MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GetILOperandMemoryAddress

Function GetILOperandMemoryAddress

arch/mips/il.cpp:65–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64
65static size_t GetILOperandMemoryAddress(LowLevelILFunction& il, InstructionOperand& operand, size_t addrSize, int32_t delta=0)
66{
67 size_t offset = 0;
68 if (operand.reg == REG_ZERO)
69 return il.ConstPointer(addrSize, operand.immediate + (int64_t)delta);
70
71 if (operand.operandClass == MEM_IMM)
72 {
73 if (operand.immediate + (uint64_t)((int64_t)delta) >= 0x80000000)
74 offset = il.Sub(addrSize,
75 il.Register(addrSize, operand.reg),
76 il.Const(addrSize, -((int32_t)operand.immediate + delta)));
77 else
78 offset = il.Add(addrSize,
79 il.Register(addrSize, operand.reg),
80 il.Const(addrSize, operand.immediate + delta));
81 }
82 else if (operand.operandClass == MEM_REG)
83 {
84 if (operand.immediate + (uint64_t)((int64_t)delta) >= 0x80000000)
85 offset = il.Sub(addrSize,
86 il.Register(addrSize, operand.reg),
87 il.Register(addrSize, -((int32_t)operand.immediate + delta)));
88 else
89 offset = il.Add(addrSize,
90 il.Register(addrSize, operand.reg),
91 il.Register(addrSize, operand.immediate + delta));
92 }
93 return offset;
94}
95
96
97static size_t ReadILOperand(LowLevelILFunction& il,

Callers 3

ReadILOperandFunction · 0.70
WriteILOperandFunction · 0.70

Calls 5

ConstPointerMethod · 0.45
SubMethod · 0.45
RegisterMethod · 0.45
ConstMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected