+
+#else
+
+static void
+sigsegv_handler(int signal, siginfo_t *info, void* void_context)
+{
+ os_context_t *context = (os_context_t*)void_context;
+ os_vm_address_t addr;
+
+#ifdef __i386__
+ interrupt_handle_now(signal,contextstruct);
+#else
+ char *control_stack_top = (char*)CONTROL_STACK_START + CONTROL_STACK_SIZE;
+
+ addr = arch_get_bad_addr(signal,info,context);
+
+ if(addr != NULL &&
+ *os_context_register_addr(context,reg_ALLOC) & (1L<<63)){
+ /* This is the end of a pseudo-atomic section during which
+ * a signal was received. We must deal with the pending interrupt
+ * (see also interrupt.c, ../code/interrupt.lisp)
+ */
+
+ /* (how we got here: when interrupting, we set bit 63 in
+ * reg_Alloc. At the end of the atomic section we tried to
+ * write to reg_Alloc, got a SIGSEGV (there's nothing mapped
+ * there) so ended up here
+ */
+ *os_context_register_addr(context,reg_ALLOC) -= (1L<<63);
+ interrupt_handle_pending(context);
+ } else if (addr > control_stack_top && addr < BINDING_STACK_START) {
+ fprintf(stderr,
+ "Possible stack overflow at 0x%016lX:\n"
+ "control_stack_top=%lx, BINDING_STACK_START=%lx\n",
+ addr,
+ control_stack_top,
+ BINDING_STACK_START);
+ /* Try to fix control frame pointer. */
+ while ( ! (CONTROL_STACK_START <= *current_control_frame_pointer &&
+ *current_control_frame_pointer <= control_stack_top))
+ ((char*)current_control_frame_pointer) -= sizeof(lispobj);
+ monitor_or_something();
+ } else if (!interrupt_maybe_gc(signal, info, context)) {
+ interrupt_handle_now(signal, info, context);
+ }
+#endif
+}
+#endif
+