summaryrefslogtreecommitdiff
path: root/arch/mips64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips64')
-rw-r--r--arch/mips64/bits/alltypes.h.in20
-rw-r--r--arch/mips64/bits/endian.h5
-rw-r--r--arch/mips64/bits/fcntl.h2
-rw-r--r--arch/mips64/bits/ipc.h2
-rw-r--r--arch/mips64/bits/limits.h7
-rw-r--r--arch/mips64/bits/msg.h13
-rw-r--r--arch/mips64/bits/posix.h2
-rw-r--r--arch/mips64/bits/reg.h3
-rw-r--r--arch/mips64/bits/sem.h14
-rw-r--r--arch/mips64/bits/shm.h24
-rw-r--r--arch/mips64/bits/signal.h3
-rw-r--r--arch/mips64/bits/socket.h34
-rw-r--r--arch/mips64/bits/stat.h3
-rw-r--r--arch/mips64/bits/stdint.h20
-rw-r--r--arch/mips64/bits/syscall.h.in31
-rw-r--r--arch/mips64/bits/termios.h2
-rw-r--r--arch/mips64/ksigaction.h2
-rw-r--r--arch/mips64/kstat.h21
-rw-r--r--arch/mips64/pthread_arch.h10
-rw-r--r--arch/mips64/reloc.h11
-rw-r--r--arch/mips64/syscall_arch.h188
21 files changed, 109 insertions, 308 deletions
diff --git a/arch/mips64/bits/alltypes.h.in b/arch/mips64/bits/alltypes.h.in
index 2b2e34a8..fcd61ee8 100644
--- a/arch/mips64/bits/alltypes.h.in
+++ b/arch/mips64/bits/alltypes.h.in
@@ -2,8 +2,13 @@
#define _Int64 long
#define _Reg long
-TYPEDEF __builtin_va_list va_list;
-TYPEDEF __builtin_va_list __isoc_va_list;
+#if _MIPSEL || __MIPSEL || __MIPSEL__
+#define __BYTE_ORDER 1234
+#else
+#define __BYTE_ORDER 4321
+#endif
+
+#define __LONG_MAX 0x7fffffffffffffffL
#ifndef __cplusplus
TYPEDEF int wchar_t;
@@ -14,15 +19,4 @@ TYPEDEF double double_t;
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
-TYPEDEF long time_t;
-TYPEDEF long suseconds_t;
-
TYPEDEF unsigned nlink_t;
-
-TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
-TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
-TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
-TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
-TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
-TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
diff --git a/arch/mips64/bits/endian.h b/arch/mips64/bits/endian.h
deleted file mode 100644
index 5399dcb5..00000000
--- a/arch/mips64/bits/endian.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#if _MIPSEL || __MIPSEL || __MIPSEL__
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#else
-#define __BYTE_ORDER __BIG_ENDIAN
-#endif
diff --git a/arch/mips64/bits/fcntl.h b/arch/mips64/bits/fcntl.h
index 3bcec15e..5da1eef8 100644
--- a/arch/mips64/bits/fcntl.h
+++ b/arch/mips64/bits/fcntl.h
@@ -13,7 +13,7 @@
#define O_ASYNC 010000
#define O_DIRECT 0100000
-#define O_LARGEFILE 0
+#define O_LARGEFILE 020000
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
diff --git a/arch/mips64/bits/ipc.h b/arch/mips64/bits/ipc.h
index 43a8314e..df227168 100644
--- a/arch/mips64/bits/ipc.h
+++ b/arch/mips64/bits/ipc.h
@@ -10,5 +10,3 @@ struct ipc_perm {
unsigned long __unused1;
unsigned long __unused2;
};
-
-#define IPC_64 0x100
diff --git a/arch/mips64/bits/limits.h b/arch/mips64/bits/limits.h
deleted file mode 100644
index 58698c62..00000000
--- a/arch/mips64/bits/limits.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-#define LONG_BIT 64
-#endif
-
-#define LONG_MAX 0x7fffffffffffffffL
-#define LLONG_MAX 0x7fffffffffffffffLL
diff --git a/arch/mips64/bits/msg.h b/arch/mips64/bits/msg.h
deleted file mode 100644
index 641e1703..00000000
--- a/arch/mips64/bits/msg.h
+++ /dev/null
@@ -1,13 +0,0 @@
-struct msqid_ds {
- struct ipc_perm msg_perm;
- time_t msg_stime;
- time_t msg_rtime;
- time_t msg_ctime;
- unsigned long msg_cbytes;
- msgqnum_t msg_qnum;
- msglen_t msg_qbytes;
- pid_t msg_lspid;
- pid_t msg_lrpid;
- unsigned long __pad1;
- unsigned long __pad2;
-};
diff --git a/arch/mips64/bits/posix.h b/arch/mips64/bits/posix.h
deleted file mode 100644
index acf42944..00000000
--- a/arch/mips64/bits/posix.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define _POSIX_V6_LP64_OFFBIG 1
-#define _POSIX_V7_LP64_OFFBIG 1
diff --git a/arch/mips64/bits/reg.h b/arch/mips64/bits/reg.h
index a3f63acc..16178dd3 100644
--- a/arch/mips64/bits/reg.h
+++ b/arch/mips64/bits/reg.h
@@ -1,6 +1,3 @@
-#undef __WORDSIZE
-#define __WORDSIZE 64
-
#define EF_R0 0
#define EF_R1 1
#define EF_R2 2
diff --git a/arch/mips64/bits/sem.h b/arch/mips64/bits/sem.h
deleted file mode 100644
index e46ced95..00000000
--- a/arch/mips64/bits/sem.h
+++ /dev/null
@@ -1,14 +0,0 @@
-struct semid_ds {
- struct ipc_perm sem_perm;
- time_t sem_otime;
- time_t sem_ctime;
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- unsigned short sem_nsems;
- char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
-#else
- char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
- unsigned short sem_nsems;
-#endif
- time_t __unused3;
- time_t __unused4;
-};
diff --git a/arch/mips64/bits/shm.h b/arch/mips64/bits/shm.h
deleted file mode 100644
index 8d193781..00000000
--- a/arch/mips64/bits/shm.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#define SHMLBA 4096
-
-struct shmid_ds {
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
- pid_t shm_cpid;
- pid_t shm_lpid;
- unsigned long shm_nattch;
- unsigned long __pad1;
- unsigned long __pad2;
-};
-
-struct shminfo {
- unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
-};
-
-struct shm_info {
- int __used_ids;
- unsigned long shm_tot, shm_rss, shm_swp;
- unsigned long __swap_attempts, __swap_successes;
-};
diff --git a/arch/mips64/bits/signal.h b/arch/mips64/bits/signal.h
index c31ad07e..ffec7fd0 100644
--- a/arch/mips64/bits/signal.h
+++ b/arch/mips64/bits/signal.h
@@ -85,7 +85,6 @@ typedef struct __ucontext {
#define SA_RESTART 0x10000000
#define SA_NODEFER 0x40000000
#define SA_RESETHAND 0x80000000
-#define SA_RESTORER 0x04000000
#undef SIG_BLOCK
#undef SIG_UNBLOCK
@@ -112,7 +111,7 @@ typedef struct __ucontext {
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
-#define SIGSTKFLT 7
+#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGBUS 10
diff --git a/arch/mips64/bits/socket.h b/arch/mips64/bits/socket.h
index 5aff0d91..519b9c8e 100644
--- a/arch/mips64/bits/socket.h
+++ b/arch/mips64/bits/socket.h
@@ -1,37 +1,3 @@
-#include <endian.h>
-
-struct msghdr {
- void *msg_name;
- socklen_t msg_namelen;
- struct iovec *msg_iov;
-#if __BYTE_ORDER == __BIG_ENDIAN
- int __pad1, msg_iovlen;
-#else
- int msg_iovlen, __pad1;
-#endif
- void *msg_control;
-#if __BYTE_ORDER == __BIG_ENDIAN
- int __pad2;
- socklen_t msg_controllen;
-#else
- socklen_t msg_controllen;
- int __pad2;
-#endif
- int msg_flags;
-};
-
-struct cmsghdr {
-#if __BYTE_ORDER == __BIG_ENDIAN
- int __pad1;
- socklen_t cmsg_len;
-#else
- socklen_t cmsg_len;
- int __pad1;
-#endif
- int cmsg_level;
- int cmsg_type;
-};
-
#define SOCK_STREAM 2
#define SOCK_DGRAM 1
#define SOL_SOCKET 65535
diff --git a/arch/mips64/bits/stat.h b/arch/mips64/bits/stat.h
index b46617f1..b620e142 100644
--- a/arch/mips64/bits/stat.h
+++ b/arch/mips64/bits/stat.h
@@ -1,6 +1,3 @@
-#include <string.h>
-#include <bits/alltypes.h>
-
struct stat {
dev_t st_dev;
int __pad1[3];
diff --git a/arch/mips64/bits/stdint.h b/arch/mips64/bits/stdint.h
deleted file mode 100644
index 1bb147f2..00000000
--- a/arch/mips64/bits/stdint.h
+++ /dev/null
@@ -1,20 +0,0 @@
-typedef int32_t int_fast16_t;
-typedef int32_t int_fast32_t;
-typedef uint32_t uint_fast16_t;
-typedef uint32_t uint_fast32_t;
-
-#define INT_FAST16_MIN INT32_MIN
-#define INT_FAST32_MIN INT32_MIN
-
-#define INT_FAST16_MAX INT32_MAX
-#define INT_FAST32_MAX INT32_MAX
-
-#define UINT_FAST16_MAX UINT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-#define UINTPTR_MAX UINT64_MAX
-#define PTRDIFF_MIN INT64_MIN
-#define PTRDIFF_MAX INT64_MAX
-#define SIZE_MAX UINT64_MAX
diff --git a/arch/mips64/bits/syscall.h.in b/arch/mips64/bits/syscall.h.in
index f814aa48..50cec45a 100644
--- a/arch/mips64/bits/syscall.h.in
+++ b/arch/mips64/bits/syscall.h.in
@@ -324,6 +324,33 @@
#define __NR_pkey_alloc 5324
#define __NR_pkey_free 5325
#define __NR_statx 5326
-#define __NR_rseq 4327
-#define __NR_io_pgetevents 4328
+#define __NR_rseq 5327
+#define __NR_io_pgetevents 5328
+#define __NR_pidfd_send_signal 5424
+#define __NR_io_uring_setup 5425
+#define __NR_io_uring_enter 5426
+#define __NR_io_uring_register 5427
+#define __NR_open_tree 5428
+#define __NR_move_mount 5429
+#define __NR_fsopen 5430
+#define __NR_fsconfig 5431
+#define __NR_fsmount 5432
+#define __NR_fspick 5433
+#define __NR_pidfd_open 5434
+#define __NR_clone3 5435
+#define __NR_close_range 5436
+#define __NR_openat2 5437
+#define __NR_pidfd_getfd 5438
+#define __NR_faccessat2 5439
+#define __NR_process_madvise 5440
+#define __NR_epoll_pwait2 5441
+#define __NR_mount_setattr 5442
+#define __NR_landlock_create_ruleset 5444
+#define __NR_landlock_add_rule 5445
+#define __NR_landlock_restrict_self 5446
+#define __NR_process_mrelease 5448
+#define __NR_futex_waitv 5449
+#define __NR_set_mempolicy_home_node 5450
+#define __NR_cachestat 5451
+#define __NR_fchmodat2 5452
diff --git a/arch/mips64/bits/termios.h b/arch/mips64/bits/termios.h
index f7b9dd2e..9d571f78 100644
--- a/arch/mips64/bits/termios.h
+++ b/arch/mips64/bits/termios.h
@@ -165,5 +165,5 @@ struct termios {
#define EXTPROC 0200000
#define XTABS 0014000
-#define TIOCSER_TEMT 0x01
+#define TIOCSER_TEMT 1
#endif
diff --git a/arch/mips64/ksigaction.h b/arch/mips64/ksigaction.h
index c16e4731..b4d0fa5f 100644
--- a/arch/mips64/ksigaction.h
+++ b/arch/mips64/ksigaction.h
@@ -4,7 +4,7 @@ struct k_sigaction {
unsigned flags;
void (*handler)(int);
unsigned long mask[2];
- void (*restorer)();
+ void *unused;
};
hidden void __restore(), __restore_rt();
diff --git a/arch/mips64/kstat.h b/arch/mips64/kstat.h
new file mode 100644
index 00000000..9a4468b4
--- /dev/null
+++ b/arch/mips64/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ unsigned st_dev;
+ int __pad1[3];
+ ino_t st_ino;
+ mode_t st_mode;
+ unsigned st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned st_rdev;
+ int __pad2[3];
+ off_t st_size;
+ int st_atime_sec;
+ int st_atime_nsec;
+ int st_mtime_sec;
+ int st_mtime_nsec;
+ int st_ctime_sec;
+ int st_ctime_nsec;
+ unsigned st_blksize;
+ unsigned __pad3;
+ blkcnt_t st_blocks;
+};
diff --git a/arch/mips64/pthread_arch.h b/arch/mips64/pthread_arch.h
index 1e7839ea..c45347ab 100644
--- a/arch/mips64/pthread_arch.h
+++ b/arch/mips64/pthread_arch.h
@@ -1,19 +1,19 @@
-static inline struct pthread *__pthread_self()
+static inline uintptr_t __get_tp()
{
#if __mips_isa_rev < 2
- register char *tp __asm__("$3");
+ register uintptr_t tp __asm__("$3");
__asm__ (".word 0x7c03e83b" : "=r" (tp) );
#else
- char *tp;
+ uintptr_t tp;
__asm__ ("rdhwr %0, $29" : "=r" (tp) );
#endif
- return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
+ return tp;
}
#define TLS_ABOVE_TP
#define GAP_ABOVE_TP 0
-#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
+#define TP_OFFSET 0x7000
#define DTP_OFFSET 0x8000
#define MC_PC pc
diff --git a/arch/mips64/reloc.h b/arch/mips64/reloc.h
index bbd9bd9d..145d8b0b 100644
--- a/arch/mips64/reloc.h
+++ b/arch/mips64/reloc.h
@@ -1,9 +1,3 @@
-#ifndef __RELOC_H__
-#define __RELOC_H__
-
-#define _GNU_SOURCE
-#include <endian.h>
-
#if __mips_isa_rev >= 6
#define ISA_SUFFIX "r6"
#else
@@ -33,6 +27,8 @@
#define REL_DTPOFF R_MIPS_TLS_DTPREL64
#define REL_TPOFF R_MIPS_TLS_TPREL64
+#include <endian.h>
+
#undef R_TYPE
#undef R_SYM
#undef R_INFO
@@ -42,6 +38,7 @@
#define NEED_MIPS_GOT_RELOCS 1
#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
+#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL
#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
#define CRTJMP(pc,sp) __asm__ __volatile__( \
@@ -62,5 +59,3 @@
" daddu %0, %0, $ra \n" \
".set pop \n" \
: "=r"(*(fp)) : : "memory", "ra" )
-
-#endif
diff --git a/arch/mips64/syscall_arch.h b/arch/mips64/syscall_arch.h
index 99eebc32..ae6532fc 100644
--- a/arch/mips64/syscall_arch.h
+++ b/arch/mips64/syscall_arch.h
@@ -3,48 +3,15 @@
#define SYSCALL_RLIM_INFINITY (-1UL/2)
-#include <sys/stat.h>
-struct kernel_stat {
- unsigned int st_dev;
- unsigned int __pad1[3];
- unsigned long long st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
- int st_uid;
- int st_gid;
- unsigned int st_rdev;
- unsigned int __pad2[3];
- long long st_size;
- unsigned int st_atime_sec;
- unsigned int st_atime_nsec;
- unsigned int st_mtime_sec;
- unsigned int st_mtime_nsec;
- unsigned int st_ctime_sec;
- unsigned int st_ctime_nsec;
- unsigned int st_blksize;
- unsigned int __pad3;
- unsigned long long st_blocks;
-};
-
-static void __stat_fix(struct kernel_stat *kst, struct stat *st)
-{
- st->st_dev = kst->st_dev;
- st->st_ino = kst->st_ino;
- st->st_mode = kst->st_mode;
- st->st_nlink = kst->st_nlink;
- st->st_uid = kst->st_uid;
- st->st_gid = kst->st_gid;
- st->st_rdev = kst->st_rdev;
- st->st_size = kst->st_size;
- st->st_atim.tv_sec = kst->st_atime_sec;
- st->st_atim.tv_nsec = kst->st_atime_nsec;
- st->st_mtim.tv_sec = kst->st_mtime_sec;
- st->st_mtim.tv_nsec = kst->st_mtime_nsec;
- st->st_ctim.tv_sec = kst->st_ctime_sec;
- st->st_ctim.tv_nsec = kst->st_ctime_nsec;
- st->st_blksize = kst->st_blksize;
- st->st_blocks = kst->st_blocks;
-}
+#if __mips_isa_rev >= 6
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+#else
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+#endif
static inline long __syscall0(long n)
{
@@ -52,10 +19,10 @@ static inline long __syscall0(long n)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7)
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
- return r7 ? -r2 : r2;
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall1(long n, long a)
@@ -65,107 +32,61 @@ static inline long __syscall1(long n, long a)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
- "r"(r4)
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
- return r7 ? -r2 : r2;
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall2(long n, long a, long b)
{
- struct kernel_stat kst;
- long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- r5 = (long) &kst;
-
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
- "r"(r4), "r"(r5)
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
-
- if (r7) return -r2;
- ret = r2;
-
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- __stat_fix(&kst, (struct stat *)b);
-
- return ret;
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall3(long n, long a, long b, long c)
{
- struct kernel_stat kst;
- long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
register long r7 __asm__("$7");
register long r2 __asm__("$2");
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- r5 = (long) &kst;
-
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
- "r"(r4), "r"(r5), "r"(r6)
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
-
- if (r7) return -r2;
- ret = r2;
-
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- __stat_fix(&kst, (struct stat *)b);
-
- return ret;
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall4(long n, long a, long b, long c, long d)
{
- struct kernel_stat kst;
- long ret;
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 r2 __asm__("$2");
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- r5 = (long) &kst;
- if (n == SYS_newfstatat)
- r6 = (long) &kst;
-
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
- "r"(r4), "r"(r5), "r"(r6)
- : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
-
- if (r7) return -r2;
- ret = r2;
-
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- __stat_fix(&kst, (struct stat *)b);
- if (n == SYS_newfstatat)
- __stat_fix(&kst, (struct stat *)c);
-
- return ret;
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
{
- struct kernel_stat kst;
- long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
@@ -173,33 +94,16 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
register long r8 __asm__("$8") = e;
register long r2 __asm__("$2");
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- r5 = (long) &kst;
- if (n == SYS_newfstatat)
- r6 = (long) &kst;
-
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
- "r"(r4), "r"(r5), "r"(r6), "r"(r8)
- : "$1", "$3", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
-
- if (r7) return -r2;
- ret = r2;
-
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- __stat_fix(&kst, (struct stat *)b);
- if (n == SYS_newfstatat)
- __stat_fix(&kst, (struct stat *)c);
-
- return ret;
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
{
- struct kernel_stat kst;
- long ret;
register long r4 __asm__("$4") = a;
register long r5 __asm__("$5") = b;
register long r6 __asm__("$6") = c;
@@ -208,29 +112,17 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
register long r9 __asm__("$9") = f;
register long r2 __asm__("$2");
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- r5 = (long) &kst;
- if (n == SYS_newfstatat)
- r6 = (long) &kst;
-
__asm__ __volatile__ (
"daddu $2,$0,%2 ; syscall"
- : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7),
- "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
- : "$1", "$3", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
-
- if (r7) return -r2;
- ret = r2;
-
- if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat)
- __stat_fix(&kst, (struct stat *)b);
- if (n == SYS_newfstatat)
- __stat_fix(&kst, (struct stat *)c);
-
- return ret;
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
#define VDSO_USEFUL
#define VDSO_CGT_SYM "__vdso_clock_gettime"
#define VDSO_CGT_VER "LINUX_2.6"
+
+#define SO_SNDTIMEO_OLD 0x1005
+#define SO_RCVTIMEO_OLD 0x1006