aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKoakuma <koachan@protonmail.com>2020-10-25 21:51:01 +0700
committerKoakuma <koachan@protonmail.com>2020-10-25 21:51:01 +0700
commit5474d4338905e8535b13391f952830a15bc5eaeb (patch)
treebf58719e90664b62b5ccde07b442bf1cfc3f223d /lib
parent1a362ea5b032d7e7f0300e0d9ace1b36b164576c (diff)
downloadzig-5474d4338905e8535b13391f952830a15bc5eaeb.tar.gz
zig-5474d4338905e8535b13391f952830a15bc5eaeb.zip
Zero %i6 to terminate backchain
Diffstat (limited to 'lib')
-rw-r--r--lib/std/start.zig11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 8bb9780e27..b1cbefcc67 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -148,13 +148,10 @@ fn _start() callconv(.Naked) noreturn {
);
},
.sparcv9 => {
- // On sparc64, the stack pointer register points to a place
- // 2047 bytes below the actual stack. Also, argc and friends are
- // placed starting at [stack-start + 128], so we need to account for that too.
- // Ref: System V Application Binary Interface: SPARC Version 9 Processor Supplement
- // Version 1.35, figure 3-16.
- // TODO: find a better way to do this.
- starting_stack_ptr = asm ("add %%o6, 2175, %[argc]"
+ // argc is stored after a register window (16 registers) plus stack bias
+ starting_stack_ptr = asm (
+ \\ mov %%g0, %%i6
+ \\ add %%o6, 2175, %[argc]
: [argc] "=r" (-> [*]usize)
);
},