Commit a779450fef
Changed files (1)
lib
std
os
linux
lib/std/os/linux/i386.zig
@@ -72,11 +72,17 @@ pub fn syscall6(
arg5: usize,
arg6: usize,
) usize {
+ // The 6th argument is passed via memory as we're out of registers if ebp is
+ // used as frame pointer. We push arg6 value on the stack before changing
+ // ebp or esp as the compiler may reference it as an offset relative to one
+ // of those two registers.
return asm volatile (
- \\ push %%ebp
- \\ mov %[arg6], %%ebp
- \\ int $0x80
- \\ pop %%ebp
+ \\ push %[arg6]
+ \\ push %%ebp
+ \\ mov 4(%%esp), %%ebp
+ \\ int $0x80
+ \\ pop %%ebp
+ \\ add $4, %%esp
: [ret] "={eax}" (-> usize)
: [number] "{eax}" (number),
[arg1] "{ebx}" (arg1),