VirtualBox

Ignore:
Timestamp:
Jul 14, 2013 4:43:54 PM (11 years ago)
Author:
vboxsync
Message:

32bit fixes

File:
1 edited

Legend:

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

    r47132 r47135  
    384384        return False;
    385385
     386    def gregNameBits(self, iReg, cBits):
     387        """ Gets the name of the given register for the specified width (bits). """
     388        return gregName(iReg, cBits, self.is64Bit());
     389
     390    def gregNameBytes(self, iReg, cbWidth):
     391        """ Gets the name of the given register for the specified with (in bytes). """
     392        return gregName(iReg, cbWidth * 8, self.is64Bit());
     393
     394
    386395
    387396
     
    392401    'bs2-r0-64':        TargetEnv('bs2-r0-64',      TargetEnv.ksInstrSet_64, TargetEnv.ksCpuMode_Long,    0),
    393402    'bs2-r0-64-big':    TargetEnv('bs2-r0-64-big',  TargetEnv.ksInstrSet_64, TargetEnv.ksCpuMode_Long,    0),
     403    'bs2-r0-32-big':    TargetEnv('bs2-r0-32-big',  TargetEnv.ksInstrSet_32, TargetEnv.ksCpuMode_Protect, 0),
    394404};
    395405
     
    12381248        oGen.write('        push    %s\n' % (oGen.oTarget.asGRegs[X86_GREG_xAX],));
    12391249        oGen.write('        VBINSTST_TRAP_INSTR X86_XCPT_DE, 0, %-4s    %s\n'
    1240                    % (self.sInstr, gregName(iOp2, cbEffOp * 8),));
     1250                   % (self.sInstr, oGen.gregNameBytes(iOp2, cbEffOp),));
    12411251        oGen.write('        call VBINSTST_NAME(%s)\n' % (oGen.needGRegChecker(X86_GREG_xAX, X86_GREG_xDX, iOp2),));
    12421252        return True;
     
    12441254    def generateOneDivideErrorTestGreg8Bit(self, oGen, cbEffOp, iOp2, iDividend, iDivisor):
    12451255        """ Generate code of one '[I]DIV AX,<GREG>' test that causes #DE (8-bit). """
     1256        if not oGen.oTarget.is64Bit() and iOp2 == 4: # Avoid AH.
     1257            iOp2 = 5;
     1258
    12461259        cbMaxOp   = oGen.oTarget.getMaxOpBytes();
    12471260        fMaxOp    = UINT64_MAX if cbMaxOp == 8 else UINT32_MAX; assert cbMaxOp in [8, 4];
     
    12641277        oGen.write('        push    sAX\n');
    12651278        oGen.write('        VBINSTST_TRAP_INSTR X86_XCPT_DE, 0, %-4s    %s\n'
    1266                    % (self.sInstr, gregName(iOp2, cbEffOp * 8),));
     1279                   % (self.sInstr, oGen.gregNameBytes(iOp2, cbEffOp),));
    12671280        oGen.write('        call VBINSTST_NAME(%s)\n' % (oGen.needGRegChecker(X86_GREG_xAX, iOp2X),));
    12681281        return;
     
    12791292                iOp2 = oGen.oTarget.randGRegNoSp();
    12801293
    1281             for cbEffOp in ( 8, 4, 2, 1 ):
     1294            for cbEffOp in [1]:#( 8, 4, 2, 1 ):
    12821295                if cbEffOp > oGen.oTarget.getMaxOpBytes():
    12831296                    continue;
     
    12991312        #oGen.write('        int3\n');
    13001313
    1301         self.generateStandardTests(oGen);
     1314        #self.generateStandardTests(oGen);
    13021315        self.generateDivideErrorTests(oGen);
    13031316
     
    13141327#
    13151328g_aoInstructionTests = [
    1316     InstrTest_Mov_Gv_Ev(),
    1317     #InstrTest_MovSxD_Gv_Ev(),
     1329    #InstrTest_Mov_Gv_Ev(),
     1330    ##InstrTest_MovSxD_Gv_Ev(),
    13181331    InstrTest_DivIDiv(fIsIDiv = False),
    1319     InstrTest_DivIDiv(fIsIDiv = True),
     1332    #InstrTest_DivIDiv(fIsIDiv = True),
    13201333];
    13211334
     
    15251538        """ Checks if we're in tiny mode."""
    15261539        return self.oOptions.sTestSize == InstructionTestGen.ksTestSize_Tiny;
     1540
     1541
     1542    #
     1543    # Forwarding calls for oTarget to shorted typing and lessen the attacks
     1544    # on the right margin.
     1545    #
     1546
     1547    def gregNameBits(self, iReg, cBitsWide):
     1548        """ Target: Get the name of a general register for the given size (in bits). """
     1549        return self.oTarget.gregNameBits(iReg, cBitsWide);
     1550
     1551    def gregNameBytes(self, iReg, cbWide):
     1552        """ Target: Get the name of a general register for the given size (in bytes). """
     1553        return self.oTarget.gregNameBytes(iReg, cbWide);
     1554
     1555    def is64Bit(self):
     1556        """ Target: Is the target 64-bit? """
     1557        return self.oTarget.is64Bit();
    15271558
    15281559
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