Index: libc/amd64/gen/makecontext.c =================================================================== RCS file: /home/ncvs/src/lib/libc/amd64/gen/makecontext.c,v retrieving revision 1.1 diff -u -r1.1 makecontext.c --- libc/amd64/gen/makecontext.c 19 Jul 2003 04:41:08 -0000 1.1 +++ libc/amd64/gen/makecontext.c 3 Dec 2003 08:45:22 -0000 @@ -70,8 +70,12 @@ /* Allocate space for a maximum of 6 arguments on the stack. */ args = sp - 6; - /* Account for arguments on stack and align to 16 bytes. */ - sp -= 8; + /* + * Account for arguments on stack and do the funky C entry alignment. + * This means that we need an 8-byte-odd alignment since the ABI expects + * the return address to be pushed, thus breaking the 16 byte alignment. + */ + sp -= 7; /* Add the arguments: */ va_start(ap, argc); Index: libpthread/arch/amd64/amd64/enter_uts.S =================================================================== RCS file: /home/ncvs/src/lib/libpthread/arch/amd64/amd64/enter_uts.S,v retrieving revision 1.3 diff -u -r1.3 enter_uts.S --- libpthread/arch/amd64/amd64/enter_uts.S 2 Aug 2003 22:39:10 -0000 1.3 +++ libpthread/arch/amd64/amd64/enter_uts.S 3 Dec 2003 08:59:00 -0000 @@ -35,7 +35,7 @@ ENTRY(_amd64_enter_uts) addq %rcx, %rdx /* get stack base */ andq $~0xf, %rdx /* align to 16 bytes */ + subq $8,%rdx /* simulate "call" */ movq %rdx, %rsp /* switch to UTS stack */ movq %rdx, %rbp /* set frame */ - pushq %rsi - ret + jmpq *%rsi