aboutsummaryrefslogtreecommitdiff
path: root/src/kernel.cc
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-02-07 18:06:51 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-02-07 18:06:51 +0200
commit2c8cfb327ab8aff0deb44c826fe659bf0062fe59 (patch)
tree4282d611641cbf85431464707efcf686ea08681e /src/kernel.cc
parentRewrite makefile (diff)
downloadkernel.cpp-2c8cfb327ab8aff0deb44c826fe659bf0062fe59.tar.xz
Rename kernel/ to src/
Diffstat (limited to 'src/kernel.cc')
-rw-r--r--src/kernel.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/kernel.cc b/src/kernel.cc
new file mode 100644
index 0000000..c083364
--- /dev/null
+++ b/src/kernel.cc
@@ -0,0 +1,26 @@
+/* Check if the compiler thinks you are targeting the wrong operating system. */
+#if defined(__linux__)
+#error "You are not using a cross-compiler"
+#endif
+
+/* This tutorial will only work for the 32-bit ix86 targets. */
+#if !defined(__i386__)
+#error "This tutorial needs to be compiled with a ix86-elf compiler"
+#endif
+
+#include <stdlib.h>
+#include <types.h>
+#include "vga.h"
+
+extern "C" void dump_multiboot(uint32_t mb_magic, uint32_t mb_addr);
+
+extern "C" void kernel_main(uint32_t mb_magic, uint32_t mb_addr) {
+ VGA terminal;
+ Console::set(&terminal);
+
+ printk("Hello, kernel World!\n");
+
+ dump_multiboot(mb_magic, mb_addr);
+
+ abort();
+}