X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Finterrupt.c;h=d23dbd72b8bbc0032d44af5799def870435c04b3;hb=fe6da9f355488152649de48885b96205043c0f82;hp=132e9b2f2b4dff0f8e91ba38f096b7e01989a177;hpb=8ede17a6b75128950ba83bb5e59e6c1b4d6f2746;p=sbcl.git diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index 132e9b2..d23dbd7 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -642,9 +642,9 @@ build_fake_control_stack_frames(struct thread *th,os_context_t *context) /* Build a fake stack frame or frames */ access_control_frame_pointer(th) = - (lispobj *)(unsigned long) + (lispobj *)(uword_t) (*os_context_register_addr(context, reg_CSP)); - if ((lispobj *)(unsigned long) + if ((lispobj *)(uword_t) (*os_context_register_addr(context, reg_CFP)) == access_control_frame_pointer(th)) { /* There is a small window during call where the callee's @@ -702,19 +702,19 @@ fake_foreign_function_call(os_context_t *context) thread->pseudo_atomic_bits = #else dynamic_space_free_pointer = - (lispobj *)(unsigned long) + (lispobj *)(uword_t) #endif (*os_context_register_addr(context, reg_ALLOC)); /* fprintf(stderr,"dynamic_space_free_pointer: %p\n", */ /* dynamic_space_free_pointer); */ #if defined(LISP_FEATURE_ALPHA) || defined(LISP_FEATURE_MIPS) - if ((long)dynamic_space_free_pointer & 1) { + if ((sword_t)dynamic_space_free_pointer & 1) { lose("dead in fake_foreign_function_call, context = %x\n", context); } #endif /* why doesnt PPC and SPARC do something like this: */ #if defined(LISP_FEATURE_HPPA) - if ((long)dynamic_space_free_pointer & 4) { + if ((sword_t)dynamic_space_free_pointer & 4) { lose("dead in fake_foreign_function_call, context = %x, d_s_f_p = %x\n", context, dynamic_space_free_pointer); } #endif @@ -766,13 +766,13 @@ undo_fake_foreign_function_call(os_context_t *context) #if defined(reg_ALLOC) && !defined(LISP_FEATURE_SB_THREAD) /* Put the dynamic space free pointer back into the context. */ *os_context_register_addr(context, reg_ALLOC) = - (unsigned long) dynamic_space_free_pointer + (uword_t) dynamic_space_free_pointer | (*os_context_register_addr(context, reg_ALLOC) & LOWTAG_MASK); /* - ((unsigned long)(*os_context_register_addr(context, reg_ALLOC)) + ((uword_t)(*os_context_register_addr(context, reg_ALLOC)) & ~LOWTAG_MASK) - | ((unsigned long) dynamic_space_free_pointer & LOWTAG_MASK); + | ((uword_t) dynamic_space_free_pointer & LOWTAG_MASK); */ #endif #if defined(reg_ALLOC) && defined(LISP_FEATURE_SB_THREAD) @@ -780,7 +780,7 @@ undo_fake_foreign_function_call(os_context_t *context) * into the context (p-a-bits for p-a, and dynamic space free * pointer for ROOM). */ *os_context_register_addr(context, reg_ALLOC) = - (unsigned long) dynamic_space_free_pointer + (uword_t) dynamic_space_free_pointer | (thread->pseudo_atomic_bits & LOWTAG_MASK); /* And clear them so we don't get bit later by call-in/call-out * not updating them. */ @@ -916,39 +916,12 @@ interrupt_handle_pending(os_context_t *context) /* handles the STOP_FOR_GC_PENDING case, plus THRUPTIONS */ if (SymbolValue(STOP_FOR_GC_PENDING,thread) != NIL # ifdef LISP_FEATURE_SB_THRUPTION - || SymbolValue(THRUPTION_PENDING,thread) != NIL + || (SymbolValue(THRUPTION_PENDING,thread) != NIL + && SymbolValue(INTERRUPTS_ENABLED, thread) != NIL) # endif ) - { /* We ought to take this chance to do a pitstop now. */ - - /* Now, it goes without saying that the context sigmask - * tweaking around this call is not pretty. However, it - * currently seems to be "needed" for the following - * situation. (So let's find a better solution and remove - * this comment afterwards.) - * - * Suppose we are in a signal handler (let's say SIGALRM). - * At the end of a WITHOUT-INTERRUPTS, the lisp code notices - * that a thruption is pending, and says to itself "let's - * receive pending interrupts then". We trust that the - * caller is happy to run those sorts of things now, - * including thruptions, otherwise it wouldn't have called - * us. But that's the problem: Even though we can guess the - * caller's intention, may_thrupt() would see that signals - * are blocked in the signal context (because that context - * itself points to a signal handler). So we cheat and - * pretend that signals weren't blocked. - * --DFL */ -#ifndef LISP_FEATURE_WIN32 - sigset_t old, *ctxset = os_context_sigmask_addr(context); - unblock_signals(&deferrable_sigset, ctxset, &old); -#endif thread_in_lisp_raised(context); -#ifndef LISP_FEATURE_WIN32 - sigcopyset(&old, ctxset); -#endif - } #elif defined(LISP_FEATURE_SB_THREAD) if (SymbolValue(STOP_FOR_GC_PENDING,thread) != NIL) { /* STOP_FOR_GC_PENDING and GC_PENDING are cleared by @@ -1016,7 +989,7 @@ interrupt_handle_pending(os_context_t *context) * an interrupt arrived during GC (POST-GC, really) it was * handled. */ if (original_pending_handler != data->pending_handler) - lose("pending handler changed in gc: %x -> %d.", + lose("pending handler changed in gc: %x -> %x.", original_pending_handler, data->pending_handler); } @@ -1889,7 +1862,7 @@ undoably_install_low_level_interrupt_handler (int signal, #endif /* This is called from Lisp. */ -unsigned long +uword_t install_handler(int signal, void handler(int, siginfo_t*, os_context_t*)) { #ifndef LISP_FEATURE_WIN32 @@ -1928,7 +1901,7 @@ install_handler(int signal, void handler(int, siginfo_t*, os_context_t*)) FSHOW((stderr, "/leaving POSIX install_handler(%d, ..)\n", signal)); - return (unsigned long)oldhandler.lisp; + return (uword_t)oldhandler.lisp; #else /* Probably-wrong Win32 hack */ return 0; @@ -2065,7 +2038,7 @@ handle_trap(os_context_t *context, int trap) arch_handle_single_step_trap(context, trap); break; #endif -#ifdef LISP_FEATURE_SB_SAFEPOINT +#ifdef trap_GlobalSafepoint case trap_GlobalSafepoint: fake_foreign_function_call(context); thread_in_lisp_raised(context);