1 | ; $Id: bootsector2-test1-template.mac 85120 2020-07-08 19:14:39Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; bootsector2 test1 - multi mode template.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2020 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 |
|
---|
28 | %include "bootsector2-template-header.mac"
|
---|
29 |
|
---|
30 | ;;
|
---|
31 | ; Run the CPUID benchmark for this mode.
|
---|
32 | ;
|
---|
33 | ; @uses nothing
|
---|
34 | ;
|
---|
35 | BEGINCODELOW
|
---|
36 | BITS 16
|
---|
37 | BEGINPROC TMPL_NM(BenchmarkFlushCmd_rm)
|
---|
38 | call TMPL_NM(Bs2IsModeSupported_rm)
|
---|
39 | jz .done
|
---|
40 | call TMPL_NM(Bs2EnterMode_rm)
|
---|
41 | BITS TMPL_BITS
|
---|
42 | push xBP
|
---|
43 | mov xBP, xSP
|
---|
44 | push sAX
|
---|
45 | push sBX
|
---|
46 | push sCX
|
---|
47 | push sDX
|
---|
48 | push sDI
|
---|
49 | sub sSP, 20h
|
---|
50 |
|
---|
51 | ; Get the current time.
|
---|
52 | mov xAX, xSP
|
---|
53 | call TMPL_NM_CMN(GetNanoTS)
|
---|
54 |
|
---|
55 | ; Do the test.
|
---|
56 | mov edi, TEST_INSTRUCTION_COUNT_IO / 4
|
---|
57 | %define MSR_IA32_FLUSH_CMD 0x10b
|
---|
58 | %define MSR_IA32_FLUSH_CMD_F_L1D RT_BIT_32(0)
|
---|
59 | mov ecx, MSR_IA32_FLUSH_CMD
|
---|
60 | mov eax, MSR_IA32_FLUSH_CMD_F_L1D
|
---|
61 | xor edx, edx
|
---|
62 | .again:
|
---|
63 | wrmsr
|
---|
64 | wrmsr
|
---|
65 | wrmsr
|
---|
66 | wrmsr
|
---|
67 | dec edi
|
---|
68 | jnz .again
|
---|
69 |
|
---|
70 | ; Calc the elapsed time and report the result.
|
---|
71 | mov xAX, xSP
|
---|
72 | call TMPL_NM_CMN(GetElapsedNanoTS)
|
---|
73 |
|
---|
74 | mov xCX, .s_szTestName
|
---|
75 | mov edx, TEST_INSTRUCTION_COUNT_IO
|
---|
76 | mov xAX, xSP
|
---|
77 | call TMPL_NM_CMN(ReportResult)
|
---|
78 |
|
---|
79 | add sSP, 20h
|
---|
80 | pop sDI
|
---|
81 | pop sDX
|
---|
82 | pop sCX
|
---|
83 | pop sBX
|
---|
84 | pop sAX
|
---|
85 | leave
|
---|
86 |
|
---|
87 | call TMPL_NM(Bs2ExitMode)
|
---|
88 | BITS 16
|
---|
89 | .done:
|
---|
90 | ret
|
---|
91 |
|
---|
92 | .s_szTestName:
|
---|
93 | db TMPL_MODE_STR, ', FLUSH_CMD', 0
|
---|
94 | ENDPROC TMPL_NM(BenchmarkFlushCmd_rm)
|
---|
95 |
|
---|
96 | TMPL_BEGINCODE
|
---|
97 | BITS TMPL_BITS
|
---|
98 |
|
---|
99 |
|
---|
100 | ;;
|
---|
101 | ; Run the CPUID benchmark for this mode.
|
---|
102 | ;
|
---|
103 | ; @uses nothing
|
---|
104 | ;
|
---|
105 | BEGINCODELOW
|
---|
106 | BITS 16
|
---|
107 | BEGINPROC TMPL_NM(BenchmarkCpuId_rm)
|
---|
108 | call TMPL_NM(Bs2IsModeSupported_rm)
|
---|
109 | jz .done
|
---|
110 | call TMPL_NM(Bs2EnterMode_rm)
|
---|
111 | BITS TMPL_BITS
|
---|
112 | push xBP
|
---|
113 | mov xBP, xSP
|
---|
114 | push sAX
|
---|
115 | push sBX
|
---|
116 | push sCX
|
---|
117 | push sDX
|
---|
118 | push sDI
|
---|
119 | sub sSP, 20h
|
---|
120 |
|
---|
121 | ; Get the current time.
|
---|
122 | mov xAX, xSP
|
---|
123 | call TMPL_NM_CMN(GetNanoTS)
|
---|
124 |
|
---|
125 | ; Do the test.
|
---|
126 | mov edi, TEST_INSTRUCTION_COUNT_IO / 4
|
---|
127 | .again:
|
---|
128 | mov eax, 1
|
---|
129 | cpuid
|
---|
130 | mov eax, 1
|
---|
131 | cpuid
|
---|
132 | mov eax, 1
|
---|
133 | cpuid
|
---|
134 | mov eax, 1
|
---|
135 | cpuid
|
---|
136 | dec edi
|
---|
137 | jnz .again
|
---|
138 |
|
---|
139 | ; Calc the elapsed time and report the result.
|
---|
140 | mov xAX, xSP
|
---|
141 | call TMPL_NM_CMN(GetElapsedNanoTS)
|
---|
142 |
|
---|
143 | mov xCX, .s_szTestName
|
---|
144 | mov edx, TEST_INSTRUCTION_COUNT_IO
|
---|
145 | mov xAX, xSP
|
---|
146 | call TMPL_NM_CMN(ReportResult)
|
---|
147 |
|
---|
148 | add sSP, 20h
|
---|
149 | pop sDI
|
---|
150 | pop sDX
|
---|
151 | pop sCX
|
---|
152 | pop sBX
|
---|
153 | pop sAX
|
---|
154 | leave
|
---|
155 |
|
---|
156 | call TMPL_NM(Bs2ExitMode)
|
---|
157 | BITS 16
|
---|
158 | .done:
|
---|
159 | ret
|
---|
160 |
|
---|
161 | .s_szTestName:
|
---|
162 | db TMPL_MODE_STR, ', CPUID', 0
|
---|
163 | ENDPROC TMPL_NM(BenchmarkCpuId_rm)
|
---|
164 |
|
---|
165 | TMPL_BEGINCODE
|
---|
166 | BITS TMPL_BITS
|
---|
167 |
|
---|
168 |
|
---|
169 | ;;
|
---|
170 | ; Run the RDTSC benchmark for this mode.
|
---|
171 | ;
|
---|
172 | ; @uses nothing
|
---|
173 | ;
|
---|
174 | BEGINCODELOW
|
---|
175 | BITS 16
|
---|
176 | BEGINPROC TMPL_NM(BenchmarkRdTsc_rm)
|
---|
177 | call TMPL_NM(Bs2IsModeSupported_rm)
|
---|
178 | jz .done
|
---|
179 | call TMPL_NM(Bs2EnterMode_rm)
|
---|
180 | BITS TMPL_BITS
|
---|
181 | push xBP
|
---|
182 | mov xBP, xSP
|
---|
183 | push sAX
|
---|
184 | push sBX
|
---|
185 | push sCX
|
---|
186 | push sDX
|
---|
187 | push sDI
|
---|
188 | sub sSP, 20h
|
---|
189 |
|
---|
190 | ; Get the current time.
|
---|
191 | mov xAX, xSP
|
---|
192 | call TMPL_NM_CMN(GetNanoTS)
|
---|
193 |
|
---|
194 | ; Do the test.
|
---|
195 | mov edi, TEST_INSTRUCTION_COUNT_RDTSC / 4
|
---|
196 | .again:
|
---|
197 | rdtsc
|
---|
198 | rdtsc
|
---|
199 | rdtsc
|
---|
200 | rdtsc
|
---|
201 | dec edi
|
---|
202 | jnz .again
|
---|
203 |
|
---|
204 | ; Calc the elapsed time and report the result.
|
---|
205 | mov xAX, xSP
|
---|
206 | call TMPL_NM_CMN(GetElapsedNanoTS)
|
---|
207 |
|
---|
208 | mov xCX, .s_szTestName
|
---|
209 | mov edx, TEST_INSTRUCTION_COUNT_RDTSC
|
---|
210 | mov xAX, xSP
|
---|
211 | call TMPL_NM_CMN(ReportResult)
|
---|
212 |
|
---|
213 | add sSP, 20h
|
---|
214 | pop sDI
|
---|
215 | pop sDX
|
---|
216 | pop sCX
|
---|
217 | pop sBX
|
---|
218 | pop sAX
|
---|
219 | leave
|
---|
220 |
|
---|
221 | call TMPL_NM(Bs2ExitMode)
|
---|
222 | BITS 16
|
---|
223 | .done:
|
---|
224 | ret
|
---|
225 |
|
---|
226 | .s_szTestName:
|
---|
227 | db TMPL_MODE_STR, ', RDTSC', 0
|
---|
228 | ENDPROC TMPL_NM(BenchmarkRdTsc_rm)
|
---|
229 |
|
---|
230 | TMPL_BEGINCODE
|
---|
231 | BITS TMPL_BITS
|
---|
232 |
|
---|
233 |
|
---|
234 | ;;
|
---|
235 | ; Run the Read CR4 benchmark for this mode.
|
---|
236 | ;
|
---|
237 | ; @uses nothing
|
---|
238 | ;
|
---|
239 | BEGINCODELOW
|
---|
240 | BITS 16
|
---|
241 | BEGINPROC TMPL_NM(BenchmarkRdCr4_rm)
|
---|
242 | call TMPL_NM(Bs2IsModeSupported_rm)
|
---|
243 | jz .done
|
---|
244 | call TMPL_NM(Bs2EnterMode_rm)
|
---|
245 | BITS TMPL_BITS
|
---|
246 | push xBP
|
---|
247 | mov xBP, xSP
|
---|
248 | push sAX
|
---|
249 | push sBX
|
---|
250 | push sCX
|
---|
251 | push sDX
|
---|
252 | push sDI
|
---|
253 | sub sSP, 20h
|
---|
254 |
|
---|
255 | ; Get the current time.
|
---|
256 | mov xAX, xSP
|
---|
257 | call TMPL_NM_CMN(GetNanoTS)
|
---|
258 |
|
---|
259 | ; Do the test.
|
---|
260 | mov edi, TEST_INSTRUCTION_COUNT_READCR4 / 4
|
---|
261 | .again:
|
---|
262 | mov sAX, cr4
|
---|
263 | mov sAX, cr4
|
---|
264 | mov sAX, cr4
|
---|
265 | mov sAX, cr4
|
---|
266 | dec edi
|
---|
267 | jnz .again
|
---|
268 |
|
---|
269 | ; Calc the elapsed time and report the result.
|
---|
270 | mov xAX, xSP
|
---|
271 | call TMPL_NM_CMN(GetElapsedNanoTS)
|
---|
272 |
|
---|
273 | mov xCX, .s_szTestName
|
---|
274 | mov edx, TEST_INSTRUCTION_COUNT_READCR4
|
---|
275 | mov xAX, xSP
|
---|
276 | call TMPL_NM_CMN(ReportResult)
|
---|
277 |
|
---|
278 | add sSP, 20h
|
---|
279 | pop sDI
|
---|
280 | pop sDX
|
---|
281 | pop sCX
|
---|
282 | pop sBX
|
---|
283 | pop sAX
|
---|
284 | leave
|
---|
285 |
|
---|
286 | call TMPL_NM(Bs2ExitMode)
|
---|
287 | BITS 16
|
---|
288 | .done:
|
---|
289 | ret
|
---|
290 |
|
---|
291 | .s_szTestName:
|
---|
292 | db TMPL_MODE_STR, ', Read CR4', 0
|
---|
293 | ENDPROC TMPL_NM(BenchmarkRdCr4_rm)
|
---|
294 |
|
---|
295 | TMPL_BEGINCODE
|
---|
296 | BITS TMPL_BITS
|
---|
297 |
|
---|
298 |
|
---|
299 | ;;
|
---|
300 | ; Prologue for the I/O port tests.
|
---|
301 | %ifndef HaveIoPortPrologue
|
---|
302 | %define HaveIoPortPrologue
|
---|
303 | %macro IoPortPrologue 2
|
---|
304 | push xBP
|
---|
305 | mov xBP, xSP
|
---|
306 | push sAX
|
---|
307 | push sDX
|
---|
308 | push sCX
|
---|
309 | sub xSP, 20h
|
---|
310 |
|
---|
311 | ; Get the current time.
|
---|
312 | mov xAX, xSP
|
---|
313 | call TMPL_NM_CMN(GetNanoTS)
|
---|
314 |
|
---|
315 | ; Do the test.
|
---|
316 | mov dx, %2
|
---|
317 | mov ecx, (%1) / 5
|
---|
318 | %endmacro
|
---|
319 | %endif
|
---|
320 |
|
---|
321 |
|
---|
322 | ;;
|
---|
323 | ; Epilogue for the I/O port tests.
|
---|
324 | %ifndef HaveIoPortEpilogue
|
---|
325 | %define HaveIoPortEpilogue
|
---|
326 | %macro IoPortEpilogue 1
|
---|
327 | ; Calc the elapsed time and report the result.
|
---|
328 | mov xAX, xSP
|
---|
329 | call TMPL_NM_CMN(GetElapsedNanoTS)
|
---|
330 |
|
---|
331 | mov xCX, .s_szTestName
|
---|
332 | mov edx, (%1)
|
---|
333 | mov xAX, xSP
|
---|
334 | call TMPL_NM_CMN(ReportResult)
|
---|
335 |
|
---|
336 | add xSP, 20h
|
---|
337 | pop sCX
|
---|
338 | pop sDX
|
---|
339 | pop sAX
|
---|
340 | leave
|
---|
341 | ret
|
---|
342 | %endmacro
|
---|
343 | %endif
|
---|
344 |
|
---|
345 |
|
---|
346 | ;;
|
---|
347 | ; Benchmarks: IN eax, NOP
|
---|
348 | ;
|
---|
349 | ; @uses nothing
|
---|
350 | ;
|
---|
351 | BEGINPROC TMPL_NM(BenchmarkIoPortNop32In)
|
---|
352 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
|
---|
353 | .again:
|
---|
354 | in eax, dx
|
---|
355 | in eax, dx
|
---|
356 | in eax, dx
|
---|
357 | in eax, dx
|
---|
358 | in eax, dx
|
---|
359 | dec ecx
|
---|
360 | jnz .again
|
---|
361 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
362 | .s_szTestName:
|
---|
363 | db TMPL_MODE_STR, ', 32-bit IN', 0
|
---|
364 | ENDPROC TMPL_NM(BenchmarkIoPortNop32In)
|
---|
365 |
|
---|
366 |
|
---|
367 | ;;
|
---|
368 | ; Benchmarks: OUT NOP, eax
|
---|
369 | ;
|
---|
370 | ; @uses nothing
|
---|
371 | ;
|
---|
372 | BEGINPROC TMPL_NM(BenchmarkIoPortNop32Out)
|
---|
373 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
|
---|
374 | .again:
|
---|
375 | out dx, eax
|
---|
376 | out dx, eax
|
---|
377 | out dx, eax
|
---|
378 | out dx, eax
|
---|
379 | out dx, eax
|
---|
380 | dec ecx
|
---|
381 | jnz .again
|
---|
382 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
383 | .s_szTestName:
|
---|
384 | db TMPL_MODE_STR, ', 32-bit OUT', 0
|
---|
385 | ENDPROC TMPL_NM(BenchmarkIoPortNop32Out)
|
---|
386 |
|
---|
387 |
|
---|
388 | ;;
|
---|
389 | ; Benchmarks: IN ax, NOP
|
---|
390 | ;
|
---|
391 | ; @uses nothing
|
---|
392 | ;
|
---|
393 | BEGINPROC TMPL_NM(BenchmarkIoPortNop16In)
|
---|
394 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
|
---|
395 | .again:
|
---|
396 | in ax, dx
|
---|
397 | in ax, dx
|
---|
398 | in ax, dx
|
---|
399 | in ax, dx
|
---|
400 | in ax, dx
|
---|
401 | dec ecx
|
---|
402 | jnz .again
|
---|
403 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
404 | .s_szTestName:
|
---|
405 | db TMPL_MODE_STR, ', 16-bit IN', 0
|
---|
406 | ENDPROC TMPL_NM(BenchmarkIoPortNop16In)
|
---|
407 |
|
---|
408 |
|
---|
409 | ;;
|
---|
410 | ; Benchmarks: OUT NOP, ax
|
---|
411 | ;
|
---|
412 | ; @uses nothing
|
---|
413 | ;
|
---|
414 | BEGINPROC TMPL_NM(BenchmarkIoPortNop16Out)
|
---|
415 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
|
---|
416 | .again:
|
---|
417 | out dx, ax
|
---|
418 | out dx, ax
|
---|
419 | out dx, ax
|
---|
420 | out dx, ax
|
---|
421 | out dx, ax
|
---|
422 | dec ecx
|
---|
423 | jnz .again
|
---|
424 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
425 | .s_szTestName:
|
---|
426 | db TMPL_MODE_STR, ', 16-bit OUT', 0
|
---|
427 | ENDPROC TMPL_NM(BenchmarkIoPortNop16Out)
|
---|
428 |
|
---|
429 |
|
---|
430 | ;;
|
---|
431 | ; Benchmarks: IN al, NOP
|
---|
432 | ;
|
---|
433 | ; @uses nothing
|
---|
434 | ;
|
---|
435 | BEGINPROC TMPL_NM(BenchmarkIoPortNop8In)
|
---|
436 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
|
---|
437 | .again:
|
---|
438 | in al, dx
|
---|
439 | in al, dx
|
---|
440 | in al, dx
|
---|
441 | in al, dx
|
---|
442 | in al, dx
|
---|
443 | dec ecx
|
---|
444 | jnz .again
|
---|
445 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
446 | .s_szTestName:
|
---|
447 | db TMPL_MODE_STR, ', 8-bit IN', 0
|
---|
448 | ENDPROC TMPL_NM(BenchmarkIoPortNop8In)
|
---|
449 |
|
---|
450 |
|
---|
451 | ;;
|
---|
452 | ; Benchmarks: OUT NOP, al
|
---|
453 | ;
|
---|
454 | ; @uses nothing
|
---|
455 | ;
|
---|
456 | BEGINPROC TMPL_NM(BenchmarkIoPortNop8Out)
|
---|
457 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
|
---|
458 | .again:
|
---|
459 | out dx, al
|
---|
460 | out dx, al
|
---|
461 | out dx, al
|
---|
462 | out dx, al
|
---|
463 | out dx, al
|
---|
464 | dec ecx
|
---|
465 | jnz .again
|
---|
466 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
467 | .s_szTestName:
|
---|
468 | db TMPL_MODE_STR, ', 8-bit OUT', 0
|
---|
469 | ENDPROC TMPL_NM(BenchmarkIoPortNop8Out)
|
---|
470 |
|
---|
471 |
|
---|
472 | ;;
|
---|
473 | ; Benchmarks: IN eax, NOP_R3
|
---|
474 | ;
|
---|
475 | ; @uses nothing
|
---|
476 | ;
|
---|
477 | BEGINPROC TMPL_NM(BenchmarkIoPortRing3Nop32In)
|
---|
478 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP_R3
|
---|
479 | .again:
|
---|
480 | in eax, dx
|
---|
481 | in eax, dx
|
---|
482 | in eax, dx
|
---|
483 | in eax, dx
|
---|
484 | in eax, dx
|
---|
485 | dec ecx
|
---|
486 | jnz .again
|
---|
487 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
488 | .s_szTestName:
|
---|
489 | db TMPL_MODE_STR, ', 32-bit IN-to-ring-3', 0
|
---|
490 | ENDPROC TMPL_NM(BenchmarkIoPortRing3Nop32In)
|
---|
491 |
|
---|
492 |
|
---|
493 | ;;
|
---|
494 | ; Benchmarks: OUT NOP_R3, eax
|
---|
495 | ;
|
---|
496 | ; @uses nothing
|
---|
497 | ;
|
---|
498 | BEGINPROC TMPL_NM(BenchmarkIoPortRing3Nop32Out)
|
---|
499 | IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP_R3
|
---|
500 | .again:
|
---|
501 | out dx, eax
|
---|
502 | out dx, eax
|
---|
503 | out dx, eax
|
---|
504 | out dx, eax
|
---|
505 | out dx, eax
|
---|
506 | dec ecx
|
---|
507 | jnz .again
|
---|
508 | IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
|
---|
509 | .s_szTestName:
|
---|
510 | db TMPL_MODE_STR, ', 32-bit OUT-to-ring-3', 0
|
---|
511 | ENDPROC TMPL_NM(BenchmarkIoPortRing3Nop32Out)
|
---|
512 |
|
---|
513 |
|
---|
514 | %undef IoPortPrologue
|
---|
515 | %undef IoPortEpilogue
|
---|
516 |
|
---|
517 |
|
---|
518 | ;;
|
---|
519 | ; Run the I/O benchmarks for this mode.
|
---|
520 | ;
|
---|
521 | ; @uses nothing
|
---|
522 | ;
|
---|
523 | BEGINCODELOW
|
---|
524 | BITS 16
|
---|
525 | BEGINPROC TMPL_NM(BenchmarkIoPortNop_rm)
|
---|
526 | call TMPL_NM(Bs2IsModeSupported_rm)
|
---|
527 | jz .done
|
---|
528 | call TMPL_NM(Bs2EnterMode_rm)
|
---|
529 | BITS TMPL_BITS
|
---|
530 |
|
---|
531 | call TMPL_NM(BenchmarkIoPortNop32In)
|
---|
532 | call TMPL_NM(BenchmarkIoPortNop32Out)
|
---|
533 | %ifndef QUICK_TEST
|
---|
534 | call TMPL_NM(BenchmarkIoPortNop16In)
|
---|
535 | call TMPL_NM(BenchmarkIoPortNop16Out)
|
---|
536 | call TMPL_NM(BenchmarkIoPortNop8In)
|
---|
537 | call TMPL_NM(BenchmarkIoPortNop8Out)
|
---|
538 | %endif
|
---|
539 | call TMPL_NM(BenchmarkIoPortRing3Nop32In)
|
---|
540 | call TMPL_NM(BenchmarkIoPortRing3Nop32Out)
|
---|
541 |
|
---|
542 | call TMPL_NM(Bs2ExitMode)
|
---|
543 | BITS 16
|
---|
544 | .done:
|
---|
545 | ret
|
---|
546 | ENDPROC TMPL_NM(BenchmarkIoPortNop_rm)
|
---|
547 |
|
---|
548 | TMPL_BEGINCODE
|
---|
549 | BITS TMPL_BITS
|
---|
550 |
|
---|
551 |
|
---|
552 |
|
---|
553 |
|
---|
554 | ;;
|
---|
555 | ; Prologue for the MMIO tests.
|
---|
556 | %ifndef HaveMmioPrologue
|
---|
557 | %define HaveMmioPrologue
|
---|
558 | %macro MmioPrologue 2
|
---|
559 | push xBP
|
---|
560 | mov xBP, xSP
|
---|
561 | push sAX
|
---|
562 | push sDX
|
---|
563 | push sCX
|
---|
564 | push sBX
|
---|
565 | sub xSP, 20h
|
---|
566 |
|
---|
567 | ; Get the current time.
|
---|
568 | mov xAX, xSP
|
---|
569 | call TMPL_NM_CMN(GetNanoTS)
|
---|
570 |
|
---|
571 | ; Do the test - X million 32-bit IN instructions.
|
---|
572 | %ifdef TMPL_16BIT
|
---|
573 | mov dx, ds ; save ds
|
---|
574 | %ifdef TMPL_RM
|
---|
575 | mov bx, VMMDEV_TESTING_MMIO_RM_SEL
|
---|
576 | mov ds, bx
|
---|
577 | mov ebx, VMMDEV_TESTING_MMIO_RM_OFF(%2)
|
---|
578 | %else
|
---|
579 | mov bx, BS2_SEL_MMIO16
|
---|
580 | mov ds, bx
|
---|
581 | mov ebx, %2 - BS2_SEL_MMIO16_BASE
|
---|
582 | %endif
|
---|
583 | %else
|
---|
584 | mov xBX, %2
|
---|
585 | %endif
|
---|
586 | mov ecx, (%1) / 5
|
---|
587 | %endmacro
|
---|
588 | %endif
|
---|
589 |
|
---|
590 | ;;
|
---|
591 | ; Epilogue for the MMIO tests.
|
---|
592 | %ifndef HaveMmioEpilogue
|
---|
593 | %define HaveMmioEpilogue
|
---|
594 | %macro MmioEpilogue 1
|
---|
595 | %ifdef TMPL_16BIT
|
---|
596 | mov ds, dx ; restore ds
|
---|
597 | %endif
|
---|
598 |
|
---|
599 | ; Calc the elapsed time and report the result.
|
---|
600 | mov xAX, xSP
|
---|
601 | call TMPL_NM_CMN(GetElapsedNanoTS)
|
---|
602 |
|
---|
603 | mov xCX, .s_szTestName
|
---|
604 | mov edx, (%1)
|
---|
605 | mov xAX, xSP
|
---|
606 | call TMPL_NM_CMN(ReportResult)
|
---|
607 |
|
---|
608 | add xSP, 20h
|
---|
609 | pop sBX
|
---|
610 | pop sCX
|
---|
611 | pop sDX
|
---|
612 | pop sAX
|
---|
613 | leave
|
---|
614 | ret
|
---|
615 | %endmacro
|
---|
616 | %endif
|
---|
617 |
|
---|
618 |
|
---|
619 | ;;
|
---|
620 | ; Benchmarks: MOV eax, [NOP]
|
---|
621 | ;
|
---|
622 | ; @uses nothing
|
---|
623 | ;
|
---|
624 | BEGINPROC TMPL_NM(BenchmarkMmioNop32Read)
|
---|
625 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP
|
---|
626 | .again:
|
---|
627 | mov eax, [sBX]
|
---|
628 | mov eax, [sBX]
|
---|
629 | mov eax, [sBX]
|
---|
630 | mov eax, [sBX]
|
---|
631 | mov eax, [sBX]
|
---|
632 | dec ecx
|
---|
633 | jnz .again
|
---|
634 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
635 | .s_szTestName:
|
---|
636 | db TMPL_MODE_STR, ', 32-bit read', 0
|
---|
637 | ENDPROC TMPL_NM(BenchmarkMmioNop32Read)
|
---|
638 |
|
---|
639 |
|
---|
640 | ;;
|
---|
641 | ; Benchmarks: MOV [NOP], eax
|
---|
642 | ;
|
---|
643 | ; @uses nothing
|
---|
644 | ;
|
---|
645 | BEGINPROC TMPL_NM(BenchmarkMmioNop32Write)
|
---|
646 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP
|
---|
647 | .again:
|
---|
648 | mov [sBX], eax
|
---|
649 | mov [sBX], eax
|
---|
650 | mov [sBX], eax
|
---|
651 | mov [sBX], eax
|
---|
652 | mov [sBX], eax
|
---|
653 | dec ecx
|
---|
654 | jnz .again
|
---|
655 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
656 | .s_szTestName:
|
---|
657 | db TMPL_MODE_STR, ', 32-bit write', 0
|
---|
658 | ENDPROC TMPL_NM(BenchmarkMmioNop32Write)
|
---|
659 |
|
---|
660 |
|
---|
661 | ;;
|
---|
662 | ; Benchmarks: MOV ax, [NOP]
|
---|
663 | ;
|
---|
664 | ; @uses nothing
|
---|
665 | ;
|
---|
666 | BEGINPROC TMPL_NM(BenchmarkMmioNop16Read)
|
---|
667 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP
|
---|
668 | .again:
|
---|
669 | mov ax, [xBX]
|
---|
670 | mov ax, [xBX]
|
---|
671 | mov ax, [xBX]
|
---|
672 | mov ax, [xBX]
|
---|
673 | mov ax, [xBX]
|
---|
674 | dec ecx
|
---|
675 | jnz .again
|
---|
676 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
677 | .s_szTestName:
|
---|
678 | db TMPL_MODE_STR, ', 16-bit read', 0
|
---|
679 | ENDPROC TMPL_NM(BenchmarkMmioNop16Read)
|
---|
680 |
|
---|
681 |
|
---|
682 | ;;
|
---|
683 | ; Benchmarks: MOV [NOP], ax
|
---|
684 | ;
|
---|
685 | ; @uses nothing
|
---|
686 | ;
|
---|
687 | BEGINPROC TMPL_NM(BenchmarkMmioNop16Write)
|
---|
688 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP
|
---|
689 | .again:
|
---|
690 | mov [xBX], ax
|
---|
691 | mov [xBX], ax
|
---|
692 | mov [xBX], ax
|
---|
693 | mov [xBX], ax
|
---|
694 | mov [xBX], ax
|
---|
695 | dec ecx
|
---|
696 | jnz .again
|
---|
697 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
698 | .s_szTestName:
|
---|
699 | db TMPL_MODE_STR, ', 16-bit write', 0
|
---|
700 | ENDPROC TMPL_NM(BenchmarkMmioNop16Write)
|
---|
701 |
|
---|
702 |
|
---|
703 | ;;
|
---|
704 | ; Benchmarks: MOV al, [NOP]
|
---|
705 | ;
|
---|
706 | ; @uses nothing
|
---|
707 | ;
|
---|
708 | BEGINPROC TMPL_NM(BenchmarkMmioNop8Read)
|
---|
709 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP
|
---|
710 | .again:
|
---|
711 | mov al, [xBX]
|
---|
712 | mov al, [xBX]
|
---|
713 | mov al, [xBX]
|
---|
714 | mov al, [xBX]
|
---|
715 | mov al, [xBX]
|
---|
716 | dec ecx
|
---|
717 | jnz .again
|
---|
718 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
719 | .s_szTestName:
|
---|
720 | db TMPL_MODE_STR, ', 8-bit read', 0
|
---|
721 | ENDPROC TMPL_NM(BenchmarkMmioNop8Read)
|
---|
722 |
|
---|
723 |
|
---|
724 | ;;
|
---|
725 | ; Benchmarks: MOV [NOP], al
|
---|
726 | ;
|
---|
727 | ; @uses nothing
|
---|
728 | ;
|
---|
729 | BEGINPROC TMPL_NM(BenchmarkMmioNop8Write)
|
---|
730 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP
|
---|
731 | .again:
|
---|
732 | mov [xBX], al
|
---|
733 | mov [xBX], al
|
---|
734 | mov [xBX], al
|
---|
735 | mov [xBX], al
|
---|
736 | mov [xBX], al
|
---|
737 | dec ecx
|
---|
738 | jnz .again
|
---|
739 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
740 | .s_szTestName:
|
---|
741 | db TMPL_MODE_STR, ', 8-bit write', 0
|
---|
742 | ENDPROC TMPL_NM(BenchmarkMmioNop8Write)
|
---|
743 |
|
---|
744 |
|
---|
745 | ;;
|
---|
746 | ; Benchmarks: MOV eax, [NOP_R3]
|
---|
747 | ;
|
---|
748 | ; @uses nothing
|
---|
749 | ;
|
---|
750 | BEGINPROC TMPL_NM(BenchmarkMmioRing3Nop32Read)
|
---|
751 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP_R3
|
---|
752 | .again:
|
---|
753 | mov eax, [sBX]
|
---|
754 | mov eax, [sBX]
|
---|
755 | mov eax, [sBX]
|
---|
756 | mov eax, [sBX]
|
---|
757 | mov eax, [sBX]
|
---|
758 | dec ecx
|
---|
759 | jnz .again
|
---|
760 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
761 | .s_szTestName:
|
---|
762 | db TMPL_MODE_STR, ', 32-bit read-to-ring-3', 0
|
---|
763 | ENDPROC TMPL_NM(BenchmarkMmioRing3Nop32Read)
|
---|
764 |
|
---|
765 |
|
---|
766 | ;;
|
---|
767 | ; Benchmarks: MOV [NOP_R3], eax
|
---|
768 | ;
|
---|
769 | ; @uses nothing
|
---|
770 | ;
|
---|
771 | BEGINPROC TMPL_NM(BenchmarkMmioRing3Nop32Write)
|
---|
772 | MmioPrologue TEST_INSTRUCTION_COUNT_MMIO, VMMDEV_TESTING_MMIO_NOP_R3
|
---|
773 | .again:
|
---|
774 | mov [sBX], eax
|
---|
775 | mov [sBX], eax
|
---|
776 | mov [sBX], eax
|
---|
777 | mov [sBX], eax
|
---|
778 | mov [sBX], eax
|
---|
779 | dec ecx
|
---|
780 | jnz .again
|
---|
781 | MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
|
---|
782 | .s_szTestName:
|
---|
783 | db TMPL_MODE_STR, ', 32-bit write-to-ring-3', 0
|
---|
784 | ENDPROC TMPL_NM(BenchmarkMmioRing3Nop32Write)
|
---|
785 |
|
---|
786 |
|
---|
787 | %undef MmioPrologue
|
---|
788 | %undef MmioEpilogue
|
---|
789 |
|
---|
790 |
|
---|
791 | ;;
|
---|
792 | ; Do the MMIO tests for this mode.
|
---|
793 | ;
|
---|
794 | ; @uses nothing
|
---|
795 | ;
|
---|
796 | BEGINCODELOW
|
---|
797 | BITS 16
|
---|
798 | BEGINPROC TMPL_NM(BenchmarkMmioNop_rm)
|
---|
799 | call TMPL_NM(Bs2IsModeSupported_rm)
|
---|
800 | jz .done
|
---|
801 | call TMPL_NM(Bs2EnterMode_rm)
|
---|
802 | BITS TMPL_BITS
|
---|
803 |
|
---|
804 | call TMPL_NM(BenchmarkMmioNop32Read)
|
---|
805 | call TMPL_NM(BenchmarkMmioNop32Write)
|
---|
806 | %ifndef QUICK_TEST
|
---|
807 | call TMPL_NM(BenchmarkMmioNop16Read)
|
---|
808 | call TMPL_NM(BenchmarkMmioNop16Write)
|
---|
809 | call TMPL_NM(BenchmarkMmioNop8Read)
|
---|
810 | call TMPL_NM(BenchmarkMmioNop8Write)
|
---|
811 | %endif
|
---|
812 | call TMPL_NM(BenchmarkMmioRing3Nop32Read)
|
---|
813 | call TMPL_NM(BenchmarkMmioRing3Nop32Write)
|
---|
814 |
|
---|
815 | call TMPL_NM(Bs2ExitMode)
|
---|
816 | BITS 16
|
---|
817 | .done:
|
---|
818 | ret
|
---|
819 | ENDPROC TMPL_NM(BenchmarkMmioNop_rm)
|
---|
820 |
|
---|
821 | TMPL_BEGINCODE
|
---|
822 | BITS TMPL_BITS
|
---|
823 |
|
---|
824 |
|
---|
825 | %include "bootsector2-template-footer.mac"
|
---|
826 |
|
---|