Changeset 8943 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 20, 2008 9:15:53 AM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r8876 r8943 470 470 LogRel(("HWACCM: SVM features = %X\n", pVM->hwaccm.s.svm.u32Features)); 471 471 472 if (pVM->hwaccm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING) 473 LogRel(("HWACCM: AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING\n")); 474 if (pVM->hwaccm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_LBR_VIRT) 475 LogRel(("HWACCM: AMD_CPUID_SVM_FEATURE_EDX_LBR_VIRT\n")); 476 if (pVM->hwaccm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_SVM_LOCK) 477 LogRel(("HWACCM: AMD_CPUID_SVM_FEATURE_EDX_SVM_LOCK\n")); 478 if (pVM->hwaccm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE) 479 LogRel(("HWACCM: AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE\n")); 480 if (pVM->hwaccm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_SSE_3_5_DISABLE) 481 LogRel(("HWACCM: AMD_CPUID_SVM_FEATURE_EDX_SSE_3_5_DISABLE\n")); 482 472 483 /* Only try once. */ 473 484 pVM->hwaccm.s.fInitialized = true; -
trunk/src/VBox/VMM/HWACCMInternal.h
r8878 r8943 214 214 /** Set if we need to flush the TLB during the world switch. */ 215 215 bool fForceTLBFlush; 216 /** Set if nested paging is enabled. */ 217 bool fNestedPaging; 216 218 217 219 /* Id of the last cpu we were executing code on (NIL_RTCPUID for the first time) */ 218 220 RTCPUID idLastCpu; 221 222 /* TLB flush count */ 223 uint32_t cTLBFlushes; 219 224 220 225 /** R0 memory object for the VM control block (VMCB). */ … … 338 343 /* Current ASID (AMD-V only) */ 339 344 uint32_t uCurrentASID; 345 /* TLB flush count */ 346 uint32_t cTLBFlushes; 340 347 341 348 bool fVMXConfigured; -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r8941 r8943 78 78 79 79 pCpu->uCurrentASID = 0; /* we'll aways increment this the first time (host uses ASID 0) */ 80 pCpu->cTLBFlushes = 0; 80 81 return VINF_SUCCESS; 81 82 } … … 269 270 */ 270 271 271 /** @todo nested paging */272 272 pVMCB->ctrl.u32InterceptException = HWACCM_SVM_TRAP_MASK; 273 if (pVM->hwaccm.s.svm.fNestedPaging) 274 pVMCB->ctrl.u32InterceptException &= ~RT_BIT(14); /* no longer need to intercept pagefaults. */ 273 275 274 276 pVMCB->ctrl.u32InterceptCtrl1 = SVM_CTRL1_INTERCEPT_INTR … … 311 313 pVMCB->ctrl.u64MSRPMPhysAddr = pVM->hwaccm.s.svm.pMSRBitmapPhys; 312 314 313 /* Enable nested paging. */314 /** @todo how to detect support for this?? */315 pVMCB->ctrl.u64NestedPaging = 0; /** @todo SVM_NESTED_PAGING_ENABLE; */316 317 315 /* No LBR virtualization. */ 318 316 pVMCB->ctrl.u64LBRVirt = 0; … … 790 788 STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatInGC, x); 791 789 790 /* Enable nested paging (disabled each time after #VMEXIT). */ 791 pVMCB->ctrl.NestedPaging.n.u1NestedPaging = pVM->hwaccm.s.svm.fNestedPaging; 792 793 /* Force a TLB flush for the first world switch if the current cpu differs from the one we ran on last. */ 792 794 if (!pVM->hwaccm.s.svm.fResumeVM) 793 795 { 794 if (pVM->hwaccm.s.svm.idLastCpu != pCpu->idCpu) 796 if ( pVM->hwaccm.s.svm.idLastCpu != pCpu->idCpu 797 /* if the tlb flush count has changed, another VM has flushed the TLB of this cpu, so we can't use our current ASID anymore. */ 798 || pVM->hwaccm.s.svm.cTLBFlushes != pCpu->cTLBFlushes) 795 799 { 796 800 /* Force a TLB flush on VM entry. */ … … 800 804 } 801 805 802 /* Make sure we flush the TLB when required. */806 /* Make sure we flush the TLB when required. Switch ASID to achieve the same thing, but without actually flushing the whole TLB (which is expensive). */ 803 807 if ( pVM->hwaccm.s.svm.fForceTLBFlush 804 808 && !pVM->hwaccm.s.svm.fAlwaysFlushTLB) … … 808 812 pCpu->uCurrentASID = 1; /* start at 1; host uses 0 */ 809 813 pVMCB->ctrl.TLBCtrl.n.u1TLBFlush = 1; /* wrap around; flush TLB */ 814 pCpu->cTLBFlushes++; 810 815 } 811 816 else 812 817 STAM_COUNTER_INC(&pVM->hwaccm.s.StatFlushASID); 818 819 pVM->hwaccm.s.svm.cTLBFlushes = pCpu->cTLBFlushes; 813 820 } 814 821 else … … 844 851 Assert(pVMCB->ctrl.u64IOPMPhysAddr == pVM->hwaccm.s.svm.pIOBitmapPhys); 845 852 Assert(pVMCB->ctrl.u64MSRPMPhysAddr == pVM->hwaccm.s.svm.pMSRBitmapPhys); 846 Assert(pVMCB->ctrl.u64NestedPaging == 0);847 853 Assert(pVMCB->ctrl.u64LBRVirt == 0); 848 854 … … 902 908 Log(("ctrl.ExitIntInfo.u1Valid %x\n", pVMCB->ctrl.ExitIntInfo.n.u1Valid)); 903 909 Log(("ctrl.ExitIntInfo.u32ErrorCode %x\n", pVMCB->ctrl.ExitIntInfo.n.u32ErrorCode)); 904 Log(("ctrl. u64NestedPaging %VX64\n", pVMCB->ctrl.u64NestedPaging));910 Log(("ctrl.NestedPaging %VX64\n", pVMCB->ctrl.NestedPaging.au64)); 905 911 Log(("ctrl.EventInject.u8Vector %x\n", pVMCB->ctrl.EventInject.n.u8Vector)); 906 912 Log(("ctrl.EventInject.u3Type %x\n", pVMCB->ctrl.EventInject.n.u3Type)); … … 1101 1107 uint32_t errCode = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */ 1102 1108 RTGCUINTPTR uFaultAddress = pVMCB->ctrl.u64ExitInfo2; /* EXITINFO2 = fault address */ 1109 1110 Assert(!pVM->hwaccm.s.svm.fNestedPaging); 1103 1111 1104 1112 Log2(("Page fault at %VGv cr2=%VGv error code %x\n", pCtx->eip, uFaultAddress, errCode)); … … 1232 1240 } 1233 1241 1242 case SVM_EXIT_NPF: 1243 /* EXITINFO1 contains fault errorcode; EXITINFO2 contains the guest physical address causing the fault. */ 1244 Assert(pVM->hwaccm.s.svm.fNestedPaging); 1245 break; 1246 1234 1247 case SVM_EXIT_VINTR: 1235 1248 /* A virtual interrupt is about to be delivered, which means IF=1. */ … … 1575 1588 case SVM_EXIT_MWAIT_ARMED: 1576 1589 case SVM_EXIT_MSR: 1577 case SVM_EXIT_TASK_SWITCH: /* can change CR3; emulate */1590 case SVM_EXIT_TASK_SWITCH: /* can change CR3; emulate */ 1578 1591 rc = VINF_EM_RAW_EXCEPTION_PRIVILEGED; 1579 break;1580 1581 case SVM_EXIT_NPF:1582 AssertFailed(); /* unexpected */1583 1592 break; 1584 1593
Note:
See TracChangeset
for help on using the changeset viewer.