From ad05dd2072917e2487dcd34dbc249b2a0efac589 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 25 Jan 2016 15:16:43 -0500 Subject: Initial implementation of platform ABI classes --- binaryviewtype.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'binaryviewtype.cpp') diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp index 86a35520..e231586b 100644 --- a/binaryviewtype.cpp +++ b/binaryviewtype.cpp @@ -107,6 +107,45 @@ Ref BinaryViewType::GetArchitecture(uint32_t id) } +void BinaryViewType::RegisterPlatform(const string& name, uint32_t id, Architecture* arch, Platform* platform) +{ + Ref type = BinaryViewType::GetByName(name); + if (!type) + return; + type->RegisterPlatform(id, arch, platform); +} + + +void BinaryViewType::RegisterDefaultPlatform(const string& name, Architecture* arch, Platform* platform) +{ + Ref type = BinaryViewType::GetByName(name); + if (!type) + return; + type->RegisterDefaultPlatform(arch, platform); +} + + +void BinaryViewType::RegisterPlatform(uint32_t id, Architecture* arch, Platform* platform) +{ + BNRegisterPlatformForViewType(m_type, id, arch->GetArchitectureObject(), platform->GetPlatformObject()); +} + + +void BinaryViewType::RegisterDefaultPlatform(Architecture* arch, Platform* platform) +{ + BNRegisterDefaultPlatformForViewType(m_type, arch->GetArchitectureObject(), platform->GetPlatformObject()); +} + + +Ref BinaryViewType::GetPlatform(uint32_t id, Architecture* arch) +{ + BNPlatform* platform = BNGetPlatformForViewType(m_type, id, arch->GetArchitectureObject()); + if (!platform) + return nullptr; + return new Platform(platform); +} + + string BinaryViewType::GetName() { char* contents = BNGetBinaryViewTypeName(m_type); -- cgit v1.3.1