From 290df8eef95d0d7f2f0e99c91b104b4b02f2bd22 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 2 Feb 2016 23:58:19 -0500 Subject: Detect system calls that do not return --- binaryninjaapi.h | 2 ++ platform.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 42a29388..32273db8 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1650,12 +1650,14 @@ namespace BinaryNinja Ref GetStdcallCallingConvention() const; Ref GetFastcallCallingConvention() const; std::vector> GetCallingConventions() const; + Ref GetSystemCallConvention() const; void RegisterCallingConvention(CallingConvention* cc); void RegisterDefaultCallingConvention(CallingConvention* cc); void RegisterCdeclCallingConvention(CallingConvention* cc); void RegisterStdcallCallingConvention(CallingConvention* cc); void RegisterFastcallCallingConvention(CallingConvention* cc); + void SetSystemCallConvention(CallingConvention* cc); Ref GetRelatedPlatform(Architecture* arch); void AddRelatedPlatform(Architecture* arch, Platform* platform); diff --git a/platform.cpp b/platform.cpp index da072dd8..d4af6750 100644 --- a/platform.cpp +++ b/platform.cpp @@ -166,6 +166,15 @@ vector> Platform::GetCallingConventions() const } +Ref Platform::GetSystemCallConvention() const +{ + BNCallingConvention* cc = BNGetPlatformSystemCallConvention(m_object); + if (!cc) + return nullptr; + return new CoreCallingConvention(cc); +} + + void Platform::RegisterCallingConvention(CallingConvention* cc) { BNRegisterPlatformCallingConvention(m_object, cc->GetObject()); @@ -196,6 +205,12 @@ void Platform::RegisterFastcallCallingConvention(CallingConvention* cc) } +void Platform::SetSystemCallConvention(CallingConvention* cc) +{ + BNSetPlatformSystemCallConvention(m_object, cc ? cc->GetObject() : nullptr); +} + + Ref Platform::GetRelatedPlatform(Architecture* arch) { BNPlatform* platform = BNGetRelatedPlatform(m_object, arch->GetObject()); -- cgit v1.3.1