summaryrefslogtreecommitdiff
path: root/src/kernel/core/kmain.cpp
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-18 11:10:53 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-18 11:10:53 +0200
commitc19415d2ffb6f063f91983ff505e2530ab500908 (patch)
tree021263be30daa438387ce3a12453a7719bc8dccf /src/kernel/core/kmain.cpp
parent593bf4df3d8db49286c1a7ae4ef75c887b629930 (diff)
downloadTCE-c19415d2ffb6f063f91983ff505e2530ab500908.tar.gz
TCE-c19415d2ffb6f063f91983ff505e2530ab500908.zip
Minor changes.
Diffstat (limited to 'src/kernel/core/kmain.cpp')
-rw-r--r--src/kernel/core/kmain.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/src/kernel/core/kmain.cpp b/src/kernel/core/kmain.cpp
index e74ff33..f745fdf 100644
--- a/src/kernel/core/kmain.cpp
+++ b/src/kernel/core/kmain.cpp
@@ -3,16 +3,19 @@
#include "multiboot.h"
#include "sys.h"
-#include <dev/vgatxt.h>
-#include <task/idt.h>
-#include <task/timer.h>
-#include <task/task.h>
#include <mem/gdt.h>
#include <mem/paging.h>
#include <mem/mem.h>
-#include <linker/elf.h>
+
#include <vfs/node.h>
+
+#include <task/idt.h>
+#include <task/timer.h>
+#include <task/task.h>
+#include <linker/elf.h>
+
#include <ui/vt.h>
+#include <dev/vgatxt.h>
#include <dev/ps2keyboard.h>
/* The kernel's main procedure. This function is called in loader_.asm.
@@ -23,13 +26,10 @@
extern "C" void kmain(multiboot_info_t* mbd, int32_t magic) {
ASSERT(magic == MULTIBOOT_BOOTLOADER_MAGIC);
- size_t totalRam = 0;
- uint32_t i;
-
mem_placementAddr = ((size_t)&end & 0xFFFFF000) + 0x1000;
mbd->cmdline += K_HIGHHALF_ADDR; mbd->mods_addr += K_HIGHHALF_ADDR;
module_t *mods = (module_t*)mbd->mods_addr;
- for (i = 0; i < mbd->mods_count; i++) {
+ for (unsigned i = 0; i < mbd->mods_count; i++) {
mods[i].mod_start += K_HIGHHALF_ADDR;
mods[i].mod_end += K_HIGHHALF_ADDR;
mods[i].string += K_HIGHHALF_ADDR;
@@ -40,7 +40,7 @@ extern "C" void kmain(multiboot_info_t* mbd, int32_t magic) {
// Init memory managment functions
idt_init();
- totalRam = ((mbd->mem_upper + mbd->mem_lower) * 1024);
+ size_t totalRam = ((mbd->mem_upper + mbd->mem_lower) * 1024);
paging_init(totalRam);
gdt_init();
paging_cleanup();
@@ -60,36 +60,35 @@ extern "C" void kmain(multiboot_info_t* mbd, int32_t magic) {
// 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");
+ *ke_vt << "Hello. This is ";
+ ke_vt->fgcolor = TC_WHITE; *ke_vt << K_OS_NAME;
+ ke_vt->fgcolor = TC_LIGHTGRAY; *ke_vt << " version ";
+ ke_vt->fgcolor = TC_WHITE; *ke_vt << K_OS_VER;
+ ke_vt->fgcolor = TC_LIGHTGRAY; *ke_vt << " codename '";
+ ke_vt->fgcolor = TC_WHITE; *ke_vt << K_OS_CODENAME;
+ ke_vt->fgcolor = TC_LIGHTGRAY; *ke_vt << "'. 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++) {
- ke_vt->writeStr(" * ");
- ke_vt->writeStr((char*)mods[i].string);
+ *ke_vt << "Loading modules :\n";
+ for (unsigned i = 0; i < mbd->mods_count; i++) {
+ *ke_vt << " * " << (char*)mods[i].string;
if (elf_check((uint8_t*)mods[i].mod_start)) {
- ke_vt->writeStr(" : Invalid ELF file\n");
+ *ke_vt << " : Invalid ELF file\n";
} else {
process *pr = elf_exec((uint8_t*)mods[i].mod_start, PL_USER);
if (pr == 0) {
- ke_vt->writeStr(" : Error loading\n");
+ *ke_vt << " : Error loading\n";
} else {
- ke_vt->writeStr(" : OK, pid="); ke_vt->writeDec(pr->pid); ke_vt->writeStr("\n");
+ *ke_vt << " : OK, pid=" << (int)pr->pid << "\n";
}
}
}
- ke_vt->writeStr("Giving control to userland processes.\n\n");
+ *ke_vt << "Giving control to userland processes.\n\n";
sti();
schedule();
PANIC("Should never happen. Something probably went wrong with multitasking.");