KraKern

C++ Kernel
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/KraKern

commit 2f15c34362d7982dc9b8a5012a7963b25d937c19
parent 76ce0c44753b82a93c47e41173b51ca4b3fbbd29
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 30 May 2016 18:07:56 +0200

Work(Console & Data types)

Diffstat:
Mkernel/FileSystem.cpp | 2+-
Mlib/baselib.cpp | 18++++++++++++++++++
Mmodules/x86/ModuleConsole.cpp | 8+++++++-
Mmodules/x86/ModuleConsole.hpp | 1+
4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/kernel/FileSystem.cpp b/kernel/FileSystem.cpp @@ -5,7 +5,7 @@ void FileSystem::init(void) { __kern.io.loading("Filesystem ..."); this->_dev = this->_root->create_child("dev", TYPE_DIRECTORY); - this->_var = this->_root->create_child("env", TYPE_DIRECTORY); + this->_var = this->_root->create_child("var", TYPE_DIRECTORY); this->_root->create_child("proc", TYPE_DIRECTORY); this->_root->create_child("mnt", TYPE_DIRECTORY); sysd = this->_root->create_child("sys", TYPE_DIRECTORY); diff --git a/lib/baselib.cpp b/lib/baselib.cpp @@ -95,3 +95,21 @@ extern "C" { } } } + +// Datas types + +struct data_map { + char *key; + void *data; + struct data_map *next; +}; + +class map { + public: + map(void); + ~map(void); + + struct data_map &operator [](char *str); + + private: +}; diff --git a/modules/x86/ModuleConsole.cpp b/modules/x86/ModuleConsole.cpp @@ -13,7 +13,7 @@ void ModuleConsole::tick(void) { int ret; if (!this->_is_waiting) { - __kern.io.printk("KraKern > "); + this->prompt(); this->_is_waiting = 1; } else { if ((ret = __kern.io.get_line(line))) { @@ -25,9 +25,15 @@ void ModuleConsole::tick(void) { } } +void ModuleConsole::prompt(void) { + __kern.io.printk("Krakern >"); +} + void ModuleConsole::command(char *str) { if (!strcmp(str, "ls")) { this->list_files(__kern.fs.get_root(), 0); + } else if (!strcmp(str, "reboot")) { + __kern.io.obyte(0x64, 0xFE); } else { __kern.io.printk("%s: Command not found\n", str); } diff --git a/modules/x86/ModuleConsole.hpp b/modules/x86/ModuleConsole.hpp @@ -12,6 +12,7 @@ class ModuleConsole : public Module { virtual void tick(void); void command(char *str); void list_files(File *root, int depth); + void prompt(void); private: int _is_waiting;