Changeset 48044 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Aug 25, 2013 7:21:27 PM (11 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR0
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r48037 r48044 1492 1492 * @returns VBox status code. 1493 1493 * @param pVCpu Pointer to the VMCPU. 1494 * 1495 * @remarks No-long-jump zone!!! 1494 1496 */ 1495 1497 VMMR0_INT_DECL(int) HMR0LeaveCpu(PVMCPU pVCpu) -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r48037 r48044 1947 1947 DECLINLINE(void) hmR0SvmLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1948 1948 { 1949 HM_DISABLE_PREEMPT_IF_NEEDED(); 1949 1950 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 1950 1951 /* Avoid repeating this work when thread-context hooks are used and we had been preempted before 1952 which would've done this work from the VMXR0ThreadCtxCallback(). */ 1953 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; 1954 bool fPreemptDisabled = false; 1955 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 1956 { 1957 Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu)); 1958 RTThreadPreemptDisable(&PreemptState); 1959 fPreemptDisabled = true; 1960 } 1961 1951 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 1952 1953 /* When thread-context hooks are used, we can avoid doing the leave again if we had been preempted before 1954 and done this from the VMXR0ThreadCtxCallback(). */ 1962 1955 if (!pVCpu->hm.s.fLeaveDone) 1963 1956 { … … 1976 1969 AssertRC(rc); NOREF(rc); 1977 1970 1978 /* Restore preemption if we previous disabled it ourselves. */ 1979 if (fPreemptDisabled) 1980 RTThreadPreemptRestore(&PreemptState); 1971 HM_RESTORE_PREEMPT_IF_NEEDED(); 1981 1972 } 1982 1973 -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r48041 r48044 6089 6089 static void hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx) 6090 6090 { 6091 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 6091 6092 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 6092 6093 Assert(VMMR0IsLogFlushDisabled(pVCpu)); … … 6160 6161 DECLINLINE(void) hmR0VmxLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx) 6161 6162 { 6163 HM_DISABLE_PREEMPT_IF_NEEDED(); 6162 6164 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 6163 6164 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; 6165 bool fPreemptDisabled = false; 6166 if (RTThreadPreemptIsEnabled(NIL_RTTHREAD)) 6167 { 6168 Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu)); 6169 RTThreadPreemptDisable(&PreemptState); 6170 fPreemptDisabled = true; 6171 } 6172 6173 /* Avoid repeating this work when thread-context hooks are used and we had been preempted before 6174 which would've done this work from the VMXR0ThreadCtxCallback(). */ 6165 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 6166 6167 /* When thread-context hooks are used, we can avoid doing the leave again if we had been preempted before 6168 and done this from the VMXR0ThreadCtxCallback(). */ 6175 6169 if (!pVCpu->hm.s.fLeaveDone) 6176 6170 { … … 6189 6183 AssertRC(rc); NOREF(rc); 6190 6184 6191 /* Restore preemption if we previous disabled it ourselves. */ 6192 if (fPreemptDisabled) 6193 RTThreadPreemptRestore(&PreemptState); 6185 HM_RESTORE_PREEMPT_IF_NEEDED(); 6194 6186 } 6195 6187 … … 9660 9652 { 9661 9653 STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIoCheck); 9654 9655 /* We're playing with the host CPU state here, make sure we don't preempt. */ 9656 HM_DISABLE_PREEMPT_IF_NEEDED(); 9662 9657 bool fIsGuestDbgActive = CPUMR0DebugStateMaybeSaveGuest(pVCpu, true /*fDr6*/); 9663 9658 … … 9677 9672 && (rcStrict == VINF_SUCCESS || rcStrict2 < rcStrict)) 9678 9673 rcStrict = rcStrict2; 9674 9675 HM_RESTORE_PREEMPT_IF_NEEDED(); 9679 9676 } 9680 9677 } … … 9882 9879 } 9883 9880 9881 /* We're playing with the host CPU state here, make sure we can't preempt. */ 9882 HM_DISABLE_PREEMPT_IF_NEEDED(); 9883 9884 9884 /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */ 9885 9885 PVM pVM = pVCpu->CTX_SUFF(pVM); 9886 9886 CPUMR0LoadGuestDebugState(pVCpu, true /* include DR6 */); 9887 9887 Assert(CPUMIsGuestDebugStateActive(pVCpu)); 9888 9889 HM_RESTORE_PREEMPT_IF_NEEDED(); 9888 9890 9889 9891 #ifdef VBOX_WITH_STATISTICS … … 10148 10150 * (See Intel spec. 27.1 "Architectural State before a VM-Exit".) 10149 10151 */ 10152 HM_DISABLE_PREEMPT_IF_NEEDED(); 10153 10150 10154 pMixedCtx->dr[6] &= ~X86_DR6_B_MASK; 10151 10155 pMixedCtx->dr[6] |= uDR6; 10152 10156 if (CPUMIsGuestDebugStateActive(pVCpu)) 10153 10157 ASMSetDR6(pMixedCtx->dr[6]); 10158 10159 HM_RESTORE_PREEMPT_IF_NEEDED(); 10154 10160 10155 10161 rc = hmR0VmxSaveGuestDR7(pVCpu, pMixedCtx); … … 10206 10212 AssertRCReturn(rc, rc); 10207 10213 10214 /* We're playing with the host CPU state here, have to disable preemption. */ 10215 HM_DISABLE_PREEMPT_IF_NEEDED(); 10216 10208 10217 /* Lazy FPU loading; load the guest-FPU state transparently and continue execution of the guest. */ 10209 10218 PVM pVM = pVCpu->CTX_SUFF(pVM); … … 10212 10221 { 10213 10222 Assert(CPUMIsGuestFPUStateActive(pVCpu)); 10223 HM_RESTORE_PREEMPT_IF_NEEDED(); 10224 10214 10225 pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR0; 10215 10226 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitShadowNM); 10216 10227 return VINF_SUCCESS; 10217 10228 } 10229 10230 HM_RESTORE_PREEMPT_IF_NEEDED(); 10218 10231 10219 10232 /* Forward #NM to the guest. */ -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r48038 r48044 901 901 { 902 902 #ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION 903 Assert(!VMMR0ThreadCtxHooksAreRegistered(pVCpu)); 903 904 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; 904 905 RTThreadPreemptDisable(&PreemptState); … … 940 941 /* Enter HM context. */ 941 942 rc = HMR0Enter(pVM, pVCpu); 942 943 /* When preemption hooks are in place, enable preemption now that we're in HM context. */944 if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))945 {946 fPreemptRestored = true;947 RTThreadPreemptRestore(&PreemptState);948 }949 950 943 if (RT_SUCCESS(rc)) 951 944 { 952 945 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_HM); 953 946 947 /* When preemption hooks are in place, enable preemption now that we're in HM context. */ 948 if (VMMR0ThreadCtxHooksAreRegistered(pVCpu)) 949 { 950 fPreemptRestored = true; 951 RTThreadPreemptRestore(&PreemptState); 952 } 953 954 954 /* Setup the longjmp machinery and execute guest code. */ 955 955 rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, HMR0RunGuestCode, pVM, pVCpu); 956 956 957 /* Leave HM context. This deregisters thread-context hooks if any.*/957 /* Leave HM context. */ 958 958 int rc2 = HMR0Leave(pVM, pVCpu); 959 959 AssertRC(rc2);
Note:
See TracChangeset
for help on using the changeset viewer.