2016-04-18 05:19:13 +00:00
|
|
|
#define __SYSCALL_LL_E(x) (x)
|
|
|
|
#define __SYSCALL_LL_O(x) (x)
|
|
|
|
|
|
|
|
#define SYSCALL_RLIM_INFINITY (-1UL/2)
|
|
|
|
|
2019-07-17 00:31:38 +00:00
|
|
|
#define SYSCALL_CLOBBERLIST \
|
|
|
|
"$1", "$3", "$10", "$11", "$12", "$13", \
|
|
|
|
"$14", "$15", "$24", "$25", "hi", "lo", "memory"
|
|
|
|
|
2016-04-18 05:19:13 +00:00
|
|
|
static inline long __syscall0(long n)
|
|
|
|
{
|
|
|
|
register long r7 __asm__("$7");
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2016-04-18 05:19:13 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "=r"(r7)
|
|
|
|
:
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2016-04-18 05:19:13 +00:00
|
|
|
return r7 ? -r2 : r2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall1(long n, long a)
|
|
|
|
{
|
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r7 __asm__("$7");
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2016-04-18 05:19:13 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "=r"(r7)
|
|
|
|
: "r"(r4)
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2016-04-18 05:19:13 +00:00
|
|
|
return r7 ? -r2 : r2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall2(long n, long a, long b)
|
|
|
|
{
|
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r5 __asm__("$5") = b;
|
|
|
|
register long r7 __asm__("$7");
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2016-04-18 05:19:13 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "=r"(r7)
|
|
|
|
: "r"(r4), "r"(r5)
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2016-04-18 05:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall3(long n, long a, long b, long c)
|
|
|
|
{
|
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r5 __asm__("$5") = b;
|
|
|
|
register long r6 __asm__("$6") = c;
|
|
|
|
register long r7 __asm__("$7");
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2016-04-18 05:19:13 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "=r"(r7)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2016-04-18 05:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall4(long n, long a, long b, long c, long d)
|
|
|
|
{
|
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r5 __asm__("$5") = b;
|
|
|
|
register long r6 __asm__("$6") = c;
|
|
|
|
register long r7 __asm__("$7") = d;
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2016-04-18 05:19:13 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "+r"(r7)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2016-04-18 05:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
|
|
|
|
{
|
2019-04-10 23:51:47 +00:00
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r5 __asm__("$5") = b;
|
|
|
|
register long r6 __asm__("$6") = c;
|
|
|
|
register long r7 __asm__("$7") = d;
|
|
|
|
register long r8 __asm__("$8") = e;
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2019-04-10 23:51:47 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "+r"(r7)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6), "r"(r8)
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2016-04-18 05:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
|
|
|
|
{
|
2019-04-10 23:51:47 +00:00
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r5 __asm__("$5") = b;
|
|
|
|
register long r6 __asm__("$6") = c;
|
|
|
|
register long r7 __asm__("$7") = d;
|
|
|
|
register long r8 __asm__("$8") = e;
|
2019-05-05 15:10:42 +00:00
|
|
|
register long r9 __asm__("$9") = f;
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2019-04-10 23:51:47 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips64/n32 syscall asm constraints
ever since inline syscalls were added for (o32) mips in commit
328810d32524e4928fec50b57e37e1bf330b2e40, the asm has nonsensically
loaded the syscall number, rather than taking $2 as an input
constraint to let the compiler load it. commit
cfc09b1ecf0c6981494fd73dffe234416f66af10 improved on this somewhat by
allowing a constant syscall number to propagate into an immediate, but
missed that the whole operation made no sense.
now, only $4, $5, $6, $8, and $9 are potential input-only registers.
$2 is always input and output, and $7 is both when it's an argument,
otherwise output-only. previously, $7 was treated as an input (with a
"1" constraint matching its output position) even when it was not an
input, which was arguably undefined behavior (asm input from
indeterminate value). this is corrected.
2019-07-17 00:49:02 +00:00
|
|
|
"syscall"
|
|
|
|
: "+&r"(r2), "+r"(r7)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
|
2019-07-17 00:31:38 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2016-04-18 05:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define VDSO_USEFUL
|
|
|
|
#define VDSO_CGT_SYM "__vdso_clock_gettime"
|
|
|
|
#define VDSO_CGT_VER "LINUX_2.6"
|
2019-07-31 02:11:39 +00:00
|
|
|
|
|
|
|
#define SO_SNDTIMEO_OLD 0x1005
|
|
|
|
#define SO_RCVTIMEO_OLD 0x1006
|