forked from xamidev/pepperOS
Scheduler returns to IDLE when.. idle.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
extern struct process_t* processes_list;
|
||||
extern struct process_t* current_process;
|
||||
extern struct process_t* idle_proc;
|
||||
|
||||
void scheduler_init()
|
||||
{
|
||||
@@ -28,9 +29,8 @@ struct cpu_status_t* scheduler_schedule(struct cpu_status_t* context)
|
||||
|
||||
if (current_process == NULL)
|
||||
{
|
||||
// Wtf happened
|
||||
current_process = processes_list;
|
||||
//panic(NULL, "Scheduler called without current process");
|
||||
// If no more processes, then set IDLE as the current process, that's it.
|
||||
current_process = idle_proc;
|
||||
}
|
||||
|
||||
current_process->context = context;
|
||||
@@ -49,15 +49,15 @@ struct cpu_status_t* scheduler_schedule(struct cpu_status_t* context)
|
||||
if (current_process != NULL && current_process->status == DEAD)
|
||||
{
|
||||
process_delete(&prev_process, current_process);
|
||||
current_process = NULL;
|
||||
return idle_proc->context;
|
||||
} else
|
||||
{
|
||||
current_process->status = RUNNING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Current_process gets wrong context?? (iret_rip points to other stuff than process function; like putpixel() for example)
|
||||
DEBUG("current_process={pid=%u, name='%s', root_page_table[virt]=%p}", current_process->pid, current_process->name, current_process->root_page_table);
|
||||
|
||||
load_cr3(VIRT_TO_PHYS((uint64_t)current_process->root_page_table));
|
||||
|
||||
Reference in New Issue
Block a user