Changeset 42024 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Jul 5, 2012 12:10:53 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp
r41965 r42024 186 186 { 187 187 uint32_t fExtFeaturesEDX = ASMCpuId_EDX(0x80000001); 188 if (fExtFeaturesEDX & X86_CPUID_ AMD_FEATURE_EDX_SEP)188 if (fExtFeaturesEDX & X86_CPUID_EXT_FEATURE_EDX_SYSCALL) 189 189 { 190 190 #ifdef RT_ARCH_X86 191 191 # ifdef VBOX_WITH_HYBRID_32BIT_KERNEL 192 if (fExtFeaturesEDX & X86_CPUID_ AMD_FEATURE_EDX_LONG_MODE)192 if (fExtFeaturesEDX & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE) 193 193 # else 194 194 if (!ASMIsIntelCpu()) -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r41965 r42024 2219 2219 { 2220 2220 Log2(("SVM: Rdtscp\n")); 2221 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtsc );2221 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtscp); 2222 2222 rc = EMInterpretRdtscp(pVM, pVCpu, pCtx); 2223 2223 if (rc == VINF_SUCCESS) -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r41965 r42024 568 568 if (pVM->hwaccm.s.vmx.fUnrestrictedGuest) 569 569 val |= VMX_VMCS_CTRL_PROC_EXEC2_REAL_MODE; 570 571 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP) 572 val |= VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP; 570 573 571 574 /* Mask away the bits that the CPU doesn't support */ … … 1316 1319 * Check if EFER MSR present. 1317 1320 */ 1318 if (ASMCpuId_EDX(0x80000001) & (X86_CPUID_ AMD_FEATURE_EDX_NX|X86_CPUID_AMD_FEATURE_EDX_LONG_MODE))1319 { 1320 if (ASMCpuId_EDX(0x80000001) & X86_CPUID_ AMD_FEATURE_EDX_SEP)1321 if (ASMCpuId_EDX(0x80000001) & (X86_CPUID_EXT_FEATURE_EDX_NX | X86_CPUID_EXT_FEATURE_EDX_LONG_MODE)) 1322 { 1323 if (ASMCpuId_EDX(0x80000001) & X86_CPUID_EXT_FEATURE_EDX_SYSCALL) 1321 1324 { 1322 1325 pMsr->u32IndexMSR = MSR_K6_STAR; 1323 1326 pMsr->u32Reserved = 0; 1324 pMsr->u64Value = ASMRdMsr(MSR_K6_STAR); 1327 pMsr->u64Value = ASMRdMsr(MSR_K6_STAR); /* legacy syscall eip, cs & ss */ 1325 1328 pMsr++; idxMsr++; 1326 1329 } … … 2098 2101 CPUMGetGuestCpuId(pVCpu, 0x80000001, &ulTemp, &ulTemp, &ulTemp, &ulEdx); 2099 2102 /* EFER MSR present? */ 2100 if (ulEdx & (X86_CPUID_ AMD_FEATURE_EDX_NX|X86_CPUID_AMD_FEATURE_EDX_LONG_MODE))2103 if (ulEdx & (X86_CPUID_EXT_FEATURE_EDX_NX | X86_CPUID_EXT_FEATURE_EDX_LONG_MODE)) 2101 2104 { 2102 2105 pMsr->u32IndexMSR = MSR_K6_EFER; … … 2105 2108 /* VT-x will complain if only MSR_K6_EFER_LME is set. */ 2106 2109 if (!CPUMIsGuestInLongModeEx(pCtx)) 2107 pMsr->u64Value &= ~(MSR_K6_EFER_LMA |MSR_K6_EFER_LME);2110 pMsr->u64Value &= ~(MSR_K6_EFER_LMA | MSR_K6_EFER_LME); 2108 2111 pMsr++; idxMsr++; 2109 2112 2110 if (ulEdx & X86_CPUID_ AMD_FEATURE_EDX_LONG_MODE)2113 if (ulEdx & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE) 2111 2114 { 2112 2115 pMsr->u32IndexMSR = MSR_K8_LSTAR; … … 2161 2164 if (u64CurTSC + pVCpu->hwaccm.s.vmx.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu)) 2162 2165 { 2163 /* Note: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT takes precedence over TSC_OFFSET */2166 /* Note: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT takes precedence over TSC_OFFSET, applies to RDTSCP too. */ 2164 2167 rc = VMXWriteVMCS64(VMX_VMCS_CTRL_TSC_OFFSET_FULL, pVCpu->hwaccm.s.vmx.u64TSCOffset); 2165 2168 AssertRC(rc); … … 2172 2175 else 2173 2176 { 2174 /* Fall back to rdtsc emulation as we would otherwise pass decreasing tsc values to the guest. */2177 /* Fall back to rdtsc, rdtscp emulation as we would otherwise pass decreasing tsc values to the guest. */ 2175 2178 LogFlow(("TSC %RX64 offset %RX64 time=%RX64 last=%RX64 (diff=%RX64, virt_tsc=%RX64)\n", u64CurTSC, 2176 2179 pVCpu->hwaccm.s.vmx.u64TSCOffset, u64CurTSC + pVCpu->hwaccm.s.vmx.u64TSCOffset, … … 2332 2335 switch (pMsr->u32IndexMSR) 2333 2336 { 2334 case MSR_K8_LSTAR:2335 pCtx->msrLSTAR = pMsr->u64Value;2336 break;2337 case MSR_K6_STAR:2338 pCtx->msrSTAR = pMsr->u64Value;2339 break;2340 case MSR_K8_SF_MASK:2341 pCtx->msrSFMASK = pMsr->u64Value;2342 break;2343 case MSR_K8_KERNEL_GS_BASE:2344 pCtx->msrKERNELGSBASE = pMsr->u64Value;2345 break;2346 case MSR_K6_EFER:2347 /* EFER can't be changed without causing a VM-exit. */2348 /* Assert(pCtx->msrEFER == pMsr->u64Value); */2349 break;2350 default:2351 AssertFailed();2352 return VERR_HM_UNEXPECTED_LD_ST_MSR;2337 case MSR_K8_LSTAR: 2338 pCtx->msrLSTAR = pMsr->u64Value; 2339 break; 2340 case MSR_K6_STAR: 2341 pCtx->msrSTAR = pMsr->u64Value; 2342 break; 2343 case MSR_K8_SF_MASK: 2344 pCtx->msrSFMASK = pMsr->u64Value; 2345 break; 2346 case MSR_K8_KERNEL_GS_BASE: 2347 pCtx->msrKERNELGSBASE = pMsr->u64Value; 2348 break; 2349 case MSR_K6_EFER: 2350 /* EFER can't be changed without causing a VM-exit. */ 2351 /* Assert(pCtx->msrEFER == pMsr->u64Value); */ 2352 break; 2353 default: 2354 AssertFailed(); 2355 return VERR_HM_UNEXPECTED_LD_ST_MSR; 2353 2356 } 2354 2357 } … … 2453 2456 else 2454 2457 { 2455 AssertMsg(pVCpu->hwaccm.s.uCurrentASID && pCpu->uCurrentASID, ("hwaccm uCurrentASID=%lu cpu uCurrentASID=%lu\n", 2456 pVCpu->hwaccm.s.uCurrentASID, pCpu->uCurrentASID)); 2458 AssertMsg(pVCpu->hwaccm.s.uCurrentASID && pCpu->uCurrentASID, 2459 ("hwaccm->uCurrentASID=%lu hwaccm->cTLBFlushes=%lu cpu->uCurrentASID=%lu cpu->cTLBFlushes=%lu\n", 2460 pVCpu->hwaccm.s.uCurrentASID, pVCpu->hwaccm.s.cTLBFlushes, 2461 pCpu->uCurrentASID, pCpu->cTLBFlushes)); 2457 2462 2458 2463 /** @todo We never set VMCPU_FF_TLB_SHOOTDOWN anywhere so this path should … … 4046 4051 /* Update EIP and continue execution. */ 4047 4052 Assert(cbInstr == 2); 4053 pCtx->rip += cbInstr; 4054 goto ResumeExecution; 4055 } 4056 rc = VINF_EM_RAW_EMULATE_INSTR; 4057 break; 4058 } 4059 4060 case VMX_EXIT_RDTSCP: /* 51 Guest software attempted to execute RDTSCP. */ 4061 { 4062 Log2(("VMX: Rdtscp\n")); 4063 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitRdtscp); 4064 rc = EMInterpretRdtscp(pVM, pVCpu, pCtx); 4065 if (rc == VINF_SUCCESS) 4066 { 4067 /* Update EIP and continue execution. */ 4068 Assert(cbInstr == 3); 4048 4069 pCtx->rip += cbInstr; 4049 4070 goto ResumeExecution; … … 4626 4647 case VMX_EXIT_PORT_IO: /* 30 I/O instruction. */ 4627 4648 case VMX_EXIT_RDPMC: /* 15 Guest software attempted to execute RDPMC. */ 4649 case VMX_EXIT_RDTSCP: /* 51 Guest software attempted to execute RDTSCP. */ 4628 4650 /* already handled above */ 4629 4651 AssertMsg( rc == VINF_PGM_CHANGE_MODE -
trunk/src/VBox/VMM/VMMR0/TRPMR0.cpp
r41965 r42024 62 62 * Check if we're in long mode or not. 63 63 */ 64 if ( (ASMCpuId_EDX(0x80000001) & X86_CPUID_ AMD_FEATURE_EDX_LONG_MODE)64 if ( (ASMCpuId_EDX(0x80000001) & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE) 65 65 && (ASMRdMsr(MSR_K6_EFER) & MSR_K6_EFER_LMA)) 66 66 {
Note:
See TracChangeset
for help on using the changeset viewer.