use of com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.MemoryCell 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);
}
}
}
use of com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.MemoryCell in project binnavi by google.
the class StmTransformer method transform.
public static ValueTrackerElement transform(final ReilInstruction instruction, final ValueTrackerElement state) {
// STM x, , y
final ReilOperand inputOperand = instruction.getFirstOperand();
final ReilOperand addressOperand = instruction.getThirdOperand();
final OperandType inputOperandType = inputOperand.getType();
if (inputOperandType == OperandType.INTEGER_LITERAL) {
final IValueElement previousAddressState = state.getState(addressOperand.getValue());
final IValueElement outputValue = getValue(inputOperand, previousAddressState);
if ((previousAddressState == null) || (previousAddressState instanceof Undefined)) {
final IValueElement newThirdState = getAtomicType(addressOperand);
return state.update(instruction, new MemoryCell(newThirdState), outputValue);
} else {
final IValueElement previousState2b = state.getState(new MemoryCell(previousAddressState));
if ((previousState2b == null) || (previousState2b instanceof Undefined)) {
return state.update(instruction, new MemoryCell(previousAddressState), outputValue);
} else {
return state.update(instruction, new MemoryCell(previousState2b), outputValue);
}
}
} else if (inputOperandType == OperandType.REGISTER) {
final IValueElement newThirdState = getAtomicType(addressOperand);
final IValueElement previousStateInput = state.getState(inputOperand.getValue());
final IValueElement previousState2 = getOperandValue(addressOperand, state);
if ((previousStateInput == null) && (previousState2 == null)) {
return state.update(instruction, new MemoryCell(newThirdState), getAtomicType(inputOperand));
} else if ((previousStateInput == null) && (previousState2 != null)) {
final IValueElement previousState2b = state.getState(new MemoryCell(previousState2));
if (previousState2b == null) {
return state.update(instruction, new MemoryCell(previousState2), getAtomicType(inputOperand));
} else {
return state.update(instruction, new MemoryCell(previousState2b), getAtomicType(inputOperand));
}
} else if ((previousStateInput != null) && (previousState2 == null)) {
return state.update(instruction, new MemoryCell(newThirdState), previousStateInput);
} else if (previousState2 instanceof Undefined) {
return state.update(instruction, new MemoryCell(newThirdState), new Undefined());
} else {
final IValueElement previousState2b = state.getState(new MemoryCell(previousState2));
if ((previousState2b == null) || (previousState2b instanceof Undefined)) {
return state.update(instruction, new MemoryCell(previousState2), previousStateInput);
} else {
return state.update(instruction, new MemoryCell(previousState2b), previousStateInput);
}
}
}
throw new IllegalStateException("Not yet implemented");
}
Aggregations