Functions | |
void | do_idle () |
Simply do nothing... | |
void | kpager () |
This special kernel thread provides to free the memory space and resources owned by the zombie tasks. | |
Variables | |
task_t * | curr_task = NULL |
A pointer to the current running task structure. Declared in task.c. | |
task_t * | idle_task = NULL |
IDLE task structure. Initialized in init_multitasking(). | |
task_t * | kpagd = NULL |
KPager daemon. |
|
Simply do nothing... This is the default thread to execute when the system has to do nothing. Definition at line 73 of file task.c.
|
|
This special kernel thread provides to free the memory space and resources owned by the zombie tasks.
Definition at line 85 of file task.c.
00086 { 00087 task_t *t; 00088 dword addr, PDBR; 00089 00090 while( TRUE ) 00091 { 00092 sched_enter_critical_region(); 00093 00094 // Look into the zombie queue. 00095 t = pick_queue(&zombie_queue); 00096 if ( t==NULL ) 00097 { 00098 // No task in the zombie queue => IDLE! // 00099 sched_leave_critical_region(); 00100 00101 sleep_task( curr_task ); 00102 enable(); 00103 idle(); 00104 continue; 00105 } 00106 00107 // Zombie task found. 00108 if ( t->type==KTHREAD_T ) 00109 { 00110 // Free the pl0-stack // 00111 if( t->pl0_stack!=NULL ) 00112 kfree((void *)((dword)(t->pl0_stack)+sizeof(uint32_t)-STACK_SIZE)); 00113 00114 // Destroy the TSS // 00115 remove_GDT_entry(t->tss_sel); 00116 00117 // The task is dead // 00118 rem_queue(&zombie_queue, t); 00119 00120 // Free the task structure // 00121 kfree((void *)t); 00122 } 00123 else 00124 { 00125 PDBR = t->tss.cr3; 00126 00127 // Temporary switch to the task address space // 00128 __asm__ __volatile__ ("movl %0, %%cr3" : : "r"(t->tss.cr3)); 00129 00130 // Free the user address space // 00131 for(addr=0; addr<K_VIR_START; addr+=PAGE_SIZE) 00132 { 00133 if (*ADDR_TO_PDE(addr) != NULL) 00134 delete_page(addr); 00135 else 00136 addr=PAGE_DIR_ALIGN_UP(addr); 00137 } 00138 00139 // Restore the kpager address space // 00140 __asm__ __volatile__ ("movl %0, %%cr3" : : "r"(curr_task->tss.cr3)); 00141 00142 // Free the pl0-stack // 00143 kfree((void *)((dword)(t->pl0_stack)+sizeof(uint32_t)-STACK_SIZE)); 00144 00145 // Destroy the TSS // 00146 remove_GDT_entry(t->tss_sel); 00147 00148 // The task is dead // 00149 rem_queue(&zombie_queue, t); 00150 00151 // Free the task structure // 00152 kfree((void *)t); 00153 00154 // Free the task page directory // 00155 push_frame(PDBR/PAGE_SIZE); 00156 } 00157 sched_leave_critical_region(); 00158 } 00159 } |
|
A pointer to the current running task structure. Declared in task.c.
|
|
IDLE task structure. Initialized in init_multitasking().
|
|
KPager daemon.
|