diff options
author | Tom <tomut@yahoo.com> | 2020-12-08 21:18:45 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-12 21:28:12 +0100 |
commit | c455fc203055f88908a77f390398b16eccb903ae (patch) | |
tree | e5703bcebf8c320a813fb36dd6360b321e654a32 /Kernel/Arch/i386 | |
parent | 47ede74326d980c0c14abc77025794b105fdcb07 (diff) | |
download | serenity-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.cpp | 14 |
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 (¤t_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 (¤t_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); } |