VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModesHlp.asm@ 60001

Last change on this file since 60001 was 60000, checked in by vboxsync, 9 years ago

bs3kit: v8086, long, fixes, updates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.2 KB
Line 
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;*********************************************************************************************************************************
33extern TMPL_NM(Bs3SwitchToRM)
34extern TMPL_NM(Bs3SwitchToPE16)
35extern TMPL_NM(Bs3SwitchToPE16_32)
36extern TMPL_NM(Bs3SwitchToPE16_V86)
37extern TMPL_NM(Bs3SwitchToPE32)
38extern TMPL_NM(Bs3SwitchToPE32_16)
39extern TMPL_NM(Bs3SwitchToPEV86)
40extern TMPL_NM(Bs3SwitchToPP16)
41extern TMPL_NM(Bs3SwitchToPP16_32)
42extern TMPL_NM(Bs3SwitchToPP16_V86)
43extern TMPL_NM(Bs3SwitchToPP32)
44extern TMPL_NM(Bs3SwitchToPP32_16)
45extern TMPL_NM(Bs3SwitchToPPV86)
46extern TMPL_NM(Bs3SwitchToPAE16)
47extern TMPL_NM(Bs3SwitchToPAE16_32)
48extern TMPL_NM(Bs3SwitchToPAE16_V86)
49extern TMPL_NM(Bs3SwitchToPAE32)
50extern TMPL_NM(Bs3SwitchToPAE32_16)
51extern TMPL_NM(Bs3SwitchToPAEV86)
52extern TMPL_NM(Bs3SwitchToLM16)
53extern TMPL_NM(Bs3SwitchToLM32)
54extern TMPL_NM(Bs3SwitchToLM64)
55extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
56extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16)
57extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_32)
58extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_v86)
59extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32)
60extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32_16)
61extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pev86)
62extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16)
63extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_32)
64extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_v86)
65extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32)
66extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32_16)
67extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_ppv86)
68extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16)
69extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_32)
70extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_v86)
71extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32)
72extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32_16)
73extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_paev86)
74extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm16)
75extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm32)
76extern 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;
83BS3_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;
122BS3_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
167BS3_PROC_BEGIN_MODE Bs3TestCallDoerInRM
168 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
169 jmp TMPL_NM(bs3TestCallDoerPrologue)
170BS3_BEGIN_TEXT16
171BS3_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)
185TMPL_BEGIN_TEXT
186BS3_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
196BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16
197 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
198 jmp TMPL_NM(bs3TestCallDoerPrologue)
199BS3_BEGIN_TEXT16
200BS3_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)
212TMPL_BEGIN_TEXT
213BS3_PROC_END_MODE Bs3TestCallDoerInPE16
214
215;;
216; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE16_32(uint16_t offBs3Text16);
217; @uses rax
218BS3_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)
232BS3_PROC_END_MODE Bs3TestCallDoerInPE16_32
233
234;;
235; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE16_V86(uint16_t offBs3Text16);
236; @uses rax
237BS3_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)
251BS3_PROC_END_MODE Bs3TestCallDoerInPE16_V86
252
253;;
254; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE32(uint16_t offBs3Text16);
255; @uses rax
256BS3_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)
270BS3_PROC_END_MODE Bs3TestCallDoerInPE32
271
272;;
273; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPE32_16(uint16_t offBs3Text16);
274; @uses rax
275BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32_16
276 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
277 jmp TMPL_NM(bs3TestCallDoerPrologue)
278BS3_BEGIN_TEXT16
279BS3_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)
291TMPL_BEGIN_TEXT
292BS3_PROC_END_MODE Bs3TestCallDoerInPE32_16
293
294;;
295; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPEV86(uint16_t offBs3Text16);
296; @uses rax
297BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPEV86
298 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
299 jmp TMPL_NM(bs3TestCallDoerPrologue)
300BS3_BEGIN_TEXT16
301BS3_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)
313TMPL_BEGIN_TEXT
314BS3_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
325BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16
326 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
327 jmp TMPL_NM(bs3TestCallDoerPrologue)
328BS3_BEGIN_TEXT16
329BS3_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)
341TMPL_BEGIN_TEXT
342BS3_PROC_END_MODE Bs3TestCallDoerInPP16
343
344;;
345; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP16_32(uint16_t offBs3Text16);
346; @uses rax
347BS3_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)
361BS3_PROC_END_MODE Bs3TestCallDoerInPP16_32
362
363;;
364; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP16_V86(uint16_t offBs3Text16);
365; @uses rax
366BS3_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)
380BS3_PROC_END_MODE Bs3TestCallDoerInPP16_V86
381
382;;
383; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP32(uint16_t offBs3Text16);
384; @uses rax
385BS3_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)
399BS3_PROC_END_MODE Bs3TestCallDoerInPP32
400
401;;
402; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPP32_16(uint16_t offBs3Text16);
403; @uses rax
404BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32_16
405 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
406 jmp TMPL_NM(bs3TestCallDoerPrologue)
407BS3_BEGIN_TEXT16
408BS3_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)
420TMPL_BEGIN_TEXT
421BS3_PROC_END_MODE Bs3TestCallDoerInPP32_16
422
423;;
424; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPPV86(uint16_t offBs3Text16);
425; @uses rax
426BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPPV86
427 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
428 jmp TMPL_NM(bs3TestCallDoerPrologue)
429BS3_BEGIN_TEXT16
430BS3_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)
442TMPL_BEGIN_TEXT
443BS3_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
454BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16
455 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
456 jmp TMPL_NM(bs3TestCallDoerPrologue)
457BS3_BEGIN_TEXT16
458BS3_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)
470TMPL_BEGIN_TEXT
471BS3_PROC_END_MODE Bs3TestCallDoerInPAE16
472
473;;
474; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16_32(uint16_t offBs3Text16);
475; @uses rax
476BS3_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)
490BS3_PROC_END_MODE Bs3TestCallDoerInPAE16_32
491
492;;
493; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16_V86(uint16_t offBs3Text16);
494; @uses rax
495BS3_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)
509BS3_PROC_END_MODE Bs3TestCallDoerInPAE16_V86
510
511;;
512; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE32(uint16_t offBs3Text16);
513; @uses rax
514BS3_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)
528BS3_PROC_END_MODE Bs3TestCallDoerInPAE32
529
530;;
531; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAE32_16(uint16_t offBs3Text16);
532; @uses rax
533BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32_16
534 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
535 jmp TMPL_NM(bs3TestCallDoerPrologue)
536BS3_BEGIN_TEXT16
537BS3_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)
549TMPL_BEGIN_TEXT
550BS3_PROC_END_MODE Bs3TestCallDoerInPAE32_16
551
552;;
553; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInPAEV86(uint16_t offBs3Text16);
554; @uses rax
555BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAEV86
556 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
557 jmp TMPL_NM(bs3TestCallDoerPrologue)
558BS3_BEGIN_TEXT16
559BS3_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)
571TMPL_BEGIN_TEXT
572BS3_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
583BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM16
584 BS3_LEA_MOV_WRT_RIP(xAX, .doit)
585 jmp TMPL_NM(bs3TestCallDoerPrologue)
586BS3_BEGIN_TEXT16
587BS3_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)
599TMPL_BEGIN_TEXT
600BS3_PROC_END_MODE Bs3TestCallDoerInLM16
601
602;;
603; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInLM32(uint16_t offBs3Text16);
604; @uses rax
605BS3_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)
620BS3_PROC_END_MODE Bs3TestCallDoerInLM32
621
622;;
623; @cproto BS3_DECL(uint8_t) Bs3TestCallDoerInLM64(uint16_t offBs3Text16);
624; @uses rax
625BS3_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)
641BS3_PROC_END_MODE Bs3TestCallDoerInLM64
642
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette