diff options
author | David Xu <davidxu@FreeBSD.org> | 2004-07-31 01:41:41 +0000 |
---|---|---|
committer | David Xu <davidxu@FreeBSD.org> | 2004-07-31 01:41:41 +0000 |
commit | d3c6a920f1aaafdab6708ef32923afc88f0292e9 (patch) | |
tree | de248d0f57538cab8dd78919eac78b8e36f00400 | |
parent | c9d3021a9228c0695d92fa1cef686f30a0bf38ae (diff) | |
download | src-d3c6a920f1aaafdab6708ef32923afc88f0292e9.tar.gz src-d3c6a920f1aaafdab6708ef32923afc88f0292e9.zip |
1. Use correct alignment mask, -15 != ~15
2. Make end of frames
Notes
Notes:
svn path=/head/; revision=132912
-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 c44e3369913b..15f10b50ded4 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; |