From 593bf4df3d8db49286c1a7ae4ef75c887b629930 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Thu, 17 May 2012 17:56:23 +0200 Subject: Devices using the VFS structure. Basic keyboard handler. --- src/kernel/core/kmain.cpp | 56 +++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 21 deletions(-) (limited to 'src/kernel/core/kmain.cpp') diff --git a/src/kernel/core/kmain.cpp b/src/kernel/core/kmain.cpp index eb2c3ec..e74ff33 100644 --- a/src/kernel/core/kmain.cpp +++ b/src/kernel/core/kmain.cpp @@ -2,8 +2,8 @@ #include #include "multiboot.h" -#include "monitor.h" #include "sys.h" +#include #include #include #include @@ -12,6 +12,8 @@ #include #include #include +#include +#include /* The kernel's main procedure. This function is called in loader_.asm. This function calls the initializer functions for all system parts. @@ -35,47 +37,59 @@ extern "C" void kmain(multiboot_info_t* mbd, int32_t magic) { mem_placementAddr = (mods[i].mod_end & 0xFFFFF000) + 0x1000; } - monitor_clear(); - - monitor_write(K_OS_NAME); - monitor_write(" version "); - monitor_write(K_OS_VER); - monitor_write(" codename '"); - monitor_write(K_OS_CODENAME); - monitor_write("' starting up :\n"); - + // Init memory managment functions idt_init(); - totalRam = ((mbd->mem_upper + mbd->mem_lower) * 1024); paging_init(totalRam); gdt_init(); paging_cleanup(); _no_more_ksbrk = true; - //kheap_init(); + // Init higher level stuff timer_init(30); tasking_init(); - vfs_setup(); - - monitor_write("\nLoading modules :\n"); + + // Init display devices + text_display = new vgatxt(dot_dev); + dot_dev->add_child("vgatxt", text_display); + ke_vt = new vt(dot_dev, 80, 25); + dot_ui->add_child("klog", ke_vt); + ke_vt->outputTo(text_display); + + // Say hello + ke_vt->fgcolor = TC_LIGHTGRAY; + ke_vt->writeStr("Hello. This is "); + ke_vt->fgcolor = TC_WHITE; ke_vt->writeStr(K_OS_NAME); + ke_vt->fgcolor = TC_LIGHTGRAY; ke_vt->writeStr(" version "); + ke_vt->fgcolor = TC_WHITE; ke_vt->writeStr(K_OS_VER); + ke_vt->fgcolor = TC_LIGHTGRAY; ke_vt->writeStr(" codename '"); + ke_vt->fgcolor = TC_WHITE; ke_vt->writeStr(K_OS_CODENAME); + ke_vt->fgcolor = TC_LIGHTGRAY; ke_vt->writeStr("'. Enjoy!\n"); + + // Init devices + kbd = new ps2kbd(dot_dev); + dot_dev->add_child("ps2kbd", kbd); + + // Load modules + ke_vt->writeStr("Loading modules :\n"); for (i = 0; i < mbd->mods_count; i++) { - monitor_write(" * "); - monitor_write((char*)mods[i].string); + ke_vt->writeStr(" * "); + ke_vt->writeStr((char*)mods[i].string); if (elf_check((uint8_t*)mods[i].mod_start)) { - monitor_write(" : Invalid ELF file\n"); + ke_vt->writeStr(" : Invalid ELF file\n"); } else { process *pr = elf_exec((uint8_t*)mods[i].mod_start, PL_USER); if (pr == 0) { - monitor_write(" : Error loading\n"); + ke_vt->writeStr(" : Error loading\n"); } else { - monitor_write(" : OK, pid="); monitor_writeDec(pr->pid); monitor_write("\n"); + ke_vt->writeStr(" : OK, pid="); ke_vt->writeDec(pr->pid); ke_vt->writeStr("\n"); } } } - monitor_write("Giving control to userland processes.\n\n"); + ke_vt->writeStr("Giving control to userland processes.\n\n"); sti(); schedule(); PANIC("Should never happen. Something probably went wrong with multitasking."); -- cgit v1.2.3