mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add assertions to Signal::DispatchHandler callers.
This commit is contained in:
parent
c1e5bcba7f
commit
ecfe121a8c
3 changed files with 16 additions and 1 deletions
|
@ -322,6 +322,7 @@ static void RealSwitch(struct interrupt_context* intctx, bool yielded)
|
||||||
{
|
{
|
||||||
// We're already this thread, so run the signal handler.
|
// We're already this thread, so run the signal handler.
|
||||||
Interrupt::Enable();
|
Interrupt::Enable();
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
Signal::DispatchHandler(intctx, NULL);
|
Signal::DispatchHandler(intctx, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -818,6 +818,7 @@ void Thread::HandleSigreturn(struct interrupt_context* intctx)
|
||||||
|
|
||||||
lock.Reset();
|
lock.Reset();
|
||||||
|
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
HandleSignal(intctx);
|
HandleSignal(intctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,11 +826,13 @@ namespace Signal {
|
||||||
|
|
||||||
void DispatchHandler(struct interrupt_context* intctx, void* /*user*/)
|
void DispatchHandler(struct interrupt_context* intctx, void* /*user*/)
|
||||||
{
|
{
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
return CurrentThread()->HandleSignal(intctx);
|
return CurrentThread()->HandleSignal(intctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReturnHandler(struct interrupt_context* intctx, void* /*user*/)
|
void ReturnHandler(struct interrupt_context* intctx, void* /*user*/)
|
||||||
{
|
{
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
return CurrentThread()->HandleSigreturn(intctx);
|
return CurrentThread()->HandleSigreturn(intctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,13 @@ static struct interrupt_handler Signal__DispatchHandler_handler;
|
||||||
static struct interrupt_handler Signal__ReturnHandler_handler;
|
static struct interrupt_handler Signal__ReturnHandler_handler;
|
||||||
static struct interrupt_handler Scheduler__ThreadExitCPU_handler;
|
static struct interrupt_handler Scheduler__ThreadExitCPU_handler;
|
||||||
|
|
||||||
|
// Temporarily to see if this is the source of the assertion failure.
|
||||||
|
void DispatchHandlerWrap(struct interrupt_context* intctx, void* user)
|
||||||
|
{
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
|
return Signal::DispatchHandler(intctx, user);
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterHandler(unsigned int index, struct interrupt_handler* handler)
|
void RegisterHandler(unsigned int index, struct interrupt_handler* handler)
|
||||||
{
|
{
|
||||||
assert(index < NUM_INTERRUPTS);
|
assert(index < NUM_INTERRUPTS);
|
||||||
|
@ -239,7 +246,7 @@ void Init()
|
||||||
|
|
||||||
Scheduler__InterruptYieldCPU_handler.handler = Scheduler::InterruptYieldCPU;
|
Scheduler__InterruptYieldCPU_handler.handler = Scheduler::InterruptYieldCPU;
|
||||||
RegisterHandler(129, &Scheduler__InterruptYieldCPU_handler);
|
RegisterHandler(129, &Scheduler__InterruptYieldCPU_handler);
|
||||||
Signal__DispatchHandler_handler.handler = Signal::DispatchHandler;
|
Signal__DispatchHandler_handler.handler = DispatchHandlerWrap;
|
||||||
RegisterHandler(130, &Signal__DispatchHandler_handler);
|
RegisterHandler(130, &Signal__DispatchHandler_handler);
|
||||||
Signal__ReturnHandler_handler.handler = Signal::ReturnHandler;
|
Signal__ReturnHandler_handler.handler = Signal::ReturnHandler;
|
||||||
RegisterHandler(131, &Signal__ReturnHandler_handler);
|
RegisterHandler(131, &Signal__ReturnHandler_handler);
|
||||||
|
@ -295,7 +302,10 @@ void UserCrashHandler(struct interrupt_context* intctx)
|
||||||
CurrentThread()->DeliverSignalUnlocked(SIGSEGV);
|
CurrentThread()->DeliverSignalUnlocked(SIGSEGV);
|
||||||
kthread_mutex_unlock(&CurrentProcess()->signal_lock);
|
kthread_mutex_unlock(&CurrentProcess()->signal_lock);
|
||||||
if ( handled )
|
if ( handled )
|
||||||
|
{
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
return Signal::DispatchHandler(intctx, NULL);
|
return Signal::DispatchHandler(intctx, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue a diagnostic message to the kernel log concerning the crash.
|
// Issue a diagnostic message to the kernel log concerning the crash.
|
||||||
|
@ -310,6 +320,7 @@ void UserCrashHandler(struct interrupt_context* intctx)
|
||||||
CurrentProcess()->ExitThroughSignal(SIGSEGV);
|
CurrentProcess()->ExitThroughSignal(SIGSEGV);
|
||||||
|
|
||||||
// Deliver signals to this thread so it can exit correctly.
|
// Deliver signals to this thread so it can exit correctly.
|
||||||
|
assert(Interrupt::IsEnabled());
|
||||||
Signal::DispatchHandler(intctx, NULL);
|
Signal::DispatchHandler(intctx, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue