Changeset 9726 in vbox
- Timestamp:
- Jun 16, 2008 2:19:08 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r9725 r9726 1788 1788 uint64_t val; 1789 1789 uint64_t oldval; 1790 uint64_t msrEFER; 1790 1791 int rc; 1791 1792 1792 /** @todo Clean up this mess. */ 1793 1793 /** @todo Clean up this mess. */ 1794 1794 if (CPUMIsGuestIn64BitCode(pVM, pRegFrame)) 1795 1795 { … … 1824 1824 AssertRCReturn(rc, rc); 1825 1825 } 1826 1827 /* Deal with long mode enabling/disabling. */ 1828 msrEFER = CPUMGetGuestEFER(pVM); 1829 if (msrEFER & MSR_K6_EFER_LME) 1830 { 1831 if ( !(oldval & X86_CR0_PG) 1832 && (val & X86_CR0_PG)) 1833 { 1834 /* Illegal to have an active 64 bits CS selector (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */ 1835 if (pRegFrame->csHid.Attr.n.u1Long) 1836 { 1837 AssertMsgFailed(("Illegal enabling of paging with CS.u1Long = 1!!\n")); 1838 return VERR_EM_INTERPRETER; /* @todo generate #GP(0) */ 1839 } 1840 1841 /* Illegal to switch to long mode before activating PAE first (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */ 1842 if (!(CPUMGetGuestCR4(pVM) & X86_CR4_PAE)) 1843 { 1844 AssertMsgFailed(("Illegal enabling of paging with PAE disabled!!\n")); 1845 return VERR_EM_INTERPRETER; /* @todo generate #GP(0) */ 1846 } 1847 1848 msrEFER |= MSR_K6_EFER_LMA; 1849 } 1850 else 1851 if ( (oldval & X86_CR0_PG) 1852 && !(val & X86_CR0_PG)) 1853 { 1854 msrEFER &= ~MSR_K6_EFER_LMA; 1855 /* @todo Do we need to cut off rip here? High dword of rip is undefined, so it shouldn't really matter. */ 1856 } 1857 CPUMSetGuestEFER(pVM, msrEFER); 1858 } 1826 1859 return PGMChangeMode(pVM, CPUMGetGuestCR0(pVM), CPUMGetGuestCR4(pVM), CPUMGetGuestEFER(pVM)); 1827 1860 … … 1845 1878 rc = CPUMSetGuestCR4(pVM, val); AssertRC(rc); 1846 1879 val = CPUMGetGuestCR4(pVM); 1880 1881 msrEFER = CPUMGetGuestEFER(pVM); 1882 /* Illegal to disable PAE when long mode is active. (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */ 1883 if ( (msrEFER & MSR_K6_EFER_LMA) 1884 && (oldval & X86_CR4_PAE) 1885 && !(val & X86_CR4_PAE)) 1886 { 1887 return VERR_EM_INTERPRETER; /* @todo generate #GP(0) */ 1888 } 1889 1847 1890 if ( (oldval & (X86_CR4_PGE|X86_CR4_PAE|X86_CR4_PSE)) 1848 1891 != (val & (X86_CR4_PGE|X86_CR4_PAE|X86_CR4_PSE))) … … 2299 2342 if (u32Features & X86_CPUID_AMD_FEATURE_EDX_SEP) 2300 2343 uMask |= MSR_K6_EFER_SCE; 2344 2345 /* Check for illegal MSR_K6_EFER_LME transitions: not allowed to change LME if paging is enabled. (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */ 2346 if ( ((pCtx->msrEFER & MSR_K6_EFER_LME) != (val & uMask & MSR_K6_EFER_LME)) 2347 && (pCtx->cr0 & X86_CR0_PG)) 2348 { 2349 AssertMsgFailed(("Illegal MSR_K6_EFER_LME change: paging is enabled!!\n")); 2350 return VERR_EM_INTERPRETER; /* @todo generate #GP(0) */ 2351 } 2301 2352 2302 2353 /* There are a few more: e.g. MSR_K6_EFER_FFXSR, MSR_K6_EFER_LMSLE */
Note:
See TracChangeset
for help on using the changeset viewer.