Search in sources :

Example 46 with OperandSize

use of com.google.security.zynamics.reil.OperandSize in project binnavi by google.

the class AndTranslator method translate.

/**
   * Translates an AND instruction to REIL code.
   *
   * @param environment A valid translation environment
   * @param instruction The AND instruction to translate
   * @param instructions The generated REIL code will be added to this list
   *
   * @throws InternalTranslationException if any of the arguments are null the passed instruction is
   *         not an AND instruction
   */
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "and");
    if (instruction.getOperands().size() != 2) {
        throw new InternalTranslationException("Error: Argument instruction is not a and instruction (invalid number of operands)");
    }
    final long baseOffset = instruction.getAddress().toLong() * 0x100;
    long offset = baseOffset;
    final List<? extends IOperandTree> operands = instruction.getOperands();
    final IOperandTree targetOperand = operands.get(0);
    final IOperandTree sourceOperand = operands.get(1);
    // Load source operand.
    final TranslationResult sourceResult = Helpers.translateOperand(environment, offset, sourceOperand, true);
    instructions.addAll(sourceResult.getInstructions());
    // Adjust the offset of the next REIL instruction.
    offset = baseOffset + instructions.size();
    // Load destination operand.
    final TranslationResult targetResult = Helpers.translateOperand(environment, offset, targetOperand, true);
    instructions.addAll(targetResult.getInstructions());
    // Adjust the offset of the next REIL instruction.
    offset = baseOffset + instructions.size();
    final OperandSize size = targetResult.getSize();
    final String sourceRegister = sourceResult.getRegister();
    final String targetRegister = targetResult.getRegister();
    final String andResult = Helpers.generateAnd(environment, offset, size, sourceRegister, targetRegister, instructions);
    offset = baseOffset + instructions.size();
    // Write the result of the ADD operation back into the target register
    Helpers.writeBack(environment, offset, targetOperand, andResult, size, targetResult.getAddress(), targetResult.getType(), instructions);
    Helpers.writeParityFlag(environment, baseOffset + instructions.size(), size, andResult, instructions);
}
Also used : IOperandTree(com.google.security.zynamics.zylib.disassembly.IOperandTree) InternalTranslationException(com.google.security.zynamics.reil.translators.InternalTranslationException) TranslationResult(com.google.security.zynamics.reil.translators.TranslationResult) OperandSize(com.google.security.zynamics.reil.OperandSize)

Example 47 with OperandSize

use of com.google.security.zynamics.reil.OperandSize in project binnavi by google.

the class SlwDotTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "slw.");
    final IOperandTreeNode targetRegister = instruction.getOperands().get(0).getRootNode().getChildren().get(0);
    final IOperandTreeNode sourceRegister = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode shiftRegister = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    Long baseOffset = instruction.getAddress().toLong() * 0x100;
    final OperandSize bt = OperandSize.BYTE;
    final OperandSize dw = OperandSize.DWORD;
    final String shiftAmmount = environment.getNextVariableString();
    final String tmpResult = environment.getNextVariableString();
    final String crTemp = environment.getNextVariableString();
    /**
     * n <- rB[27-31] r <- ROTL(rS, n) if rB[26] = 0 then m <- MASK(0, 31 - n) else m <- (32)0 rA <-
     * r & m
     */
    // n <- rB[27-31]
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, shiftRegister.getValue(), dw, String.valueOf(0x3FL), dw, shiftAmmount));
    // r <- ROTL(rS, n)
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, sourceRegister.getValue(), dw, shiftAmmount, dw, tmpResult));
    // if rB[26] = 0
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, tmpResult, dw, String.valueOf(0xFFFFFFFFL), dw, targetRegister.getValue()));
    // EQ CR0
    instructions.add(ReilHelpers.createBisz(baseOffset++, dw, targetRegister.getValue(), bt, Helpers.CR0_EQUAL));
    // LT CR0
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, targetRegister.getValue(), dw, "-31", bt, Helpers.CR0_LESS_THEN));
    // GT CR0
    instructions.add(ReilHelpers.createOr(baseOffset++, bt, Helpers.CR0_EQUAL, bt, Helpers.CR0_LESS_THEN, bt, crTemp));
    instructions.add(ReilHelpers.createBisz(baseOffset++, bt, crTemp, bt, Helpers.CR0_GREATER_THEN));
    // SO CR0
    instructions.add(ReilHelpers.createStr(baseOffset, bt, Helpers.XER_SUMMARY_OVERFLOW, bt, Helpers.CRO_SUMMARY_OVERFLOW));
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode) OperandSize(com.google.security.zynamics.reil.OperandSize)

