authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2020-10-25 21:51:01+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2020-10-25 21:51:01+07:00
log5474d4338905e8535b13391f952830a15bc5eaeb
treebf58719e90664b62b5ccde07b442bf1cfc3f223d
parent1a362ea5b032d7e7f0300e0d9ace1b36b164576c

Zero %i6 to terminate backchain


1 files changed, 4 insertions(+), 7 deletions(-)

lib/std/start.zig+4-7
......@@ -148,13 +148,10 @@ fn _start() callconv(.Naked) noreturn {
148148 );
149149 },
150150 .sparcv9 => {
151 // On sparc64, the stack pointer register points to a place
152 // 2047 bytes below the actual stack. Also, argc and friends are
153 // placed starting at [stack-start + 128], so we need to account for that too.
154 // Ref: System V Application Binary Interface: SPARC Version 9 Processor Supplement
155 // Version 1.35, figure 3-16.
156 // TODO: find a better way to do this.
157 starting_stack_ptr = asm ("add %%o6, 2175, %[argc]"
151 // argc is stored after a register window (16 registers) plus stack bias
152 starting_stack_ptr = asm (
153 \\ mov %%g0, %%i6
154 \\ add %%o6, 2175, %[argc]
158155 : [argc] "=r" (-> [*]usize)
159156 );
160157 },