1 | ; $Id: bootsector2-test1.asm 87744 2021-02-12 21:00:51Z 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-2020 Oracle Corporation
|
---|
10 | ;
|
---|
11 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
13 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | ; General Public License (GPL) as published by the Free Software
|
---|
15 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | ;
|
---|
19 | ; The contents of this file may alternatively be used under the terms
|
---|
20 | ; of the Common Development and Distribution License Version 1.0
|
---|
21 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
22 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
23 | ; CDDL are applicable instead of those of the GPL.
|
---|
24 | ;
|
---|
25 | ; You may elect to license modified versions of this file under the
|
---|
26 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
27 | ;
|
---|
28 |
|
---|
29 |
|
---|
30 | %include "iprt/asmdefs.mac"
|
---|
31 | %include "iprt/x86.mac"
|
---|
32 | %include "VBox/VMMDevTesting.mac"
|
---|
33 |
|
---|
34 | ;; The number of instructions to test.
|
---|
35 | %define TEST_INSTRUCTION_COUNT_IO 2000000
|
---|
36 |
|
---|
37 | ;; The number of CPUID instructions to test.
|
---|
38 | %define TEST_INSTRUCTION_COUNT_CPUID 8000000
|
---|
39 |
|
---|
40 | ;; The number of RDTSC instructions to test.
|
---|
41 | %define TEST_INSTRUCTION_COUNT_RDTSC 4000000
|
---|
42 |
|
---|
43 | ;; The number of RDTSC instructions to test.
|
---|
44 | %define TEST_INSTRUCTION_COUNT_READCR4 1000000
|
---|
45 |
|
---|
46 | ;; The number of instructions to test.
|
---|
47 | %define TEST_INSTRUCTION_COUNT_MMIO 750000
|
---|
48 |
|
---|
49 | ;; Define this to drop unnecessary test variations.
|
---|
50 | %define QUICK_TEST
|
---|
51 |
|
---|
52 | ;
|
---|
53 | ; Include and execute the init code.
|
---|
54 | ;
|
---|
55 | %define BS2_INIT_RM
|
---|
56 | %define BS2_INC_PE16
|
---|
57 | %define BS2_INC_PE32
|
---|
58 | %define BS2_INC_PP32
|
---|
59 | %define BS2_INC_PAE32
|
---|
60 | %define BS2_INC_LM64
|
---|
61 | %include "bootsector2-common-init-code.mac"
|
---|
62 |
|
---|
63 |
|
---|
64 | ;
|
---|
65 | ; The benchmark driver
|
---|
66 | ;
|
---|
67 | BEGINPROC main
|
---|
68 | ;
|
---|
69 | ; Test prologue.
|
---|
70 | ;
|
---|
71 | mov ax, .s_szTstName
|
---|
72 | call TestInit_r86
|
---|
73 | call Bs2EnableA20_r86
|
---|
74 | call Bs2PanicIfVMMDevTestingIsMissing_r86
|
---|
75 |
|
---|
76 | %if 0
|
---|
77 | ;
|
---|
78 | ; IA32_FLUSH_CMD.
|
---|
79 | ;
|
---|
80 | mov ax, .s_szTstFlushCmd
|
---|
81 | call TestSub_r86
|
---|
82 | call BenchmarkFlushCmd_rm_pp32
|
---|
83 | call BenchmarkFlushCmd_rm_pae32
|
---|
84 | call BenchmarkFlushCmd_rm_lm64
|
---|
85 | call BenchmarkFlushCmd_rm_pe16
|
---|
86 | call BenchmarkFlushCmd_rm_pe32
|
---|
87 | call BenchmarkFlushCmd_rm_rm
|
---|
88 | %endif
|
---|
89 |
|
---|
90 | ;
|
---|
91 | ; CPUID.
|
---|
92 | ;
|
---|
93 | mov ax, .s_szTstCpuId
|
---|
94 | call TestSub_r86
|
---|
95 | call BenchmarkCpuId_rm_pp32
|
---|
96 | call BenchmarkCpuId_rm_pae32
|
---|
97 | call BenchmarkCpuId_rm_lm64
|
---|
98 | call BenchmarkCpuId_rm_pe16
|
---|
99 | call BenchmarkCpuId_rm_pe32
|
---|
100 | call BenchmarkCpuId_rm_rm
|
---|
101 |
|
---|
102 | ;
|
---|
103 | ; RDTSC.
|
---|
104 | ;
|
---|
105 | mov ax, .s_szTstRdTsc
|
---|
106 | call TestSub_r86
|
---|
107 | call BenchmarkRdTsc_rm_pp32
|
---|
108 | call BenchmarkRdTsc_rm_pae32
|
---|
109 | call BenchmarkRdTsc_rm_lm64
|
---|
110 | call BenchmarkRdTsc_rm_pe16
|
---|
111 | call BenchmarkRdTsc_rm_pe32
|
---|
112 | call BenchmarkRdTsc_rm_rm
|
---|
113 |
|
---|
114 | ;
|
---|
115 | ; Read CR4
|
---|
116 | ;
|
---|
117 | mov ax, .s_szTstRdCr4
|
---|
118 | call TestSub_r86
|
---|
119 | call BenchmarkRdCr4_rm_pp32
|
---|
120 | call BenchmarkRdCr4_rm_pae32
|
---|
121 | call BenchmarkRdCr4_rm_lm64
|
---|
122 | call BenchmarkRdCr4_rm_pe16
|
---|
123 | call BenchmarkRdCr4_rm_pe32
|
---|
124 | call BenchmarkRdCr4_rm_rm
|
---|
125 |
|
---|
126 | ;
|
---|
127 | ; I/O port access.
|
---|
128 | ;
|
---|
129 | mov ax, .s_szTstNopIoPort
|
---|
130 | call TestSub_r86
|
---|
131 | call BenchmarkIoPortNop_rm_rm
|
---|
132 | call BenchmarkIoPortNop_rm_pe16
|
---|
133 | call BenchmarkIoPortNop_rm_pe32
|
---|
134 | call BenchmarkIoPortNop_rm_pp32
|
---|
135 | call BenchmarkIoPortNop_rm_pae32
|
---|
136 | call BenchmarkIoPortNop_rm_lm64
|
---|
137 |
|
---|
138 | ;
|
---|
139 | ; MMIO access.
|
---|
140 | ;
|
---|
141 | mov ax, .s_szTstNopMmio
|
---|
142 | call TestSub_r86
|
---|
143 | call BenchmarkMmioNop_rm_pp32
|
---|
144 | call BenchmarkMmioNop_rm_pae32
|
---|
145 | call BenchmarkMmioNop_rm_lm64
|
---|
146 | call BenchmarkMmioNop_rm_pe16
|
---|
147 | call BenchmarkMmioNop_rm_pe32
|
---|
148 | call BenchmarkMmioNop_rm_rm
|
---|
149 |
|
---|
150 | ;
|
---|
151 | ; We're done.
|
---|
152 | ;
|
---|
153 | call TestTerm_r86
|
---|
154 | call Bs2Panic
|
---|
155 |
|
---|
156 | .s_szTstName:
|
---|
157 | db 'tstIOIntr', 0
|
---|
158 | .s_szTstCpuId:
|
---|
159 | db 'CPUID EAX=1', 0
|
---|
160 | .s_szTstFlushCmd:
|
---|
161 | db 'IA32_FLUSH_CMD', 0
|
---|
162 | .s_szTstRdTsc:
|
---|
163 | db 'RDTSC', 0
|
---|
164 | .s_szTstRdCr4:
|
---|
165 | db 'Read CR4', 0
|
---|
166 | .s_szTstNopIoPort:
|
---|
167 | db 'NOP I/O Port Access', 0
|
---|
168 | .s_szTstNopMmio:
|
---|
169 | db 'NOP MMIO Access', 0
|
---|
170 | ENDPROC main
|
---|
171 |
|
---|
172 |
|
---|
173 | ;
|
---|
174 | ; Instantiate the template code.
|
---|
175 | ;
|
---|
176 | %include "bootsector2-template-footer.mac" ; reset the initial environemnt.
|
---|
177 |
|
---|
178 | %define TMPL_RM
|
---|
179 | %include "bootsector2-test1-template.mac"
|
---|
180 | ;%define TMPL_CMN_V86
|
---|
181 | ;%include "bootsector2-test1-template.mac"
|
---|
182 | %define TMPL_PE16
|
---|
183 | %include "bootsector2-test1-template.mac"
|
---|
184 | %define TMPL_PE32
|
---|
185 | %include "bootsector2-test1-template.mac"
|
---|
186 | ;%define TMPL_PP16
|
---|
187 | ;%include "bootsector2-test1-template.mac"
|
---|
188 | %define TMPL_PP32
|
---|
189 | %include "bootsector2-test1-template.mac"
|
---|
190 | ;%define TMPL_PAE16
|
---|
191 | ;%include "bootsector2-test1-template.mac"
|
---|
192 | %define TMPL_PAE32
|
---|
193 | %include "bootsector2-test1-template.mac"
|
---|
194 | ;%define TMPL_LM16
|
---|
195 | ;%include "bootsector2-test1-template.mac"
|
---|
196 | ;%define TMPL_LM32
|
---|
197 | ;%include "bootsector2-test1-template.mac"
|
---|
198 | %define TMPL_LM64
|
---|
199 | %include "bootsector2-test1-template.mac"
|
---|
200 |
|
---|
201 |
|
---|
202 | ;
|
---|
203 | ; End sections and image.
|
---|
204 | ;
|
---|
205 | %include "bootsector2-common-end.mac"
|
---|
206 |
|
---|