Index: trunk/include/VBox/iom.h
===================================================================
--- trunk/include/VBox/iom.h	(revision 2503)
+++ trunk/include/VBox/iom.h	(revision 2504)
@@ -262,5 +262,9 @@
  * Reads an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -274,5 +278,9 @@
  * Writes to an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -286,5 +294,12 @@
  * OUT <DX|imm16>, <AL|AX|EAX>
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -297,5 +312,12 @@
  * IN <AL|AX|EAX>, <DX|imm16>
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -309,5 +331,9 @@
  * Reads the string buffer of an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -322,6 +348,10 @@
  * Writes the string buffer of an I/O port register.
  *
- * @returns VBox status code.
- *
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * 
  * @param   pVM         VM handle.
  * @param   Port        The port to write.
@@ -336,5 +366,12 @@
  * ES:EDI,DX[,ECX]
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -348,7 +385,14 @@
  * ES:EDI,DX[,ECX]
  *
- * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
- *
- * @returns VBox status code.
+ * @remark Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
+ *
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM             The virtual machine (GC pointer ofcourse).
@@ -364,5 +408,12 @@
  * DS:ESI,DX[,ECX]
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -376,7 +427,14 @@
  * DS:ESI,DX[,ECX]
  *
- * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
- *
- * @returns VBox status code.
+ * @remark  Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
+ *
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM             The virtual machine (GC pointer ofcourse).
@@ -424,6 +482,10 @@
  * level and I/O bitmap.
  *
- * @returns VBox status code.
- *          If not VINF_SUCCESS a \#GP(0) was raised or an error occured.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         VM handle.
@@ -445,7 +507,14 @@
  *
  * The \#GP trap handler in GC will call this function if the opcode causing the
- * trap is a in or out type instruction.
- *
- * @returns VBox status code.
+ * trap is a in or out type instruction. (Call it indirectly via EM that is.)
+ *
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
Index: trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 2503)
+++ trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 2504)
@@ -719,5 +719,9 @@
  * Reads an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -857,5 +861,9 @@
  * Reads the string buffer of an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -978,5 +986,9 @@
  * Writes to an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -1089,8 +1101,14 @@
     return VINF_SUCCESS;
 }
+
+
 /**
  * Writes the string buffer of an I/O port register.
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
  *
  * @param   pVM         VM handle.
@@ -1208,10 +1226,15 @@
 }
 
+
 /**
  * Checks that the operation is allowed according to the IOPL
  * level and I/O bitmap.
  *
- * @returns VBox status code.
- *          If not VINF_SUCCESS a \#GP(0) was raised or an error occured.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         VM handle.
@@ -1303,5 +1326,12 @@
  * IN <AL|AX|EAX>, <DX|imm16>
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -1334,5 +1364,6 @@
         uint32_t    u32Data = ~0U;
         rc = IOMIOPortRead(pVM, uPort, &u32Data, cbSize);
-        if (rc == VINF_SUCCESS)
+        if (    rc == VINF_SUCCESS
+            ||  (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST))
         {
             /*
@@ -1342,5 +1373,9 @@
             AssertMsg(fRc, ("Failed to store register value!\n")); NOREF(fRc);
         }
-    }
+        else
+            AssertMsg(rc == VINF_IOM_HC_IOPORT_READ || VBOX_FAILURE(rc), ("%Vrc\n", rc));
+    }
+    else
+        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
     return rc;
 }
@@ -1350,5 +1385,12 @@
  * OUT <DX|imm16>, <AL|AX|EAX>
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -1379,8 +1421,11 @@
 
         /*
-         * Attemp to write to the port.
+         * Attempt to write to the port.
          */
         rc = IOMIOPortWrite(pVM, uPort, u32Data, cbSize);
-    }
+        AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
+    }
+    else
+        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
     return rc;
 }
Index: trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp	(revision 2503)
+++ trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp	(revision 2504)
@@ -460,5 +460,5 @@
 
 
-inline int iomRamRead(PVM pVM, void *pDest, RTGCPTR GCSrc, uint32_t cb)
+DECLINLINE(int) iomRamRead(PVM pVM, void *pDest, RTGCPTR GCSrc, uint32_t cb)
 {
 #ifdef IN_GC
@@ -479,5 +479,5 @@
 }
 
-inline int iomRamWrite(PVM pVM, RTGCPTR GCDest, void *pSrc, uint32_t cb)
+DECLINLINE(int) iomRamWrite(PVM pVM, RTGCPTR GCDest, void *pSrc, uint32_t cb)
 {
 #ifdef IN_GC
@@ -1589,7 +1589,14 @@
  * ES:EDI,DX[,ECX]
  *
- * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
- *
- * @returns VBox status code.
+ * @remark Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
+ *
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM             The virtual machine (GC pointer ofcourse).
@@ -1601,6 +1608,4 @@
 IOMDECL(int) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
 {
-    int rc = VINF_SUCCESS;
-
 #ifdef VBOX_WITH_STATISTICS
     STAM_COUNTER_INC(&pVM->iom.s.StatGCInstIns);
@@ -1628,7 +1633,7 @@
     /* Convert destination address es:edi. */
     RTGCPTR GCPtrDst;
-    rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->es, (RTGCPTR)pRegFrame->edi, &pRegFrame->esHid, 
-                      SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
-                      &GCPtrDst, NULL);
+    int rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->es, (RTGCPTR)pRegFrame->edi, &pRegFrame->esHid, 
+                          SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
+                          &GCPtrDst, NULL);
     if (VBOX_FAILURE(rc))
     {
@@ -1683,4 +1688,5 @@
         pRegFrame->ecx = cTransfers;
 
+    AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_READ || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
     return rc;
 }
