authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-03-13 19:26:10-07:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-05-11 02:17:11-07:00
log060c475fcd358eb9d05d14ec9f1bb7bfc47e4423
treec203f555ba0eba4d7edffd3a9ce6cc121fc900df
parent5e770407cf50ae8cd103644c8ca297da52adb5b8

riscv: update `start.zig` and restore ra from the proper stack offset


2 files changed, 2 insertions(+), 2 deletions(-)

lib/std/start.zig+1-1
...@@ -155,7 +155,7 @@ fn exit2(code: usize) noreturn {...@@ -155,7 +155,7 @@ fn exit2(code: usize) noreturn {
155 asm volatile ("ecall"155 asm volatile ("ecall"
156 :156 :
157 : [number] "{a7}" (94),157 : [number] "{a7}" (94),
158 [arg1] "{a0}" (0),158 [arg1] "{a0}" (code),
159 : "rcx", "r11", "memory"159 : "rcx", "r11", "memory"
160 );160 );
161 },161 },
src/arch/riscv64/Emit.zig+1-1
...@@ -287,7 +287,7 @@ fn mirPsuedo(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -287,7 +287,7 @@ fn mirPsuedo(emit: *Emit, inst: Mir.Inst.Index) !void {
287 };287 };
288288
289 // Restore ra289 // Restore ra
290 try emit.writeInstruction(Instruction.ld(.ra, stack_size - 16, .sp));290 try emit.writeInstruction(Instruction.ld(.ra, stack_size - 8, .sp));
291291
292 // Restore s0292 // Restore s0
293 try emit.writeInstruction(Instruction.ld(.s0, stack_size - 16, .sp));293 try emit.writeInstruction(Instruction.ld(.s0, stack_size - 16, .sp));