From afc35161bcb1e2455be328ce7647ee9ccb1a2b3a Mon Sep 17 00:00:00 2001 From: davidxu Date: Sat, 31 Jul 2004 01:41:41 +0000 Subject: 1. Use correct alignment mask, -15 != ~15 2. Make end of frames --- lib/libc/amd64/gen/makecontext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libc/amd64/gen') diff --git a/lib/libc/amd64/gen/makecontext.c b/lib/libc/amd64/gen/makecontext.c index c44e336..15f10b5 100644 --- a/lib/libc/amd64/gen/makecontext.c +++ b/lib/libc/amd64/gen/makecontext.c @@ -65,7 +65,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...) /* Align the stack to 16 bytes. */ sp = (uint64_t *)(ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); - sp = (uint64_t *)((uint64_t)sp & -15UL); + sp = (uint64_t *)((uint64_t)sp & ~15UL); /* Allocate space for a maximum of 6 arguments on the stack. */ args = sp - 6; @@ -88,7 +88,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...) ucp->uc_mcontext.mc_rdi = (register_t)ucp; ucp->uc_mcontext.mc_rsi = (register_t)start; ucp->uc_mcontext.mc_rdx = (register_t)args; - ucp->uc_mcontext.mc_rbp = (register_t)sp; + ucp->uc_mcontext.mc_rbp = 0; ucp->uc_mcontext.mc_rbx = (register_t)sp; ucp->uc_mcontext.mc_rsp = (register_t)sp; ucp->uc_mcontext.mc_rip = (register_t)makectx_wrapper; -- cgit v1.1