summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2015-05-18 00:48:07 +0200
committerMichal Idziorek <m.i@gmx.at>2015-05-18 00:48:07 +0200
commitdb22b587966b4a4eaa47536f32ca812532446bcb (patch)
treeb6d471f5232973713ef64d9c81feefef51ee5eaf /kernel
parent042e25e19b5fc0cec1d47440c26246c886cf39f6 (diff)
heavy refactoring underway
Diffstat (limited to 'kernel')
-rw-r--r--kernel/acpi.c10
-rw-r--r--kernel/kernel.c35
-rw-r--r--kernel/kernel.h5
-rw-r--r--kernel/kmalloc.c4
-rw-r--r--kernel/mp.c7
-rw-r--r--kernel/syscalls.c6
-rw-r--r--kernel/task.c1
7 files changed, 46 insertions, 22 deletions
diff --git a/kernel/acpi.c b/kernel/acpi.c
index 3aec83b..d7a1749 100644
--- a/kernel/acpi.c
+++ b/kernel/acpi.c
@@ -3,10 +3,10 @@
#define FOOLOS_MODULE_NAME "acpi"
-#include "lib/logger/log.h"
#include <stdint.h>
-#include "lib/string/string.h"
+#include <stdbool.h>
#include "smp.h"
+#include "lib/logger/log.h"
typedef struct acpi_rsdt_struct
@@ -91,7 +91,7 @@ void acpi_check_madt(uint32_t *madt,smp_processors *procdata)
acpi_madt *table=(acpi_madt *)*madt;
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"Looking for MADT Table at %08X.",table);
- if(strcmp("APIC",table->sig,4))
+ if(!strcmp_l("APIC",table->sig,4))
{
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Found MADT Table at 0x%08X",table);
uint8_t *end=(uint8_t *)table;
@@ -115,7 +115,7 @@ void acpi_read_rsdt(acpi_rsdt *rsdt,smp_processors *procdata)
{
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Reading RSDT Table at 0x%08X",rsdt);
- if(!strcmp("RSDT",rsdt->sig,4))
+ if(strcmp_l("RSDT",rsdt->sig,4))
panic(FOOLOS_MODULE_NAME,"Signature MISMATCH!");
int entries=(rsdt->length-sizeof(acpi_rsdt))/4;
@@ -146,7 +146,7 @@ bool acpi_find(smp_processors *procdata)
while(search<=(char *)0xfffff)
{
- if(strcmp("RSD PTR ",search,8)) // notice trailing space in "RSD PTR "
+ if(!strcmp_l("RSD PTR ",search,8)) // notice trailing space in "RSD PTR "
{
uint8_t checksum=0;
for(int i=0;i<20;i++)
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 098fc64..0fb337f 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -22,12 +22,13 @@
#include <stddef.h>
// for built-in shell
-#include "lib/buffer/ringbuffer.h"
#include "task.h"
-#include "video/console.h"
#include "multiboot.h"
#include "terminal/vt52.h"
+#include "driver/console.h"
+
+#include "fs/fifo.h"
//
// The Foolish structure of Fool OS!
@@ -38,15 +39,30 @@ fool_os *get_fool()
{
return &foolos;
}
+//
+//
+//
+
+// stdio init : TODO: move away!
+static vt52_tty tty1;
+
static void put_kb(uint8_t c)
{
- vt52_kb(get_fool()->tty1,c);
+ vt52_kb(&tty1,c);
}
-void kernel_main(uint32_t eax,uint32_t ebx)
+static void stdin_put_char(uint8_t c)
{
+ vt52_kb(&tty1,c);
+}
+
+
+static void init_stdio()
+{
+ fifo in=fifo_init(1);
+ fifo out=fifo_init(1);
//
// Setup terminal output / input
@@ -56,14 +72,21 @@ void kernel_main(uint32_t eax,uint32_t ebx)
screen.update_cursor=update_cursor;
term_in input;
+ input.put_char=stdin_put_char;
- vt52_tty tty=vt52_init(&screen,&input);
- get_fool()->tty1=&tty;
+ tty1=vt52_init(&screen,&input);
keyboard_init(put_kb);
+}
+
+void kernel_main(uint32_t eax,uint32_t ebx)
+{
+
+ init_stdio();
+
//
// PR
//
diff --git a/kernel/kernel.h b/kernel/kernel.h
index b6eccb8..fb4e44d 100644
--- a/kernel/kernel.h
+++ b/kernel/kernel.h
@@ -3,11 +3,12 @@
#define KERNEL_VERSION "FoolOs 0.2.1"
-#include "terminal/vt52.h";
+#include "fs/fifo.h";
typedef struct fool_os_struct
{
- vt52_tty *tty1;
+ fifo fifo_stdin;
+ fifo fifo_stdout;
}fool_os;
diff --git a/kernel/kmalloc.c b/kernel/kmalloc.c
index a3b4ab6..d235f55 100644
--- a/kernel/kmalloc.c
+++ b/kernel/kmalloc.c
@@ -22,7 +22,7 @@ void kmallocinit()
next*=4096;
}
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"kmalloc_init: 0x%08X",next);
+// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"kmalloc_init: 0x%08X",next);
init=1;
}
@@ -38,7 +38,7 @@ uint32_t kballoc(uint32_t size)
{
panic(FOOLOS_MODULE_NAME,"kballoc ran out of memory! maybe increase MEM_SIZE in kmalloc.c?");
}
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"(%d) : 0x%08X (~%dKB left)",size,old,(MEM_SIZE-next+first)/1024);
+ // log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"(%d) : 0x%08X (~%dKB left)",size,old,(MEM_SIZE-next+first)/1024);
return old;
}
diff --git a/kernel/mp.c b/kernel/mp.c
index 8312821..abea5cb 100644
--- a/kernel/mp.c
+++ b/kernel/mp.c
@@ -1,8 +1,9 @@
#define FOOLOS_MODULE_NAME "mp"
+#include <stdbool.h>
+
#include "x86.h"
#include "lib/logger/log.h" // logger facilities
-#include "lib/string/string.h"
#include "smp.h"
@@ -153,7 +154,7 @@ bool mp_find(smp_processors *procdata)
uint8_t *addr=0x8000;
while(addr<=0xfffff)
{
- if(strcmp("_MP_",addr,4))
+ if(!strcmp_l("_MP_",addr,4))
{
// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Found at 0x%04X",addr);
if(do_mp_fps(addr,procdata))return true;
@@ -164,7 +165,7 @@ bool mp_find(smp_processors *procdata)
addr=0x190000-1025;
while(addr<=0x190000+1024)
{
- if(strcmp("_MP_",addr,4))
+ if(!strcmp_l("_MP_",addr,4))
{
// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Found at 0x%04X",addr);
if(do_mp_fps(addr,procdata))return true;
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
index 1d63ba4..9900567 100644
--- a/kernel/syscalls.c
+++ b/kernel/syscalls.c
@@ -1,6 +1,5 @@
#define FOOLOS_MODULE_NAME "syscalls"
-#include "lib/buffer/ringbuffer.h"
#include "lib/logger/log.h"
#include "fs/fs.h"
#include "fs/ext2.h"
@@ -44,7 +43,7 @@ int syscall_write(int file, char *buf, int len)
//stderr and stdout go to console
for(int i=0;i<len;i++)
{
- vt52_put( get_fool()->tty1,buf[i]);
+ fifo_put(&get_fool()->fifo_stdout,buf[i]);
}
lock_release(2);
//x86_int_enable();
@@ -75,7 +74,8 @@ int syscall_read(int file, char *buf, int len)
while(1)
{
- bool ret=ringbuffer_get(&c);
+// bool ret=ringbuffer_get(&c);
+ bool ret=false;
if(ret)
{
diff --git a/kernel/task.c b/kernel/task.c
index 36ccafe..8bb6c13 100644
--- a/kernel/task.c
+++ b/kernel/task.c
@@ -3,7 +3,6 @@
//
#include "kernel.h"
#include "lib/logger/log.h" // logger facilities
-#include "lib/buffer/ringbuffer.h"
#include "mem.h"
#include "timer.h"
#include "x86.h"