From abe8810d4703ef49d7997819d9919bb2feb8666b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 30 Jul 2023 14:17:07 +0300 Subject: [PATCH] Kernel: raise() now force sends signal --- kernel/kernel/Process.cpp | 10 +--------- kernel/kernel/Thread.cpp | 6 +++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index a17f037d19..0a0856a6a7 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -867,15 +867,7 @@ namespace Kernel ASSERT(this == &Process::current()); CriticalScope _; - - // FIXME: support raise with signal blocked - Thread& current = Thread::current(); - if (current.add_signal(signal)) - { - current.handle_signal(signal); - return 0; - } - + Thread::current().handle_signal(-signal); ASSERT_NOT_REACHED(); } diff --git a/kernel/kernel/Thread.cpp b/kernel/kernel/Thread.cpp index 5a2307b46f..51804c3f33 100644 --- a/kernel/kernel/Thread.cpp +++ b/kernel/kernel/Thread.cpp @@ -253,13 +253,17 @@ namespace Kernel } ASSERT(signal <= _SIGMAX); } - else + else if (signal > 0) { uint64_t full_pending_mask = m_signal_pending_mask | process().m_signal_pending_mask; uint64_t mask = 1ull << signal; ASSERT(full_pending_mask & mask); ASSERT(!(m_signal_block_mask & mask)); } + else + { + signal = -signal; + } uintptr_t& return_rsp = this->return_rsp(); uintptr_t& return_rip = this->return_rip();