Changeset 66404 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Apr 3, 2017 3:21:56 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114357
- Location:
- trunk/src/VBox/ValidationKit/bootsectors
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r66392 r66404 395 395 /* [BS3CG1DST_OZ_R14] = */ BS3CG1DSTSIZE_OPERAND_SIZE_GRP, 396 396 /* [BS3CG1DST_OZ_R15] = */ BS3CG1DSTSIZE_OPERAND_SIZE_GRP, 397 398 /* [BS3CG1DST_CR0] = */ 4, 399 /* [BS3CG1DST_CR4] = */ 4, 397 400 398 401 /* [BS3CG1DST_FCW] = */ 2, … … 623 626 /* [BS3CG1DST_OZ_R15] = */ RT_OFFSETOF(BS3REGCTX, r15), 624 627 628 /* [BS3CG1DST_CR0] = */ RT_OFFSETOF(BS3REGCTX, cr0), 629 /* [BS3CG1DST_CR4] = */ RT_OFFSETOF(BS3REGCTX, cr4), 630 625 631 /* [BS3CG1DST_FCW] = */ sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.FCW), 626 632 /* [BS3CG1DST_FSW] = */ sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.FSW), … … 852 858 { "OZ_R15" }, 853 859 860 { "CR0" }, 861 { "CR4" }, 862 854 863 { "FCW" }, 855 864 { "FSW" }, … … 861 870 { "FPUDS" }, 862 871 { "MXCSR" }, 863 { "MXCSR_M" },864 872 { "ST0" }, 865 873 { "ST1" }, … … 977 985 { "VALXCPT" }, 978 986 }; 987 AssertCompile(RT_ELEMENTS(g_aszBs3Cg1DstFields) >= BS3CG1DST_END); 979 988 AssertCompile(RT_ELEMENTS(g_aszBs3Cg1DstFields) == BS3CG1DST_END); 980 989 … … 1556 1565 break; 1557 1566 1567 case BS3CG1ENC_MODRM_MdRO: 1568 if (iEncoding == 0) 1569 { 1570 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)) - 1; 1571 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, 1572 (pThis->abCurInstr[off] & X86_MODRM_REG_MASK) >> X86_MODRM_REG_SHIFT, 1573 4, 0, BS3CG1OPLOC_MEM); 1574 } 1575 else 1576 break; 1577 pThis->cbCurInstr = off; 1578 iEncoding++; 1579 break; 1580 1558 1581 case BS3CG1ENC_MODRM_MdWO: 1559 1582 if (iEncoding == 0) … … 1836 1859 pThis->iRmOp = 0; 1837 1860 pThis->aOperands[0].cbOp = 1; 1861 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM; 1862 break; 1863 1864 case BS3CG1ENC_MODRM_MdRO: 1865 pThis->iRmOp = 0; 1866 pThis->aOperands[0].cbOp = 4; 1838 1867 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM; 1839 1868 break; … … 2166 2195 case BS3CG1_CTXOP_AND: return "&="; 2167 2196 case BS3CG1_CTXOP_AND_INV: return "&~="; 2197 default: return "?WTF?"; 2168 2198 } 2169 2199 } … … 3284 3314 #if 0 3285 3315 /* (for debugging) */ 3286 if ( !BS3_MODE_IS_RM_OR_V86(bMode))3316 if (bMode != BS3_MODE_PPV86) 3287 3317 return BS3TESTDOMODE_SKIPPED; 3288 3318 #endif -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1.h
r66391 r66404 70 70 BS3CG1OP_Ma, 71 71 BS3CG1OP_MbRO, 72 BS3CG1OP_MdRO, 72 73 BS3CG1OP_MdWO, 73 74 BS3CG1OP_Mq, … … 104 105 BS3CG1ENC_MODRM_Vdq_Wdq, 105 106 BS3CG1ENC_MODRM_MbRO, 107 BS3CG1ENC_MODRM_MdRO, 106 108 BS3CG1ENC_MODRM_MdWO, 107 109 … … 410 412 BS3CG1DST_OZ_R14, 411 413 BS3CG1DST_OZ_R15, 414 415 /* Control registers.*/ 416 BS3CG1DST_CR0, 417 BS3CG1DST_CR4, 412 418 413 419 /* FPU registers. */ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxRestore.asm
r60774 r66404 309 309 je .skip_control_regs 310 310 %endif 311 test byte [xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_TR_LDTR 312 jnz .skip_control_regs 311 313 312 314 ; LDTR -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegCtxSaveEx.asm
r66199 r66404 33 33 ;********************************************************************************************************************************* 34 34 BS3_EXTERN_DATA16 g_bBs3CurrentMode 35 %if ARCH_BITS != 64 36 BS3_EXTERN_DATA16 g_uBs3CpuDetected 37 %endif 35 38 36 39 TMPL_BEGIN_TEXT … … 97 100 push xBP 98 101 mov xBP, xSP 102 %if ARCH_BITS == 64 103 push rcx ; Save pRegCtx 104 %endif 99 105 100 106 ; … … 151 157 BS3_CALL_CONV_EPILOG 3 152 158 BS3_HYBRID_RET 153 154 159 155 160 ; … … 218 223 %endif 219 224 BS3_SET_BITS TMPL_BITS 220 jmp . return225 jmp .supplement_and_return 221 226 TMPL_BEGIN_TEXT 222 227 … … 256 261 call _Bs3SwitchTo%[TMPL_BITS]Bit_c16 257 262 BS3_SET_BITS TMPL_BITS 258 jmp . return263 jmp .supplement_and_return 259 264 TMPL_BEGIN_TEXT 260 265 %endif … … 292 297 call _Bs3SwitchTo16Bit_c32 293 298 BS3_SET_BITS TMPL_BITS 294 jmp . return299 jmp .supplement_and_return 295 300 .code_32_back_to_v86: 296 301 BS3_SET_BITS 32 297 302 call _Bs3SwitchTo16BitV86_c32 303 BS3_SET_BITS TMPL_BITS 304 jmp .return 298 305 %else 299 306 call _Bs3SwitchTo64Bit_c32 300 %endif301 BS3_SET_BITS TMPL_BITS302 jmp .return307 BS3_SET_BITS TMPL_BITS 308 jmp .supplement_and_return 309 %endif 303 310 %endif 304 311 … … 334 341 jmp .return 335 342 %endif 343 344 345 ; 346 ; Supplement the state out of the current context and then return. 347 ; 348 .supplement_and_return: 349 %if ARCH_BITS == 16 350 CPU 8086 351 ; Skip 286 and older. Also make 101% sure we not in real mode or v8086 mode. 352 cmp byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_80386 353 jb .return ; Just skip if 286 or older. 354 test byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86 355 jnz .return 356 cmp byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_RM 357 jne .return ; paranoia 358 CPU 386 359 %endif 360 361 ; Load the context pointer into a suitable register. 362 %if ARCH_BITS == 64 363 %define pRegCtx rcx 364 mov rcx, [xBP - xCB] 365 %elif ARCH_BITS == 32 366 %define pRegCtx ecx 367 mov ecx, [xBP + xCB + cbCurRetAddr] 368 %else 369 %define pRegCtx es:bx 370 push es 371 push bx 372 les bx, [xBP + xCB + cbCurRetAddr] 373 %endif 374 %if ARCH_BITS == 64 375 ; If we're in 64-bit mode we can capture and restore the high bits. 376 test byte [pRegCtx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64 377 jz .supplemented_64bit_registers 378 mov [pRegCtx + BS3REGCTX.r8], r8 379 mov [pRegCtx + BS3REGCTX.r9], r9 380 mov [pRegCtx + BS3REGCTX.r10], r10 381 mov [pRegCtx + BS3REGCTX.r11], r11 382 mov [pRegCtx + BS3REGCTX.r12], r12 383 mov [pRegCtx + BS3REGCTX.r13], r13 384 mov [pRegCtx + BS3REGCTX.r14], r14 385 mov [pRegCtx + BS3REGCTX.r15], r15 386 shr rax, 32 387 mov [pRegCtx + BS3REGCTX.rax + 4], eax 388 mov rax, rbx 389 shr rax, 32 390 mov [pRegCtx + BS3REGCTX.rbx + 4], eax 391 mov rax, rcx 392 shr rax, 32 393 mov [pRegCtx + BS3REGCTX.rcx + 4], eax 394 mov rax, rdx 395 shr rax, 32 396 mov [pRegCtx + BS3REGCTX.rdx + 4], eax 397 mov rax, rsp 398 shr rax, 32 399 mov [pRegCtx + BS3REGCTX.rsp + 4], eax 400 mov rax, rbp 401 shr rax, 32 402 mov [pRegCtx + BS3REGCTX.rbp + 4], eax 403 mov rax, rsi 404 shr rax, 32 405 mov [pRegCtx + BS3REGCTX.rsi + 4], eax 406 mov rax, rdi 407 shr rax, 32 408 mov [pRegCtx + BS3REGCTX.rdi + 4], eax 409 ;and byte [pRegCtx + BS3REGCTX.fbFlags], ~BS3REG_CTX_F_NO_AMD64 - enable later. 410 .supplemented_64bit_registers: 411 %endif 412 ; The rest requires ring-0 (at least during restore). 413 mov ax, ss 414 test ax, 3 415 jnz .done_supplementing 416 417 ; Do control registers. 418 test byte [pRegCtx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR2_CR3 | BS3REG_CTX_F_NO_CR0_IS_MSW | BS3REG_CTX_F_NO_CR4 419 jz .supplemented_control_registers 420 mov sAX, cr0 421 mov [pRegCtx + BS3REGCTX.cr0], sAX 422 mov sAX, cr2 423 mov [pRegCtx + BS3REGCTX.cr2], sAX 424 mov sAX, cr3 425 mov [pRegCtx + BS3REGCTX.cr3], sAX 426 and byte [pRegCtx + BS3REGCTX.fbFlags], ~(BS3REG_CTX_F_NO_CR2_CR3 | BS3REG_CTX_F_NO_CR0_IS_MSW) 427 428 %if ARCH_BITS != 64 429 test byte [1 + BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8) 430 jz .supplemented_control_registers 431 %endif 432 mov sAX, cr4 433 mov [pRegCtx + BS3REGCTX.cr4], sAX 434 and byte [pRegCtx + BS3REGCTX.fbFlags], ~BS3REG_CTX_F_NO_CR4 435 .supplemented_control_registers: 436 437 ; Supply tr and ldtr if necessary 438 test byte [pRegCtx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_TR_LDTR 439 jz .done_supplementing 440 str [pRegCtx + BS3REGCTX.tr] 441 sldt [pRegCtx + BS3REGCTX.ldtr] 442 and byte [pRegCtx + BS3REGCTX.fbFlags], ~BS3REG_CTX_F_NO_TR_LDTR 443 444 .done_supplementing: 445 TONLY16 pop bx 446 TONLY16 pop es 447 jmp .return 448 %undef pRegCtx 336 449 BS3_PROC_END_CMN Bs3RegCtxSaveEx 337 450 338
Note:
See TracChangeset
for help on using the changeset viewer.