BinaryNinja::ArchitectureHook Class Reference

Public Member Functions

 ArchitectureHook (Architecture *base)
 
- Public Member Functions inherited from BinaryNinja::CoreArchitecture
 CoreArchitecture (BNArchitecture *arch)
 
virtual BNEndianness GetEndianness () const override
 
virtual size_t GetAddressSize () const override
 
virtual size_t GetDefaultIntegerSize () const override
 
virtual size_t GetInstructionAlignment () const override
 
virtual size_t GetMaxInstructionLength () const override
 
virtual size_t GetOpcodeDisplayLength () const override
 
virtual Ref< ArchitectureGetAssociatedArchitectureByAddress (uint64_t &addr) override
 
virtual bool GetInstructionInfo (const uint8_t *data, uint64_t addr, size_t maxLen, InstructionInfo &result) override
 
virtual bool GetInstructionText (const uint8_t *data, uint64_t addr, size_t &len, std::vector< InstructionTextToken > &result) override
 
virtual bool GetInstructionLowLevelIL (const uint8_t *data, uint64_t addr, size_t &len, LowLevelILFunction &il) override
 GetInstructionLowLevelIL Translates an instruction at addr and appends it onto the LowLevelILFunction& il. More...
 
virtual std::string GetRegisterName (uint32_t reg) override
 
virtual std::string GetFlagName (uint32_t flag) override
 
virtual std::string GetFlagWriteTypeName (uint32_t flags) override
 
virtual std::string GetSemanticFlagClassName (uint32_t semClass) override
 
virtual std::string GetSemanticFlagGroupName (uint32_t semGroup) override
 
virtual std::vector< uint32_t > GetFullWidthRegisters () override
 
virtual std::vector< uint32_t > GetAllRegisters () override
 
virtual std::vector< uint32_t > GetAllFlags () override
 
virtual std::vector< uint32_t > GetAllFlagWriteTypes () override
 
virtual std::vector< uint32_t > GetAllSemanticFlagClasses () override
 
virtual std::vector< uint32_t > GetAllSemanticFlagGroups () override
 
virtual BNFlagRole GetFlagRole (uint32_t flag, uint32_t semClass=0) override
 
virtual std::vector< uint32_t > GetFlagsRequiredForFlagCondition (BNLowLevelILFlagCondition cond, uint32_t semClass=0) override
 
virtual std::vector< uint32_t > GetFlagsRequiredForSemanticFlagGroup (uint32_t semGroup) override
 
virtual std::map< uint32_t, BNLowLevelILFlagConditionGetFlagConditionsForSemanticFlagGroup (uint32_t semGroup) override
 
virtual std::vector< uint32_t > GetFlagsWrittenByFlagWriteType (uint32_t writeType) override
 
virtual uint32_t GetSemanticClassForFlagWriteType (uint32_t writeType) override
 
virtual ExprId GetFlagWriteLowLevelIL (BNLowLevelILOperation op, size_t size, uint32_t flagWriteType, uint32_t flag, BNRegisterOrConstant *operands, size_t operandCount, LowLevelILFunction &il) override
 
virtual ExprId GetFlagConditionLowLevelIL (BNLowLevelILFlagCondition cond, uint32_t semClass, LowLevelILFunction &il) override
 
virtual ExprId GetSemanticFlagGroupLowLevelIL (uint32_t semGroup, LowLevelILFunction &il) override
 
virtual BNRegisterInfo GetRegisterInfo (uint32_t reg) override
 
virtual uint32_t GetStackPointerRegister () override
 
virtual uint32_t GetLinkRegister () override
 
virtual std::vector< uint32_t > GetGlobalRegisters () override
 
virtual std::vector< uint32_t > GetSystemRegisters () override
 
virtual std::string GetRegisterStackName (uint32_t regStack) override
 
virtual std::vector< uint32_t > GetAllRegisterStacks () override
 
virtual BNRegisterStackInfo GetRegisterStackInfo (uint32_t regStack) override
 
virtual std::string GetIntrinsicName (uint32_t intrinsic) override
 
virtual std::vector< uint32_t > GetAllIntrinsics () override
 
virtual std::vector< NameAndTypeGetIntrinsicInputs (uint32_t intrinsic) override
 
virtual std::vector< Confidence< Ref< Type > > > GetIntrinsicOutputs (uint32_t intrinsic) override
 
virtual bool CanAssemble () override
 
virtual bool Assemble (const std::string &code, uint64_t addr, DataBuffer &result, std::string &errors) override
 
virtual bool IsNeverBranchPatchAvailable (const uint8_t *data, uint64_t addr, size_t len) override
 IsNeverBranchPatchAvailable returns true if the instruction at addr can be patched to never branch. More...
 
virtual bool IsAlwaysBranchPatchAvailable (const uint8_t *data, uint64_t addr, size_t len) override
 IsAlwaysBranchPatchAvailable returns true if the instruction at addr can be patched to always branch. More...
 
virtual bool IsInvertBranchPatchAvailable (const uint8_t *data, uint64_t addr, size_t len) override
 IsInvertBranchPatchAvailable returns true if the instruction at addr can be patched to invert the branch. More...
 
virtual bool IsSkipAndReturnZeroPatchAvailable (const uint8_t *data, uint64_t addr, size_t len) override
 IsSkipAndReturnZeroPatchAvailable returns true if the instruction at addr is a call that can be patched to return zero. More...
 
virtual bool IsSkipAndReturnValuePatchAvailable (const uint8_t *data, uint64_t addr, size_t len) override
 IsSkipAndReturnValuePatchAvailable returns true if the instruction at addr is a call that can be patched to return a value. More...
 
virtual bool ConvertToNop (uint8_t *data, uint64_t addr, size_t len) override
 ConvertToNop converts the instruction at addr to a no-operation instruction. More...
 
virtual bool AlwaysBranch (uint8_t *data, uint64_t addr, size_t len) override
 AlwaysBranch converts the conditional branch instruction at addr to an unconditional branch. More...
 
virtual bool InvertBranch (uint8_t *data, uint64_t addr, size_t len) override
 InvertBranch converts the conditional branch instruction at addr to its invert. More...
 
virtual bool SkipAndReturnValue (uint8_t *data, uint64_t addr, size_t len, uint64_t value) override
 SkipAndReturnValue converts the call instruction at addr to an instruction that simulates that call returning a value. More...
 
- Public Member Functions inherited from BinaryNinja::Architecture
 Architecture (const std::string &name)
 
std::string GetName () const
 
virtual BNEndianness GetEndianness () const =0
 
virtual size_t GetAddressSize () const =0
 
virtual size_t GetDefaultIntegerSize () const
 
virtual size_t GetInstructionAlignment () const
 
virtual size_t GetMaxInstructionLength () const
 
virtual size_t GetOpcodeDisplayLength () const
 
virtual Ref< ArchitectureGetAssociatedArchitectureByAddress (uint64_t &addr)
 
virtual bool GetInstructionInfo (const uint8_t *data, uint64_t addr, size_t maxLen, InstructionInfo &result)=0
 
virtual bool GetInstructionText (const uint8_t *data, uint64_t addr, size_t &len, std::vector< InstructionTextToken > &result)=0
 
virtual bool GetInstructionLowLevelIL (const uint8_t *data, uint64_t addr, size_t &len, LowLevelILFunction &il)
 GetInstructionLowLevelIL Translates an instruction at addr and appends it onto the LowLevelILFunction& il. More...
 
virtual std::string GetRegisterName (uint32_t reg)
 
virtual std::string GetFlagName (uint32_t flag)
 
virtual std::string GetFlagWriteTypeName (uint32_t flags)
 
virtual std::string GetSemanticFlagClassName (uint32_t semClass)
 
virtual std::string GetSemanticFlagGroupName (uint32_t semGroup)
 
virtual std::vector< uint32_t > GetFullWidthRegisters ()
 
virtual std::vector< uint32_t > GetAllRegisters ()
 
virtual std::vector< uint32_t > GetAllFlags ()
 
virtual std::vector< uint32_t > GetAllFlagWriteTypes ()
 
virtual std::vector< uint32_t > GetAllSemanticFlagClasses ()
 
virtual std::vector< uint32_t > GetAllSemanticFlagGroups ()
 
virtual BNFlagRole GetFlagRole (uint32_t flag, uint32_t semClass=0)
 
virtual std::vector< uint32_t > GetFlagsRequiredForFlagCondition (BNLowLevelILFlagCondition cond, uint32_t semClass=0)
 
virtual std::vector< uint32_t > GetFlagsRequiredForSemanticFlagGroup (uint32_t semGroup)
 
virtual std::map< uint32_t, BNLowLevelILFlagConditionGetFlagConditionsForSemanticFlagGroup (uint32_t semGroup)
 
virtual std::vector< uint32_t > GetFlagsWrittenByFlagWriteType (uint32_t writeType)
 
