diff --git a/kernel/arch/x86_64/irq.S b/kernel/arch/x86_64/irq.S index 16e937a..e84c2bb 100644 --- a/kernel/arch/x86_64/irq.S +++ b/kernel/arch/x86_64/irq.S @@ -163,6 +163,11 @@ arch_save_context: .global arch_restore_context .type arch_restore_context, @function arch_restore_context: + mov %gs:0x10,%rax + cmp %gs:0x0,%rax + je 1f + lock andl $0xFFFFfff7,0x14(%rax) +1: movq 0(%rdi), %rsp movq 8(%rdi), %rbp movl 24(%rdi), %eax diff --git a/kernel/sys/process.c b/kernel/sys/process.c index 787744c..5e5ed6e 100644 --- a/kernel/sys/process.c +++ b/kernel/sys/process.c @@ -114,11 +114,8 @@ void switch_next(void) { /* Mark the process as running and started. */ __sync_or_and_fetch(&this_core->current_process->flags, PROC_FLAG_STARTED); - - if (this_core->previous_process != this_core->current_process) - __sync_and_and_fetch(&this_core->previous_process->flags, ~(PROC_FLAG_RUNNING)); - /* Restore the execution context of this process's kernel thread. */ + /* Jump to next */ arch_restore_context(&this_core->current_process->thread); __builtin_unreachable(); }