From 6e4c00a80fa86bcfefba9630a1ea8e2a47bef2de Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Wed, 28 May 2025 08:33:30 -0400 Subject: Support for Linux x86-64 x32 ABI --- platform.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'platform.cpp') diff --git a/platform.cpp b/platform.cpp index e367f0c2..ef32e469 100644 --- a/platform.cpp +++ b/platform.cpp @@ -41,6 +41,7 @@ Platform::Platform(Architecture* arch, const string& name) plat.viewInit = InitViewCallback; plat.getGlobalRegisters = GetGlobalRegistersCallback; plat.freeRegisterList = FreeRegisterListCallback; + plat.getAddressSize = GetAddressSizeCallback; plat.getGlobalRegisterType = GetGlobalRegisterTypeCallback; plat.adjustTypeParserInput = AdjustTypeParserInputCallback; plat.freeTypeParserInput = FreeTypeParserInputCallback; @@ -59,6 +60,7 @@ Platform::Platform(Architecture* arch, const string& name, const string& typeFil plat.getGlobalRegisters = GetGlobalRegistersCallback; plat.freeRegisterList = FreeRegisterListCallback; plat.getGlobalRegisterType = GetGlobalRegisterTypeCallback; + plat.getAddressSize = GetAddressSizeCallback; plat.adjustTypeParserInput = AdjustTypeParserInputCallback; plat.freeTypeParserInput = FreeTypeParserInputCallback; plat.getFallbackEnabled = GetFallbackEnabledCallback; @@ -193,6 +195,14 @@ BNType* Platform::GetGlobalRegisterTypeCallback(void* ctxt, uint32_t reg) return BNNewTypeReference(result->GetObject()); } + +size_t Platform::GetAddressSizeCallback(void* ctxt) +{ + CallbackRef plat(ctxt); + return plat->GetAddressSize(); +} + + bool Platform::GetFallbackEnabledCallback(void* ctxt) { CallbackRef plat(ctxt); @@ -424,6 +434,12 @@ bool Platform::GetFallbackEnabled() } +size_t Platform::GetAddressSize() const +{ + return GetArchitecture()->GetAddressSize(); +} + + std::vector CorePlatform::GetGlobalRegisters() { size_t count; @@ -448,6 +464,12 @@ Ref CorePlatform::GetGlobalRegisterType(uint32_t reg) } +size_t CorePlatform::GetAddressSize() const +{ + return BNGetPlatformAddressSize(m_object); +} + + void Platform::AdjustTypeParserInput( Ref parser, vector& arguments, -- cgit v1.3.1