Changeset 46571 in vbox
- Timestamp:
- Jun 14, 2013 4:49:48 PM (11 years ago)
- Location:
- trunk/src/VBox/VMM/testcase/Instructions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
r46554 r46571 237 237 return iReg % (16 if self.is64Bit() else 8); 238 238 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]; 239 246 240 247 … … 268 275 oGen.write(';; @todo not implemented. This is for the linter: %s, %s\n' % (oGen, sTestFnName)); 269 276 return True; 270 271 272 class InstrTest_MemOrGreg_2_Greg(InstrTestBase):273 """274 Instruction reading memory or general register and writing the result to a275 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);282 277 283 278 def generateInputs(self, cbEffOp, cbMaxOp, oGen, fLong = False): … … 330 325 return auRet; 331 326 327 328 329 class 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 332 340 def writeInstrGregGreg(self, cbEffOp, iOp1, iOp2, oGen): 333 341 """ Writes the instruction with two general registers as operands. """ … … 343 351 return True; 344 352 345 def generateOneStdTest (self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult):353 def generateOneStdTestGregGreg(self, oGen, cbEffOp, cbMaxOp, iOp1, iOp2, uInput, uResult): 346 354 """ Generate one standard test. """ 347 355 oGen.write(' call VBINSTST_NAME(Common_LoadKnownValues)\n'); … … 364 372 iLongOp2 = oGen.oTarget.randGRegNoSp(); 365 373 oOp2Range = range(oGen.oTarget.getGRegCount()); 374 oOp1MemRange = range(oGen.oTarget.getGRegCount()); 366 375 if oGen.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny: 367 oOp2Range = [iLongOp2,]; 368 369 # Register tests. 376 oOp2Range = [iLongOp2,]; 377 oOp1MemRange = [iLongOp1,]; 378 379 # Register tests 370 380 for cbEffOp in self.acbOpVars: 371 381 if cbEffOp > cbMaxOp: … … 380 390 uResult = self.fnCalcResult(cbEffOp, uInput, oGen.auRegValues[iOp1] if iOp1 != iOp2 else uInput, oGen); 381 391 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 # 383 408 384 409 return True; … … 585 610 ';\n'); 586 611 self.write('VBINSTST_BEGINDATA\n' 612 'VBINSTST_GLOBALNAME_EX g_pvLowMem4K, data hidden\n' 613 ' dq 0\n' 587 614 'VBINSTST_GLOBALNAME_EX g_uVBInsTstSubTestIndicator, data hidden\n' 588 615 ' dd 0\n' -
trunk/src/VBox/VMM/testcase/Instructions/tstVBInsTstR3.cpp
r46543 r46571 20 20 * Header Files * 21 21 *******************************************************************************/ 22 #include <iprt/mem.h> 22 23 #include <iprt/string.h> 23 24 #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 24 33 25 34 … … 41 50 42 51 RT_C_DECLS_BEGIN 52 extern void *g_pvLowMem4K; 43 53 DECLASM(void) TestInstrMain(void); 44 54 … … 88 98 return rcExit; 89 99 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 90 108 TestInstrMain(); 109 91 110 return RTTestSummaryAndDestroy(g_hTest); 92 111 }
Note:
See TracChangeset
for help on using the changeset viewer.