1 | ; $Id: bootsector2-test1.asm 53195 2014-11-04 12:44:27Z 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-2014 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 RDTSC instructions to test.
|
---|
38 | %define TEST_INSTRUCTION_COUNT_RDTSC 4000000
|
---|
39 |
|
---|
40 | ;; The number of instructions to test.
|
---|
41 | %define TEST_INSTRUCTION_COUNT_MMIO 750000
|
---|
42 |
|
---|
43 | ;; Define this to drop unnecessary test variations.
|
---|
44 | %define QUICK_TEST
|
---|
45 |
|
---|
46 | ;
|
---|
47 | ; Include and execute the init code.
|
---|
48 | ;
|
---|
49 | %define BS2_INIT_RM
|
---|
50 | %define BS2_INC_PE16
|
---|
51 | %define BS2_INC_PE32
|
---|
52 | %define BS2_INC_PP32
|
---|
53 | %define BS2_INC_PAE32
|
---|
54 | %define BS2_INC_LM64
|
---|
55 | %include "bootsector2-common-init-code.mac"
|
---|
56 |
|
---|
57 |
|
---|
58 | ;
|
---|
59 | ; The benchmark driver
|
---|
60 | ;
|
---|
61 | BEGINPROC main
|
---|
62 | ;
|
---|
63 | ; Test prologue.
|
---|
64 | ;
|
---|
65 | mov ax, .s_szTstName
|
---|
66 | call TestInit_r86
|
---|
67 | call Bs2EnableA20_r86
|
---|
68 | call Bs2PanicIfVMMDevTestingIsMissing_r86
|
---|
69 |
|
---|
70 | ;
|
---|
71 | ; CPUID.
|
---|
72 | ;
|
---|
73 | mov ax, .s_szTstCpuId
|
---|
74 | call TestSub_r86
|
---|
75 | call BenchmarkCpuId_rm_pp32
|
---|
76 | call BenchmarkCpuId_rm_pae32
|
---|
77 | call BenchmarkCpuId_rm_lm64
|
---|
78 | call BenchmarkCpuId_rm_pe16
|
---|
79 | call BenchmarkCpuId_rm_pe32
|
---|
80 | call BenchmarkCpuId_rm_rm
|
---|
81 |
|
---|
82 | ;
|
---|
83 | ; RDTSC.
|
---|
84 | ;
|
---|
85 | mov ax, .s_szTstRdTsc
|
---|
86 | call TestSub_r86
|
---|
87 | call BenchmarkRdTsc_rm_pp32
|
---|
88 | call BenchmarkRdTsc_rm_pae32
|
---|
89 | call BenchmarkRdTsc_rm_lm64
|
---|
90 | call BenchmarkRdTsc_rm_pe16
|
---|
91 | call BenchmarkRdTsc_rm_pe32
|
---|
92 | call BenchmarkRdTsc_rm_rm
|
---|
93 |
|
---|
94 | ;
|
---|
95 | ; I/O port access.
|
---|
96 | ;
|
---|
97 | mov ax, .s_szTstNopIoPort
|
---|
98 | call TestSub_r86
|
---|
99 | call BenchmarkIoPortNop_rm_rm
|
---|
100 | call BenchmarkIoPortNop_rm_pe16
|
---|
101 | call BenchmarkIoPortNop_rm_pe32
|
---|
102 | call BenchmarkIoPortNop_rm_pp32
|
---|
103 | call BenchmarkIoPortNop_rm_pae32
|
---|
104 | call BenchmarkIoPortNop_rm_lm64
|
---|
105 |
|
---|
106 | ;
|
---|
107 | ; MMIO access.
|
---|
108 | ;
|
---|
109 | mov ax, .s_szTstNopMmio
|
---|
110 | call TestSub_r86
|
---|
111 | call BenchmarkMmioNop_rm_pp32
|
---|
112 | call BenchmarkMmioNop_rm_pae32
|
---|
113 | call BenchmarkMmioNop_rm_lm64
|
---|
114 | call BenchmarkMmioNop_rm_pe16
|
---|
115 | call BenchmarkMmioNop_rm_pe32
|
---|
116 | call BenchmarkMmioNop_rm_rm
|
---|
117 |
|
---|
118 | ;
|
---|
119 | ; We're done.
|
---|
120 | ;
|
---|
121 | call TestTerm_r86
|
---|
122 | call Bs2Panic
|
---|
123 |
|
---|
124 | .s_szTstName:
|
---|
125 | db 'tstIOIntr', 0
|
---|
126 | .s_szTstCpuId:
|
---|
127 | db 'CPUID EAX=1', 0
|
---|
128 | .s_szTstRdTsc:
|
---|
129 | db 'RDTSC', 0
|
---|
130 | .s_szTstNopIoPort:
|
---|
131 | db 'NOP I/O Port Access', 0
|
---|
132 | .s_szTstNopMmio:
|
---|
133 | db 'NOP MMIO Access', 0
|
---|
134 | ENDPROC main
|
---|
135 |
|
---|
136 |
|
---|
137 | ;
|
---|
138 | ; Instantiate the template code.
|
---|
139 | ;
|
---|
140 | %include "bootsector2-template-footer.mac" ; reset the initial environemnt.
|
---|
141 |
|
---|
142 | %define TMPL_RM
|
---|
143 | %include "bootsector2-test1-template.mac"
|
---|
144 | ;%define TMPL_CMN_V86
|
---|
145 | ;%include "bootsector2-test1-template.mac"
|
---|
146 | %define TMPL_PE16
|
---|
147 | %include "bootsector2-test1-template.mac"
|
---|
148 | %define TMPL_PE32
|
---|
149 | %include "bootsector2-test1-template.mac"
|
---|
150 | ;%define TMPL_PP16
|
---|
151 | ;%include "bootsector2-test1-template.mac"
|
---|
152 | %define TMPL_PP32
|
---|
153 | %include "bootsector2-test1-template.mac"
|
---|
154 | ;%define TMPL_PAE16
|
---|
155 | ;%include "bootsector2-test1-template.mac"
|
---|
156 | %define TMPL_PAE32
|
---|
157 | %include "bootsector2-test1-template.mac"
|
---|
158 | ;%define TMPL_LM16
|
---|
159 | ;%include "bootsector2-test1-template.mac"
|
---|
160 | ;%define TMPL_LM32
|
---|
161 | ;%include "bootsector2-test1-template.mac"
|
---|
162 | %define TMPL_LM64
|
---|
163 | %include "bootsector2-test1-template.mac"
|
---|
164 |
|
---|
165 |
|
---|
166 | ;
|
---|
167 | ; End sections and image.
|
---|
168 | ;
|
---|
169 | %include "bootsector2-common-end.mac"
|
---|
170 |
|
---|