diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2011-11-08 14:25:41 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2011-11-08 21:14:09 -0800 |
| commit | b30a76ed1b5f5d35560d00a621bf91d6024c478e (patch) | |
| tree | 4d579053bc54119090560172ca775dcbd3b03b4f /src/rt/arch/x86_64/context.cpp | |
| parent | a8c0c2b871a9a0c39a1294327490700104cd0918 (diff) | |
| download | rust-b30a76ed1b5f5d35560d00a621bf91d6024c478e.tar.gz rust-b30a76ed1b5f5d35560d00a621bf91d6024c478e.zip | |
correct calling convention for x86_64
Diffstat (limited to 'src/rt/arch/x86_64/context.cpp')
| -rw-r--r-- | src/rt/arch/x86_64/context.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/rt/arch/x86_64/context.cpp b/src/rt/arch/x86_64/context.cpp index edfae486b4f..09577dbd151 100644 --- a/src/rt/arch/x86_64/context.cpp +++ b/src/rt/arch/x86_64/context.cpp @@ -25,14 +25,11 @@ void context::call(void *f, void *arg, void *stack) { // given function. swap(*this); - // set up the trampoline frame - uint64_t *sp = (uint64_t *)stack; + // set up the stack + uint32_t *sp = (uint32_t *)stack; + sp = align_down(sp); - // Shift the stack pointer so the alignment works out right. - sp = align_down(sp) - 3; - *--sp = (uint64_t)arg; - *--sp = 0xdeadbeef; - - regs.regs[RSP] = (uint64_t)sp; - regs.ip = (uint64_t)f; + regs.data[RUSTRT_ARG0] = (uint64_t)arg; + regs.data[RUSTRT_RSP] = (uint64_t)sp; + regs.data[RUSTRT_IP] = (uint64_t)f; } |
