use of com.google.security.zynamics.zylib.disassembly.IOperandTree in project binnavi by google.
the class AddiuTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "addiu");
final Triple<IOperandTree, IOperandTree, IOperandTree> operands = OperandLoader.loadDuplicateFirst(instruction);
final String targetRegister = operands.first().getRootNode().getChildren().get(0).getValue();
final String sourceRegister = operands.second().getRootNode().getChildren().get(0).getValue();
final String sourceImmediate = operands.third().getRootNode().getChildren().get(0).getValue();
final OperandSize dw = OperandSize.DWORD;
final OperandSize qw = OperandSize.QWORD;
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
long offset = baseOffset;
final String temporaryResult = environment.getNextVariableString();
final String sourceImmediateSignExtended = SignExtendGenerator.extend16BitTo32(offset, environment, sourceImmediate, instructions);
offset = baseOffset + instructions.size();
instructions.add(ReilHelpers.createAdd(offset++, dw, sourceRegister, dw, sourceImmediateSignExtended, qw, temporaryResult));
instructions.add(ReilHelpers.createAnd(offset, qw, temporaryResult, dw, String.valueOf(0xFFFFFFFFL), dw, targetRegister));
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTree in project binnavi by google.
the class AdduTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "addu");
final Triple<IOperandTree, IOperandTree, IOperandTree> operands = OperandLoader.loadDuplicateFirst(instruction);
final String targetRegister = operands.first().getRootNode().getChildren().get(0).getValue();
final String sourceRegister1 = operands.second().getRootNode().getChildren().get(0).getValue();
final String sourceRegister2 = operands.third().getRootNode().getChildren().get(0).getValue();
final OperandSize dw = OperandSize.DWORD;
final OperandSize qw = OperandSize.QWORD;
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
long offset = baseOffset;
final String temporaryResult = environment.getNextVariableString();
instructions.add(ReilHelpers.createAdd(offset++, dw, sourceRegister1, dw, sourceRegister2, qw, temporaryResult));
instructions.add(ReilHelpers.createAnd(offset, qw, temporaryResult, dw, String.valueOf(0xFFFFFFFFL), dw, targetRegister));
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTree in project binnavi by google.
the class AndTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "and");
final Triple<IOperandTree, IOperandTree, IOperandTree> operands = OperandLoader.loadDuplicateFirst(instruction);
final String targetRegister = operands.first().getRootNode().getChildren().get(0).getValue();
final String sourceRegister1 = operands.second().getRootNode().getChildren().get(0).getValue();
final String sourceRegister2 = operands.third().getRootNode().getChildren().get(0).getValue();
final OperandSize dw = OperandSize.DWORD;
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
final long offset = baseOffset;
instructions.add(ReilHelpers.createAnd(offset, dw, sourceRegister1, dw, sourceRegister2, dw, targetRegister));
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTree in project binnavi by google.
the class NorTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "nor");
final Triple<IOperandTree, IOperandTree, IOperandTree> operands = OperandLoader.loadDuplicateFirst(instruction);
final String targetRegister = operands.first().getRootNode().getChildren().get(0).getValue();
final String sourceRegister1 = operands.second().getRootNode().getChildren().get(0).getValue();
final String sourceRegister2 = operands.third().getRootNode().getChildren().get(0).getValue();
final OperandSize dw = OperandSize.DWORD;
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
long offset = baseOffset;
final String temporaryOrResult = environment.getNextVariableString();
instructions.add(ReilHelpers.createOr(offset++, dw, sourceRegister1, dw, sourceRegister2, dw, temporaryOrResult));
instructions.add(ReilHelpers.createXor(offset, dw, temporaryOrResult, dw, String.valueOf(0xFFFFFFFFL), dw, targetRegister));
}
use of com.google.security.zynamics.zylib.disassembly.IOperandTree in project binnavi by google.
the class OrTranslator method translate.
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "or");
final Triple<IOperandTree, IOperandTree, IOperandTree> operands = OperandLoader.loadDuplicateFirst(instruction);
final String targetRegister = operands.first().getRootNode().getChildren().get(0).getValue();
final String sourceRegister1 = operands.second().getRootNode().getChildren().get(0).getValue();
final String sourceRegister2 = operands.third().getRootNode().getChildren().get(0).getValue();
final OperandSize dw = OperandSize.DWORD;
final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();
final long offset = baseOffset;
instructions.add(ReilHelpers.createOr(offset, dw, sourceRegister1, dw, sourceRegister2, dw, targetRegister));
}
Aggregations