VirtualBox

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


Ignore:
Timestamp:
Jan 8, 2016 12:23:32 AM (9 years ago)
Author:
vboxsync
Message:

bs3kit: 32-bit tss, idt and system call. started on 64-bit.

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
2 added
27 edited

Legend:

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

    r59259 r59286  
    172172TOOL_Bs3Ow32_COBJSUFF                 = $(TOOL_OPENWATCOM_COBJSUFF)
    173173TOOL_Bs3Ow32_CFLAGS                   = $(TOOL_OPENWATCOM_CFLAGS)
     174#       -adfs \ - This is too complicated and it doesn't support stubbing files (svn rename fun.h pain.h). Use kDepObj instead.
     175#       -ad=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dep)) \
     176#       -adt=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
     177#       -add=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source))) \
     178#       -adhp=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dir $(abspath $(source))))
    174179TOOL_Bs3Ow32_CFLAGS.debug             = $(TOOL_OPENWATCOM_CFLAGS.debug)
    175180TOOL_Bs3Ow32_CFLAGS.dbgopt            = $(TOOL_OPENWATCOM_CFLAGS.dbgopt)
     
    185190$(TOOL_OPENWATCOM_COMPILE_C_CMDS)
    186191        $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
     192        $(QUIET)$(REDIRECT) -wo /dev/null -- $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
    187193endef
    188194
    189195TOOL_Bs3Ow32_CXXOBJSUFF               = $(TOOL_OPENWATCOM_CXXOBJSUFF)
    190 TOOL_Bs3Ow32_CXXFLAGS                 = $(TOOL_OPENWATCOM_CXXFLAGS)
     196TOOL_Bs3Ow32_CXXFLAGS                 = $(TOOL_OPENWATCOM_CXXFLAGS) -ad=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(dep)) -adfs
    191197TOOL_Bs3Ow32_CXXFLAGS.debug           = $(TOOL_OPENWATCOM_CXXFLAGS.debug)
    192198TOOL_Bs3Ow32_CXXFLAGS.dbgopt          = $(TOOL_OPENWATCOM_CXXFLAGS.dbgopt)
     
    202208$(TOOL_OPENWATCOM_COMPILE_CXX_CMDS)
    203209        $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
     210        $(QUIET)$(REDIRECT) -wo /dev/null -- $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
    204211endef
    205212
     
    227234$(TOOL_OPENWATCOM-16_COMPILE_C_CMDS)
    228235        $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
     236        $(QUIET)$(REDIRECT) -wo /dev/null -- $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
    229237endef
    230238
     
    244252$(TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS)
    245253        $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
     254        $(QUIET)$(REDIRECT) -wo /dev/null -- $(KBUILD_BIN_PATH)/kDepObj$(HOSTSUFF_EXE) -s -f -q -o "$(dep)" -t "$(obj)" "$(obj)"
    246255endef
    247256
     
    524533        bs3-cmn-Trap32SetGate.c \
    525534        bs3-cmn-Trap64SetGate.c \
     535        bs3-cmn-TrapDefaultHandler.c \
     536        bs3-cmn-TrapPrintFrame.c \
    526537        bs3-cmn-TrapSetHandler.c \
    527538       ../../../Runtime/common/asm/ASMBitFirstClear.asm \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c32-Trap32Generic.asm

    r59259 r59286  
    3131%endif
    3232
    33 BS3_BEGIN_DATA32
     33BS3_BEGIN_DATA16
    3434;; Easy to access flat address of Bs3Trap32GenericEntries.
    3535BS3_GLOBAL_DATA g_Bs3Trap32GenericEntriesFlatAddr, 4
    36         dd Bs3Trap32GenericEntries
    37 
     36        dd Bs3Trap32GenericEntries wrt FLAT
     37;; Easy to access flat address of Bs3Trap32DoubleFaultHandler.
     38BS3_GLOBAL_DATA g_Bs3Trap32DoubleFaultHandlerFlatAddr, 4
     39        dd Bs3Trap32DoubleFaultHandler wrt FLAT
     40
     41BS3_BEGIN_DATA32
    3842;; Pointer C trap handlers.
    3943BS3_GLOBAL_DATA g_apfnBs3TrapHandlers_c32, 1024
     
    4246
    4347TMPL_BEGIN_TEXT
    44 BS3_EXTERN_CMN Bs3Trap32DefaultHandler
     48BS3_EXTERN_CMN Bs3TrapDefaultHandler
    4549BS3_EXTERN_CMN Bs3Trap32ResumeFrame
    4650
     
    268272        mov     eax, cr4
    269273        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], eax
     274        str     ax
     275        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.tr], ax
     276        sldt    ax
     277        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.ldtr], ax
    270278
    271279        ;
    272280        ; Set context bit width and clear all upper dwords and unused register members.
    273281        ;
     282.clear_and_dispatch_to_handler:         ; The double fault code joins us here.
     283        xor     edx, edx
    274284        mov     dword [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cBits], 32
    275         xor     edx, edx
     285        mov     dword [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.abPadding + 3], edx
    276286        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rax    + 4], edx
    277287        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rcx    + 4], edx
     
    304314        or      eax, eax
    305315        jnz     .call_handler
    306         mov     eax, Bs3Trap32DefaultHandler
     316        mov     eax, Bs3TrapDefaultHandler
    307317.call_handler:
    308318        mov     edi, esp
     
    322332BS3_PROC_END   bs3Trap32GenericCommon
    323333
     334
     335;;
     336; Helper.
     337;
     338; @retruns  Flat address in eax.
     339; @param    ax
     340; @uses     eax
     341;
     342bs3Trap32TssInAxToFlatInEax:
     343        ; Get the GDT base address and find the descriptor address (EAX)
     344        sub     esp, 16h
     345        sgdt    [esp + 2]               ; +2 for correct alignment.
     346        and     eax, 0fff8h
     347        add     eax, [esp + 4]          ; GDT base address.
     348        add     esp, 16h
     349
     350        ; Get the flat TSS address from the descriptor.
     351        push    ecx
     352        mov     ecx, [eax + 4]
     353        and     eax, 0ffff0000h
     354        movzx   eax, word [eax]
     355        or      eax, ecx
     356        pop     ecx
     357
     358        ret
     359
     360;;
     361; Double fault handler.
     362;
     363; We don't have to load any selectors or clear anything in EFLAGS because the
     364; TSS specified sane values which got loaded during the task switch.
     365;
     366BS3_PROC_BEGIN Bs3Trap32DoubleFaultHandler
     367        push    0                       ; We'll copy the rip from the other TSS here later to create a more sensible call chain.
     368        push    ebp
     369        mov     ebp, esp
     370
     371        ;
     372        ; Fill in the non-context trap frame bits.
     373        ;
     374        pushfd                          ; Get handler flags.
     375        pop     ecx
     376        xor     edx, edx                ; NULL register.
     377
     378        sub     esp, BS3TRAPFRAME_size  ; Allocate trap frame.
     379        mov     [esp + BS3TRAPFRAME.fHandlerRfl], ecx
     380        mov     word [esp + BS3TRAPFRAME.bXcpt], X86_XCPT_DF
     381        mov     [esp + BS3TRAPFRAME.uHandlerCs], cs
     382        mov     [esp + BS3TRAPFRAME.uHandlerSs], ss
     383        lea     ecx, [ebp + 12]
     384        mov     [esp + BS3TRAPFRAME.uHandlerRsp], ecx
     385        mov     [esp + BS3TRAPFRAME.uHandlerRsp + 4], edx
     386        mov     ecx, [ebp + 8]
     387        mov     [esp + BS3TRAPFRAME.uErrCd], ecx
     388        mov     [esp + BS3TRAPFRAME.uErrCd + 4], edx
     389
     390        ;
     391        ; Copy the register state from the previous task segment.
     392        ;
     393
     394        ; Find our TSS.
     395        str     ax
     396        call    bs3Trap32TssInAxToFlatInEax
     397
     398        ; Find the previous TSS.
     399        mov     ax, [eax + X86TSS32.selPrev]
     400        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.tr], ax
     401        call    bs3Trap32TssInAxToFlatInEax
     402
     403        ; Do the copying.
     404        mov     ecx, [eax + X86TSS32.eax]
     405        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], ecx
     406        mov     ecx, [eax + X86TSS32.ecx]
     407        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rcx], ecx
     408        mov     ecx, [eax + X86TSS32.edx]
     409        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rdx], ecx
     410        mov     ecx, [eax + X86TSS32.ebx]
     411        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rbx], ecx
     412        mov     ecx, [eax + X86TSS32.esp]
     413        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], ecx
     414        mov     ecx, [eax + X86TSS32.ebp]
     415        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp], ecx
     416        mov     [ebp], ecx              ; For better call stacks.
     417        mov     ecx, [eax + X86TSS32.esi]
     418        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rsi], ecx
     419        mov     ecx, [eax + X86TSS32.edi]
     420        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rdi], ecx
     421        mov     ecx, [eax + X86TSS32.esi]
     422        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rsi], ecx
     423        mov     ecx, [eax + X86TSS32.eflags]
     424        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], ecx
     425        mov     ecx, [eax + X86TSS32.eip]
     426        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.rip], ecx
     427        mov     [ebp + 4], ecx          ; For better call stacks.
     428        mov     cx, [eax + X86TSS32.cs]
     429        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cs], cx
     430        mov     cx, [eax + X86TSS32.ds]
     431        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.ds], cx
     432        mov     cx, [eax + X86TSS32.es]
     433        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.es], cx
     434        mov     cx, [eax + X86TSS32.fs]
     435        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.fs], cx
     436        mov     cx, [eax + X86TSS32.gs]
     437        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.gs], cx
     438        mov     cx, [eax + X86TSS32.ss]
     439        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], cx
     440        mov     cx, [eax + X86TSS32.selLdt]             ; Note! This isn't necessarily the ldtr at the time of the fault.
     441        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.ldtr], cx
     442        mov     cx, [eax + X86TSS32.cr3]                ; Note! This isn't necessarily the cr3 at the time of the fault.
     443        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3], ecx
     444
     445        mov     dword [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cBits], 32
     446
     447        ;
     448        ; Control registers.
     449        ;
     450        mov     ecx, cr0
     451        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0], ecx
     452        mov     ecx, cr2
     453        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cr2], ecx
     454        mov     ecx, cr4
     455        mov     [esp + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], ecx
     456
     457        ;
     458        ; Join code paths with the generic handler code.
     459        ;
     460        jmp     bs3Trap32GenericCommon.clear_and_dispatch_to_handler
     461BS3_PROC_END   Bs3Trap32DoubleFaultHandler
     462
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c32-Trap32ResumeFrame.asm

    r59258 r59286  
    5252        mov     cr4, eax
    5353.skip_cr4:
     54
    5455        mov     eax, [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3]
    5556        mov     edx, cr3
     
    5859        mov     cr3, eax
    5960.skip_cr3:
     61
    6062        mov     eax, [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr2]
    6163        mov     edx, cr2
     
    6466        mov     cr2, eax
    6567.skip_cr2:
     68
    6669        mov     eax, [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0]
    6770        mov     edx, cr0
     
    7073        mov     cr0, eax
    7174.skip_cr0:
     75
     76        ; LDTR
     77        sldt    ax
     78        cmp     ax, [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.ldtr]
     79        je      .skip_ldtr
     80        lldt    [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.ldtr]
     81.skip_ldtr:
     82
     83        ; TR - complicated because we need to clear the busy bit. ASSUMES GDT.
     84        str     ax
     85        cmp     ax, [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.tr]
     86        je      .skip_tr
     87
     88        movzx   eax, word [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.tr]
     89        or      eax, eax                ; check for null.
     90        jz      .load_tr
     91
     92        sub     esp, 10h
     93        mov     dword [esp + 8], 0      ; paranoia^2
     94        sgdt    [esp + 6]
     95        add     eax, [esp + 8]          ; the limit.
     96        add     esp, 10h
     97
     98        add     eax, X86DESCGENERIC_BIT_OFF_TYPE / 8
     99        and     byte [eax], ~(X86_SEL_TYPE_SYS_TSS_BUSY_MASK << (X86DESCGENERIC_BIT_OFF_TYPE % 8))
     100.load_tr:
     101        ltr     [ebx + BS3TRAPFRAME.Ctx + BS3REGCTX.tr]
     102.skip_tr:
     103
    72104.skip_control_regs:
    73105
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemAllocZ.c

    r58789 r59286  
    3030#include "bs3kit-template-header.h"
    3131#include "bs3-cmn-memory.h"
    32 #include <iprt/asm.h>
    3332
    3433
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-MemFree.c

    r58789 r59286  
    3030#include "bs3kit-template-header.h"
    3131#include "bs3-cmn-memory.h"
    32 #include <iprt/asm.h>
    3332
    3433
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForLM.c

    r59245 r59286  
    3030#include "bs3kit-template-header.h"
    3131#include "bs3-cmn-paging.h"
    32 #include <iprt/asm.h>
    3332
    3433
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPAE.c

    r59244 r59286  
    3030#include "bs3kit-template-header.h"
    3131#include "bs3-cmn-paging.h"
    32 #include <iprt/asm.h>
    3332
    3433
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c

    r59239 r59286  
    3030#include "bs3kit-template-header.h"
    3131#include "bs3-cmn-paging.h"
    32 #include <iprt/asm.h>
    3332
    3433
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAlloc.c

    r58789 r59286  
    2525 */
    2626
     27/*********************************************************************************************************************************
     28*   Header Files                                                                                                                 *
     29*********************************************************************************************************************************/
    2730#include "bs3kit-template-header.h"
    2831#include <iprt/asm.h>
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabAllocEx.c

    r59245 r59286  
    2525 */
    2626
     27/*********************************************************************************************************************************
     28*   Header Files                                                                                                                 *
     29*********************************************************************************************************************************/
    2730#include "bs3kit-template-header.h"
    2831#include <iprt/asm.h>
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabFree.c

    r58789 r59286  
    2525 */
    2626
     27/*********************************************************************************************************************************
     28*   Header Files                                                                                                                 *
     29*********************************************************************************************************************************/
    2730#include "bs3kit-template-header.h"
    2831#include <iprt/asm.h>
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabInit.c

    r58789 r59286  
    2525 */
    2626
     27/*********************************************************************************************************************************
     28*   Header Files                                                                                                                 *
     29*********************************************************************************************************************************/
    2730#include "bs3kit-template-header.h"
    2831#include <iprt/asm.h>
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAlloc.c

    r58789 r59286  
    2525 */
    2626
     27/*********************************************************************************************************************************
     28*   Header Files                                                                                                                 *
     29*********************************************************************************************************************************/
    2730#include "bs3kit-template-header.h"
    28 #include <iprt/asm.h>
    2931
    3032
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SlabListAllocEx.c

    r58789 r59286  
    2525 */
    2626
     27/*********************************************************************************************************************************
     28*   Header Files                                                                                                                 *
     29*********************************************************************************************************************************/
    2730#include "bs3kit-template-header.h"
    28 #include <iprt/asm.h>
    2931
    3032
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32Init.c

    r59259 r59286  
    2929*********************************************************************************************************************************/
    3030#include "bs3kit-template-header.h"
    31 #include <iprt/asm.h>
     31
     32
     33/*********************************************************************************************************************************
     34*   Global Variables                                                                                                             *
     35*********************************************************************************************************************************/
     36extern uint32_t BS3_DATA_NM(g_Bs3Trap32DoubleFaultHandlerFlatAddr);
    3237
    3338
    3439BS3_DECL(void) Bs3Trap32Init(void)
    3540{
    36     unsigned iIdt = 256;
    37     while (iIdt-- > 0)
     41     X86TSS32 BS3_FAR *pTss;
     42     unsigned iIdt;
     43
     44    /*
     45     * IDT entries, except the system call gate.
     46     */
     47    for (iIdt = 0; iIdt < BS3_TRAP_SYSCALL; iIdt++)
    3848        Bs3Trap32SetGate(iIdt, X86_SEL_TYPE_SYS_386_INT_GATE, 0 /*bDpl*/,
    3949                         BS3_SEL_R0_CS32, BS3_DATA_NM(g_Bs3Trap32GenericEntriesFlatAddr) + iIdt * 8, 0 /*cParams*/);
    40     /** @todo Init TSS for double faults and stuff. */
     50    for (iIdt = BS3_TRAP_SYSCALL + 1; iIdt < 256; iIdt++)
     51        Bs3Trap32SetGate(iIdt, X86_SEL_TYPE_SYS_386_INT_GATE, 0 /*bDpl*/,
     52                         BS3_SEL_R0_CS32, BS3_DATA_NM(g_Bs3Trap32GenericEntriesFlatAddr) + iIdt * 8, 0 /*cParams*/);
     53
     54    /*
     55     * Initialize the normal TSS so we can do ring transitions via the IDT.
     56     */
     57    //pTss = &BS3_DATA_NM(Bs3Tss32);
     58    Bs3MemZero(&BS3_DATA_NM(Bs3Tss32), sizeof(*pTss));
     59    BS3_DATA_NM(Bs3Tss32).esp0      = BS3_ADDR_STACK_R0;
     60    BS3_DATA_NM(Bs3Tss32).ss0       = BS3_SEL_R0_SS32;
     61    BS3_DATA_NM(Bs3Tss32).esp1      = BS3_ADDR_STACK_R1;
     62    BS3_DATA_NM(Bs3Tss32).ss1       = BS3_SEL_R1_SS32;
     63    BS3_DATA_NM(Bs3Tss32).esp2      = BS3_ADDR_STACK_R2;
     64    BS3_DATA_NM(Bs3Tss32).ss2       = BS3_SEL_R2_SS32;
     65
     66    /*
     67     * Initialize the double fault TSS.
     68     * cr3 is filled in by switcher code, when needed.
     69     */
     70    pTss = &BS3_DATA_NM(Bs3Tss32DoubleFault);
     71    Bs3MemZero(pTss, sizeof(*pTss));
     72    pTss->esp0      = BS3_ADDR_STACK_R0;
     73    pTss->ss0       = BS3_SEL_R0_SS32;
     74    pTss->esp1      = BS3_ADDR_STACK_R1;
     75    pTss->ss1       = BS3_SEL_R1_SS32;
     76    pTss->esp2      = BS3_ADDR_STACK_R2;
     77    pTss->ss2       = BS3_SEL_R2_SS32;
     78    pTss->eip       = BS3_DATA_NM(g_Bs3Trap32DoubleFaultHandlerFlatAddr);
     79    pTss->eflags    = X86_EFL_1;
     80    pTss->esp       = BS3_ADDR_STACK_R0_IST1;
     81    pTss->es        = BS3_SEL_R0_DS32;
     82    pTss->ds        = BS3_SEL_R0_DS32;
     83    pTss->cs        = BS3_SEL_R0_CS32;
     84    pTss->ss        = BS3_SEL_R0_SS32;
     85
     86    Bs3Trap32SetGate(X86_XCPT_DF, X86_SEL_TYPE_SYS_TASK_GATE, 0 /*bDpl*/, BS3_SEL_TSS32_DF, 0, 0 /*cParams*/);
    4187}
    4288
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap32SetGate.c

    r59258 r59286  
    2929*********************************************************************************************************************************/
    3030#include "bs3kit-template-header.h"
    31 #include <iprt/asm.h>
    3231
    3332
     
    3736
    3837    BS3_ASSERT(bDpl <= 3);
    39     BS3_ASSERT(bType <= 7);
     38    BS3_ASSERT(bType <= 15);
    4039    BS3_ASSERT(cParams <= 15);
    4140    pIdte->Gate.u16OffsetLow    = (uint16_t)off;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Trap64SetGate.c

    r59259 r59286  
    2929*********************************************************************************************************************************/
    3030#include "bs3kit-template-header.h"
    31 #include <iprt/asm.h>
    3231
    3332
     
    3736
    3837    BS3_ASSERT(bDpl <= 3);
    39     BS3_ASSERT(bType <= 7);
     38    BS3_ASSERT(bType <= 15);
    4039    BS3_ASSERT(bIst <= 7);
    4140    pIdte->Gate.u16OffsetLow    = (uint16_t)off;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapSetHandler.c

    r59259 r59286  
    2929*********************************************************************************************************************************/
    3030#include "bs3kit-template-header.h"
    31 #include <iprt/asm.h>
    3231
    3332extern PFNBS3TRAPHANDLER BS3_DATA_NM(BS3_CMN_NM(g_apfnBs3TrapHandlers))[256];
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-pe16.asm

    r59245 r59286  
    6666EXTERN Bs3InitMemory_rm
    6767BS3_EXTERN_CMN Bs3Shutdown
     68BS3_EXTERN_CMN Bs3Trap32Init
    6869
    69 extern _Bs3Printf_c32
    70 extern Bs3Printf_c64
     70extern _Bs3PrintChr_c32
     71extern Bs3PrintChr_c64
    7172
    7273BS3_BEGIN_TEXT16
     
    7576    ;
    7677    call    NAME(Bs3InitMemory_rm)      ; Initialize the memory (must be done from real mode).
     78    call    Bs3Trap32Init
    7779    call    NAME(Bs3SwitchToPE16_rm)
    7880
     
    9698    call    NAME(Bs3SwitchToPP32_rm)
    9799    BS3_SET_BITS 32
     100    push    '!'
     101    call    NAME(Bs3PrintChr_c32)
    98102    call    NAME(Bs3SwitchToRM_pp32)
    99103    BS3_SET_BITS 16
     
    101105    call    NAME(Bs3SwitchToPAE32_rm)
    102106    BS3_SET_BITS 32
     107    push    '~'
     108    call    NAME(Bs3PrintChr_c32)
    103109    call    NAME(Bs3SwitchToRM_pae32)
    104110    BS3_SET_BITS 16
     
    111117    call    NAME(Bs3SwitchToLM64_rm)
    112118    BS3_SET_BITS 64
     119;; todo:    push    '~'
     120;; todo:    call    Bs3PrintChr_c64
    113121    call    Bs3SwitchToRM_lm64
    114122    BS3_SET_BITS 16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm

    r59260 r59286  
    4545%ifdef TMPL_CMN_R86
    4646BS3_BEGIN_DATA16
     47BS3_EXTERN_SYSTEM16 Bs3Lidt_Ivt
    4748TMPL_BEGIN_TEXT
    4849extern               TMPL_NM(Bs3TrapSystemCallHandler)
    4950        xor     ax, ax
    5051        mov     ss, ax
     52
     53        mov     ax, BS3_SEL_SYSTEM16
     54        mov     ds, ax
     55        lidt    [Bs3Lidt_Ivt]
     56
    5157        mov     ax, BS3DATA16
    5258        mov     ds, ax
     
    101107BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss32
    102108BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss32DoubleFault
     109BS3_EXTERN_SYSTEM16 Bs3Tss32
     110BS3_EXTERN_SYSTEM16 Bs3Tss32DoubleFault
    103111TMPL_BEGIN_TEXT
    104112        mov     ax, BS3_SEL_R0_SS32
     
    112120        btr     [Bs3Gdte_Tss32DoubleFault], ax  ; mark it not busy
    113121        btr     [Bs3Gdte_Tss32], ax             ; mark it not busy
     122        mov     eax, cr3
     123        mov     [Bs3Tss32 + X86TSS32.cr3], eax
     124        mov     [Bs3Tss32DoubleFault + X86TSS32.cr3], eax
    114125        mov     ax, BS3_SEL_TSS32
    115126        ltr     ax
    116127
    117128        mov     ax, BS3_SEL_LDT
     129        mov     [Bs3Tss32 + X86TSS32.selLdt], ax
    118130        lldt    ax
    119131
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-PagingGetRootForLM64.asm

    r59245 r59286  
    5252;
    5353BS3_PROC_BEGIN_MODE Bs3PagingGetRootForLM64
     54        BS3_ONLY_16BIT_STMT push    ds
     55        BS3_ONLY_16BIT_STMT push    BS3DATA16
     56        BS3_ONLY_16BIT_STMT pop     ds
    5457        mov     eax, [g_PhysPagingRootLM TMPL_WRT_DATA16_OR_FLAT]
     58        BS3_ONLY_16BIT_STMT pop     ds
    5559        cmp     eax, 0ffffffffh
    5660        je      .init_root
     
    6064        push    xBP
    6165        mov     xBP, xSP
     66        BS3_ONLY_16BIT_STMT push    ds
    6267
    6368%ifdef TMPL_RM
     
    8489%endif
    8590
     91        BS3_ONLY_16BIT_STMT push    BS3DATA16
     92        BS3_ONLY_16BIT_STMT pop     ds
    8693        mov     eax, [g_PhysPagingRootLM TMPL_WRT_DATA16_OR_FLAT]
     94        BS3_ONLY_16BIT_STMT pop     ds
    8795        leave
    8896        ret
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-PagingGetRootForPAE32.asm

    r59245 r59286  
    5252;
    5353BS3_PROC_BEGIN_MODE Bs3PagingGetRootForPAE32
     54        BS3_ONLY_16BIT_STMT push    ds
     55        BS3_ONLY_16BIT_STMT push    BS3DATA16
     56        BS3_ONLY_16BIT_STMT pop     ds
    5457        mov     eax, [g_PhysPagingRootPAE TMPL_WRT_DATA16_OR_FLAT]
     58        BS3_ONLY_16BIT_STMT pop     ds
    5559        cmp     eax, 0ffffffffh
    5660        je      .init_root
     
    6064        push    xBP
    6165        mov     xBP, xSP
     66        BS3_ONLY_16BIT_STMT push    ds
    6267
    6368%ifdef TMPL_RM
     
    8489%endif
    8590
     91        BS3_ONLY_16BIT_STMT push    BS3DATA16
     92        BS3_ONLY_16BIT_STMT pop     ds
    8693        mov     eax, [g_PhysPagingRootPAE TMPL_WRT_DATA16_OR_FLAT]
     94        BS3_ONLY_16BIT_STMT pop     ds
    8795        leave
    8896        ret
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-PagingGetRootForPP32.asm

    r59245 r59286  
    5252;
    5353BS3_PROC_BEGIN_MODE Bs3PagingGetRootForPP32
     54        BS3_ONLY_16BIT_STMT push    ds
     55        BS3_ONLY_16BIT_STMT push    BS3DATA16
     56        BS3_ONLY_16BIT_STMT pop     ds
    5457        mov     eax, [g_PhysPagingRootPP TMPL_WRT_DATA16_OR_FLAT]
     58        BS3_ONLY_16BIT_STMT pop     ds
    5559        cmp     eax, 0ffffffffh
    5660        je      .init_root
     
    6064        push    xBP
    6165        mov     xBP, xSP
     66        BS3_ONLY_16BIT_STMT push    ds
    6267
    6368%ifdef TMPL_RM
     
    8489%endif
    8590
     91        BS3_ONLY_16BIT_STMT push    BS3DATA16
     92        BS3_ONLY_16BIT_STMT pop     ds
    8693        mov     eax, [g_PhysPagingRootPP TMPL_WRT_DATA16_OR_FLAT]
     94        BS3_ONLY_16BIT_STMT pop     ds
    8795        leave
    8896        ret
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM64.asm

    r59259 r59286  
    5959        ; unnecessary 32-bit -> 64-bit -> 32-bit trips.)
    6060        ;
     61 %ifdef TMPL_16BIT
     62        and     esp, 0ffffh
     63        push    word [esp]              ; copy return address.
     64        and     word [esp + 2], 0       ; clear upper return address
     65        add     dword [esp], BS3_ADDR_BS3TEXT16 ; Add base of return segment, completing 32-bit conversion.
     66 %endif
    6167        extern  TMPL_NM(Bs3SwitchToLM32)
    6268        call    TMPL_NM(Bs3SwitchToLM32)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapSystemCallHandler.asm

    r59259 r59286  
    7070        mov     bx, ax
    7171        shl     bx, 1
    72         mov     bx, [cs:.aoffSyscallHandlers + bx]
     72        jmp     word [cs:.aoffSyscallHandlers + bx]
    7373%else
    7474        movzx   ebx, ax
    75         mov     ebx, [.aoffSyscallHandlers + ebx * 2]
     75        mov     ebx, [.aoffSyscallHandlers + ebx * 4]
     76        jmp     xBX
    7677%endif
    7778.aoffSyscallHandlers:
     
    119120        BS3_SET_BITS 16
    120121%endif
     122
    121123        ; Print the character.
    122124        mov     bx, 0ff00h
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r59259 r59286  
    280280 * For indicating near 16-bit functions.
    281281 * Does nothing in 32-bit and 64-bit code. */
     282/** @def BS3_FAR_DATA
     283 * For indicating far 16-bit external data, i.e. in a segment other than DATA16.
     284 * Does nothing in 32-bit and 64-bit code. */
    282285#ifdef M_I86
    283286# define BS3_FAR            __far
     
    285288# define BS3_FAR_CODE       __far
    286289# define BS3_NEAR_CODE      __near
     290# define BS3_FAR_DATA       __far
    287291#else
    288292# define BS3_FAR
     
    290294# define BS3_FAR_CODE
    291295# define BS3_NEAR_CODE
     296# define BS3_FAR_DATA
    292297#endif
    293298
     
    365370 * Constructs a data name.
    366371 *
    367  * Example: BS3_DATA_NM(Bs3Gdt)
     372 * Example: extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdt)
    368373 *
    369374 * @param   a_Name      The name of the global variable.
     
    472477 * @{ */
    473478/** The GDT, indexed by BS3_SEL_XXX shifted by 3. */
    474 extern X86DESC BS3_DATA_NM(Bs3Gdt)[(BS3_SEL_GDT_LIMIT + 1) / 8];
    475 
    476 extern X86DESC64 BS3_DATA_NM(Bs3Gdt_Ldt);                   /**< @see BS3_SEL_LDT */
    477 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss16);                  /**< @see BS3_SEL_TSS16  */
    478 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss16DoubleFault);       /**< @see BS3_SEL_TSS16_DF */
    479 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss16Spare0);            /**< @see BS3_SEL_TSS16_SPARE0 */
    480 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss16Spare1);            /**< @see BS3_SEL_TSS16_SPARE1 */
    481 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss32);                  /**< @see BS3_SEL_TSS32 */
    482 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss32DoubleFault);       /**< @see BS3_SEL_TSS32_DF */
    483 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss32Spare0);            /**< @see BS3_SEL_TSS32_SPARE0 */
    484 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss32Spare1);            /**< @see BS3_SEL_TSS32_SPARE1 */
    485 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss32IobpIntRedirBm);    /**< @see BS3_SEL_TSS32_IOBP_IRB */
    486 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss32IntRedirBm);        /**< @see BS3_SEL_TSS32_IRB */
    487 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss64);                  /**< @see BS3_SEL_TSS64 */
    488 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss64Spare0);            /**< @see BS3_SEL_TSS64_SPARE0 */
    489 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss64Spare1);            /**< @see BS3_SEL_TSS64_SPARE1 */
    490 extern X86DESC BS3_DATA_NM(Bs3Gdte_Tss64Iobp);              /**< @see BS3_SEL_TSS64_IOBP */
    491 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_MMIO16);              /**< @see BS3_SEL_VMMDEV_MMIO16 */
    492 
    493 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_First);               /**< @see BS3_SEL_R0_FIRST */
    494 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS16);                /**< @see BS3_SEL_R0_CS16 */
    495 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_DS16);                /**< @see BS3_SEL_R0_DS16 */
    496 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_SS16);                /**< @see BS3_SEL_R0_SS16 */
    497 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS32);                /**< @see BS3_SEL_R0_CS32 */
    498 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_DS32);                /**< @see BS3_SEL_R0_DS32 */
    499 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_SS32);                /**< @see BS3_SEL_R0_SS32 */
    500 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS64);                /**< @see BS3_SEL_R0_CS64 */
    501 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_DS64);                /**< @see BS3_SEL_R0_DS64 */
    502 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS16_EO);             /**< @see BS3_SEL_R0_CS16_EO */
    503 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS16_CNF);            /**< @see BS3_SEL_R0_CS16_CNF */
    504 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS16_CND_EO);         /**< @see BS3_SEL_R0_CS16_CNF_EO */
    505 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS32_EO);             /**< @see BS3_SEL_R0_CS32_EO */
    506 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF);            /**< @see BS3_SEL_R0_CS32_CNF */
    507 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF_EO);         /**< @see BS3_SEL_R0_CS32_CNF_EO */
    508 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS64_EO);             /**< @see BS3_SEL_R0_CS64_EO */
    509 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF);            /**< @see BS3_SEL_R0_CS64_CNF */
    510 extern X86DESC BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF_EO);         /**< @see BS3_SEL_R0_CS64_CNF_EO */
    511 
    512 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_First);               /**< @see BS3_SEL_R1_FIRST */
    513 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS16);                /**< @see BS3_SEL_R1_CS16 */
    514 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_DS16);                /**< @see BS3_SEL_R1_DS16 */
    515 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_SS16);                /**< @see BS3_SEL_R1_SS16 */
    516 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS32);                /**< @see BS3_SEL_R1_CS32 */
    517 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_DS32);                /**< @see BS3_SEL_R1_DS32 */
    518 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_SS32);                /**< @see BS3_SEL_R1_SS32 */
    519 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS64);                /**< @see BS3_SEL_R1_CS64 */
    520 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_DS64);                /**< @see BS3_SEL_R1_DS64 */
    521 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS16_EO);             /**< @see BS3_SEL_R1_CS16_EO */
    522 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS16_CNF);            /**< @see BS3_SEL_R1_CS16_CNF */
    523 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS16_CND_EO);         /**< @see BS3_SEL_R1_CS16_CNF_EO */
    524 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS32_EO);             /**< @see BS3_SEL_R1_CS32_EO */
    525 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF);            /**< @see BS3_SEL_R1_CS32_CNF */
    526 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF_EO);         /**< @see BS3_SEL_R1_CS32_CNF_EO */
    527 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS64_EO);             /**< @see BS3_SEL_R1_CS64_EO */
    528 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF);            /**< @see BS3_SEL_R1_CS64_CNF */
    529 extern X86DESC BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF_EO);         /**< @see BS3_SEL_R1_CS64_CNF_EO */
    530 
    531 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_First);               /**< @see BS3_SEL_R2_FIRST */
    532 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS16);                /**< @see BS3_SEL_R2_CS16 */
    533 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_DS16);                /**< @see BS3_SEL_R2_DS16 */
    534 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_SS16);                /**< @see BS3_SEL_R2_SS16 */
    535 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS32);                /**< @see BS3_SEL_R2_CS32 */
    536 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_DS32);                /**< @see BS3_SEL_R2_DS32 */
    537 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_SS32);                /**< @see BS3_SEL_R2_SS32 */
    538 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS64);                /**< @see BS3_SEL_R2_CS64 */
    539 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_DS64);                /**< @see BS3_SEL_R2_DS64 */
    540 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS16_EO);             /**< @see BS3_SEL_R2_CS16_EO */
    541 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS16_CNF);            /**< @see BS3_SEL_R2_CS16_CNF */
    542 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS16_CND_EO);         /**< @see BS3_SEL_R2_CS16_CNF_EO */
    543 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS32_EO);             /**< @see BS3_SEL_R2_CS32_EO */
    544 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF);            /**< @see BS3_SEL_R2_CS32_CNF */
    545 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF_EO);         /**< @see BS3_SEL_R2_CS32_CNF_EO */
    546 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS64_EO);             /**< @see BS3_SEL_R2_CS64_EO */
    547 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF);            /**< @see BS3_SEL_R2_CS64_CNF */
    548 extern X86DESC BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF_EO);         /**< @see BS3_SEL_R2_CS64_CNF_EO */
    549 
    550 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_First);               /**< @see BS3_SEL_R3_FIRST */
    551 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS16);                /**< @see BS3_SEL_R3_CS16 */
    552 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_DS16);                /**< @see BS3_SEL_R3_DS16 */
    553 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_SS16);                /**< @see BS3_SEL_R3_SS16 */
    554 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS32);                /**< @see BS3_SEL_R3_CS32 */
    555 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_DS32);                /**< @see BS3_SEL_R3_DS32 */
    556 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_SS32);                /**< @see BS3_SEL_R3_SS32 */
    557 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS64);                /**< @see BS3_SEL_R3_CS64 */
    558 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_DS64);                /**< @see BS3_SEL_R3_DS64 */
    559 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS16_EO);             /**< @see BS3_SEL_R3_CS16_EO */
    560 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS16_CNF);            /**< @see BS3_SEL_R3_CS16_CNF */
    561 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS16_CND_EO);         /**< @see BS3_SEL_R3_CS16_CNF_EO */
    562 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS32_EO);             /**< @see BS3_SEL_R3_CS32_EO */
    563 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF);            /**< @see BS3_SEL_R3_CS32_CNF */
    564 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF_EO);         /**< @see BS3_SEL_R3_CS32_CNF_EO */
    565 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS64_EO);             /**< @see BS3_SEL_R3_CS64_EO */
    566 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF);            /**< @see BS3_SEL_R3_CS64_CNF */
    567 extern X86DESC BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF_EO);         /**< @see BS3_SEL_R3_CS64_CNF_EO */
    568 
    569 extern X86DESC BS3_DATA_NM(Bs3GdteSpare00); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_00 */
    570 extern X86DESC BS3_DATA_NM(Bs3GdteSpare01); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_01 */
    571 extern X86DESC BS3_DATA_NM(Bs3GdteSpare02); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_02 */
    572 extern X86DESC BS3_DATA_NM(Bs3GdteSpare03); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_03 */
    573 extern X86DESC BS3_DATA_NM(Bs3GdteSpare04); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_04 */
    574 extern X86DESC BS3_DATA_NM(Bs3GdteSpare05); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_05 */
    575 extern X86DESC BS3_DATA_NM(Bs3GdteSpare06); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_06 */
    576 extern X86DESC BS3_DATA_NM(Bs3GdteSpare07); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_07 */
    577 extern X86DESC BS3_DATA_NM(Bs3GdteSpare08); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_08 */
    578 extern X86DESC BS3_DATA_NM(Bs3GdteSpare09); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_09 */
    579 extern X86DESC BS3_DATA_NM(Bs3GdteSpare0a); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0a */
    580 extern X86DESC BS3_DATA_NM(Bs3GdteSpare0b); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0b */
    581 extern X86DESC BS3_DATA_NM(Bs3GdteSpare0c); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0c */
    582 extern X86DESC BS3_DATA_NM(Bs3GdteSpare0d); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0d */
    583 extern X86DESC BS3_DATA_NM(Bs3GdteSpare0e); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0e */
    584 extern X86DESC BS3_DATA_NM(Bs3GdteSpare0f); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0f */
    585 extern X86DESC BS3_DATA_NM(Bs3GdteSpare10); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_10 */
    586 extern X86DESC BS3_DATA_NM(Bs3GdteSpare11); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_11 */
    587 extern X86DESC BS3_DATA_NM(Bs3GdteSpare12); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_12 */
    588 extern X86DESC BS3_DATA_NM(Bs3GdteSpare13); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_13 */
    589 extern X86DESC BS3_DATA_NM(Bs3GdteSpare14); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_14 */
    590 extern X86DESC BS3_DATA_NM(Bs3GdteSpare15); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_15 */
    591 extern X86DESC BS3_DATA_NM(Bs3GdteSpare16); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_16 */
    592 extern X86DESC BS3_DATA_NM(Bs3GdteSpare17); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_17 */
    593 extern X86DESC BS3_DATA_NM(Bs3GdteSpare18); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_18 */
    594 extern X86DESC BS3_DATA_NM(Bs3GdteSpare19); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_19 */
    595 extern X86DESC BS3_DATA_NM(Bs3GdteSpare1a); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1a */
    596 extern X86DESC BS3_DATA_NM(Bs3GdteSpare1b); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1b */
    597 extern X86DESC BS3_DATA_NM(Bs3GdteSpare1c); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1c */
    598 extern X86DESC BS3_DATA_NM(Bs3GdteSpare1d); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1d */
    599 extern X86DESC BS3_DATA_NM(Bs3GdteSpare1e); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1e */
    600 extern X86DESC BS3_DATA_NM(Bs3GdteSpare1f); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1f */
     479extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdt)[(BS3_SEL_GDT_LIMIT + 1) / 8];
     480
     481extern X86DESC64 BS3_FAR_DATA BS3_DATA_NM(Bs3Gdt_Ldt);                   /**< @see BS3_SEL_LDT */
     482extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss16);                  /**< @see BS3_SEL_TSS16  */
     483extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss16DoubleFault);       /**< @see BS3_SEL_TSS16_DF */
     484extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss16Spare0);            /**< @see BS3_SEL_TSS16_SPARE0 */
     485extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss16Spare1);            /**< @see BS3_SEL_TSS16_SPARE1 */
     486extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss32);                  /**< @see BS3_SEL_TSS32 */
     487extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss32DoubleFault);       /**< @see BS3_SEL_TSS32_DF */
     488extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss32Spare0);            /**< @see BS3_SEL_TSS32_SPARE0 */
     489extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss32Spare1);            /**< @see BS3_SEL_TSS32_SPARE1 */
     490extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss32IobpIntRedirBm);    /**< @see BS3_SEL_TSS32_IOBP_IRB */
     491extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss32IntRedirBm);        /**< @see BS3_SEL_TSS32_IRB */
     492extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss64);                  /**< @see BS3_SEL_TSS64 */
     493extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss64Spare0);            /**< @see BS3_SEL_TSS64_SPARE0 */
     494extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss64Spare1);            /**< @see BS3_SEL_TSS64_SPARE1 */
     495extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_Tss64Iobp);              /**< @see BS3_SEL_TSS64_IOBP */
     496extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_MMIO16);              /**< @see BS3_SEL_VMMDEV_MMIO16 */
     497
     498extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_First);               /**< @see BS3_SEL_R0_FIRST */
     499extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS16);                /**< @see BS3_SEL_R0_CS16 */
     500extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_DS16);                /**< @see BS3_SEL_R0_DS16 */
     501extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_SS16);                /**< @see BS3_SEL_R0_SS16 */
     502extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS32);                /**< @see BS3_SEL_R0_CS32 */
     503extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_DS32);                /**< @see BS3_SEL_R0_DS32 */
     504extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_SS32);                /**< @see BS3_SEL_R0_SS32 */
     505extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS64);                /**< @see BS3_SEL_R0_CS64 */
     506extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_DS64);                /**< @see BS3_SEL_R0_DS64 */
     507extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS16_EO);             /**< @see BS3_SEL_R0_CS16_EO */
     508extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS16_CNF);            /**< @see BS3_SEL_R0_CS16_CNF */
     509extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS16_CND_EO);         /**< @see BS3_SEL_R0_CS16_CNF_EO */
     510extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS32_EO);             /**< @see BS3_SEL_R0_CS32_EO */
     511extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF);            /**< @see BS3_SEL_R0_CS32_CNF */
     512extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS32_CNF_EO);         /**< @see BS3_SEL_R0_CS32_CNF_EO */
     513extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS64_EO);             /**< @see BS3_SEL_R0_CS64_EO */
     514extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF);            /**< @see BS3_SEL_R0_CS64_CNF */
     515extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R0_CS64_CNF_EO);         /**< @see BS3_SEL_R0_CS64_CNF_EO */
     516
     517extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_First);               /**< @see BS3_SEL_R1_FIRST */
     518extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS16);                /**< @see BS3_SEL_R1_CS16 */
     519extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_DS16);                /**< @see BS3_SEL_R1_DS16 */
     520extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_SS16);                /**< @see BS3_SEL_R1_SS16 */
     521extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS32);                /**< @see BS3_SEL_R1_CS32 */
     522extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_DS32);                /**< @see BS3_SEL_R1_DS32 */
     523extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_SS32);                /**< @see BS3_SEL_R1_SS32 */
     524extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS64);                /**< @see BS3_SEL_R1_CS64 */
     525extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_DS64);                /**< @see BS3_SEL_R1_DS64 */
     526extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS16_EO);             /**< @see BS3_SEL_R1_CS16_EO */
     527extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS16_CNF);            /**< @see BS3_SEL_R1_CS16_CNF */
     528extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS16_CND_EO);         /**< @see BS3_SEL_R1_CS16_CNF_EO */
     529extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS32_EO);             /**< @see BS3_SEL_R1_CS32_EO */
     530extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF);            /**< @see BS3_SEL_R1_CS32_CNF */
     531extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS32_CNF_EO);         /**< @see BS3_SEL_R1_CS32_CNF_EO */
     532extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS64_EO);             /**< @see BS3_SEL_R1_CS64_EO */
     533extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF);            /**< @see BS3_SEL_R1_CS64_CNF */
     534extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R1_CS64_CNF_EO);         /**< @see BS3_SEL_R1_CS64_CNF_EO */
     535
     536extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_First);               /**< @see BS3_SEL_R2_FIRST */
     537extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS16);                /**< @see BS3_SEL_R2_CS16 */
     538extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_DS16);                /**< @see BS3_SEL_R2_DS16 */
     539extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_SS16);                /**< @see BS3_SEL_R2_SS16 */
     540extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS32);                /**< @see BS3_SEL_R2_CS32 */
     541extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_DS32);                /**< @see BS3_SEL_R2_DS32 */
     542extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_SS32);                /**< @see BS3_SEL_R2_SS32 */
     543extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS64);                /**< @see BS3_SEL_R2_CS64 */
     544extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_DS64);                /**< @see BS3_SEL_R2_DS64 */
     545extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS16_EO);             /**< @see BS3_SEL_R2_CS16_EO */
     546extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS16_CNF);            /**< @see BS3_SEL_R2_CS16_CNF */
     547extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS16_CND_EO);         /**< @see BS3_SEL_R2_CS16_CNF_EO */
     548extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS32_EO);             /**< @see BS3_SEL_R2_CS32_EO */
     549extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF);            /**< @see BS3_SEL_R2_CS32_CNF */
     550extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS32_CNF_EO);         /**< @see BS3_SEL_R2_CS32_CNF_EO */
     551extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS64_EO);             /**< @see BS3_SEL_R2_CS64_EO */
     552extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF);            /**< @see BS3_SEL_R2_CS64_CNF */
     553extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R2_CS64_CNF_EO);         /**< @see BS3_SEL_R2_CS64_CNF_EO */
     554
     555extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_First);               /**< @see BS3_SEL_R3_FIRST */
     556extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS16);                /**< @see BS3_SEL_R3_CS16 */
     557extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_DS16);                /**< @see BS3_SEL_R3_DS16 */
     558extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_SS16);                /**< @see BS3_SEL_R3_SS16 */
     559extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS32);                /**< @see BS3_SEL_R3_CS32 */
     560extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_DS32);                /**< @see BS3_SEL_R3_DS32 */
     561extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_SS32);                /**< @see BS3_SEL_R3_SS32 */
     562extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS64);                /**< @see BS3_SEL_R3_CS64 */
     563extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_DS64);                /**< @see BS3_SEL_R3_DS64 */
     564extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS16_EO);             /**< @see BS3_SEL_R3_CS16_EO */
     565extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS16_CNF);            /**< @see BS3_SEL_R3_CS16_CNF */
     566extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS16_CND_EO);         /**< @see BS3_SEL_R3_CS16_CNF_EO */
     567extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS32_EO);             /**< @see BS3_SEL_R3_CS32_EO */
     568extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF);            /**< @see BS3_SEL_R3_CS32_CNF */
     569extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS32_CNF_EO);         /**< @see BS3_SEL_R3_CS32_CNF_EO */
     570extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS64_EO);             /**< @see BS3_SEL_R3_CS64_EO */
     571extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF);            /**< @see BS3_SEL_R3_CS64_CNF */
     572extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_R3_CS64_CNF_EO);         /**< @see BS3_SEL_R3_CS64_CNF_EO */
     573
     574extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare00); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_00 */
     575extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare01); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_01 */
     576extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare02); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_02 */
     577extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare03); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_03 */
     578extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare04); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_04 */
     579extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare05); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_05 */
     580extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare06); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_06 */
     581extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare07); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_07 */
     582extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare08); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_08 */
     583extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare09); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_09 */
     584extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare0a); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0a */
     585extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare0b); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0b */
     586extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare0c); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0c */
     587extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare0d); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0d */
     588extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare0e); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0e */
     589extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare0f); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_0f */
     590extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare10); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_10 */
     591extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare11); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_11 */
     592extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare12); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_12 */
     593extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare13); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_13 */
     594extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare14); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_14 */
     595extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare15); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_15 */
     596extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare16); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_16 */
     597extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare17); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_17 */
     598extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare18); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_18 */
     599extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare19); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_19 */
     600extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare1a); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1a */
     601extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare1b); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1b */
     602extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare1c); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1c */
     603extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare1d); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1d */
     604extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare1e); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1e */
     605extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteSpare1f); /**< GDT entry for playing with in testcases. @see BS3_SEL_SPARE_1f */
    601606
    602607/** GDTs setting up the tiled 16-bit access to the first 16 MBs of memory.
    603608 * @see BS3_SEL_TILED, BS3_SEL_TILED_LAST, BS3_SEL_TILED_AREA_SIZE */
    604 extern X86DESC BS3_DATA_NM(Bs3GdteTiled)[256];
     609extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteTiled)[256];
    605610/** Free GDTes, part \#1. */
    606 extern X86DESC BS3_DATA_NM(Bs3GdteFreePart1)[64];
     611extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteFreePart1)[64];
    607612/** The BS3CODE16 GDT entry. @see BS3_SEL_TEXT16   */
    608 extern X86DESC BS3_DATA_NM(Bs3Gdte_CODE16);
     613extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_CODE16);
    609614/** Free GDTes, part \#2. */
    610 extern X86DESC BS3_DATA_NM(Bs3GdteFreePart2)[511];
     615extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteFreePart2)[511];
    611616/** The BS3SYSTEM16 GDT entry. */
    612 extern X86DESC BS3_DATA_NM(Bs3Gdte_SYSTEM16);
     617extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_SYSTEM16);
    613618/** Free GDTes, part \#3. */
    614 extern X86DESC BS3_DATA_NM(Bs3GdteFreePart3)[223];
     619extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdteFreePart3)[223];
    615620/** The BS3DATA16 GDT entry. */
    616 extern X86DESC BS3_DATA_NM(Bs3Gdte_DATA16);
     621extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3Gdte_DATA16);
    617622/** The end of the GDT (exclusive). */
    618 extern X86DESC BS3_DATA_NM(Bs3GdtEnd);
     623extern X86DESC BS3_FAR_DATA BS3_DATA_NM(Bs3GdtEnd);
    619624
    620625/** The default 16-bit TSS. */
    621 extern X86TSS16  BS3_DATA_NM(Bs3Tss16);
    622 extern X86TSS16  BS3_DATA_NM(Bs3Tss16DoubleFault);
    623 extern X86TSS16  BS3_DATA_NM(Bs3Tss16Spare0);
    624 extern X86TSS16  BS3_DATA_NM(Bs3Tss16Spare1);
     626extern X86TSS16  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss16);
     627extern X86TSS16  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss16DoubleFault);
     628extern X86TSS16  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss16Spare0);
     629extern X86TSS16  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss16Spare1);
    625630/** The default 32-bit TSS. */
    626 extern X86TSS32  BS3_DATA_NM(Bs3Tss32);
    627 extern X86TSS32  BS3_DATA_NM(Bs3Tss32DoubleFault);
    628 extern X86TSS32  BS3_DATA_NM(Bs3Tss32Spare0);
    629 extern X86TSS32  BS3_DATA_NM(Bs3Tss32Spare1);
     631extern X86TSS32  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss32);
     632extern X86TSS32  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss32DoubleFault);
     633extern X86TSS32  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss32Spare0);
     634extern X86TSS32  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss32Spare1);
    630635/** The default 64-bit TSS. */
    631 extern X86TSS64  BS3_DATA_NM(Bs3Tss64);
    632 extern X86TSS64  BS3_DATA_NM(Bs3Tss64Spare0);
    633 extern X86TSS64  BS3_DATA_NM(Bs3Tss64Spare1);
    634 extern X86TSS64  BS3_DATA_NM(Bs3Tss64WithIopb);
    635 extern X86TSS32  BS3_DATA_NM(Bs3Tss32WithIopb);
     636extern X86TSS64  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss64);
     637extern X86TSS64  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss64Spare0);
     638extern X86TSS64  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss64Spare1);
     639extern X86TSS64  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss64WithIopb);
     640extern X86TSS32  BS3_FAR_DATA BS3_DATA_NM(Bs3Tss32WithIopb);
    636641/** Interrupt redirection bitmap used by Bs3Tss32WithIopb. */
    637 extern uint8_t   BS3_DATA_NM(Bs3SharedIntRedirBm)[32];
     642extern uint8_t   BS3_FAR_DATA BS3_DATA_NM(Bs3SharedIntRedirBm)[32];
    638643/** I/O permission bitmap used by Bs3Tss32WithIopb and Bs3Tss64WithIopb. */
    639 extern uint8_t   BS3_DATA_NM(Bs3SharedIobp)[8192+2];
     644extern uint8_t   BS3_FAR_DATA BS3_DATA_NM(Bs3SharedIobp)[8192+2];
    640645/** End of the I/O permission bitmap (exclusive). */
    641 extern uint8_t   BS3_DATA_NM(Bs3SharedIobpEnd);
     646extern uint8_t   BS3_FAR_DATA BS3_DATA_NM(Bs3SharedIobpEnd);
    642647/** 16-bit IDT. */
    643 extern X86DESC   BS3_DATA_NM(Bs3Idt16)[256];
     648extern X86DESC   BS3_FAR_DATA BS3_DATA_NM(Bs3Idt16)[256];
    644649/** 32-bit IDT. */
    645 extern X86DESC   BS3_DATA_NM(Bs3Idt32)[256];
     650extern X86DESC   BS3_FAR_DATA BS3_DATA_NM(Bs3Idt32)[256];
    646651/** 64-bit IDT. */
    647 extern X86DESC64 BS3_DATA_NM(Bs3Idt64)[256];
     652extern X86DESC64 BS3_FAR_DATA BS3_DATA_NM(Bs3Idt64)[256];
    648653/** Structure for the LIDT instruction for loading the 16-bit IDT. */
    649 extern X86XDTR64 BS3_DATA_NM(Bs3Lidt_Idt16);
     654extern X86XDTR64 BS3_FAR_DATA BS3_DATA_NM(Bs3Lidt_Idt16);
    650655/** Structure for the LIDT instruction for loading the 32-bit IDT. */
    651 extern X86XDTR64 BS3_DATA_NM(Bs3Lidt_Idt32);
     656extern X86XDTR64 BS3_FAR_DATA BS3_DATA_NM(Bs3Lidt_Idt32);
    652657/** Structure for the LIDT instruction for loading the 64-bit IDT. */
    653 extern X86XDTR64 BS3_DATA_NM(Bs3Lidt_Idt64);
     658extern X86XDTR64 BS3_FAR_DATA BS3_DATA_NM(Bs3Lidt_Idt64);
    654659/** Structure for the LIDT instruction for loading the real mode interrupt
    655660 *  vector table.. */
    656 extern X86XDTR64 BS3_DATA_NM(Bs3Lidt_Ivt);
     661extern X86XDTR64 BS3_FAR_DATA BS3_DATA_NM(Bs3Lidt_Ivt);
    657662/** Structure for the LGDT instruction for loading the GDT. */
    658 extern X86XDTR64 BS3_DATA_NM(Bs3Lgdt_Gdt);
     663extern X86XDTR64 BS3_FAR_DATA BS3_DATA_NM(Bs3Lgdt_Gdt);
    659664/** The LDT (all entries are empty, fill in for testing). */
    660 extern X86DESC   BS3_DATA_NM(Bs3Ldt)[118];
     665extern X86DESC   BS3_FAR_DATA BS3_DATA_NM(Bs3Ldt)[118];
    661666/** The end of the LDT (exclusive).   */
    662 extern X86DESC   BS3_DATA_NM(Bs3LdtEnd);
     667extern X86DESC   BS3_FAR_DATA BS3_DATA_NM(Bs3LdtEnd);
    663668
    664669/** @} */
     
    668673 * @{ */
    669674/** Start of the BS3TEXT16 segment.   */
    670 extern uint8_t  BS3_DATA_NM(Bs3Text16_StartOfSegment);
     675extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Text16_StartOfSegment);
    671676/** End of the BS3TEXT16 segment.   */
    672 extern uint8_t  BS3_DATA_NM(Bs3Text16_EndOfSegment);
     677extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Text16_EndOfSegment);
    673678/** The size of the BS3TEXT16 segment.   */
    674 extern uint16_t BS3_DATA_NM(Bs3Text16_Size);
     679extern uint16_t BS3_FAR_DATA BS3_DATA_NM(Bs3Text16_Size);
    675680
    676681/** Start of the BS3SYSTEM16 segment.   */
    677 extern uint8_t  BS3_DATA_NM(Bs3System16_StartOfSegment);
     682extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3System16_StartOfSegment);
    678683/** End of the BS3SYSTEM16 segment.   */
    679 extern uint8_t  BS3_DATA_NM(Bs3System16_EndOfSegment);
     684extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3System16_EndOfSegment);
    680685
    681686/** Start of the BS3DATA16 segment.   */
    682 extern uint8_t  BS3_DATA_NM(Bs3Data16_StartOfSegment);
     687extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Data16_StartOfSegment);
    683688/** End of the BS3DATA16 segment.   */
    684 extern uint8_t  BS3_DATA_NM(Bs3Data16_EndOfSegment);
     689extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Data16_EndOfSegment);
    685690
    686691/** Start of the BS3TEXT32 segment.   */
    687 extern uint8_t  BS3_DATA_NM(Bs3Text32_StartOfSegment);
     692extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Text32_StartOfSegment);
    688693/** Start of the BS3TEXT32 segment.   */
    689 extern uint8_t  BS3_DATA_NM(Bs3Text32_EndOfSegment);
     694extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Text32_EndOfSegment);
    690695
    691696/** Start of the BS3DATA32 segment.   */
    692 extern uint8_t  BS3_DATA_NM(Bs3Data32_StartOfSegment);
     697extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Data32_StartOfSegment);
    693698/** Start of the BS3DATA32 segment.   */
    694 extern uint8_t  BS3_DATA_NM(Bs3Data32_EndOfSegment);
     699extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Data32_EndOfSegment);
    695700
    696701/** Start of the BS3TEXT64 segment.   */
    697 extern uint8_t  BS3_DATA_NM(Bs3Text64_StartOfSegment);
     702extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Text64_StartOfSegment);
    698703/** Start of the BS3TEXT64 segment.   */
    699 extern uint8_t  BS3_DATA_NM(Bs3Text64_EndOfSegment);
     704extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Text64_EndOfSegment);
    700705
    701706/** Start of the BS3DATA64 segment.   */
    702 extern uint8_t  BS3_DATA_NM(Bs3Data64_StartOfSegment);
     707extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Data64_StartOfSegment);
    703708/** Start of the BS3DATA64 segment.   */
    704 extern uint8_t  BS3_DATA_NM(Bs3Data64_EndOfSegment);
     709extern uint8_t  BS3_FAR_DATA BS3_DATA_NM(Bs3Data64_EndOfSegment);
    705710
    706711/** The size of the Data16, Text32, Text64, Data32 and Data64 blob. */
    707 extern uint32_t BS3_DATA_NM(Bs3Data16Thru64Text32And64_TotalSize);
     712extern uint32_t BS3_FAR_DATA BS3_DATA_NM(Bs3Data16Thru64Text32And64_TotalSize);
    708713/** The total image size (from Text16 thu Data64). */
    709 extern uint32_t BS3_DATA_NM(Bs3TotalImageSize);
     714extern uint32_t BS3_FAR_DATA BS3_DATA_NM(Bs3TotalImageSize);
    710715/** @} */
    711716
     
    16431648    uint16_t    gs;
    16441649    uint16_t    ss;
     1650    uint16_t    tr;
     1651    uint16_t    ldtr;
    16451652    uint8_t     cBits;
    1646     uint8_t     abPadding[3];
     1653    uint8_t     abPadding[7];
    16471654    BS3REG      cr0;
    16481655    BS3REG      cr2;
     
    16961703
    16971704/**
    1698  * Modifies the 32-bit IDT entry specified by @a iIdt.
     1705 * Initializes 16-bit (protected mode) trap handling.
     1706 *
     1707 * @remarks Does not install 16-bit trap handling, just initializes the
     1708 *          structures.
     1709 */
     1710BS3_DECL(void) Bs3Trap16Init_c16(void);
     1711BS3_DECL(void) Bs3Trap16Init_c32(void); /**< @copydoc Bs3Trap16Init_c16 */
     1712BS3_DECL(void) Bs3Trap16Init_c64(void); /**< @copydoc Bs3Trap16Init_c16 */
     1713#define Bs3Trap16Init BS3_CMN_NM(Bs3Trap16Init) /**< Selects #Bs3Trap16Init_c16, #Bs3Trap16Init_c32 or #Bs3Trap16Init_c64. */
     1714
     1715/**
     1716 * Initializes 32-bit trap handling.
     1717 *
     1718 * @remarks Does not install 32-bit trap handling, just initializes the
     1719 *          structures.
     1720 */
     1721BS3_DECL(void) Bs3Trap32Init_c16(void);
     1722BS3_DECL(void) Bs3Trap32Init_c32(void); /**< @copydoc Bs3Trap32Init_c16 */
     1723BS3_DECL(void) Bs3Trap32Init_c64(void); /**< @copydoc Bs3Trap32Init_c16 */
     1724#define Bs3Trap32Init BS3_CMN_NM(Bs3Trap32Init) /**< Selects #Bs3Trap32Init_c16, #Bs3Trap32Init_c32 or #Bs3Trap32Init_c64. */
     1725
     1726/**
     1727 * Initializes 64-bit trap handling
     1728 *
     1729 * @remarks Does not install 64-bit trap handling, just initializes the
     1730 *          structures.
     1731 */
     1732BS3_DECL(void) Bs3Trap64Init_c16(void);
     1733BS3_DECL(void) Bs3Trap64Init_c32(void); /**< @copydoc Bs3Trap64Init_c16 */
     1734BS3_DECL(void) Bs3Trap64Init_c64(void); /**< @copydoc Bs3Trap64Init_c16 */
     1735#define Bs3Trap64Init BS3_CMN_NM(Bs3Trap64Init) /**< Selects #Bs3Trap64Init_c16, #Bs3Trap64Init_c32 or #Bs3Trap64Init_c64. */
     1736
     1737/**
     1738 * Modifies the 16-bit IDT entry (protected mode) specified by @a iIdt.
    16991739 *
    17001740 * @param   iIdt        The index of the IDT entry to set.
     
    17051745 * @param   cParams     The parameter count (for call gates).
    17061746 */
     1747BS3_DECL(void) Bs3Trap16SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams);
     1748BS3_DECL(void) Bs3Trap16SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap16SetGate_c16 */
     1749BS3_DECL(void) Bs3Trap16SetGate_c64(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap16SetGate_c16 */
     1750#define Bs3Trap16SetGate BS3_CMN_NM(Bs3Trap16SetGate) /**< Selects #Bs3Trap16SetGate_c16, #Bs3Trap16SetGate_c32 or #Bs3Trap16SetGate_c64. */
     1751
     1752/** The address of Bs3Trap16GenericEntries.
     1753 * Bs3Trap16GenericEntries is an array of interrupt/trap/whatever entry
     1754 * points, 8 bytes each, that will create a register frame and call the generic
     1755 * C compatible trap handlers. */
     1756extern uint32_t BS3_DATA_NM(g_Bs3Trap16GenericEntriesFlatAddr);
     1757
     1758/**
     1759 * Modifies the 32-bit IDT entry specified by @a iIdt.
     1760 *
     1761 * @param   iIdt        The index of the IDT entry to set.
     1762 * @param   bType       The gate type (X86_SEL_TYPE_SYS_XXX).
     1763 * @param   bDpl        The DPL.
     1764 * @param   uSel        The handler selector.
     1765 * @param   off         The handler offset (if applicable).
     1766 * @param   cParams     The parameter count (for call gates).
     1767 */
    17071768BS3_DECL(void) Bs3Trap32SetGate_c16(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams);
    17081769BS3_DECL(void) Bs3Trap32SetGate_c32(uint8_t iIdt, uint8_t bType, uint8_t bDpl, uint16_t uSel, uint32_t off, uint8_t cParams); /**< @copydoc Bs3Trap32SetGate_c16 */
     
    17711832#define Bs3Trap32SetHandler BS3_CMN_NM(Bs3Trap32SetHandler) /**< Selects #Bs3Trap32SetHandler_c16, #Bs3Trap32SetHandler_c32 or #Bs3Trap32SetHandler_c64. */
    17721833
     1834/**
     1835 * Default C/C++ trap handler.
     1836 *
     1837 * This will check trap record and panic if no match was found.
     1838 *
     1839 * @param   pTrapFrame      Trap frame of the trap to handle.
     1840 */
     1841BS3_DECL(void) Bs3TrapDefaultHandler_c16(PBS3TRAPFRAME pTrapFrame);
     1842BS3_DECL(void) Bs3TrapDefaultHandler_c32(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapDefaultHandler_c16 */
     1843BS3_DECL(void) Bs3TrapDefaultHandler_c64(PBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapDefaultHandler_c16 */
     1844#define Bs3TrapDefaultHandler BS3_CMN_NM(Bs3TrapDefaultHandler) /**< Selects #Bs3TrapDefaultHandler_c16, #Bs3TrapDefaultHandler_c32 or #Bs3TrapDefaultHandler_c64. */
     1845
     1846/**
     1847 * Prints the trap frame (to screen).
     1848 * @param   pTrapFrame      Trap frame to print.
     1849 */
     1850BS3_DECL(void) Bs3TrapPrintFrame_c16(PCBS3TRAPFRAME pTrapFrame);
     1851BS3_DECL(void) Bs3TrapPrintFrame_c32(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapPrintFrame_c16 */
     1852BS3_DECL(void) Bs3TrapPrintFrame_c64(PCBS3TRAPFRAME pTrapFrame); /**< @copydoc Bs3TrapPrintFrame_c16 */
     1853#define Bs3TrapPrintFrame BS3_CMN_NM(Bs3TrapPrintFrame) /**< Selects #Bs3TrapPrintFrame_c16, #Bs3TrapPrintFrame_c32 or #Bs3TrapPrintFrame_c64. */
     1854
    17731855/** @} */
    17741856
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r59259 r59286  
    860860        .gs             resw 1
    861861        .ss             resw 1
     862        .tr             resw 1
     863        .ldtr           resw 1
    862864        .cBits          resb 1
    863         .abPadding      resb 3
     865        .abPadding      resb 7
    864866        .cr0            resq 1
    865867        .cr2            resq 1
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