Index: /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 46491)
+++ /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 46492)
@@ -5655,17 +5655,17 @@
 
         /* Pending HM CR3 sync. */
-        if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_HM_UPDATE_CR3))
+        if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_CR3))
         {
             rc = PGMUpdateCR3(pVCpu, pMixedCtx->cr3);
             Assert(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3);
-            Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_HM_UPDATE_CR3));
+            Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_CR3));
         }
 
         /* Pending HM PAE PDPEs. */
-        if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_HM_UPDATE_PAE_PDPES))
+        if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_PAE_PDPES))
         {
             rc = PGMGstUpdatePaePdpes(pVCpu, &pVCpu->hm.s.aPdpes[0]);
             AssertRC(rc);
-            Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_HM_UPDATE_PAE_PDPES));
+            Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_PAE_PDPES));
         }
 
@@ -5728,5 +5728,5 @@
  * @param   pVCpu           Pointer to the VMCPU.
  */
-static void hmR0VmxTRPMTrapToPendingEvent(PVMCPU pVCpu)
+static void hmR0VmxTrpmTrapToPendingEvent(PVMCPU pVCpu)
 {
     Assert(TRPMHasTrap(pVCpu));
@@ -5773,8 +5773,8 @@
     else if (enmTrpmEvent == TRPM_HARDWARE_INT)
     {
-        if (uVector != X86_XCPT_NMI)
+        if (uVector == X86_XCPT_NMI)
+            u32IntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
+        else
             u32IntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
-        else
-            u32IntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     }
     else if (enmTrpmEvent == TRPM_SOFTWARE_INT)
@@ -5797,5 +5797,5 @@
  * @param   pvCpu           Pointer to the VMCPU.
  */
-static void hmR0VmxPendingEventToTRPMTrap(PVMCPU pVCpu)
+static void hmR0VmxPendingEventToTrpmTrap(PVMCPU pVCpu)
 {
     Assert(pVCpu->hm.s.Event.fPending);
@@ -5837,4 +5837,5 @@
     if (fErrorCodeValid)
         TRPMSetErrorCode(pVCpu, uErrorCode);
+
     if (   uVectorType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
         && uVector == X86_XCPT_PF)
@@ -5952,5 +5953,5 @@
     if (pVCpu->hm.s.Event.fPending)
     {
-        hmR0VmxPendingEventToTRPMTrap(pVCpu);
+        hmR0VmxPendingEventToTrpmTrap(pVCpu);
         Assert(!pVCpu->hm.s.Event.fPending);
     }
@@ -6711,5 +6712,5 @@
  * recompiler. We must be cautious what we do here regarding committing
  * guest-state information into the the VMCS assuming we assuredly execute the
- * guest in VT-x. If we fall back to the recompiler after updating VMCS and
+ * guest in VT-x. If we fall back to the recompiler after updating the VMCS and
  * clearing the common-state (TRPM/forceflags), we must undo those changes so
  * that the recompiler can (and should) use them when it resumes guest
@@ -6787,5 +6788,5 @@
     /** @todo Rework event evaluation and injection to be completely separate. */
     if (TRPMHasTrap(pVCpu))
-        hmR0VmxTRPMTrapToPendingEvent(pVCpu);
+        hmR0VmxTrpmTrapToPendingEvent(pVCpu);
 
     rc = hmR0VmxInjectPendingEvent(pVCpu, pMixedCtx);
