From: Matthias Kruk Date: Tue, 24 Sep 2019 08:38:26 +0000 (+0900) Subject: Disable interrupts while we don't have a valid stack in task_switch() X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=03e73a731288a1d463ae0ff9ed3756b54c0bafa2;p=corax Disable interrupts while we don't have a valid stack in task_switch() --- diff --git a/kernel/arch/task.S b/kernel/arch/task.S index faed92a..9f6a190 100644 --- a/kernel/arch/task.S +++ b/kernel/arch/task.S @@ -158,7 +158,7 @@ task_switch: movl 4(%esp), %edi cmpl %esi, %edi - jnz 2f + jne 2f /* FIXME: Return -EALREADY instead */ movl $-1, %eax ret @@ -170,6 +170,12 @@ task_switch: cmpl %ecx, %edx jz 2f + /* + * Clear interrupts, since we won't have a valid stack until the + * iret instruction in _int_restore is executed + */ + cli + /* switch page directory */ movl %ecx, %cr3