Index: /trunk/src/VBox/VMM/EM.cpp
===================================================================
--- /trunk/src/VBox/VMM/EM.cpp	(revision 272)
+++ /trunk/src/VBox/VMM/EM.cpp	(revision 273)
@@ -81,5 +81,5 @@
 static int emR3RawForcedActions(PVM pVM, PCPUMCTX pCtx);
 static int emR3RawExecute(PVM pVM, bool *pfFFDone);
-DECLINLINE(int) emR3RawExecuteInstruction(PVM pVM, const char *pszPrefix);
+DECLINLINE(int) emR3RawExecuteInstruction(PVM pVM, const char *pszPrefix, int gcret = VINF_SUCCESS);
 static int emR3HighPriorityPostForcedActions(PVM pVM, int rc);
 static int emR3ForcedActions(PVM pVM, int rc);
@@ -950,11 +950,12 @@
  *
  * @param   pVM         VM handle.
+ * @param   gcret       GC return code
  * @param   pszPrefix   Disassembly prefix. If not NULL we'll disassemble the
  *                      instruction and prefix the log output with this text.
  */
 #ifdef LOG_ENABLED
-static int emR3RawExecuteInstructionWorker(PVM pVM, const char *pszPrefix)
+static int emR3RawExecuteInstructionWorker(PVM pVM, int gcret, const char *pszPrefix)
 #else
-static int emR3RawExecuteInstructionWorker(PVM pVM)
+static int emR3RawExecuteInstructionWorker(PVM pVM, int gcret)
 #endif
 {
@@ -1015,4 +1016,10 @@
                     Log(("PATCH: IF=1 -> emulate last instruction as it can't be interrupted!!\n"));
                     return emR3RawExecuteInstruction(pVM, "PATCHIR");
+                }
+                else
+                if (gcret == VINF_PATM_PENDING_IRQ_AFTER_IRET)
+                {
+                    /* special case: iret, that sets IF,  detected a pending irq/event */
+                    return emR3RawExecuteInstruction(pVM, "PATCHIRET");
                 }
                 return VINF_EM_RESCHEDULE_REM;
@@ -1102,11 +1109,12 @@
  * @param   pszPrefix   Disassembly prefix. If not NULL we'll disassemble the
  *                      instruction and prefix the log output with this text.
+ * @param   gcret       GC return code
  */
-DECLINLINE(int) emR3RawExecuteInstruction(PVM pVM, const char *pszPrefix)
+DECLINLINE(int) emR3RawExecuteInstruction(PVM pVM, const char *pszPrefix, int gcret)
 {
 #ifdef LOG_ENABLED
-    return emR3RawExecuteInstructionWorker(pVM, pszPrefix);
+    return emR3RawExecuteInstructionWorker(pVM, gcret, pszPrefix);
 #else
-    return emR3RawExecuteInstructionWorker(pVM);
+    return emR3RawExecuteInstructionWorker(pVM, gcret);
 #endif
 }
@@ -1709,10 +1717,4 @@
                     return VINF_SUCCESS; */
                 }
-                else 
-                if (gcret == VINF_PATM_PENDING_IRQ_AFTER_IRET)
-                {
-                    /* special case: iret, that sets IF,  detected a pending irq/event */
-                    return emR3RawExecuteInstruction(pVM, "PATCHIRET");
-                }
                 return VINF_EM_RESCHEDULE_REM;
             }
@@ -2063,5 +2065,4 @@
         case VINF_PATM_PATCH_TRAP_PF:
         case VINF_PATM_PATCH_INT3:
-        case VINF_PATM_PENDING_IRQ_AFTER_IRET:
             rc = emR3PatchTrap(pVM, pCtx, rc);
             break;
@@ -2215,4 +2216,8 @@
             /** @todo skip instruction and go directly to the halt state. (see REM for implementation details) */
             rc = emR3RawPrivileged(pVM);
+            break;
+
+        case VINF_PATM_PENDING_IRQ_AFTER_IRET:
+            rc = emR3RawExecuteInstruction(pVM, "EMUL: ", VINF_PATM_PENDING_IRQ_AFTER_IRET);
             break;
 
