From 9a1e354d9c1171baed7d1ca0a7f8a33c849aafa2 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Sun, 19 Feb 2023 20:09:30 +0100 Subject: [PATCH] feature (kernel): Expanded limine requests and boot_info --- kernel/inc/boot/boot_info.h | 1 + kernel/src/boot/limine.c | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/kernel/inc/boot/boot_info.h b/kernel/inc/boot/boot_info.h index 7ef341f..fbe5257 100644 --- a/kernel/inc/boot/boot_info.h +++ b/kernel/inc/boot/boot_info.h @@ -23,6 +23,7 @@ typedef struct { struct limine_framebuffer_response* framebuffer; struct limine_terminal_response* terminal; struct limine_memmap_response* memory_map; + struct limine_kernel_file_response* kernel_file; void* rsdp; } boot_info_T; diff --git a/kernel/src/boot/limine.c b/kernel/src/boot/limine.c index 402c553..b455331 100644 --- a/kernel/src/boot/limine.c +++ b/kernel/src/boot/limine.c @@ -15,6 +15,7 @@ #include "boot/boot_info.h" #include "utils/logger.h" +#include "utils/core.h" extern void kmain(boot_info_T boot_info); @@ -33,30 +34,42 @@ static volatile struct limine_memmap_request memmap_request = { .revision = 2 }; -void halt() { - while(true) { asm("hlt"); } -} +static volatile struct limine_kernel_file_request kernel_file_request = { + .id = LIMINE_KERNEL_FILE_REQUEST, + .revision = 3 +}; + void _start() { boot_info_T boot_info; if (terminal_request.response == NULL || terminal_request.response->terminal_count < 0) { - halt(); + log(LOG_ERROR, "( LimineEntry ) no terminal response!"); + CORE_HALT_FOREVER } log(LOG_INFO, "( LimineEntry ) Found Terminal"); boot_info.terminal = terminal_request.response; if (framebuffer_request.response == NULL || framebuffer_request.response->framebuffer_count < 0) { - halt(); + log(LOG_ERROR, "( LimineEntry ) no framebuffer response!"); + CORE_HALT_FOREVER } log(LOG_INFO, "( LimineEntry ) Found Framebuffer"); boot_info.framebuffer = framebuffer_request.response; if (memmap_request.response == NULL || memmap_request.response->entry_count < 0) { - halt(); + log(LOG_ERROR, "( LimineEntry ) no memory map response!"); + CORE_HALT_FOREVER } log(LOG_INFO, "( LimineEntry ) Found Memory Map"); boot_info.memory_map = memmap_request.response; + if (kernel_file_request.response == NULL) { + log(LOG_ERROR, "( LimineEntry ) no kernel file response!"); + CORE_HALT_FOREVER + } + log(LOG_INFO, "( LimineEntry ) Found Kernel File"); + boot_info.kernel_file = kernel_file_request.response; + kmain(boot_info); } \ No newline at end of file