diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-10 01:56:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-10 02:49:37 +0200 |
commit | 0a02496f04d3a83ec0eb65635d39dff0b3fd4304 (patch) | |
tree | 8ba98568abfd18706bb6f17e3d96c150a448deb1 /Kernel/Syscalls | |
parent | 364134ad4b3ac20111bad18f39baf8c458f9c5b7 (diff) | |
download | serenity-0a02496f04d3a83ec0eb65635d39dff0b3fd4304.zip |
Kernel/SMP: Change critical sections to not disable interrupts
Leave interrupts enabled so that we can still process IRQs. Critical
sections should only prevent preemption by another thread.
Co-authored-by: Tom <tomut@yahoo.com>
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r-- | Kernel/Syscalls/execve.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index b4b328fe9a..4b55c7f2e7 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -630,7 +630,9 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description // We enter a critical section here because we don't want to get interrupted between do_exec() // and Processor::assume_context() or the next context switch. // If we used an InterruptDisabler that sti()'d on exit, we might timer tick'd too soon in exec(). - Processor::current().enter_critical(prev_flags); + Processor::enter_critical(); + prev_flags = cpu_flags(); + cli(); // NOTE: Be careful to not trigger any page faults below! @@ -927,7 +929,9 @@ KResult Process::exec(String path, Vector<String> arguments, Vector<String> envi VERIFY_NOT_REACHED(); } - Processor::leave_critical(prev_flags); + if (prev_flags & 0x200) + sti(); + Processor::leave_critical(); return KSuccess; } |