diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-09-01 10:33:02 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-09-01 10:33:02 +0200 |
| commit | 3737daa88e744cba341e08eef4a2bf607bd8ff00 (patch) | |
| tree | e454a351ef522a6c626dac575c061ce6c3dd328b /kernel/kernel.c | |
| parent | 3971429c15e235814fc73ee3f2ec30e7d749dca7 (diff) | |
Cleanup and Comments
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 115 |
1 files changed, 80 insertions, 35 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 35a1321..5a32c95 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -2,6 +2,7 @@ #include "x86.h" #include "../lib/logger/log.h" // logger facilities + // TODO: WHHYY can i compile it without the includes!??? /////// @@ -13,19 +14,13 @@ void int_floppy_handler(); uint32_t read_eip(); -/* -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); -} -*/ -////////// KERNEL MAIN///// ///// +// +// KERNEL MAIN +// // this is the very heart of our operating system! +// + void kernel_main(uint32_t initial_stack) { @@ -51,26 +46,55 @@ void kernel_main(uint32_t initial_stack) uint32_t vesa_physbase=vesa_init(0x8300,0x8400,0x7200); - // initial stack + + // + // Print initial address of the esp stack pointer + // + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack); - // multiprocessing / apic stuff - if(!find_mp()) - panic(FOOLOS_MODULE_NAME,"Can not Find _MP_"); + // + // Initialize other processors + // + // 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_"); + - // pic - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setup PIC"); + // + // Setup PIC + // + // Do we nee this when using APIC? + // + + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setting up PIC."); pic_setup(); - // PIT config (timer) + + // + // 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 + // + // init and interrupt decriptor table int_init(0x08); @@ -79,40 +103,61 @@ void kernel_main(uint32_t initial_stack) // setup some custom interrupts // remember that we shifted all interrupts with the pic by 32 - // so clock = 32 (irq 0) - // keyboard = 33 (irq 1) - // floppy = 38 (irq 6) - // etc.. - // install PIT interrupt handler + // install PIT interrupt handler (irq 0 => 32) int_install_ir(32, 0b10001110, 0x08,&int_clock_handler); - // install keyboard interrupt handler + // install keyboard interrupt handler (irq 1 => 33) int_install_ir(33, 0b10001110, 0x08,&int_kb_handler); - // install floppy interrupt handler + // install floppy interrupt handler (irq 6 => 38) int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler); - // now we can enable interrupts back again int_enable(); - // pci + + // + // Scan the PCI Bus + // + // We are interested in the E1000 Network Adapter in particular + // Its driver will be hopefully implemented one day ;) + // + pci_init(); - // floppy - // floppy_init(); + // + // Initialize Floppy Disk + // + + floppy_init(); + - //init shell + // + // "Shell" + // + // Will process input from the keyboard but will be completely + // redesigned soon. + // + shell_init(); - // multitasking + + // + // Initialize Multitasking + // + // For now this starts two tasks which are scheduled + // round robin style. + // + task_init(); - while(1) - { - - } + + // + // Just hang here. + // + + while(1); } |