virtual uint32_t GetSemanticClassForFlagWriteType (uint32_t writeType)
 
virtual ExprId GetFlagWriteLowLevelIL (BNLowLevelILOperation op, size_t size, uint32_t flagWriteType, uint32_t flag, BNRegisterOrConstant *operands, size_t operandCount, LowLevelILFunction &il)
 
ExprId GetDefaultFlagWriteLowLevelIL (BNLowLevelILOperation op, size_t size, BNFlagRole role, BNRegisterOrConstant *operands, size_t operandCount, LowLevelILFunction &il)
 
virtual ExprId GetFlagConditionLowLevelIL (BNLowLevelILFlagCondition cond, uint32_t semClass, LowLevelILFunction &il)
 
ExprId GetDefaultFlagConditionLowLevelIL (BNLowLevelILFlagCondition cond, uint32_t semClass, LowLevelILFunction &il)
 
virtual ExprId GetSemanticFlagGroupLowLevelIL (uint32_t semGroup, LowLevelILFunction &il)
 
virtual BNRegisterInfo GetRegisterInfo (uint32_t reg)
 
virtual uint32_t GetStackPointerRegister ()
 
virtual uint32_t GetLinkRegister ()
 
virtual std::vector< uint32_t > GetGlobalRegisters ()
 
bool IsGlobalRegister (uint32_t reg)
 
virtual std::vector< uint32_t > GetSystemRegisters ()
 
bool IsSystemRegister (uint32_t reg)
 
std::vector< uint32_t > GetModifiedRegistersOnWrite (uint32_t reg)
 
uint32_t GetRegisterByName (const std::string &name)
 
virtual std::string GetRegisterStackName (uint32_t regStack)
 
virtual std::vector< uint32_t > GetAllRegisterStacks ()
 
virtual BNRegisterStackInfo GetRegisterStackInfo (uint32_t regStack)
 
uint32_t GetRegisterStackForRegister (uint32_t reg)
 
virtual std::string GetIntrinsicName (uint32_t intrinsic)
 
virtual std::vector< uint32_t > GetAllIntrinsics ()
 
virtual std::vector< NameAndTypeGetIntrinsicInputs (uint32_t intrinsic)
 
virtual std::vector< Confidence< Ref< Type > > > GetIntrinsicOutputs (uint32_t intrinsic)
 
virtual bool CanAssemble ()
 
virtual bool Assemble (const std::string &code, uint64_t addr, DataBuffer &result, std::string &errors)
 
virtual bool IsNeverBranchPatchAvailable (const uint8_t *data, uint64_t addr, size_t len)
 IsNeverBranchPatchAvailable returns true if the instruction at addr can be patched to never branch. More...
 
virtual bool IsAlwaysBranchPatchAvailable (const uint8_t *data, uint64_t addr, size_t len)
 IsAlwaysBranchPatchAvailable returns true if the instruction at addr can be patched to always branch. More...
 
virtual bool IsInvertBranchPatchAvailable (const uint8_t *data, uint64_t addr, size_t len)
 IsInvertBranchPatchAvailable returns true if the instruction at addr can be patched to invert the branch. More...
 
virtual bool IsSkipAndReturnZeroPatchAvailable (const uint8_t *data, uint64_t addr, size_t len)
 IsSkipAndReturnZeroPatchAvailable returns true if the instruction at addr is a call that can be patched to return zero. More...
 
virtual bool IsSkipAndReturnValuePatchAvailable (const uint8_t *data, uint64_t addr, size_t len)
 IsSkipAndReturnValuePatchAvailable returns true if the instruction at addr is a call that can be patched to return a value. More...
 
virtual bool ConvertToNop (uint8_t *data, uint64_t addr, size_t len)
 ConvertToNop converts the instruction at addr to a no-operation instruction. More...
 
virtual bool AlwaysBranch (uint8_t *data, uint64_t addr, size_t len)
 AlwaysBranch converts the conditional branch instruction at addr to an unconditional branch. More...
 
virtual bool InvertBranch (uint8_t *data, uint64_t addr, size_t len)
 InvertBranch converts the conditional branch instruction at addr to its invert. More...
 
virtual bool SkipAndReturnValue (uint8_t *data, uint64_t addr, size_t len, uint64_t value)
 SkipAndReturnValue converts the call instruction at addr to an instruction that simulates that call returning a value. More...
 
void RegisterFunctionRecognizer (FunctionRecognizer *recog)
 
void RegisterRelocationHandler (const std::string &viewName, RelocationHandler *handler)
 
