2012-09-09 02:43:14 +00:00
|
|
|
#define __SYSCALL_LL_E(x) \
|
|
|
|
((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
|
|
|
|
((union { long long ll; long l[2]; }){ .ll = x }).l[1]
|
|
|
|
#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
|
|
|
|
|
2014-05-30 06:47:35 +00:00
|
|
|
#define SYSCALL_RLIM_INFINITY (-1UL/2)
|
|
|
|
|
2019-09-26 23:14:36 +00:00
|
|
|
#if __mips_isa_rev >= 6
|
|
|
|
#define SYSCALL_CLOBBERLIST \
|
|
|
|
"$1", "$3", "$11", "$12", "$13", \
|
|
|
|
"$14", "$15", "$24", "$25", "memory"
|
|
|
|
#else
|
|
|
|
#define SYSCALL_CLOBBERLIST \
|
|
|
|
"$1", "$3", "$11", "$12", "$13", \
|
|
|
|
"$14", "$15", "$24", "$25", "hi", "lo", "memory"
|
|
|
|
#endif
|
|
|
|
|
2012-09-09 05:01:19 +00:00
|
|
|
static inline long __syscall0(long n)
|
|
|
|
{
|
2012-09-11 06:23:47 +00:00
|
|
|
register long r7 __asm__("$7");
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2014-07-20 03:37:21 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall"
|
|
|
|
: "+r"(r2), "=r"(r7)
|
|
|
|
:
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
|
2014-07-20 03:37:21 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-09 05:01:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall1(long n, long a)
|
|
|
|
{
|
|
|
|
register long r4 __asm__("$4") = a;
|
2012-09-11 06:23:47 +00:00
|
|
|
register long r7 __asm__("$7");
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2014-07-20 03:37:21 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall"
|
|
|
|
: "+r"(r2), "=r"(r7)
|
|
|
|
: "r"(r4)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
|
2014-07-20 03:37:21 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-09 05:01:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall2(long n, long a, long b)
|
|
|
|
{
|
|
|
|
register long r4 __asm__("$4") = a;
|
|
|
|
register long r5 __asm__("$5") = b;
|
2012-09-11 06:23:47 +00:00
|
|
|
register long r7 __asm__("$7");
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2014-07-20 03:37:21 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall"
|
|
|
|
: "+r"(r2), "=r"(r7)
|
|
|
|
: "r"(r4), "r"(r5)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-09 05:01:19 +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;
|
2012-09-11 06:23:47 +00:00
|
|
|
register long r7 __asm__("$7");
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2014-07-20 03:37:21 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall"
|
|
|
|
: "+r"(r2), "=r"(r7)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-11 06:23:47 +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 mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2014-07-20 03:37:21 +00:00
|
|
|
__asm__ __volatile__ (
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall"
|
|
|
|
: "+r"(r2), "+r"(r7)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-09 05:01:19 +00:00
|
|
|
}
|
|
|
|
|
2012-09-09 02:43:14 +00:00
|
|
|
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
|
|
|
|
{
|
2019-04-10 23:23:15 +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 mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2019-04-10 23:23:15 +00:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"subu $sp,$sp,32 ; sw $8,16($sp) ; "
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall ;"
|
2019-04-10 23:23:15 +00:00
|
|
|
"addu $sp,$sp,32"
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
: "+r"(r2), "+r"(r7), "+r"(r8)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$9", "$10");
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-09 02:43:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
|
|
|
|
{
|
2019-04-10 23:23:15 +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;
|
|
|
|
register long r9 __asm__("$9") = f;
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2019-04-10 23:23:15 +00:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; "
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall ;"
|
2019-04-10 23:23:15 +00:00
|
|
|
"addu $sp,$sp,32"
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
: "+r"(r2), "+r"(r7), "+r"(r8), "+r"(r9)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST, "$10");
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2012-09-09 02:43:14 +00:00
|
|
|
}
|
2016-01-26 20:26:34 +00:00
|
|
|
|
2019-05-05 15:24:57 +00:00
|
|
|
static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
register long r9 __asm__("$9") = f;
|
|
|
|
register long r10 __asm__("$10") = g;
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
register long r2 __asm__("$2") = n;
|
2019-05-05 15:24:57 +00:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; sw $10,24($sp) ; "
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
"syscall ;"
|
2019-05-05 15:24:57 +00:00
|
|
|
"addu $sp,$sp,32"
|
clean up mips (32-bit, o32) syscall asm constraints
analogous to commit ddc7c4f936c7a90781072f10dbaa122007e939d0 for
mips64 and n32, remove the hack to load the syscall number into $2 via
asm, and use a constraint to let the compiler load it instead.
now, only $4, $5, and $6 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.
as before, $8, $9, and $10 are conditionally input-output registers
for 5-, 6-, and 7-argument syscalls. their role in input is carrying
in the values that will be stored on the stack for arguments 5-7.
their role in output is carrying back whatever the kernel has
clobbered them with, so that the compiler cannot assume they still
contain the input values.
2019-09-27 13:57:54 +00:00
|
|
|
: "+r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
|
|
|
|
: "r"(r4), "r"(r5), "r"(r6)
|
2019-09-26 23:14:36 +00:00
|
|
|
: SYSCALL_CLOBBERLIST);
|
2019-07-18 23:07:32 +00:00
|
|
|
return r7 ? -r2 : r2;
|
2019-05-05 15:24:57 +00:00
|
|
|
}
|
|
|
|
|
2016-01-26 20:26:34 +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
|