diff options
author | Samuel Johnson <[email protected]> | 2025-06-27 17:46:28 -0400 |
---|---|---|
committer | Samuel Johnson <[email protected]> | 2025-06-27 17:46:28 -0400 |
commit | 12fd3a91f138bf90520134682e38bf3b0341e660 (patch) | |
tree | 66b3f4a19f50a0f9883ca3f5a286a1e8dc3bc8c6 /kernel/entry.cxx | |
parent | 6e65e584a3baf2dfe8906c2d847ca5169b91b3fc (diff) |
Create kernel build infrastructure
Diffstat (limited to 'kernel/entry.cxx')
-rw-r--r-- | kernel/entry.cxx | 49 |
1 files changed, 49 insertions, 0 deletions
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 <cstdint> + +__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<std::uint32_t *>(fb->address); + fbptr[i] = 0xffffff; + } + + // Global C++ constructors + init(); + + hcf(); +} |