feature (kernel): Expanded limine requests and boot_info

This commit is contained in:
antifallobst 2023-02-19 20:09:30 +01:00
parent b70788196f
commit 9a1e354d9c
2 changed files with 20 additions and 6 deletions

View File

@ -23,6 +23,7 @@ typedef struct {
struct limine_framebuffer_response* framebuffer; struct limine_framebuffer_response* framebuffer;
struct limine_terminal_response* terminal; struct limine_terminal_response* terminal;
struct limine_memmap_response* memory_map; struct limine_memmap_response* memory_map;
struct limine_kernel_file_response* kernel_file;
void* rsdp; void* rsdp;
} boot_info_T; } boot_info_T;

View File

@ -15,6 +15,7 @@
#include "boot/boot_info.h" #include "boot/boot_info.h"
#include "utils/logger.h" #include "utils/logger.h"
#include "utils/core.h"
extern void kmain(boot_info_T boot_info); extern void kmain(boot_info_T boot_info);
@ -33,30 +34,42 @@ static volatile struct limine_memmap_request memmap_request = {
.revision = 2 .revision = 2
}; };
void halt() { static volatile struct limine_kernel_file_request kernel_file_request = {
while(true) { asm("hlt"); } .id = LIMINE_KERNEL_FILE_REQUEST,
} .revision = 3
};
void _start() { void _start() {
boot_info_T boot_info; boot_info_T boot_info;
if (terminal_request.response == NULL || terminal_request.response->terminal_count < 0) { 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"); log(LOG_INFO, "( LimineEntry ) Found Terminal");
boot_info.terminal = terminal_request.response; boot_info.terminal = terminal_request.response;
if (framebuffer_request.response == NULL || framebuffer_request.response->framebuffer_count < 0) { 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"); log(LOG_INFO, "( LimineEntry ) Found Framebuffer");
boot_info.framebuffer = framebuffer_request.response; boot_info.framebuffer = framebuffer_request.response;
if (memmap_request.response == NULL || memmap_request.response->entry_count < 0) { 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"); log(LOG_INFO, "( LimineEntry ) Found Memory Map");
boot_info.memory_map = memmap_request.response; 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); kmain(boot_info);
} }