From 75787e706c877a34a68c23c0d4f90ec5ff1e830c Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Wed, 5 Jun 2024 22:59:31 -0400 Subject: Add support for getting/setting default calling conventions in python --- python/architecture.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'python/architecture.py') diff --git a/python/architecture.py b/python/architecture.py index 87fe3ee9..8c118c44 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -2049,6 +2049,42 @@ class Architecture(metaclass=_ArchitectureMetaClass): """ core.BNRegisterCallingConvention(self.handle, cc.handle) + def get_default_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + cc_handle = core.BNGetArchitectureDefaultCallingConvention(self.handle) + if cc_handle is None: + return None + return callingconvention.CallingConvention(handle=cc_handle) + + def set_default_calling_convention(self, cc: 'callingconvention.CallingConvention'): + core.BNSetArchitectureDefaultCallingConvention(self.handle, cc.handle) + + def get_cdecl_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + cc_handle = core.BNGetArchitectureCdeclCallingConvention(self.handle) + if cc_handle is None: + return None + return callingconvention.CallingConvention(handle=cc_handle) + + def set_cdecl_calling_convention(self, cc: 'callingconvention.CallingConvention'): + core.BNSetArchitectureCdeclCallingConvention(self.handle, cc.handle) + + def get_stdcall_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + cc_handle = core.BNGetArchitectureStdcallCallingConvention(self.handle) + if cc_handle is None: + return None + return callingconvention.CallingConvention(handle=cc_handle) + + def set_stdcall_calling_convention(self, cc: 'callingconvention.CallingConvention'): + core.BNSetArchitectureStdcallCallingConvention(self.handle, cc.handle) + + def get_fastcall_calling_convention(self) -> Optional['callingconvention.CallingConvention']: + cc_handle = core.BNGetArchitectureFastcallCallingConvention(self.handle) + if cc_handle is None: + return None + return callingconvention.CallingConvention(handle=cc_handle) + + def set_fastcall_calling_convention(self, cc: 'callingconvention.CallingConvention'): + core.BNSetArchitectureFastcallCallingConvention(self.handle, cc.handle) + _architecture_cache = {} -- cgit v1.3.1