Changeset 72619 in vbox for trunk/src/VBox/VMM/VMMAll/EMAll.cpp
- Timestamp:
- Jun 19, 2018 7:12:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r72596 r72619 1865 1865 } 1866 1866 1867 1868 #if 1 /** @todo Remove after testing and enabling @bugref{6973}. */ 1869 1870 /** 1871 * Interpret RDTSC. 1872 * 1873 * @returns VBox status code. 1874 * @param pVM The cross context VM structure. 1875 * @param pVCpu The cross context virtual CPU structure. 1876 * @param pRegFrame The register frame. 1877 * 1878 */ 1879 VMM_INT_DECL(int) EMInterpretRdtsc(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame) 1880 { 1881 Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu)); 1882 unsigned uCR4 = CPUMGetGuestCR4(pVCpu); 1883 1884 if (uCR4 & X86_CR4_TSD) 1885 return VERR_EM_INTERPRETER; /* genuine #GP */ 1886 1887 uint64_t uTicks = TMCpuTickGet(pVCpu); 1888 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 1889 uTicks = CPUMApplyNestedGuestTscOffset(pVCpu, uTicks); 1890 #endif 1891 1892 /* Same behaviour in 32 & 64 bits mode */ 1893 pRegFrame->rax = RT_LO_U32(uTicks); 1894 pRegFrame->rdx = RT_HI_U32(uTicks); 1895 #ifdef VBOX_COMPARE_IEM_AND_EM 1896 g_fIgnoreRaxRdx = true; 1897 #endif 1898 1899 NOREF(pVM); 1900 return VINF_SUCCESS; 1901 } 1902 1903 /** 1904 * Interpret RDTSCP. 1905 * 1906 * @returns VBox status code. 1907 * @param pVM The cross context VM structure. 1908 * @param pVCpu The cross context virtual CPU structure. 1909 * @param pCtx The CPU context. 1910 * 1911 */ 1912 VMM_INT_DECL(int) EMInterpretRdtscp(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1913 { 1914 Assert(pCtx == CPUMQueryGuestCtxPtr(pVCpu)); 1915 uint32_t uCR4 = CPUMGetGuestCR4(pVCpu); 1916 1917 if (!pVM->cpum.ro.GuestFeatures.fRdTscP) 1918 { 1919 AssertFailed(); 1920 return VERR_EM_INTERPRETER; /* genuine #UD */ 1921 } 1922 1923 if (uCR4 & X86_CR4_TSD) 1924 return VERR_EM_INTERPRETER; /* genuine #GP */ 1925 1926 uint64_t uTicks = TMCpuTickGet(pVCpu); 1927 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 1928 uTicks = CPUMApplyNestedGuestTscOffset(pVCpu, uTicks); 1929 #endif 1930 1931 /* Same behaviour in 32 & 64 bits mode */ 1932 pCtx->rax = RT_LO_U32(uTicks); 1933 pCtx->rdx = RT_HI_U32(uTicks); 1934 #ifdef VBOX_COMPARE_IEM_AND_EM 1935 g_fIgnoreRaxRdx = true; 1936 #endif 1937 /* Low dword of the TSC_AUX msr only. */ 1938 VBOXSTRICTRC rc2 = CPUMQueryGuestMsr(pVCpu, MSR_K8_TSC_AUX, &pCtx->rcx); Assert(rc2 == VINF_SUCCESS); NOREF(rc2); 1939 pCtx->rcx &= UINT32_C(0xffffffff); 1940 1941 return VINF_SUCCESS; 1942 } 1943 1944 #endif /* Trying to use IEM APIs instead. */ 1867 1945 1868 1946 /**
Note:
See TracChangeset
for help on using the changeset viewer.