Example 48 with OperandSize

use of com.google.security.zynamics.reil.OperandSize in project binnavi by google.

the class SrawTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "sraw");
    final IOperandTreeNode targetRegister = instruction.getOperands().get(0).getRootNode().getChildren().get(0);
    final IOperandTreeNode sourceRegister = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode shiftRegister = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    Long baseOffset = instruction.getAddress().toLong() * 0x100;
    final OperandSize dw = OperandSize.DWORD;
    final OperandSize bt = OperandSize.BYTE;
    final String shiftAmmount = environment.getNextVariableString();
    final String tmpResult1 = environment.getNextVariableString();
    final String tmpResult2 = environment.getNextVariableString();
    final String tmpResult3 = environment.getNextVariableString();
    final String tmpResult4 = environment.getNextVariableString();
    final String oneComp = environment.getNextVariableString();
    final String twoComp = environment.getNextVariableString();
    final String signBit = environment.getNextVariableString();
    final String isZeroIfEqual = environment.getNextVariableString();
    final String noBitsShiftedOut = environment.getNextVariableString();
    final String bitsShiftedOut = environment.getNextVariableString();
    // save sign value before shift for CA Flag
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, sourceRegister.getValue(), dw, String.valueOf(-31L), dw, signBit));
    // n <- rB[26-31]
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, shiftRegister.getValue(), dw, String.valueOf(0x3FL), dw, shiftAmmount));
    // computer two's complement for shift amount == - (original value)
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, shiftRegister.getValue(), dw, String.valueOf(0xFFFFFFFFL), dw, oneComp));
    instructions.add(ReilHelpers.createAdd(baseOffset++, dw, oneComp, dw, String.valueOf(1L), dw, twoComp));
    // t = 0x8000 0000 >> n
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, String.valueOf(0x80000000L), dw, twoComp, dw, tmpResult1));
    // x >> n
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, sourceRegister.getValue(), dw, twoComp, dw, tmpResult2));
    // ( x >> n ) XOR t
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, tmpResult2, dw, tmpResult1, dw, tmpResult3));
    // ( ( x >> n ) XOR t ) - t
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpResult3, dw, tmpResult1, dw, targetRegister.getValue()));
    // compute XER[CA] Flag
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpResult2, dw, shiftRegister.getValue(), dw, tmpResult4));
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, sourceRegister.getValue(), dw, tmpResult4, dw, isZeroIfEqual));
    instructions.add(ReilHelpers.createBisz(baseOffset++, dw, isZeroIfEqual, dw, noBitsShiftedOut));
    instructions.add(ReilHelpers.createBisz(baseOffset++, dw, noBitsShiftedOut, dw, bitsShiftedOut));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, bitsShiftedOut, dw, signBit, bt, Helpers.XER_CARRY_BIT));
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode) OperandSize(com.google.security.zynamics.reil.OperandSize)

Example 49 with OperandSize

use of com.google.security.zynamics.reil.OperandSize in project binnavi by google.

