diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-19 16:36:51 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-19 16:37:54 -0400 |
commit | 472ec944d2ed81d0304cc6cac80946a6a44776be (patch) | |
tree | f6cae641c143a0b45bb289d9d9fc6145706025b0 /kernel/mboot/efi.c | |
parent | set mmap limit (diff) | |
download | comus-472ec944d2ed81d0304cc6cac80946a6a44776be.tar.gz comus-472ec944d2ed81d0304cc6cac80946a6a44776be.tar.bz2 comus-472ec944d2ed81d0304cc6cac80946a6a44776be.zip |
UEFI and republicans
Diffstat (limited to 'kernel/mboot/efi.c')
-rw-r--r-- | kernel/mboot/efi.c | 38 |
1 files changed, 38 insertions, 0 deletions
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 <comus/mboot.h> + +#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; +} |