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

Function ReadILOperand

arch/mips/il.cpp:97–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97static size_t ReadILOperand(LowLevelILFunction& il,
98 const Instruction& instr,
99 size_t i,
100 size_t registerSize,
101 size_t opSize = SIZE_MAX,
102 bool isAddress = false)
103{
104 if (opSize == SIZE_MAX)
105 {
106 opSize = registerSize;
107 }
108 InstructionOperand operand = instr.operands[i - 1];
109 switch (operand.operandClass)
110 {
111 case NONE:
112 return il.Undefined();
113 case IMM:
114 if (isAddress)
115 return il.Operand(i - 1, il.ConstPointer(registerSize, operand.immediate));
116 return il.Operand(i - 1, il.Const(opSize, operand.immediate));
117 case MEM_REG:
118 case MEM_IMM:
119 return il.Operand(i - 1, il.Load(opSize, GetILOperandMemoryAddress(il, operand, registerSize)));
120 default:
121 if (operand.reg == REG_ZERO)
122 return il.Operand(i - 1, il.Const(opSize, 0));
123 return il.Operand(i - 1, il.Register(opSize, operand.reg));
124 }
125}
126
127
128static size_t WriteILOperand(LowLevelILFunction& il, Instruction& instr, size_t i, size_t addrSize, size_t value)

Callers 2

Calls 7

OperandMethod · 0.80
UndefinedMethod · 0.45
ConstPointerMethod · 0.45
ConstMethod · 0.45
LoadMethod · 0.45
RegisterMethod · 0.45

Tested by

no test coverage detected