1 | ; $Id: bs3-cpu-basic-2-template.mac 93115 2022-01-01 11:31:46Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - bs3-cpu-basic-2 assembly template.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2022 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 | ;*********************************************************************************************************************************
|
---|
29 | ;* Header Files *
|
---|
30 | ;*********************************************************************************************************************************
|
---|
31 | %include "bs3kit-template-header.mac" ; setup environment
|
---|
32 |
|
---|
33 |
|
---|
34 | ;*********************************************************************************************************************************
|
---|
35 | ;* Defined Constants And Macros *
|
---|
36 | ;*********************************************************************************************************************************
|
---|
37 | %ifndef BS3_CPUBAS2_UD_OFF_DEFINED
|
---|
38 | %define BS3_CPUBAS2_UD_OFF_DEFINED
|
---|
39 | %macro BS3_CPUBAS2_UD_OFF 1
|
---|
40 | BS3_GLOBAL_NAME_EX BS3_CMN_NM(%1) %+ _offUD, , 1
|
---|
41 | db BS3_CMN_NM(%1).again - BS3_CMN_NM(%1)
|
---|
42 | %endmacro
|
---|
43 | %endif
|
---|
44 |
|
---|
45 |
|
---|
46 | ;*********************************************************************************************************************************
|
---|
47 | ;* External Symbols *
|
---|
48 | ;*********************************************************************************************************************************
|
---|
49 | TMPL_BEGIN_TEXT
|
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 | ;
|
---|
54 | ; Test code snippets containing code which differs between 16-bit, 32-bit
|
---|
55 | ; and 64-bit CPUs modes.
|
---|
56 | ;
|
---|
57 | %ifdef BS3_INSTANTIATING_CMN
|
---|
58 |
|
---|
59 | ;
|
---|
60 | ; SIDT
|
---|
61 | ;
|
---|
62 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_bx_ud2
|
---|
63 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_bx_ud2, BS3_PBC_NEAR
|
---|
64 | sidt [xBX]
|
---|
65 | .again: ud2
|
---|
66 | jmp .again
|
---|
67 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_bx_ud2) == 3)
|
---|
68 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_bx_ud2
|
---|
69 |
|
---|
70 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_opsize_bx_ud2
|
---|
71 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_bx_ud2, BS3_PBC_NEAR
|
---|
72 | db X86_OP_PRF_SIZE_OP
|
---|
73 | sidt [xBX]
|
---|
74 | .again: ud2
|
---|
75 | jmp .again
|
---|
76 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_bx_ud2) == 4)
|
---|
77 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_bx_ud2
|
---|
78 |
|
---|
79 | %if TMPL_BITS == 64
|
---|
80 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_rexw_bx_ud2
|
---|
81 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
82 | db X86_OP_REX_W
|
---|
83 | sidt [xBX]
|
---|
84 | .again: ud2
|
---|
85 | jmp .again
|
---|
86 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_rexw_bx_ud2) == 4)
|
---|
87 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_rexw_bx_ud2
|
---|
88 |
|
---|
89 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_opsize_rexw_bx_ud2
|
---|
90 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
91 | db X86_OP_PRF_SIZE_OP
|
---|
92 | db X86_OP_REX_W
|
---|
93 | sidt [xBX]
|
---|
94 | .again: ud2
|
---|
95 | jmp .again
|
---|
96 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_rexw_bx_ud2) == 5)
|
---|
97 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2
|
---|
98 | %endif
|
---|
99 |
|
---|
100 | %if TMPL_BITS != 64
|
---|
101 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_ss_bx_ud2
|
---|
102 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_ss_bx_ud2, BS3_PBC_NEAR
|
---|
103 | sidt [ss:xBX]
|
---|
104 | .again: ud2
|
---|
105 | jmp .again
|
---|
106 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_ss_bx_ud2) == 4)
|
---|
107 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_ss_bx_ud2
|
---|
108 |
|
---|
109 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_opsize_ss_bx_ud2
|
---|
110 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2, BS3_PBC_NEAR
|
---|
111 | db X86_OP_PRF_SIZE_OP
|
---|
112 | sidt [ss:xBX]
|
---|
113 | .again: ud2
|
---|
114 | jmp .again
|
---|
115 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_ss_bx_ud2) == 5)
|
---|
116 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2
|
---|
117 | %endif
|
---|
118 |
|
---|
119 |
|
---|
120 | ;
|
---|
121 | ; SGDT
|
---|
122 | ;
|
---|
123 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_bx_ud2
|
---|
124 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_bx_ud2, BS3_PBC_NEAR
|
---|
125 | sgdt [xBX]
|
---|
126 | .again: ud2
|
---|
127 | jmp .again
|
---|
128 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_bx_ud2) == 3)
|
---|
129 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_bx_ud2
|
---|
130 |
|
---|
131 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_opsize_bx_ud2
|
---|
132 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2, BS3_PBC_NEAR
|
---|
133 | db X86_OP_PRF_SIZE_OP
|
---|
134 | sgdt [xBX]
|
---|
135 | .again: ud2
|
---|
136 | jmp .again
|
---|
137 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_bx_ud2) == 4)
|
---|
138 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2
|
---|
139 |
|
---|
140 | %if TMPL_BITS == 64
|
---|
141 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_rexw_bx_ud2
|
---|
142 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
143 | db X86_OP_REX_W
|
---|
144 | sgdt [xBX]
|
---|
145 | .again: ud2
|
---|
146 | jmp .again
|
---|
147 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_rexw_bx_ud2) == 4)
|
---|
148 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2
|
---|
149 |
|
---|
150 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2
|
---|
151 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
152 | db X86_OP_PRF_SIZE_OP
|
---|
153 | db X86_OP_REX_W
|
---|
154 | sgdt [xBX]
|
---|
155 | .again: ud2
|
---|
156 | jmp .again
|
---|
157 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2) == 5)
|
---|
158 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2
|
---|
159 | %endif
|
---|
160 |
|
---|
161 | %if TMPL_BITS != 64
|
---|
162 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_ss_bx_ud2
|
---|
163 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_ss_bx_ud2, BS3_PBC_NEAR
|
---|
164 | sgdt [ss:xBX]
|
---|
165 | .again: ud2
|
---|
166 | jmp .again
|
---|
167 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_ss_bx_ud2) == 4)
|
---|
168 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_ss_bx_ud2
|
---|
169 |
|
---|
170 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_opsize_ss_bx_ud2
|
---|
171 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_ss_bx_ud2, BS3_PBC_NEAR
|
---|
172 | db X86_OP_PRF_SIZE_OP
|
---|
173 | sgdt [ss:xBX]
|
---|
174 | .again: ud2
|
---|
175 | jmp .again
|
---|
176 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_ss_bx_ud2) == 5)
|
---|
177 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_ss_bx_ud2
|
---|
178 | %endif
|
---|
179 |
|
---|
180 |
|
---|
181 | ;
|
---|
182 | ; LIDT
|
---|
183 | ;
|
---|
184 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2
|
---|
185 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
186 | lidt [xBX]
|
---|
187 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
188 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
189 | .again:
|
---|
190 | ud2
|
---|
191 | jmp .again
|
---|
192 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(9,11))
|
---|
193 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2
|
---|
194 |
|
---|
195 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2
|
---|
196 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
197 | db X86_OP_PRF_SIZE_OP
|
---|
198 | lidt [xBX]
|
---|
199 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
200 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
201 | .again:
|
---|
202 | ud2
|
---|
203 | jmp .again
|
---|
204 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(10,12))
|
---|
205 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2
|
---|
206 |
|
---|
207 | %if TMPL_BITS == 16
|
---|
208 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2
|
---|
209 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
210 | db X86_OP_PRF_SIZE_OP
|
---|
211 | lidt [xBX]
|
---|
212 | jmp dword BS3_SEL_R0_CS32:.in_32bit wrt FLAT
|
---|
213 | BS3_SET_BITS 32
|
---|
214 | .in_32bit:
|
---|
215 | sidt [es:edi]
|
---|
216 | lidt [es:esi]
|
---|
217 | jmp dword BS3_SEL_R0_CS16:.again wrt CGROUP16
|
---|
218 | BS3_SET_BITS 16
|
---|
219 | .again:
|
---|
220 | ud2
|
---|
221 | jmp .again
|
---|
222 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2) == 27)
|
---|
223 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2
|
---|
224 | %endif
|
---|
225 |
|
---|
226 | %if TMPL_BITS == 64
|
---|
227 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
228 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
229 | db X86_OP_REX_W
|
---|
230 | lidt [xBX]
|
---|
231 | sidt [xDI]
|
---|
232 | lidt [xSI]
|
---|
233 | .again:
|
---|
234 | ud2
|
---|
235 | jmp .again
|
---|
236 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2) == 10)
|
---|
237 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
238 |
|
---|
239 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
240 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
241 | db X86_OP_PRF_SIZE_OP
|
---|
242 | db X86_OP_REX_W
|
---|
243 | lidt [xBX]
|
---|
244 | sidt [xDI]
|
---|
245 | lidt [xSI]
|
---|
246 | .again:
|
---|
247 | ud2
|
---|
248 | jmp .again
|
---|
249 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2) == 11)
|
---|
250 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
251 | %endif
|
---|
252 |
|
---|
253 | %if TMPL_BITS != 64
|
---|
254 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
255 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
256 | lidt [ss:xBX]
|
---|
257 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
258 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
259 | .again:
|
---|
260 | ud2
|
---|
261 | jmp .again
|
---|
262 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2) == 12)
|
---|
263 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
264 |
|
---|
265 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
266 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
267 | db X86_OP_PRF_SIZE_OP
|
---|
268 | lidt [ss:xBX]
|
---|
269 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
270 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
271 | .again:
|
---|
272 | ud2
|
---|
273 | jmp .again
|
---|
274 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2) == 13)
|
---|
275 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
276 | %endif
|
---|
277 |
|
---|
278 |
|
---|
279 | ;
|
---|
280 | ; LGDT
|
---|
281 | ;
|
---|
282 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
283 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
284 | lgdt [xBX]
|
---|
285 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
286 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
287 | .again:
|
---|
288 | ud2
|
---|
289 | jmp .again
|
---|
290 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(9,11))
|
---|
291 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
292 |
|
---|
293 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
294 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
295 | db X86_OP_PRF_SIZE_OP
|
---|
296 | lgdt [xBX]
|
---|
297 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
298 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
299 | .again:
|
---|
300 | ud2
|
---|
301 | jmp .again
|
---|
302 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(10,12))
|
---|
303 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
304 |
|
---|
305 | %if TMPL_BITS == 64
|
---|
306 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
307 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
308 | db X86_OP_REX_W
|
---|
309 | lgdt [xBX]
|
---|
310 | sgdt [xDI]
|
---|
311 | lgdt [xSI]
|
---|
312 | .again:
|
---|
313 | ud2
|
---|
314 | jmp .again
|
---|
315 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2) == 10)
|
---|
316 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
317 |
|
---|
318 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
319 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
320 | db X86_OP_PRF_SIZE_OP
|
---|
321 | db X86_OP_REX_W
|
---|
322 | lgdt [xBX]
|
---|
323 | sgdt [xDI]
|
---|
324 | lgdt [xSI]
|
---|
325 | .again:
|
---|
326 | ud2
|
---|
327 | jmp .again
|
---|
328 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2) == 11)
|
---|
329 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
330 | %endif
|
---|
331 |
|
---|
332 | %if TMPL_BITS != 64
|
---|
333 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
334 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
335 | lgdt [ss:xBX]
|
---|
336 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
337 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
338 | .again:
|
---|
339 | ud2
|
---|
340 | jmp .again
|
---|
341 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2) == 12)
|
---|
342 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
343 |
|
---|
344 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
345 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
346 | db X86_OP_PRF_SIZE_OP
|
---|
347 | lgdt [ss:xBX]
|
---|
348 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
349 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
350 | .again:
|
---|
351 | ud2
|
---|
352 | jmp .again
|
---|
353 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2) == 13)
|
---|
354 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
355 | %endif
|
---|
356 |
|
---|
357 | ;
|
---|
358 | ; #PF
|
---|
359 | ;
|
---|
360 |
|
---|
361 | ; For testing read access.
|
---|
362 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_mov_ax_ds_bx__ud2
|
---|
363 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_mov_ax_ds_bx__ud2, BS3_PBC_NEAR
|
---|
364 | mov xAX, [xBX]
|
---|
365 | .again: ud2
|
---|
366 | jmp .again
|
---|
367 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
368 | BS3_PROC_END_CMN bs3CpuBasic2_mov_ax_ds_bx__ud2
|
---|
369 |
|
---|
370 |
|
---|
371 | ; For testing write access.
|
---|
372 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_mov_ds_bx_ax__ud2
|
---|
373 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_mov_ds_bx_ax__ud2, BS3_PBC_NEAR
|
---|
374 | mov [xBX], xAX
|
---|
375 | .again: ud2
|
---|
376 | jmp .again
|
---|
377 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
378 | BS3_PROC_END_CMN bs3CpuBasic2_mov_ds_bx_ax__ud2
|
---|
379 |
|
---|
380 |
|
---|
381 | ; For testing read+write access.
|
---|
382 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_xchg_ds_bx_ax__ud2
|
---|
383 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_xchg_ds_bx_ax__ud2, BS3_PBC_NEAR
|
---|
384 | xchg [xBX], xAX
|
---|
385 | .again: ud2
|
---|
386 | jmp .again
|
---|
387 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
388 | BS3_PROC_END_CMN bs3CpuBasic2_xchg_ds_bx_ax__ud2
|
---|
389 |
|
---|
390 |
|
---|
391 | ; Another read+write access test.
|
---|
392 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_cmpxchg_ds_bx_cx__ud2
|
---|
393 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_cmpxchg_ds_bx_cx__ud2, BS3_PBC_NEAR
|
---|
394 | cmpxchg [xBX], xCX
|
---|
395 | .again: ud2
|
---|
396 | jmp .again
|
---|
397 | AssertCompile(.again - BS3_LAST_LABEL == 3 + (TMPL_BITS == 64))
|
---|
398 | BS3_PROC_END_CMN bs3CpuBasic2_cmpxchg_ds_bx_cx__ud2
|
---|
399 |
|
---|
400 |
|
---|
401 | ; For testing read access from an aborted instruction: DIV by zero
|
---|
402 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_div_ds_bx__ud2
|
---|
403 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_div_ds_bx__ud2, BS3_PBC_NEAR
|
---|
404 | div xPRE [xBX]
|
---|
405 | .again: ud2
|
---|
406 | jmp .again
|
---|
407 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
408 | BS3_PROC_END_CMN bs3CpuBasic2_div_ds_bx__ud2
|
---|
409 |
|
---|
410 |
|
---|
411 | ; Two memory operands: push [mem]
|
---|
412 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_push_ds_bx__ud2
|
---|
413 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_push_ds_bx__ud2, BS3_PBC_NEAR
|
---|
414 | push xPRE [xBX]
|
---|
415 | .again: ud2
|
---|
416 | jmp .again
|
---|
417 | AssertCompile(.again - BS3_LAST_LABEL == 2)
|
---|
418 | BS3_PROC_END_CMN bs3CpuBasic2_push_ds_bx__ud2
|
---|
419 |
|
---|
420 | ; Two memory operands: pop [mem]
|
---|
421 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_push_ax__pop_ds_bx__ud2
|
---|
422 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_push_ax__pop_ds_bx__ud2, BS3_PBC_NEAR
|
---|
423 | push xAX
|
---|
424 | pop xPRE [xBX]
|
---|
425 | .again: ud2
|
---|
426 | jmp .again
|
---|
427 | AssertCompile(.again - BS3_LAST_LABEL == 3)
|
---|
428 | BS3_PROC_END_CMN bs3CpuBasic2_push_ax__pop_ds_bx__ud2
|
---|
429 |
|
---|
430 | ; Two memory operands: call [mem]
|
---|
431 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_call_ds_bx__ud2
|
---|
432 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_call_ds_bx__ud2, BS3_PBC_NEAR
|
---|
433 | call xPRE [xBX]
|
---|
434 | .again: ud2
|
---|
435 | jmp .again
|
---|
436 | AssertCompile(.again - BS3_LAST_LABEL == 2)
|
---|
437 | BS3_PROC_END_CMN bs3CpuBasic2_call_ds_bx__ud2
|
---|
438 |
|
---|
439 | ; For testing #GP vs #PF write
|
---|
440 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_insb__ud2
|
---|
441 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_insb__ud2, BS3_PBC_NEAR
|
---|
442 | insb
|
---|
443 | .again: ud2
|
---|
444 | jmp .again
|
---|
445 | AssertCompile(.again - BS3_LAST_LABEL == 1)
|
---|
446 | BS3_PROC_END_CMN bs3CpuBasic2_insb__ud2
|
---|
447 |
|
---|
448 |
|
---|
449 | %endif ; BS3_INSTANTIATING_CMN
|
---|
450 |
|
---|
451 | %include "bs3kit-template-footer.mac" ; reset environment
|
---|
452 |
|
---|