Search in sources :

Example 1 with Dereference

use of com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Dereference in project binnavi by google.

the class LdmTransformer method transform.

public static ValueTrackerElement transform(final ReilInstruction instruction, final ValueTrackerElement incomingState) {
    final ReilOperand memoryAddressOperand = instruction.getFirstOperand();
    final ReilOperand outputOperand = instruction.getThirdOperand();
    final Register outputRegister = new Register(outputOperand.getValue());
    final IValueElement memoryAddress = getOperandValue(memoryAddressOperand, incomingState);
    if ((memoryAddress == null) || (memoryAddress instanceof Undefined)) {
        final IValueElement memoryAddressValue = getAtomicType(memoryAddressOperand);
        final Dereference dereference = new Dereference(memoryAddressValue);
        return incomingState.update(instruction, outputRegister, dereference);
    } else {
        final IValueElement previousState2 = incomingState.getState(new MemoryCell(memoryAddress));
        if (previousState2 == null) {
            return incomingState.update(instruction, outputRegister, new Dereference(memoryAddress));
        } else {
            return incomingState.update(instruction, outputRegister, previousState2);
        }
    }
}
Also used : Undefined(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Undefined) IValueElement(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.IValueElement) Register(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Register) ReilOperand(com.google.security.zynamics.reil.ReilOperand) Dereference(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Dereference) MemoryCell(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.MemoryCell)

Aggregations

ReilOperand (com.google.security.zynamics.reil.ReilOperand)1 Dereference (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Dereference)1 IValueElement (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.IValueElement)1 MemoryCell (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.MemoryCell)1 Register (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Register)1 Undefined (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Undefined)1