- Timestamp:
- Apr 12, 2013 9:40:29 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r45503 r45510 210 210 static int hmR0VmxInitVmcsReadCache(PVM pVM, PVMCPU pVCpu); 211 211 #endif 212 #if 0213 DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, u nsignedrcReason);212 #if 1 213 DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, uint32_t rcReason); 214 214 #endif 215 215 … … 934 934 * 935 935 * @param pVCpu Pointer to the VMCPU. 936 * @param u lMSRThe MSR value.936 * @param uMSR The MSR value. 937 937 * @param enmRead Whether reading this MSR causes a VM-exit. 938 938 * @param enmWrite Whether writing this MSR causes a VM-exit. 939 939 */ 940 static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, u nsigned ulMsr, VMXMSREXITREAD enmRead, VMXMSREXITWRITE enmWrite)941 { 942 unsigned ulBit;940 static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, uint32_t uMsr, VMXMSREXITREAD enmRead, VMXMSREXITWRITE enmWrite) 941 { 942 int32_t iBit; 943 943 uint8_t *pbMsrBitmap = (uint8_t *)pVCpu->hm.s.vmx.pvMsrBitmap; 944 944 … … 950 950 * 0xc00 - 0xfff - High MSR write bits 951 951 */ 952 if (u lMsr <= 0x00001FFF)952 if (uMsr <= 0x00001FFF) 953 953 { 954 954 /* Pentium-compatible MSRs */ 955 ulBit = ulMsr;956 } 957 else if ( u lMsr >= 0xC0000000958 && u lMsr <= 0xC0001FFF)955 iBit = uMsr; 956 } 957 else if ( uMsr >= 0xC0000000 958 && uMsr <= 0xC0001FFF) 959 959 { 960 960 /* AMD Sixth Generation x86 Processor MSRs */ 961 ulBit = (ulMsr - 0xC0000000);961 iBit = (uMsr - 0xC0000000); 962 962 pbMsrBitmap += 0x400; 963 963 } 964 964 else 965 965 { 966 AssertMsgFailed((" Invalid MSR %lx\n", ulMsr));966 AssertMsgFailed(("hmR0VmxSetMsrPermission: Invalid MSR %#RX32\n", uMsr)); 967 967 return; 968 968 } 969 969 970 Assert( ulBit <= 0x1fff);970 Assert(iBit <= 0x1fff); 971 971 if (enmRead == VMXMSREXIT_INTERCEPT_READ) 972 ASMBitSet(pbMsrBitmap, ulBit);972 ASMBitSet(pbMsrBitmap, iBit); 973 973 else 974 ASMBitClear(pbMsrBitmap, ulBit);974 ASMBitClear(pbMsrBitmap, iBit); 975 975 976 976 if (enmWrite == VMXMSREXIT_INTERCEPT_WRITE) 977 ASMBitSet(pbMsrBitmap + 0x800, ulBit);977 ASMBitSet(pbMsrBitmap + 0x800, iBit); 978 978 else 979 ASMBitClear(pbMsrBitmap + 0x800, ulBit);979 ASMBitClear(pbMsrBitmap + 0x800, iBit); 980 980 } 981 981 … … 2209 2209 2210 2210 PVMXMSR pHostMsr = (PVMXMSR)pVCpu->hm.s.vmx.pvHostMsr; 2211 u nsigned idxHostMsr= 0;2211 uint32_t cHostMsrs = 0; 2212 2212 uint32_t u32HostExtFeatures = pVM->hm.s.cpuid.u32AMDFeatureEDX; 2213 2213 … … 2225 2225 #endif 2226 2226 pHostMsr->u64Value = ASMRdMsr(MSR_K6_EFER); 2227 pHostMsr++; idxHostMsr++;2227 pHostMsr++; cHostMsrs++; 2228 2228 } 2229 2229 … … 2234 2234 pHostMsr->u32Reserved = 0; 2235 2235 pHostMsr->u64Value = ASMRdMsr(MSR_K6_STAR); /* legacy syscall eip, cs & ss */ 2236 pHostMsr++; idxHostMsr++;2236 pHostMsr++; cHostMsrs++; 2237 2237 pHostMsr->u32IndexMSR = MSR_K8_LSTAR; 2238 2238 pHostMsr->u32Reserved = 0; 2239 2239 pHostMsr->u64Value = ASMRdMsr(MSR_K8_LSTAR); /* 64 bits mode syscall rip */ 2240 pHostMsr++; idxHostMsr++;2240 pHostMsr++; cHostMsrs++; 2241 2241 pHostMsr->u32IndexMSR = MSR_K8_SF_MASK; 2242 2242 pHostMsr->u32Reserved = 0; 2243 2243 pHostMsr->u64Value = ASMRdMsr(MSR_K8_SF_MASK); /* syscall flag mask */ 2244 pHostMsr++; idxHostMsr++;2244 pHostMsr++; cHostMsrs++; 2245 2245 /* The KERNEL_GS_BASE MSR doesn't work reliably with auto load/store. See @bugref{6208} */ 2246 2246 #if 0 … … 2248 2248 pMsr->u32Reserved = 0; 2249 2249 pMsr->u64Value = ASMRdMsr(MSR_K8_KERNEL_GS_BASE); /* swapgs exchange value */ 2250 pHostMsr++; idxHostMsr++;2250 pHostMsr++; cHostMsrs++; 2251 2251 #endif 2252 2252 } … … 2254 2254 2255 2255 /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */ 2256 if (RT_UNLIKELY( idxHostMsr> MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc)))2257 { 2258 LogRel((" idxHostMsr=%u Cpu=%u\n", idxHostMsr, (unsigned)MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc)));2256 if (RT_UNLIKELY(cHostMsrs > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc))) 2257 { 2258 LogRel(("cHostMsrs=%u Cpu=%u\n", cHostMsrs, (unsigned)MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc))); 2259 2259 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO; 2260 2260 } 2261 2261 2262 int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, idxHostMsr);2262 int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, cHostMsrs); 2263 2263 2264 2264 /* … … 3564 3564 { 3565 3565 PVMXMSR pGuestMsr = (PVMXMSR)pVCpu->hm.s.vmx.pvGuestMsr; 3566 u nsignedcGuestMsrs = 0;3566 uint32_t cGuestMsrs = 0; 3567 3567 3568 3568 /* See Intel spec. 4.1.4 "Enumeration of Paging Features by CPUID". */ … … 4442 4442 4443 4443 /* Make sure there are no duplicates. */ 4444 for (u nsignedi = 0; i < pCache->Write.cValidEntries; i++)4444 for (uint32_t i = 0; i < pCache->Write.cValidEntries; i++) 4445 4445 { 4446 4446 if (pCache->Write.aField[i] == idxField) … … 5102 5102 return VINF_SUCCESS; 5103 5103 5104 for (u nsignedi = 0; i < pVCpu->hm.s.vmx.cGuestMsrs; i++)5104 for (uint32_t i = 0; i < pVCpu->hm.s.vmx.cGuestMsrs; i++) 5105 5105 { 5106 5106 PVMXMSR pMsr = (PVMXMSR)pVCpu->hm.s.vmx.pvGuestMsr; … … 6662 6662 VmxTransient.fUpdateTscOffsettingAndPreemptTimer = true; 6663 6663 int rc = VERR_INTERNAL_ERROR_5; 6664 u nsignedcLoops = 0;6664 uint32_t cLoops = 0; 6665 6665 6666 6666 for (;; cLoops++) … … 6725 6725 6726 6726 #if 1 6727 DECLINLINE(int) hmR0VmxHandleExit(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, u nsignedrcReason)6727 DECLINLINE(int) hmR0VmxHandleExit(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, uint32_t rcReason) 6728 6728 { 6729 6729 int rc; … … 7891 7891 for (unsigned i = 0; i < 4; i++) 7892 7892 { 7893 u nsigneduBPLen = s_aIOSize[X86_DR7_GET_LEN(pMixedCtx->dr[7], i)];7893 uint32_t uBPLen = s_aIOSize[X86_DR7_GET_LEN(pMixedCtx->dr[7], i)]; 7894 7894 if ( ( uIOPort >= pMixedCtx->dr[i] 7895 7895 && uIOPort < pMixedCtx->dr[i] + uBPLen) … … 8036 8036 8037 8037 /* See Intel spec. 27-6 "Exit Qualifications for APIC-access VM-exits from Linear Accesses & Guest-Phyiscal Addresses" */ 8038 u nsigneduAccessType = VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(pVmxTransient->uExitQualification);8038 uint32_t uAccessType = VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(pVmxTransient->uExitQualification); 8039 8039 switch (uAccessType) 8040 8040 { … … 8467 8467 8468 8468 PDISCPUSTATE pDis = &pVCpu->hm.s.DisState; 8469 u nsigned int cbOp= 0;8469 uint32_t cbOp = 0; 8470 8470 PVM pVM = pVCpu->CTX_SUFF(pVM); 8471 8471 rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);
Note:
See TracChangeset
for help on using the changeset viewer.