summaryrefslogtreecommitdiff
path: root/src/kernel/task
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-17 17:56:23 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-17 17:56:23 +0200
commit593bf4df3d8db49286c1a7ae4ef75c887b629930 (patch)
tree988a104c9611d72e1252282789688586efd9a394 /src/kernel/task
parent7c9a48b4e6d66cf4f62e7bad9e22ab06923e47ef (diff)
downloadTCE-593bf4df3d8db49286c1a7ae4ef75c887b629930.tar.gz
TCE-593bf4df3d8db49286c1a7ae4ef75c887b629930.zip
Devices using the VFS structure. Basic keyboard handler.
Diffstat (limited to 'src/kernel/task')
-rw-r--r--src/kernel/task/idt.cpp11
-rw-r--r--src/kernel/task/syscall.cpp4
-rw-r--r--src/kernel/task/task.cpp26
-rw-r--r--src/kernel/task/timer.cpp3
4 files changed, 20 insertions, 24 deletions
diff --git a/src/kernel/task/idt.cpp b/src/kernel/task/idt.cpp
index c09034e..634350c 100644
--- a/src/kernel/task/idt.cpp
+++ b/src/kernel/task/idt.cpp
@@ -1,11 +1,12 @@
#include "idt.h"
-#include <core/monitor.h>
#include <core/sys.h>
#include <mem/paging.h>
#include <lib/cpp.h>
#include "task.h"
#include "syscall.h"
+#include <ui/vt.h>
+
#include <stdlib_common.h>
extern "C" {
@@ -80,9 +81,9 @@ static struct irq_waiter {
extern "C" void idt_isrHandler(registers regs) {
if ((regs.int_no == 14 && paging_fault(&regs) != 0) || regs.int_no != 14) {
if (tasking_handleException(&regs) == 0) {
- monitor_write("\nREALLY BAD THIS TIME\t\tUnhandled exception\t#");
- monitor_writeDec(regs.int_no);
- monitor_write("\t@"); monitor_writeHex(regs.eip);
+ ke_vt->writeStr("\nREALLY BAD THIS TIME\t\tUnhandled exception\t#");
+ ke_vt->writeDec(regs.int_no);
+ ke_vt->writeStr("\t@"); ke_vt->writeHex(regs.eip);
PANIC("Unhandled Exception");
}
}
@@ -191,8 +192,6 @@ void idt_init() {
idt_setGate(64, (int32_t)syscall64, 0x08, 0x8E);
idt_flush((int32_t)&idt_ptr);
-
- monitor_write("[IDT] ");
}
/* Sets up an IRQ handler for given IRQ. */
diff --git a/src/kernel/task/syscall.cpp b/src/kernel/task/syscall.cpp
index 797c5db..e9f9d3a 100644
--- a/src/kernel/task/syscall.cpp
+++ b/src/kernel/task/syscall.cpp
@@ -1,7 +1,7 @@
#include "syscall.h"
#include "task.h"
#include "timer.h"
-#include <core/monitor.h>
+#include <ui/vt.h>
#include <core/sys.h>
#include <vfs/node.h>
@@ -32,7 +32,7 @@ CALL1V(process_brk, proc_brk_sc);
CALL1V(close, close_sc);
static void printk_sc(registers *r) {
- monitor_write((char*)r->ebx);
+ ke_vt->writeStr((char*)r->ebx);
}
static void thread_new_sc(registers* r) {
diff --git a/src/kernel/task/task.cpp b/src/kernel/task/task.cpp
index 3998bfe..e54b96e 100644
--- a/src/kernel/task/task.cpp
+++ b/src/kernel/task/task.cpp
@@ -1,12 +1,13 @@
#include "task.h"
#include "sched.h"
#include <core/sys.h>
-#include <core/monitor.h>
#include <lib/cpp.h>
#include <mem/seg.h>
#include <mem/gdt.h>
#include "timer.h"
+#include <ui/vt.h>
+
#define KSTACKSIZE 0x8000
//Static routines for handling threads exiting and all cleanup
@@ -39,7 +40,6 @@ void tasking_init() {
current_thread = 0;
idle_thread = new thread(kernel_process, task_idle, 0, 0);
sti();
- monitor_write("[Tasking] ");
}
/* Called by the paging functions when a page table is allocated in the kernel space (>K_HIGHHALF_ADDR).
@@ -97,23 +97,23 @@ void schedule() {
Ends the thread for most exceptions, ends the whole process for page faults. */
uint32_t tasking_handleException(registers *regs) {
if (current_thread == 0) return 0; //No tasking yet
- NL; WHERE; monitor_write("exception:`");
+ NL; WHERE; ke_vt->writeStr("exception:`");
char *exception_messages[] = {"Division By Zero","Debug","Non Maskable Interrupt","Breakpoint",
"Into Detected Overflow","Out of Bounds","Invalid Opcode","No Coprocessor", "Double Fault",
"Coprocessor Segment Overrun","Bad TSS","Segment Not Present","Stack Fault","General Protection Fault",
"Page Fault","Unknown Interrupt","Coprocessor Fault","Alignment Check","Machine Check"};
- monitor_write(exception_messages[regs->int_no]);
- monitor_write("'\teip:"); monitor_writeHex(regs->eip);
+ ke_vt->writeStr(exception_messages[regs->int_no]);
+ ke_vt->writeStr("'\teip:"); ke_vt->writeHex(regs->eip);
if (regs->eip >= K_HIGHHALF_ADDR) {
- monitor_write("\n Exception stack trace :\n");
+ ke_vt->writeStr("\n Exception stack trace :\n");
stack_trace(regs->ebp);
PANIC("Kernel error'd.");
}
if (regs->int_no == 14) {
- monitor_write("\n>>> Process exiting.\n");
+ ke_vt->writeStr("\n>>> Process exiting.\n");
thread_exit_stackJmp(EX_PR_EXCEPTION);
} else {
- monitor_write("\n>>> Thread exiting.\n");
+ ke_vt->writeStr("\n>>> Thread exiting.\n");
thread_exit_stackJmp(EX_TH_EXCEPTION);
}
PANIC("This should never have happened. Please report this.");
@@ -372,11 +372,11 @@ size_t process_sbrk(size_t size) {
ret = p->data;
p->data += size;
}
- /* (DBG) monitor_write("(sbrk ");
- monitor_writeHex(size);
- monitor_write(" ");
- monitor_writeHex(ret);
- monitor_write(")"); */
+ /* (DBG) ke_vt->writeStr("(sbrk ");
+ ke_vt->writeHex(size);
+ ke_vt->writeStr(" ");
+ ke_vt->writeHex(ret);
+ ke_vt->writeStr(")"); */
return ret;
}
diff --git a/src/kernel/task/timer.cpp b/src/kernel/task/timer.cpp
index ccc3c79..0e92b57 100644
--- a/src/kernel/task/timer.cpp
+++ b/src/kernel/task/timer.cpp
@@ -3,7 +3,6 @@
#include "idt.h"
#include <mem/mem.h>
#include <core/sys.h>
-#include <core/monitor.h>
static uint32_t tick = 0, frequency = 0, uptime = 0;
@@ -23,8 +22,6 @@ void timer_init(uint32_t freq) {
uint8_t l = (divisor & 0xFF), h = (divisor >> 8);
outb(0x40, l);
outb(0x40, h);
-
- monitor_write("[PIT] ");
}
/* Accessor function to get machine uptime. */