diff --git a/libIRDB/include/decode/operand.hpp b/libIRDB/include/decode/operand.hpp index 37d3918792abd10d4cbbf71d2685ef8cd72b12bb..8a725f10e2c4cd2cf60f4e2046dad5a8865d1264 100644 --- a/libIRDB/include/decode/operand.hpp +++ b/libIRDB/include/decode/operand.hpp @@ -35,11 +35,13 @@ class DecodedOperand_t bool hasIndexRegister() const; uint32_t getBaseRegister() const; uint32_t getIndexRegister() const; + bool hasMemoryDisplacement() const; virtual_offset_t getMemoryDisplacement() const; bool isPcrel() const; uint32_t getScaleValue() const; uint32_t getMemoryDisplacementEncodingSize() const; uint32_t getArgumentSizeInBytes() const; + uint32_t getArgumentSizeInBits() const; bool isRead() const; bool isWritten() const; diff --git a/libIRDB/src/decode/operand.cpp b/libIRDB/src/decode/operand.cpp index 6b02b80d5a5f0aecbd0b7333d8ad109e80be6d13..8e9fbce38b156bdedece459af32458494c23f29f 100644 --- a/libIRDB/src/decode/operand.cpp +++ b/libIRDB/src/decode/operand.cpp @@ -194,6 +194,14 @@ uint32_t DecodedOperand_t::getScaleValue() const return t->Memory.Scale; /* 0 indicates no scale */ } +bool DecodedOperand_t::hasMemoryDisplacement() const +{ + if(!isMemory()) + throw std::logic_error("GetBaseRegister called on not memory operand"); + ARGTYPE *t=static_cast<ARGTYPE*>(arg_data); + return t->Memory.DisplacementAddr!=0; +} + virtual_offset_t DecodedOperand_t::getMemoryDisplacement() const { if(!isMemory()) @@ -220,6 +228,12 @@ uint32_t DecodedOperand_t::getArgumentSizeInBytes() const return t->ArgSize/8; } +uint32_t DecodedOperand_t::getArgumentSizeInBits() const +{ + ARGTYPE *t=static_cast<ARGTYPE*>(arg_data); + return t->ArgSize; +} + bool DecodedOperand_t::hasSegmentRegister() const { ARGTYPE *t=static_cast<ARGTYPE*>(arg_data);