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 {...@@ -329,8 +329,8 @@ fn _start() callconv(.Naked) noreturn {
329 \\ jsr (%%pc, %%a0)329 \\ jsr (%%pc, %%a0)
330 ,330 ,
331 .mips, .mipsel =>331 .mips, .mipsel =>
332 // The lr is already zeroed on entry, as specified by the ABI.332 \\ move $fp, $0
333 \\ addiu $fp, $zero, 0333 \\ move $ra, $0
334 \\ move $a0, $sp334 \\ move $a0, $sp
335 \\ .set push335 \\ .set push
336 \\ .set noat336 \\ .set noat
...@@ -340,8 +340,8 @@ fn _start() callconv(.Naked) noreturn {...@@ -340,8 +340,8 @@ fn _start() callconv(.Naked) noreturn {
340 \\ j %[posixCallMainAndExit]340 \\ j %[posixCallMainAndExit]
341 ,341 ,
342 .mips64, .mips64el =>342 .mips64, .mips64el =>
343 // The lr is already zeroed on entry, as specified by the ABI.343 \\ move $fp, $0
344 \\ addiu $fp, $zero, 0344 \\ move $ra, $0
345 \\ move $a0, $sp345 \\ move $a0, $sp
346 \\ .set push346 \\ .set push
347 \\ .set noat347 \\ .set noat