use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.
the class THUMBUxthTranslator method translateCore.
@Override
protected void translateCore(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) {
final IOperandTreeNode registerOperand1 = instruction.getOperands().get(0).getRootNode().getChildren().get(0);
final IOperandTreeNode registerOperand2 = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
final String targetRegister = (registerOperand1.getValue());
final String sourceRegister = (registerOperand2.getValue());
final OperandSize dw = OperandSize.DWORD;
long baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister, dw, String.valueOf(0xFFFFL), dw, targetRegister));
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.
the class ARMUxthTranslator method translateCore.
@Override
protected void translateCore(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
final IOperandTreeNode registerOperand1 = instruction.getOperands().get(0).getRootNode().getChildren().get(0);
final IOperandTreeNode shifter = instruction.getOperands().get(1).getRootNode();
final String targetRegister = (registerOperand1.getValue());
final OperandSize dw = OperandSize.DWORD;
long baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
final Pair<String, String> shifterPair = AddressingModeOneGenerator.generate(baseOffset, environment, instruction, instructions, shifter);
baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
final String shifterOperand = shifterPair.first();
instructions.add(ReilHelpers.createAnd(baseOffset++, dw, shifterOperand, dw, String.valueOf(0x0000FFFFL), dw, targetRegister));
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.
the class BeqTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "beq");
final List<? extends IOperandTree> operands = instruction.getOperands();
final String rs = operands.get(0).getRootNode().getChildren().get(0).getValue();
final String rt = operands.get(1).getRootNode().getChildren().get(0).getValue();
final IOperandTreeNode target = operands.get(2).getRootNode().getChildren().get(0);
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
long offset = baseOffset;
final OperandSize dw = OperandSize.DWORD;
final OperandSize qw = OperandSize.QWORD;
final String subtractedValue = environment.getNextVariableString();
final String flippedValue = environment.getNextVariableString();
instructions.add(ReilHelpers.createSub(offset++, dw, rs, dw, rt, qw, subtractedValue));
instructions.add(ReilHelpers.createBisz(offset++, qw, subtractedValue, qw, flippedValue));
Helpers.generateDelayBranch(instructions, offset, qw, flippedValue, dw, target);
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.
the class BeqlTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "beql");
final List<? extends IOperandTree> operands = instruction.getOperands();
final String rs = operands.get(0).getRootNode().getChildren().get(0).getValue();
final String rt = operands.get(1).getRootNode().getChildren().get(0).getValue();
final IOperandTreeNode target = operands.get(2).getRootNode().getChildren().get(0);
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
long offset = baseOffset;
final OperandSize dw = OperandSize.DWORD;
final OperandSize qw = OperandSize.QWORD;
final String subtractedValue = environment.getNextVariableString();
final String flippedValue = environment.getNextVariableString();
instructions.add(ReilHelpers.createSub(offset++, dw, rs, dw, rt, qw, subtractedValue));
instructions.add(ReilHelpers.createBisz(offset++, qw, subtractedValue, qw, flippedValue));
Helpers.generateDelayBranchLikely(instructions, offset, qw, flippedValue, dw, target);
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.
the class THUMB2CbnzTranslator method translateCore.
@Override
protected void translateCore(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) {
final IOperandTreeNode registerOperand1 = instruction.getOperands().get(0).getRootNode().getChildren().get(0);
final IOperandTreeNode labelOperand1 = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
final String sourceRegister1 = (registerOperand1.getValue());
final String realJumpLabel = (labelOperand1.getValue());
final OperandSize dw = OperandSize.DWORD;
long baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
final String jmpGoal = String.format("%d.%d", instruction.getAddress().toLong(), 3);
final String jumpCondition = environment.getNextVariableString();
instructions.add(ReilHelpers.createBisz(baseOffset++, dw, sourceRegister1, dw, jumpCondition));
instructions.add(ReilHelpers.createJcc(baseOffset++, dw, jumpCondition, dw, jmpGoal));
instructions.add(ReilHelpers.createJcc(baseOffset++, dw, String.valueOf(1), dw, realJumpLabel));
instructions.add(ReilHelpers.createNop(baseOffset++));
}
Aggregations