summaryrefslogtreecommitdiff
path: root/platform.cpp
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2025-05-28 08:33:30 -0400
committerBrandon Miller <brandon@vector35.com>2025-05-28 08:33:30 -0400
commit6e4c00a80fa86bcfefba9630a1ea8e2a47bef2de (patch)
tree94f891149263fe089d747c4baba7d20a80a7750b /platform.cpp
parentb13d50bac18c341b98e6a3002ac9f17f6c8a8df4 (diff)
Support for Linux x86-64 x32 ABI
Diffstat (limited to 'platform.cpp')
-rw-r--r--platform.cpp22
1 files changed, 22 insertions, 0 deletions
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<Platform> plat(ctxt);
+ return plat->GetAddressSize();
+}
+
+
bool Platform::GetFallbackEnabledCallback(void* ctxt)
{
CallbackRef<Platform> plat(ctxt);
@@ -424,6 +434,12 @@ bool Platform::GetFallbackEnabled()
}
+size_t Platform::GetAddressSize() const
+{
+ return GetArchitecture()->GetAddressSize();
+}
+
+
std::vector<uint32_t> CorePlatform::GetGlobalRegisters()
{
size_t count;
@@ -448,6 +464,12 @@ Ref<Type> CorePlatform::GetGlobalRegisterType(uint32_t reg)
}
+size_t CorePlatform::GetAddressSize() const
+{
+ return BNGetPlatformAddressSize(m_object);
+}
+
+
void Platform::AdjustTypeParserInput(
Ref<TypeParser> parser,
vector<string>& arguments,