diff options
Diffstat (limited to 'arch/mips64')
-rw-r--r-- | arch/mips64/bits/alltypes.h.in | 20 | ||||
-rw-r--r-- | arch/mips64/bits/endian.h | 5 | ||||
-rw-r--r-- | arch/mips64/bits/fcntl.h | 2 | ||||
-rw-r--r-- | arch/mips64/bits/ioctl.h | 98 | ||||
-rw-r--r-- | arch/mips64/bits/ipc.h | 2 | ||||
-rw-r--r-- | arch/mips64/bits/limits.h | 7 | ||||
-rw-r--r-- | arch/mips64/bits/msg.h | 13 | ||||
-rw-r--r-- | arch/mips64/bits/sem.h | 14 | ||||
-rw-r--r-- | arch/mips64/bits/shm.h | 24 | ||||
-rw-r--r-- | arch/mips64/bits/signal.h | 3 | ||||
-rw-r--r-- | arch/mips64/bits/socket.h | 34 | ||||
-rw-r--r-- | arch/mips64/bits/stat.h | 3 | ||||
-rw-r--r-- | arch/mips64/bits/syscall.h.in | 31 | ||||
-rw-r--r-- | arch/mips64/bits/termios.h | 2 | ||||
-rw-r--r-- | arch/mips64/ksigaction.h | 2 | ||||
-rw-r--r-- | arch/mips64/kstat.h | 21 | ||||
-rw-r--r-- | arch/mips64/pthread_arch.h | 10 | ||||
-rw-r--r-- | arch/mips64/reloc.h | 11 | ||||
-rw-r--r-- | arch/mips64/syscall_arch.h | 229 |
19 files changed, 135 insertions, 396 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/ioctl.h b/arch/mips64/bits/ioctl.h index b8f77cb5..e277c3f0 100644 --- a/arch/mips64/bits/ioctl.h +++ b/arch/mips64/bits/ioctl.h @@ -90,24 +90,6 @@ #define TIOCMIWAIT 0x5491 #define TIOCGICOUNT 0x5492 -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 -#define TIOCPKT_IOCTL 64 - -#define TIOCSER_TEMT 0x01 - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 @@ -123,23 +105,6 @@ struct winsize { #define TIOCM_OUT2 0x4000 #define TIOCM_LOOP 0x8000 -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 -#define N_STRIP 4 -#define N_AX25 5 -#define N_X25 6 -#define N_6PACK 7 -#define N_MASC 8 -#define N_R3964 9 -#define N_PROFIBUS_FDL 10 -#define N_IRDA 11 -#define N_SMSBLOCK 12 -#define N_HDLC 13 -#define N_SYNC_PPP 14 -#define N_HCI 15 - #define FIOGETOWN _IOR('f', 123, int) #define FIOSETOWN _IOW('f', 124, int) #define SIOCATMARK _IOR('s', 7, int) @@ -147,66 +112,3 @@ struct winsize { #define SIOCGPGRP _IOR('s', 9, pid_t) #define SIOCGSTAMP 0x8906 #define SIOCGSTAMPNS 0x8907 - -#define SIOCADDRT 0x890B -#define SIOCDELRT 0x890C -#define SIOCRTMSG 0x890D - -#define SIOCGIFNAME 0x8910 -#define SIOCSIFLINK 0x8911 -#define SIOCGIFCONF 0x8912 -#define SIOCGIFFLAGS 0x8913 -#define SIOCSIFFLAGS 0x8914 -#define SIOCGIFADDR 0x8915 -#define SIOCSIFADDR 0x8916 -#define SIOCGIFDSTADDR 0x8917 -#define SIOCSIFDSTADDR 0x8918 -#define SIOCGIFBRDADDR 0x8919 -#define SIOCSIFBRDADDR 0x891a -#define SIOCGIFNETMASK 0x891b -#define SIOCSIFNETMASK 0x891c -#define SIOCGIFMETRIC 0x891d -#define SIOCSIFMETRIC 0x891e -#define SIOCGIFMEM 0x891f -#define SIOCSIFMEM 0x8920 -#define SIOCGIFMTU 0x8921 -#define SIOCSIFMTU 0x8922 -#define SIOCSIFNAME 0x8923 -#define SIOCSIFHWADDR 0x8924 -#define SIOCGIFENCAP 0x8925 -#define SIOCSIFENCAP 0x8926 -#define SIOCGIFHWADDR 0x8927 -#define SIOCGIFSLAVE 0x8929 -#define SIOCSIFSLAVE 0x8930 -#define SIOCADDMULTI 0x8931 -#define SIOCDELMULTI 0x8932 -#define SIOCGIFINDEX 0x8933 -#define SIOGIFINDEX SIOCGIFINDEX -#define SIOCSIFPFLAGS 0x8934 -#define SIOCGIFPFLAGS 0x8935 -#define SIOCDIFADDR 0x8936 -#define SIOCSIFHWBROADCAST 0x8937 -#define SIOCGIFCOUNT 0x8938 - -#define SIOCGIFBR 0x8940 -#define SIOCSIFBR 0x8941 - -#define SIOCGIFTXQLEN 0x8942 -#define SIOCSIFTXQLEN 0x8943 - -#define SIOCDARP 0x8953 -#define SIOCGARP 0x8954 -#define SIOCSARP 0x8955 - -#define SIOCDRARP 0x8960 -#define SIOCGRARP 0x8961 -#define SIOCSRARP 0x8962 - -#define SIOCGIFMAP 0x8970 -#define SIOCSIFMAP 0x8971 - -#define SIOCADDDLCI 0x8980 -#define SIOCDELDLCI 0x8981 - -#define SIOCDEVPRIVATE 0x89F0 -#define SIOCPROTOPRIVATE 0x89E0 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/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/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 5eabdf46..ae6532fc 100644 --- a/arch/mips64/syscall_arch.h +++ b/arch/mips64/syscall_arch.h @@ -1,53 +1,17 @@ #define __SYSCALL_LL_E(x) (x) #define __SYSCALL_LL_O(x) (x) -__attribute__((visibility("hidden"))) -long (__syscall)(long, ...); - #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) { @@ -55,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) @@ -68,158 +32,97 @@ 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"); - register long r5 __asm__("$5"); + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; register long r7 __asm__("$7"); register long r2 __asm__("$2"); - r5 = b; - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) - r5 = (long) &kst; - - r4 = a; __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"); - register long r5 __asm__("$5"); - register long r6 __asm__("$6"); + 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"); - r5 = b; - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) - r5 = (long) &kst; - - r4 = a; - r6 = c; __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"); - register long r5 __asm__("$5"); - register long r6 __asm__("$6"); - register long r7 __asm__("$7"); + 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"); - r4 = a; - r5 = b; - r6 = c; - r7 = d; - 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) { - long r2; - long old_b = b; - long old_c = c; - struct kernel_stat kst; - - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) - b = (long) &kst; - if (n == SYS_newfstatat) - c = (long) &kst; - - r2 = (__syscall)(n, a, b, c, d, e); - if (r2 > -4096UL) return r2; - - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) - __stat_fix(&kst, (struct stat *)old_b); - if (n == SYS_newfstatat) - __stat_fix(&kst, (struct stat *)old_c); + 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 r2 __asm__("$2"); - return r2; + __asm__ __volatile__ ( + "daddu $2,$0,%2 ; syscall" + : "=&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) { - long r2; - long old_b = b; - long old_c = c; - struct kernel_stat kst; - - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) - b = (long) &kst; - if (n == SYS_newfstatat) - c = (long) &kst; - - r2 = (__syscall)(n, a, b, c, d, e, f); - if (r2 > -4096UL) return r2; - - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) - __stat_fix(&kst, (struct stat *)old_b); - if (n == SYS_newfstatat) - __stat_fix(&kst, (struct stat *)old_c); + 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 r2 __asm__("$2"); - return r2; + __asm__ __volatile__ ( + "daddu $2,$0,%2 ; syscall" + : "=&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 |