X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fruntime%2Fx86-darwin-os.c;h=8489322b71dbd261ecdf65a41fb4084e6f5bb84b;hb=de3bfc084239fa962ef001eaa68e5b6f4b9bbf81;hp=edcd85cc1096ed2f749f25430b38ceb8b4005959;hpb=597826f00530e8d0c6f4a8ccda2e366f56b65579;p=sbcl.git diff --git a/src/runtime/x86-darwin-os.c b/src/runtime/x86-darwin-os.c index edcd85c..8489322 100644 --- a/src/runtime/x86-darwin-os.c +++ b/src/runtime/x86-darwin-os.c @@ -44,10 +44,23 @@ void set_data_desc_addr(data_desc_t* desc, void* addr) #endif +#ifdef LISP_FEATURE_SB_THREAD +void +arch_os_load_ldt(struct thread *thread) +{ + sel_t sel; + + sel.index = thread->tls_cookie; + sel.rpl = USER_PRIV; + sel.ti = SEL_LDT; + + __asm__ __volatile__ ("mov %0, %%fs" : : "r"(sel)); +} +#endif + int arch_os_thread_init(struct thread *thread) { #ifdef LISP_FEATURE_SB_THREAD int n; - sel_t sel; data_desc_t ldt_entry = { 0, 0, 0, DESC_DATA_WRITE, 3, 1, 0, DESC_DATA_32B, DESC_GRAN_BYTE, 0 }; @@ -65,13 +78,9 @@ int arch_os_thread_init(struct thread *thread) { thread_mutex_unlock(&modify_ldt_lock); FSHOW_SIGNAL((stderr, "/ TLS: Allocated LDT %x\n", n)); - sel.index = n; - sel.rpl = USER_PRIV; - sel.ti = SEL_LDT; - - __asm__ __volatile__ ("mov %0, %%fs" : : "r"(sel)); - thread->tls_cookie=n; + arch_os_load_ldt(thread); + pthread_setspecific(specials,thread); #endif #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER @@ -395,10 +404,10 @@ catch_exception_raise(mach_port_t exception_port, siginfo_t siginfo; kern_return_t ret, dealloc_ret; - struct thread *th = (struct thread*) exception_port; + struct thread *th; FSHOW((stderr,"/entering catch_exception_raise with exception: %d\n", exception)); - + th = *(struct thread**)exception_port; /* Get state and info */ state_count = x86_THREAD_STATE32_COUNT; if ((ret = thread_get_state(thread,