Functions | |
void | init_multitasking () |
Initialize the multitasking management. |
|
Initialize the multitasking management.
Definition at line 1185 of file task.c.
01186 { 01187 // Initialize pid counter. 01188 atomic_set(&last_pid, 0); 01189 01190 // Initialize scheduler critical region flag. 01191 INIT_MUTEX( &sched_enabled ); 01192 01193 // Create the "init" task. 01194 curr_task = create_process(NULL, NULL, 0, "init", KERNEL_PRIVILEGE); 01195 // Set the console. 01196 curr_task->console=1; 01197 // Set the type. 01198 curr_task->type = KTHREAD_T; 01199 01200 // Load task register. 01201 __asm__ __volatile__ ("ltr %%ax" : : "a" (curr_task->tss_sel)); 01202 __asm__ __volatile__ ("" : : : "ax"); 01203 01204 // Load virtual space. 01205 __asm__ __volatile__ ("movl %0, %%cr3" : : "r"(curr_task->tss.cr3)); 01206 01207 // Initialize the IDLE task. 01208 // The IDLE task is a special task, 01209 // it's always ready but never present in the ready queue. 01210 idle_task = create_kthread(&do_idle, "idle"); 01211 idle_task->console=0; 01212 rem_queue(&ready_queue, idle_task); 01213 01214 // Initialize KPager thread 01215 kpagd = create_kthread(&kpager, "kpagerd"); 01216 kpagd->console = 0; 01217 01218 // Install the dispatcher. 01219 install_irq_handler( TIMER_IRQ, (void *)&dispatcher ); 01220 } |