Changeset 60319 in vbox for trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Timestamp:
- Apr 4, 2016 10:02:21 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-bootsector.asm
r59975 r60319 104 104 105 105 ; save the registers. 106 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rax], eax 107 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rsp], esp 108 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rbp], ebp 109 mov ax, ss 110 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.ss], ax 111 mov ax, ds 112 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.ds], ax 113 mov ax, es 114 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.es], ax 115 mov ax, fs 116 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.fs], ax 117 mov ax, gs 106 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rax], ax 107 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rsp], sp 108 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rbp], bp 109 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.ss], ss 110 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.ds], ds 111 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.es], es 118 112 119 113 ; set up the segment reisters and stack. 120 xor eax, eax114 mov ax, 0 121 115 mov ds, ax 122 116 mov es, ax 123 mov fs, ax124 mov gs, ax125 117 mov ss, ax 126 mov esp, BS3_ADDR_STACK 127 mov ebp, esp 128 mov [ebp], eax ; clear the first 16 bytes (terminates the ebp chain) 129 mov [ebp + 04h], eax 130 mov [ebp + 08h], eax 131 mov [ebp + 0ch], eax 132 133 ; Save more registers now that ds is known and the stack is usable. 134 pushfd 135 pop eax 136 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rflags], eax 118 mov sp, BS3_ADDR_STACK 119 mov bp, sp 120 mov [bp], ax ; clear the first 8 bytes (terminates the ebp chain) 121 mov [bp + 02h], ax 122 mov [bp + 04h], ax 123 mov [bp + 06h], ax 124 125 ; Save flags now that we know that there's a valid stack. 126 pushf 127 128 ; 129 ; Clear the register area. 130 ; 131 push cx 132 push di 133 mov di, BS3_ADDR_REG_SAVE 134 mov cx, BS3REGCTX_size/2 135 cld 136 rep stosw 137 pop di 138 pop cx 139 140 ; 141 ; Do basic CPU detection. 142 ; 143 144 ; 1. bit 15-bit was fixed to 1 in pre-286 CPUs, and fixed to 0 in 286+. 145 mov ax, [bp - 2] 146 test ah, 080h ; always set on pre 286, clear on 286 and later 147 jnz .pre_80286 148 149 ; 2. On a 286 you cannot popf IOPL and NT from real mode. 150 or ah, (X86_EFL_IOPL | X86_EFL_NT) >> 8 151 push ax 152 popf 153 pushf 154 pop ax 155 test ah, (X86_EFL_IOPL | X86_EFL_NT) >> 8 156 jz .is_80286 157 ; 386 or later. 158 159 160 ; Save 386 registers. We can now skip the CS prefix as DS is flat. 161 shr eax, 16 162 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rax+2], ax 163 mov eax, esp 164 shr eax, 16 165 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rsp+2], ax 166 mov eax, ebp 167 shr eax, 16 168 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rbp+2], ax 169 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.fs], fs 170 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.gs], gs 137 171 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rbx], ebx 138 172 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rcx], ecx … … 144 178 mov eax, cr3 145 179 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.cr3], eax 180 mov byte [BS3_ADDR_REG_SAVE + BS3REGCTX.bMode], BS3_MODE_RM 181 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.cs], cs 182 xor eax, eax 183 mov ax, start 184 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rip], eax 185 186 ; Pentium/486+: CR4 requires VME/CPUID, so we need to detect that before accessing it. 187 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.cr4], eax 188 popf 189 pushfd 190 pop eax 191 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rflags], eax 192 xor eax, X86_EFL_ID 193 push eax 194 popfd 195 pushfd 196 pop ebx 197 cmp ebx, eax 198 jne .no_cr4 146 199 mov eax, cr4 147 200 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.cr4], eax 148 mov byte [BS3_ADDR_REG_SAVE + BS3REGCTX.bMode], BS3_MODE_RM 149 xor eax, eax 150 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.cs], ax 151 mov ax, start 152 mov [cs:BS3_ADDR_REG_SAVE + BS3REGCTX.rip], eax 153 201 .no_cr4: 154 202 ; Make sure caching is enabled and alignment is off. 155 203 mov eax, cr0 … … 157 205 and eax, ~(X86_CR0_NW | X86_CR0_CD | X86_CR0_AM) 158 206 mov cr0, eax 207 jmp .do_load 208 209 .is_80286: 210 smsw [BS3_ADDR_REG_SAVE + BS3REGCTX.cr0] 211 .pre_80286: 212 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rbx], bx 213 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rcx], cx 214 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rdx], dx 215 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rsi], si 216 mov [BS3_ADDR_REG_SAVE + BS3REGCTX.rdi], di 159 217 160 218 ; Load all the code. 219 .do_load 161 220 mov [g_bBootDrv], dl 162 221 call bs3InitLoadImage … … 165 224 ; Call the user 'main' procedure (shouldn't return). 166 225 ; 226 cld 167 227 call BS3_SEL_TEXT16:0000h 168 228 … … 170 230 Bs3Panic: 171 231 cli 172 hlt232 ;hlt 173 233 jmp Bs3Panic 174 175 234 176 235 … … 212 271 ; Reload all the sectors one at a time (avoids problems). 213 272 ; 214 mov esi, [g_cLargeTotalSectors]215 dec esi273 mov si, [g_cLargeTotalSectors] ; 16-bit sector count ==> max 512 * 65 535 = 33 553 920 bytes. 274 dec si 216 275 mov di, BS3_ADDR_LOAD / 16 ; The current load segment. 217 276 mov cx, 0002h ; ch/cylinder=0 (0-based); cl/sector=2 (1-based) … … 256 315 ; print message 257 316 mov si, .s_szErrMsg 258 mov ah, 0eh259 xor bx, bx260 317 .failure_next_char: 261 318 lodsb 319 mov ah, 0eh 320 mov bx, 0ff00h 262 321 int 10h 263 322 cmp si, .s_szErrMsgEnd 264 323 jb .failure_next_char 265 266 ; format the error number.267 movzx bx, byte [bp - 2 - 1] ; read the ah of the pusha frame268 shr bl, 4269 mov al, [bx + .s_achHex]270 int 10h271 272 movzx bx, byte [bp - 2 - 1] ; read the ah of the pusha frame273 and bl, 0fh274 mov al, [bx + .s_achHex]275 int 10h276 324 277 325 ; panic … … 279 327 call Bs3Panic 280 328 .s_szErrMsg: 281 db 13, 10, 'read error :'329 db 13, 10, 'read error!' 282 330 .s_szErrMsgEnd: 283 .s_achHex: 284 db '0123456789abcdef' 285 ENDPROC bs3InitLoadImage 331 ;ENDPROC bs3InitLoadImage - don't want the padding. 286 332 287 333 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-Trap16Generic.asm
r60218 r60319 40 40 BS3_EXTERN_DATA16 g_bBs3CurrentMode 41 41 BS3_EXTERN_DATA16 g_uBs3TrapEipHint 42 BS3_EXTERN_DATA16 g_uBs3CpuDetected 42 43 BS3_EXTERN_SYSTEM16 Bs3Gdt 43 44 TMPL_BEGIN_TEXT … … 433 434 mov eax, cr3 434 435 mov [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3], eax 436 437 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) ; CR4 first appeared in later 486es. 438 jz .skip_cr4_because_not_there 435 439 mov eax, cr4 436 440 mov [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], eax 437 441 jmp .set_flags 442 443 .skip_cr4_because_not_there: 444 mov byte [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 445 jmp .set_flags 446 438 447 .skip_crX_because_cpl_not_0: 439 448 or byte [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR 440 449 jmp .set_flags 450 441 451 CPU 286 442 452 .save_286_control_registers: … … 584 594 mov ecx, cr3 585 595 mov [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3], ecx 596 597 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) ; CR4 first appeared in later 486es. 598 jz .skip_cr4_because_not_there 586 599 mov ecx, cr4 587 600 mov [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], ecx 601 jmp .common 602 603 .skip_cr4_because_not_there: 604 mov byte [ss:bx + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 588 605 589 606 ; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c32-Trap32Generic.asm
r60216 r60319 39 39 ;********************************************************************************************************************************* 40 40 BS3_EXTERN_DATA16 g_bBs3CurrentMode 41 BS3_EXTERN_DATA16 g_uBs3CpuDetected 41 42 BS3_EXTERN_SYSTEM16 Bs3Gdt 42 43 TMPL_BEGIN_TEXT … … 350 351 jnz .skip_crX_because_cpl_not_0 351 352 353 mov eax, cr3 354 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3], eax 355 .save_cr0_cr2_cr4: ; The double fault code joins us here. 352 356 mov eax, cr0 353 357 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0], eax 354 358 mov eax, cr2 355 359 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr2], eax 356 mov eax, cr3 357 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr3], eax 360 361 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) ; CR4 first appeared in later 486es. 362 jz .skip_cr4_because_not_there 358 363 mov eax, cr4 359 364 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], eax 360 365 jmp .set_flags 366 367 .skip_cr4_because_not_there: 368 mov byte [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 369 jmp .set_flags 370 361 371 .skip_crX_because_cpl_not_0: 362 372 or byte [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR 363 373 364 .set_flags: ; The double fault code joins us here.374 .set_flags: 365 375 or byte [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64 366 376 … … 522 532 523 533 ; 524 ; Control registers.525 ;526 mov ecx, cr0527 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0], ecx528 mov ecx, cr2529 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr2], ecx530 mov ecx, cr4531 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], ecx532 533 ;534 534 ; Join code paths with the generic handler code. 535 535 ; 536 jmp bs3Trap32GenericCommon.s et_flags536 jmp bs3Trap32GenericCommon.save_cr0_cr2_cr4 537 537 BS3_PROC_END Bs3Trap32DoubleFaultHandler 538 538 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c
r60311 r60319 30 30 #include "bs3kit-template-header.h" 31 31 #include "bs3-cmn-paging.h" 32 #include "bs3-cmn-memory.h" /* bad bird */ 33 #include <iprt/param.h> 34 35 36 /** 37 * Creates page tables for a section of the page directory. 38 * 39 * @returns VINF_SUCCESS or VERR_NO_MEMORY. 40 * @param pPgDir The page directory. 41 * @param iFirst The first PD entry. 42 * @param cEntries How many PD entries to create pages tables for. 43 */ 44 static int Bs3PagingInitPageTablesForPgDir(X86PD BS3_FAR *pPgDir, unsigned iFirst, unsigned cEntries) 45 { 46 uint32_t uCurPhys = (uint32_t)iFirst << X86_PD_SHIFT; 47 while (cEntries--) 48 { 49 X86PT BS3_FAR *pPt = (X86PT BS3_FAR *)Bs3MemAlloc(BS3MEMKIND_TILED, _4K); 50 if (pPt) 51 { 52 unsigned j = 0; 53 for (j = 0; j < RT_ELEMENTS(pPt->a); j++, uCurPhys += PAGE_SIZE) 54 { 55 pPt->a[j].u = uCurPhys; 56 pPt->a[j].u |= X86_PTE_P | X86_PTE_RW | X86_PTE_US | X86_PTE_A | X86_PTE_D; 57 } 58 pPgDir->a[iFirst].u = Bs3SelPtrToFlat(pPt); 59 pPgDir->a[iFirst].u |= X86_PDE_P | X86_PDE_RW | X86_PDE_US | X86_PDE_A; 60 iFirst++; 61 } 62 else 63 return VERR_NO_MEMORY; 64 } 65 return VINF_SUCCESS; 66 } 32 67 33 68 … … 46 81 * ASSUMES page size extension available, i.e. pentium+. 47 82 */ 48 pPgDir = (X86PD BS3_FAR *)Bs3MemAlloc (BS3MEMKIND_TILED, _4K);83 pPgDir = (X86PD BS3_FAR *)Bs3MemAllocZ(BS3MEMKIND_TILED, _4K); 49 84 if (pPgDir) 50 85 { 51 86 BS3_XPTR_AUTO(X86PD, XptrPgDir); 52 87 unsigned i; 88 int rc = VINF_SUCCESS; 53 89 54 if (g_uBs3CpuDetected )90 if (g_uBs3CpuDetected & BS3CPU_F_PSE) 55 91 { 92 for (i = 0; i < RT_ELEMENTS(pPgDir->a); i++) 93 { 94 pPgDir->a[i].u = (uint32_t)i << X86_PD_SHIFT; 95 pPgDir->a[i].u |= X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PS | X86_PDE4M_A | X86_PDE4M_D; 96 } 56 97 } 57 for (i = 0; i < RT_ELEMENTS(pPgDir->a); i++)98 else 58 99 { 59 pPgDir->a[i].u = (uint32_t)i << X86_PD_SHIFT; 60 pPgDir->a[i].u |= X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_PS | X86_PDE4M_A | X86_PDE4M_D; 100 /* 101 * This requires 4MB of page tables if we map everything. 102 * So, we check how much memory we have available and make sure we 103 * don't use all of it for page tables. 104 */ 105 unsigned cMax = RT_ELEMENTS(pPgDir->a); 106 uint32_t cFreePages = g_Bs3Mem4KUpperTiled.Core.cFreeChunks + g_Bs3Mem4KLow.Core.cFreeChunks; 107 if (cFreePages >= cMax + 128) 108 Bs3PagingInitPageTablesForPgDir(pPgDir, 0, cMax); 109 else 110 { 111 unsigned cTop; 112 if (cMax >= 256 /*1MB*/) 113 { 114 cMax = cFreePages - 128; 115 cTop = 32; 116 } 117 else if (cMax >= 128) 118 { 119 cMax = cFreePages - 48; 120 cTop = 16; 121 } 122 else 123 { 124 cMax = cFreePages - 16; 125 cTop = RT_MIN(16, cMax / 4); 126 } 127 Bs3Printf("Bs3PagingInitRootForPP: Warning! insufficient memory for mapping all 4GB!\n" 128 " Will only map 0x00000000-%#010RX32 and %#010RX32-0xffffffff.\n", 129 (uint32_t)(cMax - cTop) << PAGE_SHIFT, UINT32_MAX - ((uint32_t)cTop << PAGE_SHIFT) + 1); 130 rc = Bs3PagingInitPageTablesForPgDir(pPgDir, 0, cMax - cTop); 131 if (RT_SUCCESS(rc)) 132 rc = Bs3PagingInitPageTablesForPgDir(pPgDir, RT_ELEMENTS(pPgDir->a) - cTop, cTop); 133 } 61 134 } 62 135 63 136 BS3_XPTR_SET(X86PD, XptrPgDir, pPgDir); 64 137 g_PhysPagingRootPP = BS3_XPTR_GET_FLAT(X86PD, XptrPgDir); 65 return VINF_SUCCESS;138 return rc; 66 139 } 67 140 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm
r60291 r60319 30 30 BS3_EXTERN_SYSTEM16 Bs3Gdt 31 31 BS3_EXTERN_DATA16 g_bBs3CurrentMode 32 %if TMPL_BITS == 1632 %if TMPL_BITS != 64 33 33 BS3_EXTERN_DATA16 g_uBs3CpuDetected 34 34 %endif … … 213 213 jnz .skip_control_regs 214 214 215 test byte [xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 ; (old 486s and 386s didn't have CR4) 216 jnz .skip_cr4 217 %if TMPL_BITS != 64 218 test word [BS3_ONLY_16BIT(es:) BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_F_CPUID 219 jz .skip_cr4 220 %endif 215 221 mov sAX, [xBX + BS3REGCTX.cr4] 216 222 mov sDX, cr4 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSave.asm
r60218 r60319 30 30 BS3_EXTERN_SYSTEM16 Bs3Gdt 31 31 BS3_EXTERN_DATA16 g_bBs3CurrentMode 32 %if TMPL_BITS == 1632 %if TMPL_BITS != 64 33 33 BS3_EXTERN_DATA16 g_uBs3CpuDetected 34 34 %endif … … 121 121 ; 80386 or later. 122 122 ; 123 %if TMPL_BITS != 64 124 ; Check for CR4 here while we've got a working DS in all contexts. 125 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) 126 jnz .save_full_have_cr4 127 or byte [BS3_ONLY_16BIT(es:) xDI + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 128 .save_full_have_cr4: 129 %endif 123 130 %if TMPL_BITS == 16 124 131 ; Load es into ds so we can save ourselves some segment prefix bytes. … … 176 183 mov sAX, cr3 177 184 mov [xDI + BS3REGCTX.cr3], sAX 185 %if TMPL_BITS != 64 186 test byte [xDI + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 187 jnz .common_80286 188 %endif 178 189 mov sAX, cr4 179 190 mov [xDI + BS3REGCTX.cr4], sAX -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-CpuDetect.asm
r60311 r60319 46 46 push xBP 47 47 mov xBP, xSP 48 pushf49 48 push xCX 50 49 push xDX 51 50 push xBX 51 pushf 52 52 53 53 %ifndef TMPL_CMN_PAGING … … 139 139 ; 140 140 cli ; Disable interrupts to be on the safe side. 141 mov xAX, [xBP - xCB]142 or xAX, X86_EFL_IOPL | X86_EFL_NT143 push xAX; Load modified flags.141 mov ax, [xBP - xCB] 142 or ax, X86_EFL_IOPL | X86_EFL_NT 143 push ax ; Load modified flags. 144 144 popf 145 145 pushf ; Get actual flags. 146 pop xAX146 pop ax 147 147 test ax, X86_EFL_IOPL | X86_EFL_NT 148 148 jnz .386plus ; If any of the flags are set, we're on 386+. … … 151 151 ; by a flaky POPF implementation, we assume this isn't the case in our 152 152 ; execution environment. 153 mov xAX, BS3CPU_80286153 mov ax, BS3CPU_80286 154 154 jmp .return 155 155 %endif … … 216 216 mov ah, al 217 217 AssertCompile(X86_CPUID_FEATURE_EDX_PAE_BIT > BS3CPU_F_PAE_BIT - 8) ; 6 vs 10-8=2 218 and al, X86_CPUID_FEATURE_EDX_PAE 218 219 shr al, X86_CPUID_FEATURE_EDX_PAE_BIT - (BS3CPU_F_PAE_BIT - 8) 219 220 AssertCompile(X86_CPUID_FEATURE_EDX_PSE_BIT == BS3CPU_F_PSE_BIT - 8) ; 3 vs 11-8=3 221 and ah, X86_CPUID_FEATURE_EDX_PSE 220 222 or ah, al 223 or ah, (BS3CPU_F_CPUID >> 8) 221 224 222 225 ; Add the CPU type based on the family and model values. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16.asm
r60291 r60319 123 123 124 124 ; 125 ; Make sure PAE is really off and that PSE is enabled. 126 ; ASSUMES PSE supported (pentium+). 125 ; Make sure PAE is really off and that PSE is enabled when supported. 127 126 ; 127 BS3_EXTERN_DATA16 g_uBs3CpuDetected 128 BS3_BEGIN_TEXT16 129 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) 130 jz .cr4_is_fine 128 131 mov eax, cr4 129 132 mov ecx, eax 130 and eax, ~X86_CR4_PAE 133 and eax, ~(X86_CR4_PAE | X86_CR4_PSE) 134 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_PSE >> 8) 135 jz .no_pse 131 136 or eax, X86_CR4_PSE 137 .no_pse: 132 138 cmp eax, ecx 133 139 je .cr4_is_fine -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP32.asm
r59950 r60319 85 85 86 86 ; 87 ; Make sure PAE is really off and that PSE is on .87 ; Make sure PAE is really off and that PSE is on when supported. 88 88 ; 89 BS3_EXTERN_DATA16 g_uBs3CpuDetected 90 BS3_BEGIN_TEXT16 91 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) 92 jz .cr4_is_fine 89 93 mov eax, cr4 90 94 mov ecx, eax 91 and eax, ~X86_CR4_PAE 95 and eax, ~(X86_CR4_PAE | X86_CR4_PSE) 96 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_PSE >> 8) 97 jz .no_pse 92 98 or eax, X86_CR4_PSE 99 .no_pse: 93 100 cmp eax, ecx 94 101 je .cr4_is_fine -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapSystemCallHandler.asm
r60291 r60319 35 35 ;********************************************************************************************************************************* 36 36 BS3_EXTERN_DATA16 g_bBs3CurrentMode 37 %if TMPL_BITS != 64 37 38 BS3_EXTERN_DATA16 g_uBs3CpuDetected 39 %endif 38 40 %if TMPL_BITS == 16 39 41 BS3_EXTERN_DATA16 g_uBs3TrapEipHint … … 587 589 sldt [ss:bx + BS3REGCTX.ldtr] 588 590 .save_context_16_return: 591 or byte [ss:bx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64 | BS3REG_CTX_F_NO_CR4 589 592 ret 590 593 %endif ; TMPL_BITS == 16 … … 711 714 mov sAX, cr3 712 715 mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cr3], sAX 716 %if TMPL_BITS != 64 717 test byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) 718 jnz .have_cr4 719 or byte [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4 720 jmp .done_cr4 721 .have_cr4: 722 %endif 713 723 mov sAX, cr4 714 724 mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cr4], sAX 715 716 %if TMPL_BITS != 64 725 %if TMPL_BITS != 64 726 .done_cr4: 727 or byte [ss:xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64 728 717 729 ; Deal with extended v8086 frame. 718 730 %if TMPL_BITS == 32 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r60312 r60319 2207 2207 * This is usually because it wasn't created with CPL=0. */ 2208 2208 #define BS3REG_CTX_F_NO_CR UINT8_C(0x01) 2209 /** The CPU is too old for CR4, so no CR4 in this context. */ 2210 #define BS3REG_CTX_F_NO_CR4 UINT8_C(0x02) 2209 2211 /** The context doesn't have valid values for AMD64 GPR extensions. */ 2210 #define BS3REG_CTX_F_NO_AMD64 UINT8_C(0x0 2)2212 #define BS3REG_CTX_F_NO_AMD64 UINT8_C(0x04) 2211 2213 /** @} */ 2212 2214 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
r60311 r60319 1172 1172 ; This is usually because it wasn't created with CPL=0. 1173 1173 %define BS3REG_CTX_F_NO_CR 0x01 1174 ;; The CPU is too old for CR4, so no CR4 in this context. 1175 %define BS3REG_CTX_F_NO_CR4 0x02 1174 1176 ;; The context doesn't have valid values for AMD64 GPR extensions. 1175 %define BS3REG_CTX_F_NO_AMD64 0x0 21177 %define BS3REG_CTX_F_NO_AMD64 0x04 1176 1178 ;; @} 1177 1179
Note:
See TracChangeset
for help on using the changeset viewer.