diff options
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 70 |
1 files changed, 31 insertions, 39 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 91e1c45..76ae8d7 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -26,10 +26,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) { - - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"kernel_main: eax=0x%08X ebx=0x%08X",eax,ebx); - // // Configuring the PIT timer. // @@ -48,6 +45,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Loaded by: \"%s\"",info->boot_loader_name); } + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"multiboot flags: 0x%08X",info->flags); if(info->flags&&1<<0) @@ -61,6 +59,29 @@ void kernel_main(uint32_t eax,uint32_t ebx) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"cmdline: \"%s\"",info->cmdline); } + + // + // Memory Init + // + // after this is set up we will be able to allocate and deallocate + // blocks of physical memory :) + // + // we know that here, the bootloader placed the memory map and + // its length + // + + if(info->flags&&1<<6) + { + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"memory map of length %d provided by bootloader",info->mmap_length); + mem_init(info->mmap_addr,info->mmap_length); + } + + else panic(FOOLOS_MODULE_NAME,"Unable to continue without memory map, sorry!"); + + // + // Modules + // + if(info->flags&&1<<3) { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d modules loaded",info->mods_count); @@ -75,39 +96,6 @@ void kernel_main(uint32_t eax,uint32_t ebx) mod++; } } - - if(info->flags&&1<<6) - { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"memory map of length %d provided by bootloader",info->mmap_length); - - uint32_t mmap_addr=info->mmap_addr; - - while(mmap_addr<info->mmap_addr+info->mmap_length) - { - multiboot_mmap *mmap=mmap_addr; - uint32_t mem_start=mmap->base_addr; - uint32_t mem_end=mmap->base_addr+mmap->length; - - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%08X - %08X / type: %d, size: %d", - mem_start, mem_end, mmap->type, mmap->size); - - mmap_addr+=mmap->size+4; - } - - - } - else panic(FOOLOS_MODULE_NAME,"Unable to continue without memory map, sorry!"); - - // - // Memory Init - // - // after this is set up we will be able to allocate and deallocate - // blocks of physical memory :) - // - // we know that here, the bootloader placed the memory map and - // the number of entries. - // -// mem_init((physical_address)0xa001,(int)(*((uint16_t *)(0xa000)))); // @@ -118,19 +106,20 @@ void kernel_main(uint32_t eax,uint32_t ebx) // // Activate Virtual Memory (paging) -// pdirectory *dir=vmem_init(physbase); + pdirectory *dir=vmem_init(physbase); // log buffered messages to console log_log(); - while(1); - // // Setup Interrupts (code segment: 0x08) // + int_init(0x08); + //while(1); + // // Scan the PCI Bus // @@ -163,6 +152,9 @@ void kernel_main(uint32_t eax,uint32_t ebx) // Initialize Multitasking // //task_init(dir); //; this will never return! + // + while(1); + //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"."); } |
