summaryrefslogtreecommitdiff
path: root/Kernel/Arch/i386
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-12-08 21:18:45 -0700
committerAndreas Kling <kling@serenityos.org>2020-12-12 21:28:12 +0100
commitc455fc203055f88908a77f390398b16eccb903ae (patch)
treee5703bcebf8c320a813fb36dd6360b321e654a32 /Kernel/Arch/i386
parent47ede74326d980c0c14abc77025794b105fdcb07 (diff)
downloadserenity-c455fc203055f88908a77f390398b16eccb903ae.zip
Kernel: Change wait blocking to Process-only blocking
This prevents zombies created by multi-threaded applications and brings our model back to closer to what other OSs do. This also means that SIGSTOP needs to halt all threads, and SIGCONT needs to resume those threads.
Diffstat (limited to 'Kernel/Arch/i386')
-rw-r--r--Kernel/Arch/i386/CPU.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp
index 8a372caff2..0df5f639b7 100644
--- a/Kernel/Arch/i386/CPU.cpp
+++ b/Kernel/Arch/i386/CPU.cpp
@@ -484,7 +484,8 @@ void debug_handler(TrapFrame* trap)
clac();
auto& regs = *trap->regs;
auto current_thread = Thread::current();
- if (&current_thread->process() == nullptr || (regs.cs & 3) == 0) {
+ auto& process = current_thread->process();
+ if ((regs.cs & 3) == 0) {
klog() << "Debug Exception in Ring0";
Processor::halt();
return;
@@ -494,8 +495,8 @@ void debug_handler(TrapFrame* trap)
if (!is_reason_singlestep)
return;
- if (current_thread->tracer()) {
- current_thread->tracer()->set_regs(regs);
+ if (auto tracer = process.tracer()) {
+ tracer->set_regs(regs);
}
current_thread->send_urgent_signal_to_self(SIGTRAP);
}
@@ -506,13 +507,14 @@ void breakpoint_handler(TrapFrame* trap)
clac();
auto& regs = *trap->regs;
auto current_thread = Thread::current();
- if (&current_thread->process() == nullptr || (regs.cs & 3) == 0) {
+ auto& process = current_thread->process();
+ if ((regs.cs & 3) == 0) {
klog() << "Breakpoint Trap in Ring0";
Processor::halt();
return;
}
- if (current_thread->tracer()) {
- current_thread->tracer()->set_regs(regs);
+ if (auto tracer = process.tracer()) {
+ tracer->set_regs(regs);
}
current_thread->send_urgent_signal_to_self(SIGTRAP);
}