summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/core/kmain.cpp5
-rw-r--r--src/kernel/dev/keyboard.cpp2
-rw-r--r--src/kernel/task/task.cpp2
-rw-r--r--src/kernel/ui/vt.cpp14
-rw-r--r--src/kernel/ui/vt.h4
-rw-r--r--src/kernel/vfs/node.cpp5
6 files changed, 22 insertions, 10 deletions
diff --git a/src/kernel/core/kmain.cpp b/src/kernel/core/kmain.cpp
index 96c4050..0aa047a 100644
--- a/src/kernel/core/kmain.cpp
+++ b/src/kernel/core/kmain.cpp
@@ -55,9 +55,12 @@ extern "C" void kmain(multiboot_info_t* mbd, int32_t magic) {
// Init display devices
text_display = new vgatxt(dot_dev);
dot_dev->add_child("vgatxt", text_display);
- ke_vt = new vt(dot_dev, 80, 25);
+
+ ke_vt = new vt(dot_ui, 80, 25);
dot_ui->add_child("klog", ke_vt);
ke_vt->outputTo(text_display);
+ home_vt = new vt(dot_ui, 80, 25);
+ dot_ui->add_child("home", home_vt);
// Say hello
ke_vt->fgcolor = TC_LIGHTGRAY;
diff --git a/src/kernel/dev/keyboard.cpp b/src/kernel/dev/keyboard.cpp
index ce8e77b..3f54b99 100644
--- a/src/kernel/dev/keyboard.cpp
+++ b/src/kernel/dev/keyboard.cpp
@@ -150,7 +150,7 @@ void keyboard::handle(int scancode, bool pressed) {
// process keypress
if (output != 0) {
- output->keyboardInput(kp);
+ output->keyboardInput(kp, this);
} else {
// TODO: enable reading directly keypresses from keyboard device
}
diff --git a/src/kernel/task/task.cpp b/src/kernel/task/task.cpp
index 02294bd..98204d6 100644
--- a/src/kernel/task/task.cpp
+++ b/src/kernel/task/task.cpp
@@ -119,7 +119,7 @@ uint32_t tasking_handleException(registers *regs) {
if (regs->eip >= K_HIGHHALF_ADDR) {
*ke_vt << "\nException in kernel. Stack trace:\n";
stack_trace(regs->ebp);
- }
+ }
if (regs->int_no == 14) {
*ke_vt << "\n>>> Process exiting.\n";
thread_exit_stackJmp(EX_PR_EXCEPTION);
diff --git a/src/kernel/ui/vt.cpp b/src/kernel/ui/vt.cpp
index 2869fec..2bd82ca 100644
--- a/src/kernel/ui/vt.cpp
+++ b/src/kernel/ui/vt.cpp
@@ -1,7 +1,7 @@
#include "vt.h"
#include <dev/display.h>
-vt *ke_vt = 0;
+vt *ke_vt = 0, *home_vt = 0;
vt::vt(node* parent, int ww, int hh) : node(parent, FT_TERMINAL) {
w = ww; h = hh;
@@ -9,6 +9,7 @@ vt::vt(node* parent, int ww, int hh) : node(parent, FT_TERMINAL) {
bgcolor = TC_BLACK;
output = 0;
cursor_visible = true;
+ csr_l = csr_c = 0;
kbd_buffer_filled = 0;
kbd_waiter = 0;
@@ -148,9 +149,18 @@ void vt::outputTo(display *display) {
}
}
}
+ output->text_setcsr(csr_l, csr_c, cursor_visible);
}
-void vt::keyboardInput(keypress kp) {
+void vt::keyboardInput(keypress kp, keyboard* from) {
+ if (kp.command == KB_RSUPER || kp.command == KB_LSUPER) {
+ if (this == home_vt) return;
+ // go to home terminal
+ home_vt->outputTo(output);
+ from->outputTo(home_vt);
+ output = 0;
+ return;
+ }
// convert to sequence of chars
int n = 0;
char b[8];
diff --git a/src/kernel/ui/vt.h b/src/kernel/ui/vt.h
index b26e95a..a80452b 100644
--- a/src/kernel/ui/vt.h
+++ b/src/kernel/ui/vt.h
@@ -45,7 +45,7 @@ class vt : public node {
void outputTo(display *display);
- void keyboardInput(keypress kp);
+ void keyboardInput(keypress kp, keyboard* from);
virtual int write(size_t offset, size_t len, char* buffer);
virtual int read(size_t offset, size_t len, char* buffer); // get keyboard input
@@ -53,7 +53,7 @@ class vt : public node {
virtual int link(node* to, int mode);
};
-extern vt *ke_vt;
+extern vt *ke_vt, *home_vt;
#define NL ke_vt->writeStr("\n");
#define TAB ke_vt->writeStr("\t");
#define WHERE { ke_vt->writeStr("(ke:"); \
diff --git a/src/kernel/vfs/node.cpp b/src/kernel/vfs/node.cpp
index ea7b531..c517aae 100644
--- a/src/kernel/vfs/node.cpp
+++ b/src/kernel/vfs/node.cpp
@@ -27,8 +27,7 @@ void vfs_setup() {
node* vfs_find(node* root, char* fn) {
node* el = root;
- char *path = strdup(fn);
- char *s = path;
+ char *path = fn;
char *member = path;
while (*path != 0 && el != 0) {
@@ -39,6 +38,7 @@ node* vfs_find(node* root, char* fn) {
} else {
*path = 0;
el = el->get_child(member);
+ *path = '/';
path++;
member = path;
}
@@ -49,7 +49,6 @@ node* vfs_find(node* root, char* fn) {
if (el != 0 && member != path) {
el = el->get_child(member);
}
- kfree(s);
return el;
}