From: Matt Birkholz Date: Tue, 25 Nov 2014 15:46:15 +0000 (-0700) Subject: smp: unshare: UX trap_state and current_interruptable_extent. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6af369546f92247ad0579b5bf77c45821bceb150;p=mit-scheme.git smp: unshare: UX trap_state and current_interruptable_extent. Split the thread-local parts out of UX_initialize_trap_recovery into UX_initialize_trap_state, and those of OS_initialize into OS_initialize_processor. --- diff --git a/src/microcode/intext.c b/src/microcode/intext.c index 2ba8141d7..fcbc34a22 100644 --- a/src/microcode/intext.c +++ b/src/microcode/intext.c @@ -28,7 +28,7 @@ USA. extern void preserve_signal_mask (void); -struct interruptable_extent * current_interruptable_extent; +__thread struct interruptable_extent * current_interruptable_extent; void initialize_interruptable_extent (void) diff --git a/src/microcode/intext.h b/src/microcode/intext.h index c10323a9a..04e73f36c 100644 --- a/src/microcode/intext.h +++ b/src/microcode/intext.h @@ -36,7 +36,7 @@ struct interruptable_extent int interrupted; }; -extern struct interruptable_extent * current_interruptable_extent; +extern __thread struct interruptable_extent * current_interruptable_extent; extern void initialize_interruptable_extent (void); extern void reset_interruptable_extent (void); extern struct interruptable_extent * enter_interruptable_extent (void); diff --git a/src/microcode/ostop.h b/src/microcode/ostop.h index a57d46b65..be00c6c18 100644 --- a/src/microcode/ostop.h +++ b/src/microcode/ostop.h @@ -31,6 +31,9 @@ USA. extern int OS_under_emacs_p (void); extern void OS_initialize (void); +#ifdef ENABLE_SMP +extern void OS_initialize_processor (void); +#endif extern void OS_reset (void); extern void OS_quit (int code, int abnormal_p); extern void OS_restartable_exit (void); diff --git a/src/microcode/prossmp.c b/src/microcode/prossmp.c index 5cf831fd9..fe5ee1ee0 100644 --- a/src/microcode/prossmp.c +++ b/src/microcode/prossmp.c @@ -31,6 +31,7 @@ USA. #ifdef ENABLE_SMP #include "history.h" +#include "ostop.h" #include "osio.h" #include "ossmp.h" #include "osproc.h" /* for OS_process_any_status_change */ @@ -218,6 +219,7 @@ work (void *p) assert (self != processors); initialize_processor_early (); reset_processor_allocator (self); + OS_initialize_processor (); RESET_HISTORY (); /* expr: (SMP-PAUSE) */ diff --git a/src/microcode/uxtop.c b/src/microcode/uxtop.c index be358d23a..e073582cb 100644 --- a/src/microcode/uxtop.c +++ b/src/microcode/uxtop.c @@ -48,6 +48,7 @@ extern void UX_initialize_environment (void); extern void UX_initialize_processes (void); extern void UX_initialize_signals (void); extern void UX_initialize_terminals (void); +extern void UX_initialize_trap_state (void); extern void UX_initialize_trap_recovery (void); extern void UX_initialize_tty (void); extern void UX_initialize_userio (void); @@ -71,9 +72,15 @@ OS_under_emacs_p (void) } void -OS_initialize (void) +OS_initialize_processor (void) { initialize_interruptable_extent (); + UX_initialize_trap_state (); +} + +void +OS_initialize (void) +{ { interactive = (option_force_interactive @@ -96,6 +103,7 @@ OS_initialize (void) UX_initialize_processes (); UX_initialize_trap_recovery (); UX_initialize_directory_reader (); + OS_initialize_processor (); OS_Name = SYSTEM_NAME; OS_Variant = SYSTEM_VARIANT; #if defined(_SUNOS) || defined(_SUNOS3) || defined(_SUNOS4) diff --git a/src/microcode/uxtrap.c b/src/microcode/uxtrap.c index ceef616e7..22a5e05dd 100644 --- a/src/microcode/uxtrap.c +++ b/src/microcode/uxtrap.c @@ -96,12 +96,12 @@ enum pc_location # define SPECIAL_SIGNAL_CODE_NAMES() #endif -static enum trap_state trap_state; -static enum trap_state user_trap_state; -static enum trap_state saved_trap_state; -static int saved_signo; -static SIGINFO_T saved_info; -static SIGCONTEXT_T * saved_scp; +static __thread enum trap_state trap_state; +static __thread enum trap_state user_trap_state; +static __thread enum trap_state saved_trap_state; +static __thread int saved_signo; +static __thread SIGINFO_T saved_info; +static __thread SIGCONTEXT_T * saved_scp; static void continue_from_trap (int, SIGINFO_T, SIGCONTEXT_T *); @@ -136,10 +136,15 @@ static void trap_dump_core (void); static void trap_recover (void); void -UX_initialize_trap_recovery (void) +UX_initialize_trap_state (void) { trap_state = trap_state_recover; user_trap_state = trap_state_recover; +} + +void +UX_initialize_trap_recovery (void) +{ initialize_ux_signal_codes (); } diff --git a/src/microcode/uxtrap.h b/src/microcode/uxtrap.h index cd148969a..851406c51 100644 --- a/src/microcode/uxtrap.h +++ b/src/microcode/uxtrap.h @@ -828,6 +828,7 @@ enum trap_state }; extern void UX_initialize_trap_recovery (void); +extern void UX_initialize_trap_state (void); extern enum trap_state OS_set_trap_state (enum trap_state state); extern void hard_reset (SIGCONTEXT_T * scp); extern void soft_reset (void);