mirror of
git://git.musl-libc.org/musl
synced 2024-12-24 23:52:48 +00:00
f56d57f8a7
the definition of the IPC_64 macro controls the interface between libc and the kernel through syscalls; it's not a public API. the meaning is rather obscure. long ago, Linux's sysvipc *id_ds structures used 16-bit uids/gids and wrong types for a few other fields. this was in the libc5 era, before glibc. the IPC_64 flag (64 is a misnomer; it's more like 32) tells the kernel to use the modern[-ish] versions of the structures. the definition of IPC_64 has nothing to do with whether the arch is 32- or 64-bit. rather, due to either historical accident or intentional obnoxiousness, the kernel only accepts and masks off the 0x100 IPC_64 flag conditional on CONFIG_ARCH_WANT_IPC_PARSE_VERSION, i.e. for archs that want to provide, or that accidentally provided, both. for archs which don't define this option, no masking is performed and commands with the 0x100 bit set will fail as invalid. so ultimately, the definition is just a matter of matching an arbitrary switch defined per-arch in the kernel.
71 lines
2.0 KiB
C
71 lines
2.0 KiB
C
#define __SYSCALL_LL_E(x) (x)
|
|
#define __SYSCALL_LL_O(x) (x)
|
|
|
|
static __inline long __syscall0(long n)
|
|
{
|
|
unsigned long ret;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static __inline long __syscall1(long n, long a1)
|
|
{
|
|
unsigned long ret;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static __inline long __syscall2(long n, long a1, long a2)
|
|
{
|
|
unsigned long ret;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
|
|
: "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static __inline long __syscall3(long n, long a1, long a2, long a3)
|
|
{
|
|
unsigned long ret;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
|
"d"(a3) : "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
|
|
{
|
|
unsigned long ret;
|
|
register long r10 __asm__("r10") = a4;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
|
"d"(a3), "r"(r10): "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
|
|
{
|
|
unsigned long ret;
|
|
register long r10 __asm__("r10") = a4;
|
|
register long r8 __asm__("r8") = a5;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
|
"d"(a3), "r"(r10), "r"(r8) : "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
|
|
{
|
|
unsigned long ret;
|
|
register long r10 __asm__("r10") = a4;
|
|
register long r8 __asm__("r8") = a5;
|
|
register long r9 __asm__("r9") = a6;
|
|
__asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
|
|
"d"(a3), "r"(r10), "r"(r8), "r"(r9) : "rcx", "r11", "memory");
|
|
return ret;
|
|
}
|
|
|
|
#define VDSO_USEFUL
|
|
#define VDSO_CGT_SYM "__vdso_clock_gettime"
|
|
#define VDSO_CGT_VER "LINUX_2.6"
|
|
#define VDSO_GETCPU_SYM "__vdso_getcpu"
|
|
#define VDSO_GETCPU_VER "LINUX_2.6"
|
|
|
|
#define IPC_64 0
|