Search in sources :

Example 46 with IOperandTreeNode

use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.

the class OrcDotTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "orc.");
    final IOperandTreeNode registerOperand1 = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode registerOperand2 = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    OrGenerator.generate(instruction.getAddress().toLong() * 0x100, environment, instruction, instructions, "orc.", registerOperand1.getValue(), registerOperand2.getValue(), true, false, true);
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode)

Example 47 with IOperandTreeNode

use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.

the class OriTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "ori");
    final IOperandTreeNode registerOperand1 = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode literalOperand1 = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    OrGenerator.generate(instruction.getAddress().toLong() * 0x100, environment, instruction, instructions, "ori", registerOperand1.getValue(), literalOperand1.getValue(), false, false, false);
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode)

Example 48 with IOperandTreeNode

use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.

the class OrisTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "oris");
    final IOperandTreeNode registerOperand1 = instruction.getOperands().get(1).getRootNode().getChildren().get(0);
    final IOperandTreeNode literalOperand1 = instruction.getOperands().get(2).getRootNode().getChildren().get(0);
    long baseOffset = instruction.getAddress().toLong() * 0x100;
    final String tmpLiteralValue = environment.getNextVariableString();
    instructions.add(ReilHelpers.createStr(baseOffset++, OperandSize.DWORD, String.valueOf(Long.valueOf(literalOperand1.getValue()) << 16), OperandSize.DWORD, tmpLiteralValue));
    OrGenerator.generate(baseOffset, environment, instruction, instructions, "oris", registerOperand1.getValue(), tmpLiteralValue, false, false, false);
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode)

Example 49 with IOperandTreeNode

use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.

the class CReferenceFinder method fetchReferenceMap.

/**
   * Fetch for outgoing code references of a tree node and all of its children.
   * 
   * @param node The start node of the search.
   * @param instruction The instruction the operand tree belongs to.
   * @param functions The map of code references.
   */
private static void fetchReferenceMap(final IOperandTreeNode node, final INaviInstruction instruction, final Map<INaviInstruction, INaviFunction> functions) {
    final List<IReference> references = node.getReferences();
    for (final IReference reference : references) {
        if (ReferenceType.isCodeReference(reference.getType())) {
            final IAddress target = reference.getTarget();
            final INaviFunction function = instruction.getModule().getContent().getFunctionContainer().getFunction(target);
            if (function != null) {
                functions.put(instruction, function);
            }
        }
    }
    for (final IOperandTreeNode child : node.getChildren()) {
        fetchReferenceMap(child, instruction, functions);
    }
}
Also used : IReference(com.google.security.zynamics.zylib.disassembly.IReference) IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Example 50 with IOperandTreeNode

use of com.google.security.zynamics.zylib.disassembly.IOperandTreeNode in project binnavi by google.

the class BlelrlTranslator method translate.

@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
    TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "blelrl");
    Long baseOffset = instruction.getAddress().toLong() * 0x100;
    final String jumpOperand = environment.getNextVariableString();
    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, "blelrl", jumpOperand, Helpers.LINK_REGISTER, true, false, false, false, false, false);
}
Also used : IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode)

Aggregations

IOperandTreeNode (com.google.security.zynamics.zylib.disassembly.IOperandTreeNode)518 OperandSize (com.google.security.zynamics.reil.OperandSize)257 BigInteger (java.math.BigInteger)5 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)3 InternalTranslationException (com.google.security.zynamics.reil.translators.InternalTranslationException)2 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)2 IReference (com.google.security.zynamics.zylib.disassembly.IReference)2 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)1 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)1 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)1 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)1 ReilOperandNode (com.google.security.zynamics.reil.ReilOperandNode)1 TranslationResult (com.google.security.zynamics.reil.translators.TranslationResult)1 IInstruction (com.google.security.zynamics.zylib.disassembly.IInstruction)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1