aboutsummaryrefslogtreecommitdiff
path: root/kernel/l0/kmain.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2014-12-01 17:24:38 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2014-12-01 17:24:38 +0100
commit0921a33fc9f3724cb36a03a24b58b0a5bfc519b1 (patch)
tree6f3db52ba8c38928749806cb2d94ca548b3b19bd /kernel/l0/kmain.c
parent6f11c9e5c15cc8ef936741e5ee7575b731a47e0f (diff)
downloadkogata-0921a33fc9f3724cb36a03a24b58b0a5bfc519b1.tar.gz
kogata-0921a33fc9f3724cb36a03a24b58b0a5bfc519b1.zip
Advance HH, GDT, IDT (details below)
- Implement higher-half in loader with paging (using 4Mb pages) - Add GDT installation code - Add IDT installation code (spend a loong time debugging the ISRs!) - Add CDROM generation scripts - Add scripts to launch bochs (debug) and qemu (debug)
Diffstat (limited to 'kernel/l0/kmain.c')
-rw-r--r--kernel/l0/kmain.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/l0/kmain.c b/kernel/l0/kmain.c
index 74945e4..854a2b7 100644
--- a/kernel/l0/kmain.c
+++ b/kernel/l0/kmain.c
@@ -2,6 +2,9 @@
#include <config.h>
#include <dbglog.h>
#include <sys.h>
+
+#include <gdt.h>
+#include <idt.h>
void kmain(struct multiboot_info_t *mbd, int32_t mb_magic) {
dbglog_setup();
@@ -9,6 +12,19 @@ void kmain(struct multiboot_info_t *mbd, int32_t mb_magic) {
dbg_printf("Hello, kernel World!\n");
dbg_printf("This is %s, version %s.\n", OS_NAME, OS_VERSION);
+ ASSERT(mb_magic == MULTIBOOT_BOOTLOADER_MAGIC);
+
+ gdt_init(); dbg_printf("GDT set up.\n");
+
+ idt_init(); dbg_printf("IDT set up.\n");
+
+ asm volatile("int $0x3");
+
+ size_t total_ram = ((mbd->mem_upper + mbd->mem_lower) * 1024);
+ dbg_printf("Total ram: %d Kb\n", total_ram / 1024);
+ // paging_init(totalRam);
+
PANIC("Reached kmain end! Falling off the edge.");
}
+/* vim: set ts=4 sw=4 tw=0 noet :*/