summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-02-02 23:58:19 -0500
committerRusty Wagner <rusty@vector35.com>2016-02-02 23:58:19 -0500
commit290df8eef95d0d7f2f0e99c91b104b4b02f2bd22 (patch)
tree156ddeddebfe71737222aeaf4a62d3936df3481e
parentf0ab57068974f11cc19a95e9672af22ba2ea2ae2 (diff)
Detect system calls that do not return
-rw-r--r--binaryninjaapi.h2
-rw-r--r--platform.cpp15
2 files changed, 17 insertions, 0 deletions
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<CallingConvention> GetStdcallCallingConvention() const;
Ref<CallingConvention> GetFastcallCallingConvention() const;
std::vector<Ref<CallingConvention>> GetCallingConventions() const;
+ Ref<CallingConvention> 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<Platform> 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<Ref<CallingConvention>> Platform::GetCallingConventions() const
}
+Ref<CallingConvention> 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> Platform::GetRelatedPlatform(Architecture* arch)
{
BNPlatform* platform = BNGetRelatedPlatform(m_object, arch->GetObject());