- Timestamp:
- Oct 1, 2018 4:09:23 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.h
r74491 r74539 1875 1875 1876 1876 /** 1877 * Checks whether the given Pin-based VM-execution controls are set. 1877 * Checks whether the given Pin-based VM-execution controls are set when executing a 1878 * nested-guest. 1878 1879 * 1879 1880 * @returns @c true if set, @c false otherwise. … … 1881 1882 * @param pCtx Pointer to the context. 1882 1883 * @param uPinCtl The Pin-based VM-execution controls to check. 1884 * 1885 * @remarks This does not check if all given controls are set if more than one 1886 * control is passed in @a uPinCtl. 1883 1887 */ 1884 1888 DECLINLINE(bool) CPUMIsGuestVmxPinCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uPinCtl) … … 1887 1891 if (pCtx->hwvirt.enmHwvirt != CPUMHWVIRT_VMX) 1888 1892 return false; 1889 Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode); 1893 if (!pCtx->hwvirt.vmx.fInVmxNonRootMode) 1894 return false; 1890 1895 Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)); 1891 1896 return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32PinCtls & uPinCtl); … … 1893 1898 1894 1899 /** 1895 * Checks whether the given Processor-based VM-execution controls are set. 1900 * Checks whether the given Processor-based VM-execution controls are set when 1901 * executing a nested-guest. 1896 1902 * 1897 1903 * @returns @c true if set, @c false otherwise. 1898 1904 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1899 1905 * @param pCtx Pointer to the context. 1900 * @param uPinCtl The Processor-based VM-execution controls to check. 1901 */ 1902 DECLINLINE(bool) CPUMIsGuestVmxProcCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtls) 1906 * @param uProcCtl The Processor-based VM-execution controls to check. 1907 * 1908 * @remarks This does not check if all given controls are set if more than one 1909 * control is passed in @a uProcCtls. 1910 */ 1911 DECLINLINE(bool) CPUMIsGuestVmxProcCtlsSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtl) 1903 1912 { 1904 1913 RT_NOREF(pVCpu); 1905 1914 if (pCtx->hwvirt.enmHwvirt != CPUMHWVIRT_VMX) 1906 1915 return false; 1907 Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode); 1916 if (!pCtx->hwvirt.vmx.fInVmxNonRootMode) 1917 return false; 1908 1918 Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)); 1909 return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls & uProcCtls); 1910 } 1911 1912 /** 1913 * Checks whether the given Secondary Processor-based VM-execution controls are set. 1919 return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls & uProcCtl); 1920 } 1921 1922 /** 1923 * Checks whether the given Secondary Processor-based VM-execution controls are set 1924 * when executing a nested-guest. 1914 1925 * 1915 1926 * @returns @c true if set, @c false otherwise. 1916 1927 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1917 1928 * @param pCtx Pointer to the context. 1918 * @param uP inCtlThe Secondary Processor-based VM-execution controls to1929 * @param uProcCtl2 The Secondary Processor-based VM-execution controls to 1919 1930 * check. 1920 */ 1921 DECLINLINE(bool) CPUMIsGuestVmxProcCtls2Set(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtls2) 1931 * 1932 * @remarks This does not check if all given controls are set if more than one 1933 * control is passed in @a uProcCtl2. 1934 * 1935 */ 1936 DECLINLINE(bool) CPUMIsGuestVmxProcCtls2Set(PVMCPU pVCpu, PCCPUMCTX pCtx, uint32_t uProcCtl2) 1922 1937 { 1923 1938 RT_NOREF(pVCpu); 1924 1939 if (pCtx->hwvirt.enmHwvirt != CPUMHWVIRT_VMX) 1925 1940 return false; 1926 Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode); 1941 if (!pCtx->hwvirt.vmx.fInVmxNonRootMode) 1942 return false; 1927 1943 Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)); 1928 return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls2 & uProcCtl s2);1944 return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls2 & uProcCtl2); 1929 1945 } 1930 1946 -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r74532 r74539 389 389 * Check if the guest has entered VMX root operation. 390 390 */ 391 # define IEM_VMX_IS_ROOT_MODE(a_pVCpu) 391 # define IEM_VMX_IS_ROOT_MODE(a_pVCpu) (CPUMIsGuestInVmxRootMode(IEM_GET_CTX(a_pVCpu))) 392 392 393 393 /** 394 394 * Check if the guest has entered VMX non-root operation. 395 395 */ 396 # define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu) 396 # define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu) (CPUMIsGuestInVmxNonRootMode(IEM_GET_CTX(a_pVCpu))) 397 397 398 398 /** … … 402 402 do { return iemVmxVmexitInstr((a_pVCpu), (a_uExitReason), (a_cbInstr)); } while (0) 403 403 404 /** 405 * Check if the nested-guest has the given Pin-based VM-execution control set. 406 */ 407 # define IEM_VMX_IS_PINCTLS_SET(a_pVCpu, a_PinCtl) \ 408 (CPUMIsGuestVmxPinCtlsSet((a_pVCpu), IEM_GET_CTX(a_pVCpu), (a_PinCtl))) 409 410 /** 411 * Check if the nested-guest has the given Processor-based VM-execution control set. 412 */ 413 #define IEM_VMX_IS_PROCCTLS_SET(a_pVCpu, a_ProcCtl) \ 414 (CPUMIsGuestVmxProcCtlsSet((a_pVCpu), IEM_GET_CTX(a_pVCpu), (a_ProcCtl))) 415 416 /** 417 * Check if the nested-guest has the given Secondary Processor-based VM-execution 418 * control set. 419 */ 420 #define IEM_VMX_IS_PROCCTLS2_SET(a_pVCpu, a_ProcCtl2) \ 421 (CPUMIsGuestVmxProcCtls2Set((a_pVCpu), IEM_GET_CTX(a_pVCpu), (a_ProcCtl2))) 422 404 423 #else 405 # define IEM_VMX_IS_ROOT_MODE(a_pVCpu) (false) 406 # define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu) (false) 407 # define IEM_VMX_VMEXIT_INSTR_RET(a_pVCpu, a_Reason, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0) 424 # define IEM_VMX_IS_ROOT_MODE(a_pVCpu) (false) 425 # define IEM_VMX_IS_NON_ROOT_MODE(a_pVCpu) (false) 426 # define IEM_VMX_IS_PINCTLS_SET(a_pVCpu, a_cbInstr) (false) 427 # define IEM_VMX_IS_PROCCTLS_SET(a_pVCpu, a_cbInstr) (false) 428 # define IEM_VMX_IS_PROCCTLS2_SET(a_pVCpu, a_cbInstr) (false) 429 # define IEM_VMX_VMEXIT_INSTR_RET(a_pVCpu, a_Reason, a_cbInstr) do { return VERR_VMX_IPE_1; } while (0) 430 408 431 #endif 409 432 … … 412 435 * Check if an SVM control/instruction intercept is set. 413 436 */ 414 # define IEM_SVM_IS_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept) (CPUMIsGuestSvmCtrlInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_Intercept))) 437 # define IEM_SVM_IS_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept) \ 438 (CPUMIsGuestSvmCtrlInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_Intercept))) 415 439 416 440 /** 417 441 * Check if an SVM read CRx intercept is set. 418 442 */ 419 # define IEM_SVM_IS_READ_CR_INTERCEPT_SET(a_pVCpu, a_uCr) (CPUMIsGuestSvmReadCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr))) 443 # define IEM_SVM_IS_READ_CR_INTERCEPT_SET(a_pVCpu, a_uCr) \ 444 (CPUMIsGuestSvmReadCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr))) 420 445 421 446 /** 422 447 * Check if an SVM write CRx intercept is set. 423 448 */ 424 # define IEM_SVM_IS_WRITE_CR_INTERCEPT_SET(a_pVCpu, a_uCr) (CPUMIsGuestSvmWriteCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr))) 449 # define IEM_SVM_IS_WRITE_CR_INTERCEPT_SET(a_pVCpu, a_uCr) \ 450 (CPUMIsGuestSvmWriteCRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uCr))) 425 451 426 452 /** 427 453 * Check if an SVM read DRx intercept is set. 428 454 */ 429 # define IEM_SVM_IS_READ_DR_INTERCEPT_SET(a_pVCpu, a_uDr) (CPUMIsGuestSvmReadDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr))) 455 # define IEM_SVM_IS_READ_DR_INTERCEPT_SET(a_pVCpu, a_uDr) \ 456 (CPUMIsGuestSvmReadDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr))) 430 457 431 458 /** 432 459 * Check if an SVM write DRx intercept is set. 433 460 */ 434 # define IEM_SVM_IS_WRITE_DR_INTERCEPT_SET(a_pVCpu, a_uDr) (CPUMIsGuestSvmWriteDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr))) 461 # define IEM_SVM_IS_WRITE_DR_INTERCEPT_SET(a_pVCpu, a_uDr) \ 462 (CPUMIsGuestSvmWriteDRxInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uDr))) 435 463 436 464 /** 437 465 * Check if an SVM exception intercept is set. 438 466 */ 439 # define IEM_SVM_IS_XCPT_INTERCEPT_SET(a_pVCpu, a_uVector) (CPUMIsGuestSvmXcptInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uVector))) 467 # define IEM_SVM_IS_XCPT_INTERCEPT_SET(a_pVCpu, a_uVector) \ 468 (CPUMIsGuestSvmXcptInterceptSet(a_pVCpu, IEM_GET_CTX(a_pVCpu), (a_uVector))) 440 469 441 470 /** -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r74532 r74539 6143 6143 } 6144 6144 6145 if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_RDTSC_EXIT)) 6146 { 6147 Log(("rdtsc: Guest intercept -> VM-exit\n")); 6148 IEM_VMX_VMEXIT_INSTR_RET(pVCpu, VMX_EXIT_RDTSC, cbInstr); 6149 } 6150 6145 6151 if (IEM_SVM_IS_CTRL_INTERCEPT_SET(pVCpu, SVM_CTRL_INTERCEPT_RDTSC)) 6146 6152 { … … 6186 6192 } 6187 6193 6194 if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_RDTSCP)) 6195 { 6196 Log(("rdtscp: Guest intercept -> VM-exit\n")); 6197 IEM_VMX_VMEXIT_INSTR_RET(pVCpu, VMX_EXIT_RDTSCP, cbInstr); 6198 } 6199 6188 6200 if (IEM_SVM_IS_CTRL_INTERCEPT_SET(pVCpu, SVM_CTRL_INTERCEPT_RDTSCP)) 6189 6201 { … … 6843 6855 IEM_CIMPL_DEF_0(iemCImpl_cpuid) 6844 6856 { 6857 if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu)) 6858 { 6859 Log2(("cpuid: Guest intercept -> VM-exit\n")); 6860 IEM_VMX_VMEXIT_INSTR_RET(pVCpu, VMX_EXIT_CPUID, cbInstr); 6861 } 6862 6845 6863 if (IEM_SVM_IS_CTRL_INTERCEPT_SET(pVCpu, SVM_CTRL_INTERCEPT_CPUID)) 6846 6864 { … … 6848 6866 IEM_SVM_UPDATE_NRIP(pVCpu); 6849 6867 IEM_SVM_VMEXIT_RET(pVCpu, SVM_EXIT_CPUID, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6850 }6851 6852 if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))6853 {6854 Log2(("cpuid: Guest intercept -> VM-exit\n"));6855 IEM_VMX_VMEXIT_INSTR_RET(pVCpu, VMX_EXIT_CPUID, cbInstr);6856 6868 } 6857 6869
Note:
See TracChangeset
for help on using the changeset viewer.