Index: /trunk/src/VBox/VMM/VMMAll/EMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/EMAll.cpp	(revision 41822)
+++ /trunk/src/VBox/VMM/VMMAll/EMAll.cpp	(revision 41823)
@@ -380,5 +380,11 @@
 {
     RTGCPTR GCPtrInstr;
+#if 0
     int rc = SELMToFlatEx(pVCpu, DISSELREG_CS, pCtxCore, pCtxCore->rip, 0, &GCPtrInstr);
+#else
+/** @todo Get the CPU mode as well while we're at it! */
+    int rc = SELMValidateAndConvertCSAddr(pVCpu, pCtxCore->eflags, pCtxCore->ss, pCtxCore->cs,
+                                          &pCtxCore->csHid, pCtxCore->rip, &GCPtrInstr);
+#endif
     if (RT_FAILURE(rc))
     {
@@ -406,7 +412,10 @@
  * @param   pcbInstr        Where to return the instruction size. (optional)
  */
-VMMDECL(int) EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore, PDISCPUSTATE pDis, unsigned *pcbInstr)
+VMMDECL(int) EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore,
+                                   PDISCPUSTATE pDis, unsigned *pcbInstr)
 {
     DISCPUMODE enmCpuMode = SELMGetCpuModeFromSelector(pVCpu, pCtxCore->eflags, pCtxCore->cs, (PCPUMSELREGHID)&pCtxCore->csHid);
+    /** @todo Deal with too long instruction (=> \#GP), opcode read errors (=>
+     *        \#PF, \#GP, \#??), undefined opcodes (=> \#UD), and such. */
     int rc = DISInstrWithReader(GCPtrInstr, enmCpuMode, emReadBytes, pVCpu, pDis, pcbInstr);
     if (RT_SUCCESS(rc))
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllBth.h	(revision 41822)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllBth.h	(revision 41823)
@@ -906,20 +906,14 @@
                  * Decode the instruction.
                  */
-                RTGCPTR PC;
-                rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss, pRegFrame->cs,
-                                                  &pRegFrame->csHid, (RTGCPTR)pRegFrame->eip, &PC);
-                if (rc == VINF_SUCCESS)
+                PDISCPUSTATE pDis = &pVCpu->pgm.s.DisState;
+                uint32_t     cbOp;
+                rc = EMInterpretDisasOne(pVM, pVCpu, pRegFrame, pDis, &cbOp);
+
+                /* For now we'll restrict this to rep movsw/d instructions */
+                if (    rc == VINF_SUCCESS
+                    &&  pDis->pCurInstr->opcode == OP_MOVSWD
+                    &&  (pDis->prefix & DISPREFIX_REP))
                 {
-                    PDISCPUSTATE pDis = &pVCpu->pgm.s.DisState;
-                    uint32_t     cbOp;
-                    rc = EMInterpretDisasOneEx(pVM, pVCpu, PC, pRegFrame, pDis, &cbOp);
-
-                    /* For now we'll restrict this to rep movsw/d instructions */
-                    if (    rc == VINF_SUCCESS
-                        &&  pDis->pCurInstr->opcode == OP_MOVSWD
-                        &&  (pDis->prefix & DISPREFIX_REP))
-                    {
-                        CSAMMarkPossibleCodePage(pVM, pvFault);
-                    }
+                    CSAMMarkPossibleCodePage(pVM, pvFault);
                 }
             }
Index: /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp	(revision 41822)
+++ /trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp	(revision 41823)
@@ -2974,24 +2974,12 @@
     if (enmMode != DISCPUMODE_16BIT)
     {
-        RTGCPTR pbCode;
-        int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss, pRegFrame->cs,
-                                              &pRegFrame->csHid, (RTGCPTR)pRegFrame->rip, &pbCode);
-        if (RT_SUCCESS(rc))
-        {
-            uint32_t     cbOp;
-            PDISCPUSTATE pDis = &pVCpu->hwaccm.s.DisState;
-
-            pDis->uCpuMode = enmMode;
-            rc = EMInterpretDisasOneEx(pVM, pVCpu, pbCode, pRegFrame, pDis, &cbOp);
-            Assert(RT_FAILURE(rc) || pDis->pCurInstr->uOpcode == OP_INVLPG);
-            if (RT_SUCCESS(rc) && pDis->pCurInstr->uOpcode == OP_INVLPG)
-            {
-                Assert(cbOp == pDis->cbInstr);
-                rc = hmR0svmInterpretInvlPg(pVCpu, pDis, pRegFrame, uASID);
-                if (RT_SUCCESS(rc))
-                    pRegFrame->rip += cbOp; /* Move on to the next instruction. */
-
-                return rc;
-            }
+        PDISSTATE pDis = &pVCpu->hwaccm.s.DisState;
+        int rc = EMInterpretDisasOne(pVM, pVCpu, pRegFrame, pDis, NULL);
+        if (RT_SUCCESS(rc) && pDis->pCurInstr->uOpcode == OP_INVLPG)
+        {
+            rc = hmR0svmInterpretInvlPg(pVCpu, pDis, pRegFrame, uASID);
+            if (RT_SUCCESS(rc))
+                pRegFrame->rip += pDis->cbInstr; /* Move on to the next instruction. */
+            return rc;
         }
     }
