sched: simplify entry-exit path between processes
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
308ba36aab
commit
11bedfe3a8
7 changed files with 24 additions and 20 deletions
|
|
@ -64,20 +64,15 @@ static struct thread *dequeue_thread()
|
|||
|
||||
void schedule()
|
||||
{
|
||||
struct thread *cur = get_cur_thread();
|
||||
struct thread *next = dequeue_thread();
|
||||
if (!next)
|
||||
return;
|
||||
|
||||
struct thread *prev = cur;
|
||||
if (cur)
|
||||
sched_add_thread(cur);
|
||||
|
||||
struct cpu_local *tls = tls_get();
|
||||
tls->cur_thread = next;
|
||||
tls->kernel_rsp = next->kstack_top;
|
||||
tls->tss.rsp0 = next->kstack_top;
|
||||
pgd_load(next->proc->pgd);
|
||||
|
||||
switch_to(prev, next);
|
||||
sched_restore_state(next);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue