summaryrefslogtreecommitdiff
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/arch.mak1
-rw-r--r--arch/mips/bits/alltypes.h.in21
-rw-r--r--arch/mips/bits/endian.h5
-rw-r--r--arch/mips/bits/hwcap.h11
-rw-r--r--arch/mips/bits/ioctl.h4
-rw-r--r--arch/mips/bits/ipcstat.h1
-rw-r--r--arch/mips/bits/limits.h7
-rw-r--r--arch/mips/bits/msg.h27
-rw-r--r--arch/mips/bits/posix.h2
-rw-r--r--arch/mips/bits/reg.h3
-rw-r--r--arch/mips/bits/sem.h14
-rw-r--r--arch/mips/bits/shm.h16
-rw-r--r--arch/mips/bits/signal.h11
-rw-r--r--arch/mips/bits/socket.h18
-rw-r--r--arch/mips/bits/stat.h12
-rw-r--r--arch/mips/bits/stdint.h20
-rw-r--r--arch/mips/bits/syscall.h.in77
-rw-r--r--arch/mips/bits/termios.h2
-rw-r--r--arch/mips/ksigaction.h5
-rw-r--r--arch/mips/kstat.h22
-rw-r--r--arch/mips/pthread_arch.h9
-rw-r--r--arch/mips/reloc.h3
-rw-r--r--arch/mips/syscall_arch.h118
23 files changed, 214 insertions, 195 deletions
diff --git a/arch/mips/arch.mak b/arch/mips/arch.mak
new file mode 100644
index 00000000..aa4d05ce
--- /dev/null
+++ b/arch/mips/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/arch/mips/bits/alltypes.h.in b/arch/mips/bits/alltypes.h.in
index 66ca18ad..ff934a4c 100644
--- a/arch/mips/bits/alltypes.h.in
+++ b/arch/mips/bits/alltypes.h.in
@@ -1,9 +1,15 @@
+#define _REDIR_TIME64 1
#define _Addr int
#define _Int64 long long
#define _Reg int
-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 0x7fffffffL
#ifndef __cplusplus
TYPEDEF int wchar_t;
@@ -13,14 +19,3 @@ TYPEDEF float float_t;
TYPEDEF double double_t;
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
-
-TYPEDEF long time_t;
-TYPEDEF long suseconds_t;
-
-TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
-TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
-TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
-TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
-TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
-TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
diff --git a/arch/mips/bits/endian.h b/arch/mips/bits/endian.h
deleted file mode 100644
index 5399dcb5..00000000
--- a/arch/mips/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/mips/bits/hwcap.h b/arch/mips/bits/hwcap.h
index 13e86fe7..7986deb7 100644
--- a/arch/mips/bits/hwcap.h
+++ b/arch/mips/bits/hwcap.h
@@ -1,3 +1,14 @@
#define HWCAP_MIPS_R6 (1 << 0)
#define HWCAP_MIPS_MSA (1 << 1)
#define HWCAP_MIPS_CRC32 (1 << 2)
+#define HWCAP_MIPS_MIPS16 (1 << 3)
+#define HWCAP_MIPS_MDMX (1 << 4)
+#define HWCAP_MIPS_MIPS3D (1 << 5)
+#define HWCAP_MIPS_SMARTMIPS (1 << 6)
+#define HWCAP_MIPS_DSP (1 << 7)
+#define HWCAP_MIPS_DSP2 (1 << 8)
+#define HWCAP_MIPS_DSP3 (1 << 9)
+#define HWCAP_MIPS_MIPS16E2 (1 << 10)
+#define HWCAP_LOONGSON_MMI (1 << 11)
+#define HWCAP_LOONGSON_EXT (1 << 12)
+#define HWCAP_LOONGSON_EXT2 (1 << 13)
diff --git a/arch/mips/bits/ioctl.h b/arch/mips/bits/ioctl.h
index e277c3f0..e20bf19e 100644
--- a/arch/mips/bits/ioctl.h
+++ b/arch/mips/bits/ioctl.h
@@ -110,5 +110,5 @@
#define SIOCATMARK _IOR('s', 7, int)
#define SIOCSPGRP _IOW('s', 8, pid_t)
#define SIOCGPGRP _IOR('s', 9, pid_t)
-#define SIOCGSTAMP 0x8906
-#define SIOCGSTAMPNS 0x8907
+#define SIOCGSTAMP _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
diff --git a/arch/mips/bits/ipcstat.h b/arch/mips/bits/ipcstat.h
new file mode 100644
index 00000000..4f4fcb0c
--- /dev/null
+++ b/arch/mips/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/arch/mips/bits/limits.h b/arch/mips/bits/limits.h
deleted file mode 100644
index fbc6d238..00000000
--- a/arch/mips/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 32
-#endif
-
-#define LONG_MAX 0x7fffffffL
-#define LLONG_MAX 0x7fffffffffffffffLL
diff --git a/arch/mips/bits/msg.h b/arch/mips/bits/msg.h
index f28aece8..c734dbb5 100644
--- a/arch/mips/bits/msg.h
+++ b/arch/mips/bits/msg.h
@@ -1,19 +1,19 @@
struct msqid_ds {
struct ipc_perm msg_perm;
#if _MIPSEL || __MIPSEL || __MIPSEL__
- time_t msg_stime;
- int __unused1;
- time_t msg_rtime;
- int __unused2;
- time_t msg_ctime;
- int __unused3;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
#else
- int __unused1;
- time_t msg_stime;
- int __unused2;
- time_t msg_rtime;
- int __unused3;
- time_t msg_ctime;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long __msg_ctime_lo;
#endif
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
@@ -21,4 +21,7 @@ struct msqid_ds {
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
};
diff --git a/arch/mips/bits/posix.h b/arch/mips/bits/posix.h
deleted file mode 100644
index 30a38714..00000000
--- a/arch/mips/bits/posix.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define _POSIX_V6_ILP32_OFFBIG 1
-#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/arch/mips/bits/reg.h b/arch/mips/bits/reg.h
index 0c370987..2611b632 100644
--- a/arch/mips/bits/reg.h
+++ b/arch/mips/bits/reg.h
@@ -1,6 +1,3 @@
-#undef __WORDSIZE
-#define __WORDSIZE 32
-
#define EF_R0 6
#define EF_R1 7
#define EF_R2 8
diff --git a/arch/mips/bits/sem.h b/arch/mips/bits/sem.h
index e46ced95..fe6f0948 100644
--- a/arch/mips/bits/sem.h
+++ b/arch/mips/bits/sem.h
@@ -1,14 +1,16 @@
struct semid_ds {
struct ipc_perm sem_perm;
- time_t sem_otime;
- time_t sem_ctime;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_ctime_lo;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
- char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
- char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
unsigned short sem_nsems;
#endif
- time_t __unused3;
- time_t __unused4;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_hi;
+ time_t sem_otime;
+ time_t sem_ctime;
};
diff --git a/arch/mips/bits/shm.h b/arch/mips/bits/shm.h
index 6652d659..ab8c642d 100644
--- a/arch/mips/bits/shm.h
+++ b/arch/mips/bits/shm.h
@@ -3,14 +3,19 @@
struct shmid_ds {
struct ipc_perm shm_perm;
size_t shm_segsz;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_ctime_lo;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
- unsigned long __pad1;
- unsigned long __pad2;
+ unsigned short __shm_atime_hi;
+ unsigned short __shm_dtime_hi;
+ unsigned short __shm_ctime_hi;
+ unsigned short __pad1;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
};
struct shminfo {
@@ -22,4 +27,3 @@ struct shm_info {
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};
-
diff --git a/arch/mips/bits/signal.h b/arch/mips/bits/signal.h
index 1a84de59..a3b3857a 100644
--- a/arch/mips/bits/signal.h
+++ b/arch/mips/bits/signal.h
@@ -19,14 +19,18 @@ typedef struct {
} fpregset_t;
struct sigcontext {
unsigned sc_regmask, sc_status;
- unsigned long long sc_pc, sc_regs[32], sc_fpregs[32];
+ unsigned long long sc_pc;
+ gregset_t sc_regs;
+ fpregset_t sc_fpregs;
unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
unsigned long long sc_mdhi, sc_mdlo;
unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3;
};
typedef struct {
unsigned regmask, status;
- unsigned long long pc, gregs[32], fpregs[32];
+ unsigned long long pc;
+ gregset_t gregs;
+ fpregset_t fpregs;
unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp;
unsigned long long mdhi, mdlo;
unsigned long hi1, lo1, hi2, lo2, hi3, lo3;
@@ -62,7 +66,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
@@ -89,7 +92,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/mips/bits/socket.h b/arch/mips/bits/socket.h
index b82c7d34..02fbb88b 100644
--- a/arch/mips/bits/socket.h
+++ b/arch/mips/bits/socket.h
@@ -1,19 +1,3 @@
-struct msghdr {
- void *msg_name;
- socklen_t msg_namelen;
- struct iovec *msg_iov;
- int msg_iovlen;
- void *msg_control;
- socklen_t msg_controllen;
- int msg_flags;
-};
-
-struct cmsghdr {
- socklen_t cmsg_len;
- int cmsg_level;
- int cmsg_type;
-};
-
#define SOCK_STREAM 2
#define SOCK_DGRAM 1
@@ -32,8 +16,6 @@ struct cmsghdr {
#define SO_RCVBUF 0x1002
#define SO_SNDLOWAT 0x1003
#define SO_RCVLOWAT 0x1004
-#define SO_RCVTIMEO 0x1006
-#define SO_SNDTIMEO 0x1005
#define SO_ERROR 0x1007
#define SO_TYPE 0x1008
#define SO_ACCEPTCONN 0x1009
diff --git a/arch/mips/bits/stat.h b/arch/mips/bits/stat.h
index 3291a636..48d4ac80 100644
--- a/arch/mips/bits/stat.h
+++ b/arch/mips/bits/stat.h
@@ -12,11 +12,15 @@ struct stat {
dev_t st_rdev;
long __st_padding2[2];
off_t st_size;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
blksize_t st_blksize;
long __st_padding3;
blkcnt_t st_blocks;
- long __st_padding4[14];
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ long __st_padding4[2];
};
diff --git a/arch/mips/bits/stdint.h b/arch/mips/bits/stdint.h
deleted file mode 100644
index d1b27121..00000000
--- a/arch/mips/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 INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#define UINTPTR_MAX UINT32_MAX
-#define PTRDIFF_MIN INT32_MIN
-#define PTRDIFF_MAX INT32_MAX
-#define SIZE_MAX UINT32_MAX
diff --git a/arch/mips/bits/syscall.h.in b/arch/mips/bits/syscall.h.in
index be8c3207..55e35742 100644
--- a/arch/mips/bits/syscall.h.in
+++ b/arch/mips/bits/syscall.h.in
@@ -76,8 +76,8 @@
#define __NR_setrlimit 4075
#define __NR_getrlimit 4076
#define __NR_getrusage 4077
-#define __NR_gettimeofday 4078
-#define __NR_settimeofday 4079
+#define __NR_gettimeofday_time32 4078
+#define __NR_settimeofday_time32 4079
#define __NR_getgroups 4080
#define __NR_setgroups 4081
#define __NR_reserved82 4082
@@ -256,14 +256,14 @@
#define __NR_statfs64 4255
#define __NR_fstatfs64 4256
#define __NR_timer_create 4257
-#define __NR_timer_settime 4258
-#define __NR_timer_gettime 4259
+#define __NR_timer_settime32 4258
+#define __NR_timer_gettime32 4259
#define __NR_timer_getoverrun 4260
#define __NR_timer_delete 4261
-#define __NR_clock_settime 4262
-#define __NR_clock_gettime 4263
-#define __NR_clock_getres 4264
-#define __NR_clock_nanosleep 4265
+#define __NR_clock_settime32 4262
+#define __NR_clock_gettime32 4263
+#define __NR_clock_getres_time32 4264
+#define __NR_clock_nanosleep_time32 4265
#define __NR_tgkill 4266
#define __NR_utimes 4267
#define __NR_mbind 4268
@@ -319,8 +319,8 @@
#define __NR_eventfd 4319
#define __NR_fallocate 4320
#define __NR_timerfd_create 4321
-#define __NR_timerfd_gettime 4322
-#define __NR_timerfd_settime 4323
+#define __NR_timerfd_gettime32 4322
+#define __NR_timerfd_settime32 4323
#define __NR_signalfd4 4324
#define __NR_eventfd2 4325
#define __NR_epoll_create1 4326
@@ -366,4 +366,61 @@
#define __NR_statx 4366
#define __NR_rseq 4367
#define __NR_io_pgetevents 4368
+#define __NR_semget 4393
+#define __NR_semctl 4394
+#define __NR_shmget 4395
+#define __NR_shmctl 4396
+#define __NR_shmat 4397
+#define __NR_shmdt 4398
+#define __NR_msgget 4399
+#define __NR_msgsnd 4400
+#define __NR_msgrcv 4401
+#define __NR_msgctl 4402
+#define __NR_clock_gettime64 4403
+#define __NR_clock_settime64 4404
+#define __NR_clock_adjtime64 4405
+#define __NR_clock_getres_time64 4406
+#define __NR_clock_nanosleep_time64 4407
+#define __NR_timer_gettime64 4408
+#define __NR_timer_settime64 4409
+#define __NR_timerfd_gettime64 4410
+#define __NR_timerfd_settime64 4411
+#define __NR_utimensat_time64 4412
+#define __NR_pselect6_time64 4413
+#define __NR_ppoll_time64 4414
+#define __NR_io_pgetevents_time64 4416
+#define __NR_recvmmsg_time64 4417
+#define __NR_mq_timedsend_time64 4418
+#define __NR_mq_timedreceive_time64 4419
+#define __NR_semtimedop_time64 4420
+#define __NR_rt_sigtimedwait_time64 4421
+#define __NR_futex_time64 4422
+#define __NR_sched_rr_get_interval_time64 4423
+#define __NR_pidfd_send_signal 4424
+#define __NR_io_uring_setup 4425
+#define __NR_io_uring_enter 4426
+#define __NR_io_uring_register 4427
+#define __NR_open_tree 4428
+#define __NR_move_mount 4429
+#define __NR_fsopen 4430
+#define __NR_fsconfig 4431
+#define __NR_fsmount 4432
+#define __NR_fspick 4433
+#define __NR_pidfd_open 4434
+#define __NR_clone3 4435
+#define __NR_close_range 4436
+#define __NR_openat2 4437
+#define __NR_pidfd_getfd 4438
+#define __NR_faccessat2 4439
+#define __NR_process_madvise 4440
+#define __NR_epoll_pwait2 4441
+#define __NR_mount_setattr 4442
+#define __NR_landlock_create_ruleset 4444
+#define __NR_landlock_add_rule 4445
+#define __NR_landlock_restrict_self 4446
+#define __NR_process_mrelease 4448
+#define __NR_futex_waitv 4449
+#define __NR_set_mempolicy_home_node 4450
+#define __NR_cachestat 4451
+#define __NR_fchmodat2 4452
diff --git a/arch/mips/bits/termios.h b/arch/mips/bits/termios.h
index f7b9dd2e..9d571f78 100644
--- a/arch/mips/bits/termios.h
+++ b/arch/mips/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/mips/ksigaction.h b/arch/mips/ksigaction.h
index 63fdfab0..485abf75 100644
--- a/arch/mips/ksigaction.h
+++ b/arch/mips/ksigaction.h
@@ -4,10 +4,7 @@ struct k_sigaction {
unsigned flags;
void (*handler)(int);
unsigned long mask[4];
- /* The following field is past the end of the structure the
- * kernel will read or write, and exists only to avoid having
- * mips-specific preprocessor conditionals in sigaction.c. */
- void (*restorer)();
+ void *unused;
};
hidden void __restore(), __restore_rt();
diff --git a/arch/mips/kstat.h b/arch/mips/kstat.h
new file mode 100644
index 00000000..5e637eab
--- /dev/null
+++ b/arch/mips/kstat.h
@@ -0,0 +1,22 @@
+struct kstat {
+ unsigned st_dev;
+ long __st_padding1[3];
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned st_rdev;
+ long __st_padding2[3];
+ off_t st_size;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ blksize_t st_blksize;
+ long __st_padding3;
+ blkcnt_t st_blocks;
+ long __st_padding4[14];
+};
diff --git a/arch/mips/pthread_arch.h b/arch/mips/pthread_arch.h
index 1e7839ea..376b7741 100644
--- a/arch/mips/pthread_arch.h
+++ b/arch/mips/pthread_arch.h
@@ -1,19 +1,18 @@
-static inline struct pthread *__pthread_self()
+static inline uintptr_t __get_tp()
{
+ register uintptr_t tp __asm__("$3");
#if __mips_isa_rev < 2
- register char *tp __asm__("$3");
__asm__ (".word 0x7c03e83b" : "=r" (tp) );
#else
- char *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/mips/reloc.h b/arch/mips/reloc.h
index b3d59a45..f4023b16 100644
--- a/arch/mips/reloc.h
+++ b/arch/mips/reloc.h
@@ -1,5 +1,3 @@
-#include <endian.h>
-
#if __mips_isa_rev >= 6
#define ISA_SUFFIX "r6"
#else
@@ -31,6 +29,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__( \
diff --git a/arch/mips/syscall_arch.h b/arch/mips/syscall_arch.h
index 43bcdee7..5b7c38de 100644
--- a/arch/mips/syscall_arch.h
+++ b/arch/mips/syscall_arch.h
@@ -5,16 +5,14 @@
#define SYSCALL_RLIM_INFINITY (-1UL/2)
-#if _MIPSEL || __MIPSEL || __MIPSEL__
-#define __stat_fix(st) ((st),(void)0)
+#if __mips_isa_rev >= 6
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
#else
-#include <sys/stat.h>
-static inline void __stat_fix(long p)
-{
- struct stat *st = (struct stat *)p;
- st->st_dev >>= 32;
- st->st_rdev >>= 32;
-}
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
#endif
static inline long __syscall0(long n)
@@ -23,10 +21,10 @@ static inline long __syscall0(long n)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"addu $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, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall1(long n, long a)
@@ -36,11 +34,10 @@ static inline long __syscall1(long n, long a)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"addu $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, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall2(long n, long a, long b)
@@ -51,14 +48,10 @@ static inline long __syscall2(long n, long a, long b)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"addu $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;
- long ret = r2;
- if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
- return ret;
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall3(long n, long a, long b, long c)
@@ -70,14 +63,10 @@ static inline long __syscall3(long n, long a, long b, long c)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"addu $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;
- long ret = r2;
- if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
- return ret;
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall4(long n, long a, long b, long c, long d)
@@ -89,15 +78,10 @@ static inline long __syscall4(long n, long a, long b, long c, long d)
register long r2 __asm__("$2");
__asm__ __volatile__ (
"addu $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;
- long ret = r2;
- if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
- if (n == SYS_fstatat64) __stat_fix(c);
- return ret;
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall5(long n, long a, long b, long c, long d, long e)
@@ -112,15 +96,10 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
"subu $sp,$sp,32 ; sw $8,16($sp) ; "
"addu $2,$0,%3 ; syscall ;"
"addu $sp,$sp,32"
- : "=&r"(r2), "=r"(r7), "+r"(r8)
- : "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6)
- : "$1", "$3", "$9", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
- if (r7) return -r2;
- long ret = r2;
- if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
- if (n == SYS_fstatat64) __stat_fix(c);
- return r2;
+ : "=&r"(r2), "+r"(r7), "+r"(r8)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
@@ -136,15 +115,10 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; "
"addu $2,$0,%4 ; syscall ;"
"addu $sp,$sp,32"
- : "=&r"(r2), "=r"(r7), "+r"(r8), "+r"(r9)
- : "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6)
- : "$1", "$3", "$10", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
- if (r7) return -r2;
- long ret = r2;
- if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
- if (n == SYS_fstatat64) __stat_fix(c);
- return r2;
+ : "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$10");
+ return r7 && r2>0 ? -r2 : r2;
}
static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
@@ -161,17 +135,19 @@ static inline long __syscall7(long n, long a, long b, long c, long d, long e, lo
"subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; sw $10,24($sp) ; "
"addu $2,$0,%5 ; syscall ;"
"addu $sp,$sp,32"
- : "=&r"(r2), "=r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
- : "ir"(n), "0"(r2), "1"(r7), "r"(r4), "r"(r5), "r"(r6)
- : "$1", "$3", "$11", "$12", "$13",
- "$14", "$15", "$24", "$25", "hi", "lo", "memory");
- if (r7) return -r2;
- long ret = r2;
- if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b);
- if (n == SYS_fstatat64) __stat_fix(c);
- return r2;
+ : "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
}
#define VDSO_USEFUL
-#define VDSO_CGT_SYM "__vdso_clock_gettime"
+#define VDSO_CGT32_SYM "__vdso_clock_gettime"
+#define VDSO_CGT32_VER "LINUX_2.6"
+#define VDSO_CGT_SYM "__vdso_clock_gettime64"
#define VDSO_CGT_VER "LINUX_2.6"
+
+#define SO_SNDTIMEO_OLD 0x1005
+#define SO_RCVTIMEO_OLD 0x1006
+
+#undef SYS_socketcall