Changeset 22049 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 7, 2009 8:14:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r22041 r22049 1833 1833 vmxR0UpdateExceptionBitmap(pVM, pVCpu, pCtx); 1834 1834 1835 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS) 1835 /* Store all guest MSRs in the VM-Entry load area, so they will be loaded during the world switch. */ 1836 PVMXMSR pMsr = (PVMXMSR)pVCpu->hwaccm.s.vmx.pGuestMSR; 1837 unsigned idxMsr = 0; 1838 1839 uint32_t ulEdx; 1840 uint32_t ulTemp; 1841 CPUMGetGuestCpuId(pVCpu, 0x80000001, &ulTemp, &ulTemp, &ulTemp, &ulEdx); 1842 /* EFER MSR present? */ 1843 if (ulEdx & (X86_CPUID_AMD_FEATURE_EDX_NX|X86_CPUID_AMD_FEATURE_EDX_LONG_MODE)) 1844 { 1845 pMsr->u32IndexMSR = MSR_K6_EFER; 1846 pMsr->u32Reserved = 0; 1847 pMsr->u64Value = pCtx->msrEFER; 1848 /* VT-x will complain if only MSR_K6_EFER_LME is set. */ 1849 if (!CPUMIsGuestInLongModeEx(pCtx)) 1850 pMsr->u64Value &= ~(MSR_K6_EFER_LMA|MSR_K6_EFER_LME); 1851 pMsr++; idxMsr++; 1852 1853 if (ulEdx & X86_CPUID_AMD_FEATURE_EDX_LONG_MODE) 1854 { 1855 pMsr->u32IndexMSR = MSR_K8_LSTAR; 1856 pMsr->u32Reserved = 0; 1857 pMsr->u64Value = pCtx->msrLSTAR; /* 64 bits mode syscall rip */ 1858 pMsr++; idxMsr++; 1859 pMsr->u32IndexMSR = MSR_K6_STAR; 1860 pMsr->u32Reserved = 0; 1861 pMsr->u64Value = pCtx->msrSTAR; /* legacy syscall eip, cs & ss */ 1862 pMsr++; idxMsr++; 1863 pMsr->u32IndexMSR = MSR_K8_SF_MASK; 1864 pMsr->u32Reserved = 0; 1865 pMsr->u64Value = pCtx->msrSFMASK; /* syscall flag mask */ 1866 pMsr++; idxMsr++; 1867 pMsr->u32IndexMSR = MSR_K8_KERNEL_GS_BASE; 1868 pMsr->u32Reserved = 0; 1869 pMsr->u64Value = pCtx->msrKERNELGSBASE; /* swapgs exchange value */ 1870 pMsr++; idxMsr++; 1871 } 1872 } 1873 1874 if ( (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS) 1875 && (ulEdx & X86_CPUID_AMD_FEATURE_EDX_LONG_MODE)) 1836 1876 { 1837 1877 /* Allow the guest to directly modify these MSRs; they are restored and saved automatically. */ … … 1843 1883 vmxR0SetMSRPermission(pVCpu, MSR_K8_FS_BASE, true, true); 1844 1884 } 1845 1846 /* Store all guest MSRs in the VM-Entry load area, so they will be loaded during the world switch. */1847 PVMXMSR pMsr = (PVMXMSR)pVCpu->hwaccm.s.vmx.pGuestMSR;1848 unsigned idxMsr = 0;1849 1850 pMsr->u32IndexMSR = MSR_K6_EFER;1851 pMsr->u32Reserved = 0;1852 pMsr->u64Value = pCtx->msrEFER;1853 /* VT-x will complain if only MSR_K6_EFER_LME is set. */1854 if (!CPUMIsGuestInLongModeEx(pCtx))1855 pMsr->u64Value &= ~(MSR_K6_EFER_LMA|MSR_K6_EFER_LME);1856 1857 pMsr++; idxMsr++;1858 pMsr->u32IndexMSR = MSR_K8_LSTAR;1859 pMsr->u32Reserved = 0;1860 pMsr->u64Value = pCtx->msrLSTAR; /* 64 bits mode syscall rip */1861 pMsr++; idxMsr++;1862 pMsr->u32IndexMSR = MSR_K6_STAR;1863 pMsr->u32Reserved = 0;1864 pMsr->u64Value = pCtx->msrSTAR; /* legacy syscall eip, cs & ss */1865 pMsr++; idxMsr++;1866 pMsr->u32IndexMSR = MSR_K8_SF_MASK;1867 pMsr->u32Reserved = 0;1868 pMsr->u64Value = pCtx->msrSFMASK; /* syscall flag mask */1869 pMsr++; idxMsr++;1870 pMsr->u32IndexMSR = MSR_K8_KERNEL_GS_BASE;1871 pMsr->u32Reserved = 0;1872 pMsr->u64Value = pCtx->msrKERNELGSBASE; /* swapgs exchange value */1873 pMsr++; idxMsr++;1874 1885 1875 1886 rc = VMXWriteVMCS(VMX_VMCS_CTRL_ENTRY_MSR_LOAD_COUNT, idxMsr);
Note:
See TracChangeset
for help on using the changeset viewer.