summaryrefslogtreecommitdiff
path: root/kernel/entry.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/entry.cxx')
-rw-r--r--kernel/entry.cxx49
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();
+}