Changeset 97562 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Nov 16, 2022 2:34:26 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 154593
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp
r96407 r97562 678 678 pVCpu->cpum.s.Guest.dr[3] = ASMGetDR3(); 679 679 if (fDr6) 680 pVCpu->cpum.s.Guest.dr[6] = ASMGetDR6() ;680 pVCpu->cpum.s.Guest.dr[6] = ASMGetDR6() | X86_DR6_RA1_MASK; /* ASSUMES no guest supprot for TSX-NI / RTM. */ 681 681 } 682 682 ASMAtomicAndU32(&pVCpu->cpum.s.fUseFlags, ~(CPUM_USED_DEBUG_REGS_GUEST | CPUM_USED_DEBUG_REGS_HYPER)); -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r97224 r97562 71 71 #endif 72 72 73 /** Enables the fAlwaysInterceptMovDRx related code. */ 74 #define VMX_WITH_MAYBE_ALWAYS_INTERCEPT_MOV_DRX 1 75 73 76 74 77 /********************************************************************************************************************************* … … 97 100 static bool hmR0VmxShouldSwapEferMsr(PCVMCPUCC pVCpu, PCVMXTRANSIENT pVmxTransient); 98 101 static int hmR0VmxExitHostNmi(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo); 102 103 104 /********************************************************************************************************************************* 105 * Global Variables * 106 *********************************************************************************************************************************/ 107 /** The DR6 value after writing zero to the register. 108 * Set by VMXR0GlobalInit(). */ 109 static uint64_t g_fDr6Zeroed = 0; 99 110 100 111 … … 3044 3055 # endif 3045 3056 #endif 3057 3058 /* 3059 * For detecting whether DR6.RTM is writable or not (done in VMXR0InitVM). 3060 */ 3061 RTTHREADPREEMPTSTATE Preempt = RTTHREADPREEMPTSTATE_INITIALIZER; 3062 RTThreadPreemptDisable(&Preempt); 3063 RTCCUINTXREG const fSavedDr6 = ASMGetDR6(); 3064 ASMSetDR6(0); 3065 RTCCUINTXREG const fZeroDr6 = ASMGetDR6(); 3066 ASMSetDR6(fSavedDr6); 3067 RTThreadPreemptRestore(&Preempt); 3068 3069 g_fDr6Zeroed = fZeroDr6; 3070 3046 3071 return VINF_SUCCESS; 3047 3072 } … … 3151 3176 *(uint64_t *)(pVM->hmr0.s.vmx.pbScratch + 16) = UINT64_C(0xdeadbeefdeadbeef); 3152 3177 #endif 3178 3179 /* 3180 * Copy out stuff that's for ring-3 and determin default configuration. 3181 */ 3182 pVM->hm.s.ForR3.vmx.u64HostDr6Zeroed = g_fDr6Zeroed; 3183 3184 /* Since we do not emulate RTM, make sure DR6.RTM cannot be cleared by the 3185 guest and cause confusion there. It appears that the DR6.RTM bit can be 3186 cleared even if TSX-NI is disabled (microcode update / system / whatever). */ 3187 #ifdef VMX_WITH_MAYBE_ALWAYS_INTERCEPT_MOV_DRX 3188 if (pVM->hm.s.vmx.fAlwaysInterceptMovDRxCfg == 0) 3189 pVM->hmr0.s.vmx.fAlwaysInterceptMovDRx = g_fDr6Zeroed != X86_DR6_RA1_MASK; 3190 else 3191 #endif 3192 pVM->hmr0.s.vmx.fAlwaysInterceptMovDRx = pVM->hm.s.vmx.fAlwaysInterceptMovDRxCfg > 0; 3193 pVM->hm.s.ForR3.vmx.fAlwaysInterceptMovDRx = pVM->hmr0.s.vmx.fAlwaysInterceptMovDRx; 3194 3153 3195 return VINF_SUCCESS; 3154 3196 } … … 3802 3844 3803 3845 bool fSteppingDB = false; 3804 bool fInterceptMovDRx = false;3805 3846 uint32_t uProcCtls = pVmcsInfo->u32ProcCtls; 3806 3847 if (pVCpu->hm.s.fSingleInstruction) … … 3821 3862 } 3822 3863 3864 #ifdef VMX_WITH_MAYBE_ALWAYS_INTERCEPT_MOV_DRX 3865 bool fInterceptMovDRx = pVCpu->CTX_SUFF(pVM)->hmr0.s.vmx.fAlwaysInterceptMovDRx; 3866 #else 3867 bool fInterceptMovDRx = false; 3868 #endif 3823 3869 uint64_t u64GuestDr7; 3824 3870 if ( fSteppingDB … … 3860 3906 STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxArmed); 3861 3907 } 3908 #ifndef VMX_WITH_MAYBE_ALWAYS_INTERCEPT_MOV_DRX 3862 3909 Assert(!fInterceptMovDRx); 3910 #endif 3863 3911 } 3864 3912 else if (!CPUMIsGuestDebugStateActive(pVCpu)) … … 4607 4655 4608 4656 /* Restore host debug registers if necessary. We will resync on next R0 reentry. */ 4609 #ifdef VBOX_STRICT 4610 if (CPUMIsHyperDebugStateActive(pVCpu)) 4611 Assert(pVmcsInfo->u32ProcCtls & VMX_PROC_CTLS_MOV_DR_EXIT); 4657 #ifdef VMX_WITH_MAYBE_ALWAYS_INTERCEPT_MOV_DRX 4658 Assert( (pVmcsInfo->u32ProcCtls & VMX_PROC_CTLS_MOV_DR_EXIT) 4659 || (!CPUMIsHyperDebugStateActive(pVCpu) && !pVCpu->CTX_SUFF(pVM)->hmr0.s.vmx.fAlwaysInterceptMovDRx)); 4660 #else 4661 Assert((pVmcsInfo->u32ProcCtls & VMX_PROC_CTLS_MOV_DR_EXIT) || !CPUMIsHyperDebugStateActive(pVCpu)); 4612 4662 #endif 4613 4663 CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, true /* save DR6 */); … … 5497 5547 | (pVmcsInfoGst->u32ProcCtls & ~( VMX_PROC_CTLS_INT_WINDOW_EXIT 5498 5548 | VMX_PROC_CTLS_NMI_WINDOW_EXIT 5499 | VMX_PROC_CTLS_MOV_DR_EXIT 5549 | VMX_PROC_CTLS_MOV_DR_EXIT /* hmR0VmxExportSharedDebugState makes 5550 sure guest DRx regs are loaded. */ 5500 5551 | VMX_PROC_CTLS_USE_TPR_SHADOW 5501 5552 | VMX_PROC_CTLS_MONITOR_TRAP_FLAG));
Note:
See TracChangeset
for help on using the changeset viewer.