From 5ccef726c0954116f8f4b5d6347e0acdbb0b6ce3 Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Tue, 27 Jan 2026 11:26:57 -0500 Subject: Perform function lifting and inlining in arch plugins This change allows architecture plugins to override the LiftFunction callback to iterate a function's basic block list and lift entire functions at once. This is required for architectures such as TMS320 C6x, which have non-traditional "delay slots" in that branches, loads, and other instructions take multiple cycles to complete, and branch instructions can reside within the delay slots of other branches. --- defaultarch/plugin.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 defaultarch/plugin.cpp (limited to 'defaultarch/plugin.cpp') diff --git a/defaultarch/plugin.cpp b/defaultarch/plugin.cpp new file mode 100644 index 00000000..3e6e66a8 --- /dev/null +++ b/defaultarch/plugin.cpp @@ -0,0 +1,16 @@ +#include "binaryninjaapi.h" +#include "binaryninjacore.h" + +using namespace BinaryNinja; + +extern "C" +{ + BN_DECLARE_CORE_ABI_VERSION + BINARYNINJAPLUGIN bool CorePluginInit() + { + if (!BNArchitectureSetDefaultAnalyzeBasicBlocksCallback((void*)Architecture::DefaultAnalyzeBasicBlocksCallback)) + return false; + + return BNArchitectureSetDefaultLiftFunctionCallback((void*)Architecture::DefaultLiftFunctionCallback); + } +} -- cgit v1.3.1