From fc5b443d86d10c5ce308630f8b41c8f64f5f40f1 Mon Sep 17 00:00:00 2001 From: Zichuan Li <34680029+river-li@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:20:56 -0400 Subject: Implement callback function for fallback type library --- platform.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'platform.cpp') 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 plat(ctxt); + return plat->GetFallbackEnabled(); +} + Ref Platform::GetArchitecture() const { @@ -410,6 +418,12 @@ Ref Platform::GetGlobalRegisterType(uint32_t reg) } +bool Platform::GetFallbackEnabled() +{ + return true; +} + + std::vector CorePlatform::GetGlobalRegisters() { size_t count; -- cgit v1.3.1