aboutsummaryrefslogtreecommitdiffstats
path: root/bootloader/other.c
diff options
context:
space:
mode:
authorGravatar ornitorrincos 2026-08-18 12:15:05 +0200
committerGravatar ornitorrincos 2026-08-18 12:15:05 +0200
commit132d3236bb884433bf94e961f6d32264e0334aec (patch)
tree06638976b06f019ea4037175ff228f8271057c44 /bootloader/other.c
Diffstat (limited to 'bootloader/other.c')
-rw-r--r--bootloader/other.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/bootloader/other.c b/bootloader/other.c
new file mode 100644
index 0000000..9286dac
--- /dev/null
+++ b/bootloader/other.c
@@ -0,0 +1,42 @@
+#include <efi.h>
+#include <efilib.h>
+#include <efidef.h>
+
+#include "other.h"
+
+void PrintImageAddr(EFI_HANDLE image)
+{
+ EFI_LOADED_IMAGE *loaded_image = NULL;
+ EFI_STATUS status;
+
+ status = uefi_call_wrapper(BS->HandleProtocol,
+ 3,
+ image,
+ &LoadedImageProtocol,
+ (void **)&loaded_image);
+
+ if (EFI_ERROR(status))
+ {
+ Print(L"handleprotocol: %r\n", status);
+ }
+
+ Print(L"Image base: 0x%lx\n", loaded_image->ImageBase);
+}
+
+bool AreEqual(void* lhs, void* rhs, uint64_t size)
+{
+ char* clhs = (char*)lhs;
+ char* crhs = (char*)rhs;
+
+ bool equal = true;
+
+ for(int i = 0; i < size; i++)
+ {
+ if(clhs[i] != crhs[i])
+ {
+ equal = false;
+ }
+ }
+
+ return equal;
+}