Index: /trunk/src/VBox/VMM/VMMRC/TRPMRC.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMRC/TRPMRC.cpp	(revision 41822)
+++ /trunk/src/VBox/VMM/VMMRC/TRPMRC.cpp	(revision 41823)
@@ -172,22 +172,18 @@
     NOREF(uErrorCode); NOREF(offRange);
 
-    /* If we ever get here, then the guest has executed an sidt instruction that we failed to patch. In theory this could be very bad, but
-     * there are nasty applications out there that install device drivers that mess with the guest's IDT. In those cases, it's quite ok
-     * to simply ignore the writes and pretend success.
+    /*
+     * If we ever get here, then the guest has executed an SIDT instruction
+     * that we failed to patch.  In theory this could be very bad, but there
+     * are nasty applications out there that install device drivers that mess
+     * with the guest's IDT.  In those cases, it's quite ok to simply ignore
+     * the writes and pretend success.
      */
-    RTGCPTR PC;
-    int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss, pRegFrame->cs, &pRegFrame->csHid,
-                                          (RTGCPTR)pRegFrame->eip, &PC);
+    DISSTATE Dis;
+    int rc = EMInterpretDisasOne(pVM, pVCpu, pRegFrame, &Dis, NULL);
     if (rc == VINF_SUCCESS)
     {
-        DISCPUSTATE Cpu;
-        uint32_t    cbOp;
-        rc = EMInterpretDisasOneEx(pVM, pVCpu, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);
-        if (rc == VINF_SUCCESS)
-        {
-            /* Just ignore the write. */
-            pRegFrame->eip += Cpu.cbInstr;
-            return VINF_SUCCESS;
-        }
+        /* Just ignore the write. */
+        pRegFrame->eip += Dis.cbInstr;
+        return VINF_SUCCESS;
     }
 
Index: /trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp	(revision 41822)
+++ /trunk/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp	(revision 41823)
@@ -498,5 +498,5 @@
         RTGCPTR PC;
         rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss, pRegFrame->cs, &pRegFrame->csHid,
-                                          (RTGCPTR)pRegFrame->eip, &PC);
+                                          pRegFrame->rip, &PC);
         if (RT_FAILURE(rc))
         {
@@ -955,5 +955,5 @@
     uint32_t cBits;
     int rc = SELMValidateAndConvertCSAddrGCTrap(pVCpu, pRegFrame->eflags, pRegFrame->ss, pRegFrame->cs,
-                                                (RTGCPTR)pRegFrame->eip, &PC, &cBits);
+                                                pRegFrame->rip, &PC, &cBits);
     if (RT_FAILURE(rc))
     {
@@ -969,5 +969,5 @@
     DISCPUSTATE Cpu;
     uint32_t    cbOp;
-    rc = EMInterpretDisasOneEx(pVM, pVCpu, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);
+    rc = EMInterpretDisasOneEx(pVM, pVCpu, PC, pRegFrame, &Cpu, &cbOp);
     if (RT_FAILURE(rc))
     {
Index: /trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp	(revision 41822)
+++ /trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp	(revision 41823)
@@ -127,7 +127,7 @@
         int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss, pRegFrame->cs, &pRegFrame->csHid,
 #ifdef IN_RC
-                                              (RTGCPTR)((RTGCUINTPTR)pRegFrame->eip - 1),
+                                              pRegFrame->eip - 1,
 #else
-                                              (RTGCPTR)pRegFrame->rip /* no -1 in R0 */,
+                                              pRegFrame->rip /* no -1 in R0 */,
 #endif
                                               &pPc);
