From 12fd3a91f138bf90520134682e38bf3b0341e660 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Fri, 27 Jun 2025 17:46:28 -0400 Subject: Create kernel build infrastructure --- kernel/entry.cxx | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 kernel/entry.cxx (limited to 'kernel/entry.cxx') diff --git a/kernel/entry.cxx b/kernel/entry.cxx new file mode 100644 index 0000000..b5bc210 --- /dev/null +++ b/kernel/entry.cxx @@ -0,0 +1,49 @@ +#include "../vendor/limine/limine.h" +#include + +__attribute__ ((used, section(".requests"))) +static volatile LIMINE_BASE_REVISION(3); + +__attribute__ ((used, section(".requests"))) +static volatile limine_framebuffer_request framebuffer_request = { + .id = LIMINE_FRAMEBUFFER_REQUEST, + .revision = 0, + .response = nullptr +}; + +__attribute__ ((used, section(".requests_start"))) +static volatile LIMINE_REQUESTS_START_MARKER; + +__attribute__ ((used, section(".requests_end"))) +static volatile LIMINE_REQUESTS_END_MARKER; + +static void hcf (void) +{ + for (;;) + { + asm ("hlt"); + } +} + +void init (void); + +extern "C" void _launch (void); +void _launch (void) +{ + if (LIMINE_BASE_REVISION_SUPPORTED == false) + { + hcf(); + } + + struct limine_framebuffer *fb = framebuffer_request.response->framebuffers[0]; + for (std::size_t i = 0; i < (fb->width - 1) * (fb->height - 1); i += 2) + { + volatile std::uint32_t *fbptr = static_cast(fb->address); + fbptr[i] = 0xffffff; + } + + // Global C++ constructors + init(); + + hcf(); +} -- cgit v1.2.3