From: <mic...@us...> - 2007-08-24 17:08:32
|
Revision: 172 http://pearcolator.svn.sourceforge.net/pearcolator/?rev=172&view=rev Author: michael_baer Date: 2007-08-24 10:08:31 -0700 (Fri, 24 Aug 2007) Log Message: ----------- - Fixed a bug where a parameter that is only one char would not be parsed correctly - Fixed a bug that I recently introduced on loads with negative offset and writeback - various smaller fixes Modified Paths: -------------- src/org/binarytranslator/arch/arm/decoder/ARM2IR.java src/org/binarytranslator/arch/arm/decoder/ARM_Disassembler.java src/org/binarytranslator/arch/arm/decoder/ARM_InstructionDecoder.java src/org/binarytranslator/arch/arm/decoder/ARM_Options.java src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java Modified: src/org/binarytranslator/arch/arm/decoder/ARM2IR.java =================================================================== --- src/org/binarytranslator/arch/arm/decoder/ARM2IR.java 2007-08-21 16:12:27 UTC (rev 171) +++ src/org/binarytranslator/arch/arm/decoder/ARM2IR.java 2007-08-24 17:08:31 UTC (rev 172) @@ -556,28 +556,13 @@ return super.inlineBranchInstruction(targetPc, jump); case DynamicJumps: - if (jump.type == BranchType.INDIRECT_BRANCH) - return true; - else - return super.inlineBranchInstruction(targetPc, jump); + return jump.type == BranchType.INDIRECT_BRANCH; - case FunctionCalls: - if (jump.type == BranchType.CALL) - return true; - else - return super.inlineBranchInstruction(targetPc, jump); + case DirectBranches: + return jump.type == BranchType.DIRECT_BRANCH; - case FunctionReturns: - if (jump.type == BranchType.CALL) - return true; - else - return super.inlineBranchInstruction(targetPc, jump); - case Functions: - if (jump.type == BranchType.CALL || jump.type == BranchType.RETURN) - return true; - else - return super.inlineBranchInstruction(targetPc, jump); + return jump.type == BranchType.CALL || jump.type == BranchType.RETURN; case All: return true; Modified: src/org/binarytranslator/arch/arm/decoder/ARM_Disassembler.java =================================================================== --- src/org/binarytranslator/arch/arm/decoder/ARM_Disassembler.java 2007-08-21 16:12:27 UTC (rev 171) +++ src/org/binarytranslator/arch/arm/decoder/ARM_Disassembler.java 2007-08-24 17:08:31 UTC (rev 172) @@ -248,7 +248,8 @@ if (instr.writeBack()) address += '!'; - } else { + } + else { address += "], "; if (!instr.positiveOffset()) Modified: src/org/binarytranslator/arch/arm/decoder/ARM_InstructionDecoder.java =================================================================== --- src/org/binarytranslator/arch/arm/decoder/ARM_InstructionDecoder.java 2007-08-21 16:12:27 UTC (rev 171) +++ src/org/binarytranslator/arch/arm/decoder/ARM_InstructionDecoder.java 2007-08-24 17:08:31 UTC (rev 172) @@ -368,10 +368,12 @@ <T> T decode(short instr, ARM_InstructionFactory<T> factory) { //bit9==bit10==bit11==1? if ((instr & 0x0E00) == 0x0E00) { - if (Utils.getBit(instr, 8)) + if (Utils.getBit(instr, 8)) { return factory.createSoftwareInterrupt(instr); - else + } + else { return factory.createUndefinedInstruction(instr); + } } return factory.createBranch(instr); Modified: src/org/binarytranslator/arch/arm/decoder/ARM_Options.java =================================================================== --- src/org/binarytranslator/arch/arm/decoder/ARM_Options.java 2007-08-21 16:12:27 UTC (rev 171) +++ src/org/binarytranslator/arch/arm/decoder/ARM_Options.java 2007-08-24 17:08:31 UTC (rev 172) @@ -11,8 +11,7 @@ NoInlining, Default, Functions, - FunctionCalls, - FunctionReturns, + DirectBranches, DynamicJumps, All, } @@ -40,7 +39,6 @@ /** Sets the memory model that ARM shall use. */ public static MemoryModel memoryModel = MemoryModel.IntAddressed; - public static void parseOption(String key, String value) { if (key.equalsIgnoreCase("optimizeByProfiling")) { optimizeTranslationByProfiling = Boolean.parseBoolean(value); Modified: src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java =================================================================== --- src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java 2007-08-21 16:12:27 UTC (rev 171) +++ src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java 2007-08-24 17:08:31 UTC (rev 172) @@ -8,7 +8,6 @@ import org.binarytranslator.arch.arm.decoder.ARM_Instructions.Instruction.Condition; import org.binarytranslator.arch.arm.os.process.ARM_ProcessSpace; import org.binarytranslator.arch.arm.os.process.ARM_Registers; -import org.binarytranslator.arch.arm.os.process.ARM_Registers.OperatingMode; import org.binarytranslator.generic.branchprofile.BranchProfile.BranchType; import org.jikesrvm.classloader.VM_Atom; import org.jikesrvm.classloader.VM_MemberReference; @@ -2205,7 +2204,7 @@ return positiveOffset; } else { - OPT_RegisterOperand tmp = arm2ir.getTempInt(0); + OPT_RegisterOperand tmp = arm2ir.getTempInt(1); arm2ir.appendInstruction(Unary.create(INT_NEG, tmp, positiveOffset)); return tmp.copy(); } @@ -2241,26 +2240,14 @@ } public void translate() { - //should we simulate a user-mode memory access? If yes, store the current mode and fake a switch - //to user mode. - - //stores the current operating mode - OPT_RegisterOperand currentOperatingMode = null; - + //should we simulate a user-mode memory access? If yes, handle this using the interpreter if (i.forceUserMode) { - OPT_Instruction call_getOperatingMode = createCallToRegisters("getOperatingMode", "()A", 0); - currentOperatingMode = arm2ir.getTempOperatingMode(); - - Call.setResult(call_getOperatingMode, currentOperatingMode); - arm2ir.appendCustomCall(call_getOperatingMode); - - OPT_Instruction call_setOperatingModeWithoutRegisterLayout = createCallToRegisters("setOperatingModeWithoutRegisterLayout", "(A)", 1); - Call.setParam(call_setOperatingModeWithoutRegisterLayout, 1, arm2ir.getTempOperatingMode(OperatingMode.USR)); - - arm2ir.appendCustomCall(call_setOperatingModeWithoutRegisterLayout); + arm2ir.appendInterpretedInstruction(pc, lazy); + arm2ir.appendTraceExit(lazy, arm2ir.getRegister(ARM_Registers.PC)); + return; } - //get the address of the memory, that we're supposed access + //get the address of the memory, that we're supposed to access OPT_Operand address = resolveAddress(); if (i.isLoad) { @@ -2275,10 +2262,6 @@ //according to the ARM reference, the last two bits cause the value to be right-rotated OPT_RegisterOperand rotation = arm2ir.getTempInt(1); - - //make sure that we're not loosing the address due to the shifting - OPT_RegisterOperand adrCopy = arm2ir.getTempInt(0); - arm2ir.appendInstruction(Move.create(INT_MOVE, adrCopy, address.copy())); //rotation = (address & 0x3) * 8 arm2ir.appendInstruction(Binary.create(INT_AND, rotation, address.copy(), new OPT_IntConstantOperand(0x3))); @@ -2299,9 +2282,6 @@ //continue with the remainder of the instruction arm2ir.setCurrentBlock(remainderBlock); - - //allow further usage of the memory address - address = adrCopy; break; case HalfWord: @@ -2345,13 +2325,6 @@ throw new RuntimeException("Unexpected memory size: " + i.size); } } - - //if we were writing in user mode, then switch back to our previous operating mode - if (i.forceUserMode) { - OPT_Instruction call_setOperatingModeWithoutRegisterLayout = createCallToRegisters("setOperatingModeWithoutRegisterLayout", "(A)", 1); - Call.setParam(call_setOperatingModeWithoutRegisterLayout, 1, currentOperatingMode); - arm2ir.appendCustomCall(call_setOperatingModeWithoutRegisterLayout); - } //should the memory address, which we accessed, be written back into a register? //This is used for continuous memory accesses Modified: src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java =================================================================== --- src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java 2007-08-21 16:12:27 UTC (rev 171) +++ src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java 2007-08-24 17:08:31 UTC (rev 172) @@ -58,7 +58,6 @@ if (registers.getThumbMode()) { int instrAddr = getCurrentInstructionAddress() & 0xFFFFFFFE; - System.out.println("Thumb syscall at: " + instrAddr); short instruction = (short)memory.loadInstruction16(instrAddr); instr = ARM_InstructionDecoder.Thumb.decode(instruction); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |