summaryrefslogtreecommitdiff
path: root/binaryninjacore.h
diff options
context:
space:
mode:
authorRyan Snyder <ryan@vector35.com>2024-05-24 14:47:15 -0400
committerRyan Snyder <ryan@vector35.com>2024-05-24 17:14:46 -0400
commit56115aecf186bc720dae9a20cc4c6aef248ba07f (patch)
tree1754beaa4e8601be328de689c0f6dc9d05851b35 /binaryninjacore.h
parent74920c190c5c6230833be6d50536119ce5e44c98 (diff)
platform: initial BNCustomPlatform support
Diffstat (limited to 'binaryninjacore.h')
-rw-r--r--binaryninjacore.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index d7d6244a..68dde467 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -1872,6 +1872,18 @@ extern "C"
bool (*skipAndReturnValue)(void* ctxt, uint8_t* data, uint64_t addr, size_t len, uint64_t value);
} BNCustomArchitecture;
+ typedef struct BNCustomPlatform
+ {
+ void* context;
+ void (*init)(void* ctxt, BNPlatform* obj);
+ void (*viewInit)(void* ctxt, BNBinaryView* view);
+
+ uint32_t* (*getGlobalRegisters)(void* ctxt, size_t* count);
+ void (*freeRegisterList)(void* ctxt, uint32_t* regs, size_t len);
+
+ BNType* (*getGlobalRegisterType)(void* ctxt, uint32_t reg);
+ } BNCustomPlatform;
+
typedef struct BNBasicBlockEdge
{
BNBranchType type;
@@ -6360,6 +6372,10 @@ extern "C"
BINARYNINJACOREAPI BNPlatform* BNCreatePlatform(BNArchitecture* arch, const char* name);
BINARYNINJACOREAPI BNPlatform* BNCreatePlatformWithTypes(
BNArchitecture* arch, const char* name, const char* typeFile, const char** includeDirs, size_t includeDirCount);
+ BINARYNINJACOREAPI BNPlatform* BNCreateCustomPlatform(BNArchitecture* arch, const char* name, BNCustomPlatform* impl);
+ BINARYNINJACOREAPI BNPlatform* BNCreateCustomPlatformWithTypes(
+ BNArchitecture* arch, const char* name, BNCustomPlatform* impl,
+ const char* typeFile, const char** includeDirs, size_t includeDirCount);
BINARYNINJACOREAPI void BNRegisterPlatform(const char* os, BNPlatform* platform);
BINARYNINJACOREAPI BNPlatform* BNNewPlatformReference(BNPlatform* platform);
BINARYNINJACOREAPI void BNFreePlatform(BNPlatform* platform);
@@ -6391,6 +6407,9 @@ extern "C"
BINARYNINJACOREAPI void BNRegisterPlatformFastcallCallingConvention(BNPlatform* platform, BNCallingConvention* cc);
BINARYNINJACOREAPI void BNSetPlatformSystemCallConvention(BNPlatform* platform, BNCallingConvention* cc);
+ BINARYNINJACOREAPI uint32_t* BNGetPlatformGlobalRegisters(BNPlatform* platform, size_t* count);
+ BINARYNINJACOREAPI BNType* BNGetPlatformGlobalRegisterType(BNPlatform* platform, uint32_t reg);
+
BINARYNINJACOREAPI BNPlatform* BNGetArchitectureStandalonePlatform(BNArchitecture* arch);
BINARYNINJACOREAPI BNPlatform* BNGetRelatedPlatform(BNPlatform* platform, BNArchitecture* arch);