summaryrefslogtreecommitdiff
path: root/platform.cpp
diff options
context:
space:
mode:
authorZichuan Li <34680029+river-li@users.noreply.github.com>2024-06-11 18:20:56 -0400
committerZichuan Li <34680029+river-li@users.noreply.github.com>2024-06-19 13:04:46 -0400
commitfc5b443d86d10c5ce308630f8b41c8f64f5f40f1 (patch)
treed4ba6b13d1ffbc974f6371a7e4037b337afe0bf8 /platform.cpp
parent7518e76fb706fe036fb4579f21401df6e091f9b0 (diff)
Implement callback function for fallback type library
Diffstat (limited to 'platform.cpp')
-rw-r--r--platform.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform.cpp b/platform.cpp
index ec27b710..55044595 100644
--- a/platform.cpp
+++ b/platform.cpp
@@ -44,6 +44,7 @@ Platform::Platform(Architecture* arch, const string& name)
plat.getGlobalRegisterType = GetGlobalRegisterTypeCallback;
plat.adjustTypeParserInput = AdjustTypeParserInputCallback;
plat.freeTypeParserInput = FreeTypeParserInputCallback;
+ plat.getFallbackEnabled = GetFallbackEnabledCallback;
m_object = BNCreateCustomPlatform(arch->GetObject(), name.c_str(), &plat);
AddRefForRegistration();
}
@@ -60,6 +61,7 @@ Platform::Platform(Architecture* arch, const string& name, const string& typeFil
plat.getGlobalRegisterType = GetGlobalRegisterTypeCallback;
plat.adjustTypeParserInput = AdjustTypeParserInputCallback;
plat.freeTypeParserInput = FreeTypeParserInputCallback;
+ plat.getFallbackEnabled = GetFallbackEnabledCallback;
const char** includeDirList = new const char*[includeDirs.size()];
for (size_t i = 0; i < includeDirs.size(); i++)
includeDirList[i] = includeDirs[i].c_str();
@@ -191,6 +193,12 @@ BNType* Platform::GetGlobalRegisterTypeCallback(void* ctxt, uint32_t reg)
return BNNewTypeReference(result->GetObject());
}
+bool Platform::GetFallbackEnabledCallback(void* ctxt)
+{
+ CallbackRef<Platform> plat(ctxt);
+ return plat->GetFallbackEnabled();
+}
+
Ref<Architecture> Platform::GetArchitecture() const
{
@@ -410,6 +418,12 @@ Ref<Type> Platform::GetGlobalRegisterType(uint32_t reg)
}
+bool Platform::GetFallbackEnabled()
+{
+ return true;
+}
+
+
std::vector<uint32_t> CorePlatform::GetGlobalRegisters()
{
size_t count;