Search in sources :

Example 1 with CpuPolicyX86

use of com.google.security.zynamics.reil.interpreter.CpuPolicyX86 in project binnavi by google.

the class InterpreterTest method testAdd2.

@Test
public void testAdd2() throws InterpreterException {
    final ReilInterpreter interpreter = new ReilInterpreter(Endianness.LITTLE_ENDIAN, new CpuPolicyX86(), new EmptyInterpreterPolicy());
    final HashMap<BigInteger, List<ReilInstruction>> instructions = new HashMap<BigInteger, List<ReilInstruction>>();
    instructions.put(BigInteger.ZERO, Lists.newArrayList(ReilHelpers.createAdd(0, OperandSize.DWORD, "2147483648", OperandSize.DWORD, "4294967295", OperandSize.QWORD, "t0")));
    interpreter.interpret(instructions, BigInteger.ZERO);
    assertEquals(BigInteger.valueOf(0x17FFFFFFFL), interpreter.getVariableValue("t0"));
}
Also used : ReilInstruction(com.google.security.zynamics.reil.ReilInstruction) ReilInterpreter(com.google.security.zynamics.reil.interpreter.ReilInterpreter) HashMap(java.util.HashMap) CpuPolicyX86(com.google.security.zynamics.reil.interpreter.CpuPolicyX86) BigInteger(java.math.BigInteger) List(java.util.List) EmptyInterpreterPolicy(com.google.security.zynamics.reil.interpreter.EmptyInterpreterPolicy) Test(org.junit.Test)

Example 2 with CpuPolicyX86

use of com.google.security.zynamics.reil.interpreter.CpuPolicyX86 in project binnavi by google.

the class InterpreterTest method testAdd.

@Test
public void testAdd() throws InterpreterException {
    final ReilInterpreter interpreter = new ReilInterpreter(Endianness.LITTLE_ENDIAN, new CpuPolicyX86(), new EmptyInterpreterPolicy());
    final HashMap<BigInteger, List<ReilInstruction>> instructions = new HashMap<BigInteger, List<ReilInstruction>>();
    instructions.put(BigInteger.ZERO, Lists.newArrayList(ReilHelpers.createAdd(0, OperandSize.DWORD, "2147483647", OperandSize.DWORD, "1", OperandSize.QWORD, "t0")));
    interpreter.interpret(instructions, BigInteger.ZERO);
    assertEquals(BigInteger.valueOf(0x80000000L), interpreter.getVariableValue("t0"));
}
Also used : ReilInstruction(com.google.security.zynamics.reil.ReilInstruction) ReilInterpreter(com.google.security.zynamics.reil.interpreter.ReilInterpreter) HashMap(java.util.HashMap) CpuPolicyX86(com.google.security.zynamics.reil.interpreter.CpuPolicyX86) BigInteger(java.math.BigInteger) List(java.util.List) EmptyInterpreterPolicy(com.google.security.zynamics.reil.interpreter.EmptyInterpreterPolicy) Test(org.junit.Test)

Aggregations

ReilInstruction (com.google.security.zynamics.reil.ReilInstruction)2 CpuPolicyX86 (com.google.security.zynamics.reil.interpreter.CpuPolicyX86)2 EmptyInterpreterPolicy (com.google.security.zynamics.reil.interpreter.EmptyInterpreterPolicy)2 ReilInterpreter (com.google.security.zynamics.reil.interpreter.ReilInterpreter)2 BigInteger (java.math.BigInteger)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Test (org.junit.Test)2