1 | ; $Id: bs3-mode-TestDoModesHlp.asm 60000 2016-03-11 19:12:05Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3TestDoModes helpers
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2016 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 | %include "bs3kit-template-header.mac"
|
---|
28 |
|
---|
29 |
|
---|
30 | ;*********************************************************************************************************************************
|
---|
31 | ;* External Symbols *
|
---|
32 | ;*********************************************************************************************************************************
|
---|
33 | extern TMPL_NM(Bs3SwitchToRM)
|
---|
34 | extern TMPL_NM(Bs3SwitchToPE16)
|
---|
35 | extern TMPL_NM(Bs3SwitchToPE16_32)
|
---|
36 | extern TMPL_NM(Bs3SwitchToPE16_V86)
|
---|
37 | extern TMPL_NM(Bs3SwitchToPE32)
|
---|
38 | extern TMPL_NM(Bs3SwitchToPE32_16)
|
---|
39 | extern TMPL_NM(Bs3SwitchToPEV86)
|
---|
40 | extern TMPL_NM(Bs3SwitchToPP16)
|
---|
41 | extern TMPL_NM(Bs3SwitchToPP16_32)
|
---|
42 | extern TMPL_NM(Bs3SwitchToPP16_V86)
|
---|
43 | extern TMPL_NM(Bs3SwitchToPP32)
|
---|
44 | extern TMPL_NM(Bs3SwitchToPP32_16)
|
---|
45 | extern TMPL_NM(Bs3SwitchToPPV86)
|
---|
46 | extern TMPL_NM(Bs3SwitchToPAE16)
|
---|
47 | extern TMPL_NM(Bs3SwitchToPAE16_32)
|
---|
48 | extern TMPL_NM(Bs3SwitchToPAE16_V86)
|
---|
49 | extern TMPL_NM(Bs3SwitchToPAE32)
|
---|
50 | extern TMPL_NM(Bs3SwitchToPAE32_16)
|
---|
51 | extern TMPL_NM(Bs3SwitchToPAEV86)
|
---|
52 | extern TMPL_NM(Bs3SwitchToLM16)
|
---|
53 | extern TMPL_NM(Bs3SwitchToLM32)
|
---|
54 | extern TMPL_NM(Bs3SwitchToLM64)
|
---|
55 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
|
---|
56 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16)
|
---|
57 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_32)
|
---|
58 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_v86)
|
---|
59 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32)
|
---|
60 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32_16)
|
---|
61 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pev86)
|
---|
62 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16)
|
---|
63 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_32)
|
---|
64 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_v86)
|
---|
65 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32)
|
---|
66 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32_16)
|
---|
67 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_ppv86)
|
---|
68 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16)
|
---|
69 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_32)
|
---|
70 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_v86)
|
---|
71 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32)
|
---|
72 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32_16)
|
---|
73 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_paev86)
|
---|
74 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm16)
|
---|
75 | extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm32)
|
---|
76 | extern RT_CONCAT3(Bs3SwitchTo,TMPL_MODE_UNAME,_lm64)
|
---|
77 |
|
---|
78 |
|
---|
79 | ;;
|
---|
80 | ; Shared prologue code.
|
---|
81 | ; @param xAX Where to jump to for the main event.
|
---|
82 | ;
|
---|
83 | BS3_GLOBAL_NAME_EX TMPL_NM(bs3TestCallDoerPrologue), , 0
|
---|
84 | BS3_CALL_CONV_PROLOG 1
|
---|
85 | push xBP
|
---|
86 | mov xBP, xSP
|
---|
87 | xPUSHF
|
---|
88 |
|
---|
89 | ; Save non-volatile registers so the DO function doesn't have to.
|
---|
90 | push xBX
|
---|
91 | push xCX
|
---|
92 | push xDX
|
---|
93 | push xSI
|
---|
94 | push xDI
|
---|
95 | %if TMPL_BITS != 64
|
---|
96 | push ds
|
---|
97 | push es
|
---|
98 | push ss
|
---|
99 | %if TMPL_BITS != 16
|
---|
100 | push fs
|
---|
101 | push gs
|
---|
102 | %endif
|
---|
103 | %endif
|
---|
104 | %if TMPL_BITS == 64
|
---|
105 | push r8
|
---|
106 | push r9
|
---|
107 | push r10
|
---|
108 | push r11
|
---|
109 | push r12
|
---|
110 | push r13
|
---|
111 | push r14
|
---|
112 | push r15
|
---|
113 | %endif
|
---|
114 |
|
---|
115 | ; Jump to the main code.
|
---|
116 | jmp xAX
|
---|
117 |
|
---|
118 | ;;
|
---|
119 | ; Shared epilogue code.
|
---|
120 | ; @param xAX Return code.
|
---|
121 | ;
|
---|
122 | BS3_GLOBAL_NAME_EX TMPL_NM(bs3TestCallDoerEpilogue), , 0
|
---|
123 | ; Restore registers.
|
---|
124 | %if TMPL_BITS == 16
|
---|
125 | sub bp, (1+5+3)*2
|
---|
126 | mov sp, bp
|
---|
127 | %elif TMPL_BITS == 32
|
---|
128 | lea xSP, [xBP - (1+5+5)*4]
|
---|
129 | %else
|
---|
130 | lea xSP, [xBP - (1+5+8)*8]
|
---|
131 | pop r15
|
---|
132 | pop r14
|
---|
133 | pop r13
|
---|
134 | pop r12
|
---|
135 | pop r11
|
---|
136 | pop r10
|
---|
137 | pop r9
|
---|
138 | pop r8
|
---|
139 | %endif
|
---|
140 | %if TMPL_BITS != 64
|
---|
141 | %if TMPL_BITS != 16
|
---|
142 | pop gs
|
---|
143 | pop fs
|
---|
144 | %endif
|
---|
145 | pop ss
|
---|
146 | pop es
|
---|
147 | pop ds
|
---|
148 | %endif
|
---|
149 | pop xDI
|
---|
150 | pop xSI
|
---|
151 | pop xDX
|
---|
152 | pop xCX
|
---|
153 | pop xBX
|
---|
154 | xPOPF
|
---|
155 | pop xBP
|
---|
156 | ret
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
161 | ;; Real mode
|
---|
162 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
163 |
|
---|
164 | ;;
|
---|
165 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInRM(uint16_t offBs3Text16);
|
---|
166 | ; @uses rax
|
---|
167 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInRM
|
---|
168 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
169 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
170 | BS3_BEGIN_TEXT16
|
---|
171 | BS3_SET_BITS TMPL_BITS
|
---|
172 | .doit:
|
---|
173 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
174 |
|
---|
175 | ; Mode switch, make the call, switch back.
|
---|
176 | call TMPL_NM(Bs3SwitchToRM)
|
---|
177 | BS3_SET_BITS 16
|
---|
178 | mov cx, BS3_MODE_RM
|
---|
179 | push cx
|
---|
180 | call ax
|
---|
181 | add sp, 2
|
---|
182 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
|
---|
183 | BS3_SET_BITS TMPL_BITS
|
---|
184 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
185 | TMPL_BEGIN_TEXT
|
---|
186 | BS3_PROC_END_MODE Bs3TestCallDoerInRM
|
---|
187 |
|
---|
188 |
|
---|
189 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
190 | ;; Unpage protection mode.
|
---|
191 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
192 |
|
---|
193 | ;;
|
---|
194 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE16(uint16_t offBs3Text16);
|
---|
195 | ; @uses rax
|
---|
196 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16
|
---|
197 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
198 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
199 | BS3_BEGIN_TEXT16
|
---|
200 | BS3_SET_BITS TMPL_BITS
|
---|
201 | .doit:
|
---|
202 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
203 |
|
---|
204 | ; Mode switch, make the call, switch back.
|
---|
205 | call TMPL_NM(Bs3SwitchToPE16)
|
---|
206 | BS3_SET_BITS 16
|
---|
207 | push BS3_MODE_PE16
|
---|
208 | call ax
|
---|
209 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16)
|
---|
210 | BS3_SET_BITS TMPL_BITS
|
---|
211 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
212 | TMPL_BEGIN_TEXT
|
---|
213 | BS3_PROC_END_MODE Bs3TestCallDoerInPE16
|
---|
214 |
|
---|
215 | ;;
|
---|
216 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE16_32(uint16_t offBs3Text16);
|
---|
217 | ; @uses rax
|
---|
218 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_32
|
---|
219 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
220 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
221 | .doit:
|
---|
222 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
223 |
|
---|
224 | ; Mode switch, make the call, switch back.
|
---|
225 | call TMPL_NM(Bs3SwitchToPE16_32)
|
---|
226 | BS3_SET_BITS 32
|
---|
227 | push BS3_MODE_RM
|
---|
228 | call eax
|
---|
229 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_32)
|
---|
230 | BS3_SET_BITS TMPL_BITS
|
---|
231 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
232 | BS3_PROC_END_MODE Bs3TestCallDoerInPE16_32
|
---|
233 |
|
---|
234 | ;;
|
---|
235 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE16_V86(uint16_t offBs3Text16);
|
---|
236 | ; @uses rax
|
---|
237 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_V86
|
---|
238 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
239 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
240 | .doit:
|
---|
241 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
242 |
|
---|
243 | ; Mode switch, make the call, switch back.
|
---|
244 | call TMPL_NM(Bs3SwitchToPE16_V86)
|
---|
245 | BS3_SET_BITS 16
|
---|
246 | push BS3_MODE_PE16_V86
|
---|
247 | call ax
|
---|
248 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_v86)
|
---|
249 | BS3_SET_BITS TMPL_BITS
|
---|
250 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
251 | BS3_PROC_END_MODE Bs3TestCallDoerInPE16_V86
|
---|
252 |
|
---|
253 | ;;
|
---|
254 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE32(uint16_t offBs3Text16);
|
---|
255 | ; @uses rax
|
---|
256 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32
|
---|
257 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
258 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
259 | .doit:
|
---|
260 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
261 |
|
---|
262 | ; Mode switch, make the call, switch back.
|
---|
263 | call TMPL_NM(Bs3SwitchToPE32)
|
---|
264 | BS3_SET_BITS 32
|
---|
265 | push BS3_MODE_PE32
|
---|
266 | call eax
|
---|
267 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32)
|
---|
268 | BS3_SET_BITS TMPL_BITS
|
---|
269 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
270 | BS3_PROC_END_MODE Bs3TestCallDoerInPE32
|
---|
271 |
|
---|
272 | ;;
|
---|
273 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE32_16(uint16_t offBs3Text16);
|
---|
274 | ; @uses rax
|
---|
275 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32_16
|
---|
276 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
277 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
278 | BS3_BEGIN_TEXT16
|
---|
279 | BS3_SET_BITS TMPL_BITS
|
---|
280 | .doit:
|
---|
281 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
282 |
|
---|
283 | ; Mode switch, make the call, switch back.
|
---|
284 | call TMPL_NM(Bs3SwitchToPE32_16)
|
---|
285 | BS3_SET_BITS 16
|
---|
286 | push BS3_MODE_PE32_16
|
---|
287 | call ax
|
---|
288 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32_16)
|
---|
289 | BS3_SET_BITS TMPL_BITS
|
---|
290 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
291 | TMPL_BEGIN_TEXT
|
---|
292 | BS3_PROC_END_MODE Bs3TestCallDoerInPE32_16
|
---|
293 |
|
---|
294 | ;;
|
---|
295 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPEV86(uint16_t offBs3Text16);
|
---|
296 | ; @uses rax
|
---|
297 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPEV86
|
---|
298 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
299 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
300 | BS3_BEGIN_TEXT16
|
---|
301 | BS3_SET_BITS TMPL_BITS
|
---|
302 | .doit:
|
---|
303 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
304 |
|
---|
305 | ; Mode switch, make the call, switch back.
|
---|
306 | call TMPL_NM(Bs3SwitchToPEV86)
|
---|
307 | BS3_SET_BITS 16
|
---|
308 | push BS3_MODE_PEV86
|
---|
309 | call ax
|
---|
310 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pev86)
|
---|
311 | BS3_SET_BITS TMPL_BITS
|
---|
312 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
313 | TMPL_BEGIN_TEXT
|
---|
314 | BS3_PROC_END_MODE Bs3TestCallDoerInPEV86
|
---|
315 |
|
---|
316 |
|
---|
317 |
|
---|
318 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
319 | ;; Page protection mode.
|
---|
320 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
321 |
|
---|
322 | ;;
|
---|
323 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP16(uint16_t offBs3Text16);
|
---|
324 | ; @uses rax
|
---|
325 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16
|
---|
326 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
327 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
328 | BS3_BEGIN_TEXT16
|
---|
329 | BS3_SET_BITS TMPL_BITS
|
---|
330 | .doit:
|
---|
331 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
332 |
|
---|
333 | ; Mode switch, make the call, switch back.
|
---|
334 | call TMPL_NM(Bs3SwitchToPP16)
|
---|
335 | BS3_SET_BITS 16
|
---|
336 | push BS3_MODE_PP16
|
---|
337 | call ax
|
---|
338 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16)
|
---|
339 | BS3_SET_BITS TMPL_BITS
|
---|
340 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
341 | TMPL_BEGIN_TEXT
|
---|
342 | BS3_PROC_END_MODE Bs3TestCallDoerInPP16
|
---|
343 |
|
---|
344 | ;;
|
---|
345 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP16_32(uint16_t offBs3Text16);
|
---|
346 | ; @uses rax
|
---|
347 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_32
|
---|
348 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
349 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
350 | .doit:
|
---|
351 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
352 |
|
---|
353 | ; Mode switch, make the call, switch back.
|
---|
354 | call TMPL_NM(Bs3SwitchToPP16_32)
|
---|
355 | BS3_SET_BITS 32
|
---|
356 | push BS3_MODE_PP16_32
|
---|
357 | call eax
|
---|
358 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_32)
|
---|
359 | BS3_SET_BITS TMPL_BITS
|
---|
360 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
361 | BS3_PROC_END_MODE Bs3TestCallDoerInPP16_32
|
---|
362 |
|
---|
363 | ;;
|
---|
364 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP16_V86(uint16_t offBs3Text16);
|
---|
365 | ; @uses rax
|
---|
366 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_V86
|
---|
367 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
368 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
369 | .doit:
|
---|
370 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
371 |
|
---|
372 | ; Mode switch, make the call, switch back.
|
---|
373 | call TMPL_NM(Bs3SwitchToPP16_V86)
|
---|
374 | BS3_SET_BITS 16
|
---|
375 | push BS3_MODE_PP16_V86
|
---|
376 | call ax
|
---|
377 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_v86)
|
---|
378 | BS3_SET_BITS TMPL_BITS
|
---|
379 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
380 | BS3_PROC_END_MODE Bs3TestCallDoerInPP16_V86
|
---|
381 |
|
---|
382 | ;;
|
---|
383 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP32(uint16_t offBs3Text16);
|
---|
384 | ; @uses rax
|
---|
385 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32
|
---|
386 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
387 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
388 | .doit:
|
---|
389 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
390 |
|
---|
391 | ; Mode switch, make the call, switch back.
|
---|
392 | call TMPL_NM(Bs3SwitchToPP32)
|
---|
393 | BS3_SET_BITS 32
|
---|
394 | push BS3_MODE_PP32
|
---|
395 | call eax
|
---|
396 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32)
|
---|
397 | BS3_SET_BITS TMPL_BITS
|
---|
398 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
399 | BS3_PROC_END_MODE Bs3TestCallDoerInPP32
|
---|
400 |
|
---|
401 | ;;
|
---|
402 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP32_16(uint16_t offBs3Text16);
|
---|
403 | ; @uses rax
|
---|
404 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32_16
|
---|
405 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
406 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
407 | BS3_BEGIN_TEXT16
|
---|
408 | BS3_SET_BITS TMPL_BITS
|
---|
409 | .doit:
|
---|
410 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
411 |
|
---|
412 | ; Mode switch, make the call, switch back.
|
---|
413 | call TMPL_NM(Bs3SwitchToPP32_16)
|
---|
414 | BS3_SET_BITS 16
|
---|
415 | push BS3_MODE_PP32_16
|
---|
416 | call ax
|
---|
417 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32_16)
|
---|
418 | BS3_SET_BITS TMPL_BITS
|
---|
419 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
420 | TMPL_BEGIN_TEXT
|
---|
421 | BS3_PROC_END_MODE Bs3TestCallDoerInPP32_16
|
---|
422 |
|
---|
423 | ;;
|
---|
424 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPPV86(uint16_t offBs3Text16);
|
---|
425 | ; @uses rax
|
---|
426 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPPV86
|
---|
427 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
428 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
429 | BS3_BEGIN_TEXT16
|
---|
430 | BS3_SET_BITS TMPL_BITS
|
---|
431 | .doit:
|
---|
432 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
433 |
|
---|
434 | ; Mode switch, make the call, switch back.
|
---|
435 | call TMPL_NM(Bs3SwitchToPPV86)
|
---|
436 | BS3_SET_BITS 16
|
---|
437 | push BS3_MODE_PPV86
|
---|
438 | call ax
|
---|
439 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_ppv86)
|
---|
440 | BS3_SET_BITS TMPL_BITS
|
---|
441 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
442 | TMPL_BEGIN_TEXT
|
---|
443 | BS3_PROC_END_MODE Bs3TestCallDoerInPPV86
|
---|
444 |
|
---|
445 |
|
---|
446 |
|
---|
447 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
448 | ;; PAE paged protection mode.
|
---|
449 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
450 |
|
---|
451 | ;;
|
---|
452 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16(uint16_t offBs3Text16);
|
---|
453 | ; @uses rax
|
---|
454 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16
|
---|
455 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
456 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
457 | BS3_BEGIN_TEXT16
|
---|
458 | BS3_SET_BITS TMPL_BITS
|
---|
459 | .doit:
|
---|
460 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
461 |
|
---|
462 | ; Mode switch, make the call, switch back.
|
---|
463 | call TMPL_NM(Bs3SwitchToPAE16)
|
---|
464 | BS3_SET_BITS 16
|
---|
465 | push BS3_MODE_PAE16
|
---|
466 | call ax
|
---|
467 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16)
|
---|
468 | BS3_SET_BITS TMPL_BITS
|
---|
469 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
470 | TMPL_BEGIN_TEXT
|
---|
471 | BS3_PROC_END_MODE Bs3TestCallDoerInPAE16
|
---|
472 |
|
---|
473 | ;;
|
---|
474 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16_32(uint16_t offBs3Text16);
|
---|
475 | ; @uses rax
|
---|
476 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_32
|
---|
477 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
478 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
479 | .doit:
|
---|
480 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
481 |
|
---|
482 | ; Mode switch, make the call, switch back.
|
---|
483 | call TMPL_NM(Bs3SwitchToPAE16_32)
|
---|
484 | BS3_SET_BITS 32
|
---|
485 | push BS3_MODE_PAE16_32
|
---|
486 | call eax
|
---|
487 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_32)
|
---|
488 | BS3_SET_BITS TMPL_BITS
|
---|
489 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
490 | BS3_PROC_END_MODE Bs3TestCallDoerInPAE16_32
|
---|
491 |
|
---|
492 | ;;
|
---|
493 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16_V86(uint16_t offBs3Text16);
|
---|
494 | ; @uses rax
|
---|
495 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_V86
|
---|
496 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
497 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
498 | .doit:
|
---|
499 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
500 |
|
---|
501 | ; Mode switch, make the call, switch back.
|
---|
502 | call TMPL_NM(Bs3SwitchToPAE16_V86)
|
---|
503 | BS3_SET_BITS 16
|
---|
504 | push BS3_MODE_PAE16_V86
|
---|
505 | call ax
|
---|
506 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_v86)
|
---|
507 | BS3_SET_BITS TMPL_BITS
|
---|
508 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
509 | BS3_PROC_END_MODE Bs3TestCallDoerInPAE16_V86
|
---|
510 |
|
---|
511 | ;;
|
---|
512 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE32(uint16_t offBs3Text16);
|
---|
513 | ; @uses rax
|
---|
514 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32
|
---|
515 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
516 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
517 | .doit:
|
---|
518 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
519 |
|
---|
520 | ; Mode switch, make the call, switch back.
|
---|
521 | call TMPL_NM(Bs3SwitchToPAE32)
|
---|
522 | BS3_SET_BITS 32
|
---|
523 | push BS3_MODE_PAE16_32
|
---|
524 | call eax
|
---|
525 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32)
|
---|
526 | BS3_SET_BITS TMPL_BITS
|
---|
527 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
528 | BS3_PROC_END_MODE Bs3TestCallDoerInPAE32
|
---|
529 |
|
---|
530 | ;;
|
---|
531 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE32_16(uint16_t offBs3Text16);
|
---|
532 | ; @uses rax
|
---|
533 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32_16
|
---|
534 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
535 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
536 | BS3_BEGIN_TEXT16
|
---|
537 | BS3_SET_BITS TMPL_BITS
|
---|
538 | .doit:
|
---|
539 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
540 |
|
---|
541 | ; Mode switch, make the call, switch back.
|
---|
542 | call TMPL_NM(Bs3SwitchToPAE32_16)
|
---|
543 | BS3_SET_BITS 16
|
---|
544 | push BS3_MODE_PAE32_16
|
---|
545 | call ax
|
---|
546 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32_16)
|
---|
547 | BS3_SET_BITS TMPL_BITS
|
---|
548 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
549 | TMPL_BEGIN_TEXT
|
---|
550 | BS3_PROC_END_MODE Bs3TestCallDoerInPAE32_16
|
---|
551 |
|
---|
552 | ;;
|
---|
553 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAEV86(uint16_t offBs3Text16);
|
---|
554 | ; @uses rax
|
---|
555 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAEV86
|
---|
556 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
557 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
558 | BS3_BEGIN_TEXT16
|
---|
559 | BS3_SET_BITS TMPL_BITS
|
---|
560 | .doit:
|
---|
561 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
562 |
|
---|
563 | ; Mode switch, make the call, switch back.
|
---|
564 | call TMPL_NM(Bs3SwitchToPAEV86)
|
---|
565 | BS3_SET_BITS 16
|
---|
566 | push BS3_MODE_PAEV86
|
---|
567 | call ax
|
---|
568 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_paev86)
|
---|
569 | BS3_SET_BITS TMPL_BITS
|
---|
570 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
571 | TMPL_BEGIN_TEXT
|
---|
572 | BS3_PROC_END_MODE Bs3TestCallDoerInPAEV86
|
---|
573 |
|
---|
574 |
|
---|
575 |
|
---|
576 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
577 | ;; Long mode
|
---|
578 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
579 |
|
---|
580 | ;;
|
---|
581 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInLM16(uint16_t offBs3Text16);
|
---|
582 | ; @uses rax
|
---|
583 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM16
|
---|
584 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
585 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
586 | BS3_BEGIN_TEXT16
|
---|
587 | BS3_SET_BITS TMPL_BITS
|
---|
588 | .doit:
|
---|
589 | mov ax, [xBP + xCB*2] ; Load function pointer.
|
---|
590 |
|
---|
591 | ; Mode switch, make the call, switch back.
|
---|
592 | call TMPL_NM(Bs3SwitchToLM16)
|
---|
593 | BS3_SET_BITS 16
|
---|
594 | push BS3_MODE_LM16
|
---|
595 | call ax
|
---|
596 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm16)
|
---|
597 | BS3_SET_BITS TMPL_BITS
|
---|
598 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
599 | TMPL_BEGIN_TEXT
|
---|
600 | BS3_PROC_END_MODE Bs3TestCallDoerInLM16
|
---|
601 |
|
---|
602 | ;;
|
---|
603 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInLM32(uint16_t offBs3Text16);
|
---|
604 | ; @uses rax
|
---|
605 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM32
|
---|
606 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
607 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
608 | .doit:
|
---|
609 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
610 |
|
---|
611 | ; Mode switch, make the call, switch back.
|
---|
612 | call TMPL_NM(Bs3SwitchToLM32)
|
---|
613 | BS3_SET_BITS 32
|
---|
614 | and esp, ~03h
|
---|
615 | push BS3_MODE_LM32
|
---|
616 | call eax
|
---|
617 | call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm32)
|
---|
618 | BS3_SET_BITS TMPL_BITS
|
---|
619 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
620 | BS3_PROC_END_MODE Bs3TestCallDoerInLM32
|
---|
621 |
|
---|
622 | ;;
|
---|
623 | ; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInLM64(uint16_t offBs3Text16);
|
---|
624 | ; @uses rax
|
---|
625 | BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM64
|
---|
626 | BS3_LEA_MOV_WRT_RIP(xAX, .doit)
|
---|
627 | jmp TMPL_NM(bs3TestCallDoerPrologue)
|
---|
628 | .doit:
|
---|
629 | mov eax, [xBP + xCB*2] ; Load function pointer.
|
---|
630 |
|
---|
631 | ; Mode switch, make the call, switch back.
|
---|
632 | call TMPL_NM(Bs3SwitchToLM64)
|
---|
633 | BS3_SET_BITS 64
|
---|
634 | and rsp, ~0fh
|
---|
635 | sub rsp, 18h
|
---|
636 | push BS3_MODE_LM64
|
---|
637 | BS3_CALL rax, 1
|
---|
638 | call RT_CONCAT3(Bs3SwitchTo,TMPL_MODE_UNAME,_lm64)
|
---|
639 | BS3_SET_BITS TMPL_BITS
|
---|
640 | jmp TMPL_NM(bs3TestCallDoerEpilogue)
|
---|
641 | BS3_PROC_END_MODE Bs3TestCallDoerInLM64
|
---|
642 |
|
---|