zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 060c475fcd358eb9d05d14ec9f1bb7bfc47e4423 (tree)
parent 5e770407cf50ae8cd103644c8ca297da52adb5b8
Author: David Rubin <daviru007@icloud.com>
Date:   Wed, 13 Mar 2024 19:26:10 -0700

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

Diffstat:
Mlib/std/start.zig | 2+-
Msrc/arch/riscv64/Emit.zig | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/std/start.zig b/lib/std/start.zig @@ -155,7 +155,7 @@ fn exit2(code: usize) noreturn { asm volatile ("ecall" : : [number] "{a7}" (94), - [arg1] "{a0}" (0), + [arg1] "{a0}" (code), : "rcx", "r11", "memory" ); }, diff --git a/src/arch/riscv64/Emit.zig b/src/arch/riscv64/Emit.zig @@ -287,7 +287,7 @@ fn mirPsuedo(emit: *Emit, inst: Mir.Inst.Index) !void { }; // Restore ra - try emit.writeInstruction(Instruction.ld(.ra, stack_size - 16, .sp)); + try emit.writeInstruction(Instruction.ld(.ra, stack_size - 8, .sp)); // Restore s0 try emit.writeInstruction(Instruction.ld(.s0, stack_size - 16, .sp));