authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-12 04:10:27+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-12 16:07:46-07:00
log6d23850108b5d3278f5b1cad395ff8da4fdfebeb
tree7aece37a9bf3c7f8828727e23d6ef6f645a355ea
parentf988cea825c4b21d0864e7125287b12566079c39

std.Thread: Explain apparently pointless mips instruction in freeAndExit().

https://git.musl-libc.org/cgit/musl/commit/?id=ce3688eca920aa77549323f84e21f33522397115

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

lib/std/Thread.zig+4
......@@ -1130,6 +1130,10 @@ const LinuxThreadImpl = struct {
11301130 [len] "r" (self.mapped.len),
11311131 : "memory"
11321132 ),
1133 // We set `sp` to the address of the current function as a workaround for a Linux
1134 // kernel bug that caused syscalls to return EFAULT if the stack pointer is invalid.
1135 // The bug was introduced in 46e12c07b3b9603c60fc1d421ff18618241cb081 and fixed in
1136 // 7928eb0370d1133d0d8cd2f5ddfca19c309079d5.
11331137 .mips, .mipsel => asm volatile (
11341138 \\ move $sp, $25
11351139 \\ li $2, 4091 # SYS_munmap