Ref< RelocationHandlerGetRelocationHandler (const std::string &viewName)
 
bool IsBinaryViewTypeConstantDefined (const std::string &type, const std::string &name)
 
uint64_t GetBinaryViewTypeConstant (const std::string &type, const std::string &name, uint64_t defaultValue=0)
 
void SetBinaryViewTypeConstant (const std::string &type, const std::string &name, uint64_t value)
 
void RegisterCallingConvention (CallingConvention *cc)
 
std::vector< Ref< CallingConvention > > GetCallingConventions ()
 
Ref< CallingConventionGetCallingConventionByName (const std::string &name)
 
void SetDefaultCallingConvention (CallingConvention *cc)
 
void SetCdeclCallingConvention (CallingConvention *cc)
 
void SetStdcallCallingConvention (CallingConvention *cc)
 
void SetFastcallCallingConvention (CallingConvention *cc)
 
Ref< CallingConventionGetDefaultCallingConvention ()
 
Ref< CallingConventionGetCdeclCallingConvention ()
 
Ref< CallingConventionGetStdcallCallingConvention ()
 
Ref< CallingConventionGetFastcallCallingConvention ()
 
Ref< PlatformGetStandalonePlatform ()
 
void AddArchitectureRedirection (Architecture *from, Architecture *to)
 
- Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNArchitecture >
 StaticCoreRefCountObject ()
 
virtual ~StaticCoreRefCountObject ()
 
BNArchitecture * GetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 

Protected Member Functions

virtual void Register (BNCustomArchitecture *callbacks) override
 
- Protected Member Functions inherited from BinaryNinja::Architecture
 Architecture (BNArchitecture *arch)
 
virtual void Register (BNCustomArchitecture *callbacks)
 

Protected Attributes

Ref< Architecturem_base
 
- Protected Attributes inherited from BinaryNinja::Architecture
std::string m_nameForRegister
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::Architecture
static void Register (Architecture *arch)
 
static Ref< ArchitectureGetByName (const std::string &name)
 
static std::vector< Ref< Architecture > > GetList ()
 
- Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNArchitecture >
static BNArchitecture * GetObject (StaticCoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNArchitecture >
std::atomic< int > m_refs
 
BNArchitecture * m_object
 
- Static Protected Member Functions inherited from BinaryNinja::Architecture
static void InitCallback (void *ctxt, BNArchitecture *obj)
 
static BNEndianness GetEndiannessCallback (void *ctxt)
 
static size_t GetAddressSizeCallback (void *ctxt)
 
static size_t GetDefaultIntegerSizeCallback (void *ctxt)
 
static size_t GetInstructionAlignmentCallback (void *ctxt)
 
static size_t GetMaxInstructionLengthCallback (void *ctxt)
 
static size_t GetOpcodeDisplayLengthCallback (void *ctxt)
 
static BNArchitecture * GetAssociatedArchitectureByAddressCallback (void *ctxt, uint64_t *addr)
 
static bool GetInstructionInfoCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t maxLen, BNInstructionInfo *result)
 
static bool GetInstructionTextCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t *len, BNInstructionTextToken **result, size_t *count)
 
static void FreeInstructionTextCallback (BNInstructionTextToken *tokens, size_t count)
 
static bool GetInstructionLowLevelILCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t *len, BNLowLevelILFunction *il)
 
static char * GetRegisterNameCallback (void *ctxt, uint32_t reg)
 
static char * GetFlagNameCallback (void *ctxt, uint32_t flag)
 
static char * GetFlagWriteTypeNameCallback (void *ctxt, uint32_t flags)
 
static char * GetSemanticFlagClassNameCallback (void *ctxt, uint32_t semClass)
 
static char * GetSemanticFlagGroupNameCallback (void *ctxt, uint32_t semGroup)
 
static uint32_t * GetFullWidthRegistersCallback (void *ctxt, size_t *count)
 
static uint32_t * GetAllRegistersCallback (void *ctxt, size_t *count)
 
static uint32_t * GetAllFlagsCallback (void *ctxt, size_t *count)
 
static uint32_t * GetAllFlagWriteTypesCallback (void *ctxt, size_t *count)
 
static uint32_t * GetAllSemanticFlagClassesCallback (void *ctxt, size_t *count)
 
static uint32_t * GetAllSemanticFlagGroupsCallback (void *ctxt, size_t *count)
 
static BNFlagRole GetFlagRoleCallback (void *ctxt, uint32_t flag, uint32_t semClass)
 
