summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-18 13:23:53 +0200
committerMiguel <m.i@gmx.at>2018-08-18 13:23:53 +0200
commit7b0d88b2dff9b635d9ff69f6d51b6832c1ca4c40 (patch)
tree22c452e9c7ad586136721e776e0b67b23fb33119 /kernel/kernel.c
parent17fd357bad5f6c3362cfdab1d807aa463c69a4e9 (diff)
cleaning up syscalls and playing with new pipes
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c77
1 files changed, 13 insertions, 64 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index fca6fe6..79acf18 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,10 +1,10 @@
#define FOOLOS_MODULE_NAME "kernel"
-#include "kernel.h"
#include <stdint.h>
#include <stddef.h>
-#include "config.h"
+#include "syscalls.h"
+#include "kernel.h"
#include "types.h"
#include "lib/logger/log.h"
#include "fifo.h"
@@ -20,75 +20,28 @@
#include "terminal/terminal.h"
#include "driver/screen.h"
-// The Foolish structure of Fool OS! //
-static fool_os foolos;
-
-fool_os *get_fool()
-{
- return &foolos;
-}
-//
-
-// stdio init : TODO: move away!
-static terminal_tty tty1;
-static term_out screen;
-static term_in input;
-
-static ringbuffer stdin_buf;
-
-static void put_kb(uint8_t c)
-{
- terminal_kb(&tty1,c);
-}
-
-static void stdin_put_char(uint8_t c)
-{
- ringbuffer_put(&stdin_buf,c);
-}
-
-static void init_stdio()
-{
- //
- // Setup terminal output / input
- //
-
- screen.put_char=console_put_char;
- screen.update_cursor=update_cursor;
-
- input.put_char=stdin_put_char;
-
- tty1=terminal_init(&screen,&input);
-
- get_fool()->tty=&tty1;
-
- //
-
- get_fool()->std_out.data=&tty1;
- get_fool()->std_out.put=terminal_put;
-
- stdin_buf=ringbuffer_init(1);
- get_fool()->std_in.data=&stdin_buf;
- get_fool()->std_in.put=ringbuffer_put;
- get_fool()->std_in.get=ringbuffer_get;
- get_fool()->std_in.has=ringbuffer_has;
-
- keyboard_init(put_kb);
-}
-
/* F00L 0S Entry point (called directly from asm/multiboot.asm */
void kernel_main(uint32_t eax,uint32_t ebx)
{
+
+ //
+ // STDIN & STDOUT
//
- // STDIN and STDOUT
- //
- init_stdio();
+ uint32_t sstdin = syscall_open("stdin",0,0); // stdin 0
+ uint32_t sstdout = syscall_open("term",0,0); // stdout 1
+ uint32_t sstderr = syscall_open("stderr",0,0); // stderr 2
//
// PR
//
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",KERNEL_VERSION,__DATE__,__TIME__);
+ //
+ // Setup Keyboard Driver
+ //
+ keyboard_init(sstdin);
+
//
// Configuring the PIT timer.
//
@@ -152,10 +105,6 @@ void kernel_main(uint32_t eax,uint32_t ebx)
//
//pci_init();
//
-
- //empty stdin!
- while(fifo_has(&get_fool()->std_in))
- fifo_get(&get_fool()->std_in);
//
// Initialize Multitasking