linux/i386: Make syscall6 more robust and correct
LLVM10 exposed a subtle flaw in the previous implementation that made the mmap tests fail.master
parent
7a58ec81ec
commit
a779450fef
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue