diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-17 17:14:07 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-17 17:14:07 +0200 |
| commit | 29ea3208b004f15dafa48ae29a75ba7f0c093a74 (patch) | |
| tree | bc39ac9b187753e9a16dbac5bf9c2523b32097f9 /kernel | |
| parent | 819a4e871058f2dc4a2e255ecbe5a2c49cc8450c (diff) | |
working on vt52 layer
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/config.h | 2 | ||||
| -rw-r--r-- | kernel/console.h | 1 | ||||
| -rw-r--r-- | kernel/kernel.c | 30 | ||||
| -rw-r--r-- | kernel/kernel.h | 10 | ||||
| -rw-r--r-- | kernel/syscalls.c | 4 | ||||
| -rw-r--r-- | kernel/usermode.c | 5 |
6 files changed, 42 insertions, 10 deletions
diff --git a/kernel/config.h b/kernel/config.h index 8329457..74304d8 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -8,7 +8,7 @@ #define FOOLOS_CONFIG_H #define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line -//#define FOOLOS_LOG_OFF // do not log anything +#define FOOLOS_LOG_OFF // do not log anything #define FOOLOS_CONSOLE // otherwise VESA will be used! #define FOOLSOS_SHOW_VESAMODES #define MEM_PRINT_MEMORYMAP diff --git a/kernel/console.h b/kernel/console.h index e68a3b7..4c56a5a 100644 --- a/kernel/console.h +++ b/kernel/console.h @@ -4,6 +4,7 @@ #include <stdint.h> uint32_t console_init(); +void console_put_char(uint8_t c,uint8_t color, uint32_t x, uint32_t y); void console_put_char_white(char); void console_put_char_red(char); void console_put_char_green(char); diff --git a/kernel/kernel.c b/kernel/kernel.c index a3df0b3..0a4b863 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -28,14 +28,33 @@ #include "video/vesa.h" #include "multiboot.h" +#include "terminal/vt52.h" + + +// +// The Foolish structure of Fool OS! +// +static fool_os foolos; + +fool_os *get_fool() +{ + return &foolos; +} + void kernel_main(uint32_t eax,uint32_t ebx) { + // - // Init Console - // - console_init(); + // Setup main tty + // + scr_clear(); + term_screen screen; + screen.put_char=console_put_char; + vt52_tty tty=vt52_init(&screen); + get_fool()->tty1=&tty; + // // PR @@ -43,13 +62,11 @@ void kernel_main(uint32_t eax,uint32_t ebx) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",KERNEL_VERSION,__DATE__,__TIME__); - // // Configuring the PIT timer. // timer_init(); - // // GDT // @@ -98,6 +115,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) smp_start_aps(&procdata,"/boot/mp.bin"); //will be copied over mbr + // // Activate Virtual Memory (paging) // @@ -112,13 +130,13 @@ void kernel_main(uint32_t eax,uint32_t ebx) //pci_init(); + // // Initialize Multitasking // task_init(dir); - // // Abvoe should never returon // diff --git a/kernel/kernel.h b/kernel/kernel.h index 59e3d4c..b6eccb8 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -3,5 +3,15 @@ #define KERNEL_VERSION "FoolOs 0.2.1" +#include "terminal/vt52.h"; + +typedef struct fool_os_struct +{ + vt52_tty *tty1; + +}fool_os; + +fool_os *get_fool(); + #endif diff --git a/kernel/syscalls.c b/kernel/syscalls.c index e9ef9d5..6bd51d1 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -5,7 +5,9 @@ #include "fs/fs.h" #include "fs/ext2.h" #include "kernel/console.h" +#include "kernel/kernel.h" #include "kernel/config.h" +#include "terminal/vt52.h" #include <sys/stat.h> #include <stdbool.h> #include <stddef.h> @@ -43,7 +45,7 @@ int syscall_write(int file, char *buf, int len) //stderr and stdout go to console for(int i=0;i<len;i++) { - console_put_char_green(buf[i]); + vt52_put( get_fool()->tty1,buf[i]); } lock_release(2); //x86_int_enable(); diff --git a/kernel/usermode.c b/kernel/usermode.c index e4d22d3..745cef1 100644 --- a/kernel/usermode.c +++ b/kernel/usermode.c @@ -4,8 +4,9 @@ #include "syscalls.h" + tss_struct sys_tss; //Define the TSS as a global structure -extern uint32_t stack_top[]; + // generic syscall interface! int syscall(int call, int p1, int p2, int p3) @@ -46,7 +47,7 @@ void install_tss(int cpu_no){ // now fill each value // set values necessary sys_tss.ss0 = 0x10; //kernel data - sys_tss.esp0 = stack_top; //kernel stack just under the kernel + sys_tss.esp0 = kballoc(4); // now set the IO bitmap (not necessary, so set above limit) // sys_tss.iomap = ( unsigned short ) sizeof( tss_struct ); |
