Changeset 87361 in vbox
- Timestamp:
- Jan 21, 2021 9:13:55 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142342
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.mac
r82968 r87361 255 255 .aoffXState resw 64 256 256 .fWorldSwitcher resd 1 257 .fUsedFpuGuest resb 1 257 258 alignb 8 258 259 .fExtrn resq 1 -
trunk/include/VBox/vmm/cpumctx.h
r82968 r87361 473 473 /** 0x2d4 - World switcher flags, CPUMCTX_WSF_XXX. */ 474 474 uint32_t fWorldSwitcher; 475 uint32_t fUnused; 475 /** 0x2d8 - Mirror of CPUMCPU::fUseFlags[CPUM_USED_FPU_GUEST]. */ 476 bool fUsedFpuGuest; 477 uint8_t afUnused[3]; 476 478 /** 0x2d8 - Externalized state tracker, CPUMCTX_EXTRN_XXX. 477 479 * Currently only used internally in NEM/win. */ -
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r87346 r87361 1616 1616 VMMDECL(bool) CPUMIsGuestFPUStateActive(PVMCPU pVCpu) 1617 1617 { 1618 return RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST); 1618 bool fRet = RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST); 1619 AssertMsg(fRet == pVCpu->cpum.s.Guest.fUsedFpuGuest, ("fRet=%d\n", fRet)); 1620 return fRet; 1619 1621 } 1620 1622 … … 1628 1630 VMMDECL(bool) CPUMIsGuestFPUStateLoaded(PVMCPU pVCpu) 1629 1631 { 1630 return RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST); 1632 bool fRet = RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST); 1633 AssertMsg(fRet == pVCpu->cpum.s.Guest.fUsedFpuGuest, ("fRet=%d\n", fRet)); 1634 return fRet; 1631 1635 } 1632 1636 -
trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp
r87346 r87361 466 466 Assert( (pVCpu->cpum.s.fUseFlags & (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST | CPUM_USED_FPU_SINCE_REM)) 467 467 == (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST | CPUM_USED_FPU_SINCE_REM)); 468 Assert(pVCpu->cpum.s.Guest.fUsedFpuGuest); 468 469 return rc; 469 470 } … … 485 486 { 486 487 fSavedGuest = RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST); 488 Assert(fSavedGuest == pVCpu->cpum.s.Guest.fUsedFpuGuest); 487 489 if (!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE)) 488 490 cpumR0SaveGuestRestoreHostFPUState(&pVCpu->cpum.s); … … 509 511 Assert(!( pVCpu->cpum.s.fUseFlags 510 512 & (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST | CPUM_USED_MANUAL_XMM_RESTORE))); 513 Assert(!pVCpu->cpum.s.Guest.fUsedFpuGuest); 511 514 return fSavedGuest; 512 515 } -
trunk/src/VBox/VMM/VMMR0/CPUMR0A.asm
r82968 r87361 181 181 182 182 or dword [pCpumCpu + CPUMCPU.fUseFlags], (CPUM_USED_FPU_GUEST | CPUM_USED_FPU_SINCE_REM | CPUM_USED_FPU_HOST) 183 mov byte [pCpumCpu + CPUMCPU.Guest.fUsedFpuGuest], 1 183 184 popf 184 185 … … 295 296 CPUMRZ_RESTORE_CR0_IF_TS_OR_EM_SET xCX 296 297 and dword [pCpumCpu + CPUMCPU.fUseFlags], ~(CPUM_USED_FPU_GUEST | CPUM_USED_FPU_HOST) 298 mov byte [pCpumCpu + CPUMCPU.Guest.fUsedFpuGuest], 0 297 299 298 300 popf -
trunk/src/VBox/VMM/VMMR0/HMR0A.asm
r87359 r87361 1096 1096 ; @param 2 fLoadSaveGuestXcr0 value 1097 1097 ; @param 3 The CPUMCTX_WSF_IBPB_ENTRY + CPUMCTX_WSF_IBPB_EXIT value. 1098 %macro hmR0SvmVmRunTemplate 3 1098 ; @param 4 The SSE saving/restoring: 0 to do nothing, 1 to do it manually, 2 to use xsave/xrstor. 1099 %macro hmR0SvmVmRunTemplate 4 1099 1100 1100 1101 ;; … … 1109 1110 ; So the SEH64_XXX stuff is currently not operational. 1110 1111 BEGINPROC RT_CONCAT(hmR0SvmVmRun,%1) 1112 %ifdef VBOX_WITH_KERNEL_USING_XMM 1113 %if %4 == 0 && 0 1114 ; 1115 ; The non-saving variant will currently check the two SSE preconditions and pick 1116 ; the right variant to continue with. Later we can see if we can't manage to 1117 ; move these decisions into hmR0SvmUpdateVmRunFunction(). 1118 ; 1119 test byte [rsi + VMCPU.cpum.GstCtx + CPUMCTX.fUsedFpuGuest], 1 1120 jz .save_xmm_no_need 1121 cmp dword [rdx + VMCPU.cpum.GstCtx + CPUMCTX.fXStateMask], 0 1122 je RT_CONCAT3(hmR0SvmVmRun,%1,_SseManual) 1123 jmp RT_CONCAT3(hmR0SvmVmRun,%1,_SseXSave) 1124 .save_xmm_no_need: 1125 %endif 1126 %endif 1111 1127 push rbp 1112 1128 SEH64_PUSH_xBP … … 1149 1165 1150 1166 %ifdef VBOX_STRICT 1167 ; 1151 1168 ; Verify template preconditions / parameters to ensure HMSVM.cpp didn't miss some state change. 1169 ; 1152 1170 cmp byte [rsi + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], %2 1153 1171 mov eax, VERR_SVM_VMRUN_PRECOND_0 … … 1159 1177 mov eax, VERR_SVM_VMRUN_PRECOND_1 1160 1178 jne .failure_return 1179 1180 %ifdef VBOX_WITH_KERNEL_USING_XMM 1181 %if %4 == 0 1182 1183 %elif %4 == 1 1184 %elif %4 == 2 1185 %else 1186 %error Invalid template parameter 4. 1187 %endif 1188 %endif 1161 1189 %endif 1162 1190 … … 1170 1198 mov eax, [rsi + VMCPU.cpum.GstCtx + CPUMCTX.aXcr] ; load the guest XCR0 1171 1199 mov edx, [rsi + VMCPU.cpum.GstCtx + CPUMCTX.aXcr + 4] 1172 xor ecx, ecx ; paranoia ; Also, indicates that we must restore XCR0 (moved into ecx, thus 0).1200 xor ecx, ecx ; paranoia 1173 1201 xsetbv 1174 1202 %endif … … 1318 1346 ; Instantiate the hmR0SvmVmRun various variations. 1319 1347 ; 1320 hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_SansIbpbExit, 0, 0 1321 hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_SansIbpbExit, 1, 0 1322 hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_SansIbpbExit, 0, CPUMCTX_WSF_IBPB_ENTRY 1323 hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_SansIbpbExit, 1, CPUMCTX_WSF_IBPB_ENTRY 1324 hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_WithIbpbExit, 0, CPUMCTX_WSF_IBPB_EXIT 1325 hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_WithIbpbExit, 1, CPUMCTX_WSF_IBPB_EXIT 1326 hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_WithIbpbExit, 0, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT 1327 hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_WithIbpbExit, 1, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT 1328 1348 hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_SansIbpbExit, 0, 0, 0 1349 hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_SansIbpbExit, 1, 0, 0 1350 hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_SansIbpbExit, 0, CPUMCTX_WSF_IBPB_ENTRY, 0 1351 hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_SansIbpbExit, 1, CPUMCTX_WSF_IBPB_ENTRY, 0 1352 hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_WithIbpbExit, 0, CPUMCTX_WSF_IBPB_EXIT, 0 1353 hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_WithIbpbExit, 1, CPUMCTX_WSF_IBPB_EXIT, 0 1354 hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_WithIbpbExit, 0, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT, 0 1355 hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_WithIbpbExit, 1, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT, 0 1356 ;%ifdef VBOX_WITH_KERNEL_USING_XMM 1357 ;hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_SansIbpbExit_SseManual, 0, 0, 1 1358 ;hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_SansIbpbExit_SseManual, 1, 0, 1 1359 ;hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_SansIbpbExit_SseManual, 0, CPUMCTX_WSF_IBPB_ENTRY, 1 1360 ;hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_SansIbpbExit_SseManual, 1, CPUMCTX_WSF_IBPB_ENTRY, 1 1361 ;hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_WithIbpbExit_SseManual, 0, CPUMCTX_WSF_IBPB_EXIT, 1 1362 ;hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_WithIbpbExit_SseManual, 1, CPUMCTX_WSF_IBPB_EXIT, 1 1363 ;hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_WithIbpbExit_SseManual, 0, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT, 1 1364 ;hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_WithIbpbExit_SseManual, 1, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT, 1 1365 ; 1366 ;hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_SansIbpbExit_SseXSave, 0, 0, 2 1367 ;hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_SansIbpbExit_SseXSave, 1, 0, 2 1368 ;hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_SansIbpbExit_SseXSave, 0, CPUMCTX_WSF_IBPB_ENTRY, 2 1369 ;hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_SansIbpbExit_SseXSave, 1, CPUMCTX_WSF_IBPB_ENTRY, 2 1370 ;hmR0SvmVmRunTemplate _SansXcr0_SansIbpbEntry_WithIbpbExit_SseXSave, 0, CPUMCTX_WSF_IBPB_EXIT, 2 1371 ;hmR0SvmVmRunTemplate _WithXcr0_SansIbpbEntry_WithIbpbExit_SseXSave, 1, CPUMCTX_WSF_IBPB_EXIT, 2 1372 ;hmR0SvmVmRunTemplate _SansXcr0_WithIbpbEntry_WithIbpbExit_SseXSave, 0, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT, 2 1373 ;hmR0SvmVmRunTemplate _WithXcr0_WithIbpbEntry_WithIbpbExit_SseXSave, 1, CPUMCTX_WSF_IBPB_ENTRY | CPUMCTX_WSF_IBPB_EXIT, 2 1374 ;%endif 1375 -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r87359 r87361 718 718 * CPUMCTX_WSF_IBPB_EXIT cannot be changed at runtime. 719 719 */ 720 static void hmR0SvmUpdate RunFunction(PVMCPUCC pVCpu)720 static void hmR0SvmUpdateVmRunFunction(PVMCPUCC pVCpu) 721 721 { 722 722 static const PFNHMSVMVMRUN s_apfnHmR0SvmVmRunFunctions[] = … … 745 745 static DECLCALLBACK(int) hmR0SvmVMRunSelector(PVMCC pVM, PVMCPUCC pVCpu, RTHCPHYS HCPhysVMCB) 746 746 { 747 hmR0SvmUpdate RunFunction(pVCpu);747 hmR0SvmUpdateVmRunFunction(pVCpu); 748 748 return pVCpu->hm.s.svm.pfnVMRun(pVM, pVCpu, HCPhysVMCB); 749 749 } … … 1672 1672 { 1673 1673 pVCpu->hm.s.fLoadSaveGuestXcr0 = fLoadSaveGuestXcr0; 1674 hmR0SvmUpdate RunFunction(pVCpu);1674 hmR0SvmUpdateVmRunFunction(pVCpu); 1675 1675 } 1676 1676 … … 6569 6569 { 6570 6570 pVCpu->hm.s.fLoadSaveGuestXcr0 = fLoadSaveGuestXcr0; 6571 hmR0SvmUpdate RunFunction(pVCpu);6571 hmR0SvmUpdateVmRunFunction(pVCpu); 6572 6572 } 6573 6573 } -
trunk/src/VBox/VMM/VMMRZ/CPUMRZ.cpp
r82968 r87361 99 99 if (pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST) 100 100 { 101 Assert(pVCpu->cpum.s.Guest.fUsedFpuGuest); 101 102 cpumRZSaveGuestFpuState(&pVCpu->cpum.s, false /*fLeaveFpuAccessible*/); 102 103 pVCpu->cpum.s.fUseFlags |= CPUM_USED_FPU_GUEST; 104 pVCpu->cpum.s.Guest.fUsedFpuGuest = true; 103 105 Log7(("CPUMRZFpuStateActualizeForRead\n")); 104 106 } … … 120 122 if (pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST) 121 123 { 124 Assert(pVCpu->cpum.s.Guest.fUsedFpuGuest); 122 125 cpumRZSaveGuestSseRegisters(&pVCpu->cpum.s); 123 126 Log7(("CPUMRZFpuStateActualizeSseForRead\n")); … … 138 141 if (pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU_GUEST) 139 142 { 143 Assert(pVCpu->cpum.s.Guest.fUsedFpuGuest); 140 144 cpumRZSaveGuestAvxRegisters(&pVCpu->cpum.s); 141 145 Log7(("CPUMRZFpuStateActualizeAvxForRead\n")); -
trunk/src/VBox/VMM/VMMRZ/CPUMRZA.asm
r82968 r87361 211 211 212 212 and dword [pCpumCpu + CPUMCPU.fUseFlags], ~CPUM_USED_FPU_GUEST 213 mov byte [pCpumCpu + CPUMCPU.Guest.fUsedFpuGuest], 0 213 214 %ifdef IN_RC 214 215 test byte [ebp + 0ch], 1 ; fLeaveFpuAccessible -
trunk/src/VBox/VMM/include/CPUMInternal.h
r87351 r87361 67 67 /** Use flags (CPUM::fUseFlags). 68 68 * (Don't forget to sync this with CPUMInternal.mac !) 69 * @note Part of saved state.69 * @note Was part of saved state (6.1 and earlier). 70 70 * @{ */ 71 71 /** Indicates that we've saved the host FPU, SSE, whatever state and that it … … 73 73 #define CPUM_USED_FPU_HOST RT_BIT(0) 74 74 /** Indicates that we've loaded the guest FPU, SSE, whatever state and that it 75 * needs to be saved. */ 75 * needs to be saved. 76 * @note Mirrored in CPUMCTX::fUsedFpuGuest for the HM switcher code. */ 76 77 #define CPUM_USED_FPU_GUEST RT_BIT(10) 77 78 /** Used the guest FPU, SSE or such stuff since last we were in REM. -
trunk/src/VBox/VMM/include/CPUMInternal.mac
r87349 r87361 222 222 .Guest.aoffXState resw 64 223 223 .Guest.fWorldSwitcher resd 1 224 .Guest.fUsedFpuGuest resb 1 224 225 alignb 8 225 226 .Guest.fExtrn resq 1
Note:
See TracChangeset
for help on using the changeset viewer.