std.Thread: fix freeAndExit on x86_64-linux (#12693)

Previously, this function used incorrect registers for the munmap syscall, leading to detached threads not cleaning up.

closes #12690

Co-authored-by: bxlr <biexelar@diroot.org>
This commit is contained in:
biexelar 2022-08-31 02:31:47 +00:00 committed by GitHub
parent 56cfa8f22f
commit 59e33b447b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -769,16 +769,13 @@ const LinuxThreadImpl = struct {
),
.x86_64 => asm volatile (
\\ movq $11, %%rax
\\ movq %[ptr], %%rbx
\\ movq %[len], %%rcx
\\ syscall
\\ movq $60, %%rax
\\ movq $1, %%rdi
\\ syscall
:
: [ptr] "r" (@ptrToInt(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
: [ptr] "{rdi}" (@ptrToInt(self.mapped.ptr)),
[len] "{rsi}" (self.mapped.len),
),
.arm, .armeb, .thumb, .thumbeb => asm volatile (
\\ mov r7, #91