VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bootsector2-test1.asm@ 97441

Last change on this file since 97441 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1; $Id: bootsector2-test1.asm 96407 2022-08-22 17:43:14Z vboxsync $
2;; @file
3; Bootsector that benchmarks I/O and MMIO roundtrip time.
4; VBoxManage setextradata bs-test1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled 1
5; VBoxManage setextradata bs-test1 VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO 1
6;
7
8;
9; Copyright (C) 2007-2022 Oracle and/or its affiliates.
10;
11; This file is part of VirtualBox base platform packages, as
12; available from https://www.virtualbox.org.
13;
14; This program is free software; you can redistribute it and/or
15; modify it under the terms of the GNU General Public License
16; as published by the Free Software Foundation, in version 3 of the
17; License.
18;
19; This program is distributed in the hope that it will be useful, but
20; WITHOUT ANY WARRANTY; without even the implied warranty of
21; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22; General Public License for more details.
23;
24; You should have received a copy of the GNU General Public License
25; along with this program; if not, see <https://www.gnu.org/licenses>.
26;
27; The contents of this file may alternatively be used under the terms
28; of the Common Development and Distribution License Version 1.0
29; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
30; in the VirtualBox distribution, in which case the provisions of the
31; CDDL are applicable instead of those of the GPL.
32;
33; You may elect to license modified versions of this file under the
34; terms and conditions of either the GPL or the CDDL or both.
35;
36; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
37;
38
39
40%include "iprt/asmdefs.mac"
41%include "iprt/x86.mac"
42%include "VBox/VMMDevTesting.mac"
43
44;; The number of instructions to test.
45%define TEST_INSTRUCTION_COUNT_IO 2000000
46
47;; The number of CPUID instructions to test.
48%define TEST_INSTRUCTION_COUNT_CPUID 8000000
49
50;; The number of RDTSC instructions to test.
51%define TEST_INSTRUCTION_COUNT_RDTSC 4000000
52
53;; The number of RDTSC instructions to test.
54%define TEST_INSTRUCTION_COUNT_READCR4 1000000
55
56;; The number of instructions to test.
57%define TEST_INSTRUCTION_COUNT_MMIO 750000
58
59;; Define this to drop unnecessary test variations.
60%define QUICK_TEST
61
62;
63; Include and execute the init code.
64;
65 %define BS2_INIT_RM
66 %define BS2_INC_PE16
67 %define BS2_INC_PE32
68 %define BS2_INC_PP32
69 %define BS2_INC_PAE32
70 %define BS2_INC_LM64
71 %include "bootsector2-common-init-code.mac"
72
73
74;
75; The benchmark driver
76;
77BEGINPROC main
78 ;
79 ; Test prologue.
80 ;
81 mov ax, .s_szTstName
82 call TestInit_r86
83 call Bs2EnableA20_r86
84 call Bs2PanicIfVMMDevTestingIsMissing_r86
85
86%if 0
87 ;
88 ; IA32_FLUSH_CMD.
89 ;
90 mov ax, .s_szTstFlushCmd
91 call TestSub_r86
92 call BenchmarkFlushCmd_rm_pp32
93 call BenchmarkFlushCmd_rm_pae32
94 call BenchmarkFlushCmd_rm_lm64
95 call BenchmarkFlushCmd_rm_pe16
96 call BenchmarkFlushCmd_rm_pe32
97 call BenchmarkFlushCmd_rm_rm
98%endif
99
100 ;
101 ; CPUID.
102 ;
103 mov ax, .s_szTstCpuId
104 call TestSub_r86
105 call BenchmarkCpuId_rm_pp32
106 call BenchmarkCpuId_rm_pae32
107 call BenchmarkCpuId_rm_lm64
108 call BenchmarkCpuId_rm_pe16
109 call BenchmarkCpuId_rm_pe32
110 call BenchmarkCpuId_rm_rm
111
112 ;
113 ; RDTSC.
114 ;
115 mov ax, .s_szTstRdTsc
116 call TestSub_r86
117 call BenchmarkRdTsc_rm_pp32
118 call BenchmarkRdTsc_rm_pae32
119 call BenchmarkRdTsc_rm_lm64
120 call BenchmarkRdTsc_rm_pe16
121 call BenchmarkRdTsc_rm_pe32
122 call BenchmarkRdTsc_rm_rm
123
124 ;
125 ; Read CR4
126 ;
127 mov ax, .s_szTstRdCr4
128 call TestSub_r86
129 call BenchmarkRdCr4_rm_pp32
130 call BenchmarkRdCr4_rm_pae32
131 call BenchmarkRdCr4_rm_lm64
132 call BenchmarkRdCr4_rm_pe16
133 call BenchmarkRdCr4_rm_pe32
134 call BenchmarkRdCr4_rm_rm
135
136 ;
137 ; I/O port access.
138 ;
139 mov ax, .s_szTstNopIoPort
140 call TestSub_r86
141 call BenchmarkIoPortNop_rm_rm
142 call BenchmarkIoPortNop_rm_pe16
143 call BenchmarkIoPortNop_rm_pe32
144 call BenchmarkIoPortNop_rm_pp32
145 call BenchmarkIoPortNop_rm_pae32
146 call BenchmarkIoPortNop_rm_lm64
147
148 ;
149 ; MMIO access.
150 ;
151 mov ax, .s_szTstNopMmio
152 call TestSub_r86
153 call BenchmarkMmioNop_rm_pp32
154 call BenchmarkMmioNop_rm_pae32
155 call BenchmarkMmioNop_rm_lm64
156 call BenchmarkMmioNop_rm_pe16
157 call BenchmarkMmioNop_rm_pe32
158 call BenchmarkMmioNop_rm_rm
159
160 ;
161 ; We're done.
162 ;
163 call TestTerm_r86
164 call Bs2Panic
165
166.s_szTstName:
167 db 'tstIOIntr', 0
168.s_szTstCpuId:
169 db 'CPUID EAX=1', 0
170.s_szTstFlushCmd:
171 db 'IA32_FLUSH_CMD', 0
172.s_szTstRdTsc:
173 db 'RDTSC', 0
174.s_szTstRdCr4:
175 db 'Read CR4', 0
176.s_szTstNopIoPort:
177 db 'NOP I/O Port Access', 0
178.s_szTstNopMmio:
179 db 'NOP MMIO Access', 0
180ENDPROC main
181
182
183;
184; Instantiate the template code.
185;
186%include "bootsector2-template-footer.mac" ; reset the initial environemnt.
187
188%define TMPL_RM
189%include "bootsector2-test1-template.mac"
190;%define TMPL_CMN_V86
191;%include "bootsector2-test1-template.mac"
192%define TMPL_PE16
193%include "bootsector2-test1-template.mac"
194%define TMPL_PE32
195%include "bootsector2-test1-template.mac"
196;%define TMPL_PP16
197;%include "bootsector2-test1-template.mac"
198%define TMPL_PP32
199%include "bootsector2-test1-template.mac"
200;%define TMPL_PAE16
201;%include "bootsector2-test1-template.mac"
202%define TMPL_PAE32
203%include "bootsector2-test1-template.mac"
204;%define TMPL_LM16
205;%include "bootsector2-test1-template.mac"
206;%define TMPL_LM32
207;%include "bootsector2-test1-template.mac"
208%define TMPL_LM64
209%include "bootsector2-test1-template.mac"
210
211
212;
213; End sections and image.
214;
215%include "bootsector2-common-end.mac"
216
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette