summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 6a77fd5..8680e7d 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -32,6 +32,8 @@
#include "driver/vesa.h"
#include "asm_pit.h"
+#include "test/selftest.h"
+
/* F00L 0S Entry point (called directly from asm/multiboot.asm */
void kernel_main(uint32_t eax,uint32_t ebx)
{
@@ -93,12 +95,6 @@ void kernel_main(uint32_t eax,uint32_t ebx)
klog("Advanced Programmable Interrupt Controller (APIC) config ...");
apic_init(&cfg_acpi);
ioapic_config();
- apic_enable();
- apic_init_timer(3);// freq in HZ
-
- // -- RAM IMAGE -- //
- klog("Ram Filesystem init ... ");
- fs_mount(cfg_multiboot);
// -- VESA -- //
fixme("tell terminal syscall somehow if we are vga or textmode");
@@ -108,9 +104,9 @@ void kernel_main(uint32_t eax,uint32_t ebx)
vesa_init(cfg_multiboot->vbe_control_info,cfg_multiboot->vbe_mode_info,addr);
// -- STDIN/STDOUT -- //
+ fixme("do not force order"); // now needed since ids are allocated 0,1,2...
klog("stdin/stdout init ...");
uint32_t sstderr = syscall_open("stderr",0,0); // stderr 2
- uint32_t sstdin = syscall_open("stdin",0,0); // stdin 0
uint32_t sstdout;
if(cfg_multiboot->framebuffer_type==2) // EGA-standard text mode
{
@@ -120,6 +116,7 @@ void kernel_main(uint32_t eax,uint32_t ebx)
{
sstdout = syscall_open("xterm",0,0); // stdout 1
}
+ uint32_t sstdin = syscall_open("stdin",0,0); // stdin 0
klog("Keyboard init ...");
keyboard_init(0);
@@ -127,24 +124,12 @@ void kernel_main(uint32_t eax,uint32_t ebx)
klog("Mouse init ...");
mouse_init();
- klog("Symmetric Multi Processing (SMP) start ... ");
- smp_start_aps(&cfg_acpi);
-
+ // we wait till almost the end since the time will only start ticking after we
+ // enable interrupts
klog("Programmable Interval Timer (PIT) init ...");
uint64_t unixtime=timer_init();
klog("Unix Time = %u seconds",unixtime);
- klog("Unlock application processors ... ");
- asm_smp_unlock();
-
- //PutFont('X', 100,200, 0x00ffff,0xff00ff); // TODO temporary!
-
- klog("Enable Interrupts ... ");
- x86_sti(); // this will start processing hardware interrupts
-
- // now just wait until our scheduler kicks in.
- while(1){
- syscall_write(sstdout,"dupa",4);
- asm("hlt");
- }
+ klog("Symmetric Multi Processing (SMP) start ... ");
+ smp_start_aps(&cfg_acpi);
}