Skip to content

Commit cce0dfa

Browse files
Remove unnecessary TSS assignment in the scheduler
1 parent 6df5e0e commit cce0dfa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kernel/src/task.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,6 @@ uint32_t task_switch(uint32_t esp) {
421421
old_thread->nice = 0;
422422
} else {
423423
// Task still has some time left to run
424-
tss.esp = old_thread->esp;
425-
tss.esp0 = old_thread->kernel_stack;
426-
tss.ss = old_thread->ss;
427-
428424
ODA.ts_flag = true;
429425
timefreeze = false;
430426
return old_thread->esp;
@@ -450,6 +446,14 @@ uint32_t task_switch(uint32_t esp) {
450446
}
451447
}
452448

449+
// No thread to run found
450+
if (old_thread->parent == doNothing_task) {
451+
// doNothing task is already running, no need to switch to it
452+
ODA.ts_flag = true;
453+
timefreeze = false;
454+
return old_thread->esp;
455+
}
456+
453457
current_thread = list_getElement(doNothing_task->threads, 1);
454458

455459
found_new_task:

0 commit comments

Comments
 (0)