- Timestamp:
- May 14, 2015 6:44:04 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100320
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r55863 r55864 1046 1046 { 1047 1047 /* 1048 * Register thread-context hooks if required.1048 * Enable the context switching hook. 1049 1049 */ 1050 if ( pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK 1051 && !RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook)) 1050 if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK) 1052 1051 { 1053 rc = RTThreadCtxHookEnable(pVCpu->vmm.s.hCtxHook);1054 AssertRC(rc);1052 Assert(!RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook)); 1053 int rc2 = RTThreadCtxHookEnable(pVCpu->vmm.s.hCtxHook); AssertRC(rc2); 1055 1054 } 1056 1055 … … 1090 1089 rc = VERR_VMM_WRONG_HM_VMCPU_STATE; 1091 1090 } 1091 /** @todo Get rid of this. HM shouldn't disable the context hook. */ 1092 1092 else if (RT_UNLIKELY(vmmR0ThreadCtxHookIsEnabled(pVCpu))) 1093 1093 { 1094 1094 pVM->vmm.s.szRing0AssertMsg1[0] = '\0'; 1095 1095 RTStrPrintf(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2), 1096 "Thread-context hooks still registered! VCPU=%p Id=%u rc=%d.\n", pVCpu, pVCpu->idCpu, rc);1096 "Thread-context hooks still enabled! VCPU=%p Id=%u rc=%d.\n", pVCpu, pVCpu->idCpu, rc); 1097 1097 rc = VERR_INVALID_STATE; 1098 1098 } … … 1102 1102 STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC); 1103 1103 1104 /** @todo shouldn't we disable the ctx hook here??? */ 1104 /* 1105 * Invalidate the host CPU identifiers before we disable the context 1106 * hook / restore preemption. 1107 */ 1108 pVCpu->iHostCpuSet = UINT32_MAX; 1109 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID); 1110 1111 /* 1112 * Disable context hooks. Due to unresolved cleanup issues, we 1113 * cannot leave the hooks enabled when we return to ring-3. 1114 * 1115 * Note! At the moment HM may also have disabled the hook 1116 * when we get here, but the IPRT API handles that. 1117 */ 1118 if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK) 1119 { 1120 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID); 1121 RTThreadCtxHookDisable(pVCpu->vmm.s.hCtxHook); 1122 } 1105 1123 } 1106 1124 /* … … 1108 1126 */ 1109 1127 else 1128 { 1110 1129 rc = VINF_EM_RAW_INTERRUPT; 1111 1112 /* 1113 * Invalidate the host CPU identifiers as we restore preemption. 1114 */ 1115 pVCpu->iHostCpuSet = UINT32_MAX; 1116 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID); 1117 1130 pVCpu->iHostCpuSet = UINT32_MAX; 1131 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID); 1132 } 1133 1134 /** @todo When HM stops messing with the context hook state, we'll disable 1135 * preemption again before the RTThreadCtxHookDisable call. */ 1118 1136 if (!fPreemptRestored) 1119 1137 RTThreadPreemptRestore(&PreemptState);
Note:
See TracChangeset
for help on using the changeset viewer.