summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/font.h0
-rw-r--r--kernel/kernel.c55
-rw-r--r--kernel/smp.c39
-rw-r--r--kernel/syslog.h6
-rw-r--r--kernel/textwindow.c33
-rw-r--r--kernel/xxx.c15
6 files changed, 44 insertions, 104 deletions
diff --git a/kernel/font.h b/kernel/font.h
deleted file mode 100644
index e69de29..0000000
--- a/kernel/font.h
+++ /dev/null
diff --git a/kernel/kernel.c b/kernel/kernel.c
index a5bbfcc..2f7cfc3 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -29,61 +29,12 @@
#include "floppy.h"
#endif
-// some multiprocessor shit that should move away TODO
-uint32_t c1,c2,c3;
-volatile uint8_t proc;
-uint32_t cpu_counter[SMP_MAX_PROC];
-
-void kernel_ap()
-{
- proc++;
- uint8_t p=proc;
- while(1)
- {
- cpu_counter[p]++;
-
- lock_spin(0);
- if(cpu_counter[p]%1000000==0)log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"cpu[%d] %d",p,cpu_counter[p]);
- lock_release(0);
- }
-}
-
-
-// mouse coords testing, move away
-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)
{
-
- /// TODO
- /////// SYMMETRIC MULTIPROCESSING, APS get caought here, move it away ///
- // catch the APs (Application Processors)
- if(mp==1)
- {
- uint32_t ebp=pmmngr_alloc_block()+4095;
-
- asm volatile("mov %0, %%ebp"::"r"(ebp));
- asm volatile("mov %ebp, %esp");
- asm volatile("jmp kernel_ap");
- }
-
- proc=c1=c2=c3=0;
- for(int i=0;i<SMP_MAX_PROC;i++)cpu_counter[i]=0;
-
- /////////////////// BULLSHIT ABOVE THIS LINE: TODO: CLEANUP
-
- //
- // Print initial address of the esp stack pointer
- //
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack);
-
//
// Configuring the PIT timer.
//
@@ -105,13 +56,14 @@ void kernel_main(uint32_t initial_stack, int mp)
//
console_init();
+
// log buffered messages to console
log_log();
+
//
// Setup PIC
//
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setting up PIC.");
pic_setup();
@@ -119,6 +71,7 @@ void kernel_main(uint32_t initial_stack, int mp)
// mouse_init();
keyboard_init();
+
//
// Setup Interrupts (code segment: 0x08)
//
@@ -141,6 +94,7 @@ void kernel_main(uint32_t initial_stack, int mp)
// init spinlocks
init_spinlocks();
+
// ringbuffer for stdin!
ringbuffer_init();
@@ -156,6 +110,7 @@ void kernel_main(uint32_t initial_stack, int mp)
//
vmem_init();
+
//
// Scan the PCI Bus
//
diff --git a/kernel/smp.c b/kernel/smp.c
index 46767ac..63b4087 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -3,12 +3,51 @@
#include "lib/logger/log.h"
#include "lib/int/stdint.h"
#include "smp.h"
+#include "mem.h"
+#include "spinlock.h"
#include "x86.h"
#define FOOLOS_APIC_SPUR_INT 0x00f0
#define FOOLOS_APIC_INT_COMMAND_LOW 0x0300
#define FOOLOS_APIC_INT_COMMAND_HIGH 0x0310
+// some multiprocessor shit that should move away TODO
+uint32_t c1,c2,c3;
+volatile uint8_t proc;
+uint32_t cpu_counter[SMP_MAX_PROC];
+
+void smp_main()
+{
+ /// TODO
+ /////// SYMMETRIC MULTIPROCESSING, APS get caought here, move it away ///
+ // catch the APs (Application Processors)
+// if(mp==1)
+ {
+ uint32_t ebp=pmmngr_alloc_block()+4095;
+
+ asm volatile("mov %0, %%ebp"::"r"(ebp));
+ asm volatile("mov %ebp, %esp");
+ asm volatile("jmp kernel_ap");
+ }
+
+ proc=c1=c2=c3=0;
+ for(int i=0;i<SMP_MAX_PROC;i++)cpu_counter[i]=0;
+}
+
+
+void kernel_ap()
+{
+ proc++;
+ uint8_t p=proc;
+ while(1)
+ {
+ cpu_counter[p]++;
+
+ lock_spin(0);
+ if(cpu_counter[p]%1000000==0)log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"cpu[%d] %d",p,cpu_counter[p]);
+ lock_release(0);
+ }
+}
void smp_log_procdata(smp_processors *procdata)
{
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"---- smp -----");
diff --git a/kernel/syslog.h b/kernel/syslog.h
deleted file mode 100644
index 921702c..0000000
--- a/kernel/syslog.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef FOOLOS_SYSLOG_H
-#define FOOLOS_SYSLOG_H
-
-void syslog(char *sys, int level, char *str);
-
-#endif
diff --git a/kernel/textwindow.c b/kernel/textwindow.c
deleted file mode 100644
index 77c0cbc..0000000
--- a/kernel/textwindow.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#define FOOLOS_TEXTWINDOW_BUFFER_SIZE 10000
-static char *buff;
-
-void textwin_init(int x,int y,int w,int h,char *title, int r,int g, int b)
-{
-
-}
-
-void textwin_move(int x,int y)
-{
-
-}
-
-void textwin_resize(int w,int h)
-{
-
-}
-
-void textwin_putchar(char c)
-{
-
-}
-
-void textwin_putline(char *str,...)
-{
-
-}
-
-void textwin_render()
-{
-
-}
-
diff --git a/kernel/xxx.c b/kernel/xxx.c
deleted file mode 100644
index 19ddb4c..0000000
--- a/kernel/xxx.c
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// some code snipplets I might use someday
-
-/*
-void test_a20()
-{
- uint16_t *test=0x7dfe;
- test+=1024*1024;
-// *test=0x69;
-// test=0x8abcd;
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"A20 test: 0x%02X ",*test);
-
-}
-
-*/