From 8251da342161767fe203627223ccd4a7026701c6 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 4 Sep 2026 11:31:40 -0400 Subject: initial commit. working on tasking --- boot/limine/start.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 boot/limine/start.c (limited to 'boot/limine/start.c') diff --git a/boot/limine/start.c b/boot/limine/start.c new file mode 100644 index 0000000..b371f92 --- /dev/null +++ b/boot/limine/start.c @@ -0,0 +1,81 @@ +#include +#include + +#include "boot/cmdline.h" +#include "hal/framebuffer.h" +#include "limine.h" + +void _start(void); + +#define LIMINE_REQUEST_SECTION __attribute__((section(".limine_requests"))) + +LIMINE_REQUEST_SECTION +static volatile uint64_t limine_base_revision[] = LIMINE_BASE_REVISION(4); + +LIMINE_REQUEST_SECTION +static volatile uint64_t limine_requests_start_marker[] = LIMINE_REQUESTS_START_MARKER; + +LIMINE_REQUEST_SECTION +static volatile struct limine_executable_cmdline_request cmdline_req = { + .id = LIMINE_EXECUTABLE_CMDLINE_REQUEST_ID, + .revision = 0, .response = NULL +}; + +LIMINE_REQUEST_SECTION +static volatile struct limine_entry_point_request entry_point_req = { + .id = LIMINE_ENTRY_POINT_REQUEST_ID, + .revision = 0, .response = NULL, + .entry = _start +}; + +LIMINE_REQUEST_SECTION +static volatile struct limine_executable_address_request executable_address_req = { + .id = LIMINE_EXECUTABLE_ADDRESS_REQUEST_ID, + .revision = 0, .response = NULL +}; + +LIMINE_REQUEST_SECTION +static volatile struct limine_memmap_request memmap_req = { + .id = LIMINE_MEMMAP_REQUEST_ID, + .revision = 0, .response = NULL +}; + +LIMINE_REQUEST_SECTION +static volatile struct limine_module_request module_req = { + .id = LIMINE_MODULE_REQUEST_ID, + .revision = 0, .response = NULL +}; + +LIMINE_REQUEST_SECTION +static volatile struct limine_framebuffer_request framebuffer_request = { + .id = LIMINE_FRAMEBUFFER_REQUEST_ID, + .revision = 0, .response = NULL +}; + +LIMINE_REQUEST_SECTION +static volatile uint64_t limine_requests_end_marker[] = LIMINE_REQUESTS_END_MARKER; + +void *_kernel_physptr = NULL; +void *_initrd_module = NULL; +struct limine_framebuffer_response *_limine_framebuffers; +struct limine_memmap_response *_limine_memmap_resp = NULL; + +__attribute__((noreturn)) +void +_start(void) +{ + _kernel_physptr = (void*)executable_address_req.response->physical_base; + _limine_memmap_resp = memmap_req.response; + _limine_framebuffers = framebuffer_request.response; + + if(module_req.response->module_count > 0) { + _initrd_module = module_req.response->modules[0]->address; + } + + cmdline_init(cmdline_req.response->cmdline); + + __attribute__((noreturn)) + extern void kernel_entry(void); + + kernel_entry(); +} -- cgit v1.2.3