diff options
author | davidxu <davidxu@FreeBSD.org> | 2004-07-31 01:41:41 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2004-07-31 01:41:41 +0000 |
commit | afc35161bcb1e2455be328ce7647ee9ccb1a2b3a (patch) | |
tree | de248d0f57538cab8dd78919eac78b8e36f00400 /lib/libc/amd64/gen | |
parent | 6bb53152bae4336f7f62118c91c230c59ca18f30 (diff) | |
download | FreeBSD-src-afc35161bcb1e2455be328ce7647ee9ccb1a2b3a.zip FreeBSD-src-afc35161bcb1e2455be328ce7647ee9ccb1a2b3a.tar.gz |
1. Use correct alignment mask, -15 != ~15
2. Make end of frames
Diffstat (limited to 'lib/libc/amd64/gen')
-rw-r--r-- | lib/libc/amd64/gen/makecontext.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |