From ca01a62fbc49df5e33bad4200c6defd9983560a8 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sun, 19 Oct 2025 21:46:11 -0500 Subject: bootstrap: stage1: use the new headers Have the first stage of the bootloader take advantage of the new files in /usr/include. Signed-off-by: Danny Holman --- bootstrap/stage1/firmware/efi/alloc.c | 5 +---- bootstrap/stage1/firmware/efi/efi.c | 16 +++++++++++++--- bootstrap/stage1/include/tty.h | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bootstrap/stage1/firmware/efi/alloc.c b/bootstrap/stage1/firmware/efi/alloc.c index d57e481..09d3793 100644 --- a/bootstrap/stage1/firmware/efi/alloc.c +++ b/bootstrap/stage1/firmware/efi/alloc.c @@ -18,10 +18,7 @@ */ #include - -#ifndef NULL -#define NULL (void*)(0) -#endif +#include extern uint64_t errno; extern efi_loaded_image_protocol_t *lip; diff --git a/bootstrap/stage1/firmware/efi/efi.c b/bootstrap/stage1/firmware/efi/efi.c index 140a9a6..169ae1f 100644 --- a/bootstrap/stage1/firmware/efi/efi.c +++ b/bootstrap/stage1/firmware/efi/efi.c @@ -188,11 +188,21 @@ uint64_t efi_main(void *handle, efi_system_t *st) { params->firmware_id = FIRMWARE_UEFI; efi_bootparam_t *uefi_params = balloc(sizeof(efi_bootparam_t)); uefi_params->st = st; - uefi_params->gop_info = gop->mode->info; - params->stack_ptr = balloc(4096); - memset(params->stack_ptr, 0, 4096); + uefi_params->gop_mode = gop->mode; params->firmware_params = (void*)uefi_params; + uint64_t heap_addr; + status = st->bootsrv->allocate_pages(AllocateAnyPages, + LoaderData, + 30, + &heap_addr); + if (status != 0) { + print_error(status); + return 0; + } + params->heap_ptr = (void*)heap_addr; + params->stack_ptr = balloc(4096); + if (load_mmap(uefi_params) == NULL) { print_error(errno); return 0; diff --git a/bootstrap/stage1/include/tty.h b/bootstrap/stage1/include/tty.h index af0d8f9..b693685 100644 --- a/bootstrap/stage1/include/tty.h +++ b/bootstrap/stage1/include/tty.h @@ -21,6 +21,7 @@ #define BOOTSTRAP_TTY_H #include +#include void tty_putchar(char c); char tty_getchar(void); -- cgit v1.2.3