1 | ; $Id: bs3-cpu-basic-2-template.mac 97477 2022-11-09 10:37:00Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - bs3-cpu-basic-2 assembly template.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2022 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; The contents of this file may alternatively be used under the terms
|
---|
26 | ; of the Common Development and Distribution License Version 1.0
|
---|
27 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | ; CDDL are applicable instead of those of the GPL.
|
---|
30 | ;
|
---|
31 | ; You may elect to license modified versions of this file under the
|
---|
32 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | ;
|
---|
34 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | ;
|
---|
36 |
|
---|
37 |
|
---|
38 | ;*********************************************************************************************************************************
|
---|
39 | ;* Header Files *
|
---|
40 | ;*********************************************************************************************************************************
|
---|
41 | %include "bs3kit-template-header.mac" ; setup environment
|
---|
42 |
|
---|
43 |
|
---|
44 | ;*********************************************************************************************************************************
|
---|
45 | ;* Defined Constants And Macros *
|
---|
46 | ;*********************************************************************************************************************************
|
---|
47 | %ifndef BS3_CPUBAS2_UD_OFF_DEFINED
|
---|
48 | %define BS3_CPUBAS2_UD_OFF_DEFINED
|
---|
49 | %macro BS3_CPUBAS2_UD_OFF 1
|
---|
50 | BS3_GLOBAL_NAME_EX BS3_CMN_NM(%1) %+ _offUD, , 1
|
---|
51 | db BS3_CMN_NM(%1).again - BS3_CMN_NM(%1)
|
---|
52 | %endmacro
|
---|
53 | %endif
|
---|
54 |
|
---|
55 |
|
---|
56 | ;*********************************************************************************************************************************
|
---|
57 | ;* External Symbols *
|
---|
58 | ;*********************************************************************************************************************************
|
---|
59 | TMPL_BEGIN_TEXT
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 | ;
|
---|
64 | ; Test code snippets containing code which differs between 16-bit, 32-bit
|
---|
65 | ; and 64-bit CPUs modes.
|
---|
66 | ;
|
---|
67 | %ifdef BS3_INSTANTIATING_CMN
|
---|
68 |
|
---|
69 | ;
|
---|
70 | ; SIDT
|
---|
71 | ;
|
---|
72 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_bx_ud2
|
---|
73 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_bx_ud2, BS3_PBC_NEAR
|
---|
74 | sidt [xBX]
|
---|
75 | .again: ud2
|
---|
76 | jmp .again
|
---|
77 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_bx_ud2) == 3)
|
---|
78 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_bx_ud2
|
---|
79 |
|
---|
80 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_opsize_bx_ud2
|
---|
81 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_bx_ud2, BS3_PBC_NEAR
|
---|
82 | db X86_OP_PRF_SIZE_OP
|
---|
83 | sidt [xBX]
|
---|
84 | .again: ud2
|
---|
85 | jmp .again
|
---|
86 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_bx_ud2) == 4)
|
---|
87 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_bx_ud2
|
---|
88 |
|
---|
89 | %if TMPL_BITS == 64
|
---|
90 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_rexw_bx_ud2
|
---|
91 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
92 | db X86_OP_REX_W
|
---|
93 | sidt [xBX]
|
---|
94 | .again: ud2
|
---|
95 | jmp .again
|
---|
96 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_rexw_bx_ud2) == 4)
|
---|
97 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_rexw_bx_ud2
|
---|
98 |
|
---|
99 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_opsize_rexw_bx_ud2
|
---|
100 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
101 | db X86_OP_PRF_SIZE_OP
|
---|
102 | db X86_OP_REX_W
|
---|
103 | sidt [xBX]
|
---|
104 | .again: ud2
|
---|
105 | jmp .again
|
---|
106 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_rexw_bx_ud2) == 5)
|
---|
107 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_rexw_bx_ud2
|
---|
108 | %endif
|
---|
109 |
|
---|
110 | %if TMPL_BITS != 64
|
---|
111 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_ss_bx_ud2
|
---|
112 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_ss_bx_ud2, BS3_PBC_NEAR
|
---|
113 | sidt [ss:xBX]
|
---|
114 | .again: ud2
|
---|
115 | jmp .again
|
---|
116 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_ss_bx_ud2) == 4)
|
---|
117 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_ss_bx_ud2
|
---|
118 |
|
---|
119 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sidt_opsize_ss_bx_ud2
|
---|
120 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2, BS3_PBC_NEAR
|
---|
121 | db X86_OP_PRF_SIZE_OP
|
---|
122 | sidt [ss:xBX]
|
---|
123 | .again: ud2
|
---|
124 | jmp .again
|
---|
125 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_opsize_ss_bx_ud2) == 5)
|
---|
126 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_opsize_ss_bx_ud2
|
---|
127 | %endif
|
---|
128 |
|
---|
129 |
|
---|
130 | ;
|
---|
131 | ; SGDT
|
---|
132 | ;
|
---|
133 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_bx_ud2
|
---|
134 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_bx_ud2, BS3_PBC_NEAR
|
---|
135 | sgdt [xBX]
|
---|
136 | .again: ud2
|
---|
137 | jmp .again
|
---|
138 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_bx_ud2) == 3)
|
---|
139 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_bx_ud2
|
---|
140 |
|
---|
141 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_opsize_bx_ud2
|
---|
142 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2, BS3_PBC_NEAR
|
---|
143 | db X86_OP_PRF_SIZE_OP
|
---|
144 | sgdt [xBX]
|
---|
145 | .again: ud2
|
---|
146 | jmp .again
|
---|
147 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_bx_ud2) == 4)
|
---|
148 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_bx_ud2
|
---|
149 |
|
---|
150 | %if TMPL_BITS == 64
|
---|
151 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_rexw_bx_ud2
|
---|
152 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
153 | db X86_OP_REX_W
|
---|
154 | sgdt [xBX]
|
---|
155 | .again: ud2
|
---|
156 | jmp .again
|
---|
157 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_rexw_bx_ud2) == 4)
|
---|
158 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_rexw_bx_ud2
|
---|
159 |
|
---|
160 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2
|
---|
161 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2, BS3_PBC_NEAR
|
---|
162 | db X86_OP_PRF_SIZE_OP
|
---|
163 | db X86_OP_REX_W
|
---|
164 | sgdt [xBX]
|
---|
165 | .again: ud2
|
---|
166 | jmp .again
|
---|
167 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2) == 5)
|
---|
168 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_rexw_bx_ud2
|
---|
169 | %endif
|
---|
170 |
|
---|
171 | %if TMPL_BITS != 64
|
---|
172 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_ss_bx_ud2
|
---|
173 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_ss_bx_ud2, BS3_PBC_NEAR
|
---|
174 | sgdt [ss:xBX]
|
---|
175 | .again: ud2
|
---|
176 | jmp .again
|
---|
177 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_ss_bx_ud2) == 4)
|
---|
178 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_ss_bx_ud2
|
---|
179 |
|
---|
180 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_sgdt_opsize_ss_bx_ud2
|
---|
181 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sgdt_opsize_ss_bx_ud2, BS3_PBC_NEAR
|
---|
182 | db X86_OP_PRF_SIZE_OP
|
---|
183 | sgdt [ss:xBX]
|
---|
184 | .again: ud2
|
---|
185 | jmp .again
|
---|
186 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sgdt_opsize_ss_bx_ud2) == 5)
|
---|
187 | BS3_PROC_END_CMN bs3CpuBasic2_sgdt_opsize_ss_bx_ud2
|
---|
188 | %endif
|
---|
189 |
|
---|
190 |
|
---|
191 | ;
|
---|
192 | ; LIDT
|
---|
193 | ;
|
---|
194 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2
|
---|
195 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
196 | lidt [xBX]
|
---|
197 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
198 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
199 | .again:
|
---|
200 | ud2
|
---|
201 | jmp .again
|
---|
202 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(9,11))
|
---|
203 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_bx__sidt_es_di__lidt_es_si__ud2
|
---|
204 |
|
---|
205 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2
|
---|
206 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
207 | db X86_OP_PRF_SIZE_OP
|
---|
208 | lidt [xBX]
|
---|
209 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
210 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
211 | .again:
|
---|
212 | ud2
|
---|
213 | jmp .again
|
---|
214 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(10,12))
|
---|
215 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_bx__sidt_es_di__lidt_es_si__ud2
|
---|
216 |
|
---|
217 | %if TMPL_BITS == 16
|
---|
218 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2
|
---|
219 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
220 | db X86_OP_PRF_SIZE_OP
|
---|
221 | lidt [xBX]
|
---|
222 | jmp dword BS3_SEL_R0_CS32:.in_32bit wrt FLAT
|
---|
223 | BS3_SET_BITS 32
|
---|
224 | .in_32bit:
|
---|
225 | sidt [es:edi]
|
---|
226 | lidt [es:esi]
|
---|
227 | jmp dword BS3_SEL_R0_CS16:.again wrt CGROUP16
|
---|
228 | BS3_SET_BITS 16
|
---|
229 | .again:
|
---|
230 | ud2
|
---|
231 | jmp .again
|
---|
232 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2) == 27)
|
---|
233 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_bx__sidt32_es_di__lidt_es_si__ud2
|
---|
234 | %endif
|
---|
235 |
|
---|
236 | %if TMPL_BITS == 64
|
---|
237 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
238 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
239 | db X86_OP_REX_W
|
---|
240 | lidt [xBX]
|
---|
241 | sidt [xDI]
|
---|
242 | lidt [xSI]
|
---|
243 | .again:
|
---|
244 | ud2
|
---|
245 | jmp .again
|
---|
246 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2) == 10)
|
---|
247 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
248 |
|
---|
249 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
250 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
251 | db X86_OP_PRF_SIZE_OP
|
---|
252 | db X86_OP_REX_W
|
---|
253 | lidt [xBX]
|
---|
254 | sidt [xDI]
|
---|
255 | lidt [xSI]
|
---|
256 | .again:
|
---|
257 | ud2
|
---|
258 | jmp .again
|
---|
259 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2) == 11)
|
---|
260 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_rexw_bx__sidt_es_di__lidt_es_si__ud2
|
---|
261 | %endif
|
---|
262 |
|
---|
263 | %if TMPL_BITS != 64
|
---|
264 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
265 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
266 | lidt [ss:xBX]
|
---|
267 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
268 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
269 | .again:
|
---|
270 | ud2
|
---|
271 | jmp .again
|
---|
272 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2) == 12)
|
---|
273 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
274 |
|
---|
275 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
276 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2, BS3_PBC_NEAR
|
---|
277 | db X86_OP_PRF_SIZE_OP
|
---|
278 | lidt [ss:xBX]
|
---|
279 | sidt [BS3_NOT_64BIT(es:) xDI]
|
---|
280 | lidt [BS3_NOT_64BIT(es:) xSI]
|
---|
281 | .again:
|
---|
282 | ud2
|
---|
283 | jmp .again
|
---|
284 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2) == 13)
|
---|
285 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_opsize_ss_bx__sidt_es_di__lidt_es_si__ud2
|
---|
286 | %endif
|
---|
287 |
|
---|
288 |
|
---|
289 | ;
|
---|
290 | ; LGDT
|
---|
291 | ;
|
---|
292 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
293 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
294 | lgdt [xBX]
|
---|
295 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
296 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
297 | .again:
|
---|
298 | ud2
|
---|
299 | jmp .again
|
---|
300 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(9,11))
|
---|
301 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
302 |
|
---|
303 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
304 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
305 | db X86_OP_PRF_SIZE_OP
|
---|
306 | lgdt [xBX]
|
---|
307 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
308 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
309 | .again:
|
---|
310 | ud2
|
---|
311 | jmp .again
|
---|
312 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2) == BS3_IF_64BIT_OTHERWISE(10,12))
|
---|
313 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_opsize_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
314 |
|
---|
315 | %if TMPL_BITS == 64
|
---|
316 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
317 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
318 | db X86_OP_REX_W
|
---|
319 | lgdt [xBX]
|
---|
320 | sgdt [xDI]
|
---|
321 | lgdt [xSI]
|
---|
322 | .again:
|
---|
323 | ud2
|
---|
324 | jmp .again
|
---|
325 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2) == 10)
|
---|
326 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
327 |
|
---|
328 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
329 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
330 | db X86_OP_PRF_SIZE_OP
|
---|
331 | db X86_OP_REX_W
|
---|
332 | lgdt [xBX]
|
---|
333 | sgdt [xDI]
|
---|
334 | lgdt [xSI]
|
---|
335 | .again:
|
---|
336 | ud2
|
---|
337 | jmp .again
|
---|
338 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2) == 11)
|
---|
339 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_opsize_rexw_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
340 | %endif
|
---|
341 |
|
---|
342 | %if TMPL_BITS != 64
|
---|
343 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
344 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
345 | lgdt [ss:xBX]
|
---|
346 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
347 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
348 | .again:
|
---|
349 | ud2
|
---|
350 | jmp .again
|
---|
351 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2) == 12)
|
---|
352 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
353 |
|
---|
354 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
355 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2, BS3_PBC_NEAR
|
---|
356 | db X86_OP_PRF_SIZE_OP
|
---|
357 | lgdt [ss:xBX]
|
---|
358 | sgdt [BS3_NOT_64BIT(es:) xDI]
|
---|
359 | lgdt [BS3_NOT_64BIT(es:) xSI]
|
---|
360 | .again:
|
---|
361 | ud2
|
---|
362 | jmp .again
|
---|
363 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2) == 13)
|
---|
364 | BS3_PROC_END_CMN bs3CpuBasic2_lgdt_opsize_ss_bx__sgdt_es_di__lgdt_es_si__ud2
|
---|
365 | %endif
|
---|
366 |
|
---|
367 | ;
|
---|
368 | ; #PF & #AC
|
---|
369 | ;
|
---|
370 |
|
---|
371 | ; For testing read access.
|
---|
372 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_mov_ax_ds_bx__ud2
|
---|
373 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_mov_ax_ds_bx__ud2, BS3_PBC_NEAR
|
---|
374 | mov xAX, [xBX]
|
---|
375 | .again: ud2
|
---|
376 | jmp .again
|
---|
377 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
378 | BS3_PROC_END_CMN bs3CpuBasic2_mov_ax_ds_bx__ud2
|
---|
379 |
|
---|
380 |
|
---|
381 | ; For testing write access.
|
---|
382 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_mov_ds_bx_ax__ud2
|
---|
383 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_mov_ds_bx_ax__ud2, BS3_PBC_NEAR
|
---|
384 | mov [xBX], xAX
|
---|
385 | .again: ud2
|
---|
386 | jmp .again
|
---|
387 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
388 | BS3_PROC_END_CMN bs3CpuBasic2_mov_ds_bx_ax__ud2
|
---|
389 |
|
---|
390 |
|
---|
391 | ; For testing read+write access.
|
---|
392 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_xchg_ds_bx_ax__ud2
|
---|
393 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_xchg_ds_bx_ax__ud2, BS3_PBC_NEAR
|
---|
394 | xchg [xBX], xAX
|
---|
395 | .again: ud2
|
---|
396 | jmp .again
|
---|
397 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
398 | BS3_PROC_END_CMN bs3CpuBasic2_xchg_ds_bx_ax__ud2
|
---|
399 |
|
---|
400 |
|
---|
401 | ; Another read+write access test.
|
---|
402 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_cmpxchg_ds_bx_cx__ud2
|
---|
403 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_cmpxchg_ds_bx_cx__ud2, BS3_PBC_NEAR
|
---|
404 | cmpxchg [xBX], xCX
|
---|
405 | .again: ud2
|
---|
406 | jmp .again
|
---|
407 | AssertCompile(.again - BS3_LAST_LABEL == 3 + (TMPL_BITS == 64))
|
---|
408 | BS3_PROC_END_CMN bs3CpuBasic2_cmpxchg_ds_bx_cx__ud2
|
---|
409 |
|
---|
410 |
|
---|
411 | ; For testing read access from an aborted instruction: DIV by zero
|
---|
412 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_div_ds_bx__ud2
|
---|
413 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_div_ds_bx__ud2, BS3_PBC_NEAR
|
---|
414 | div xPRE [xBX]
|
---|
415 | .again: ud2
|
---|
416 | jmp .again
|
---|
417 | AssertCompile(.again - BS3_LAST_LABEL == 2 + (TMPL_BITS == 64))
|
---|
418 | BS3_PROC_END_CMN bs3CpuBasic2_div_ds_bx__ud2
|
---|
419 |
|
---|
420 | ; For testing FLD m80 alignment (#AC).
|
---|
421 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_fninit_fld_ds_bx__ud2
|
---|
422 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_fninit_fld_ds_bx__ud2, BS3_PBC_NEAR
|
---|
423 | fninit ; make sure to not trigger a stack overflow.
|
---|
424 | .actual_test_instruction:
|
---|
425 | fld tword [xBX]
|
---|
426 | .again: ud2
|
---|
427 | jmp .again
|
---|
428 | AssertCompile(.actual_test_instruction - BS3_LAST_LABEL == 2)
|
---|
429 | BS3_PROC_END_CMN bs3CpuBasic2_fninit_fld_ds_bx__ud2
|
---|
430 |
|
---|
431 | ; For testing FBLD m80 alignment (#AC).
|
---|
432 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_fninit_fbld_ds_bx__ud2
|
---|
433 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_fninit_fbld_ds_bx__ud2, BS3_PBC_NEAR
|
---|
434 | fninit ; make sure to not trigger a stack overflow.
|
---|
435 | .actual_test_instruction:
|
---|
436 | fbld tword [xBX]
|
---|
437 | .again: ud2
|
---|
438 | jmp .again
|
---|
439 | AssertCompile(.actual_test_instruction - BS3_LAST_LABEL == 2)
|
---|
440 | BS3_PROC_END_CMN bs3CpuBasic2_fninit_fbld_ds_bx__ud2
|
---|
441 |
|
---|
442 | ; For testing FST m80 alignment (#AC).
|
---|
443 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_fninit_fldz_fstp_ds_bx__ud2
|
---|
444 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_fninit_fldz_fstp_ds_bx__ud2, BS3_PBC_NEAR
|
---|
445 | fninit ; make sure to not trigger a stack overflow.
|
---|
446 | fldz ; make sure we've got something to store
|
---|
447 | .actual_test_instruction:
|
---|
448 | fstp tword [xBX]
|
---|
449 | .again: ud2
|
---|
450 | jmp .again
|
---|
451 | AssertCompile(.actual_test_instruction - BS3_LAST_LABEL == 4)
|
---|
452 | BS3_PROC_END_CMN bs3CpuBasic2_fninit_fldz_fstp_ds_bx__ud2
|
---|
453 |
|
---|
454 | ; For testing FXSAVE alignment (#AC/#GP).
|
---|
455 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_fxsave_ds_bx__ud2
|
---|
456 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_fxsave_ds_bx__ud2, BS3_PBC_NEAR
|
---|
457 | fxsave [xBX]
|
---|
458 | .again: ud2
|
---|
459 | jmp .again
|
---|
460 | BS3_PROC_END_CMN bs3CpuBasic2_fxsave_ds_bx__ud2
|
---|
461 |
|
---|
462 |
|
---|
463 | ; Two memory operands: push [mem]
|
---|
464 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_push_ds_bx__ud2
|
---|
465 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_push_ds_bx__ud2, BS3_PBC_NEAR
|
---|
466 | push xPRE [xBX]
|
---|
467 | .again: ud2
|
---|
468 | jmp .again
|
---|
469 | AssertCompile(.again - BS3_LAST_LABEL == 2)
|
---|
470 | BS3_PROC_END_CMN bs3CpuBasic2_push_ds_bx__ud2
|
---|
471 |
|
---|
472 | ; Two memory operands: pop [mem]
|
---|
473 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_push_ax__pop_ds_bx__ud2
|
---|
474 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_push_ax__pop_ds_bx__ud2, BS3_PBC_NEAR
|
---|
475 | push xAX
|
---|
476 | pop xPRE [xBX]
|
---|
477 | .again: ud2
|
---|
478 | jmp .again
|
---|
479 | AssertCompile(.again - BS3_LAST_LABEL == 3)
|
---|
480 | BS3_PROC_END_CMN bs3CpuBasic2_push_ax__pop_ds_bx__ud2
|
---|
481 |
|
---|
482 | ; Two memory operands: call [mem]
|
---|
483 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_call_ds_bx__ud2
|
---|
484 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_call_ds_bx__ud2, BS3_PBC_NEAR
|
---|
485 | call xPRE [xBX]
|
---|
486 | .again: ud2
|
---|
487 | jmp .again
|
---|
488 | AssertCompile(.again - BS3_LAST_LABEL == 2)
|
---|
489 | BS3_PROC_END_CMN bs3CpuBasic2_call_ds_bx__ud2
|
---|
490 |
|
---|
491 | ; For testing #GP vs #PF write
|
---|
492 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_insb__ud2
|
---|
493 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_insb__ud2, BS3_PBC_NEAR
|
---|
494 | insb
|
---|
495 | .again: ud2
|
---|
496 | jmp .again
|
---|
497 | AssertCompile(.again - BS3_LAST_LABEL == 1)
|
---|
498 | BS3_PROC_END_CMN bs3CpuBasic2_insb__ud2
|
---|
499 |
|
---|
500 |
|
---|
501 | ;*********************************************************************************************************************************
|
---|
502 | ;* JMP Tests (simple ones). *
|
---|
503 | ;*********************************************************************************************************************************
|
---|
504 |
|
---|
505 | ; jmp rel8 (forwards)
|
---|
506 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jb__ud2
|
---|
507 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jb__ud2, BS3_PBC_NEAR
|
---|
508 | jmp short .again
|
---|
509 | .post_jmp:
|
---|
510 | times 7 int3
|
---|
511 | .again: ud2
|
---|
512 | int3
|
---|
513 | jmp .again
|
---|
514 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 2)
|
---|
515 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jb__ud2
|
---|
516 |
|
---|
517 |
|
---|
518 | ; jmp rel8 (backwards)
|
---|
519 | BS3_GLOBAL_NAME_EX RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_jmp_jb_back__ud2),.again), function, 2
|
---|
520 | ud2
|
---|
521 | times 7 int3
|
---|
522 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jb_back__ud2
|
---|
523 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jb_back__ud2, BS3_PBC_NEAR
|
---|
524 | jmp short .again
|
---|
525 | .post_jmp:
|
---|
526 | int3
|
---|
527 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 2)
|
---|
528 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jb_back__ud2
|
---|
529 |
|
---|
530 |
|
---|
531 | ; jmp rel16 (forwards)
|
---|
532 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jv__ud2
|
---|
533 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jv__ud2, BS3_PBC_NEAR
|
---|
534 | jmp near .again
|
---|
535 | .post_jmp:
|
---|
536 | times 9 int3
|
---|
537 | .again: ud2
|
---|
538 | int3
|
---|
539 | jmp .again
|
---|
540 | %if TMPL_BITS == 16
|
---|
541 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 3)
|
---|
542 | %else
|
---|
543 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 5)
|
---|
544 | %endif
|
---|
545 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jv__ud2
|
---|
546 |
|
---|
547 |
|
---|
548 | ; jmp rel16 (backwards)
|
---|
549 | BS3_GLOBAL_NAME_EX RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_jmp_jv_back__ud2),.again), function, 2
|
---|
550 | ud2
|
---|
551 | times 6 int3
|
---|
552 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jv_back__ud2
|
---|
553 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jv_back__ud2, BS3_PBC_NEAR
|
---|
554 | jmp near .again
|
---|
555 | .post_jmp:
|
---|
556 | int3
|
---|
557 | %if TMPL_BITS == 16
|
---|
558 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 3)
|
---|
559 | %else
|
---|
560 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 5)
|
---|
561 | %endif
|
---|
562 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jv_back__ud2
|
---|
563 |
|
---|
564 |
|
---|
565 | ; jmp [indirect]
|
---|
566 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_mem__ud2
|
---|
567 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_mem__ud2, BS3_PBC_NEAR
|
---|
568 | %if TMPL_BITS == 16
|
---|
569 | jmp [word cs:.npAgain]
|
---|
570 | %elif TMPL_BITS == 32
|
---|
571 | jmp [dword cs:.npAgain]
|
---|
572 | %else
|
---|
573 | jmp [.npAgain]
|
---|
574 | %endif
|
---|
575 | .post_jmp:
|
---|
576 | times 9 int3
|
---|
577 | .npAgain:
|
---|
578 | %if TMPL_BITS == 16
|
---|
579 | dw BS3_TEXT16_WRT(.again)
|
---|
580 | %else
|
---|
581 | dd .again wrt FLAT
|
---|
582 | %if TMPL_BITS == 64
|
---|
583 | dd 0
|
---|
584 | %endif
|
---|
585 | %endif
|
---|
586 | .again: ud2
|
---|
587 | int3
|
---|
588 | jmp .again
|
---|
589 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_mem__ud2
|
---|
590 |
|
---|
591 | ; jmp [xAX]
|
---|
592 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_xAX__ud2
|
---|
593 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_xAX__ud2, BS3_PBC_NEAR
|
---|
594 | jmp xAX
|
---|
595 | .post_jmp:
|
---|
596 | times 17 int3
|
---|
597 | .again: ud2
|
---|
598 | int3
|
---|
599 | jmp .again
|
---|
600 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_xAX__ud2
|
---|
601 |
|
---|
602 | ; jmp [xDI]
|
---|
603 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_xDI__ud2
|
---|
604 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_xDI__ud2, BS3_PBC_NEAR
|
---|
605 | jmp xDI
|
---|
606 | .post_jmp:
|
---|
607 | times 17 int3
|
---|
608 | .again: ud2
|
---|
609 | int3
|
---|
610 | jmp .again
|
---|
611 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_xDI__ud2
|
---|
612 |
|
---|
613 | %if TMPL_BITS == 64
|
---|
614 | ; jmp [xAX]
|
---|
615 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_r9__ud2
|
---|
616 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_r9__ud2, BS3_PBC_NEAR
|
---|
617 | jmp r9
|
---|
618 | .post_jmp:
|
---|
619 | times 17 int3
|
---|
620 | .again: ud2
|
---|
621 | int3
|
---|
622 | jmp .again
|
---|
623 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_r9__ud2
|
---|
624 | %endif
|
---|
625 |
|
---|
626 |
|
---|
627 | ; call rel16/32 (forwards)
|
---|
628 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_call_jv__ud2
|
---|
629 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_call_jv__ud2, BS3_PBC_NEAR
|
---|
630 | call near .again
|
---|
631 | .post_call:
|
---|
632 | times 9 int3
|
---|
633 | .again: ud2
|
---|
634 | int3
|
---|
635 | jmp .again
|
---|
636 | %if TMPL_BITS == 16
|
---|
637 | AssertCompile(.post_call - BS3_LAST_LABEL == 3)
|
---|
638 | %else
|
---|
639 | AssertCompile(.post_call - BS3_LAST_LABEL == 5)
|
---|
640 | %endif
|
---|
641 | BS3_PROC_END_CMN bs3CpuBasic2_call_jv__ud2
|
---|
642 |
|
---|
643 | ; call rel16/32 (backwards)
|
---|
644 | BS3_GLOBAL_NAME_EX RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_call_jv_back__ud2),.again), function, 2
|
---|
645 | ud2
|
---|
646 | times 6 int3
|
---|
647 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_call_jv_back__ud2
|
---|
648 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_call_jv_back__ud2, BS3_PBC_NEAR
|
---|
649 | call near .again
|
---|
650 | .post_call:
|
---|
651 | int3
|
---|
652 | %if TMPL_BITS == 16
|
---|
653 | AssertCompile(.post_call - BS3_LAST_LABEL == 3)
|
---|
654 | %else
|
---|
655 | AssertCompile(.post_call - BS3_LAST_LABEL == 5)
|
---|
656 | %endif
|
---|
657 | BS3_PROC_END_CMN bs3CpuBasic2_call_jv_back__ud2
|
---|
658 |
|
---|
659 |
|
---|
660 | ;
|
---|
661 | ; When applying opsize, we need to put this in the 16-bit text segment to
|
---|
662 | ; better control where we end up in 32-bit and 64-bit mode.
|
---|
663 | ;
|
---|
664 | ; Try keep the code out of the IVT and BIOS data area. This unfortunately
|
---|
665 | ; requires manual padding here.
|
---|
666 | ;
|
---|
667 | BS3_BEGIN_TEXT16
|
---|
668 | BS3_SET_BITS TMPL_BITS
|
---|
669 | %if TMPL_BITS == 32
|
---|
670 | align 0x100, int3 ; Currently takes us up to 0x400 (max align value is 0x100)
|
---|
671 | times 0x200 int3 ; Brings us up to 0x600.
|
---|
672 | %endif
|
---|
673 |
|
---|
674 | BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuBasic2_jmp_opsize_begin), , 1
|
---|
675 |
|
---|
676 |
|
---|
677 | ; jmp rel8 (forwards) with opsize override.
|
---|
678 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jb_opsize__ud2
|
---|
679 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jb_opsize__ud2, BS3_PBC_NEAR
|
---|
680 | db 66h
|
---|
681 | jmp short .again
|
---|
682 | .post_jmp:
|
---|
683 | times 8 int3
|
---|
684 | .again: ud2
|
---|
685 | int3
|
---|
686 | jmp .again
|
---|
687 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 3)
|
---|
688 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jb_opsize__ud2
|
---|
689 |
|
---|
690 |
|
---|
691 | ; jmp rel8 (backwards) with opsize override.
|
---|
692 | BS3_GLOBAL_NAME_EX RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_jmp_jb_opsize_back__ud2),.again), function, 2
|
---|
693 | ud2
|
---|
694 | times 19 int3
|
---|
695 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jb_opsize_back__ud2
|
---|
696 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jb_opsize_back__ud2, BS3_PBC_NEAR
|
---|
697 | db 66h
|
---|
698 | jmp short .again
|
---|
699 | .post_jmp:
|
---|
700 | int3
|
---|
701 | AssertCompile(.post_jmp - BS3_LAST_LABEL == 3)
|
---|
702 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jb_opsize_back__ud2
|
---|
703 |
|
---|
704 |
|
---|
705 | ; jmp rel16 (forwards) with opsize override.
|
---|
706 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jv_opsize__ud2
|
---|
707 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jv_opsize__ud2, BS3_PBC_NEAR
|
---|
708 | db 66h, 0e9h ; o32 jmp near .again
|
---|
709 | %if TMPL_BITS != 32
|
---|
710 | dd 11
|
---|
711 | %else
|
---|
712 | dw 11
|
---|
713 | %endif
|
---|
714 | .post_jmp:
|
---|
715 | times 11 int3
|
---|
716 | .again: ud2
|
---|
717 | int3
|
---|
718 | jmp .again
|
---|
719 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jv_opsize__ud2
|
---|
720 |
|
---|
721 |
|
---|
722 | ; jmp rel16 (backwards) with opsize override.
|
---|
723 | BS3_GLOBAL_NAME_EX RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_jmp_jv_opsize_back__ud2),.again), function, 2
|
---|
724 | ud2
|
---|
725 | times 19 int3
|
---|
726 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_jv_opsize_back__ud2
|
---|
727 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_jv_opsize_back__ud2, BS3_PBC_NEAR
|
---|
728 | %if TMPL_BITS != 32
|
---|
729 | db 66h, 0e9h ; o32 jmp near .again
|
---|
730 | dd RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_jmp_jv_opsize_back__ud2),.again) - .post_jmp
|
---|
731 | %else
|
---|
732 | db 66h, 0e9h ; o16 jmp near .again
|
---|
733 | dw RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_jmp_jv_opsize_back__ud2),.again) - .post_jmp
|
---|
734 | %endif
|
---|
735 | .post_jmp:
|
---|
736 | int3
|
---|
737 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_jv_opsize_back__ud2
|
---|
738 |
|
---|
739 |
|
---|
740 | BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuBasic2_jmp_opsize_end), , 1
|
---|
741 | int3
|
---|
742 |
|
---|
743 | ; jmp [indirect]
|
---|
744 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_mem_opsize__ud2
|
---|
745 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_mem_opsize__ud2, BS3_PBC_NEAR
|
---|
746 | db 66h
|
---|
747 | %if TMPL_BITS == 16
|
---|
748 | jmp [word cs:.npAgain]
|
---|
749 | %elif TMPL_BITS == 32
|
---|
750 | jmp [dword cs:.npAgain wrt FLAT]
|
---|
751 | %else
|
---|
752 | jmp [.npAgain wrt FLAT]
|
---|
753 | %endif
|
---|
754 | .post_jmp:
|
---|
755 | times 9 int3
|
---|
756 | .npAgain:
|
---|
757 | %if TMPL_BITS == 16
|
---|
758 | dw BS3_TEXT16_WRT(.again)
|
---|
759 | dw 0
|
---|
760 | %else
|
---|
761 | dw .again wrt CGROUP16
|
---|
762 | dw 0faceh, 0f00dh, 07777h ; non-canonical address
|
---|
763 | %endif
|
---|
764 | .again: ud2
|
---|
765 | int3
|
---|
766 | jmp .again
|
---|
767 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_mem_opsize__ud2
|
---|
768 |
|
---|
769 | %if TMPL_BITS == 64
|
---|
770 | ; jmp [indirect] - 64-bit intel version
|
---|
771 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_mem_opsize__ud2__intel
|
---|
772 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_mem_opsize__ud2__intel, BS3_PBC_NEAR
|
---|
773 | db 66h
|
---|
774 | jmp [.npAgain wrt FLAT]
|
---|
775 | .post_jmp:
|
---|
776 | times 8 int3
|
---|
777 | .npAgain:
|
---|
778 | dd .again wrt FLAT
|
---|
779 | dd 0
|
---|
780 | .again: ud2
|
---|
781 | int3
|
---|
782 | jmp .again
|
---|
783 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_mem_opsize__ud2__intel
|
---|
784 | %endif
|
---|
785 |
|
---|
786 | ; jmp [xAX]
|
---|
787 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_jmp_ind_xAX_opsize__ud2
|
---|
788 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_jmp_ind_xAX_opsize__ud2, BS3_PBC_NEAR
|
---|
789 | db 66h
|
---|
790 | jmp xAX
|
---|
791 | .post_jmp:
|
---|
792 | times 8 int3
|
---|
793 | .again: ud2
|
---|
794 | int3
|
---|
795 | jmp .again
|
---|
796 | BS3_PROC_END_CMN bs3CpuBasic2_jmp_ind_xAX_opsize__ud2
|
---|
797 |
|
---|
798 |
|
---|
799 | ; call rel16/32 (forwards) with opsize override.
|
---|
800 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_call_jv_opsize__ud2
|
---|
801 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_call_jv_opsize__ud2, BS3_PBC_NEAR
|
---|
802 | db 66h, 0e8h ; o32 jmp near .again
|
---|
803 | %if TMPL_BITS != 32
|
---|
804 | dd 12
|
---|
805 | %else
|
---|
806 | dw 12
|
---|
807 | %endif
|
---|
808 | .post_call:
|
---|
809 | times 12 int3
|
---|
810 | .again: ud2
|
---|
811 | int3
|
---|
812 | jmp .again
|
---|
813 | BS3_PROC_END_CMN bs3CpuBasic2_call_jv_opsize__ud2
|
---|
814 |
|
---|
815 |
|
---|
816 | ; call rel16/32 (backwards) with opsize override.
|
---|
817 | BS3_GLOBAL_NAME_EX RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_call_jv_opsize_back__ud2),.again), function, 2
|
---|
818 | ud2
|
---|
819 | times 19 int3
|
---|
820 | BS3_CPUBAS2_UD_OFF bs3CpuBasic2_call_jv_opsize_back__ud2
|
---|
821 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_call_jv_opsize_back__ud2, BS3_PBC_NEAR
|
---|
822 | %if TMPL_BITS != 32
|
---|
823 | db 66h, 0e8h ; o32 call near .again
|
---|
824 | dd RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_call_jv_opsize_back__ud2),.again) - .post_call
|
---|
825 | %else
|
---|
826 | db 66h, 0e8h ; o16 call near .again
|
---|
827 | dw RT_CONCAT(BS3_CMN_NM(bs3CpuBasic2_call_jv_opsize_back__ud2),.again) - .post_call
|
---|
828 | %endif
|
---|
829 | .post_call:
|
---|
830 | int3
|
---|
831 | BS3_PROC_END_CMN bs3CpuBasic2_call_jv_opsize_back__ud2
|
---|
832 |
|
---|
833 |
|
---|
834 | %endif ; BS3_INSTANTIATING_CMN
|
---|
835 |
|
---|
836 | %include "bs3kit-template-footer.mac" ; reset environment
|
---|
837 |
|
---|