X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Finterrupt.h;h=ec7899967381c5993e45df411077b598c7d25831;hb=be7adb92bf0012ab07adac2943e73772dfad7911;hp=642160e9a96b13cf3038c2396280bb247ae9a3b5;hpb=1f23c9f7828d8aebeda92c8c1126114e10461ffa;p=sbcl.git diff --git a/src/runtime/interrupt.h b/src/runtime/interrupt.h index 642160e..ec78999 100644 --- a/src/runtime/interrupt.h +++ b/src/runtime/interrupt.h @@ -14,11 +14,28 @@ #include +/* + * This is a workaround for some slightly silly Linux/GNU Libc + * behaviour: glibc defines sigset_t to support 1024 signals, which is + * more than the kernel. This is usually not a problem, but becomes + * one when we want to save a signal mask from a ucontext, and restore + * it later into another ucontext: the ucontext is allocated on the + * stack by the kernel, so copying a libc-sized sigset_t into it will + * overflow and cause other data on the stack to be corrupted */ +/* FIXME: do not rely on NSIG being a multiple of 8 */ +#define REAL_SIGSET_SIZE_BYTES ((NSIG/8)) + +static inline void +sigcopyset(sigset_t *new, sigset_t *old) +{ + memcpy(new, old, REAL_SIGSET_SIZE_BYTES); +} + /* maximum signal nesting depth * * Note: In CMU CL, this was 4096, but there was no explanation given, * and it's hard to see why we'd need that many nested interrupts, so - * I've scaled it back (to 256) to see what happens. -- WHN 20000730 + * I've scaled it back (to 256) to see what happens. -- WHN 20000730 * Nothing happened, so let's creep it back a bit further -- dan 20030411 */ #define MAX_INTERRUPTS 32 @@ -28,14 +45,13 @@ union interrupt_handler { void (*c)(int, siginfo_t*, void*); }; -struct interrupt_data { - void (*interrupt_low_level_handlers[NSIG]) (int, siginfo_t*, void*) ; - union interrupt_handler interrupt_handlers[NSIG]; +extern union interrupt_handler interrupt_handlers[NSIG]; - /* signal information for pending signal. pending_signal=0 when there +struct interrupt_data { + /* signal information for pending signal. pending_signal=0 when there * is no pending signal. */ void (*pending_handler) (int, siginfo_t*, void*) ; - int pending_signal ; + int pending_signal; siginfo_t pending_info; sigset_t pending_mask; }; @@ -48,27 +64,39 @@ extern void arrange_return_to_lisp_function(os_context_t *, lispobj); extern void interrupt_handle_now(int, siginfo_t*, void*); extern void interrupt_handle_pending(os_context_t*); extern void interrupt_internal_error(int, siginfo_t*, os_context_t*, - boolean continuable); -extern boolean handle_guard_page_triggered(os_context_t *,void *); + boolean continuable); +extern boolean handle_guard_page_triggered(os_context_t *,os_vm_address_t); extern boolean interrupt_maybe_gc(int, siginfo_t*, void*); +extern boolean interrupt_maybe_gc_int(int, siginfo_t *, void *); +extern boolean maybe_defer_handler(void *handler, struct interrupt_data *data, + int signal, siginfo_t *info, + os_context_t *context); +#if defined LISP_FEATURE_GENCGC +/* assembly language stub that executes trap_PendingInterrupt */ +extern void do_pending_interrupt(void); +#endif + #ifdef LISP_FEATURE_SB_THREAD extern void interrupt_thread_handler(int, siginfo_t*, void*); extern void sig_stop_for_gc_handler(int, siginfo_t*, void*); -extern void thread_exit_handler(int, siginfo_t*, void*); #endif extern void undoably_install_low_level_interrupt_handler (int signal, - void - handler(int, - siginfo_t*, - void*)); + void + handler(int, + siginfo_t*, + void*)); extern unsigned long install_handler(int signal, - void handler(int, siginfo_t*, void*)); + void handler(int, siginfo_t*, void*)); extern union interrupt_handler interrupt_handlers[NSIG]; +/* Set all deferrable signals into *s. */ +void sigaddset_deferrable(sigset_t *s); /* Set all blockable signals into *s. */ void sigaddset_blockable(sigset_t *s); +extern void block_blockable_signals(); + /* The void* casting here avoids having to mess with the various types * of function argument lists possible for signal handlers: * SA_SIGACTION handlers have one signature, and the default old-style @@ -77,4 +105,3 @@ void sigaddset_blockable(sigset_t *s); #define ARE_SAME_HANDLER(x, y) ((void*)(x) == (void*)(y)) #endif -