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

Function ExtractRegister

arch/arm64/il.cpp:133–166  ·  view source on GitHub ↗

extractSize can be smaller than the register, generating an LLIL_LOWPART resultSize can be larger than the register, generating sign or zero extension

Source from the content-addressed store, hash-verified

131// extractSize can be smaller than the register, generating an LLIL_LOWPART
132// resultSize can be larger than the register, generating sign or zero extension
133ExprId ExtractRegister(LowLevelILFunction& il, InstructionOperand& operand, size_t regNum,
134 size_t extractSize, bool signExtend, size_t resultSize)
135{
136 size_t opsz = get_register_size(operand.reg[regNum]);
137
138 if (IS_ZERO_REG(operand.reg[regNum]))
139 return il.Const(resultSize, 0);
140
141 ExprId res = 0;
142
143 switch (operand.operandClass)
144 {
145 case SYS_REG:
146 res = il.Register(opsz, operand.sysreg);
147 break;
148 case REG:
149 default:
150 res = il.Register(opsz, operand.reg[regNum]);
151 break;
152 }
153
154 if (extractSize < opsz)
155 res = il.LowPart(extractSize, res);
156
157 if (extractSize < resultSize || opsz < extractSize)
158 {
159 if (signExtend)
160 res = il.SignExtend(resultSize, res);
161 else
162 res = il.ZeroExtend(resultSize, res);
163 }
164
165 return res;
166}
167
168static ExprId GetFloat(LowLevelILFunction& il, InstructionOperand& operand, int float_sz)
169{

Callers 3

GetFloatFunction · 0.85
GetShiftedRegisterFunction · 0.85

Calls 6

get_register_sizeFunction · 0.50
ConstMethod · 0.45
RegisterMethod · 0.45
LowPartMethod · 0.45
SignExtendMethod · 0.45
ZeroExtendMethod · 0.45

Tested by

no test coverage detected