diff options
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 75 |
1 files changed, 14 insertions, 61 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 657b69a..224f98b 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -25,14 +25,21 @@ #include "lib/buffer/ringbuffer.h" #include "task.h" #include "video/vesa.h" +#include "multiboot.h" void kernel_main(uint32_t eax,uint32_t ebx) { // + // Init Console + // + + uint32_t physbase=console_init(0,0); + + // // PR // - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s",KERNEL_VERSION); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",KERNEL_VERSION,__DATE__,__TIME__); // // Configuring the PIT timer. @@ -44,27 +51,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) // Process Multiboot Header // - if(eax!=0x2badb002)panic(FOOLOS_MODULE_NAME,"EAX was not set properly by your bootlaoder!"); - - multiboot_information *info; - info=ebx; - if(info->flags&&1<<9) - { - 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) - { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mem_lower: %d KB",info->mem_lower); - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mem_upper: %d KB",info->mem_upper); - } - - if(info->flags&&1<<2) - { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"cmdline: \"%s\"",info->cmdline); - } + multiboot_information *info=get_multiboot(eax, ebx); // // Memory Init @@ -75,42 +62,16 @@ void kernel_main(uint32_t eax,uint32_t ebx) // we know that here, the bootloader placed the memory map and // its length // + mem_init(info); //info->mmap_addr,info->mmap_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); - - multiboot_mod *mod=info->mods_addr; - - for(int i=0;i<info->mods_count;i++) - { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mod at 0x%08X-0x%08X : %s", - mod->mod_start,mod->mod_end, mod->string); - - mod++; - } - } - - // - // Video + // Video TODO // + /* log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"VBE Info: 0x%04X (0x%08X 0x%08X)",info->vbe_mode,info->vbe_control_info, info->vbe_mode_info); vbeinfo *vbe=info->vbe_mode_info; //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%c%c",'X',vbe->VbeSignature[0]); - /* uint16_t VbeVersion; // == 0x0300 for VBE 3.0 uint16_t OemStringPtr[2]; // isa vbeFarPtr uint8_t Capabilities[4]; @@ -120,21 +81,11 @@ void kernel_main(uint32_t eax,uint32_t ebx) // - // init output to screen - // - - uint32_t physbase=console_init(info->vbe_mode_info,info->vbe_control_info); - - - // // Activate Virtual Memory (paging) // pdirectory *dir=vmem_init(physbase); - // log buffered messages to console - log_log(); - while(1); // // Setup Interrupts (code segment: 0x08) @@ -142,6 +93,8 @@ void kernel_main(uint32_t eax,uint32_t ebx) int_init(0x08); + while(1); + // // Scan the PCI Bus |
