diff options
author | rsc <devnull@localhost> | 2006-04-22 00:50:08 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-04-22 00:50:08 +0000 |
commit | fa07e3d777fc52a7c564f71c9b7f2bba1d0e7716 (patch) | |
tree | 8b9142fde8b4d9a60697941729f05b31b0e0eb86 /src/libthread | |
parent | d9ed72433f25ec45908dede1022425a3f3ed1c67 (diff) | |
download | plan9port-fa07e3d777fc52a7c564f71c9b7f2bba1d0e7716.tar.gz plan9port-fa07e3d777fc52a7c564f71c9b7f2bba1d0e7716.tar.bz2 plan9port-fa07e3d777fc52a7c564f71c9b7f2bba1d0e7716.zip |
16-byte align
Diffstat (limited to 'src/libthread')
-rw-r--r-- | src/libthread/Darwin-386.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libthread/Darwin-386.c b/src/libthread/Darwin-386.c index 3725f264..0bd3c0fd 100644 --- a/src/libthread/Darwin-386.c +++ b/src/libthread/Darwin-386.c @@ -3,10 +3,19 @@ void makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) { + int n; int *sp; sp = (int*)ucp->uc_stack.ss_sp+ucp->uc_stack.ss_size/4; sp -= argc; + /* + * Stack pointer at call instruction (before return address + * gets pushed) must be 16-byte aligned. + */ + if((uintptr)sp%4) + abort(); + while((uintptr)sp%16) + sp--; memmove(sp, &argc+1, argc*sizeof(int)); *--sp = 0; /* return address */ ucp->uc_mcontext.mc_eip = (long)func; |