diff options
| author | Russ Cox <rsc@swtch.com> | 2011-08-02 14:28:04 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@swtch.com> | 2011-08-02 14:28:04 -0400 |
| commit | fc567f476a9cb381a50a94a355c4e0dd990b2539 (patch) | |
| tree | 9bfabb0a7d3c13f6e853b47e0eae7e7d9c888c31 /src/libthread/threadimpl.h | |
| parent | babe3439cc2bb8baa027be65da67d02d980ebb05 (diff) | |
build: OS X 64-bit build
R=rsc
http://codereview.appspot.com/4838047
Diffstat (limited to 'src/libthread/threadimpl.h')
| -rw-r--r-- | src/libthread/threadimpl.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h index 8b931ae7..0352d755 100644 --- a/src/libthread/threadimpl.h +++ b/src/libthread/threadimpl.h @@ -24,7 +24,7 @@ extern int swapcontext(ucontext_t*, ucontext_t*); extern void makecontext(ucontext_t*, void(*)(), int, ...); #endif -#if defined(__APPLE__) +#if defined(__APPLE__) && !defined(__x86_64__) /* * OS X before 10.5 (Leopard) does not provide * swapcontext nor makecontext, so we have to use our own. @@ -40,8 +40,10 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...); # define makecontext libthread_makecontext # if defined(__i386__) # include "386-ucontext.h" -# else +# elif defined(__power__) # include "power-ucontext.h" +# else +# error "unknown architecture" # endif #endif @@ -99,6 +101,15 @@ enum struct Context { ucontext_t uc; +#ifdef __APPLE__ + /* + * On Snow Leopard, etc., the context routines exist, + * so we use them, but apparently they write past the + * end of the ucontext_t. Sigh. We put some extra + * scratch space here for them. + */ + uchar buf[512]; +#endif }; struct Execjob @@ -116,12 +127,12 @@ struct _Thread _Thread *allnext; _Thread *allprev; Context context; + void (*startfn)(void*); + void *startarg; uint id; uchar *stk; uint stksize; int exiting; - void (*startfn)(void*); - void *startarg; Proc *proc; char name[256]; char state[256]; |