authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 17:41:18+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 21:56:54+02:00
log47c0464e860486150942b73a78529805d4f320b5
tree48ea1b5eda7c8658b3194126ad19a0c72336f9f7
parent1b13d7477d8c9f2154a8779f2e58c65cf1685b05
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

start: Explicitly clear the link register on mips and mips64 just in case.

The kernel does this as required, but we cannot trust dynamic linkers to do it.

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

lib/std/start.zig+4-4
......@@ -329,8 +329,8 @@ fn _start() callconv(.Naked) noreturn {
329329 \\ jsr (%%pc, %%a0)
330330 ,
331331 .mips, .mipsel =>
332 // The lr is already zeroed on entry, as specified by the ABI.
333 \\ addiu $fp, $zero, 0
332 \\ move $fp, $0
333 \\ move $ra, $0
334334 \\ move $a0, $sp
335335 \\ .set push
336336 \\ .set noat
......@@ -340,8 +340,8 @@ fn _start() callconv(.Naked) noreturn {
340340 \\ j %[posixCallMainAndExit]
341341 ,
342342 .mips64, .mips64el =>
343 // The lr is already zeroed on entry, as specified by the ABI.
344 \\ addiu $fp, $zero, 0
343 \\ move $fp, $0
344 \\ move $ra, $0
345345 \\ move $a0, $sp
346346 \\ .set push
347347 \\ .set noat