summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c63
1 files changed, 22 insertions, 41 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 429a286..373eea1 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,6 +1,7 @@
#define FOOLOS_MODULE_NAME "kernel"
#include "x86.h"
+#include "console.h"
#include "../lib/logger/log.h" // logger facilities
// TODO: WHHYY can i compile it without the includes!???
@@ -20,22 +21,20 @@ uint32_t read_eip();
//
// this is the very heart of our operating system!
//
-
void kernel_main(uint32_t initial_stack, int mp)
{
- volatile static uint32_t cpu1_counter=0;
// catch the APs (Application Processors)
- /*
if(mp==1)
{
- //while(1) { static uint16_t c=0; PutString("cpu2: %03d", 200,560,0b1111100000000000, (c++)/100); }
- while(1) { static uint16_t c=0; PutString("cpu1counter: %d", 200,560,0b1111100000000000, (cpu1_counter)); }
- }
- */
+ volatile static uint16_t proc=1;
+ int p=proc;
+ uint32_t cpu_counter=0;
+ while(1)PutString("mp: %d", 200,580,0b1111100000000000, (cpu_counter++));
+ }
//
// We want to get output to the screen as fast as possible!
@@ -67,31 +66,14 @@ void kernel_main(uint32_t initial_stack, int mp)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack);
//
- // Initialize other processors
+ // Initialize other processors (run this before entering paged mode)
//
// This currently uses the MP Floating Pointer Struct.
// Should support APCI in future too.
//
-
if(!init_mp()) panic(FOOLOS_MODULE_NAME,"Can not Find _MP_");
-
- //
- // Memory Init
- //
-
- // we know that here, the bootloader placed the mamory map!
- mem_init(0x7c00+0x400,*((uint16_t *)(0x7c00+0x600)));
-
-
- // paging (pass the vesa physbase address for identity mapping)
- vmem_init(vesa_physbase);
-
- while(1) {
- PutString("cpu1counter: %d", 10,560,0b1111100000000000, (cpu1_counter));
- cpu1_counter++;
- }
//
// Setup PIC
//
@@ -101,14 +83,20 @@ void kernel_main(uint32_t initial_stack, int mp)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setting up PIC.");
pic_setup();
- //while(1);
-
//
// Configuring the PIT timer.
//
timer_init();
+ //
+ // Memory Init
+ //
+
+ // we know that here, the bootloader placed the mamory map!
+ mem_init(0x7c00+0x400,*((uint16_t *)(0x7c00+0x600)));
+ // paging (pass the vesa physbase address for identity mapping)
+ vmem_init(vesa_physbase);
//
// Interrupts
@@ -133,19 +121,7 @@ void kernel_main(uint32_t initial_stack, int mp)
int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler);
// now we can enable interrupts back again
-// int_enable();
-
- while(1) {
- cpu1_counter++;
- /*
- static uint16_t c=0;
- PutString("cpu1: A",20,560,0xffffff,0);
- for(int c2=0;c2<0xffff;c2++);
- PutString("cpu1: B",20,560,0xffffff,0);
- for(int c2=0;c2<0xffff;c2++);
- //PutString("cpu1: %03d", 20,560,0b1111100000000000, (c++)/100);
- */
- }
+ int_enable();
//
// Scan the PCI Bus
@@ -187,7 +163,12 @@ void kernel_main(uint32_t initial_stack, int mp)
// Just hang here.
//
- while(1);
+ while(1)
+ {
+ static uint32_t cpu1_counter=0;
+ PutString("cpu1counter: %d", 10,560,0b1111100000000000, (cpu1_counter++));
+ cpu1_counter++;
+ }
}