Index: /trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
===================================================================
--- /trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py	(revision 46570)
+++ /trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py	(revision 46571)
@@ -237,4 +237,11 @@
         return iReg % (16 if self.is64Bit() else 8);
 
+    def getAddrModes(self):
+        """ Gets a list of addressing mode (16, 32, or/and 64). """
+        if self.sInstrSet == self.ksInstrSet_16:
+            return [16,];
+        if self.sInstrSet == self.ksInstrSet_32:
+            return [32, 16];
+        return [64, 64];
 
 
@@ -268,16 +275,4 @@
         oGen.write(';; @todo not implemented. This is for the linter: %s, %s\n' % (oGen, sTestFnName));
         return True;
-
-
-class InstrTest_MemOrGreg_2_Greg(InstrTestBase):
-    """
-    Instruction reading memory or general register and writing the result to a
-    general register.
-    """
-
-    def __init__(self, sName, fnCalcResult, sInstr = None, acbOpVars = None):
-        InstrTestBase.__init__(self, sName, sInstr);
-        self.fnCalcResult = fnCalcResult;
-        self.acbOpVars = [ 1, 2, 4, 8 ] if not acbOpVars else list(acbOpVars);
 
     def generateInputs(self, cbEffOp, cbMaxOp, oGen, fLong = False):
@@ -330,4 +325,17 @@
         return auRet;
 
+
+
+class InstrTest_MemOrGreg_2_Greg(InstrTestBase):
+    """
+    Instruction reading memory or general register and writing the result to a
+    general register.
+    """
+
+    def __init__(self, sName, fnCalcResult, sInstr = None, acbOpVars = None):
+        InstrTestBase.__init__(self, sName, sInstr);
+        self.fnCalcResult = fnCalcResult;
+        self.acbOpVars = [ 1, 2, 4, 8 ] if not acbOpVars else list(acbOpVars);
+
     def writeInstrGregGreg(self, cbEffOp, iOp1, iOp2, oGen):
         """ Writes the instruction with two general registers as operands. """
@@ -343,5 +351,5 @@
         return True;
 
-    def generateOneStdTest(self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult):
+    def generateOneStdTestGregGreg(self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult):
         """ Generate one standard test. """
         oGen.write('        call VBINSTST_NAME(Common_LoadKnownValues)\n');
@@ -364,8 +372,10 @@
         iLongOp2      = oGen.oTarget.randGRegNoSp();
         oOp2Range     = range(oGen.oTarget.getGRegCount());
+        oOp1MemRange  = range(oGen.oTarget.getGRegCount());
         if oGen.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny:
-            oOp2Range = [iLongOp2,];
-
-        # Register tests.
+            oOp2Range    = [iLongOp2,];
+            oOp1MemRange = [iLongOp1,];
+
+        # Register tests
         for cbEffOp in self.acbOpVars:
             if cbEffOp > cbMaxOp:
@@ -380,5 +390,20 @@
                         uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1] if iOp1 != iOp2 else uInput, oGen);
                         oGen.newSubTest();
-                        self.generateOneStdTest(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult);
+                        self.generateOneStdTestGregGreg(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult);
+
+        ## Memory test.
+        #for cbEffOp in self.acbOpVars:
+        #    if cbEffOp > cbMaxOp:
+        #        continue;
+        #    for iOp1 in oOp1MemRange:
+        #        if oGen.oTarget.asGRegsNoSp[iOp1] is None:
+        #            continue;
+        #        for cbAddrMode in oGen.oTarget.getAddrModes():
+        #
+        #            for uInput in (auLongInputs if iOp1 == iLongOp1 and False else auShortInputs):
+        #                uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1] if iOp1 != iOp2 else uInput, oGen);
+        #                oGen.newSubTest();
+        #                self.generateOneStdTestGregGreg(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult);
+        #
 
         return True;
@@ -585,4 +610,6 @@
                    ';\n');
         self.write('VBINSTST_BEGINDATA\n'
+                   'VBINSTST_GLOBALNAME_EX g_pvLowMem4K, data hidden\n'
+                   '        dq      0\n'
                    'VBINSTST_GLOBALNAME_EX g_uVBInsTstSubTestIndicator, data hidden\n'
                    '        dd      0\n'
Index: /trunk/src/VBox/VMM/testcase/Instructions/tstVBInsTstR3.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/Instructions/tstVBInsTstR3.cpp	(revision 46570)
+++ /trunk/src/VBox/VMM/testcase/Instructions/tstVBInsTstR3.cpp	(revision 46571)
@@ -20,6 +20,15 @@
 *   Header Files                                                               *
 *******************************************************************************/
+#include <iprt/mem.h>
 #include <iprt/string.h>
 #include <iprt/test.h>
+
+#ifdef RT_OS_WINDOWS
+# define NO_LOW_MEM
+#elif defined(RT_OS_OS2) || defined(RT_OS_HAIKU)
+# define NO_LOW_MEM
+#else
+# include <sys/mman.h>
+#endif
 
 
@@ -41,4 +50,5 @@
 
 RT_C_DECLS_BEGIN
+extern void *g_pvLowMem4K;
 DECLASM(void)    TestInstrMain(void);
 
@@ -88,5 +98,14 @@
         return rcExit;
     RTTestBanner(g_hTest);
+
+    int rc = RTMemAllocEx(_4K, 0, RTMEMALLOCEX_FLAGS_16BIT_REACH, &g_pvLowMem4K);
+    if (RT_FAILURE(rc))
+    {
+        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Could not allocate low memory (%Rrc)\n", rc);
+        g_pvLowMem4K = NULL;
+    }
+
     TestInstrMain();
+
     return RTTestSummaryAndDestroy(g_hTest);
 }
