#define FOOLOS_MODULE_NAME "kernel" #include "config.h" #include "lib/logger/log.h" #include "lib/int/stdint.h" #include "lib/bool/bool.h" #include "smp.h" #include "time.h" #ifdef FOOLOS_COMPILE_FLOPPY #include "floppy.h" #endif // some multiprocessor shit that should move away TODO uint32_t c1,c2,c3; volatile uint8_t proc; uint32_t cpu_counter[SMP_MAX_PROC]; volatile int16_t mouse_x; volatile int16_t mouse_y; void kernel_ap() { proc++; uint8_t p=proc; while(1) { cpu_counter[p]++; lock_spin(0); if(cpu_counter[p]%1000000==0)log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"cpu[%d] %d",p,cpu_counter[p]); lock_release(0); } } // // KERNEL MAIN // this is the very heart of our operating system! // void kernel_main(uint32_t initial_stack, int mp) { /// TODO /////// SYMMETRIC MULTIPROCESSING, APS get caought here, move it away /// // catch the APs (Application Processors) if(mp==1) { uint32_t ebp=pmmngr_alloc_block()+4095; asm volatile("mov %0, %%ebp"::"r"(ebp)); asm volatile("mov %ebp, %esp"); asm volatile("jmp kernel_ap"); } proc=c1=c2=c3=0; for(int i=0;i