diff options
| author | Ryan Snyder <ryan@vector35.com> | 2024-05-24 14:47:15 -0400 |
|---|---|---|
| committer | Ryan Snyder <ryan@vector35.com> | 2024-05-24 17:14:46 -0400 |
| commit | 56115aecf186bc720dae9a20cc4c6aef248ba07f (patch) | |
| tree | 1754beaa4e8601be328de689c0f6dc9d05851b35 /binaryninjaapi.h | |
| parent | 74920c190c5c6230833be6d50536119ce5e44c98 (diff) | |
platform: initial BNCustomPlatform support
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 477d1b60..8eb3cdaf 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -14495,6 +14495,12 @@ namespace BinaryNinja { Platform(Architecture* arch, const std::string& name, const std::string& typeFile, const std::vector<std::string>& includeDirs = std::vector<std::string>()); + static void InitCallback(void *ctxt, BNPlatform*); + static void InitViewCallback(void* ctxt, BNBinaryView* view); + static uint32_t* GetGlobalRegistersCallback(void* ctxt, size_t* count); + static void FreeRegisterListCallback(void* ctxt, uint32_t* regs, size_t count); + static BNType* GetGlobalRegisterTypeCallback(void* ctxt, uint32_t reg); + public: Platform(BNPlatform* platform); @@ -14630,6 +14636,30 @@ namespace BinaryNinja { */ void SetSystemCallConvention(CallingConvention* cc); + /*! Callback that will be called when the platform of a binaryview + * is set. Allows for the Platform to to do platform-specific + * processing of views just after finalization. + * + * \param view BinaryView that was just set to this Platform + */ + virtual void BinaryViewInit(BinaryView* view); + + /*! Get the global register list for this Platform + * + * Allows the Platform to override the global register list + * used by analysis. + */ + virtual std::vector<uint32_t> GetGlobalRegisters(); + + /*! Get the type of a global register + * + * Called by analysis when the incoming register value of a + * global register is observed. + * + * \param reg The register being queried for type information. + */ + virtual Ref<Type> GetGlobalRegisterType(uint32_t reg); + Ref<Platform> GetRelatedPlatform(Architecture* arch); void AddRelatedPlatform(Architecture* arch, Platform* platform); Ref<Platform> GetAssociatedPlatformByAddress(uint64_t& addr); @@ -14720,6 +14750,16 @@ namespace BinaryNinja { const std::string& autoTypeSource = ""); }; + + class CorePlatform : public Platform + { + public: + CorePlatform(BNPlatform* plat); + + virtual std::vector<uint32_t> GetGlobalRegisters() override; + virtual Ref<Type> GetGlobalRegisterType(uint32_t reg) override; + }; + /*! \ingroup typeparser */ |
