VirtualBox

Changeset 46571 in vbox


Ignore:
Timestamp:
Jun 14, 2013 4:49:48 PM (11 years ago)
Author:
vboxsync
Message:

Preps for memory operand tests.

Location:
trunk/src/VBox/VMM/testcase/Instructions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py

    r46554 r46571  
    237237        return iReg % (16 if self.is64Bit() else 8);
    238238
     239    def getAddrModes(self):
     240        """ Gets a list of addressing mode (16, 32, or/and 64). """
     241        if self.sInstrSet == self.ksInstrSet_16:
     242            return [16,];
     243        if self.sInstrSet == self.ksInstrSet_32:
     244            return [32, 16];
     245        return [64, 64];
    239246
    240247
     
    268275        oGen.write(';; @todo not implemented. This is for the linter: %s, %s\n' % (oGen, sTestFnName));
    269276        return True;
    270 
    271 
    272 class InstrTest_MemOrGreg_2_Greg(InstrTestBase):
    273     """
    274     Instruction reading memory or general register and writing the result to a
    275     general register.
    276     """
    277 
    278     def __init__(self, sName, fnCalcResult, sInstr = None, acbOpVars = None):
    279         InstrTestBase.__init__(self, sName, sInstr);
    280         self.fnCalcResult = fnCalcResult;
    281         self.acbOpVars = [ 1, 2, 4, 8 ] if not acbOpVars else list(acbOpVars);
    282277
    283278    def generateInputs(self, cbEffOp, cbMaxOp, oGen, fLong = False):
     
    330325        return auRet;
    331326
     327
     328
     329class InstrTest_MemOrGreg_2_Greg(InstrTestBase):
     330    """
     331    Instruction reading memory or general register and writing the result to a
     332    general register.
     333    """
     334
     335    def __init__(self, sName, fnCalcResult, sInstr = None, acbOpVars = None):
     336        InstrTestBase.__init__(self, sName, sInstr);
     337        self.fnCalcResult = fnCalcResult;
     338        self.acbOpVars = [ 1, 2, 4, 8 ] if not acbOpVars else list(acbOpVars);
     339
    332340    def writeInstrGregGreg(self, cbEffOp, iOp1, iOp2, oGen):
    333341        """ Writes the instruction with two general registers as operands. """
     
    343351        return True;
    344352
    345     def generateOneStdTest(self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult):
     353    def generateOneStdTestGregGreg(self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult):
    346354        """ Generate one standard test. """
    347355        oGen.write('        call VBINSTST_NAME(Common_LoadKnownValues)\n');
     
    364372        iLongOp2      = oGen.oTarget.randGRegNoSp();
    365373        oOp2Range     = range(oGen.oTarget.getGRegCount());
     374        oOp1MemRange  = range(oGen.oTarget.getGRegCount());
    366375        if oGen.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny:
    367             oOp2Range = [iLongOp2,];
    368 
    369         # Register tests.
     376            oOp2Range    = [iLongOp2,];
     377            oOp1MemRange = [iLongOp1,];
     378
     379        # Register tests
    370380        for cbEffOp in self.acbOpVars:
    371381            if cbEffOp > cbMaxOp:
     
    380390                        uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1] if iOp1 != iOp2 else uInput, oGen);
    381391                        oGen.newSubTest();
    382                         self.generateOneStdTest(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult);
     392                        self.generateOneStdTestGregGreg(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult);
     393
     394        ## Memory test.
     395        #for cbEffOp in self.acbOpVars:
     396        #    if cbEffOp > cbMaxOp:
     397        #        continue;
     398        #    for iOp1 in oOp1MemRange:
     399        #        if oGen.oTarget.asGRegsNoSp[iOp1] is None:
     400        #            continue;
     401        #        for cbAddrMode in oGen.oTarget.getAddrModes():
     402        #
     403        #            for uInput in (auLongInputs if iOp1 == iLongOp1 and False else auShortInputs):
     404        #                uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1] if iOp1 != iOp2 else uInput, oGen);
     405        #                oGen.newSubTest();
     406        #                self.generateOneStdTestGregGreg(oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult);
     407        #
    383408
    384409        return True;
     
    585610                   ';\n');
    586611        self.write('VBINSTST_BEGINDATA\n'
     612                   'VBINSTST_GLOBALNAME_EX g_pvLowMem4K, data hidden\n'
     613                   '        dq      0\n'
    587614                   'VBINSTST_GLOBALNAME_EX g_uVBInsTstSubTestIndicator, data hidden\n'
    588615                   '        dd      0\n'
  • trunk/src/VBox/VMM/testcase/Instructions/tstVBInsTstR3.cpp

    r46543 r46571  
    2020*   Header Files                                                               *
    2121*******************************************************************************/
     22#include <iprt/mem.h>
    2223#include <iprt/string.h>
    2324#include <iprt/test.h>
     25
     26#ifdef RT_OS_WINDOWS
     27# define NO_LOW_MEM
     28#elif defined(RT_OS_OS2) || defined(RT_OS_HAIKU)
     29# define NO_LOW_MEM
     30#else
     31# include <sys/mman.h>
     32#endif
    2433
    2534
     
    4150
    4251RT_C_DECLS_BEGIN
     52extern void *g_pvLowMem4K;
    4353DECLASM(void)    TestInstrMain(void);
    4454
     
    8898        return rcExit;
    8999    RTTestBanner(g_hTest);
     100
     101    int rc = RTMemAllocEx(_4K, 0, RTMEMALLOCEX_FLAGS_16BIT_REACH, &g_pvLowMem4K);
     102    if (RT_FAILURE(rc))
     103    {
     104        RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Could not allocate low memory (%Rrc)\n", rc);
     105        g_pvLowMem4K = NULL;
     106    }
     107
    90108    TestInstrMain();
     109
    91110    return RTTestSummaryAndDestroy(g_hTest);
    92111}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette