2014-01-07 21:43:34 +00:00
|
|
|
#define __SYSCALL_LL_E(x) (x)
|
|
|
|
#define __SYSCALL_LL_O(x) (x)
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
#define __scc(X) sizeof(1?(X):0ULL) < 8 ? (unsigned long) (X) : (long long) (X)
|
2014-02-23 10:43:09 +00:00
|
|
|
typedef long long syscall_arg_t;
|
2014-01-07 21:53:38 +00:00
|
|
|
|
|
|
|
static __inline long __syscall0(long long n)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
static __inline long __syscall1(long long n, long long a1)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
static __inline long __syscall2(long long n, long long a1, long long a2)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
|
2014-01-07 21:53:38 +00:00
|
|
|
: "rcx", "r11", "memory");
|
2014-01-07 21:43:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
static __inline long __syscall3(long long n, long long a1, long long a2, long long a3)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
|
|
|
"d"(a3) : "rcx", "r11", "memory");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
static __inline long __syscall4(long long n, long long a1, long long a2, long long a3,
|
2014-02-23 19:46:30 +00:00
|
|
|
long long a4_)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
2014-02-23 19:46:30 +00:00
|
|
|
register long long a4 __asm__("r10") = a4_;
|
2014-01-07 21:43:34 +00:00
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
2014-02-23 19:46:30 +00:00
|
|
|
"d"(a3), "r"(a4): "rcx", "r11", "memory");
|
2014-01-07 21:43:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
static __inline long __syscall5(long long n, long long a1, long long a2, long long a3,
|
2014-02-23 19:46:30 +00:00
|
|
|
long long a4_, long long a5_)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
2014-02-23 19:46:30 +00:00
|
|
|
register long long a4 __asm__("r10") = a4_;
|
|
|
|
register long long a5 __asm__("r8") = a5_;
|
2014-01-07 21:43:34 +00:00
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
2014-02-23 19:46:30 +00:00
|
|
|
"d"(a3), "r"(a4), "r"(a5) : "rcx", "r11", "memory");
|
2014-01-07 21:43:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-01-07 21:53:38 +00:00
|
|
|
static __inline long __syscall6(long long n, long long a1, long long a2, long long a3,
|
2014-02-23 19:46:30 +00:00
|
|
|
long long a4_, long long a5_, long long a6_)
|
2014-01-07 21:43:34 +00:00
|
|
|
{
|
|
|
|
unsigned long ret;
|
2014-02-23 19:46:30 +00:00
|
|
|
register long long a4 __asm__("r10") = a4_;
|
|
|
|
register long long a5 __asm__("r8") = a5_;
|
|
|
|
register long long a6 __asm__("r9") = a6_;
|
2014-01-07 21:43:34 +00:00
|
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
2014-02-23 19:46:30 +00:00
|
|
|
"d"(a3), "r"(a4), "r"(a5), "r"(a6) : "rcx", "r11", "memory");
|
2014-01-07 21:43:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2019-07-27 16:20:07 +00:00
|
|
|
|
|
|
|
#undef SYS_futimesat
|
internally, define time64 syscalls on x32 as the existing syscalls
x32 is odd in that it's the only ILP32 arch/ABI we have where time_t
is 64-bit rather than (32-bit) long, and this has always been
problematic in that it results in struct timespec having unused
padding space, since tv_nsec has type long, which the kernel insists
be zero- or sign-extended (due to negative tv_nsec being invalid, it
doesn't matter which) to match the x86_64 type.
up til now, we've had really ugly hacks in x32/syscall_arch.h to patch
up the timespecs passed to the kernel. but the same requirement to
zero- or sign-extend tv_nsec also applies to all the new time64
syscalls on true 32-bit archs. so let's take advantage of this to
clean things up.
this patch defines all of the time64 syscalls for x32 as aliases for
the existing syscalls by the same name. this establishes the following
invariants:
- if the time64 form is defined, it takes time arguments as 64-bit
objects, and tv_nsec inputs must be zero-/sign-extended to 64-bit.
- if the time64 form is not defined, or if the time64 form is defined
and is not equal to the "plain" form, the plain form takes time
arguments as longs.
this will avoid the need for protocols for archs to define appropriate
types for each family of syscalls, and for the reader of the code to
have to be aware of such type definitions.
in some sense it might be simpler if the plain syscall form were
undefined for x32, so that it would always take longs if defined.
however, a number of these syscalls are used in contexts with a null
time argument, or (e.g. futex) for commands that don't involve time at
all, and having to introduce time64-specific logic to all those call
points does not make sense. thus, while the "plain" forms are kept now
just because they're needed until the affected code is converted over,
they'll also almost surely be kept in the future as well.
2019-07-27 16:39:29 +00:00
|
|
|
|
|
|
|
#define SYS_clock_gettime64 SYS_clock_gettime
|
|
|
|
#define SYS_clock_settime64 SYS_clock_settime
|
|
|
|
#define SYS_clock_adjtime64 SYS_clock_adjtime
|
|
|
|
#define SYS_clock_nanosleep_time64 SYS_clock_nanosleep
|
|
|
|
#define SYS_timer_gettime64 SYS_timer_gettime
|
|
|
|
#define SYS_timer_settime64 SYS_timer_settime
|
|
|
|
#define SYS_timerfd_gettime64 SYS_timerfd_gettime
|
|
|
|
#define SYS_timerfd_settime64 SYS_timerfd_settime
|
|
|
|
#define SYS_utimensat_time64 SYS_utimensat
|
|
|
|
#define SYS_pselect6_time64 SYS_pselect6
|
|
|
|
#define SYS_ppoll_time64 SYS_ppoll
|
|
|
|
#define SYS_recvmmsg_time64 SYS_recvmmsg
|
|
|
|
#define SYS_mq_timedsend_time64 SYS_mq_timedsend
|
|
|
|
#define SYS_mq_timedreceive_time64 SYS_mq_timedreceive
|
|
|
|
#define SYS_semtimedop_time64 SYS_semtimedop
|
|
|
|
#define SYS_rt_sigtimedwait_time64 SYS_rt_sigtimedwait
|
|
|
|
#define SYS_futex_time64 SYS_futex
|
|
|
|
#define SYS_sched_rr_get_interval_time64 SYS_sched_rr_get_interval
|
2019-07-30 17:07:55 +00:00
|
|
|
|
|
|
|
#define IPC_64 0
|