From 247070cc7e5ae117fd0d1b551fafdf5c13f0dd6b Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 20 Dec 2009 13:40:58 +0100 Subject: Keyboard warning gets logged --- Source/Kernel/Core/kmain.wtf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Kernel/Core/kmain.wtf.cpp') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index ad11eaf..5181cb7 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -214,13 +214,13 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //*************************************** LOAD SYSTEM STUFF - if (keymap != "builtin") { - if (!Kbd::loadKeymap(keymap)) *kvt << "WARNING : Could not load keymap " << keymap << ", using built-in keymap instead."; - } - Log::init(KL_STATUS); //Setup logging Log::log(KL_STATUS, "kmain : Melon booting."); + if (keymap != "builtin") { + if (!Kbd::loadKeymap(keymap)) Log::log(KL_WARNING, String("WARNING : Could not load keymap ") += keymap += ", using built-in keymap instead."); + } + Usr::load(); //Setup user managment Log::log(KL_STATUS, "kmain : User list loaded"); -- cgit v1.2.3 From 2a9defea402eec36e075e9e835b804dcc6926748 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 20 Dec 2009 23:09:17 +0100 Subject: Added a simple status bar for loading progress --- Source/Kernel/Core/kmain.wtf.cpp | 44 +++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'Source/Kernel/Core/kmain.wtf.cpp') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 5181cb7..2dc0377 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -116,9 +116,29 @@ void selectVideoMode(SimpleVT& v) { } } +#define STATUS(stat) { \ + progress++; \ + kvt->setColor(STATUSBAR_FGCOLOR, STATUSBAR_BGCOLOR); \ + line = kvt->csrlin(); \ + kvt->moveCursor(0, 0); \ + *kvt << "Melon is loading : {"; \ + for (u32int i = 0; i < progress; i++) *kvt << ":"; \ + *kvt << ". "; \ + kvt->moveCursor(0, 42); \ + *kvt << "} "; \ + kvt->moveCursor(0, 51); \ + *kvt << "[" << stat; \ + kvt->moveCursor(0, 78); \ + *kvt << "] "; \ + kvt->setColor(KVT_FGCOLOR, KVT_BGCOLOR); \ + kvt->moveCursor(line, 0); \ +} + void kmain(multiboot_info_t* mbd, u32int magic) { DEBUG("Entering kmain."); + u16int progress = 0, line; //For logger + if (magic != MULTIBOOT_BOOTLOADER_MAGIC) { Mem::placementAddress = (u32int)&end; //Setup basic stuff so that PANIC will work VGATextOutput *vgaout = new VGATextOutput(); @@ -146,27 +166,34 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //Create a VT for logging what kernel does kvt = new ScrollableVT(25, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR); kvt->map(0, 0); - *kvt << "Melon is loading...\n"; + *kvt << "Melon is loading :\n"; + STATUS("IDT"); IDT::init(); //Setup interrupts + STATUS("Paging"); u32int totalRam = ((mbd->mem_upper + mbd->mem_lower) * 1024); PhysMem::initPaging(totalRam); //Setup paging + STATUS("GDT"); GDT::init(); //Initialize real GDT, not fake one from loader.wtf.asm PhysMem::removeTemporaryPages(); //Remove useless page mapping + STATUS("Heap"); Mem::createHeap(); //Create kernel heap Dev::registerDevice(vgaout); + STATUS("Timer"); Dev::registerDevice(new Timer()); //Initialize timer String kcmdline((char*)mbd->cmdline); + STATUS("Multitasking"); Task::initialize(kcmdline, kvt); //Initialize multitasking asm volatile("sti"); //*************************************** PARSE COMMAND LINE + STATUS("Parse command line"); Vector opts = kcmdline.split(" "); String keymap = "builtin", init = "/System/Applications/PaperWork.app"; String root = "ramfs:0"; @@ -183,14 +210,15 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //*************************************** DEVICE SETUP - Dev::registerDevice(new PS2Keyboard()); //Initialize keyboard driver + STATUS("Keyboard"); Dev::registerDevice(new PS2Keyboard()); //Initialize keyboard driver Kbd::setFocus(kvt); //Set focus to virtual terminal - if (enableVESA) Dev::registerDevice(new VESADisplay()); - FloppyController::detect(); - ATAController::detect(); + STATUS("VESA"); if (enableVESA) Dev::registerDevice(new VESADisplay()); + STATUS("Floppy"); FloppyController::detect(); + STATUS("Hard disk drives"); ATAController::detect(); //*************************************** MOUNT FILESYSTEMS + STATUS("Root filesystem"); { // mount root filesystem if (!VFS::mount(String("/:") += root, kvt, mbd)) PANIC("Cannot mount root filesystem."); } @@ -198,6 +226,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { cwd = VFS::getRootNode(); Task::currProcess()->setCwd(cwd); + STATUS("File systems"); // mount other filesystems for (u32int i = 0; i < mount.size(); i++) { VFS::mount(mount[i], kvt, mbd); @@ -214,17 +243,21 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //*************************************** LOAD SYSTEM STUFF + STATUS("Logging"); Log::init(KL_STATUS); //Setup logging Log::log(KL_STATUS, "kmain : Melon booting."); if (keymap != "builtin") { + STATUS("Keymap"); if (!Kbd::loadKeymap(keymap)) Log::log(KL_WARNING, String("WARNING : Could not load keymap ") += keymap += ", using built-in keymap instead."); } + STATUS("Users"); Usr::load(); //Setup user managment Log::log(KL_STATUS, "kmain : User list loaded"); if (init.empty()) { + STATUS("= LAUNCHING KERNEL SHELL ="); *kvt << "\n"; new KernelShell(cwd, kvt); while (KernelShell::getInstances() > 0) { @@ -232,6 +265,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { } Sys::halt(); } else { + STATUS("= VIDEO MODE DETECTION ="); selectVideoMode(*kvt); //Create a VT for handling the Melon bootup logo SimpleVT *melonLogoVT = new SimpleVT(melonLogoLines, melonLogoCols, TXTLOGO_FGCOLOR, TXTLOGO_BGCOLOR); -- cgit v1.2.3 From a975053605a0f041fd2003792d81c80391527e71 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Mon, 21 Dec 2009 00:11:00 +0100 Subject: Made status bar into a namespace, and added functionnalities --- Source/Kernel/Core/kmain.wtf.cpp | 72 +++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 41 deletions(-) (limited to 'Source/Kernel/Core/kmain.wtf.cpp') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 2dc0377..83fca7b 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -107,6 +108,7 @@ void selectVideoMode(SimpleVT& v) { u32int n = answer.toInt(); v.unmap(); if (n >= 0 and n < Disp::modes.size() and Disp::setMode(Disp::modes[n])) { + SB::reinit(); return; } else { Disp::setMode(Disp::modes[1]); @@ -116,29 +118,9 @@ void selectVideoMode(SimpleVT& v) { } } -#define STATUS(stat) { \ - progress++; \ - kvt->setColor(STATUSBAR_FGCOLOR, STATUSBAR_BGCOLOR); \ - line = kvt->csrlin(); \ - kvt->moveCursor(0, 0); \ - *kvt << "Melon is loading : {"; \ - for (u32int i = 0; i < progress; i++) *kvt << ":"; \ - *kvt << ". "; \ - kvt->moveCursor(0, 42); \ - *kvt << "} "; \ - kvt->moveCursor(0, 51); \ - *kvt << "[" << stat; \ - kvt->moveCursor(0, 78); \ - *kvt << "] "; \ - kvt->setColor(KVT_FGCOLOR, KVT_BGCOLOR); \ - kvt->moveCursor(line, 0); \ -} - void kmain(multiboot_info_t* mbd, u32int magic) { DEBUG("Entering kmain."); - u16int progress = 0, line; //For logger - if (magic != MULTIBOOT_BOOTLOADER_MAGIC) { Mem::placementAddress = (u32int)&end; //Setup basic stuff so that PANIC will work VGATextOutput *vgaout = new VGATextOutput(); @@ -163,37 +145,41 @@ void kmain(multiboot_info_t* mbd, u32int magic) { VGATextOutput *vgaout = new VGATextOutput(); Disp::setText(vgaout); + SB::init(); + //Create a VT for logging what kernel does - kvt = new ScrollableVT(25, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR); - kvt->map(0, 0); - *kvt << "Melon is loading :\n"; + SB::progress("Create kernel VT"); + kvt = new ScrollableVT(24, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR); + kvt->map(1, 0); + kvt->moveCursor(0, 0); - STATUS("IDT"); + SB::progress("IDT"); IDT::init(); //Setup interrupts - STATUS("Paging"); + SB::progress("Paging"); u32int totalRam = ((mbd->mem_upper + mbd->mem_lower) * 1024); PhysMem::initPaging(totalRam); //Setup paging - STATUS("GDT"); + SB::progress("GDT"); GDT::init(); //Initialize real GDT, not fake one from loader.wtf.asm PhysMem::removeTemporaryPages(); //Remove useless page mapping - STATUS("Heap"); + SB::progress("Heap"); Mem::createHeap(); //Create kernel heap Dev::registerDevice(vgaout); - STATUS("Timer"); + SB::progress("Timer"); Dev::registerDevice(new Timer()); //Initialize timer String kcmdline((char*)mbd->cmdline); - STATUS("Multitasking"); + SB::progress("Multitasking"); Task::initialize(kcmdline, kvt); //Initialize multitasking + SB::gomulti(); asm volatile("sti"); //*************************************** PARSE COMMAND LINE - STATUS("Parse command line"); + SB::progress("Parse command line"); Vector opts = kcmdline.split(" "); String keymap = "builtin", init = "/System/Applications/PaperWork.app"; String root = "ramfs:0"; @@ -210,15 +196,15 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //*************************************** DEVICE SETUP - STATUS("Keyboard"); Dev::registerDevice(new PS2Keyboard()); //Initialize keyboard driver + SB::progress("Keyboard"); Dev::registerDevice(new PS2Keyboard()); //Initialize keyboard driver Kbd::setFocus(kvt); //Set focus to virtual terminal - STATUS("VESA"); if (enableVESA) Dev::registerDevice(new VESADisplay()); - STATUS("Floppy"); FloppyController::detect(); - STATUS("Hard disk drives"); ATAController::detect(); + SB::progress("VESA"); if (enableVESA) Dev::registerDevice(new VESADisplay()); + SB::progress("Floppy"); FloppyController::detect(); + SB::progress("Hard disk drives"); ATAController::detect(); //*************************************** MOUNT FILESYSTEMS - STATUS("Root filesystem"); + SB::progress("Root filesystem"); { // mount root filesystem if (!VFS::mount(String("/:") += root, kvt, mbd)) PANIC("Cannot mount root filesystem."); } @@ -226,7 +212,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { cwd = VFS::getRootNode(); Task::currProcess()->setCwd(cwd); - STATUS("File systems"); + SB::progress("File systems"); // mount other filesystems for (u32int i = 0; i < mount.size(); i++) { VFS::mount(mount[i], kvt, mbd); @@ -243,35 +229,38 @@ void kmain(multiboot_info_t* mbd, u32int magic) { //*************************************** LOAD SYSTEM STUFF - STATUS("Logging"); + SB::progress("Logging"); Log::init(KL_STATUS); //Setup logging Log::log(KL_STATUS, "kmain : Melon booting."); if (keymap != "builtin") { - STATUS("Keymap"); + SB::progress("Keymap"); if (!Kbd::loadKeymap(keymap)) Log::log(KL_WARNING, String("WARNING : Could not load keymap ") += keymap += ", using built-in keymap instead."); } - STATUS("Users"); + SB::progress("Users"); Usr::load(); //Setup user managment Log::log(KL_STATUS, "kmain : User list loaded"); if (init.empty()) { - STATUS("= LAUNCHING KERNEL SHELL ="); + SB::progress("Start kernel shell"); *kvt << "\n"; new KernelShell(cwd, kvt); + SB::message("Melon is running \\o/"); while (KernelShell::getInstances() > 0) { Task::currThread()->sleep(100); } Sys::halt(); } else { - STATUS("= VIDEO MODE DETECTION ="); + SB::progress("Video mode selection"); selectVideoMode(*kvt); + SB::progress("Logo setup"); //Create a VT for handling the Melon bootup logo SimpleVT *melonLogoVT = new SimpleVT(melonLogoLines, melonLogoCols, TXTLOGO_FGCOLOR, TXTLOGO_BGCOLOR); melonLogoVT->map(1); new Thread(logoAnimation, (void*)melonLogoVT, true); + SB::progress("Launch INIT"); Process* p = Process::run(init, 0); if (p == 0) { PANIC((char*)(u8int*)ByteArray(String("Could not launch init : ") += init)); @@ -284,6 +273,7 @@ void kmain(multiboot_info_t* mbd, u32int magic) { p->setInVT(vt); p->setOutVT(vt); p->start(); + SB::message("Init started"); while (p->getState() != P_FINISHED) Task::currThread()->sleep(100); PANIC("Init has terminated"); } -- cgit v1.2.3 From e7a0a24fa88e369eb3d345573200955e99324156 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Mon, 21 Dec 2009 18:56:08 +0100 Subject: More work on the status bar --- Source/Kernel/Core/kmain.wtf.cpp | 60 ++++++++-------------------------------- 1 file changed, 11 insertions(+), 49 deletions(-) (limited to 'Source/Kernel/Core/kmain.wtf.cpp') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 83fca7b..aa87d49 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -86,38 +86,6 @@ u32int logoAnimation(void* p) { return 0; } -void selectVideoMode(SimpleVT& v) { - Disp::getModes(); - v << "\nPlease select a graphic mode in the list below:\n"; - - for (u32int i = 0; i < Disp::modes.size(); i++) { - Disp::mode_t& m = Disp::modes[i]; - v << (s32int)i << ":\t" << "Text " << m.textRows << "x" << m.textCols << "\t"; - if (m.graphWidth != 0 and m.graphHeight != 0) { - v << "Graphics " << m.graphWidth << "x" << m.graphHeight << "x" << m.graphDepth << "\t"; - } else { - v << "No graphics"; - } - v.setCursorCol(50); - v << m.device->getName() << "\n"; - } - - while (1) { - v << "\nYour selection: "; - String answer = v.readLine(); - u32int n = answer.toInt(); - v.unmap(); - if (n >= 0 and n < Disp::modes.size() and Disp::setMode(Disp::modes[n])) { - SB::reinit(); - return; - } else { - Disp::setMode(Disp::modes[1]); - v.map(); - v << "Error while switching video mode, please select another one."; - } - } -} - void kmain(multiboot_info_t* mbd, u32int magic) { DEBUG("Entering kmain."); @@ -151,7 +119,12 @@ void kmain(multiboot_info_t* mbd, u32int magic) { SB::progress("Create kernel VT"); kvt = new ScrollableVT(24, 80, 20, KVT_FGCOLOR, KVT_BGCOLOR); kvt->map(1, 0); - kvt->moveCursor(0, 0); + kvt->setColor(TXTLOGO_FGCOLOR, TXTLOGO_BGCOLOR); + for (int i = 0; i < melonLogoLines; i++) { + kvt->setCursorCol(40 - (melonLogoCols / 2)); + *kvt << melonLogo[i] << "\n"; + } + kvt->setColor(KVT_FGCOLOR, KVT_BGCOLOR); SB::progress("IDT"); IDT::init(); //Setup interrupts @@ -225,7 +198,6 @@ void kmain(multiboot_info_t* mbd, u32int magic) { if (!m.empty() && m[0] != WChar("#")) VFS::mount(m, kvt, mbd); } } - //*************************************** LOAD SYSTEM STUFF @@ -242,36 +214,26 @@ void kmain(multiboot_info_t* mbd, u32int magic) { Usr::load(); //Setup user managment Log::log(KL_STATUS, "kmain : User list loaded"); + SB::progress("Video mode selection"); + Disp::selectMode(); if (init.empty()) { SB::progress("Start kernel shell"); *kvt << "\n"; new KernelShell(cwd, kvt); - SB::message("Melon is running \\o/"); + SB::message("Melon is running"); while (KernelShell::getInstances() > 0) { Task::currThread()->sleep(100); } Sys::halt(); } else { - SB::progress("Video mode selection"); - selectVideoMode(*kvt); - SB::progress("Logo setup"); - //Create a VT for handling the Melon bootup logo - SimpleVT *melonLogoVT = new SimpleVT(melonLogoLines, melonLogoCols, TXTLOGO_FGCOLOR, TXTLOGO_BGCOLOR); - melonLogoVT->map(1); - new Thread(logoAnimation, (void*)melonLogoVT, true); - SB::progress("Launch INIT"); Process* p = Process::run(init, 0); if (p == 0) { PANIC((char*)(u8int*)ByteArray(String("Could not launch init : ") += init)); } else { Log::log(KL_STATUS, String("kmain : Starting init : ") += init); - VirtualTerminal* vt = new ScrollableVT(Disp::textRows() - 10, Disp::textCols() - 4, - 200, SHELL_FGCOLOR, SHELL_BGCOLOR); - Kbd::setFocus(vt); - ((ScrollableVT*)vt)->map(9); - p->setInVT(vt); - p->setOutVT(vt); + p->setInVT(kvt); + p->setOutVT(kvt); p->start(); SB::message("Init started"); while (p->getState() != P_FINISHED) Task::currThread()->sleep(100); -- cgit v1.2.3