From 00fc6c96d415bd31ee5ecbec70a8e4de141674cd Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Thu, 16 Aug 2018 22:30:15 -0400 Subject: Adding EXTERN_PTR type --- lowlevelilinstruction.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lowlevelilinstruction.cpp') diff --git a/lowlevelilinstruction.cpp b/lowlevelilinstruction.cpp index 4e0901f3..1522596b 100644 --- a/lowlevelilinstruction.cpp +++ b/lowlevelilinstruction.cpp @@ -171,7 +171,7 @@ unordered_map> {LLIL_MEM_PHI, {DestMemoryVersionLowLevelOperandUsage, SourceMemoryVersionsLowLevelOperandUsage}}, {LLIL_CONST, {ConstantLowLevelOperandUsage}}, {LLIL_CONST_PTR, {ConstantLowLevelOperandUsage}}, - {LLIL_RELOC_PTR, {ConstantLowLevelOperandUsage}}, + {LLIL_EXTERN_PTR, {ConstantLowLevelOperandUsage, OffsetLowLevelOperandUsage}}, {LLIL_FLOAT_CONST, {ConstantLowLevelOperandUsage}}, {LLIL_ADD, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}}, {LLIL_SUB, {LeftExprLowLevelOperandUsage, RightExprLowLevelOperandUsage}}, @@ -2114,8 +2114,8 @@ ExprId LowLevelILInstruction::CopyTo(LowLevelILFunction* dest, return dest->Const(size, GetConstant(), *this); case LLIL_CONST_PTR: return dest->ConstPointer(size, GetConstant(), *this); - case LLIL_RELOC_PTR: - return dest->ConstPointer(size, GetConstant(), *this); + case LLIL_EXTERN_PTR: + return dest->ExternPointer(size, GetConstant(), GetOffset(), *this); case LLIL_FLOAT_CONST: return dest->FloatConstRaw(size, GetConstant(), *this); case LLIL_POP: @@ -2492,6 +2492,15 @@ int64_t LowLevelILInstruction::GetConstant() const } +uint64_t LowLevelILInstruction::GetOffset() const +{ + size_t operandIndex; + if (GetOperandIndexForUsage(OffsetLowLevelOperandUsage, operandIndex)) + return GetRawOperandAsInteger(operandIndex); + throw LowLevelILInstructionAccessException(); +} + + int64_t LowLevelILInstruction::GetVector() const { size_t operandIndex; @@ -2897,9 +2906,9 @@ ExprId LowLevelILFunction::ConstPointer(size_t size, uint64_t val, const ILSourc } -ExprId LowLevelILFunction::RelocationPointer(size_t size, uint64_t val, const ILSourceLocation& loc) +ExprId LowLevelILFunction::ExternPointer(size_t size, uint64_t val, uint64_t offset, const ILSourceLocation& loc) { - return AddExprWithLocation(LLIL_RELOC_PTR, loc, size, 0, val); + return AddExprWithLocation(LLIL_EXTERN_PTR, loc, size, 0, val, offset); } -- cgit v1.3.1