static uint32_t * GetFlagsRequiredForFlagConditionCallback (void *ctxt, BNLowLevelILFlagCondition cond, uint32_t semClass, size_t *count)
 
static uint32_t * GetFlagsRequiredForSemanticFlagGroupCallback (void *ctxt, uint32_t semGroup, size_t *count)
 
static BNFlagConditionForSemanticClassGetFlagConditionsForSemanticFlagGroupCallback (void *ctxt, uint32_t semGroup, size_t *count)
 
static void FreeFlagConditionsForSemanticFlagGroupCallback (void *ctxt, BNFlagConditionForSemanticClass *conditions)
 
static uint32_t * GetFlagsWrittenByFlagWriteTypeCallback (void *ctxt, uint32_t writeType, size_t *count)
 
static uint32_t GetSemanticClassForFlagWriteTypeCallback (void *ctxt, uint32_t writeType)
 
static size_t GetFlagWriteLowLevelILCallback (void *ctxt, BNLowLevelILOperation op, size_t size, uint32_t flagWriteType, uint32_t flag, BNRegisterOrConstant *operands, size_t operandCount, BNLowLevelILFunction *il)
 
static size_t GetFlagConditionLowLevelILCallback (void *ctxt, BNLowLevelILFlagCondition cond, uint32_t semClass, BNLowLevelILFunction *il)
 
static size_t GetSemanticFlagGroupLowLevelILCallback (void *ctxt, uint32_t semGroup, BNLowLevelILFunction *il)
 
static void FreeRegisterListCallback (void *ctxt, uint32_t *regs)
 
static void GetRegisterInfoCallback (void *ctxt, uint32_t reg, BNRegisterInfo *result)
 
static uint32_t GetStackPointerRegisterCallback (void *ctxt)
 
static uint32_t GetLinkRegisterCallback (void *ctxt)
 
static uint32_t * GetGlobalRegistersCallback (void *ctxt, size_t *count)
 
static uint32_t * GetSystemRegistersCallback (void *ctxt, size_t *count)
 
static char * GetRegisterStackNameCallback (void *ctxt, uint32_t regStack)
 
static uint32_t * GetAllRegisterStacksCallback (void *ctxt, size_t *count)
 
static void GetRegisterStackInfoCallback (void *ctxt, uint32_t regStack, BNRegisterStackInfo *result)
 
static char * GetIntrinsicNameCallback (void *ctxt, uint32_t intrinsic)
 
static uint32_t * GetAllIntrinsicsCallback (void *ctxt, size_t *count)
 
static BNNameAndTypeGetIntrinsicInputsCallback (void *ctxt, uint32_t intrinsic, size_t *count)
 
static void FreeNameAndTypeListCallback (void *ctxt, BNNameAndType *nt, size_t count)
 
static BNTypeWithConfidenceGetIntrinsicOutputsCallback (void *ctxt, uint32_t intrinsic, size_t *count)
 
static void FreeTypeListCallback (void *ctxt, BNTypeWithConfidence *types, size_t count)
 
static bool CanAssembleCallback (void *ctxt)
 
static bool AssembleCallback (void *ctxt, const char *code, uint64_t addr, BNDataBuffer *result, char **errors)
 
static bool IsNeverBranchPatchAvailableCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t len)
 
static bool IsAlwaysBranchPatchAvailableCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t len)
 
static bool IsInvertBranchPatchAvailableCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t len)
 
static bool IsSkipAndReturnZeroPatchAvailableCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t len)
 
static bool IsSkipAndReturnValuePatchAvailableCallback (void *ctxt, const uint8_t *data, uint64_t addr, size_t len)
 
static bool ConvertToNopCallback (void *ctxt, uint8_t *data, uint64_t addr, size_t len)
 
static bool AlwaysBranchCallback (void *ctxt, uint8_t *data, uint64_t addr, size_t len)
 
static bool InvertBranchCallback (void *ctxt, uint8_t *data, uint64_t addr, size_t len)
 
static bool SkipAndReturnValueCallback (void *ctxt, uint8_t *data, uint64_t addr, size_t len, uint64_t value)
 

Constructor & Destructor Documentation

◆ ArchitectureHook()

ArchitectureHook::ArchitectureHook ( Architecture base)

Member Function Documentation

◆ Register()

void ArchitectureHook::Register ( BNCustomArchitecture callbacks)
overrideprotectedvirtual

Reimplemented from BinaryNinja::Architecture.

Member Data Documentation

◆ m_base

Ref<Architecture> BinaryNinja::ArchitectureHook::m_base
protected

The documentation for this class was generated from the following files: