Index: /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 45386)
+++ /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 45387)
@@ -376,28 +376,4 @@
 
 /**
- * Disables longjmps to ring-3.
- * @param   pVCpu       Pointer to the VMCPU.
- */
-DECLINLINE(void) hmR0VmxCallRing3Disable(PVMCPU pVCpu)
-{
-    while (VMMRZCallRing3IsEnabled(pVCpu))
-        VMMRZCallRing3Disable(pVCpu);
-    Assert(VMMR0IsLogFlushDisabled(pVCpu));
-}
-
-
-/**
- * Enables longjmps to ring-3.
- * @param   pVCpu       Pointer to the VMCPU.
- */
-DECLINLINE(void) hmR0VmxCallRing3Enable(PVMCPU pVCpu)
-{
-    while (!VMMRZCallRing3IsEnabled(pVCpu))
-        VMMRZCallRing3Enable(pVCpu);
-    Assert(!VMMR0IsLogFlushDisabled(pVCpu));
-}
-
-
-/**
  * Updates the VM's last error record. If there was a VMX instruction error,
  * reads the error data from the VMCS and updates VCPU's last error record as
@@ -6338,5 +6314,5 @@
     {
         ASMSetFlags(pVmxTransient->uEFlags);
-        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPreemptPending);
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
         /* Don't use VINF_EM_RAW_INTERRUPT_HYPER as we can't assume the host does kernel preemption. Maybe some day? */
         return VINF_EM_RAW_INTERRUPT;
@@ -6374,4 +6350,5 @@
 {
     Assert(!VMMRZCallRing3IsEnabled(pVCpu));
+    Assert(VMMR0IsLogFlushDisabled(pVCpu));
 
 #ifndef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
@@ -6486,5 +6463,5 @@
 
     VMMRZCallRing3SetNotification(pVCpu, hmR0VmxCallRing3Callback, pMixedCtx);
-    hmR0VmxCallRing3Enable(pVCpu);                              /* It is now safe to do longjmps to ring-3!!! */
+    VMMRZCallRing3Enable(pVCpu);                                /* It is now safe to do longjmps to ring-3!!! */
 
     /* If the VMLAUNCH/VMRESUME failed, we can bail out early. This does -not- cover VMX_EXIT_ERR_*. */
@@ -6554,5 +6531,5 @@
          * This also disables flushing of the R0-logger instance (if any).
          */
-        hmR0VmxCallRing3Disable(pVCpu);
+        VMMRZCallRing3Disable(pVCpu);
         VMMRZCallRing3RemoveNotification(pVCpu);
         hmR0VmxPreRunGuestCommitted(pVM, pVCpu, pCtx, &VmxTransient);
@@ -6641,5 +6618,5 @@
 {
     VMX_VALIDATE_EXIT_HANDLER_PARAMS();
-    STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
+    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitExtInt);
     return VINF_SUCCESS;
 }
@@ -6655,13 +6632,10 @@
     AssertRCReturn(rc, rc);
 
-    uint8_t u8IntrType = VMX_EXIT_INTERRUPTION_INFO_TYPE(pVmxTransient->uExitIntrInfo);
+    uint32_t uIntrType = VMX_EXIT_INTERRUPTION_INFO_TYPE(pVmxTransient->uExitIntrInfo);
     Assert(   !(pVCpu->hm.s.vmx.u32ExitCtls & VMX_VMCS_CTRL_EXIT_CONTROLS_ACK_EXT_INT)
-           && u8IntrType != VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT);
-
-    if (u8IntrType == VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI)
+           && uIntrType != VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT);
+
+    if (uIntrType == VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI)
         return VINF_EM_RAW_INTERRUPT;
-
-    uint32_t uExitIntrInfo = pVmxTransient->uExitIntrInfo;
-    Assert(VMX_EXIT_INTERRUPTION_INFO_VALID(uExitIntrInfo));
 
     /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
@@ -6672,6 +6646,7 @@
         return rc;
 
-    uint32_t uVector = VMX_EXIT_INTERRUPTION_INFO_VECTOR(uExitIntrInfo);
-    switch (VMX_EXIT_INTERRUPTION_INFO_TYPE(uExitIntrInfo))
+    uint32_t uExitIntrInfo = pVmxTransient->uExitIntrInfo;
+    uint32_t uVector       = VMX_EXIT_INTERRUPTION_INFO_VECTOR(uExitIntrInfo);
+    switch (uIntrType)
     {
         case VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_XCPT:   /* Software exception. (#BP or #OF) */
@@ -6710,6 +6685,6 @@
                         Assert(pVM->hm.s.vmx.pRealModeTSS);
                         Assert(PDMVmmDevHeapIsEnabled(pVM));
-                        rc     = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
-                        rc    |= hmR0VmxReadExitIntrErrorCodeVmcs(pVmxTransient);
+                        rc  = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
+                        rc |= hmR0VmxReadExitIntrErrorCodeVmcs(pVmxTransient);
                         AssertRCReturn(rc, rc);
                         rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
@@ -7508,6 +7483,12 @@
         case VMX_EXIT_QUALIFICATION_CRX_ACCESS_WRITE:       /* MOV to CRx */
         {
+#if 0
             /* EMInterpretCRxWrite() references a lot of guest state (EFER, RFLAGS, Segment Registers, etc.) Sync entire state */
             rc = hmR0VmxSaveGuestState(pVM, pVCpu, pMixedCtx);
+#else
+            rc  = hmR0VmxSaveGuestGprs(pVM, pVCpu, pMixedCtx);
+            rc |= hmR0VmxSaveGuestControlRegs(pVM, pVCpu, pMixedCtx);
+            rc |= hmR0VmxSaveGuestSegmentRegs(pVM, pVCpu, pMixedCtx);
+#endif
             AssertRCReturn(rc, rc);
 
@@ -7552,5 +7533,5 @@
         {
             /* EMInterpretCRxRead() requires EFER MSR, CS. */
-            rc |= hmR0VmxSaveGuestSegmentRegs(pVM, pVCpu, pMixedCtx);
+            rc = hmR0VmxSaveGuestSegmentRegs(pVM, pVCpu, pMixedCtx);
             AssertRCReturn(rc, rc);
             Assert(   !pVM->hm.s.fNestedPaging
@@ -7576,6 +7557,5 @@
             rc |= EMInterpretCLTS(pVM, pVCpu);
             AssertRCReturn(rc, rc);
-            if (RT_LIKELY(rc == VINF_SUCCESS))
-                pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR0;
+            pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR0;
             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitClts);
             Log(("CRX CLTS write rc=%d\n", rc));
@@ -7586,6 +7566,6 @@
         {
             rc  = hmR0VmxSaveGuestCR0(pVM, pVCpu, pMixedCtx);
-            rc |= EMInterpretLMSW(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx), VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(uExitQualification));
             AssertRCReturn(rc, rc);
+            rc = EMInterpretLMSW(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx), VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(uExitQualification));
             if (RT_LIKELY(rc == VINF_SUCCESS))
                 pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR0;
Index: /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp	(revision 45386)
+++ /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp	(revision 45387)
@@ -1376,5 +1376,5 @@
     if (RTThreadPreemptIsPending(NIL_RTTHREAD))
     {
-        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPreemptPending);
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
         rc = VINF_EM_RAW_INTERRUPT;
         goto end;
Index: /trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp	(revision 45386)
+++ /trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp	(revision 45387)
@@ -3150,5 +3150,5 @@
     if (RTThreadPreemptIsPending(NIL_RTTHREAD))
     {
-        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPreemptPending);
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
         rc = VINF_EM_RAW_INTERRUPT;
         goto end;
@@ -3527,4 +3527,5 @@
             Assert(exitReason == VMX_EXIT_EXT_INT);
             /* External interrupt; leave to allow it to be dispatched again. */
+            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitExtInt);
             rc = VINF_EM_RAW_INTERRUPT;
             break;
Index: /trunk/src/VBox/VMM/VMMR3/HM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/HM.cpp	(revision 45386)
+++ /trunk/src/VBox/VMM/VMMR3/HM.cpp	(revision 45387)
@@ -576,5 +576,5 @@
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitIntWindow,          "/HM/CPU%d/Exit/IntWindow");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitMaxResume,          "/HM/CPU%d/Exit/MaxResume");
-        HM_REG_COUNTER(&pVCpu->hm.s.StatExitPreemptPending,     "/HM/CPU%d/Exit/PreemptPending");
+        HM_REG_COUNTER(&pVCpu->hm.s.StatExitExtInt,             "/HM/CPU%d/Exit/ExtInt");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitPreemptTimer,       "/HM/CPU%d/Exit/PreemptTimer");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitTprBelowThreshold,  "/HM/CPU%d/Exit/TprBelowThreshold");
Index: /trunk/src/VBox/VMM/include/HMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/HMInternal.h	(revision 45386)
+++ /trunk/src/VBox/VMM/include/HMInternal.h	(revision 45387)
@@ -854,5 +854,5 @@
     STAMCOUNTER             StatExitIntWindow;
     STAMCOUNTER             StatExitMaxResume;
-    STAMCOUNTER             StatExitPreemptPending;
+    STAMCOUNTER             StatExitExtInt;
     STAMCOUNTER             StatExitPreemptTimer;
     STAMCOUNTER             StatExitTprBelowThreshold;