@@ -1691,5 +1697,12 @@
  * ES:EDI,DX[,ECX]
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -1712,8 +1725,12 @@
     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
     if (RT_UNLIKELY(rc != VINF_SUCCESS))
+    {
+        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
         return rc;
+    }
 
     return IOMInterpretINSEx(pVM, pRegFrame, uPort, pCpu->prefix, cbSize);
 }
+
 
 /**
@@ -1721,7 +1738,14 @@
  * DS:ESI,DX[,ECX]
  *
- * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
- *
- * @returns VBox status code.
+ * @remark  Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
+ *
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM             The virtual machine (GC pointer ofcourse).
@@ -1733,6 +1757,4 @@
 IOMDECL(int) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)
 {
-    int rc = VINF_SUCCESS;
-
 #ifdef VBOX_WITH_STATISTICS
     STAM_COUNTER_INC(&pVM->iom.s.StatGCInstOuts);
@@ -1760,10 +1782,10 @@
     /* Convert source address ds:esi. */
     RTGCPTR GCPtrSrc;
-    rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->ds, (RTGCPTR)pRegFrame->esi, &pRegFrame->dsHid,
-                      SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
-                      &GCPtrSrc, NULL);
+    int rc = SELMToFlatEx(pVM, pRegFrame->eflags, pRegFrame->ds, (RTGCPTR)pRegFrame->esi, &pRegFrame->dsHid,
+                          SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,
+                          &GCPtrSrc, NULL);
     if (VBOX_FAILURE(rc))
     {
-        Log(("OUTS source address conversion failed -> fallback, rc=%d\n", rc));
+        Log(("OUTS source address conversion failed -> fallback, rc=%Vrc\n", rc));
         return VINF_IOM_HC_IOPORT_WRITE;
     }
@@ -1775,5 +1797,5 @@
     if (rc != VINF_SUCCESS)
     {
-        Log(("OUTS will generate a trap -> fallback, rc=%d\n", rc));
+        Log(("OUTS will generate a trap -> fallback, rc=%Vrc\n", rc));
         return VINF_IOM_HC_IOPORT_WRITE;
     }
@@ -1783,7 +1805,7 @@
     {
         /*
-        * If the device supports string transfers, ask it to do as
-        * much as it wants. The rest is done with single-word transfers.
-        */
+         * If the device supports string transfers, ask it to do as
+         * much as it wants. The rest is done with single-word transfers.
+         */
         const RTGCUINTREG cTransfersOrg = cTransfers;
         rc = IOMIOPortWriteString(pVM, uPort, &GCPtrSrc, &cTransfers, cbTransfer);
@@ -1803,5 +1825,5 @@
             break;
         rc = IOMIOPortWrite(pVM, uPort, u32Value, cbTransfer);
-        if (rc == VINF_IOM_HC_IOPORT_WRITE)
+        if (rc == VINF_IOM_HC_IOPORT_WRITE || VBOX_FAILURE(rc))
             break;
         GCPtrSrc = (RTGCPTR)((RTUINTPTR)GCPtrSrc + cbTransfer);
@@ -1817,7 +1839,8 @@
     if (uPrefix & PREFIX_REP)
         pRegFrame->ecx = cTransfers;
+
+    AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
     return rc;
 }
-
 
 
@@ -1826,5 +1849,12 @@
  * DS:ESI,DX[,ECX]
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_WRITE    Defer the write to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
@@ -1849,6 +1879,10 @@
     int rc = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);
     if (RT_UNLIKELY(rc != VINF_SUCCESS))
+    {
+        AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
         return rc;
+    }
 
     return IOMInterpretOUTSEx(pVM, pRegFrame, uPort, pCpu->prefix, cbSize);
 }
+
Index: trunk/src/VBox/VMM/VMMGC/IOMGC.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMGC/IOMGC.cpp	(revision 2503)
+++ trunk/src/VBox/VMM/VMMGC/IOMGC.cpp	(revision 2504)
@@ -51,7 +51,14 @@
  *
  * The \#GP trap handler in GC will call this function if the opcode causing the
- * trap is a in or out type instruction.
+ * trap is a in or out type instruction. (Call it indirectly via EM that is.)
  *
- * @returns VBox status code.
+ * @returns Strict VBox status code. Informational status codes other than the one documented 
+ *          here are to be treated as internal failure.
+ * @retval  VINF_SUCCESS                Success.
+ * @retval  VINF_EM_FIRST-VINF_EM_LAST  Success but schedulinging information needs to be passed onto EM.
+ * @retval  VINF_IOM_HC_IOPORT_READ     Defer the read to ring-3. (R0/GC only)
+ * @retval  VINF_EM_RAW_GUEST_TRAP      The exception was left pending. (TRPMRaiseXcptErr)
+ * @retval  VINF_TRPM_XCPT_DISPATCHED   The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
+ * @retval  VINF_EM_RESCHEDULE_REM      The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
  *
  * @param   pVM         The virtual machine (GC pointer ofcourse).
