#define FOOLOS_MODULE_NAME "kernel" #ifdef __linux__ #error "Watchout! this is not Linux but FoolOS. Use a cross-compiler" #endif #include #include "config.h" #include "types.h" #include "lib/logger/log.h" #include "timer.h" #include "mem.h" #include "vmem.h" #include "interrupts.h" #include "console.h" // for built-in shell #include "lib/buffer/ringbuffer.h" #include "task.h" // mp informs us if this if this is the main processor void kernel_main(uint32_t initial_stack, int mp) { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial_stack: 0x%08X",initial_stack); // // Configuring the PIT timer. // timer_init(); // // 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)))); // // Activate Virtual Memory (paging) // 0x8048000 is where user programms start! pdirectory *dir=vmem_init(); // // init output to screen // console_init(); // log buffered messages to console log_log(); // // Setup Interrupts (code segment: 0x08) // int_init(0x08); // // Scan the PCI Bus // // We are interested in the E1000 Network Adapter in particular // Its driver will be hopefully implemented one day ;) TODO // //pci_init(); // // Gather Info about other processors. (APs) // ACPI or MP // // /* smp_processors procdata; if(!acpi_find(&procdata)) if(!mp_find(&procdata)) panic(FOOLOS_MODULE_NAME,"ACPI and MP search failed! I do not want to continue!"); */ // // Start the other Processors (also before paging for some reason!) // //smp_log_procdata(&procdata); //smp_start_aps(&procdata,0x80000); // starts at 0x80000 // but it will be copied over mbr // // Initialize Multitasking // task_init(dir); //; this will never return! }