1 #include "thread.h" 2 #include <limits.h> 3 #include <sys/cpu.h> 4 default_idle_thread_hook(void)5static void default_idle_thread_hook(void) 6 { 7 } 8 9 void (*idle_thread_hook)(void) = default_idle_thread_hook; 10 idle_thread_func(void * dummy)11static void idle_thread_func(void *dummy) 12 { 13 (void)dummy; 14 15 for (;;) { 16 cli(); 17 idle_thread_hook(); 18 __schedule(); 19 asm volatile("sti ; hlt" : : : "memory"); 20 } 21 } 22 start_idle_thread(void)23void start_idle_thread(void) 24 { 25 start_thread("idle", 4096, IDLE_THREAD_PRIORITY, idle_thread_func, NULL); 26 } 27 28