the class SrawiTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "srawi");
    final IOperandTreeNode targetRegister = instruction.getOperands().get(0).getRootNode().getChildren().get(0);
    final IOperandTreeNode sourceRegister = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode shiftRegister = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    Long baseOffset = instruction.getAddress().toLong() * 0x100;
    final OperandSize dw = OperandSize.DWORD;
    final OperandSize bt = OperandSize.BYTE;
    final String shiftAmmount = environment.getNextVariableString();
    final String tmpResult1 = environment.getNextVariableString();
    final String tmpResult2 = environment.getNextVariableString();
    final String tmpResult3 = environment.getNextVariableString();
    final String tmpResult4 = environment.getNextVariableString();
    final String oneComp = environment.getNextVariableString();
    final String twoComp = environment.getNextVariableString();
    final String signBit = environment.getNextVariableString();
    final String isZeroIfEqual = environment.getNextVariableString();
    final String noBitsShiftedOut = environment.getNextVariableString();
    final String bitsShiftedOut = environment.getNextVariableString();
    // save sign value before shift for CA Flag
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, sourceRegister.getValue(), dw, String.valueOf(-31L), dw, signBit));
    // n <- rB[26-31]
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, shiftRegister.getValue(), dw, String.valueOf(0x3FL), dw, shiftAmmount));
    // computer two's complement for shift amount == - (original value)
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, shiftRegister.getValue(), dw, String.valueOf(0xFFFFFFFFL), dw, oneComp));
    instructions.add(ReilHelpers.createAdd(baseOffset++, dw, oneComp, dw, String.valueOf(1L), dw, twoComp));
    // t = 0x8000 0000 >> n
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, String.valueOf(0x80000000L), dw, twoComp, dw, tmpResult1));
    // x >> n
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, sourceRegister.getValue(), dw, twoComp, dw, tmpResult2));
    // ( x >> n ) XOR t
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, tmpResult2, dw, tmpResult1, dw, tmpResult3));
    // ( ( x >> n ) XOR t ) - t
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpResult3, dw, tmpResult1, dw, targetRegister.getValue()));
    // compute XER[CA] Flag
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpResult2, dw, shiftRegister.getValue(), dw, tmpResult4));
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, sourceRegister.getValue(), dw, tmpResult4, dw, isZeroIfEqual));
    instructions.add(ReilHelpers.createBisz(baseOffset++, dw, isZeroIfEqual, dw, noBitsShiftedOut));
    instructions.add(ReilHelpers.createBisz(baseOffset++, dw, noBitsShiftedOut, dw, bitsShiftedOut));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, bitsShiftedOut, dw, signBit, bt, Helpers.XER_CARRY_BIT));
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode) OperandSize(com.google.security.zynamics.reil.OperandSize)

Example 50 with OperandSize

use of com.google.security.zynamics.reil.OperandSize in project binnavi by google.

the class ARMUsada8Translator 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 IOperandTreeNode registerOperand3 = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    final IOperandTreeNode registerOperand4 = instruction.getOperands().get(3).getRootNode().getChildren().get(0);
    final String targetRegister = (registerOperand1.getValue());
    final String sourceRegister1 = (registerOperand2.getValue());
    final String sourceRegister2 = (registerOperand3.getValue());
    final String sourceRegister3 = (registerOperand4.getValue());
    final OperandSize dw = OperandSize.DWORD;
    long baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
    final String diff1 = environment.getNextVariableString();
    final String diff11 = environment.getNextVariableString();
    final String diff12 = environment.getNextVariableString();
    final String diff1MaskRmRs = environment.getNextVariableString();
    final String diff1MaskRsRm = environment.getNextVariableString();
    final String diff1RmRs = environment.getNextVariableString();
    final String diff1RsRm = environment.getNextVariableString();
    final String diff2 = environment.getNextVariableString();
    final String diff21 = environment.getNextVariableString();
    final String diff22 = environment.getNextVariableString();
    final String diff2MaskRmRs = environment.getNextVariableString();
    final String diff2MaskRsRm = environment.getNextVariableString();
    final String diff2RmRs = environment.getNextVariableString();
    final String diff2RsRm = environment.getNextVariableString();
    final String diff3 = environment.getNextVariableString();
    final String diff31 = environment.getNextVariableString();
    final String diff32 = environment.getNextVariableString();
    final String diff3MaskRmRs = environment.getNextVariableString();
    final String diff3MaskRsRm = environment.getNextVariableString();
    final String diff3RmRs = environment.getNextVariableString();
    final String diff3RsRm = environment.getNextVariableString();
    final String diff4 = environment.getNextVariableString();
    final String diff41 = environment.getNextVariableString();
    final String diff42 = environment.getNextVariableString();
    final String diff4MaskRmRs = environment.getNextVariableString();
    final String diff4MaskRsRm = environment.getNextVariableString();
    final String diff4RmRs = environment.getNextVariableString();
    final String diff4RsRm = environment.getNextVariableString();
    final String isSmaller1 = environment.getNextVariableString();
    final String isSmaller2 = environment.getNextVariableString();
    final String isSmaller3 = environment.getNextVariableString();
    final String isSmaller4 = environment.getNextVariableString();
    final String sum1 = environment.getNextVariableString();
    final String sum2 = environment.getNextVariableString();
    final String tmpRm15to8 = environment.getNextVariableString();
    final String tmpRm23to16 = environment.getNextVariableString();
    final String tmpRm31to24 = environment.getNextVariableString();
    final String tmpRm7to0 = environment.getNextVariableString();
    final String tmpRs15to8 = environment.getNextVariableString();
    final String tmpRs23to16 = environment.getNextVariableString();
    final String tmpRs31to24 = environment.getNextVariableString();
    final String tmpRs7to0 = environment.getNextVariableString();
    final String tmpVar1 = environment.getNextVariableString();
    final String tmpVar2 = environment.getNextVariableString();
    final String tmpVar3 = environment.getNextVariableString();
    final String tmpVar4 = environment.getNextVariableString();
    final String tmpVar5 = environment.getNextVariableString();
    final String zeroDiff1 = environment.getNextVariableString();
    final String zeroDiff2 = environment.getNextVariableString();
    final String zeroDiff3 = environment.getNextVariableString();
    final String zeroDiff4 = environment.getNextVariableString();
    // Rm
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister1, dw, String.valueOf(0x000000FFL), dw, tmpRm7to0));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister1, dw, String.valueOf(0x0000FF00L), dw, tmpVar1));
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpVar1, dw, String.valueOf(-8), dw, tmpRm15to8));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister1, dw, String.valueOf(0x00FF0000L), dw, tmpVar2));
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpVar2, dw, String.valueOf(-16), dw, tmpRm23to16));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister1, dw, String.valueOf(0xFF000000L), dw, tmpVar3));
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpVar3, dw, String.valueOf(-24), dw, tmpRm31to24));
    // Rs
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister2, dw, String.valueOf(0x000000FFL), dw, tmpRs7to0));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister2, dw, String.valueOf(0x0000FF00L), dw, tmpVar1));
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpVar1, dw, String.valueOf(-8), dw, tmpRs15to8));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister2, dw, String.valueOf(0x00FF0000L), dw, tmpVar2));
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpVar2, dw, String.valueOf(-16), dw, tmpRs23to16));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, sourceRegister2, dw, String.valueOf(0xFF000000L), dw, tmpVar3));
    instructions.add(ReilHelpers.createBsh(baseOffset++, dw, tmpVar3, dw, String.valueOf(-24), dw, tmpRs31to24));
    // Do the compares
    Helpers.unsignedCompareXSmallerY(baseOffset, environment, instruction, instructions, dw, tmpRm7to0, dw, tmpRs7to0, dw, isSmaller1);
    baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
    Helpers.unsignedCompareXSmallerY(baseOffset, environment, instruction, instructions, dw, tmpRm15to8, dw, tmpRs15to8, dw, isSmaller2);
    baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
    Helpers.unsignedCompareXSmallerY(baseOffset, environment, instruction, instructions, dw, tmpRm23to16, dw, tmpRs23to16, dw, isSmaller3);
    baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
    Helpers.unsignedCompareXSmallerY(baseOffset, environment, instruction, instructions, dw, tmpRm31to24, dw, tmpRs31to24, dw, isSmaller4);
    baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
    // prepare the masks according to the comparison results
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, String.valueOf(0L), dw, isSmaller1, dw, diff1MaskRsRm));
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, diff1MaskRsRm, dw, String.valueOf(0xFFFFFFFFL), dw, diff1MaskRmRs));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, String.valueOf(0L), dw, isSmaller2, dw, diff2MaskRsRm));
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, diff2MaskRsRm, dw, String.valueOf(0xFFFFFFFFL), dw, diff2MaskRmRs));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, String.valueOf(0L), dw, isSmaller3, dw, diff3MaskRsRm));
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, diff3MaskRsRm, dw, String.valueOf(0xFFFFFFFFL), dw, diff3MaskRmRs));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, String.valueOf(0L), dw, isSmaller4, dw, diff4MaskRsRm));
    instructions.add(ReilHelpers.createXor(baseOffset++, dw, diff4MaskRsRm, dw, String.valueOf(0xFFFFFFFFL), dw, diff4MaskRmRs));
    // do the subs.
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRs7to0, dw, tmpRm7to0, dw, diff1RsRm));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRs15to8, dw, tmpRm15to8, dw, diff2RsRm));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRs23to16, dw, tmpRm23to16, dw, diff3RsRm));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRs31to24, dw, tmpRm31to24, dw, diff4RsRm));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRm7to0, dw, tmpRs7to0, dw, diff1RmRs));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRm15to8, dw, tmpRs15to8, dw, diff2RmRs));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRm23to16, dw, tmpRs23to16, dw, diff3RmRs));
    instructions.add(ReilHelpers.createSub(baseOffset++, dw, tmpRm31to24, dw, tmpRs31to24, dw, diff4RmRs));
    // filter the ones really used
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff1RsRm, dw, diff1MaskRsRm, dw, diff11));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff2RsRm, dw, diff2MaskRsRm, dw, diff21));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff3RsRm, dw, diff3MaskRsRm, dw, diff31));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff4RsRm, dw, diff4MaskRsRm, dw, diff41));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff1RmRs, dw, diff1MaskRmRs, dw, diff12));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff2RmRs, dw, diff2MaskRmRs, dw, diff22));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff3RmRs, dw, diff3MaskRmRs, dw, diff32));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff4RmRs, dw, diff4MaskRmRs, dw, diff42));
    // get real diff results
    instructions.add(ReilHelpers.createOr(baseOffset++, dw, diff11, dw, diff12, dw, diff1));
    instructions.add(ReilHelpers.createOr(baseOffset++, dw, diff21, dw, diff22, dw, diff2));
    instructions.add(ReilHelpers.createOr(baseOffset++, dw, diff31, dw, diff32, dw, diff3));
    instructions.add(ReilHelpers.createOr(baseOffset++, dw, diff41, dw, diff42, dw, diff4));
    // zero extend results
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff1, dw, String.valueOf(0xFFL), dw, zeroDiff1));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff2, dw, String.valueOf(0xFFL), dw, zeroDiff2));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff3, dw, String.valueOf(0xFFL), dw, zeroDiff3));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, diff4, dw, String.valueOf(0xFFL), dw, zeroDiff4));
    // perform the addition to receive the result
    instructions.add(ReilHelpers.createAdd(baseOffset++, dw, zeroDiff1, dw, zeroDiff2, dw, sum1));
    instructions.add(ReilHelpers.createAdd(baseOffset++, dw, zeroDiff3, dw, zeroDiff4, dw, sum2));
    instructions.add(ReilHelpers.createAdd(baseOffset++, dw, sum1, dw, sum2, dw, tmpVar4));
    instructions.add(ReilHelpers.createAdd(baseOffset++, dw, tmpVar4, dw, sourceRegister3, dw, tmpVar5));
    instructions.add(ReilHelpers.createAnd(baseOffset++, dw, tmpVar5, dw, String.valueOf(0xFFFFFFFFL), dw, targetRegister));
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode) OperandSize(com.google.security.zynamics.reil.OperandSize)

