summaryrefslogtreecommitdiff
path: root/platform/efi/efi_resolver/src/Plugin.cpp
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2025-05-08 15:08:10 -0400
committerBrandon Miller <brandon@vector35.com>2025-05-08 15:08:10 -0400
commit5147249a644f611a801aada7645b7a993fc8e314 (patch)
tree3a18e50df5ae9edcf31f3545a7f27774021c76a1 /platform/efi/efi_resolver/src/Plugin.cpp
parentf7e831ab40a5031cec9186096a90d94735080ed7 (diff)
Implement EFI resolver as a module workflow
Diffstat (limited to 'platform/efi/efi_resolver/src/Plugin.cpp')
-rw-r--r--platform/efi/efi_resolver/src/Plugin.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/platform/efi/efi_resolver/src/Plugin.cpp b/platform/efi/efi_resolver/src/Plugin.cpp
deleted file mode 100644
index b562975c..00000000
--- a/platform/efi/efi_resolver/src/Plugin.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "DxeResolver.h"
-#include "PeiResolver.h"
-#include "binaryninjaapi.h"
-#include <thread>
-
-using namespace BinaryNinja;
-
-extern "C"
-{
-BN_DECLARE_CORE_ABI_VERSION
-
-BINARYNINJAPLUGIN void CorePluginDependencies()
-{
- BinaryNinja::AddOptionalPluginDependency("arch_x86");
- BinaryNinja::AddOptionalPluginDependency("arch_armv7");
- BinaryNinja::AddOptionalPluginDependency("arch_arm64");
- BinaryNinja::AddOptionalPluginDependency("platform_efi");
-}
-
-static Ref<BackgroundTask> efiBackgroundTask = nullptr;
-
-void Run(Ref<BinaryView> view)
-{
- efiBackgroundTask = new BackgroundTask("Loading EFI protocol mappings!", true);
- thread resolverThread([view]() {
- LogInfo("Entering new thread");
-
- LogInfo("Identifying module type");
- EFIModuleType moduleType = identifyModuleType(view);
-
-#ifndef DEBUG
- auto undo = view->BeginUndoActions();
-#endif
- if (moduleType == PEI)
- {
- efiBackgroundTask->SetProgressText("Resolving PEIM...");
- auto resolver = PeiResolver(view, efiBackgroundTask);
- resolver.resolvePei();
- }
- else if (moduleType == DXE)
- {
- efiBackgroundTask->SetProgressText("Resolving DXE protocols...");
- auto resolver = DxeResolver(view, efiBackgroundTask);
- resolver.resolveDxe();
- efiBackgroundTask->SetProgressText("Resolving MM related protocols...");
- resolver.resolveSmm();
- }
-
-#ifndef DEBUG
- view->CommitUndoActions(undo);
-#endif
- efiBackgroundTask->Finish();
- });
- resolverThread.detach();
-}
-
-BINARYNINJAPLUGIN bool CorePluginInit()
-{
- EfiGuidRenderer::Register();
-
- PluginCommand::Register("EFI Resolver\\Resolve EFI Types And Protocols", "Resolve EFI Protocols", &Run);
-
- return true;
-}
-}