Index: /trunk/src/VBox/VMM/VMMAll/APICAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 60458)
+++ /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 60459)
@@ -158,5 +158,5 @@
  * @param   idxFragment     The index of the 32-bit fragment in @a
  *                          pApicReg.
- * @param   u32Fragment     The 32-bit vector fragment.
+ * @param   u32Fragment     The 32-bit vector fragment to OR.
  */
 DECLINLINE(void) apicOrVectorsToReg(volatile XAPIC256BITREG *pApicReg, size_t idxFragment, uint32_t u32Fragment)
@@ -164,4 +164,20 @@
     Assert(idxFragment < RT_ELEMENTS(pApicReg->u));
     ASMAtomicOrU32(&pApicReg->u[idxFragment].u32Reg, u32Fragment);
+}
+
+
+/**
+ * Atomically AND's a fragment (32 vectors) into an APIC
+ * 256-bit sparse register.
+ *
+ * @param   pApicReg        The APIC 256-bit spare register.
+ * @param   idxFragment     The index of the 32-bit fragment in @a
+ *                          pApicReg.
+ * @param   u32Fragment     The 32-bit vector fragment to AND.
+ */
+DECLINLINE(void) apicAndVectorsToReg(volatile XAPIC256BITREG *pApicReg, size_t idxFragment, uint32_t u32Fragment)
+{
+    Assert(idxFragment < RT_ELEMENTS(pApicReg->u));
+    ASMAtomicAndU32(&pApicReg->u[idxFragment].u32Reg, u32Fragment);
 }
 
@@ -1290,5 +1306,5 @@
 {
     Assert(pApicCpu);
-    Assert(TMTimerIsLockOwner(CTX_SUFF(pApicCpu->pTimer)));
+    Assert(TMTimerIsLockOwner(pApicCpu->CTX_SUFF(pTimer)));
 
     if (   pApicCpu->uHintedTimerInitialCount != uInitialCount
@@ -2397,5 +2413,5 @@
 
 /**
- * Updates pending interrupts from the pending interrupt bitmap to the IRR.
+ * Updates pending interrupts from the pending-interrupt bitmaps to the IRR.
  *
  * @param   pVCpu               The cross context virtual CPU structure.
@@ -2407,4 +2423,6 @@
     PAPICCPU   pApicCpu   = VMCPU_TO_APICCPU(pVCpu);
     PXAPICPAGE pXApicPage = VMCPU_TO_XAPICPAGE(pVCpu);
+
+    /* Update edge-triggered pending interrupts. */
     for (;;)
     {
@@ -2418,5 +2436,27 @@
             uint32_t const uFragment = ASMAtomicXchgU32(&pPib->aVectorBitmap[i], 0);
             if (uFragment)
+            {
+                apicOrVectorsToReg(&pXApicPage->irr,  i,  uFragment);
+                apicAndVectorsToReg(&pXApicPage->tmr, i, ~uFragment);
+            }
+        }
+    }
+
+    /* Update level-triggered pending interrupts. */
+    for (;;)
+    {
+        bool const fAlreadySet = apicClearNotificationBitInPib(&pApicCpu->ApicPibLevel);
+        if (!fAlreadySet)
+            break;
+
+        PAPICPIB pPib = (PAPICPIB)&pApicCpu->ApicPibLevel;
+        for (size_t i = 0; i < RT_ELEMENTS(pPib->aVectorBitmap); i++)
+        {
+            uint32_t const uFragment = ASMAtomicXchgU32(&pPib->aVectorBitmap[i], 0);
+            if (uFragment)
+            {
                 apicOrVectorsToReg(&pXApicPage->irr, i, uFragment);
+                apicOrVectorsToReg(&pXApicPage->tmr, i, uFragment);
+            }
         }
     }
Index: /trunk/src/VBox/VMM/VMMR3/APIC.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/APIC.cpp	(revision 60458)
+++ /trunk/src/VBox/VMM/VMMR3/APIC.cpp	(revision 60459)
@@ -384,4 +384,6 @@
     VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu);
 
+    LogFlow(("APIC%u: APICR3Reset\n", pVCpu->idCpu));
+
 #ifdef RT_STRICT
     /* Verify that the initial APIC ID reported via CPUID matches our VMCPU ID assumption. */
@@ -429,4 +431,5 @@
 {
     VMCPU_ASSERT_EMT(pVCpu);
+    LogFlow(("APIC%u: APICR3InitIpi\n", pVCpu->idCpu));
     apicR3InitIpi(pVCpu);
 }