Aggregations

OperandSize (com.google.security.zynamics.reil.OperandSize)442 IOperandTreeNode (com.google.security.zynamics.zylib.disassembly.IOperandTreeNode)257 IOperandTree (com.google.security.zynamics.zylib.disassembly.IOperandTree)53 InternalTranslationException (com.google.security.zynamics.reil.translators.InternalTranslationException)46 TranslationResult (com.google.security.zynamics.reil.translators.TranslationResult)45 ReilInstruction (com.google.security.zynamics.reil.ReilInstruction)16 ArrayList (java.util.ArrayList)15 BigInteger (java.math.BigInteger)12 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)5 OperandType (com.google.security.zynamics.reil.OperandType)2 ReilOperandNode (com.google.security.zynamics.reil.ReilOperandNode)2 TranslationResultType (com.google.security.zynamics.reil.translators.TranslationResultType)2 ReilBlock (com.google.security.zynamics.reil.ReilBlock)1 ReilEdge (com.google.security.zynamics.reil.ReilEdge)1 ReilGraph (com.google.security.zynamics.reil.ReilGraph)1 ReilOperand (com.google.security.zynamics.reil.ReilOperand)1 Pair (com.google.security.zynamics.zylib.general.Pair)1 EdgeType (com.google.security.zynamics.zylib.gui.zygraph.edges.EdgeType)1 HashMap (java.util.HashMap)1 StringTokenizer (java.util.StringTokenizer)1