int kernel_idle_task() { int task, cache; #if CONFIG_SWAP if(!fork()) { set_as_kernel_task("kpager"); __KT_pager(); } #endif set_as_kernel_task("kidle"); /* First stage is to wait until we can clear various allocated things * that we wont need anymore */ while(!__KT_clear_args()) { schedule(); set_int(1); } set_int(0); printk(1, "[kernel]: remapping lower memory with protection flags...\n"); addr_t addr = 0; while(addr != TOP_LOWER_KERNEL) { /* set it to write. We don't actually have to do this, because * ring0 code may always access memory. As long as the PAGE_USER * flag isn't set... */ if(!(SIGNAL_INJECT >= addr && SIGNAL_INJECT < (addr + PAGE_SIZE_LOWER_KERNEL))) vm_setattrib(addr, PAGE_PRESENT | PAGE_WRITE); addr += PAGE_SIZE_LOWER_KERNEL; } set_int(1); /* Now enter the main idle loop, waiting to do periodic cleanup */ printk(0, "[idle]: entering background loop\n"); for(;;) { task=__KT_try_releasing_tasks(); __KT_try_handle_stage2_interrupts(); schedule(); set_int(1); } }
int module_install() { printk(1, "[sync]: Kernel service for autosyncronization beginning in 3 seconds\n"); int x = mod_fork(&pid); if(!x) { sys_setsid(); exe=set_as_kernel_task("ksync"); delay(3000); printk(1, "[sync]: Autosync enabled\n"); for(;;) { delay(1000); //kernel_cache_sync_slow(0); } } return 0; }