VirtualBox

Changeset 60686 in vbox


Ignore:
Timestamp:
Apr 25, 2016 12:51:41 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106859
Message:

bs3kit: Enabled full gdt base address loading (and testing).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c

    r60682 r60686  
    19441944    }
    19451945
     1946    /*
     1947     * Move the table by setting up alias pages.  Aim at areas above 2GB for 32-bit and in
     1948     * the 'negative' space of 64-bit addresses.
     1949     */
     1950    if (BS3_MODE_IS_PAGED(bTestMode))
     1951    {
     1952
     1953    }
     1954
     1955
    19461956}
    19471957
     
    19601970        for (idx = 0; idx < cWorkers; idx++)
    19611971            if (    (paWorkers[idx].bMode & (bTestMode & BS3_MODE_CODE_MASK))
    1962                 && (!paWorkers[idx].fSs || bRing != 0))
     1972                && (!paWorkers[idx].fSs || bRing != 0 /** @todo || BS3_MODE_IS_64BIT_SYS(bTestMode)*/ ))
    19631973            {
    19641974                g_usBs3TestStep = iStep;
     
    22532263BS3_DECL_FAR(uint8_t) TMPL_NM(bs3CpuBasic2_sgdt)(uint8_t bMode)
    22542264{
    2255 //if (bMode == BS3_MODE_LM64)
    2256 {
     2265//if (bMode >= BS3_MODE_LM16)
     2266{
     2267    uint64_t const uOrgAddr = Bs3Lgdt_Gdt.uAddr;
     2268    uint64_t       uNew     = 0;
    22572269    union
    22582270    {
     
    22642276    g_bTestMode   = bMode;
    22652277    g_f16BitSys   = BS3_MODE_IS_16BIT_SYS(TMPL_MODE);
    2266 
    22672278    BS3_ASSERT(bMode == TMPL_MODE);
     2279
     2280    /*
     2281     * If paged mode, try push the GDT way up.
     2282     */
     2283    if (BS3_MODE_IS_PAGED(bMode))
     2284    {
     2285/** @todo loading non-canonical base addresses.   */
     2286        int rc;
     2287        uNew  = BS3_MODE_IS_64BIT_SYS(bMode) ? UINT64_C(0xffff80fedcb70000) : UINT64_C(0xc2d28000);
     2288        uNew |= uOrgAddr & X86_PAGE_OFFSET_MASK;
     2289        rc = Bs3PagingAlias(uNew, uOrgAddr, Bs3Lgdt_Gdt.cb, X86_PTE_P | X86_PTE_RW | X86_PTE_US | X86_PTE_D | X86_PTE_A);
     2290        if (RT_SUCCESS(rc))
     2291        {
     2292            Bs3Lgdt_Gdt.uAddr = uNew;
     2293            Bs3UtilSetFullGdtr(Bs3Lgdt_Gdt.cb, uNew);
     2294        }
     2295    }
    22682296
    22692297    /*
     
    22732301    ASMGetGDTR(&Expected.Gdtr);
    22742302    bs3CpuBasic2_sidt_sgdt_Common(bMode, g_aSgdtWorkers, RT_ELEMENTS(g_aSgdtWorkers), Expected.ab);
     2303
     2304    /*
     2305     * Unalias the GDT.
     2306     */
     2307    if (uNew != 0)
     2308    {
     2309        Bs3Lgdt_Gdt.uAddr = uOrgAddr;
     2310        Bs3UtilSetFullGdtr(Bs3Lgdt_Gdt.cb, uOrgAddr);
     2311        Bs3PagingUnalias(uNew, Bs3Lgdt_Gdt.cb);
     2312    }
    22752313
    22762314    /*
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r60682 r60686  
    8686       bs3-cmn-PagingInitRootForPAE.c \
    8787       bs3-cmn-PagingInitRootForLM.c \
     88       bs3-cmn-PagingAlias.c \
    8889       bs3-cmn-PagingProtect.c \
    8990       bs3-cmn-PagingSetupCanonicalTraps.c \
     
    158159        bs3-cmn-TrapSetJmpAndRestore.c \
    159160        bs3-cmn-TrapUnsetJmp.c \
     161       bs3-cmn-UtilSetFullGdtr.asm \
     162       bs3-cmn-UtilSetFullIdtr.asm \
    160163       ../../../Runtime/common/asm/ASMBitFirstClear.asm \
    161164       ../../../Runtime/common/asm/ASMBitFirstSet.asm \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c

    r60682 r60686  
    100100                {
    101101                    X86PT BS3_FAR *pPT;
    102                     uint32_t       uPte = (pPD->a[iPde].u & ~(uint32_t)(X86_PTE_PG_MASK | X86_PDE4M_PS | X86_PDE4M_G)) | X86_PTE_D;
     102                    uint32_t       uPte = (pPD->a[iPde].u & ~(uint32_t)(X86_PDE4M_PS | X86_PDE4M_G | X86_PDE4M_PG_HIGH_MASK)) \
     103                                        | X86_PTE_D;
    103104                    if (pPD->a[iPde].b.u1Global)
    104105                        uPte |= X86_PTE_G;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM32.asm

    r60557 r60686  
    134134
    135135        ;
     136        ; Load full 64-bit GDT base address from 64-bit segment.
     137        ;
     138        jmp     dword BS3_SEL_R0_CS64:.load_full_gdt_base wrt FLAT
     139.load_full_gdt_base:
     140        BS3_SET_BITS 64
     141        lgdt    [Bs3Lgdt_Gdt wrt FLAT]
     142        push    BS3_SEL_R0_CS32
     143        push    .back_to_32bit wrt FLAT
     144        o64 retf
     145.back_to_32bit:
     146        BS3_SET_BITS 32
     147
     148        ;
    136149        ; Restore ecx, eax and flags (IF).
    137150        ;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16.asm

    r60557 r60686  
    132132        ; Load the GDT and enable PP16.
    133133        ;
     134BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
    134135BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
    135136BS3_BEGIN_TEXT16
    136137        mov     ax, BS3SYSTEM16
    137138        mov     ds, ax
    138         lgdt    [Bs3Lgdt_Gdt]
     139        lgdt    [Bs3LgdtDef_Gdt]        ; Will only load 24-bit base!
    139140
    140141        mov     eax, cr0
     
    156157        ;
    157158        call    NAME(Bs3EnteredMode_pae16)
     159
     160        ;
     161        ; Load full 32-bit GDT base address from 32-bit segment.
     162        ;
     163        push    ds
     164        mov     ax, BS3_SEL_SYSTEM16
     165        mov     ds, ax
     166        jmp     dword BS3_SEL_R0_CS32:.load_full_gdt_base wrt FLAT
     167.load_full_gdt_base:
     168        BS3_SET_BITS 32
     169        lgdt    [Bs3Lgdt_Gdt wrt BS3SYSTEM16]
     170        jmp     BS3_SEL_R0_CS16:.back_to_16bit
     171.back_to_16bit:
     172        BS3_SET_BITS 16
     173        pop     ds
    158174
    159175        popfd
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE32.asm

    r60557 r60686  
    109109        ; Load the GDT and enable PE32.
    110110        ;
     111BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
    111112BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
    112113BS3_BEGIN_TEXT16
    113114        mov     ax, BS3SYSTEM16
    114115        mov     ds, ax
    115         lgdt    [Bs3Lgdt_Gdt]
     116        lgdt    [Bs3LgdtDef_Gdt]        ; Will only load 24-bit base!
    116117
    117118        mov     eax, cr0
     
    139140        extern  NAME(Bs3EnteredMode_pae32)
    140141        call    NAME(Bs3EnteredMode_pae32)
     142
     143        ; Load full 32-bit GDT base address.
     144        lgdt    [Bs3Lgdt_Gdt wrt FLAT]
    141145
    142146        ;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16.asm

    r60557 r60686  
    9494        ;
    9595BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
     96BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
    9697BS3_BEGIN_TEXT16
    9798        mov     ax, BS3SYSTEM16
    9899        mov     ds, ax
    99         lgdt    [Bs3Lgdt_Gdt]
     100        lgdt    [Bs3LgdtDef_Gdt]        ; Will only load 24-bit base!
    100101
    101102        smsw    ax
     
    116117        extern  NAME(Bs3EnteredMode_pe16)
    117118        call    NAME(Bs3EnteredMode_pe16)
     119
     120        ;
     121        ; Load full 32-bit GDT base address from 32-bit segment, if 386+ CPU.
     122        ;
     123        BS3_EXTERN_DATA16 g_uBs3CpuDetected
     124        BS3_BEGIN_TEXT16
     125        cmp     byte [g_uBs3CpuDetected], BS3CPU_80386
     126        jb      .old_cpu_skip_32bit_lgdt
     127        push    ds
     128        mov     ax, BS3_SEL_SYSTEM16
     129        mov     ds, ax
     130        jmp     dword BS3_SEL_R0_CS32:.load_full_gdt_base wrt FLAT
     131.load_full_gdt_base:
     132        BS3_SET_BITS 32
     133        lgdt    [Bs3Lgdt_Gdt wrt BS3SYSTEM16]
     134        jmp     BS3_SEL_R0_CS16:.back_to_16bit
     135.back_to_16bit:
     136        BS3_SET_BITS 16
     137        pop     ds
     138.old_cpu_skip_32bit_lgdt:
    118139
    119140        popf
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE32.asm

    r60557 r60686  
    8787        ; Load the GDT and enable PE32.
    8888        ;
     89BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
    8990BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
    9091BS3_BEGIN_TEXT16
    9192        mov     ax, BS3SYSTEM16
    9293        mov     ds, ax
    93         lgdt    [Bs3Lgdt_Gdt]
     94        lgdt    [Bs3LgdtDef_Gdt]        ; Will only load 24-bit base!
    9495
    9596        mov     eax, cr0
     
    117118        extern  NAME(Bs3EnteredMode_pe32)
    118119        call    NAME(Bs3EnteredMode_pe32)
     120
     121        ; Load full 32-bit GDT base address.
     122        lgdt    [Bs3Lgdt_Gdt wrt FLAT]
    119123
    120124        ;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16.asm

    r60557 r60686  
    148148        ; Load the GDT and enable PP16.
    149149        ;
     150BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
    150151BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
    151152BS3_BEGIN_TEXT16
    152153        mov     ax, BS3SYSTEM16
    153154        mov     ds, ax
    154         lgdt    [Bs3Lgdt_Gdt]
     155        lgdt    [Bs3LgdtDef_Gdt]        ; Will only load 24-bit base!
    155156
    156157        mov     eax, cr0
     
    172173        ;
    173174        call    NAME(Bs3EnteredMode_pp16)
     175
     176        ;
     177        ; Load full 32-bit GDT base address from 32-bit segment.
     178        ;
     179        push    ds
     180        mov     ax, BS3_SEL_SYSTEM16
     181        mov     ds, ax
     182        jmp     dword BS3_SEL_R0_CS32:.load_full_gdt_base wrt FLAT
     183.load_full_gdt_base:
     184        BS3_SET_BITS 32
     185        lgdt    [Bs3Lgdt_Gdt wrt BS3SYSTEM16]
     186        jmp     BS3_SEL_R0_CS16:.back_to_16bit
     187.back_to_16bit:
     188        BS3_SET_BITS 16
     189        pop     ds
    174190
    175191        popfd
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP32.asm

    r60557 r60686  
    117117        ; Load the GDT and enable PE32.
    118118        ;
     119BS3_EXTERN_SYSTEM16 Bs3LgdtDef_Gdt
    119120BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
    120121BS3_BEGIN_TEXT16
    121122        mov     ax, BS3SYSTEM16
    122123        mov     ds, ax
    123         lgdt    [Bs3Lgdt_Gdt]
     124        lgdt    [Bs3LgdtDef_Gdt]        ; Will only load 24-bit base!
    124125
    125126        mov     eax, cr0
     
    129130BS3_BEGIN_TEXT32
    130131.thirty_two_bit:
    131 
    132132        ;
    133133        ; Convert the (now) real mode stack pointer to 32-bit flat.
     
    147147        extern  NAME(Bs3EnteredMode_pp32)
    148148        call    NAME(Bs3EnteredMode_pp32)
     149
     150        ; Load full 32-bit GDT base address.
     151        lgdt    [Bs3Lgdt_Gdt wrt FLAT]
    149152
    150153        ;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c

    r60578 r60686  
    175175
    176176
     177/** The last RAM address below 4GB (approximately). */
     178uint32_t                g_uBs3EndOfRamBelow4G = 0;
     179
     180
     181
    177182/**
    178183 * Adds a range of memory to the tiled slabs.
     
    181186 * @param   cbRange     Size of range.
    182187 */
    183 static void bs3InitMemoryAddRange(uint32_t uRange, uint32_t cbRange)
    184 {
    185     if (uRange < BS3_SEL_TILED_AREA_SIZE)
     188static void bs3InitMemoryAddRange32(uint32_t uRange, uint32_t cbRange)
     189{
     190    uint32_t uRangeEnd = uRange + cbRange;
     191    if (uRangeEnd < uRange)
     192        uRangeEnd = UINT32_MAX;
     193
     194    /* Raise the end-of-ram-below-4GB marker? */
     195    if (uRangeEnd > g_uBs3EndOfRamBelow4G)
     196        g_uBs3EndOfRamBelow4G = uRangeEnd;
     197
     198    /* Applicable to tiled memory? */
     199    if (   uRange < BS3_SEL_TILED_AREA_SIZE
     200        && (   uRange >= _1M
     201            || uRangeEnd >= _1M))
    186202    {
    187         uint32_t uRangeEnd = uRange + cbRange;
    188         if (   uRange >= _1M
    189             || uRangeEnd > _1M)
    190         {
    191             uint16_t cPages;
    192 
    193             /* Adjust the start of the range such that it's at or above 1MB and page aligned.  */
    194             if (uRange < _1M)
     203        uint16_t cPages;
     204
     205        /* Adjust the start of the range such that it's at or above 1MB and page aligned.  */
     206        if (uRange < _1M)
     207        {
     208            cbRange -= _1M - uRange;
     209            uRange   = _1M;
     210        }
     211        else if (uRange & (_4K - 1U))
     212        {
     213            cbRange -= uRange & (_4K - 1U);
     214            uRange   = RT_ALIGN_32(uRange, _4K);
     215        }
     216
     217        /* Adjust the end/size of the range such that it's page aligned and not beyond the tiled area. */
     218        if (uRangeEnd > BS3_SEL_TILED_AREA_SIZE)
     219        {
     220            cbRange  -= uRangeEnd - BS3_SEL_TILED_AREA_SIZE;
     221            uRangeEnd = BS3_SEL_TILED_AREA_SIZE;
     222        }
     223        else if (uRangeEnd & (_4K - 1U))
     224        {
     225            cbRange   -= uRangeEnd & (_4K - 1U);
     226            uRangeEnd &= ~(uint32_t)(_4K - 1U);
     227        }
     228
     229        /* If there is still something, enable it.
     230           (We're a bit paranoid here don't trust the BIOS to only report a page once.)  */
     231        cPages = cbRange >> 12; /*div 4K*/
     232        if (cPages)
     233        {
     234            unsigned i;
     235            uRange -= _1M;
     236            i = uRange >> 12; /*div _4K*/
     237            while (cPages-- > 0)
    195238            {
    196                 cbRange -= _1M - uRange;
    197                 uRange   = _1M;
    198             }
    199             else if (uRange & (_4K - 1U))
    200             {
    201                 cbRange -= uRange & (_4K - 1U);
    202                 uRange   = RT_ALIGN_32(uRange, _4K);
    203             }
    204 
    205             /* Adjust the end/size of the range such that it's page aligned and not beyond the tiled area. */
    206             if (uRangeEnd > BS3_SEL_TILED_AREA_SIZE)
    207             {
    208                 cbRange  -= uRangeEnd - BS3_SEL_TILED_AREA_SIZE;
    209                 uRangeEnd = BS3_SEL_TILED_AREA_SIZE;
    210             }
    211             else if (uRangeEnd & (_4K - 1U))
    212             {
    213                 cbRange   -= uRangeEnd & (_4K - 1U);
    214                 uRangeEnd &= ~(uint32_t)(_4K - 1U);
    215             }
    216 
    217             /* If there is still something, enable it.
    218                (We're a bit paranoid here don't trust the BIOS to only report a page once.)  */
    219             cPages = cbRange >> 12; /*div 4K*/
    220             if (cPages)
    221             {
    222                 unsigned i;
    223                 uRange -= _1M;
    224                 i = uRange >> 12; /*div _4K*/
    225                 while (cPages-- > 0)
    226                 {
    227                     uint16_t uLineToLong = ASMBitTestAndClear(g_Bs3Mem4KUpperTiled.Core.bmAllocated, i);
    228                     g_Bs3Mem4KUpperTiled.Core.cFreeChunks += uLineToLong;
    229                     i++;
    230                 }
     239                uint16_t uLineToLong = ASMBitTestAndClear(g_Bs3Mem4KUpperTiled.Core.bmAllocated, i);
     240                g_Bs3Mem4KUpperTiled.Core.cFreeChunks += uLineToLong;
     241                i++;
    231242            }
    232243        }
     
    308319        while (   (uCont = Bs3BiosInt15hE820(&Entry, sizeof(Entry), uCont)) != 0
    309320               && i++ < 2048)
    310         {
    311             if (   Entry.uType == INT15E820_TYPE_USABLE
    312                 && Entry.uBaseAddr < BS3_SEL_TILED_AREA_SIZE)
    313             {
    314                 /* Entry concerning tiled memory. Convert from 64-bit to 32-bit
    315                    values and check whether it's concerning anything at or above 1MB  */
    316                 uint32_t uRange    = (uint32_t)Entry.uBaseAddr;
    317                 uint32_t cbRange   = Entry.cbRange >= BS3_SEL_TILED_AREA_SIZE
    318                                    ? BS3_SEL_TILED_AREA_SIZE : (uint32_t)Entry.cbRange;
    319                 AssertCompile(BS3_SEL_TILED_AREA_SIZE <= _512M /* the range of 16-bit cPages. */ );
    320                 bs3InitMemoryAddRange(uRange, cbRange);
    321             }
    322         }
     321            if (Entry.uType == INT15E820_TYPE_USABLE)
     322                if (!(Entry.uBaseAddr >> 32))
     323                    /* Convert from 64-bit to 32-bit value and record it. */
     324                    bs3InitMemoryAddRange32((uint32_t)Entry.uBaseAddr,
     325                                            (Entry.cbRange >> 32) ? UINT32_C(0xfffff000) : (uint32_t)Entry.cbRange);
    323326    }
    324327    /* Try the 286+ API for getting memory above 1MB and (usually) below 16MB. */
     
    326329             && (u32 = Bs3BiosInt15h88()) != UINT32_MAX
    327330             && u32 > 0)
    328         bs3InitMemoryAddRange(_1M, u32 * _1K);
     331        bs3InitMemoryAddRange32(_1M, u32 * _1K);
    329332
    330333    /*
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-system-data.asm

    r60595 r60686  
    10051005
    10061006;;
    1007 ; LGDT structure for the GDT (8-byte aligned on offset).
     1007; LGDT structure for the current GDT (8-byte aligned on offset).
    10081008BS3_GLOBAL_DATA Bs3Lgdt_Gdt, 2+8
    10091009        dw      BS3_DATA_NM(Bs3GdtEnd) - BS3_DATA_NM(Bs3Gdt) - 1 ; limit
     
    10121012        dd      0                                                ; top32 offset
    10131013
     1014;;
     1015; LGDT structure for the default GDT (8-byte aligned on offset).
     1016; This must not be modified, whereas Bs3Lgdt_Gdt can be modified by the user.
     1017BS3_GLOBAL_DATA Bs3LgdtDef_Gdt, 2+8
     1018        dw      BS3_DATA_NM(Bs3GdtEnd) - BS3_DATA_NM(Bs3Gdt) - 1 ; limit
     1019        dw      BS3_SYSTEM16_BASE_LOW(Bs3Gdt)                    ; low offset
     1020        dw      (BS3_ADDR_BS3SYSTEM16 >> 16)                     ; high offset
     1021        dd      0                                                ; top32 offset
     1022
    10141023
    10151024
     
    10181027; LDT filling up the rest of the segment.
    10191028;
    1020 ; Currently this starts at 0x84d0, which leaves us with 0xb30 bytes.  We'll use
     1029; Currently this starts at 0x84e0, which leaves us with 0xb20 bytes.  We'll use
    10211030; the last 32 of those for an eye catcher.
    10221031;
    1023 BS3_GLOBAL_DATA Bs3Ldt, 0b30h - 32
    1024         times (0b30h - 32) db 0
     1032BS3_GLOBAL_DATA Bs3Ldt, 0b20h - 32
     1033        times (0b20h - 32) db 0
    10251034BS3_GLOBAL_DATA Bs3LdtEnd, 0
    10261035        db  10, 13, 'eye-catcher: SYSTEM16 END', 10, 13, 0, 0, 0 ; 32 bytes long
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk

    r60682 r60686  
    3636$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestCheckRegCtxEx)
    3737$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3StrCpy)
     38$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingAlias)
    3839$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingInitRootForLM)
    3940$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingInitRootForPAE)
     
    4142$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingProtect)
    4243$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingProtectPtr)
     44$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingUnalias)
    4345$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SwitchFromV86To16BitAndCallC)
    4446$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetHandler)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h

    r60682 r60686  
    4747#define Bs3MemSet BS3_CMN_MANGLER(Bs3MemSet)
    4848#define Bs3MemZero BS3_CMN_MANGLER(Bs3MemZero)
     49#define Bs3PagingAlias BS3_CMN_MANGLER(Bs3PagingAlias)
    4950#define bs3PagingGetLegacyPte BS3_CMN_MANGLER(bs3PagingGetLegacyPte)
    5051#define bs3PagingGetPte BS3_CMN_MANGLER(bs3PagingGetPte)
     
    5556#define Bs3PagingProtectPtr BS3_CMN_MANGLER(Bs3PagingProtectPtr)
    5657#define Bs3PagingSetupCanonicalTraps BS3_CMN_MANGLER(Bs3PagingSetupCanonicalTraps)
     58#define Bs3PagingUnalias BS3_CMN_MANGLER(Bs3PagingUnalias)
    5759#define Bs3Panic BS3_CMN_MANGLER(Bs3Panic)
    5860#define Bs3PicMaskAll BS3_CMN_MANGLER(Bs3PicMaskAll)
     
    138140#define Bs3UInt32Div BS3_CMN_MANGLER(Bs3UInt32Div)
    139141#define Bs3UInt64Div BS3_CMN_MANGLER(Bs3UInt64Div)
     142#define Bs3UtilSetFullGdtr BS3_CMN_MANGLER(Bs3UtilSetFullGdtr)
     143#define Bs3UtilSetFullIdtr BS3_CMN_MANGLER(Bs3UtilSetFullIdtr)
    140144#ifndef BS3_CMN_ONLY
    141145# define Bs3CpuDetect BS3_MODE_MANGLER(Bs3CpuDetect)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h

    r60682 r60686  
    4747#undef Bs3MemSet
    4848#undef Bs3MemZero
     49#undef Bs3PagingAlias
    4950#undef bs3PagingGetLegacyPte
    5051#undef bs3PagingGetPte
     
    5556#undef Bs3PagingProtectPtr
    5657#undef Bs3PagingSetupCanonicalTraps
     58#undef Bs3PagingUnalias
    5759#undef Bs3Panic
    5860#undef Bs3PicMaskAll
     
    138140#undef Bs3UInt32Div
    139141#undef Bs3UInt64Div
     142#undef Bs3UtilSetFullGdtr
     143#undef Bs3UtilSetFullIdtr
    140144#ifndef BS3_CMN_ONLY
    141145# undef Bs3CpuDetect
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r60682 r60686  
    196196/** Whether the mode has paging enabled. */
    197197#define BS3_MODE_IS_PAGED(a_fMode)              ((a_fMode) >= BS3_MODE_PP16)
     198/** Whether the mode has legacy paging enabled (legacy as opposed to PAE or
     199 * long mode). */
     200#define BS3_MODE_IS_LEGACY_PAGING(a_fMode)      ((a_fMode) >= BS3_MODE_PP16 && (a_fMode) < BS3_MODE_PAE16)
    198201
    199202/** Whether the mode is running v8086 code. */
     
    9981001 *  vector table.. */
    9991002extern X86XDTR64 BS3_FAR_DATA Bs3Lidt_Ivt;
    1000 /** Structure for the LGDT instruction for loading the GDT. */
     1003/** Structure for the LGDT instruction for loading the current GDT. */
    10011004extern X86XDTR64 BS3_FAR_DATA Bs3Lgdt_Gdt;
     1005/** Structure for the LGDT instruction for loading the default GDT. */
     1006extern X86XDTR64 BS3_FAR_DATA Bs3LgdtDef_Gdt;
    10021007/** The LDT (all entries are empty, fill in for testing). */
    1003 extern X86DESC   BS3_FAR_DATA Bs3Ldt[118];
     1008extern X86DESC   BS3_FAR_DATA Bs3Ldt[116];
    10041009/** The end of the LDT (exclusive).   */
    10051010extern X86DESC   BS3_FAR_DATA Bs3LdtEnd;
     
    20432048BS3_CMN_PROTO_STUB(void, Bs3MemGuardedTestPageFree,(void BS3_FAR *pvGuardedPage));
    20442049
     2050/** Highes RAM byte below 4G. */
     2051extern uint32_t  g_uBs3EndOfRamBelow4G;
     2052
    20452053
    20462054/**
     
    21362144 */
    21372145BS3_CMN_PROTO_STUB(int, Bs3PagingProtectPtr,(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear));
     2146
     2147/**
     2148 * Aliases (maps) one or more contiguous physical pages to a virtual range.
     2149 *
     2150 * @returns VBox status code.
     2151 * @retval  VERR_INVALID_PARAMETER if we're in legacy paging mode and @a uDst or
     2152 *          @a uPhysToAlias are not compatible with legacy paging.
     2153 * @retval  VERR_OUT_OF_RANGE if we cannot traverse the page tables in this mode
     2154 *          (typically real mode or v86, maybe 16-bit PE).
     2155 * @retval  VERR_NO_MEMORY if we cannot allocate page tables for splitting up
     2156 *          the necessary large pages.  No aliasing was performed.
     2157 *
     2158 * @param   uDst                The virtual address to map it at. Rounded down
     2159 *                              to the nearest page (@a cbHowMuch is adjusted
     2160 *                              up).
     2161 * @param   uPhysToAlias        The physical address of the first page in the
     2162 *                              (contiguous) range to map.  Chopped down to
     2163 *                              nearest page boundrary (@a cbHowMuch is not
     2164 *                              adjusted).
     2165 * @param   cbHowMuch           How much to map. Rounded up to nearest page.
     2166 * @param   fPte                The PTE flags.
     2167 */
     2168BS3_CMN_PROTO_STUB(int, Bs3PagingAlias,(uint64_t uDst, uint64_t uPhysToAlias, uint32_t cbHowMuch, uint64_t fPte));
     2169
     2170/**
     2171 * Unaliases memory, i.e. restores the 1:1 mapping.
     2172 *
     2173 * @returns VBox status code.  Cannot fail if @a uDst and @a cbHowMuch specify
     2174 *          the range of a successful Bs3PagingAlias call, however it may run
     2175 *          out of memory if it's breaking new ground.
     2176 *
     2177 * @param   uDst                The virtual address to restore to 1:1 mapping.
     2178 *                              Rounded down to the nearest page (@a cbHowMuch
     2179 *                              is adjusted up).
     2180 * @param   cbHowMuch           How much to restore. Rounded up to nearest page.
     2181 */
     2182BS3_CMN_PROTO_STUB(int, Bs3PagingUnalias,(uint64_t uDst, uint32_t cbHowMuch));
     2183
    21382184
    21392185/** The physical / flat address of the buffer backing the canonical traps.
     
    28992945    FNBS3TESTDOMODE   RT_CONCAT(a_BaseNm, _lm64)
    29002946
     2947
     2948/**
     2949 * Sets the full GDTR register.
     2950 *
     2951 * @param   cbLimit     The limit.
     2952 * @param   uBase       The base address - 24, 32 or 64 bit depending on the
     2953 *                      CPU mode.
     2954 */
     2955BS3_CMN_PROTO_NOSB(void, Bs3UtilSetFullGdtr,(uint16_t cbLimit, uint64_t uBase));
     2956
     2957/**
     2958 * Sets the full IDTR register.
     2959 *
     2960 * @param   cbLimit     The limit.
     2961 * @param   uBase       The base address - 24, 32 or 64 bit depending on the
     2962 *                      CPU mode.
     2963 */
     2964BS3_CMN_PROTO_NOSB(void, Bs3UtilSetFullIdtr,(uint16_t cbLimit, uint64_t uBase));
     2965
     2966
    29012967/** @} */
    29022968
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