diff options
| author | Miguel <m.i@gmx.at> | 2018-09-09 19:56:46 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-09 19:56:46 +0200 |
| commit | 074490c63dd09fc941b1162f62af1985ee9576d3 (patch) | |
| tree | cf20201cb188c556c8deb59d0eb6f5d145b04b72 /kernel/kernel.c | |
| parent | 4cda542d863839c5b0e026ccee297ca5ff3dd9cd (diff) | |
never ending cleanup
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 50815d1..dfcab3f 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,14 +1,16 @@ #include "kernel.h" #include "serial.h" +#include "asm_pic.h" #include "multiboot.h" #include "acpi.h" +#include "gdt.h" +#include "interrupts.h" -// +#include "mem.h" +#include "vmem.h" -#include "kernel/mem.h" -#include "kernel/vmem.h" -#include "kernel/gdt.h" +//-- clean below headers --// #include "kernel/scheduler.h" #include "driver/timer.h" @@ -17,13 +19,10 @@ #include "syscalls.h" #include "fifo.h" -#include "mp.h" #include "asm_smp.h" #include "asm_x86.h" -#include "interrupts.h" #include "ringbuffer.h" #include "driver/screen.h" -#include "asm_pic.h" #include "smp.h" #include "fs/fs.h" @@ -33,8 +32,11 @@ /* F00L 0S Entry point (called directly from asm/multiboot.asm */ void kernel_main(uint32_t eax,uint32_t ebx) { + // -- COM1 -- // serial_init(); + klog("Communication Port (COM1) initialized."); + // -- PR & VERSION BANNER -- // klog("======================================"); klog("F00L- 0S / The Fool's Operating System"); klog("(C) 2018 / Michal Idziorek (m.i@gmx.at)"); @@ -42,67 +44,66 @@ void kernel_main(uint32_t eax,uint32_t ebx) klog("Version: git-commit: %s",GIT_REVISION); klog("======================================"); - fixme("Check if kernel size does not exceed memory limits!"); - - klog("Communication Port (COM1) initialized."); //delayed info + // -- DISABLE LEGACY PIC -- // + klog("Remapping & Disabling Programmable Interrupt Controller (PIC) ..."); + asm_pic_setup(); + // -- GET CONFIGS -- // klog("Read Multiboot Structures ..."); - multiboot_information *info; - info=multiboot_read(eax, ebx); + multiboot_information *cfg_multiboot; + cfg_multiboot=multiboot_read(eax, ebx); klog("Read Advanced Power Configuration Interface (ACPI) Structures ..."); - acpi_information procdata; - bool acpi_found=acpi_fill(&procdata); + acpi_information cfg_acpi; + bool acpi_found=acpi_fill(&cfg_acpi); + fixme("try to read (legacy) multiprocessor mp strucutres (see: xxx/mp.c)"); if(!acpi_found) kpanic("We Currently rely on ACPI Structures Sorry!"); - //klog("Read Multiprocessor (MP) Structures (Legacy) ... "); - //smp_processors procdata2; - //bool mp_found=mp_find(&procdata2); - + // -- GDT -- // klog("Global Descriptor Table (GDT) init ..."); gdt_init(); + // -- IVT -- // klog("Interrupt Vector Table (IVT) init ..."); interrupts_init(0x08); interrupts_install(); + fixme("register interrupt callback funcs"); - klog("Remapping & Disabling Programmable Interrupt Controller (PIC) ..."); - asm_pic_setup(); - - klog("Keyboard init ..."); - keyboard_init(0); - - klog("Mouse init ..."); - mouse_init(); - - klog("MEMORY MANAGEMENT"); - // memory management + // -- MEMORY MANAGEMENT -- // klog("Memory init ... "); - uint32_t kernel_blocks=mem_init(info); + uint32_t kernel_blocks=mem_init(cfg_multiboot); klog("Vritual Memory / Paging init ... "); - pdirectory *dir=vmem_init(kernel_blocks,(uint32_t)info->framebuffer_addr,procdata.local_apic_address,procdata.io_apic_address); - // - + pdirectory *dir=vmem_init(kernel_blocks,(uint32_t)cfg_multiboot->framebuffer_addr,cfg_acpi.local_apic_address,cfg_acpi.io_apic_address); + // -- RAM IMAGE -- // klog("Ram Filesystem init ... "); - fs_mount(info); + fs_mount(cfg_multiboot); + // -- VESA -- // klog("Video Electronics Standards Association (VESA) init ... "); // TODO check if text or fb? uint32_t addr=kballoc(1); fs_content("/binfont.bin",addr,0x100); // copy font (0x100 bytes) to memory. - vesa_init(info->vbe_control_info,info->vbe_mode_info,addr); + vesa_init(cfg_multiboot->vbe_control_info,cfg_multiboot->vbe_mode_info,addr); + // -- STDIN/STDOUT -- // klog("stdin/stdout init ..."); uint32_t sstdin = syscall_open("stdin",0,0); // stdin 0 uint32_t sstdout = syscall_open("term",0,0); // stdout 1 uint32_t sstderr = syscall_open("stderr",0,0); // stderr 2 + // -- ... -- // klog("Scheduler init ..."); scheduler_init(dir); + klog("Keyboard init ..."); + keyboard_init(0); + + klog("Mouse init ..."); + mouse_init(); + klog("Symmetric Multi Processing (SMP) start ... "); - smp_start_aps(&procdata); + smp_start_aps(&cfg_acpi); klog("Programmable Interval Timer (PIT) init ..."); uint64_t unixtime=timer_init(); |
