summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index bf4daac..6d4cb64 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,12 +1,10 @@
#define FOOLOS_MODULE_NAME "kernel"
-#include "lib/logger/log.h" // logger facilities
+#include "lib/logger/log.h"
#include "lib/int/stdint.h"
#include "lib/bool/bool.h"
#include "smp.h"
-// TODO: WHHYY can i compile it without the includes!???
-
///////
// interrupt handler prototypes
// todo: move somewhere else!?
@@ -16,12 +14,13 @@ void int_kb_handler();
uint32_t read_eip();
+volatile uint8_t proc;
+
void kernel_ap()
{
uint32_t cpu_counter=0;
uint32_t ebp;
asm volatile("mov %%ebp,%0":"=r"(ebp));
-// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial ebp: 0x%08X",ebp);
int proc=ebp-0xffffff;
proc/=-0x400;
while(1)PutString("%d", proc*100,580,0b1111100000000000, (cpu_counter++));
@@ -31,7 +30,6 @@ void kernel_ap()
// this is the very heart of our operating system!
//
-volatile uint8_t proc;
void kernel_main(uint32_t initial_stack, int mp)
{
@@ -45,11 +43,12 @@ void kernel_main(uint32_t initial_stack, int mp)
asm volatile("mov %0, %%ebp"::"r"(ebp));
asm volatile("mov %ebp, %esp");
asm volatile("jmp kernel_ap");
-
}
proc=0;
+
+
//
// We want to get output to the screen as fast as possible!
//
@@ -79,6 +78,33 @@ void kernel_main(uint32_t initial_stack, int mp)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack);
+
+ //
+ // Setup PIC
+ //
+ // Do we nee this when using APIC?
+ //
+
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setting up PIC.");
+ pic_setup();
+
+
+ //
+ // 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)));
+
+
+
//
// Initialize other processors (run this before entering paged mode)
//
@@ -90,7 +116,6 @@ void kernel_main(uint32_t initial_stack, int mp)
smp_processors procdata2;
smp_processors procdata;
-
// try to find acpi tables
bool succ_acpi=acpi_find(&procdata1);
@@ -110,31 +135,13 @@ void kernel_main(uint32_t initial_stack, int mp)
smp_start_aps(&procdata);
+ /////////////////////
- //
- // Setup PIC
- //
- // Do we nee this when using APIC?
- //
-
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setting up PIC.");
- pic_setup();
-
- //
- // 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
//