std.os.linux.x86: fix signal restore function

After handling any signal on x86, it would previously segfault.
This commit is contained in:
Andrew Kelley 2025-10-28 08:27:07 -07:00
parent 030b630829
commit 1553c8eae7

View File

@ -159,12 +159,14 @@ pub fn clone() callconv(.naked) u32 {
pub fn restore() callconv(.naked) noreturn { pub fn restore() callconv(.naked) noreturn {
switch (builtin.zig_backend) { switch (builtin.zig_backend) {
.stage2_c => asm volatile ( .stage2_c => asm volatile (
\\ addl $4, %%esp
\\ movl %[number], %%eax \\ movl %[number], %%eax
\\ int $0x80 \\ int $0x80
: :
: [number] "i" (@intFromEnum(SYS.sigreturn)), : [number] "i" (@intFromEnum(SYS.sigreturn)),
), ),
else => asm volatile ( else => asm volatile (
\\ addl $4, %%esp
\\ int $0x80 \\ int $0x80
: :
: [number] "{eax}" (@intFromEnum(SYS.sigreturn)), : [number] "{eax}" (@intFromEnum(SYS.sigreturn)),