Index: /trunk/src/VBox/VMM/VMMR3/PATM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PATM.cpp	(revision 41769)
+++ /trunk/src/VBox/VMM/VMMR3/PATM.cpp	(revision 41770)
@@ -549,17 +549,19 @@
     if (pDisInfo->fReadFlags & PATMREAD_ORGCODE)
     {
-        for (;;)
-        {
-            int rc = PATMR3QueryOpcode(pDisInfo->pVM, (RTGCPTR32)pDis->uInstrAddr + offInstr, &pDis->abInstr[offInstr]);
-            if (RT_FAILURE(rc))
-                break; /* VERR_PATCH_NOT_FOUND */
-            offInstr++;
-            cbMinRead--;
-            if (cbMinRead == 0)
+        size_t      cbRead   = cbMaxRead;
+        RTUINTPTR   uSrcAddr = pDis->uInstrAddr + offInstr;
+        int rc = PATMR3ReadOrgInstr(pDisInfo->pVM, pDis->uInstrAddr + offInstr, &pDis->abInstr[offInstr], cbRead, &cbRead);
+        if (RT_SUCCESS(rc))
+        {
+            if (cbRead >= cbMinRead)
             {
-                pDis->cbCachedInstr = offInstr;
+                pDis->cbCachedInstr = offInstr + cbRead;
                 return VINF_SUCCESS;
             }
-            cbMaxRead--;
+
+            cbMinRead -= cbRead;
+            cbMaxRead -= cbRead;
+            offInstr  += cbRead;
+            uSrcAddr  += cbRead;
         }
 
@@ -586,10 +588,23 @@
     else
     {
-        /* pbInstrHC is the base address; adjust according to the GC pointer. */
+        /*
+         * pbInstrHC is the base address; adjust according to the GC pointer.
+         *
+         * Try read the max number of bytes here.  Since the disassembler only
+         * ever uses these bytes for the current instruction, it doesn't matter
+         * much if we accidentally read the start of the next instruction even
+         * if it happens to be a patch jump or int3.
+         */
         uint8_t const *pbInstrHC = pDisInfo->pbInstrHC; AssertPtr(pbInstrHC);
         pbInstrHC += uSrcAddr - pDisInfo->pInstrGC;
 
-        memcpy(&pDis->abInstr[offInstr], pbInstrHC, cbMinRead);
-        offInstr += cbMinRead;
+        size_t cbMaxRead1 = PAGE_SIZE - (uSrcAddr & PAGE_OFFSET_MASK);
+        size_t cbMaxRead2 = PAGE_SIZE - ((uintptr_t)pbInstrHC & PAGE_OFFSET_MASK);
+        size_t cbToRead   = RT_MIN(cbMaxRead1, RT_MAX(cbMaxRead2, cbMinRead));
+        if (cbToRead > cbMaxRead)
+            cbToRead = cbMaxRead;
+
+        memcpy(&pDis->abInstr[offInstr], pbInstrHC, cbToRead);
+        offInstr += (uint8_t)cbToRead;
     }
 
