diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2016-07-24 19:12:18 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2016-07-24 19:12:18 -0400 |
| commit | 4b722a7961e372bd5638a0e538272395d60a1797 (patch) | |
| tree | 8adfb97a94aa01e815cb29f8e1cd7d1e26c7f3b3 /architecture.cpp | |
| parent | 58f251e982f7c1b59c6934a72683a75c234b3b35 (diff) | |
| parent | 11cf9f176f45f03df16bf69c5ca33789ba0ded22 (diff) | |
Merge branch 'dev' of github.com:Vector35/binaryninja-api into dev
Diffstat (limited to 'architecture.cpp')
| -rw-r--r-- | architecture.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/architecture.cpp b/architecture.cpp index accfa69f..d068ff36 100644 --- a/architecture.cpp +++ b/architecture.cpp @@ -97,6 +97,20 @@ size_t Architecture::GetDefaultIntegerSizeCallback(void* ctxt) } +size_t Architecture::GetMaxInstructionLengthCallback(void* ctxt) +{ + Architecture* arch = (Architecture*)ctxt; + return arch->GetMaxInstructionLength(); +} + + +size_t Architecture::GetOpcodeDisplayLengthCallback(void* ctxt) +{ + Architecture* arch = (Architecture*)ctxt; + return arch->GetOpcodeDisplayLength(); +} + + bool Architecture::GetInstructionInfoCallback(void* ctxt, const uint8_t* data, uint64_t addr, size_t maxLen, BNInstructionInfo* result) { @@ -390,6 +404,8 @@ void Architecture::Register(Architecture* arch) callbacks.getEndianness = GetEndiannessCallback; callbacks.getAddressSize = GetAddressSizeCallback; callbacks.getDefaultIntegerSize = GetDefaultIntegerSizeCallback; + callbacks.getMaxInstructionLength = GetMaxInstructionLengthCallback; + callbacks.getOpcodeDisplayLength = GetOpcodeDisplayLengthCallback; callbacks.getInstructionInfo = GetInstructionInfoCallback; callbacks.getInstructionText = GetInstructionTextCallback; callbacks.freeInstructionText = FreeInstructionTextCallback; @@ -466,6 +482,21 @@ size_t Architecture::GetDefaultIntegerSize() const } +size_t Architecture::GetMaxInstructionLength() const +{ + return BN_DEFAULT_NSTRUCTION_LENGTH; +} + + +size_t Architecture::GetOpcodeDisplayLength() const +{ + size_t maxLen = GetMaxInstructionLength(); + if (maxLen < BN_DEFAULT_OPCODE_DISPLAY) + return maxLen; + return BN_DEFAULT_OPCODE_DISPLAY; +} + + bool Architecture::GetInstructionLowLevelIL(const uint8_t*, uint64_t, size_t&, LowLevelILFunction& il) { il.AddInstruction(il.Undefined()); @@ -874,6 +905,18 @@ size_t CoreArchitecture::GetDefaultIntegerSize() const } +size_t CoreArchitecture::GetMaxInstructionLength() const +{ + return BNGetArchitectureMaxInstructionLength(m_object); +} + + +size_t CoreArchitecture::GetOpcodeDisplayLength() const +{ + return BNGetArchitectureOpcodeDisplayLength(m_object); +} + + bool CoreArchitecture::GetInstructionInfo(const uint8_t* data, uint64_t addr, size_t maxLen, InstructionInfo& result) { return BNGetInstructionInfo(m_object, data, addr, maxLen, &result); |
