diff options
author | Alexis211 <alexis211@gmail.com> | 2009-08-31 00:25:21 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-08-31 00:25:21 +0200 |
commit | 68a8fb4e3b3e9087904b17ce6d81983950b9dca9 (patch) | |
tree | 57518642ab813fddfb3887a47f7a01d839d9bb70 /Source/Kernel/Core | |
parent | 9ad8e2fe0242da26dae7fca2b180640637c8c062 (diff) | |
download | Melon-68a8fb4e3b3e9087904b17ce6d81983950b9dca9.tar.gz Melon-68a8fb4e3b3e9087904b17ce6d81983950b9dca9.zip |
We now have complete support for keybord, IN UTF-8 !!
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r-- | Source/Kernel/Core/.kmain.wtf.cpp.swp | bin | 12288 -> 24576 bytes | |||
-rw-r--r-- | Source/Kernel/Core/Sys.ns.cpp | 15 | ||||
-rw-r--r-- | Source/Kernel/Core/Sys.ns.h | 2 | ||||
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.cpp | 82 |
4 files changed, 68 insertions, 31 deletions
diff --git a/Source/Kernel/Core/.kmain.wtf.cpp.swp b/Source/Kernel/Core/.kmain.wtf.cpp.swp Binary files differindex 4849678..9a87295 100644 --- a/Source/Kernel/Core/.kmain.wtf.cpp.swp +++ b/Source/Kernel/Core/.kmain.wtf.cpp.swp diff --git a/Source/Kernel/Core/Sys.ns.cpp b/Source/Kernel/Core/Sys.ns.cpp index 5cd1c28..9f98c91 100644 --- a/Source/Kernel/Core/Sys.ns.cpp +++ b/Source/Kernel/Core/Sys.ns.cpp @@ -40,6 +40,21 @@ void bochs_output(char *message, char *file, u32int line) { outb(0xE9, '\n'); } +void bochs_output(String message, char *file, u32int line) { + for (u32int i = 0; i < message.size(); i++) { + outb(0xE9, message[i].toAscii()); + } + char* t = (char*)" (in "; + for (u32int i = 0; i < strlen(t); i++) { + outb(0xE9, t[i]); + } + for (u32int i = 0; i < strlen(file); i++) { + outb(0xE9, file[i]); + } + outb(0xE9, ')'); + outb(0xE9, '\n'); +} + void bochs_output_hex(u32int i) { char hexdigits[] = "0123456789ABCDEF"; outb(0xE9, '0'); diff --git a/Source/Kernel/Core/Sys.ns.h b/Source/Kernel/Core/Sys.ns.h index 69dcc42..825b68c 100644 --- a/Source/Kernel/Core/Sys.ns.h +++ b/Source/Kernel/Core/Sys.ns.h @@ -5,6 +5,7 @@ #define DEF_SYS_NS_H //This file contains system-relative functions +class String; namespace Sys { void outb(u16int port, u8int value); @@ -13,6 +14,7 @@ namespace Sys { void panic(char* message, char *file, u32int line); void panic_assert(char* file, u32int line, char *desc); void bochs_output(char* message, char *file, u32int line); + void bochs_output(String message, char *file, u32int line); void bochs_output_hex(u32int i); void reboot(); } diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index fa1c57e..e2f3707 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -4,9 +4,11 @@ #include <Core/multiboot.wtf.h> #include <Devices/Display/VGATextOutput.class.h> +#include <Devices/Keyboard/PS2Keyboard.class.h> #include <Devices/Timer.class.h> #include <DeviceManager/Disp.ns.h> #include <DeviceManager/Dev.ns.h> +#include <DeviceManager/Kbd.ns.h> #include <VTManager/VirtualTerminal.class.h> #include <MemoryManager/PhysMem.ns.h> #include <MemoryManager/PageAlloc.ns.h> @@ -17,11 +19,17 @@ #include <Library/wchar.class.h> #include <Ressources/logo.cd> +#include <Ressources/keymap-fr.wtf.c> extern u32int end; //Placement address extern "C" void kmain(multiboot_info_t* mbd, u32int magic); +#define INFO(vt) vt->setColor(0); *vt << " - "; vt->setColor(8); +#define PROCESSING(vt, m) vt->setColor(6); *vt << " > "; vt->setColor(0); *vt << m; \ + vt->setCursorCol(60); vt->setColor(8); *vt << ": "; +#define OK(vt) vt->setColor(0); *vt << "[ "; vt->setColor(1); *vt << "OK"; vt->setColor(0); *vt << " ]\n"; + void kmain(multiboot_info_t* mbd, u32int magic) { DEBUG("Entering kmain."); @@ -48,58 +56,70 @@ void kmain(multiboot_info_t* mbd, u32int magic) { Disp::setDisplay(vgaout); //Create a VT for handling the Melon bootup logo - VirtualTerminal *melonLogoVT = new VirtualTerminal(melonLogoLines, melonLogoCols, 7, 0); + VirtualTerminal *melonLogoVT = new VirtualTerminal(melonLogoLines, melonLogoCols, 9, 0); for (int i = 0; i < melonLogoLines; i++) { for (int j = 0; j < melonLogoCols; j++) { melonLogoVT->putChar(i, j, melonLogo[i][j]); } } - melonLogoVT->map(2); + melonLogoVT->map(1); //Create a VT for logging what kernel does - VirtualTerminal *kvt = new VirtualTerminal(12, 40, 0, 7); - kvt->map(melonLogoLines + 4); + VirtualTerminal *kvt = new VirtualTerminal(15, 76, 0, 7); + kvt->map(melonLogoLines + 2); - *kvt << "* Kernel initializing in HIGHER HALF!\n"; - *kvt << "- Lower ram : " << (s32int)mbd->mem_lower << "k, upper : " << (s32int)mbd->mem_upper << "k.\n"; - *kvt << "- Kernel command line @ " << (u32int)mbd->cmdline << "\n"; - *kvt << "- Modules@" << (u32int)mbd->mods_addr << ", mbd@" << (u32int)mbd << "\n"; - *kvt << "- Placement address : " << (u32int)Mem::placementAddress << "\n"; + INFO(kvt); *kvt << "Lower ram : " << (s32int)mbd->mem_lower << "k, upper : " << (s32int)mbd->mem_upper << "k.\n"; + INFO(kvt); *kvt << "Placement address : " << (u32int)Mem::placementAddress << "\n"; - *kvt << "> Loading IDT..."; - IDT::init(); + PROCESSING(kvt, "Loading IDT..."); + IDT::init(); OK(kvt); - *kvt << "OK.\n> Initializing paging..."; + PROCESSING(kvt, "Initializing paging..."); u32int totalRam = ((mbd->mem_upper + 1024) * 1024); - PhysMem::initPaging(totalRam); + PhysMem::initPaging(totalRam); OK(kvt); - *kvt << "OK.\n- Total ram : " << (s32int)(totalRam / 1024) << "k.\n"; + INFO(kvt); *kvt << "Total ram : " << (s32int)(totalRam / 1024) << "k.\n"; + PROCESSING(kvt, "Initializing GDT and cleaning page directory..."); GDT::init(); - *kvt << "> GDT OK. Cleaning page directory..."; - PhysMem::removeTemporaryPages(); - - *kvt << "OK.\n> Creating heap..."; - Mem::createHeap(); - *kvt << "OK.\n"; - *kvt << "- Free frames : " << (s32int)PhysMem::free() << "/" << - (s32int)PhysMem::total(); + PhysMem::removeTemporaryPages(); OK(kvt); + + PROCESSING(kvt, "Creating heap..."); + Mem::createHeap(); OK(kvt); + INFO(kvt); *kvt << "Free frames : " << (s32int)PhysMem::free() << "/" << + (s32int)PhysMem::total() << "\n"; - *kvt << "\n> Registering vgaout..."; - Dev::registerDevice(vgaout); + PROCESSING(kvt, "Registering vgaout..."); + Dev::registerDevice(vgaout); OK(kvt); - *kvt << "OK.\n> Initializing PIT..."; - Dev::registerDevice(new Timer()); + PROCESSING(kvt,"Initializing PIT..."); + Dev::registerDevice(new Timer()); OK(kvt); - *kvt << "OK.\n> Initializing multitasking..."; - Task::initialize(String((char*)mbd->cmdline)); + PROCESSING(kvt, "Initializing multitasking..."); + Task::initialize(String((char*)mbd->cmdline), kvt); OK(kvt); - *kvt << "OK.\n"; + PROCESSING(kvt, "Setting up keyboard..."); + Dev::registerDevice(new PS2Keyboard()); //Initialize keyboard driver + Kbd::setKeymap(keymapFR_normal, keymapFR_shift, keymapFR_altgr, keymapFR_shiftaltgr); //Load keymap + Kbd::setFocus(kvt); //Set focus to virtual terminal + OK(kvt); asm volatile("sti"); while(1) { - Task::currentThread->sleep(1000); - *kvt << "."; + kvt->setColor(0); + *kvt << "> "; + kvt->setColor(8); + String tmp = kvt->readLine(); + kvt->setColor(0); + if (tmp == "help") { + *kvt << " - Command list for integrated kernel shell:\n"; + *kvt << " - help shows this help screen\n"; + *kvt << " - reboot reboots your computer\n"; + } else if (tmp == "reboot") { + Sys::reboot(); + } else if (!tmp.empty()) { + *kvt << " - Unrecognized command: " << tmp << "\n"; + } } PANIC("END OF KMAIN"); } |