VirtualBox

Changeset 60557 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Apr 19, 2016 3:01:35 AM (9 years ago)
Author:
vboxsync
Message:

bs3kit: move real mode version of Bs3TestDoModes out of the default 16-bit code segment.

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
1 added
38 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r60554 r60557  
    219219
    220220bs3kit-common-16_VBOX_NEAR_TO_FAR_MODE_FUNCTIONS := \
    221         Bs3TestDoModes \
    222221        Bs3TrapInit \
    223222
     
    232231bs3kit-common-32_ASDEFS   = RT_ASMDEFS_INC_FIRST_FILE
    233232bs3kit-common-32_SOURCES  = $(VBOX_BS3KIT_COMMON_SOURCES) \
     233       bs3-cmn-SwitchHlpConvFlatRetToRetfProtMode.asm \
    234234        bs3-cmn-UInt64Div.c \
    235235        bs3-wc32-U8D.asm \
     
    247247bs3kit-common-64_ASDEFS   = RT_ASMDEFS_INC_FIRST_FILE
    248248bs3kit-common-64_SOURCES  = $(VBOX_BS3KIT_COMMON_SOURCES) \
     249       bs3-cmn-SwitchHlpConvFlatRetToRetfProtMode.asm \
    249250       bs3-c64-Trap64Generic.asm \
    250251       ../../../Runtime/common/asm/ASMGetIDTR.asm \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelFlatCodeToRealMode.asm

    r60539 r60557  
    3535;*      Global Variables                                                                                                         *
    3636;*********************************************************************************************************************************
    37 extern Bs3X0Text16_EndOfSegment
    38 extern Bs3X1Text16_EndOfSegment
     37BS3_EXTERN_DATA16 Bs3RmText16_EndOfSegment
     38BS3_EXTERN_DATA16 Bs3X0Text16_EndOfSegment
     39BS3_EXTERN_DATA16 Bs3X1Text16_EndOfSegment
    3940
    4041
     
    4344;
    4445BS3_BEGIN_TEXT16
     46BS3_BEGIN_RMTEXT16
    4547BS3_BEGIN_X0TEXT16
    4648BS3_BEGIN_X1TEXT16
     
    7779
    7880        mov     ax, dx
    79         sub     ax, BS3TEXT16
     81        sub     ax, CGROUP16
    8082        cmp     ax, 1000h
    8183        jb      .bs3text16
    8284
    8385        mov     ax, dx
    84         sub     ax, BS3X0TEXT16
     86        sub     ax, BS3GROUPRMTEXT16
     87        mov     bx, Bs3RmText16_EndOfSegment wrt BS3GROUPRMTEXT16
     88        add     bx, 15
     89        shr     bx, cl
     90        cmp     ax, bx
     91        jb      .bs3rmtext16
     92
     93        mov     ax, dx
     94        sub     ax, BS3GROUPX0TEXT16
    8595        mov     bx, Bs3X0Text16_EndOfSegment wrt BS3GROUPX0TEXT16
    8696        add     bx, 15
     
    90100
    91101        mov     ax, dx
    92         sub     ax, BS3X1TEXT16
     102        sub     ax, BS3GROUPX1TEXT16
    93103        mov     bx, Bs3X1Text16_EndOfSegment wrt BS3GROUPX1TEXT16
    94104        add     bx, 15
     
    104114        ;
    105115.bs3x1text16:
    106         mov     dx, BS3X1TEXT16
     116        mov     dx, BS3GROUPX1TEXT16
    107117        jmp     .calc_return
    108118.bs3x0text16:
    109         mov     dx, BS3X0TEXT16
     119        mov     dx, BS3GROUPX0TEXT16
     120        jmp     .calc_return
     121.bs3rmtext16:
     122        mov     dx, BS3GROUPRMTEXT16
    110123        jmp     .calc_return
    111124.bs3text16:
    112         mov     dx, BS3X0TEXT16
     125        mov     dx, CGROUP16
    113126.calc_return:
    114127        ; Convert the real-mode frame into the low 16-bit base (BX).
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelProtModeCodeToRealMode.asm

    r60554 r60557  
    3131;
    3232BS3_BEGIN_TEXT16
     33BS3_BEGIN_RMTEXT16
    3334BS3_BEGIN_X0TEXT16
    3435BS3_BEGIN_X1TEXT16
     
    5051
    5152        ; We're allowed to use the real-mode segment value.
    52         cmp     ax, BS3TEXT16
     53        cmp     ax, CGROUP16
    5354        je      .bs3text16
    5455
     
    5657        cmp     ax, BS3_SEL_R0_CS16
    5758        je      .bs3text16
     59        cmp     ax, BS3_SEL_RMTEXT16_CS
     60        je      .bs3rmtext16
    5861        cmp     ax, BS3_SEL_X0TEXT16_CS
    5962        je      .bs3x0text16
     
    8184        je      .bs3text16
    8285.panic:
     86hlt
    8387        extern  BS3_CMN_NM(Bs3Panic)
    8488        call    BS3_CMN_NM(Bs3Panic)
     
    8690
    8791.bs3x1text16:
    88         mov     ax, BS3_SEL_X1TEXT16_CS
     92        mov     ax, BS3GROUPX1TEXT16
    8993        jmp     .return
    9094.bs3x0text16:
    91         mov     ax, BS3_SEL_X0TEXT16_CS
     95        mov     ax, BS3GROUPX0TEXT16
     96        jmp     .return
     97.bs3rmtext16:
     98        mov     ax, BS3GROUPRMTEXT16
    9299        jmp     .return
    93100.bs3text16:
    94         mov     ax, BS3TEXT16
     101        mov     ax, CGROUP16
    95102.return:
    96103        pop     xBP
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelRealModeCodeToProtMode.asm

    r60554 r60557  
    3131;
    3232BS3_BEGIN_TEXT16
     33BS3_BEGIN_RMTEXT16
    3334BS3_BEGIN_X0TEXT16
    3435BS3_BEGIN_X1TEXT16
     
    4647
    4748        mov     ax, [xBP + xCB + cbCurRetAddr]
    48         cmp     ax, BS3TEXT16
     49        cmp     ax, CGROUP16
    4950        je      .bs3text16
    50         cmp     ax, BS3X0TEXT16
     51        cmp     ax, BS3GROUPRMTEXT16
     52        je      .bs3rmtext16
     53        cmp     ax, BS3GROUPX0TEXT16
    5154        je      .bs3x0text16
    52         cmp     ax, BS3X1TEXT16
     55        cmp     ax, BS3GROUPX1TEXT16
    5356        je      .bs3x1text16
     57
    5458        extern  BS3_CMN_NM(Bs3Panic)
    5559        call    BS3_CMN_NM(Bs3Panic)
     
    6165.bs3x0text16:
    6266        mov     ax, BS3_SEL_X0TEXT16_CS
     67        jmp     .return
     68.bs3rmtext16:
     69        mov     ax, BS3_SEL_RMTEXT16_CS
    6370        jmp     .return
    6471.bs3text16:
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchHlpConvRealModeRetfPopBpDecBpAndReturn.asm

    r60554 r60557  
    5151        push        ax
    5252        BS3_EXTERN_CMN Bs3SelRealModeCodeToProtMode
    53         call        Bs3SelRealModeCodeToProtMode ; This doesn't trash any registers (except AX).
     53        call        Bs3SelRealModeCodeToProtMode    ; This doesn't trash any registers (except AX).
    5454        add         sp, 2
    5555        mov         [bp + 2 + 2], ax
     
    6161        retf
    6262
    63 %else
     63%elif TMPL_BITS == 32
    6464        push    xAX
    6565        push    xDX
    6666
    67         movzx   eax, word [xSP + 4*2 + 2 + 2]   ; return segment
    68         movzx   edx, word [xSP + 4*2 + 2]       ; return offset
     67        movzx   eax, word [xSP + xCB*2 + 2 + 2]     ; return segment
     68        movzx   edx, word [xSP + xCB*2 + 2]         ; return offset
    6969        shl     eax, 4
    7070        add     eax, edx
    71         mov     [xSP + 4*3 + 2], eax
     71        mov     [xSP + xCB*2 + 2], eax
    7272
    7373        pop     xDX
    7474        pop     xAX
    75  %if TMPL_BITS == 32
    7675        pop     bp
    7776        dec     bp
    7877        ret
    79  %else
    80         mov     bp, [rsp]
    81         add     rsp, 2h
     78%else
     79        sub     rsp, 2h
     80
     81        push    xAX
     82        push    xDX
     83
     84        movzx   eax, word [xSP + xCB*2 + 4 + 2]     ; return segment
     85        movzx   edx, word [xSP + xCB*2 + 4]         ; return offset
     86        shl     eax, 4
     87        add     eax, edx
     88
     89        mov     bp, [xSP + xCB*2 + 2]
    8290        dec     bp
    83         o32 ret
    84  %endif
     91
     92        mov     [xSP + xCB*2], rax
     93
     94        pop     xDX
     95        pop     xAX
     96        ret
    8597%endif
    8698BS3_PROC_END_CMN   Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSendCmdWithU32.asm

    r60527 r60557  
    6868%endif
    6969
    70 %if TMPL_BITS == 16
    71         pop     sAX
    72 %endif
    7370.no_vmmdev:
    7471        pop     xSI
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac

    r60554 r60557  
    9898BS3_GLOBAL_DATA Bs3TotalImageSize, 4
    9999    dd  BS3_DATA_NM(Bs3Data64_EndOfSegment) wrt CGROUP16
     100
    100101BS3_GLOBAL_DATA Bs3Text16_Size, 2
    101102    dw  BS3_DATA_NM(Bs3Text16_EndOfSegment) wrt CGROUP16
     103BS3_GLOBAL_DATA Bs3RmText16_Size, 2
     104    dw  BS3_DATA_NM(Bs3RmText16_EndOfSegment) wrt BS3GROUPRMTEXT16
    102105BS3_GLOBAL_DATA Bs3X0Text16_Size, 2
    103106    dw  BS3_DATA_NM(Bs3X0Text16_EndOfSegment) wrt BS3GROUPX0TEXT16
    104107BS3_GLOBAL_DATA Bs3X1Text16_Size, 2
    105108    dw  BS3_DATA_NM(Bs3X1Text16_EndOfSegment) wrt BS3GROUPX1TEXT16
     109
     110BS3_GLOBAL_DATA Bs3RmText16_FlatAddr, 4
     111    dd  BS3_DATA_NM(Bs3RmText16_StartOfSegment) wrt BS3FLAT
    106112BS3_GLOBAL_DATA Bs3X0Text16_FlatAddr, 4
    107113    dd  BS3_DATA_NM(Bs3X0Text16_StartOfSegment) wrt BS3FLAT
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm

    r60554 r60557  
    189189%if BS3_MODE_IS_RM_SYS(TMPL_MODE)
    190190        extern         _Bs3TrapSystemCallHandler_rm
    191         mov     word [ss: BS3_TRAP_SYSCALL*4], _Bs3TrapSystemCallHandler_rm wrt BS3TEXT16
    192         mov     word [ss: BS3_TRAP_SYSCALL*4 + 2], BS3TEXT16
     191        mov     word [ss: BS3_TRAP_SYSCALL*4], _Bs3TrapSystemCallHandler_rm wrt CGROUP16
     192        mov     word [ss: BS3_TRAP_SYSCALL*4 + 2], CGROUP16
    193193
    194194%elif BS3_MODE_IS_16BIT_SYS(TMPL_MODE)
     
    198198        TMPL_BEGIN_TEXT
    199199        push    0                       ; cParams
    200         push    TMPL_NM(Bs3TrapSystemCallHandler) wrt BS3TEXT16
     200        push    TMPL_NM(Bs3TrapSystemCallHandler) wrt CGROUP16
    201201        push    BS3_SEL_R0_CS16
    202202        push    3                       ; DPL
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM16.asm

    r60554 r60557  
    4141; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4242;
     43%if TMPL_BITS == 16
     44BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToLM16_Safe), function , 0
     45%endif
    4346BS3_PROC_BEGIN_MODE Bs3SwitchToLM16, BS3_PBC_NEAR
    4447%ifdef TMPL_LM16
     
    106109 %endif
    107110BS3_PROC_END_MODE   Bs3SwitchToLM16
     111
     112%else
     113;;
     114; Safe far return to non-BS3TEXT16 code.
     115BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     116BS3_BEGIN_TEXT16
     117BS3_SET_BITS TMPL_BITS
     118BS3_PROC_BEGIN_MODE Bs3SwitchToLM16_Safe, BS3_PBC_NEAR
     119        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     120        call        TMPL_NM(Bs3SwitchToLM16)
     121        BS3_SET_BITS 16
     122        retf
     123BS3_PROC_END_MODE   Bs3SwitchToLM16_Safe
     124
    108125%endif
    109126
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM32.asm

    r60554 r60557  
    4444; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4545;
     46BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToLM32_Safe), function, 0
    4647BS3_PROC_BEGIN_MODE Bs3SwitchToLM32, BS3_PBC_NEAR
    4748%ifdef TMPL_LM32
     
    168169        ; Jmp to common code for the tedious conversion.
    169170 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    170         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    171         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     171        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     172        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    172173 %else
    173         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    174         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     174        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     175        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    175176 %endif
    176177        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM64.asm

    r60554 r60557  
    4141; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4242;
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToLM16_Safe), function, 0
    4344BS3_PROC_BEGIN_MODE Bs3SwitchToLM64, BS3_PBC_NEAR
    4445%ifdef TMPL_LM64
     
    9293        ; Jmp to common code for the tedious conversion.
    9394 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    94         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    95         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     95        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c64
     96        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c64
    9697 %else
    97         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    98         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     98        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c64
     99        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c64
    99100 %endif
    100101        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16.asm

    r60554 r60557  
    4747; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4848;
     49%if TMPL_BITS == 16
     50BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPAE16_Safe), function , 0
     51%endif
    4952BS3_PROC_BEGIN_MODE Bs3SwitchToPAE16, BS3_PBC_NEAR
    5053%ifdef TMPL_PAE16
     
    189192 %endif
    190193BS3_PROC_END_MODE   Bs3SwitchToPAE16
    191 %endif
    192 
     194
     195%else
     196;;
     197; Safe far return to non-BS3TEXT16 code.
     198BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     199BS3_BEGIN_TEXT16
     200BS3_SET_BITS TMPL_BITS
     201BS3_PROC_BEGIN_MODE Bs3SwitchToPAE16_Safe, BS3_PBC_NEAR
     202        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     203        call        TMPL_NM(Bs3SwitchToPAE16)
     204        BS3_SET_BITS 16
     205        retf
     206BS3_PROC_END_MODE   Bs3SwitchToPAE16_Safe
     207%endif
     208
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16_32.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPAE16_32_Safe), function, 0
    4243BS3_PROC_BEGIN_MODE Bs3SwitchToPAE16_32, BS3_PBC_NEAR
    4344%ifdef TMPL_PAE16_32
     
    9293        ; Jmp to common code for the tedious conversion.
    9394 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    94         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    95         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     95        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     96        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    9697 %else
    97         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    98         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     98        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     99        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    99100 %endif
    100101        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16_V86.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPAE16_V86_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPAE16_V86, BS3_PBC_NEAR
    4346%ifdef TMPL_PAE16_V86
     
    9598 %endif
    9699BS3_PROC_END_MODE   Bs3SwitchToPAE16_V86
     100
     101%else
     102;;
     103; Safe far return to non-BS3TEXT16 code.
     104BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     105BS3_BEGIN_TEXT16
     106BS3_SET_BITS TMPL_BITS
     107BS3_PROC_BEGIN_MODE Bs3SwitchToPAE16_V86_Safe, BS3_PBC_NEAR
     108        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     109        call        TMPL_NM(Bs3SwitchToPAE16_V86)
     110        BS3_SET_BITS 16
     111        retf
     112BS3_PROC_END_MODE   Bs3SwitchToPAE16_V86_Safe
    97113%endif
    98114
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE32.asm

    r60554 r60557  
    4242; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4343;
     44BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPAE32_Safe), function, 0
    4445BS3_PROC_BEGIN_MODE Bs3SwitchToPAE32, BS3_PBC_NEAR
    4546%ifdef TMPL_PAE32
     
    174175        ; Jmp to common code for the tedious conversion.
    175176 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    176         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    177         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     177        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     178        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    178179 %else
    179         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    180         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     180        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     181        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    181182 %endif
    182183        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE32_16.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPAE32_16_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPAE32_16, BS3_PBC_NEAR
    4346%if TMPL_MODE == BS3_MODE_PAE32_16
     
    8083BS3_PROC_END_MODE   Bs3SwitchToPAE32_16
    8184
     85
    8286%if TMPL_BITS == 16
    8387;;
     
    102106 %endif
    103107BS3_PROC_END_MODE   Bs3SwitchToPAE32_16
     108
     109%else
     110;;
     111; Safe far return to non-BS3TEXT16 code.
     112BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     113BS3_BEGIN_TEXT16
     114BS3_SET_BITS TMPL_BITS
     115BS3_PROC_BEGIN_MODE Bs3SwitchToPAE32_16_Safe, BS3_PBC_NEAR
     116        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     117        call        TMPL_NM(Bs3SwitchToPAE32_16)
     118        BS3_SET_BITS 16
     119        retf
     120BS3_PROC_END_MODE   Bs3SwitchToPAE32_16_Safe
    104121%endif
    105122
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAEV86.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPAEV86_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPAEV86, BS3_PBC_NEAR
    4346%if TMPL_MODE == BS3_MODE_PAEV86
     
    8992 %endif
    9093BS3_PROC_END_MODE   Bs3SwitchToPAEV86
     94
     95%else
     96;;
     97; Safe far return to non-BS3TEXT16 code.
     98BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     99BS3_BEGIN_TEXT16
     100BS3_SET_BITS TMPL_BITS
     101BS3_PROC_BEGIN_MODE Bs3SwitchToPAEV86_Safe, BS3_PBC_NEAR
     102        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     103        call        TMPL_NM(Bs3SwitchToPAEV86)
     104        BS3_SET_BITS 16
     105        retf
     106BS3_PROC_END_MODE   Bs3SwitchToPAEV86_Safe
    91107%endif
    92108
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPE16_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPE16, BS3_PBC_NEAR
    4346%ifdef TMPL_PE16
     
    148151 %endif
    149152BS3_PROC_END_MODE   Bs3SwitchToPE16
     153
     154%else
     155;;
     156; Safe far return to non-BS3TEXT16 code.
     157BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     158BS3_BEGIN_TEXT16
     159BS3_SET_BITS TMPL_BITS
     160BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_Safe, BS3_PBC_NEAR
     161        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     162        call        TMPL_NM(Bs3SwitchToPE16)
     163        BS3_SET_BITS 16
     164        retf
     165BS3_PROC_END_MODE   Bs3SwitchToPE16_Safe
    150166%endif
    151167
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_32.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPE16_32_Safe), function, 0
    4243BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_32, BS3_PBC_NEAR
    4344%ifdef TMPL_PE16_32
     
    9293        ; Jmp to common code for the tedious conversion.
    9394 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    94         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    95         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     95        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     96        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    9697 %else
    97         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    98         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     98        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     99        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    99100 %endif
    100101        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_V86.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPE16_V86_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_V86, BS3_PBC_NEAR
    4346%ifdef TMPL_PE16_V86
     
    9598 %endif
    9699BS3_PROC_END_MODE   Bs3SwitchToPE16_V86
     100
     101%else
     102;;
     103; Safe far return to non-BS3TEXT16 code.
     104BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     105BS3_BEGIN_TEXT16
     106BS3_SET_BITS TMPL_BITS
     107BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_V86_Safe, BS3_PBC_NEAR
     108        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     109        call        TMPL_NM(Bs3SwitchToPE16_V86)
     110        BS3_SET_BITS 16
     111        retf
     112BS3_PROC_END_MODE   Bs3SwitchToPE16_V86_Safe
    97113%endif
    98114
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE32.asm

    r60554 r60557  
    4141; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4242;
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPE32_Safe), function, 0
    4344BS3_PROC_BEGIN_MODE Bs3SwitchToPE32, BS3_PBC_NEAR
    4445%ifdef TMPL_PE32
     
    152153        ; Jmp to common code for the tedious conversion.
    153154 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    154         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    155         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     155        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     156        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    156157 %else
    157         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    158         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     158        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     159        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    159160 %endif
    160161        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE32_16.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPE32_16_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPE32_16, BS3_PBC_NEAR
    4346%if TMPL_MODE == BS3_MODE_PE32_16
     
    103106 %endif
    104107BS3_PROC_END_MODE   Bs3SwitchToPE32_16
     108
     109%else
     110;;
     111; Safe far return to non-BS3TEXT16 code.
     112BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     113BS3_BEGIN_TEXT16
     114BS3_SET_BITS TMPL_BITS
     115BS3_PROC_BEGIN_MODE Bs3SwitchToPE32_16_Safe, BS3_PBC_NEAR
     116        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     117        call        TMPL_NM(Bs3SwitchToPE32_16)
     118        BS3_SET_BITS 16
     119        retf
     120BS3_PROC_END_MODE   Bs3SwitchToPE32_16_Safe
    105121%endif
    106122
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPEV86.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPEV86_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPEV86, BS3_PBC_NEAR
    4346%if TMPL_MODE == BS3_MODE_PEV86
     
    8992 %endif
    9093BS3_PROC_END_MODE   Bs3SwitchToPEV86
     94
     95%else
     96;;
     97; Safe far return to non-BS3TEXT16 code.
     98BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     99BS3_BEGIN_TEXT16
     100BS3_SET_BITS TMPL_BITS
     101BS3_PROC_BEGIN_MODE Bs3SwitchToPEV86_Safe, BS3_PBC_NEAR
     102        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     103        call        TMPL_NM(Bs3SwitchToPEV86)
     104        BS3_SET_BITS 16
     105        retf
     106BS3_PROC_END_MODE   Bs3SwitchToPEV86_Safe
    91107%endif
    92108
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16.asm

    r60554 r60557  
    4747; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4848;
     49%if TMPL_BITS == 16
     50BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPP16_Safe), function , 0
     51%endif
    4952BS3_PROC_BEGIN_MODE Bs3SwitchToPP16, BS3_PBC_NEAR
    5053%ifdef TMPL_PP16
     
    205208 %endif
    206209BS3_PROC_END_MODE   Bs3SwitchToPP16
    207 %endif
    208 
     210
     211%else
     212;;
     213; Safe far return to non-BS3TEXT16 code.
     214BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     215BS3_BEGIN_TEXT16
     216BS3_SET_BITS TMPL_BITS
     217BS3_PROC_BEGIN_MODE Bs3SwitchToPP16_Safe, BS3_PBC_NEAR
     218        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     219        call        TMPL_NM(Bs3SwitchToPP16)
     220        BS3_SET_BITS 16
     221        retf
     222BS3_PROC_END_MODE   Bs3SwitchToPP16_Safe
     223%endif
     224
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16_32.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPP16_32_Safe), function, 0
    4243BS3_PROC_BEGIN_MODE Bs3SwitchToPP16_32, BS3_PBC_NEAR
    4344%ifdef TMPL_PP16_32
     
    9293        ; Jmp to common code for the tedious conversion.
    9394 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    94         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    95         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     95        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     96        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    9697 %else
    97         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    98         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     98        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     99        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    99100 %endif
    100101        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16_V86.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPP16_V86_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPP16_V86, BS3_PBC_NEAR
    4346%ifdef TMPL_PP16_V86
     
    9598 %endif
    9699BS3_PROC_END_MODE   Bs3SwitchToPP16_V86
     100
     101%else
     102;;
     103; Safe far return to non-BS3TEXT16 code.
     104BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     105BS3_BEGIN_TEXT16
     106BS3_SET_BITS TMPL_BITS
     107BS3_PROC_BEGIN_MODE Bs3SwitchToPP16_V86_Safe, BS3_PBC_NEAR
     108        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     109        call        TMPL_NM(Bs3SwitchToPP16_V86)
     110        BS3_SET_BITS 16
     111        retf
     112BS3_PROC_END_MODE   Bs3SwitchToPP16_V86_Safe
    97113%endif
    98114
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP32.asm

    r60554 r60557  
    4242; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4343;
     44BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPP32_Safe), function, 0
    4445BS3_PROC_BEGIN_MODE Bs3SwitchToPP32, BS3_PBC_NEAR
    4546%ifdef TMPL_PP32
     
    182183        ; Jmp to common code for the tedious conversion.
    183184 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE)
    184         BS3_EXTERN_CMN Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
    185         jmp         Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn
     185        extern      _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
     186        jmp         _Bs3SwitchHlpConvRealModeRetfPopBpDecBpAndReturn_c32
    186187 %else
    187         BS3_EXTERN_CMN Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
    188         jmp         Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn
     188        extern      _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
     189        jmp         _Bs3SwitchHlpConvProtModeRetfPopBpDecBpAndReturn_c32
    189190 %endif
    190191        BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP32_16.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPP32_16_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPP32_16, BS3_PBC_NEAR
    4346%if TMPL_MODE == BS3_MODE_PP32_16
     
    103106 %endif
    104107BS3_PROC_END_MODE   Bs3SwitchToPP32_16
     108
     109%else
     110;;
     111; Safe far return to non-BS3TEXT16 code.
     112BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     113BS3_BEGIN_TEXT16
     114BS3_SET_BITS TMPL_BITS
     115BS3_PROC_BEGIN_MODE Bs3SwitchToPP32_16_Safe, BS3_PBC_NEAR
     116        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     117        call        TMPL_NM(Bs3SwitchToPP32_16)
     118        BS3_SET_BITS 16
     119        retf
     120BS3_PROC_END_MODE   Bs3SwitchToPP32_16_Safe
    105121%endif
    106122
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPPV86.asm

    r60554 r60557  
    4040; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4141;
     42%if TMPL_BITS == 16
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToPPV86_Safe), function , 0
     44%endif
    4245BS3_PROC_BEGIN_MODE Bs3SwitchToPPV86, BS3_PBC_NEAR
    4346%if TMPL_MODE == BS3_MODE_PPV86
     
    8992 %endif
    9093BS3_PROC_END_MODE   Bs3SwitchToPPV86
     94
     95%else
     96;;
     97; Safe far return to non-BS3TEXT16 code.
     98BS3_EXTERN_CMN Bs3SwitchHlpConvFlatRetToRetfProtMode
     99BS3_BEGIN_TEXT16
     100BS3_SET_BITS TMPL_BITS
     101BS3_PROC_BEGIN_MODE Bs3SwitchToPPV86_Safe, BS3_PBC_NEAR
     102        call        Bs3SwitchHlpConvFlatRetToRetfProtMode ; Special internal function.  Uses nothing, but modifies the stack.
     103        call        TMPL_NM(Bs3SwitchToPPV86)
     104        BS3_SET_BITS 16
     105        retf
     106BS3_PROC_END_MODE   Bs3SwitchToPPV86_Safe
    91107%endif
    92108
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToRM.asm

    r60554 r60557  
    5555;
    5656; @uses     GPRs and EFLAGS are unchanged (except high 32-bit register (AMD64) parts).
    57 ;           CS is loaded with BS3TEXT16.
     57;           CS is loaded with CGROUP16.
    5858;           SS:[RE]SP is converted to real mode address.
    5959;           DS and ES are loaded with BS3DATA16_GROUP.
     
    6565; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    6666;
     67%if TMPL_BITS == 16
     68BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToRM_Safe), function , 0
     69%endif
    6770BS3_PROC_BEGIN_MODE Bs3SwitchToRM, BS3_PBC_NEAR
    6871%ifdef TMPL_RM
     
    265268        and     eax, X86_CR0_NO_PE_NO_PG
    266269        mov     cr0, eax
    267         jmp     BS3TEXT16:.reload_cs
     270        jmp     CGROUP16:.reload_cs
    268271.reload_cs:
    269272
     
    361364 %endif
    362365BS3_PROC_END_MODE   Bs3SwitchToRM
    363 %endif
    364 
     366
     367%else
     368;;
     369; Safe far return to non-BS3TEXT16 code.
     370BS3_EXTERN_CMN Bs3SelFlatCodeToRealMode
     371BS3_BEGIN_TEXT16
     372BS3_SET_BITS TMPL_BITS
     373BS3_PROC_BEGIN_MODE Bs3SwitchToRM_Safe, BS3_PBC_NEAR
     374 %if TMPL_BITS == 64
     375        push        xAX
     376        push        xCX
     377        sub         xSP, 20h
     378
     379        mov         xCX, [xSP + xCB*2 + 20h]
     380        call        Bs3SelFlatCodeToRealMode ; well behaved assembly function, only clobbers ecx
     381        mov         [xSP + xCB*2 + 20h + 4], eax
     382
     383        add         xSP, 20h
     384        pop         xCX
     385        pop         xAX
     386        add         xSP, 4
     387 %else
     388        xchg        eax, [xSP]
     389        push        xAX
     390        call        Bs3SelFlatCodeToRealMode ; well behaved assembly function, only clobbers eax
     391        add         xSP, 4
     392        xchg        [xSP], eax
     393 %endif
     394        call        TMPL_NM(Bs3SwitchToRM)
     395        BS3_SET_BITS 16
     396        retf
     397BS3_PROC_END_MODE   Bs3SwitchToRM_Safe
     398%endif
     399
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModes.c

    r60554 r60557  
    3131*   Header Files                                                                                                                 *
    3232*********************************************************************************************************************************/
    33 #include "bs3kit-template-header.h"
    34 #include "bs3-cmn-test.h"
     33#if defined(__WATCOMC__) && TMPL_MODE == BS3_MODE_RM
     34/* In real mode we move this blob of code to the RMTEXT16 segment to save space. */
     35# define BS3_USE_RM_TEXT_SEG 1
     36# include "bs3kit-template-header.h"
     37# include "bs3-cmn-test.h"
     38# pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
     39#else
     40# include "bs3kit-template-header.h"
     41# include "bs3-cmn-test.h"
     42#endif
    3543
    3644
     
    6371*   Assembly Symbols                                                                                                             *
    6472*********************************************************************************************************************************/
    65 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInRM)(uint32_t uCallbackFarPtr);
    66 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPE16)(uint32_t uCallbackFarPtr);
    67 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPE16_32)(uint32_t uFlatAddrCallback);
    68 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPE16_V86)(uint32_t uCallbackFarPtr);
    69 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPE32)(uint32_t uFlatAddrCallback);
    70 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPE32_16)(uint32_t uCallbackFarPtr);
    71 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPEV86)(uint32_t uCallbackFarPtr);
    72 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPP16)(uint32_t uCallbackFarPtr);
    73 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPP16_32)(uint32_t uFlatAddrCallback);
    74 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPP16_V86)(uint32_t uCallbackFarPtr);
    75 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPP32)(uint32_t uFlatAddrCallback);
    76 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPP32_16)(uint32_t uCallbackFarPtr);
    77 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPPV86)(uint32_t uCallbackFarPtr);
    78 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPAE16)(uint32_t uCallbackFarPtr);
    79 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPAE16_32)(uint32_t uFlatAddrCallback);
    80 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPAE16_V86)(uint32_t uCallbackFarPtr);
    81 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPAE32)(uint32_t uFlatAddrCallback);
    82 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPAE32_16)(uint32_t uCallbackFarPtr);
    83 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInPAEV86)(uint32_t uCallbackFarPtr);
    84 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInLM16)(uint32_t uCallbackFarPtr);
    85 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInLM32)(uint32_t uFlatAddrCallback);
    86 BS3_DECL_FAR(uint8_t) TMPL_FAR_NM(Bs3TestCallDoerInLM64)(uint32_t uFlatAddrCallback);
     73/* These are in the same code segment as this code, so no FAR necessary. */
     74BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInRM)(uint32_t uCallbackFarPtr);
     75BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPE16)(uint32_t uCallbackFarPtr);
     76BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPE16_32)(uint32_t uFlatAddrCallback);
     77BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPE16_V86)(uint32_t uCallbackFarPtr);
     78BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPE32)(uint32_t uFlatAddrCallback);
     79BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPE32_16)(uint32_t uCallbackFarPtr);
     80BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPEV86)(uint32_t uCallbackFarPtr);
     81BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPP16)(uint32_t uCallbackFarPtr);
     82BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPP16_32)(uint32_t uFlatAddrCallback);
     83BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPP16_V86)(uint32_t uCallbackFarPtr);
     84BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPP32)(uint32_t uFlatAddrCallback);
     85BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPP32_16)(uint32_t uCallbackFarPtr);
     86BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPPV86)(uint32_t uCallbackFarPtr);
     87BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPAE16)(uint32_t uCallbackFarPtr);
     88BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPAE16_32)(uint32_t uFlatAddrCallback);
     89BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPAE16_V86)(uint32_t uCallbackFarPtr);
     90BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPAE32)(uint32_t uFlatAddrCallback);
     91BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPAE32_16)(uint32_t uCallbackFarPtr);
     92BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInPAEV86)(uint32_t uCallbackFarPtr);
     93BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInLM16)(uint32_t uCallbackFarPtr);
     94BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInLM32)(uint32_t uFlatAddrCallback);
     95BS3_DECL_NEAR(uint8_t) TMPL_NM(Bs3TestCallDoerInLM64)(uint32_t uFlatAddrCallback);
    8796
    8897
     
    218227        {
    219228            PRE_DO_CALL(g_szBs3ModeName_rm);
    220             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInRM)(CONV_TO_RM_FAR16(paEntries[i].pfnDoRM));
     229            bErrNo = TMPL_NM(Bs3TestCallDoerInRM)(CONV_TO_RM_FAR16(paEntries[i].pfnDoRM));
    221230            CHECK_RESULT(g_szBs3ModeName_rm);
    222231        }
     
    235244        {
    236245            PRE_DO_CALL(g_szBs3ModeName_pe16);
    237             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPE16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPE16));
     246            bErrNo = TMPL_NM(Bs3TestCallDoerInPE16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPE16));
    238247            CHECK_RESULT(g_szBs3ModeName_pe16);
    239248        }
     
    248257        {
    249258            PRE_DO_CALL(g_szBs3ModeName_pe16_32);
    250             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPE16_32)(CONV_TO_FLAT(paEntries[i].pfnDoPE16_32));
     259            bErrNo = TMPL_NM(Bs3TestCallDoerInPE16_32)(CONV_TO_FLAT(paEntries[i].pfnDoPE16_32));
    251260            CHECK_RESULT(g_szBs3ModeName_pe16_32);
    252261        }
     
    255264        {
    256265            PRE_DO_CALL(g_szBs3ModeName_pe16_v86);
    257             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPE16_V86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPE16_V86));
     266            bErrNo = TMPL_NM(Bs3TestCallDoerInPE16_V86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPE16_V86));
    258267            CHECK_RESULT(g_szBs3ModeName_pe16_v86);
    259268        }
     
    262271        {
    263272            PRE_DO_CALL(g_szBs3ModeName_pe32);
    264             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPE32)(CONV_TO_FLAT(paEntries[i].pfnDoPE32));
     273            bErrNo = TMPL_NM(Bs3TestCallDoerInPE32)(CONV_TO_FLAT(paEntries[i].pfnDoPE32));
    265274            CHECK_RESULT(g_szBs3ModeName_pe32);
    266275        }
     
    269278        {
    270279            PRE_DO_CALL(g_szBs3ModeName_pe32_16);
    271             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPE32_16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPE32_16));
     280            bErrNo = TMPL_NM(Bs3TestCallDoerInPE32_16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPE32_16));
    272281            CHECK_RESULT(g_szBs3ModeName_pe32_16);
    273282        }
     
    276285        {
    277286            PRE_DO_CALL(g_szBs3ModeName_pev86);
    278             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPEV86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPEV86));
     287            bErrNo = TMPL_NM(Bs3TestCallDoerInPEV86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPEV86));
    279288            CHECK_RESULT(g_szBs3ModeName_pev86);
    280289        }
     
    286295        {
    287296            PRE_DO_CALL(g_szBs3ModeName_pp16);
    288             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPP16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPP16));
     297            bErrNo = TMPL_NM(Bs3TestCallDoerInPP16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPP16));
    289298            CHECK_RESULT(g_szBs3ModeName_pp16);
    290299        }
     
    293302        {
    294303            PRE_DO_CALL(g_szBs3ModeName_pp16_32);
    295             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPP16_32)(CONV_TO_FLAT(paEntries[i].pfnDoPP16_32));
     304            bErrNo = TMPL_NM(Bs3TestCallDoerInPP16_32)(CONV_TO_FLAT(paEntries[i].pfnDoPP16_32));
    296305            CHECK_RESULT(g_szBs3ModeName_pp16_32);
    297306        }
     
    300309        {
    301310            PRE_DO_CALL(g_szBs3ModeName_pp16_v86);
    302             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPP16_V86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPP16_V86));
     311            bErrNo = TMPL_NM(Bs3TestCallDoerInPP16_V86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPP16_V86));
    303312            CHECK_RESULT(g_szBs3ModeName_pp16_v86);
    304313        }
     
    307316        {
    308317            PRE_DO_CALL(g_szBs3ModeName_pp32);
    309             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPP32)(CONV_TO_FLAT(paEntries[i].pfnDoPP32));
     318            bErrNo = TMPL_NM(Bs3TestCallDoerInPP32)(CONV_TO_FLAT(paEntries[i].pfnDoPP32));
    310319            CHECK_RESULT(g_szBs3ModeName_pp32);
    311320        }
     
    314323        {
    315324            PRE_DO_CALL(g_szBs3ModeName_pp32_16);
    316             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPP32_16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPP32_16));
     325            bErrNo = TMPL_NM(Bs3TestCallDoerInPP32_16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPP32_16));
    317326            CHECK_RESULT(g_szBs3ModeName_pp32_16);
    318327        }
     
    321330        {
    322331            PRE_DO_CALL(g_szBs3ModeName_ppv86);
    323             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPPV86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPPV86));
     332            bErrNo = TMPL_NM(Bs3TestCallDoerInPPV86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPPV86));
    324333            CHECK_RESULT(g_szBs3ModeName_ppv86);
    325334        }
     
    338347        {
    339348            PRE_DO_CALL(g_szBs3ModeName_pae16);
    340             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPAE16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPAE16));
     349            bErrNo = TMPL_NM(Bs3TestCallDoerInPAE16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPAE16));
    341350            CHECK_RESULT(g_szBs3ModeName_pae16);
    342351        }
     
    345354        {
    346355            PRE_DO_CALL(g_szBs3ModeName_pae16_32);
    347             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPAE16_32)(CONV_TO_FLAT(paEntries[i].pfnDoPAE16_32));
     356            bErrNo = TMPL_NM(Bs3TestCallDoerInPAE16_32)(CONV_TO_FLAT(paEntries[i].pfnDoPAE16_32));
    348357            CHECK_RESULT(g_szBs3ModeName_pae16_32);
    349358        }
     
    352361        {
    353362            PRE_DO_CALL(g_szBs3ModeName_pae16_v86);
    354             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPAE16_V86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPAE16_V86));
     363            bErrNo = TMPL_NM(Bs3TestCallDoerInPAE16_V86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPAE16_V86));
    355364            CHECK_RESULT(g_szBs3ModeName_pae16_v86);
    356365        }
     
    359368        {
    360369            PRE_DO_CALL(g_szBs3ModeName_pae32);
    361             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPAE32)(CONV_TO_FLAT(paEntries[i].pfnDoPAE32));
     370            bErrNo = TMPL_NM(Bs3TestCallDoerInPAE32)(CONV_TO_FLAT(paEntries[i].pfnDoPAE32));
    362371            CHECK_RESULT(g_szBs3ModeName_pae32);
    363372        }
     
    366375        {
    367376            PRE_DO_CALL(g_szBs3ModeName_pae32_16);
    368             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPAE32_16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPAE32_16));
     377            bErrNo = TMPL_NM(Bs3TestCallDoerInPAE32_16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoPAE32_16));
    369378            CHECK_RESULT(g_szBs3ModeName_pae32_16);
    370379        }
     
    373382        {
    374383            PRE_DO_CALL(g_szBs3ModeName_paev86);
    375             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInPAEV86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPAEV86));
     384            bErrNo = TMPL_NM(Bs3TestCallDoerInPAEV86)(CONV_TO_RM_FAR16(paEntries[i].pfnDoPAEV86));
    376385            CHECK_RESULT(g_szBs3ModeName_paev86);
    377386        }
     
    390399        {
    391400            PRE_DO_CALL(g_szBs3ModeName_lm16);
    392             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInLM16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoLM16));
     401            bErrNo = TMPL_NM(Bs3TestCallDoerInLM16)(CONV_TO_PROT_FAR16(paEntries[i].pfnDoLM16));
    393402            CHECK_RESULT(g_szBs3ModeName_lm16);
    394403        }
     
    397406        {
    398407            PRE_DO_CALL(g_szBs3ModeName_lm32);
    399             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInLM32)(CONV_TO_FLAT(paEntries[i].pfnDoLM32));
     408            bErrNo = TMPL_NM(Bs3TestCallDoerInLM32)(CONV_TO_FLAT(paEntries[i].pfnDoLM32));
    400409            CHECK_RESULT(g_szBs3ModeName_lm32);
    401410        }
     
    404413        {
    405414            PRE_DO_CALL(g_szBs3ModeName_lm64);
    406             bErrNo = TMPL_FAR_NM(Bs3TestCallDoerInLM64)(CONV_TO_FLAT(paEntries[i].pfnDoLM64));
     415            bErrNo = TMPL_NM(Bs3TestCallDoerInLM64)(CONV_TO_FLAT(paEntries[i].pfnDoLM64));
    407416            CHECK_RESULT(g_szBs3ModeName_lm64);
    408417        }
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModesHlp.asm

    r60554 r60557  
    2525;
    2626
     27;*********************************************************************************************************************************
     28;*  Header Files                                                                                                                 *
     29;*********************************************************************************************************************************
    2730%include "bs3kit-template-header.mac"
     31
     32
     33;*********************************************************************************************************************************
     34;*  Defined Constants And Macros                                                                                                 *
     35;*********************************************************************************************************************************
     36;
     37; We put most of this mess in the RMTEXT16 segment when in real mode.
     38;
     39%if TMPL_MODE == BS3_MODE_RM
     40 %define MY_BEGIN_TEXT   BS3_BEGIN_RMTEXT16
     41 %define MY_BEGIN_TEXT16 BS3_BEGIN_RMTEXT16
     42%else
     43 %define MY_BEGIN_TEXT   TMPL_BEGIN_TEXT
     44 %define MY_BEGIN_TEXT16 BS3_BEGIN_TEXT16
     45%endif
    2846
    2947
     
    3149;*  External Symbols                                                                                                             *
    3250;*********************************************************************************************************************************
     51%if TMPL_MODE == BS3_MODE_RM
     52BS3_BEGIN_TEXT16_FARSTUBS
     53extern TMPL_FAR_NM(Bs3SwitchToRM)
     54extern TMPL_FAR_NM(Bs3SwitchToPE16)
     55extern TMPL_FAR_NM(Bs3SwitchToPE16_32)
     56extern TMPL_FAR_NM(Bs3SwitchToPE16_V86)
     57extern TMPL_FAR_NM(Bs3SwitchToPE32)
     58extern TMPL_FAR_NM(Bs3SwitchToPE32_16)
     59extern TMPL_FAR_NM(Bs3SwitchToPEV86)
     60extern TMPL_FAR_NM(Bs3SwitchToPP16)
     61extern TMPL_FAR_NM(Bs3SwitchToPP16_32)
     62extern TMPL_FAR_NM(Bs3SwitchToPP16_V86)
     63extern TMPL_FAR_NM(Bs3SwitchToPP32)
     64extern TMPL_FAR_NM(Bs3SwitchToPP32_16)
     65extern TMPL_FAR_NM(Bs3SwitchToPPV86)
     66extern TMPL_FAR_NM(Bs3SwitchToPAE16)
     67extern TMPL_FAR_NM(Bs3SwitchToPAE16_32)
     68extern TMPL_FAR_NM(Bs3SwitchToPAE16_V86)
     69extern TMPL_FAR_NM(Bs3SwitchToPAE32)
     70extern TMPL_FAR_NM(Bs3SwitchToPAE32_16)
     71extern TMPL_FAR_NM(Bs3SwitchToPAEV86)
     72extern TMPL_FAR_NM(Bs3SwitchToLM16)
     73extern TMPL_FAR_NM(Bs3SwitchToLM32)
     74extern TMPL_FAR_NM(Bs3SwitchToLM64)
     75extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm_far)
     76extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_far)
     77extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_v86_far)
     78extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32_16_far)
     79extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pev86_far)
     80extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_far)
     81extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_v86_far)
     82extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32_16_far)
     83extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_ppv86_far)
     84extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_far)
     85extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_v86_far)
     86extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32_16_far)
     87extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_paev86_far)
     88extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm16_far)
     89%else
     90BS3_BEGIN_TEXT16
    3391extern TMPL_NM(Bs3SwitchToRM)
    3492extern TMPL_NM(Bs3SwitchToPE16)
     
    53111extern TMPL_NM(Bs3SwitchToLM32)
    54112extern 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 
     113extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_rm)
     114extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe16)
     115extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe16_v86)
     116extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe32_16)
     117extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pev86)
     118extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp16)
     119extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp16_v86)
     120extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp32_16)
     121extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_ppv86)
     122extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae16)
     123extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae16_v86)
     124extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae32_16)
     125extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_paev86)
     126extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_lm16)
     127%endif
     128BS3_BEGIN_TEXT16
     129extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe16_32):wrt BS3FLAT
     130extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe32):wrt BS3FLAT
     131extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp16_32):wrt BS3FLAT
     132extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp32):wrt BS3FLAT
     133extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae16_32):wrt BS3FLAT
     134extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae32):wrt BS3FLAT
     135extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_lm32):wrt BS3FLAT
     136extern RT_CONCAT3(Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_lm64):wrt BS3FLAT
     137
     138
     139
     140MY_BEGIN_TEXT
    78141
    79142;;
     
    154217        xPOPF
    155218        pop     xBP
    156 %if TMPL_BITS == 16
    157         retf
    158 %else
    159219        ret
    160 %endif
    161220
    162221;
     
    217276; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInRM(uint16_t offBs3Text16);
    218277; @uses     rax
    219 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInRM, BS3_PBC_FAR
    220         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    221         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    222 BS3_BEGIN_TEXT16
     278BS3_PROC_BEGIN_MODE Bs3TestCallDoerInRM, BS3_PBC_NEAR
     279        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     280        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     281MY_BEGIN_TEXT16
    223282BS3_SET_BITS TMPL_BITS
    224283.doit:
     
    228287        ; Mode switch, make the call, switch back.
    229288        STRICT_SAVE_REGS
     289%if TMPL_MODE == BS3_MODE_RM
     290        call far TMPL_FAR_NM(Bs3SwitchToRM)
     291%else
    230292        call    TMPL_NM(Bs3SwitchToRM)
     293%endif
    231294        BS3_SET_BITS 16
    232295        STRICT_CHECK_REGS
     
    243306
    244307        STRICT_SAVE_REGS
    245         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
    246         BS3_SET_BITS TMPL_BITS
    247         STRICT_CHECK_REGS
    248         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    249 TMPL_BEGIN_TEXT
     308%if TMPL_MODE == BS3_MODE_RM
     309        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm_far)
     310%else
     311        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_rm)
     312%endif
     313        BS3_SET_BITS TMPL_BITS
     314        STRICT_CHECK_REGS
     315        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     316MY_BEGIN_TEXT
    250317BS3_PROC_END_MODE   Bs3TestCallDoerInRM
    251318
     
    258325; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPE16(uint16_t offBs3Text16);
    259326; @uses     rax
    260 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16, BS3_PBC_FAR
    261         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    262         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    263 BS3_BEGIN_TEXT16
     327BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16, BS3_PBC_NEAR
     328        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     329        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     330MY_BEGIN_TEXT16
    264331BS3_SET_BITS TMPL_BITS
    265332.doit:
     
    269336        ; Mode switch, make the call, switch back.
    270337        STRICT_SAVE_REGS
     338%if TMPL_MODE == BS3_MODE_RM
     339        call far TMPL_FAR_NM(Bs3SwitchToPE16)
     340%else
    271341        call    TMPL_NM(Bs3SwitchToPE16)
     342%endif
    272343        BS3_SET_BITS 16
    273344        STRICT_CHECK_REGS
     
    282353
    283354        STRICT_SAVE_REGS
    284         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16)
    285         BS3_SET_BITS TMPL_BITS
    286         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    287 TMPL_BEGIN_TEXT
     355%if TMPL_MODE == BS3_MODE_RM
     356        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_far)
     357%else
     358        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe16)
     359%endif
     360        BS3_SET_BITS TMPL_BITS
     361        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     362MY_BEGIN_TEXT
    288363BS3_PROC_END_MODE   Bs3TestCallDoerInPE16
    289364
     
    291366; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPE16_32(uint16_t offBs3Text16);
    292367; @uses     rax
    293 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_32, BS3_PBC_FAR
     368BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_32, BS3_PBC_NEAR
    294369        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    295370        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    299374        ; Mode switch, make the call, switch back.
    300375        STRICT_SAVE_REGS
     376%if TMPL_MODE == BS3_MODE_RM
     377        call far TMPL_FAR_NM(Bs3SwitchToPE16_32)
     378%else
    301379        call    TMPL_NM(Bs3SwitchToPE16_32)
     380%endif
    302381        BS3_SET_BITS 32
    303382        STRICT_CHECK_REGS
     
    307386
    308387        STRICT_SAVE_REGS
    309         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_32)
     388        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe16_32)
    310389        BS3_SET_BITS TMPL_BITS
    311390        STRICT_CHECK_REGS
     
    316395; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPE16_V86(uint16_t offBs3Text16);
    317396; @uses     rax
    318 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_V86, BS3_PBC_FAR
    319         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    320         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    321 .doit:
    322         mov     ax, [xBP + xCB + cbCurRetAddr]      ; Load far function pointer.
    323         mov     dx, [xBP + xCB + cbCurRetAddr + 2]
    324 
    325         ; Mode switch, make the call, switch back.
    326         STRICT_SAVE_REGS
     397BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_V86, BS3_PBC_NEAR
     398        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     399        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     400.doit:
     401        mov     ax, [xBP + xCB + cbCurRetAddr]      ; Load far function pointer.
     402        mov     dx, [xBP + xCB + cbCurRetAddr + 2]
     403
     404        ; Mode switch, make the call, switch back.
     405        STRICT_SAVE_REGS
     406%if TMPL_MODE == BS3_MODE_RM
     407        call far TMPL_FAR_NM(Bs3SwitchToPE16_V86)
     408%else
    327409        call    TMPL_NM(Bs3SwitchToPE16_V86)
     410%endif
    328411        BS3_SET_BITS 16
    329412        STRICT_CHECK_REGS
     
    338421
    339422        STRICT_SAVE_REGS
    340         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_v86)
     423%if TMPL_MODE == BS3_MODE_RM
     424        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe16_v86_far)
     425%else
     426        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe16_v86)
     427%endif
    341428        BS3_SET_BITS TMPL_BITS
    342429        STRICT_CHECK_REGS
     
    347434; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPE32(uint16_t offBs3Text16);
    348435; @uses     rax
    349 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32, BS3_PBC_FAR
     436BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32, BS3_PBC_NEAR
    350437        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    351438        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    355442        ; Mode switch, make the call, switch back.
    356443        STRICT_SAVE_REGS
     444%if TMPL_MODE == BS3_MODE_RM
     445        call far TMPL_FAR_NM(Bs3SwitchToPE32)
     446%else
    357447        call    TMPL_NM(Bs3SwitchToPE32)
     448%endif
    358449        BS3_SET_BITS 32
    359450        STRICT_CHECK_REGS
     
    363454
    364455        STRICT_SAVE_REGS
    365         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32)
     456        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe32)
    366457        BS3_SET_BITS TMPL_BITS
    367458        STRICT_CHECK_REGS
     
    372463; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPE32_16(uint16_t offBs3Text16);
    373464; @uses     rax
    374 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32_16, BS3_PBC_FAR
    375         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    376         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    377 BS3_BEGIN_TEXT16
     465BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32_16, BS3_PBC_NEAR
     466        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     467        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     468MY_BEGIN_TEXT16
    378469BS3_SET_BITS TMPL_BITS
    379470.doit:
     
    383474        ; Mode switch, make the call, switch back.
    384475        STRICT_SAVE_REGS
     476%if TMPL_MODE == BS3_MODE_RM
     477        call far TMPL_FAR_NM(Bs3SwitchToPE32_16)
     478%else
    385479        call    TMPL_NM(Bs3SwitchToPE32_16)
     480%endif
    386481        BS3_SET_BITS 16
    387482        STRICT_CHECK_REGS
     
    396491
    397492        STRICT_SAVE_REGS
    398         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32_16)
    399         BS3_SET_BITS TMPL_BITS
    400         STRICT_CHECK_REGS
    401         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    402 TMPL_BEGIN_TEXT
     493%if TMPL_MODE == BS3_MODE_RM
     494        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pe32_16_far)
     495%else
     496        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pe32_16)
     497%endif
     498        BS3_SET_BITS TMPL_BITS
     499        STRICT_CHECK_REGS
     500        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     501MY_BEGIN_TEXT
    403502BS3_PROC_END_MODE   Bs3TestCallDoerInPE32_16
    404503
     
    406505; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPEV86(uint16_t offBs3Text16);
    407506; @uses     rax
    408 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPEV86, BS3_PBC_FAR
    409         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    410         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    411 BS3_BEGIN_TEXT16
     507BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPEV86, BS3_PBC_NEAR
     508        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     509        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     510MY_BEGIN_TEXT16
    412511BS3_SET_BITS TMPL_BITS
    413512.doit:
     
    417516        ; Mode switch, make the call, switch back.
    418517        STRICT_SAVE_REGS
     518%if TMPL_MODE == BS3_MODE_RM
     519        call far TMPL_FAR_NM(Bs3SwitchToPEV86)
     520%else
    419521        call    TMPL_NM(Bs3SwitchToPEV86)
     522%endif
    420523        BS3_SET_BITS 16
    421524        STRICT_CHECK_REGS
     
    430533
    431534        STRICT_SAVE_REGS
    432         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pev86)
    433         BS3_SET_BITS TMPL_BITS
    434         STRICT_CHECK_REGS
    435         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    436 TMPL_BEGIN_TEXT
     535%if TMPL_MODE == BS3_MODE_RM
     536        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pev86_far)
     537%else
     538        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pev86)
     539%endif
     540        BS3_SET_BITS TMPL_BITS
     541        STRICT_CHECK_REGS
     542        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     543MY_BEGIN_TEXT
    437544BS3_PROC_END_MODE   Bs3TestCallDoerInPEV86
    438545
     
    446553; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPP16(uint16_t offBs3Text16);
    447554; @uses     rax
    448 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16, BS3_PBC_FAR
    449         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    450         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    451 BS3_BEGIN_TEXT16
     555BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16, BS3_PBC_NEAR
     556        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     557        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     558MY_BEGIN_TEXT16
    452559BS3_SET_BITS TMPL_BITS
    453560.doit:
     
    457564        ; Mode switch, make the call, switch back.
    458565        STRICT_SAVE_REGS
     566%if TMPL_MODE == BS3_MODE_RM
     567        call far TMPL_FAR_NM(Bs3SwitchToPP16)
     568%else
    459569        call    TMPL_NM(Bs3SwitchToPP16)
     570%endif
    460571        BS3_SET_BITS 16
    461572        STRICT_CHECK_REGS
     
    470581
    471582        STRICT_SAVE_REGS
    472         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16)
    473         BS3_SET_BITS TMPL_BITS
    474         STRICT_CHECK_REGS
    475         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    476 TMPL_BEGIN_TEXT
     583%if TMPL_MODE == BS3_MODE_RM
     584        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_far)
     585%else
     586        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp16)
     587%endif
     588        BS3_SET_BITS TMPL_BITS
     589        STRICT_CHECK_REGS
     590        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     591MY_BEGIN_TEXT
    477592BS3_PROC_END_MODE   Bs3TestCallDoerInPP16
    478593
     
    480595; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPP16_32(uint16_t offBs3Text16);
    481596; @uses     rax
    482 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_32, BS3_PBC_FAR
     597BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_32, BS3_PBC_NEAR
    483598        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    484599        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    488603        ; Mode switch, make the call, switch back.
    489604        STRICT_SAVE_REGS
     605%if TMPL_MODE == BS3_MODE_RM
     606        call far TMPL_FAR_NM(Bs3SwitchToPP16_32)
     607%else
    490608        call    TMPL_NM(Bs3SwitchToPP16_32)
     609%endif
    491610        BS3_SET_BITS 32
    492611        STRICT_CHECK_REGS
     
    496615
    497616        STRICT_SAVE_REGS
    498         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_32)
     617        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp16_32)
    499618        BS3_SET_BITS TMPL_BITS
    500619        STRICT_CHECK_REGS
     
    505624; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPP16_V86(uint16_t offBs3Text16);
    506625; @uses     rax
    507 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_V86, BS3_PBC_FAR
    508         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    509         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    510 .doit:
    511         mov     ax, [xBP + xCB + cbCurRetAddr]      ; Load far function pointer.
    512         mov     dx, [xBP + xCB + cbCurRetAddr + 2]
    513 
    514         ; Mode switch, make the call, switch back.
    515         STRICT_SAVE_REGS
     626BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_V86, BS3_PBC_NEAR
     627        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     628        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     629.doit:
     630        mov     ax, [xBP + xCB + cbCurRetAddr]      ; Load far function pointer.
     631        mov     dx, [xBP + xCB + cbCurRetAddr + 2]
     632
     633        ; Mode switch, make the call, switch back.
     634        STRICT_SAVE_REGS
     635%if TMPL_MODE == BS3_MODE_RM
     636        call far TMPL_FAR_NM(Bs3SwitchToPP16_V86)
     637%else
    516638        call    TMPL_NM(Bs3SwitchToPP16_V86)
     639%endif
    517640        BS3_SET_BITS 16
    518641        STRICT_CHECK_REGS
     
    527650
    528651        STRICT_SAVE_REGS
    529         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_v86)
     652%if TMPL_MODE == BS3_MODE_RM
     653        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp16_v86_far)
     654%else
     655        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp16_v86)
     656%endif
    530657        BS3_SET_BITS TMPL_BITS
    531658        STRICT_CHECK_REGS
     
    536663; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPP32(uint16_t offBs3Text16);
    537664; @uses     rax
    538 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32, BS3_PBC_FAR
     665BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32, BS3_PBC_NEAR
    539666        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    540667        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    544671        ; Mode switch, make the call, switch back.
    545672        STRICT_SAVE_REGS
     673%if TMPL_MODE == BS3_MODE_RM
     674        call far TMPL_FAR_NM(Bs3SwitchToPP32)
     675%else
    546676        call    TMPL_NM(Bs3SwitchToPP32)
     677%endif
    547678        BS3_SET_BITS 32
    548679        STRICT_CHECK_REGS
     
    552683
    553684        STRICT_SAVE_REGS
    554         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32)
     685        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp32)
    555686        BS3_SET_BITS TMPL_BITS
    556687        STRICT_CHECK_REGS
     
    561692; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPP32_16(uint16_t offBs3Text16);
    562693; @uses     rax
    563 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32_16, BS3_PBC_FAR
    564         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    565         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    566 BS3_BEGIN_TEXT16
     694BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32_16, BS3_PBC_NEAR
     695        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     696        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     697MY_BEGIN_TEXT16
    567698BS3_SET_BITS TMPL_BITS
    568699.doit:
     
    572703        ; Mode switch, make the call, switch back.
    573704        STRICT_SAVE_REGS
     705%if TMPL_MODE == BS3_MODE_RM
     706        call far TMPL_FAR_NM(Bs3SwitchToPP32_16)
     707%else
    574708        call    TMPL_NM(Bs3SwitchToPP32_16)
     709%endif
    575710        BS3_SET_BITS 16
    576711        STRICT_CHECK_REGS
     
    585720
    586721        STRICT_SAVE_REGS
    587         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32_16)
    588         BS3_SET_BITS TMPL_BITS
    589         STRICT_CHECK_REGS
    590         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    591 TMPL_BEGIN_TEXT
     722%if TMPL_MODE == BS3_MODE_RM
     723        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pp32_16_far)
     724%else
     725        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pp32_16)
     726%endif
     727        BS3_SET_BITS TMPL_BITS
     728        STRICT_CHECK_REGS
     729        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     730MY_BEGIN_TEXT
    592731BS3_PROC_END_MODE   Bs3TestCallDoerInPP32_16
    593732
     
    595734; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPPV86(uint16_t offBs3Text16);
    596735; @uses     rax
    597 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPPV86, BS3_PBC_FAR
    598         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    599         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    600 BS3_BEGIN_TEXT16
     736BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPPV86, BS3_PBC_NEAR
     737        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     738        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     739MY_BEGIN_TEXT16
    601740BS3_SET_BITS TMPL_BITS
    602741.doit:
     
    606745        ; Mode switch, make the call, switch back.
    607746        STRICT_SAVE_REGS
     747%if TMPL_MODE == BS3_MODE_RM
     748        call far TMPL_FAR_NM(Bs3SwitchToPPV86)
     749%else
    608750        call    TMPL_NM(Bs3SwitchToPPV86)
     751%endif
    609752        BS3_SET_BITS 16
    610753        STRICT_CHECK_REGS
     
    619762
    620763        STRICT_SAVE_REGS
    621         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_ppv86)
    622         BS3_SET_BITS TMPL_BITS
    623         STRICT_CHECK_REGS
    624         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    625 TMPL_BEGIN_TEXT
     764%if TMPL_MODE == BS3_MODE_RM
     765        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_ppv86_far)
     766%else
     767        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_ppv86)
     768%endif
     769        BS3_SET_BITS TMPL_BITS
     770        STRICT_CHECK_REGS
     771        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     772MY_BEGIN_TEXT
    626773BS3_PROC_END_MODE   Bs3TestCallDoerInPPV86
    627774
     
    635782; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16(uint16_t offBs3Text16);
    636783; @uses     rax
    637 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16, BS3_PBC_FAR
    638         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    639         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    640 BS3_BEGIN_TEXT16
     784BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16, BS3_PBC_NEAR
     785        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     786        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     787MY_BEGIN_TEXT16
    641788BS3_SET_BITS TMPL_BITS
    642789.doit:
     
    646793        ; Mode switch, make the call, switch back.
    647794        STRICT_SAVE_REGS
     795%if TMPL_MODE == BS3_MODE_RM
     796        call far TMPL_FAR_NM(Bs3SwitchToPAE16)
     797%else
    648798        call    TMPL_NM(Bs3SwitchToPAE16)
     799%endif
    649800        BS3_SET_BITS 16
    650801        STRICT_CHECK_REGS
     
    659810
    660811        STRICT_SAVE_REGS
    661         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16)
    662         BS3_SET_BITS TMPL_BITS
    663         STRICT_CHECK_REGS
    664         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    665 TMPL_BEGIN_TEXT
     812%if TMPL_MODE == BS3_MODE_RM
     813        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_far)
     814%else
     815        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae16)
     816%endif
     817        BS3_SET_BITS TMPL_BITS
     818        STRICT_CHECK_REGS
     819        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     820MY_BEGIN_TEXT
    666821BS3_PROC_END_MODE   Bs3TestCallDoerInPAE16
    667822
     
    669824; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16_32(uint16_t offBs3Text16);
    670825; @uses     rax
    671 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_32, BS3_PBC_FAR
     826BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_32, BS3_PBC_NEAR
    672827        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    673828        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    677832        ; Mode switch, make the call, switch back.
    678833        STRICT_SAVE_REGS
     834%if TMPL_MODE == BS3_MODE_RM
     835        call far TMPL_FAR_NM(Bs3SwitchToPAE16_32)
     836%else
    679837        call    TMPL_NM(Bs3SwitchToPAE16_32)
     838%endif
    680839        BS3_SET_BITS 32
    681840        STRICT_CHECK_REGS
     
    685844
    686845        STRICT_SAVE_REGS
    687         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_32)
     846        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae16_32)
    688847        BS3_SET_BITS TMPL_BITS
    689848        STRICT_CHECK_REGS
     
    694853; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPAE16_V86(uint16_t offBs3Text16);
    695854; @uses     rax
    696 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_V86, BS3_PBC_FAR
    697         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    698         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    699 .doit:
    700         mov     ax, [xBP + xCB + cbCurRetAddr]      ; Load far function pointer.
    701         mov     dx, [xBP + xCB + cbCurRetAddr + 2]
    702 
    703         ; Mode switch, make the call, switch back.
    704         STRICT_SAVE_REGS
     855BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_V86, BS3_PBC_NEAR
     856        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     857        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     858.doit:
     859        mov     ax, [xBP + xCB + cbCurRetAddr]      ; Load far function pointer.
     860        mov     dx, [xBP + xCB + cbCurRetAddr + 2]
     861
     862        ; Mode switch, make the call, switch back.
     863        STRICT_SAVE_REGS
     864%if TMPL_MODE == BS3_MODE_RM
     865        call far TMPL_FAR_NM(Bs3SwitchToPAE16_V86)
     866%else
    705867        call    TMPL_NM(Bs3SwitchToPAE16_V86)
     868%endif
    706869        BS3_SET_BITS 16
    707870        STRICT_CHECK_REGS
     
    716879
    717880        STRICT_SAVE_REGS
    718         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_v86)
     881%if TMPL_MODE == BS3_MODE_RM
     882        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae16_v86_far)
     883%else
     884        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae16_v86)
     885%endif
    719886        BS3_SET_BITS TMPL_BITS
    720887        STRICT_CHECK_REGS
     
    725892; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPAE32(uint16_t offBs3Text16);
    726893; @uses     rax
    727 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32, BS3_PBC_FAR
     894BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32, BS3_PBC_NEAR
    728895        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    729896        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    733900        ; Mode switch, make the call, switch back.
    734901        STRICT_SAVE_REGS
     902%if TMPL_MODE == BS3_MODE_RM
     903        call far TMPL_FAR_NM(Bs3SwitchToPAE32)
     904%else
    735905        call    TMPL_NM(Bs3SwitchToPAE32)
     906%endif
    736907        BS3_SET_BITS 32
    737908        STRICT_CHECK_REGS
     
    741912
    742913        STRICT_SAVE_REGS
    743         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32)
     914        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae32)
    744915        BS3_SET_BITS TMPL_BITS
    745916        STRICT_CHECK_REGS
     
    750921; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPAE32_16(uint16_t offBs3Text16);
    751922; @uses     rax
    752 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32_16, BS3_PBC_FAR
    753         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    754         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    755 BS3_BEGIN_TEXT16
     923BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32_16, BS3_PBC_NEAR
     924        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     925        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     926MY_BEGIN_TEXT16
    756927BS3_SET_BITS TMPL_BITS
    757928.doit:
     
    761932        ; Mode switch, make the call, switch back.
    762933        STRICT_SAVE_REGS
     934%if TMPL_MODE == BS3_MODE_RM
     935        call far TMPL_FAR_NM(Bs3SwitchToPAE32_16)
     936%else
    763937        call    TMPL_NM(Bs3SwitchToPAE32_16)
     938%endif
    764939        BS3_SET_BITS 16
    765940        STRICT_CHECK_REGS
     
    774949
    775950        STRICT_SAVE_REGS
    776         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32_16)
    777         BS3_SET_BITS TMPL_BITS
    778         STRICT_CHECK_REGS
    779         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    780 TMPL_BEGIN_TEXT
     951%if TMPL_MODE == BS3_MODE_RM
     952        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_pae32_16_far)
     953%else
     954        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_pae32_16)
     955%endif
     956        BS3_SET_BITS TMPL_BITS
     957        STRICT_CHECK_REGS
     958        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     959MY_BEGIN_TEXT
    781960BS3_PROC_END_MODE   Bs3TestCallDoerInPAE32_16
    782961
     
    784963; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInPAEV86(uint16_t offBs3Text16);
    785964; @uses     rax
    786 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAEV86, BS3_PBC_FAR
    787         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    788         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    789 BS3_BEGIN_TEXT16
     965BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAEV86, BS3_PBC_NEAR
     966        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     967        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     968MY_BEGIN_TEXT16
    790969BS3_SET_BITS TMPL_BITS
    791970.doit:
     
    795974        ; Mode switch, make the call, switch back.
    796975        STRICT_SAVE_REGS
     976%if TMPL_MODE == BS3_MODE_RM
     977        call far TMPL_FAR_NM(Bs3SwitchToPAEV86)
     978%else
    797979        call    TMPL_NM(Bs3SwitchToPAEV86)
     980%endif
    798981        BS3_SET_BITS 16
    799982        STRICT_CHECK_REGS
     
    808991
    809992        STRICT_SAVE_REGS
    810         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_paev86)
    811         BS3_SET_BITS TMPL_BITS
    812         STRICT_CHECK_REGS
    813         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    814 TMPL_BEGIN_TEXT
     993%if TMPL_MODE == BS3_MODE_RM
     994        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_paev86_far)
     995%else
     996        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_paev86)
     997%endif
     998        BS3_SET_BITS TMPL_BITS
     999        STRICT_CHECK_REGS
     1000        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     1001MY_BEGIN_TEXT
    8151002BS3_PROC_END_MODE   Bs3TestCallDoerInPAEV86
    8161003
     
    8241011; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInLM16(uint16_t offBs3Text16);
    8251012; @uses     rax
    826 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM16, BS3_PBC_FAR
    827         BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    828         jmp     TMPL_NM(bs3TestCallDoerPrologue)
    829 BS3_BEGIN_TEXT16
     1013BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM16, BS3_PBC_NEAR
     1014        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
     1015        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     1016MY_BEGIN_TEXT16
    8301017BS3_SET_BITS TMPL_BITS
    8311018.doit:
     
    8351022        ; Mode switch, make the call, switch back.
    8361023        STRICT_SAVE_REGS
     1024%if TMPL_MODE == BS3_MODE_RM
     1025        call far TMPL_FAR_NM(Bs3SwitchToLM16)
     1026%else
    8371027        call    TMPL_NM(Bs3SwitchToLM16)
     1028%endif
    8381029        BS3_SET_BITS 16
    8391030        STRICT_CHECK_REGS
     
    8481039
    8491040        STRICT_SAVE_REGS
    850         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm16)
    851         BS3_SET_BITS TMPL_BITS
    852         STRICT_CHECK_REGS
    853         jmp     TMPL_NM(bs3TestCallDoerEpilogue)
    854 TMPL_BEGIN_TEXT
     1041%if TMPL_MODE == BS3_MODE_RM
     1042        call far RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm16_far)
     1043%else
     1044        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_lm16)
     1045%endif
     1046        BS3_SET_BITS TMPL_BITS
     1047        STRICT_CHECK_REGS
     1048        jmp     TMPL_NM(bs3TestCallDoerEpilogue)
     1049MY_BEGIN_TEXT
    8551050BS3_PROC_END_MODE   Bs3TestCallDoerInLM16
    8561051
     
    8581053; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInLM32(uint16_t offBs3Text16);
    8591054; @uses     rax
    860 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM32, BS3_PBC_FAR
     1055BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM32, BS3_PBC_NEAR
    8611056        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    8621057        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    8661061        ; Mode switch, make the call, switch back.
    8671062        STRICT_SAVE_REGS
     1063%if TMPL_MODE == BS3_MODE_RM
     1064        call far TMPL_FAR_NM(Bs3SwitchToLM32)
     1065%else
    8681066        call    TMPL_NM(Bs3SwitchToLM32)
     1067%endif
    8691068        BS3_SET_BITS 32
    8701069        STRICT_CHECK_REGS
     
    8751074
    8761075        STRICT_SAVE_REGS
    877         call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_lm32)
     1076        call    RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_lm32)
    8781077        BS3_SET_BITS TMPL_BITS
    8791078        STRICT_CHECK_REGS
     
    8841083; @cproto   BS3_DECL(uint8_t) Bs3TestCallDoerInLM64(uint16_t offBs3Text16);
    8851084; @uses     rax
    886 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM64, BS3_PBC_FAR
     1085BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM64, BS3_PBC_NEAR
    8871086        BS3_LEA_MOV_WRT_RIP(xAX, .doit)
    8881087        jmp     TMPL_NM(bs3TestCallDoerPrologue)
     
    8921091        ; Mode switch, make the call, switch back.
    8931092        STRICT_SAVE_REGS
     1093%if TMPL_MODE == BS3_MODE_RM
     1094        call far TMPL_FAR_NM(Bs3SwitchToLM64)
     1095%else
    8941096        call    TMPL_NM(Bs3SwitchToLM64)
     1097%endif
    8951098        BS3_SET_BITS 64
    8961099        STRICT_CHECK_REGS
     
    9021105
    9031106        STRICT_SAVE_REGS
    904         call    RT_CONCAT3(Bs3SwitchTo,TMPL_MODE_UNAME,_lm64)
     1107        call    RT_CONCAT3(Bs3SwitchTo,TMPL_MODE_UNAME,_Safe_lm64)
    9051108        BS3_SET_BITS TMPL_BITS
    9061109        STRICT_CHECK_REGS
     
    9081111BS3_PROC_END_MODE   Bs3TestCallDoerInLM64
    9091112
     1113
     1114;
     1115; Finally near stub for the API call (16-bit only).
     1116;
     1117%if TMPL_BITS == 16
     1118BS3_BEGIN_TEXT16_NEARSTUBS
     1119BS3_PROC_BEGIN_MODE Bs3TestDoModes, BS3_PBC_NEAR
     1120        pop     ax
     1121 %if TMPL_MODE == BS3_MODE_RM
     1122        push    cs
     1123        push    ax
     1124        extern TMPL_FAR_NM(Bs3TestDoModes):wrt BS3GROUPRMTEXT16
     1125        jmp far TMPL_FAR_NM(Bs3TestDoModes)
     1126 %else
     1127        push    cs
     1128        push    ax
     1129        extern TMPL_FAR_NM(Bs3TestDoModes):wrt CGROUP16
     1130        jmp     TMPL_NM(Bs3TestDoModes)
     1131 %endif
     1132BS3_PROC_END_MODE   Bs3TestDoModes
     1133
     1134%endif
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapSystemCallHandler.asm

    r60554 r60557  
    6767;       CPUs too!
    6868;
    69 BS3_PROC_BEGIN_MODE Bs3TrapSystemCallHandler, BS3_PBC_NEAR ; Near because we'll probably only ever need this from BS3TEXT16.
     69BS3_PROC_BEGIN_MODE Bs3TrapSystemCallHandler, BS3_PBC_NEAR ; Near because we'll probably only ever need this from CGROUP16.
    7070        ;
    7171        ; This prologue is kind of complicated because of 80286 and older CPUs
     
    168168.aoffSyscallHandlers:
    169169%ifdef TMPL_16BIT
    170         dw      .invalid_syscall wrt BS3TEXT16
    171         dw      .print_chr       wrt BS3TEXT16
    172         dw      .print_str       wrt BS3TEXT16
    173         dw      .to_ringX        wrt BS3TEXT16
    174         dw      .to_ringX        wrt BS3TEXT16
    175         dw      .to_ringX        wrt BS3TEXT16
    176         dw      .to_ringX        wrt BS3TEXT16
    177         dw      .restore_ctx     wrt BS3TEXT16
     170        dw      .invalid_syscall wrt CGROUP16
     171        dw      .print_chr       wrt CGROUP16
     172        dw      .print_str       wrt CGROUP16
     173        dw      .to_ringX        wrt CGROUP16
     174        dw      .to_ringX        wrt CGROUP16
     175        dw      .to_ringX        wrt CGROUP16
     176        dw      .to_ringX        wrt CGROUP16
     177        dw      .restore_ctx     wrt CGROUP16
    178178%else
    179179        dd      .invalid_syscall wrt FLAT
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitGdt.c

    r60556 r60557  
    4444BS3_DECL_FAR(void) Bs3InitGdt_rm_far(void)
    4545{
     46#if 1
     47    Bs3Gdte_R0_CS16.Gen.u16LimitLow     = Bs3Text16_Size - 1;
     48    Bs3Gdte_R1_CS16.Gen.u16LimitLow     = Bs3Text16_Size - 1;
     49    Bs3Gdte_R2_CS16.Gen.u16LimitLow     = Bs3Text16_Size - 1;
     50    Bs3Gdte_R3_CS16.Gen.u16LimitLow     = Bs3Text16_Size - 1;
     51#endif
     52    Bs3Gdte_RMTEXT16_CS.Gen.u16LimitLow = Bs3RmText16_Size - 1;
    4653    Bs3Gdte_X0TEXT16_CS.Gen.u16LimitLow = Bs3X0Text16_Size - 1;
    47     Bs3Gdte_X1TEXT16_CS.Gen.u16LimitLow = Bs3X0Text16_Size - 1;
     54    Bs3Gdte_X1TEXT16_CS.Gen.u16LimitLow = Bs3X1Text16_Size - 1;
     55
     56    Bs3Gdte_RMTEXT16_CS.Gen.u16BaseLow  = (uint16_t)Bs3RmText16_FlatAddr;
    4857    Bs3Gdte_X0TEXT16_CS.Gen.u16BaseLow  = (uint16_t)Bs3X0Text16_FlatAddr;
    4958    Bs3Gdte_X1TEXT16_CS.Gen.u16BaseLow  = (uint16_t)Bs3X1Text16_FlatAddr;
     59
     60    Bs3Gdte_RMTEXT16_CS.Gen.u8BaseHigh1 = (uint8_t)(Bs3RmText16_FlatAddr >> 16);
    5061    Bs3Gdte_X0TEXT16_CS.Gen.u8BaseHigh1 = (uint8_t)(Bs3X0Text16_FlatAddr >> 16);
    5162    Bs3Gdte_X1TEXT16_CS.Gen.u8BaseHigh1 = (uint8_t)(Bs3X1Text16_FlatAddr >> 16);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-system-data.asm

    r60539 r60557  
    177177        dw  00000h, 00000h, 00000h, 00000h      ; Entry 0d0h - currently unused
    178178        dw  00000h, 00000h, 00000h, 00000h      ; Entry 0d8h - currently unused
    179         dw  00000h, 00000h, 00000h, 00000h      ; Entry 0e0h - currently unused
    180179
    181180        ; Misc selectors.
     181BS3_GLOBAL_DATA Bs3Gdte_RMTEXT16_CS, 8          ; Entry 0e0h
     182        dw  0fffeh, 00000h                      ; 16-bit conforming code (read+exec) segment, accessed. Will be finalized at startup.
     183        dw  09f00h, 00000h
    182184BS3_GLOBAL_DATA Bs3Gdte_X0TEXT16_CS, 8          ; Entry 0e8h
    183185        dw  0fffeh, 00000h                      ; 16-bit conforming code (read+exec) segment, accessed. Will be finalized at startup.
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-data.h

    r60527 r60557  
    5050# define Bs3Gdte_Tss64Spare1                    BS3_DATA_NM(Bs3Gdte_Tss64Spare1)
    5151# define Bs3Gdte_Tss64Iobp                      BS3_DATA_NM(Bs3Gdte_Tss64Iobp)
     52# define Bs3Gdte_RMTEXT16_CS                    BS3_DATA_NM(Bs3Gdte_RMTEXT16_CS)
     53# define Bs3Gdte_X0TEXT16_CS                    BS3_DATA_NM(Bs3Gdte_X0TEXT16_CS)
     54# define Bs3Gdte_X1TEXT16_CS                    BS3_DATA_NM(Bs3Gdte_X1TEXT16_CS)
    5255# define Bs3Gdte_R0_MMIO16                      BS3_DATA_NM(Bs3Gdte_R0_MMIO16)
    5356
     
    220223# define Bs3Text16_EndOfSegment                 BS3_DATA_NM(Bs3Text16_EndOfSegment)
    221224# define Bs3Text16_Size                         BS3_DATA_NM(Bs3Text16_Size)
     225
    222226# define Bs3System16_StartOfSegment             BS3_DATA_NM(Bs3System16_StartOfSegment)
    223227# define Bs3System16_EndOfSegment               BS3_DATA_NM(Bs3System16_EndOfSegment)
     228
    224229# define Bs3Data16_StartOfSegment               BS3_DATA_NM(Bs3Data16_StartOfSegment)
    225230# define Bs3Data16_EndOfSegment                 BS3_DATA_NM(Bs3Data16_EndOfSegment)
     231
     232# define Bs3RmText16_StartOfSegment             BS3_DATA_NM(Bs3RmText16_StartOfSegment)
     233# define Bs3RmText16_EndOfSegment               BS3_DATA_NM(Bs3RmText16_EndOfSegment)
     234# define Bs3RmText16_Size                       BS3_DATA_NM(Bs3RmText16_Size)
     235# define Bs3RmText16_FlatAddr                   BS3_DATA_NM(Bs3RmText16_FlatAddr)
     236
     237# define Bs3X0Text16_StartOfSegment             BS3_DATA_NM(Bs3X0Text16_StartOfSegment)
     238# define Bs3X0Text16_EndOfSegment               BS3_DATA_NM(Bs3X0Text16_EndOfSegment)
     239# define Bs3X0Text16_Size                       BS3_DATA_NM(Bs3X0Text16_Size)
     240# define Bs3X0Text16_FlatAddr                   BS3_DATA_NM(Bs3X0Text16_FlatAddr)
     241
     242# define Bs3X1Text16_StartOfSegment             BS3_DATA_NM(Bs3X1Text16_StartOfSegment)
     243# define Bs3X1Text16_EndOfSegment               BS3_DATA_NM(Bs3X1Text16_EndOfSegment)
     244# define Bs3X1Text16_Size                       BS3_DATA_NM(Bs3X1Text16_Size)
     245# define Bs3X1Text16_FlatAddr                   BS3_DATA_NM(Bs3X1Text16_FlatAddr)
     246
    226247# define Bs3Text32_StartOfSegment               BS3_DATA_NM(Bs3Text32_StartOfSegment)
    227248# define Bs3Text32_EndOfSegment                 BS3_DATA_NM(Bs3Text32_EndOfSegment)
     249
    228250# define Bs3Data32_StartOfSegment               BS3_DATA_NM(Bs3Data32_StartOfSegment)
    229251# define Bs3Data32_EndOfSegment                 BS3_DATA_NM(Bs3Data32_EndOfSegment)
     252
    230253# define Bs3Text64_StartOfSegment               BS3_DATA_NM(Bs3Text64_StartOfSegment)
    231254# define Bs3Text64_EndOfSegment                 BS3_DATA_NM(Bs3Text64_EndOfSegment)
     255
    232256# define Bs3Data64_StartOfSegment               BS3_DATA_NM(Bs3Data64_StartOfSegment)
    233257# define Bs3Data64_EndOfSegment                 BS3_DATA_NM(Bs3Data64_EndOfSegment)
     
    235259# define Bs3Data16Thru64Text32And64_TotalSize   BS3_DATA_NM(Bs3Data16Thru64Text32And64_TotalSize)
    236260# define Bs3TotalImageSize                      BS3_DATA_NM(Bs3TotalImageSize)
     261
    237262# define g_achBs3HexDigits                      BS3_DATA_NM(g_achBs3HexDigits)
    238263# define g_achBs3HexDigitsUpper                 BS3_DATA_NM(g_achBs3HexDigitsUpper)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r60556 r60557  
    228228#define BS3_SEL_TSS64_IOBP          0x00a0 /**< The 64-bit TSS selector. */
    229229
     230#define BS3_SEL_RMTEXT16_CS         0x00e0 /**< Conforming code selector for accessing the BS3RMTEXT16 segment. Runtime config. */
    230231#define BS3_SEL_X0TEXT16_CS         0x00e8 /**< Conforming code selector for accessing the BS3X0TEXT16 segment. Runtime config. */
    231 #define BS3_SEL_X1TEXT16_CS         0x00f0 /**< Conforming code selector for accessing the BS3X0TEXT16 segment. Runtime config. */
     232#define BS3_SEL_X1TEXT16_CS         0x00f0 /**< Conforming code selector for accessing the BS3X1TEXT16 segment. Runtime config. */
    232233#define BS3_SEL_VMMDEV_MMIO16       0x00f8 /**< Selector for accessing the VMMDev MMIO segment at 0100000h from 16-bit code. */
    233234
     
    705706extern X86DESC BS3_FAR_DATA Bs3Gdte_Tss64Spare1;            /**< @see BS3_SEL_TSS64_SPARE1 */
    706707extern X86DESC BS3_FAR_DATA Bs3Gdte_Tss64Iobp;              /**< @see BS3_SEL_TSS64_IOBP */
     708extern X86DESC BS3_FAR_DATA Bs3Gdte_RMTEXT16_CS;            /**< @see BS3_SEL_RMTEXT16_CS */
    707709extern X86DESC BS3_FAR_DATA Bs3Gdte_X0TEXT16_CS;            /**< @see BS3_SEL_X0TEXT16_CS */
    708710extern X86DESC BS3_FAR_DATA Bs3Gdte_X1TEXT16_CS;            /**< @see BS3_SEL_X1TEXT16_CS */
     
    930932/** End of the BS3RMTEXT16 segment.   */
    931933extern uint8_t  BS3_FAR_DATA Bs3RmText16_EndOfSegment;
     934/** The size of the BS3RMTEXT16 segment.   */
     935extern uint16_t BS3_FAR_DATA Bs3RmText16_Size;
     936/** The flat start address of the BS3X0TEXT16 segment.   */
     937extern uint32_t BS3_FAR_DATA Bs3RmText16_FlatAddr;
    932938
    933939/** Start of the BS3X0TEXT16 segment.   */
     
    937943/** The size of the BS3X0TEXT16 segment.   */
    938944extern uint16_t BS3_FAR_DATA Bs3X0Text16_Size;
    939 /** The flat start address of the BS3X1TEXT16 segment.   */
     945/** The flat start address of the BS3X0TEXT16 segment.   */
    940946extern uint32_t BS3_FAR_DATA Bs3X0Text16_FlatAddr;
    941947
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r60554 r60557  
    14771477%define BS3_SEL_TSS64_IOBP          00a0h ;;< The 64-bit TSS selector.
    14781478
     1479%define BS3_SEL_RMTEXT16_CS         00e0h ;;< Conforming code selector for accessing the BS3RMTEXT16 segment. Runtime config.
    14791480%define BS3_SEL_X0TEXT16_CS         00e8h ;;< Conforming code selector for accessing the BS3X0TEXT16 segment. Runtime config.
    1480 %define BS3_SEL_X1TEXT16_CS         00f0h ;;< Conforming code selector for accessing the BS3X0TEXT16 segment. Runtime config.
     1481%define BS3_SEL_X1TEXT16_CS         00f0h ;;< Conforming code selector for accessing the BS3X1TEXT16 segment. Runtime config.
    14811482%define BS3_SEL_VMMDEV_MMIO16       00f8h ;;< Selector for accessing the VMMDev MMIO segment at 0100000h from 16-bit code.
    14821483
Note: See TracChangeset for help on using the changeset viewer.

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