]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix: save/restore EFLAGS in context_switch instead of forcing sti after schedule()
authorTulio A M Mendes <[email protected]>
Thu, 12 Feb 2026 06:21:08 +0000 (03:21 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 02:44:55 +0000 (23:44 -0300)
commit9dadf00e8747fa97b3df43f5de6c8e12224b96bc
treedf3f6736334303a06bf3c17e0634cc87a21d01b8
parentd859002aef2bc93eae728f3d484a50e6154fe103
fix: save/restore EFLAGS in context_switch instead of forcing sti after schedule()

context_switch now uses pushf/popf to properly save and restore the
EFLAGS register (including the IF bit) across context switches.
This replaces the unconditional hal_cpu_enable_interrupts() call
after context_switch in schedule(), which broke the interrupt-state
semantics for callers that needed atomicity.

All process creation functions (fork, clone, kernel thread) now push
EFLAGS=0x202 (IF=1) onto the initial stack so new processes start
with interrupts enabled via popf in context_switch.
src/arch/x86/process.S
src/kernel/scheduler.c