Esempio n. 1
0
  @Override
  public void translate(
      final ITranslationEnvironment environment,
      final IInstruction instruction,
      final List<ReilInstruction> instructions)
      throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "beqlr");

    final IOperandTreeNode BIOperand =
        instruction.getOperands().get(0).getRootNode().getChildren().get(0);

    String suffix = "";
    if (instruction.getMnemonic().endsWith("+")) {
      suffix = "+";
    }
    if (instruction.getMnemonic().endsWith("-")) {
      suffix = "-";
    }

    BranchGenerator.generate(
        instruction.getAddress().toLong() * 0x100,
        environment,
        instruction,
        instructions,
        "beqlr" + suffix,
        String.valueOf((Helpers.getCRRegisterIndex(BIOperand.getValue()) * 4) + 2),
        Helpers.LINK_REGISTER,
        false,
        false,
        false,
        false,
        true,
        false);
  }
Esempio n. 2
0
  @Override
  public void translate(
      final ITranslationEnvironment environment,
      final IInstruction instruction,
      final List<ReilInstruction> instructions)
      throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "bta");

    final IOperandTreeNode addressOperand1 =
        instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode BIOperand =
        instruction.getOperands().get(0).getRootNode().getChildren().get(0);

    BranchGenerator.generate(
        instruction.getAddress().toLong() * 0x100,
        environment,
        instruction,
        instructions,
        "bta",
        BIOperand.getValue(),
        addressOperand1.getValue(),
        false,
        false,
        false,
        false,
        true,
        false);
  }
Esempio n. 3
0
  @Override
  public void translate(
      final ITranslationEnvironment environment,
      final IInstruction instruction,
      final List<ReilInstruction> instructions)
      throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "blel");

    Long baseOffset = instruction.getAddress().toLong() * 0x100;
    final String jumpOperand = environment.getNextVariableString();
    final IOperandTreeNode addressOperand1 =
        instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode BIOperand =
        instruction.getOperands().get(0).getRootNode().getChildren().get(0);

    instructions.add(
        ReilHelpers.createOr(
            baseOffset++,
            OperandSize.BYTE,
            String.valueOf((Helpers.getCRRegisterIndex(BIOperand.getValue()) * 4) + 2),
            OperandSize.BYTE,
            String.valueOf((Helpers.getCRRegisterIndex(BIOperand.getValue()) * 4) + 0),
            OperandSize.BYTE,
            jumpOperand));
    BranchGenerator.generate(
        baseOffset,
        environment,
        instruction,
        instructions,
        "blel",
        jumpOperand,
        addressOperand1.getValue(),
        true,
        false,
        false,
        false,
        false,
        false);
  }