From fc567f476a9cb381a50a94a355c4e0dd990b2539 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 2 Aug 2011 14:28:04 -0400 Subject: build: OS X 64-bit build R=rsc http://codereview.appspot.com/4838047 --- src/libthread/threadimpl.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/libthread/threadimpl.h') 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]; -- cgit v1.2.3