Skip to content
Snippets Groups Projects
Commit f851310c authored by dtc's avatar dtc
Browse files

Delay the re-enabling of interrupts in interrupt_internal_error and

interrupt_handle_now until after the context SAP object is allocated
so that this allocation is not interrupted.

May still be some lossage on the non-x86 ports as the GC will not see
the object on the C stack until it is moved onto the control stack by
the call into lisp.
parent 27743a2b
No related branches found
No related tags found
No related merge requests found
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.10 1997/11/19 02:41:54 dtc Exp $ */ /* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.11 1997/11/21 12:20:34 dtc Exp $ */
/* Interrupt handing magic. */ /* Interrupt handing magic. */
...@@ -164,10 +164,16 @@ void ...@@ -164,10 +164,16 @@ void
interrupt_internal_error(HANDLER_ARGS, interrupt_internal_error(HANDLER_ARGS,
boolean continuable) boolean continuable)
{ {
lispobj context_sap;
#ifdef __linux__ #ifdef __linux__
GET_CONTEXT GET_CONTEXT
#endif #endif
/* Allocate the SAP object while the interrupts are still
disabled. */
if (internal_errors_enabled)
context_sap = alloc_sap(context),
#ifdef POSIX_SIGS #ifdef POSIX_SIGS
sigprocmask(SIG_SETMASK,&context->uc_sigmask, 0); sigprocmask(SIG_SETMASK,&context->uc_sigmask, 0);
#else #else
...@@ -175,7 +181,7 @@ interrupt_internal_error(HANDLER_ARGS, ...@@ -175,7 +181,7 @@ interrupt_internal_error(HANDLER_ARGS,
#endif #endif
fake_foreign_function_call(context); fake_foreign_function_call(context);
if (internal_errors_enabled) if (internal_errors_enabled)
funcall2(SymbolFunction(INTERNAL_ERROR), alloc_sap(context), funcall2(SymbolFunction(INTERNAL_ERROR), context_sap,
continuable ? T : NIL); continuable ? T : NIL);
else else
internal_error(context); internal_error(context);
...@@ -256,32 +262,44 @@ interrupt_handle_now(HANDLER_ARGS) ...@@ -256,32 +262,44 @@ interrupt_handle_now(HANDLER_ARGS)
if (were_in_lisp) if (were_in_lisp)
fake_foreign_function_call(context); fake_foreign_function_call(context);
/* Allow signals again. */
#ifdef POSIX_SIGS
sigprocmask(SIG_SETMASK, &context->uc_sigmask, 0);
#else
sigsetmask(context->sc_mask);
#endif
if (handler.c==SIG_DFL) if (handler.c==SIG_DFL)
/* This can happen if someone tries to ignore or default on of the */ /* This can happen if someone tries to ignore or default on of the */
/* signals we need for runtime support, and the runtime support */ /* signals we need for runtime support, and the runtime support */
/* decides to pass on it. */ /* decides to pass on it. */
lose("interrupt_handle_now: No handler for signal %d?\n", signal); lose("interrupt_handle_now: No handler for signal %d?\n", signal);
else if (LowtagOf(handler.lisp) == type_FunctionPointer) else if (LowtagOf(handler.lisp) == type_FunctionPointer) {
/* Allocate the SAP object while the interrupts are still
disabled. */
lispobj context_sap = alloc_sap(context);
/* Allow signals again. */
#ifdef POSIX_SIGS
sigprocmask(SIG_SETMASK, &context->uc_sigmask, 0);
#else
sigsetmask(context->sc_mask);
#endif
#if 1 #if 1
funcall3(handler.lisp, make_fixnum(signal), make_fixnum(CODE(code)), funcall3(handler.lisp, make_fixnum(signal), make_fixnum(CODE(code)),
alloc_sap(context)); context_sap);
#else #else
funcall3(handler.lisp, make_fixnum(signal), alloc_sap(code), funcall3(handler.lisp, make_fixnum(signal), alloc_sap(code),
alloc_sap(context)); alloc_sap(context));
#endif #endif
else } else {
/* Allow signals again. */
#ifdef POSIX_SIGS
sigprocmask(SIG_SETMASK, &context->uc_sigmask, 0);
#else
sigsetmask(context->sc_mask);
#endif
#ifdef __linux__ #ifdef __linux__
(*handler.c)(signal, contextstruct); (*handler.c)(signal, contextstruct);
#else #else
(*handler.c)(signal, code, context); (*handler.c)(signal, code, context);
#endif #endif
}
if (were_in_lisp) if (were_in_lisp)
undo_fake_foreign_function_call(context); undo_fake_foreign_function_call(context);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment