Changeset 11582 for release


Ignore:
Timestamp:
Jan 5, 2009, 11:37:24 AM (11 years ago)
Author:
gb
Message:

Hold TCR_AREA_LOCK when calling pthread_create(), to avoid Darwin lossage.

Propagate recent x86 Darwin sigreturn changes to 1.2.

Location:
release/1.2/source/lisp-kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/1.2/source/lisp-kernel/thread_manager.c

    r10401 r11582  
    12191219  pthread_attr_t attr;
    12201220  pthread_t returned_thread = (pthread_t) 0;
     1221  TCR *current = get_tcr(false);
    12211222
    12221223  pthread_attr_init(&attr);
     
    12411242  /*
    12421243     I think that's just about enough ... create the thread.
     1244     Well ... not quite enough.  In Leopard (at least), many
     1245     pthread routines grab an internal spinlock when validating
     1246     their arguments.  If we suspend a thread that owns this
     1247     spinlock, we deadlock.  We can't in general keep that
     1248     from happening: if arbitrary C code is suspended while
     1249     it owns the spinlock, we still deadlock.  It seems that
     1250     the best that we can do is to keep -this- code from
     1251     getting suspended (by grabbing TCR_AREA_LOCK)
    12431252  */
     1253  LOCK(lisp_global(TCR_AREA_LOCK),current);
    12441254  pthread_create(&returned_thread, &attr, start_routine, param);
     1255  UNLOCK(lisp_global(TCR_AREA_LOCK),current);
    12451256  return (LispObj) ptr_to_lispobj(returned_thread);
    12461257}
  • release/1.2/source/lisp-kernel/x86-asmutils64.s

    r8575 r11582  
    177177_endfn
    178178
     179
     180_exportfn(C(darwin_sigreturn))
     181        .globl C(sigreturn)
     182/* Need to set the sigreturn 'infostyle' argument, which is mostly
     183   undocumented.  On x8664 Darwin, sigtramp() sets it to 0x1e, and
     184   since we're trying to do what sigtramp() would do if we'd returned
     185   to it ... */
     186        __(movl $0x1e,%esi)
     187        __(jmp C(sigreturn))
     188_endfn           
     189               
     190       
    179191_exportfn(C(put_vector_registers))
    180192_endfn                         
  • release/1.2/source/lisp-kernel/x86-exceptions.h

    r9055 r11582  
    3030#define DARWIN_USE_PSEUDO_SIGRETURN 1
    3131#include <sys/syscall.h>
    32 #define DarwinSigReturn(context) syscall(0x2000000|SYS_sigreturn,context,0x1e)
     32#define DarwinSigReturn(context) do {\
     33    darwin_sigreturn(context);\
     34    Bug(context,"sigreturn returned");\
     35  } while (0)
     36
    3337#ifdef X8664
    3438#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss.__rax)))
Note: See TracChangeset for help on using the changeset viewer.