Changeset 66450 in vbox
- Timestamp:
- Apr 5, 2017 7:06:04 PM (8 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py
r66419 r66450 159 159 'X86_CR4_PKE': 0x00400000, # RT_BIT_32(22) 160 160 }; 161 162 ## XSAVE components (XCR0). 163 g_kdX86XSaveCConstants = { 164 'XSAVE_C_X87': 0x00000001, 165 'XSAVE_C_SSE': 0x00000002, 166 'XSAVE_C_YMM': 0x00000004, 167 'XSAVE_C_BNDREGS': 0x00000008, 168 'XSAVE_C_BNDCSR': 0x00000010, 169 'XSAVE_C_OPMASK': 0x00000020, 170 'XSAVE_C_ZMM_HI256': 0x00000040, 171 'XSAVE_C_ZMM_16HI': 0x00000080, 172 'XSAVE_C_PKRU': 0x00000200, 173 'XSAVE_C_LWP': 0x4000000000000000, 174 'XSAVE_C_X': 0x8000000000000000, 175 'XSAVE_C_ALL_AVX': 0x000000c4, # For clearing all AVX bits. 176 'XSAVE_C_ALL_AVX_SSE': 0x000000c6, # For clearing all AVX and SSE bits. 177 }; 178 161 179 162 180 ## \@op[1-4] locations … … 824 842 'cr0': TestTypeFromDict('cr0', g_kdX86Cr0Constants, 'X86_CR0_'), 825 843 'cr4': TestTypeFromDict('cr4', g_kdX86Cr4Constants, 'X86_CR4_'), 844 'xcr0': TestTypeFromDict('xcr0', g_kdX86XSaveCConstants, 'XSAVE_C_'), 826 845 }; 827 846 ## CPU context fields. … … 924 943 'cr0': ( 'cr0', 'both', ), 925 944 'cr4': ( 'cr4', 'both', ), 945 'xcr0': ( 'xcr0', 'both', ), 926 946 # FPU Registers 927 947 'fcw': ( 'uint', 'both', ), -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h
r66419 r66450 5905 5905 * @opcpuid avx 5906 5906 * @opgroup og_avx_mxcsrsm 5907 * @optest mxcsr=0 -> op1=0 5908 * @optest mxcsr=0x2083 -> op1=0x2083 5909 * @optestign mxcsr=0x2084 cr0|=ts -> value.xcpt=0x7 5910 * @optestign mxcsr=0x2085 cr0|=em -> value.xcpt=0x6 5911 * @optestign mxcsr=0x2086 cr0|=mp -> op1=0x2086 5912 * @optestign mxcsr=0x2087 cr4&~=osfxsr -> value.xcpt=0x6 5913 * @optestign mxcsr=0x2088 cr0|=ts,em -> value.xcpt=0x6 5914 * @optestign mxcsr=0x2089 cr0|=em cr4&~=osfxsr -> value.xcpt=0x6 5915 * @optestign mxcsr=0x208a cr0|=ts,em cr4&~=osfxsr -> value.xcpt=0x6 5916 * @optestign mxcsr=0x208b cr0|=ts,em,mp cr4&~=osfxsr -> value.xcpt=0x6 5907 * @optest mxcsr=0 -> op1=0 5908 * @optest mxcsr=0x2083 -> op1=0x2083 5909 * @optest mxcsr=0x2084 cr0|=ts -> value.xcpt=0x7 5910 * @optest mxcsr=0x2085 cr0|=em -> op1=0x2085 5911 * @optest mxcsr=0x2086 cr0|=mp -> op1=0x2086 5912 * @optest mxcsr=0x2087 cr4&~=osfxsr -> op1=0x2087 5913 * @optest mxcsr=0x2088 cr0|=ts,em -> value.xcpt=0x7 5914 * @optest mxcsr=0x2089 cr0|=em cr4&~=osfxsr -> op1=0x2089 5915 * @optest mxcsr=0x208a cr0|=ts,em cr4&~=osfxsr -> value.xcpt=0x7 5916 * @optest mxcsr=0x208b cr0|=ts,em,mp cr4&~=osfxsr -> value.xcpt=0x7 5917 * @optest mxcsr=0x208c xcr0&~=all_avx -> value.xcpt=0x6 5918 * @optest mxcsr=0x208d xcr0&~=all_avx_sse -> value.xcpt=0x6 5919 * @optest mxcsr=0x208e xcr0&~=all_avx cr0|=ts -> value.xcpt=0x6 5920 * @optest mxcsr=0x208f cr4&~=osxsave -> value.xcpt=0x6 5921 * @optest mxcsr=0x2082 cr0|=ts cr4&~=osxsave -> value.xcpt=0x6 5922 * @optest mxcsr=0x2081 xcr0&~=all_avx cr0|=ts cr4&~=osxsave 5923 * -> value.xcpt=0x6 5917 5924 * @oponlytest 5918 5925 */ -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r66446 r66450 400 400 /* [BS3CG1DST_CR0] = */ 4, 401 401 /* [BS3CG1DST_CR4] = */ 4, 402 /* [BS3CG1DST_XCR0] = */ 8, 402 403 403 404 /* [BS3CG1DST_FCW] = */ 2, … … 630 631 /* [BS3CG1DST_CR0] = */ RT_OFFSETOF(BS3REGCTX, cr0), 631 632 /* [BS3CG1DST_CR4] = */ RT_OFFSETOF(BS3REGCTX, cr4), 633 /* [BS3CG1DST_XCR0] = */ sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, fXcr0Saved), 632 634 633 635 /* [BS3CG1DST_FCW] = */ sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.FCW), … … 862 864 { "CR0" }, 863 865 { "CR4" }, 866 { "XCR0" }, 864 867 865 868 { "FCW" }, … … 2226 2229 cr4 |= X86_CR4_OSFXSR | X86_CR4_OSXMMEEXCPT | X86_CR4_OSXSAVE; 2227 2230 ASMSetCR4(cr4); 2228 ASMSetXcr0(pThis->pExtCtx->fXcr0 );2231 ASMSetXcr0(pThis->pExtCtx->fXcr0Nominal); 2229 2232 } 2230 2233 else … … 3397 3400 pExtCtx->Ctx.x87.aXMM[i].au16[7] = i; 3398 3401 } 3399 if (pExtCtx->fXcr0 & XSAVE_C_YMM)3402 if (pExtCtx->fXcr0Nominal & XSAVE_C_YMM) 3400 3403 for (i = 0; i < RT_ELEMENTS(pExtCtx->Ctx.x.u.Intel.YmmHi.aYmmHi); i++) 3401 3404 { -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1.h
r66419 r66450 418 418 BS3CG1DST_CR0, 419 419 BS3CG1DST_CR4, 420 BS3CG1DST_XCR0, 420 421 421 422 /* FPU registers. */ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxCopy.c
r66226 r66450 36 36 BS3_CMN_DEF(PBS3EXTCTX, Bs3ExtCtxCopy,(PBS3EXTCTX pDst, PCBS3EXTCTX pSrc)) 37 37 { 38 BS3_ASSERT(pDst->cb == pSrc->cb && pDst->enmMethod == pSrc->enmMethod && pDst->fXcr0 == pSrc->fXcr0);38 BS3_ASSERT(pDst->cb == pSrc->cb && pDst->enmMethod == pSrc->enmMethod && pDst->fXcr0Nominal == pSrc->fXcr0Nominal); 39 39 Bs3MemCpy(&pDst->Ctx, &pSrc->Ctx, pDst->cb - RT_OFFSETOF(BS3EXTCTX, Ctx)); 40 pDst->fXcr0Saved = pSrc->fXcr0Saved; 40 41 return pDst; 41 42 } -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxInit.c
r66226 r66450 54 54 pExtCtx->enmMethod = BS3EXTCTXMETHOD_ANCIENT; 55 55 } 56 pExtCtx->cb = cbExtCtx; 57 pExtCtx->u16Magic = BS3EXTCTX_MAGIC; 58 pExtCtx->fXcr0 = fFlags; 56 pExtCtx->cb = cbExtCtx; 57 pExtCtx->u16Magic = BS3EXTCTX_MAGIC; 58 pExtCtx->fXcr0Nominal = fFlags; 59 pExtCtx->fXcr0Saved = fFlags; 59 60 return pExtCtx; 60 61 } -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxRestore.asm
r66214 r66450 36 36 push xBP 37 37 mov xBP, xSP 38 push xAX 39 BONLY32 push xCX 38 push sAX 39 push sCX 40 push sDX 41 push xBX 40 42 BONLY16 push es 41 BONLY16 push bx42 43 43 44 %if ARCH_BITS == 16 … … 56 57 jmp .return 57 58 58 .do_16_ xsave:59 xrstor [es:bx + BS3EXTCTX.Ctx]59 .do_16_fxsave: 60 fxrstor [es:bx + BS3EXTCTX.Ctx] 60 61 jmp .return 61 62 62 .do_16_fxsave: 63 fxrstor [es:bx + BS3EXTCTX.Ctx] 63 .do_16_xsave: 64 xor ecx, ecx 65 mov eax, [es:bx + BS3EXTCTX.fXcr0Nominal] 66 mov edx, [es:bx + BS3EXTCTX.fXcr0Nominal + 4] 67 xsetbv 68 69 xrstor [es:bx + BS3EXTCTX.Ctx] 70 71 mov eax, [es:bx + BS3EXTCTX.fXcr0Saved] 72 mov edx, [es:bx + BS3EXTCTX.fXcr0Saved + 4] 73 xsetbv 64 74 ;jmp .return 65 75 66 76 %else 67 BONLY32 mov ecx, [xBP + xCB + cbCurRetAddr] 77 BONLY32 mov ebx, [xBP + xCB + cbCurRetAddr] 78 BONLY64 mov rbx, rcx 68 79 69 mov al, [x CX + BS3EXTCTX.enmMethod]80 mov al, [xBX + BS3EXTCTX.enmMethod] 70 81 cmp al, BS3EXTCTXMETHOD_XSAVE 71 82 je .do_xsave … … 77 88 78 89 .do_ancient: 79 frstor [xCX + BS3EXTCTX.Ctx] 90 frstor [xBX + BS3EXTCTX.Ctx] 91 jmp .return 92 93 .do_fxsave: 94 BONLY32 fxrstor [xBX + BS3EXTCTX.Ctx] 95 BONLY64 fxrstor64 [xBX + BS3EXTCTX.Ctx] 80 96 jmp .return 81 97 82 98 .do_xsave: 83 BONLY32 xrstor [xCX + BS3EXTCTX.Ctx] 84 BONLY64 xrstor64 [xCX + BS3EXTCTX.Ctx] 85 jmp .return 99 xor ecx, ecx 100 mov eax, [xBX + BS3EXTCTX.fXcr0Nominal] 101 mov edx, [xBX + BS3EXTCTX.fXcr0Nominal + 4] 102 xsetbv 86 103 87 .do_fxsave: 88 BONLY32 fxrstor [xCX + BS3EXTCTX.Ctx] 89 BONLY64 fxrstor64 [xCX + BS3EXTCTX.Ctx] 104 BONLY32 xrstor [xBX + BS3EXTCTX.Ctx] 105 BONLY64 xrstor64 [xBX + BS3EXTCTX.Ctx] 106 107 mov eax, [xBX + BS3EXTCTX.fXcr0Saved] 108 mov edx, [xBX + BS3EXTCTX.fXcr0Saved + 4] 109 xsetbv 90 110 ;jmp .return 91 111 … … 93 113 94 114 .return: 95 BONLY16 pop bx96 115 BONLY16 pop es 97 BONLY32 pop xCX 98 pop xAX 116 pop xBX 117 pop sDX 118 pop sCX 119 pop sAX 99 120 mov xSP, xBP 100 121 pop xBP … … 102 123 BS3_PROC_END_CMN Bs3ExtCtxRestore 103 124 104 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSave.asm
r66214 r66450 36 36 push xBP 37 37 mov xBP, xSP 38 push xAX 39 BONLY32 push xCX 38 push sAX 39 push sCX 40 push sDX 41 push xBX 40 42 BONLY16 push es 41 BONLY16 push bx42 43 43 44 %if ARCH_BITS == 16 … … 56 57 jmp .return 57 58 58 .do_16_ xsave:59 xsave[es:bx + BS3EXTCTX.Ctx]59 .do_16_fxsave: 60 fxsave [es:bx + BS3EXTCTX.Ctx] 60 61 jmp .return 61 62 62 .do_16_fxsave: 63 fxsave [es:bx + BS3EXTCTX.Ctx] 63 .do_16_xsave: 64 xor ecx, ecx 65 xgetbv 66 mov [es:bx + BS3EXTCTX.fXcr0Saved], eax 67 mov [es:bx + BS3EXTCTX.fXcr0Saved + 4], edx 68 mov eax, [es:bx + BS3EXTCTX.fXcr0Nominal] 69 mov edx, [es:bx + BS3EXTCTX.fXcr0Nominal + 4] 70 xsetbv 71 72 xsave [es:bx + BS3EXTCTX.Ctx] 73 74 mov eax, [es:bx + BS3EXTCTX.fXcr0Saved] 75 mov edx, [es:bx + BS3EXTCTX.fXcr0Saved + 4] 76 xsetbv 64 77 ;jmp .return 65 78 66 79 %else 67 BONLY32 mov ecx, [xBP + xCB + cbCurRetAddr] 80 BONLY32 mov ebx, [xBP + xCB + cbCurRetAddr] 81 BONLY64 mov rbx, rcx 68 82 69 mov al, [x CX + BS3EXTCTX.enmMethod]83 mov al, [xBX + BS3EXTCTX.enmMethod] 70 84 cmp al, BS3EXTCTXMETHOD_XSAVE 71 85 je .do_xsave … … 77 91 78 92 .do_ancient: 79 fnsave [xCX + BS3EXTCTX.Ctx] 93 fnsave [xBX + BS3EXTCTX.Ctx] 94 jmp .return 95 96 .do_fxsave: 97 BONLY32 fxsave [xBX + BS3EXTCTX.Ctx] 98 BONLY64 fxsave64 [xBX + BS3EXTCTX.Ctx] 80 99 jmp .return 81 100 82 101 .do_xsave: 83 BONLY32 xsave [xCX + BS3EXTCTX.Ctx] 84 BONLY64 xsave64 [xCX + BS3EXTCTX.Ctx] 85 jmp .return 102 xor ecx, ecx 103 xgetbv 104 mov [xBX + BS3EXTCTX.fXcr0Saved], eax 105 mov [xBX + BS3EXTCTX.fXcr0Saved + 4], edx 106 mov eax, [xBX + BS3EXTCTX.fXcr0Nominal] 107 mov edx, [xBX + BS3EXTCTX.fXcr0Nominal + 4] 108 xsetbv 86 109 87 .do_fxsave: 88 BONLY32 fxsave [xCX + BS3EXTCTX.Ctx] 89 BONLY64 fxsave64 [xCX + BS3EXTCTX.Ctx] 110 BONLY32 xsave [xBX + BS3EXTCTX.Ctx] 111 BONLY64 xsave64 [xBX + BS3EXTCTX.Ctx] 112 113 mov eax, [xBX + BS3EXTCTX.fXcr0Saved] 114 mov edx, [xBX + BS3EXTCTX.fXcr0Saved + 4] 115 xsetbv 90 116 ;jmp .return 91 117 … … 93 119 94 120 .return: 95 BONLY16 pop bx96 121 BONLY16 pop es 97 BONLY32 pop xCX 98 pop xAX 122 pop xBX 123 pop sDX 124 pop sCX 125 pop sAX 99 126 mov xSP, xBP 100 127 pop xBP -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r66446 r66450 2686 2686 uint8_t enmMethod; 2687 2687 uint8_t abPadding0[3]; 2688 /** XSAVE_C_XXX. */ 2689 uint64_t fXcr0; 2688 /** Nominal XSAVE_C_XXX. */ 2689 uint64_t fXcr0Nominal; 2690 /** The saved XCR0 mask (restored after xrstor). */ 2691 uint64_t fXcr0Saved; 2690 2692 2691 2693 /** Explicit alignment padding. */ 2692 uint8_t abPadding[64 - 2 - 2 - 1 - 3 - 8 ];2694 uint8_t abPadding[64 - 2 - 2 - 1 - 3 - 8 - 8]; 2693 2695 2694 2696 /** The context, variable size (see above). -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
r66226 r66450 1422 1422 ; 1423 1423 struc BS3EXTCTX 1424 .u16Magic resw 1; uint16_t u16Magic;1425 .cb resw 1; uint16_t cb;1426 .enmMethod resb 1; uint8_t enmMethod;1424 .u16Magic resw 1 ; uint16_t u16Magic; 1425 .cb resw 1 ; uint16_t cb; 1426 .enmMethod resb 1 ; uint8_t enmMethod; 1427 1427 alignb 8 1428 .fXcr0 resq 1 1428 .fXcr0Nominal resq 1 ; uint64_t fXcr0Nominal; 1429 .fXcr0Saved resq 1 ; uint64_t fXcr0Saved; 1429 1430 alignb 64 1430 .Ctx resb 5121431 .Ctx resb 512 1431 1432 endstruc 1432 1433 %define BS3EXTCTXMETHOD_ANCIENT 1
Note:
See TracChangeset
for help on using the changeset viewer.