From 472ec944d2ed81d0304cc6cac80946a6a44776be Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 19 Apr 2025 16:36:51 -0400 Subject: UEFI and republicans --- kernel/mboot/efi.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 kernel/mboot/efi.c (limited to 'kernel/mboot/efi.c') diff --git a/kernel/mboot/efi.c b/kernel/mboot/efi.c new file mode 100644 index 0000000..75b869a --- /dev/null +++ b/kernel/mboot/efi.c @@ -0,0 +1,38 @@ +#include + +#include "mboot.h" + +#define MULTIBOOT_TAG_TYPE_EFI64 12 +#define MULTIBOOT_TAG_TYPE_EFI64_IH 20 + +struct multiboot_tag_efi64 { + uint32_t type; + uint32_t size; + uint64_t pointer; +}; + +struct multiboot_tag_efi64_ih { + uint32_t type; + uint32_t size; + uint64_t pointer; +}; + +EFI_SYSTEM_TABLE *mboot_get_efi_st(void) +{ + void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_EFI64); + if (tag == NULL) + return NULL; + + struct multiboot_tag_efi64 *efi = (struct multiboot_tag_efi64 *)tag; + return (void *)efi->pointer; +} + +EFI_HANDLE mboot_get_efi_hdl(void) +{ + void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_EFI64_IH); + if (tag == NULL) + return NULL; + + struct multiboot_tag_efi64_ih *ih = (struct multiboot_tag_efi64_ih *)tag; + return (void *)ih->pointer; +} -- cgit v1.2.3-freya