summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-10-20 18:54:18 +0200
committerMichal Idziorek <m.i@gmx.at>2014-10-20 18:54:18 +0200
commit813272cd88cc6c0a1dfbb121d2130fc849042c8a (patch)
tree61b8ede4a5c191c491621f0185d3a442ff5407dd /kernel
parent2f6fe94d436347c4d886407dbfd44b6ac1aa41fa (diff)
1st userspace programm and partial newlib support!
Diffstat (limited to 'kernel')
-rw-r--r--kernel/config.h1
-rw-r--r--kernel/interrupts.c15
-rw-r--r--kernel/kernel.c17
-rw-r--r--kernel/syscalls.c23
-rw-r--r--kernel/vesa.c23
5 files changed, 50 insertions, 29 deletions
diff --git a/kernel/config.h b/kernel/config.h
index 02ba57c..3870673 100644
--- a/kernel/config.h
+++ b/kernel/config.h
@@ -1,2 +1,3 @@
//#define FOOLOS_COMPILE_FLOPPY
+#define FOOLOS_CONSOLE_AUTOBREAK //add newline automatically at end of line
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 56fa09f..80375c2 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -83,21 +83,6 @@ void int_irq16(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Coprocessor error");
void int_irq17(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Alignment Check"); X86_IRQ_END }
void int_irq18(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Machine Check"); X86_IRQ_END }
-//
-int example_syscall(int x,int y)
-{
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"example syscall called with %d + %d",x,y);
- return x+y;
-
-}
-
-int example_syscall_2(int x,int y)
-{
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"example syscall 2 called with %d - %d",x,y);
- return x-y;
-}
-
-//
//set a handler for a specific interrupt
void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr)
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 811f4c1..3372b75 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -18,9 +18,6 @@ uint32_t c1,c2,c3;
volatile uint8_t proc;
uint32_t cpu_counter[SMP_MAX_PROC];
-volatile int16_t mouse_x;
-volatile int16_t mouse_y;
-
void kernel_ap()
{
proc++;
@@ -35,12 +32,16 @@ void kernel_ap()
}
}
+
+volatile int16_t mouse_x;
+volatile int16_t mouse_y;
+
+
//
// KERNEL MAIN
// this is the very heart of our operating system!
//
-
void kernel_main(uint32_t initial_stack, int mp)
{
@@ -60,7 +61,7 @@ void kernel_main(uint32_t initial_stack, int mp)
proc=c1=c2=c3=0;
for(int i=0;i<SMP_MAX_PROC;i++)cpu_counter[i]=0;
-
+
/////////////////// BULLSHIT ABOVE THIS LINE: TODO: CLEANUP
//
@@ -149,8 +150,8 @@ void kernel_main(uint32_t initial_stack, int mp)
//
// Start the other Processors (also before paging for some reason!)
//
- smp_log_procdata(&procdata);
- smp_start_aps(&procdata,0x80000); // starts at 0x80000
+ //smp_log_procdata(&procdata);
+ //smp_start_aps(&procdata,0x80000); // starts at 0x80000
// but it will be copied over mbr
@@ -192,7 +193,7 @@ void kernel_main(uint32_t initial_stack, int mp)
// For now this starts three "tasks" which are scheduled
// round robin style.
//
- task_init();
+ //task_init();
//
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
new file mode 100644
index 0000000..bf875fd
--- /dev/null
+++ b/kernel/syscalls.c
@@ -0,0 +1,23 @@
+#define FOOLOS_MODULE_NAME "syscalls"
+#include "lib/logger/log.h"
+
+//
+void syscall_outbyte(char c)
+{
+ PutConsoleChar(c,0b1111111111000000);
+}
+
+int example_syscall(int x,int y)
+{
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"example syscall called with %d + %d",x,y);
+ return x+y;
+
+}
+
+int example_syscall_2(int x,int y)
+{
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"example syscall 2 called with %d - %d",x,y);
+ return x-y;
+}
+
+//
diff --git a/kernel/vesa.c b/kernel/vesa.c
index 0619f1a..7001e02 100644
--- a/kernel/vesa.c
+++ b/kernel/vesa.c
@@ -1,6 +1,7 @@
//http://wiki.osdev.org/GUI
#include <stdarg.h>
#include "kernel.h"
+#include "config.h"
#include "lib/logger/log.h" // logger facilities
#include "lib/int/stdint.h"
@@ -80,7 +81,7 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont)
console_cols=mode->Xres/col_width;
// vesa info
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setup complete. vbe version: 0x%x / video mode ptr: 0x%x 0x%x",
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"vbe version: 0x%x / video mode ptr: 0x%x 0x%x",
info->VbeVersion, info->VideoModePtr[1], info->VideoModePtr[0]);
// vesa info on selected mode:
@@ -89,8 +90,10 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont)
mode->green_position,mode->green_mask,
mode->blue_position,mode->blue_mask);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"res: %d * %d / banks: %d / attr: 0x%x / bpp: %d / physbase: 0x%x",
- mode->Xres, mode->Yres, mode->banks, mode->attributes, mode->bpp,mode->physbase);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"res: %d * %d / banks: %d / attr: 0x%x",
+ mode->Xres, mode->Yres, mode->banks, mode->attributes);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"bpp: %d / physbase: 0x%x",
+ mode->bpp,mode->physbase);
// vesa modes
// todo: take segment from vbeinfo!
#ifdef FOOLSOS_SHOW_VESAMODES
@@ -167,15 +170,23 @@ void PutString(char *str, int x,int y, int color, va_list va)
}
+void PutConsoleChar(char c, int color)
+{
+ PutFont(c, console_x*10,console_y*12, color);
+ console_x++;
+
+ #ifdef FOOLOS_CONSOLE_AUTOBREAK
+ if(console_x>console_cols)PutConsoleNL();
+ #endif
+}
+
void PutConsole(char *str, int color)
{
while((*str)!=0)
{
- PutFont(*str, console_x*10,console_y*12, color);
+ PutConsoleChar(*str,color);
str++;
- console_x++;
- if(console_x>console_cols);//PutConsoleNL();
}
}