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,
|
arg5: usize,
|
||||||
arg6: usize,
|
arg6: usize,
|
||||||
) 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 (
|
return asm volatile (
|
||||||
|
\\ push %[arg6]
|
||||||
\\ push %%ebp
|
\\ push %%ebp
|
||||||
\\ mov %[arg6], %%ebp
|
\\ mov 4(%%esp), %%ebp
|
||||||
\\ int $0x80
|
\\ int $0x80
|
||||||
\\ pop %%ebp
|
\\ pop %%ebp
|
||||||
|
\\ add $4, %%esp
|
||||||
: [ret] "={eax}" (-> usize)
|
: [ret] "={eax}" (-> usize)
|
||||||
: [number] "{eax}" (number),
|
: [number] "{eax}" (number),
|
||||||
[arg1] "{ebx}" (arg1),
|
[arg1] "{ebx}" (arg1),
|
||||||
|
|
Loading…
Reference in New Issue