summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-10 01:56:21 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-10 02:49:37 +0200
commit0a02496f04d3a83ec0eb65635d39dff0b3fd4304 (patch)
tree8ba98568abfd18706bb6f17e3d96c150a448deb1 /Kernel/Syscalls
parent364134ad4b3ac20111bad18f39baf8c458f9c5b7 (diff)
downloadserenity-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.cpp8
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;
}