mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
std.Thread: fix some issues in x86_64/x32 inline asm
Wrong syscall on x32; return exit code 0 instead of 1 on both. ref https://github.com/ziglang/zig/issues/22189
This commit is contained in:
parent
e59f2995a5
commit
adcfdce6be
@ -1191,12 +1191,22 @@ const LinuxThreadImpl = struct {
|
||||
: [ptr] "r" (@intFromPtr(self.mapped.ptr)),
|
||||
[len] "r" (self.mapped.len),
|
||||
: .{ .memory = true }),
|
||||
.x86_64 => asm volatile (
|
||||
\\ movq $11, %%rax # SYS_munmap
|
||||
\\ syscall
|
||||
\\ movq $60, %%rax # SYS_exit
|
||||
\\ movq $1, %%rdi
|
||||
\\ syscall
|
||||
.x86_64 => asm volatile (switch (target.abi) {
|
||||
.gnux32, .muslx32 =>
|
||||
\\ movl $0x4000000b, %%eax # SYS_munmap
|
||||
\\ syscall
|
||||
\\ movl $0x4000003c, %%eax # SYS_exit
|
||||
\\ xor %%rdi, %%rdi
|
||||
\\ syscall
|
||||
,
|
||||
else =>
|
||||
\\ movl $11, %%eax # SYS_munmap
|
||||
\\ syscall
|
||||
\\ movl $60, %%eax # SYS_exit
|
||||
\\ xor %%rdi, %%rdi
|
||||
\\ syscall
|
||||
,
|
||||
}
|
||||
:
|
||||
: [ptr] "{rdi}" (@intFromPtr(self.mapped.ptr)),
|
||||
[len] "{rsi}" (self.mapped.len),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user