diff options
Diffstat (limited to 'arch')
307 files changed, 4521 insertions, 2289 deletions
diff --git a/arch/aarch64/bits/alltypes.h.in b/arch/aarch64/bits/alltypes.h.in index d56abdac..c547ca0b 100644 --- a/arch/aarch64/bits/alltypes.h.in +++ b/arch/aarch64/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 __AARCH64EB__ +#define __BYTE_ORDER 4321 +#else +#define __BYTE_ORDER 1234 +#endif + +#define __LONG_MAX 0x7fffffffffffffffL #ifndef __cplusplus TYPEDEF unsigned wchar_t; @@ -17,14 +22,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[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/aarch64/bits/endian.h b/arch/aarch64/bits/endian.h deleted file mode 100644 index 7a74d2fe..00000000 --- a/arch/aarch64/bits/endian.h +++ /dev/null @@ -1,5 +0,0 @@ -#if __AARCH64EB__ -#define __BYTE_ORDER __BIG_ENDIAN -#else -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif diff --git a/arch/aarch64/bits/hwcap.h b/arch/aarch64/bits/hwcap.h index 8541e329..424cc4d4 100644 --- a/arch/aarch64/bits/hwcap.h +++ b/arch/aarch64/bits/hwcap.h @@ -26,3 +26,27 @@ #define HWCAP_USCAT (1 << 25) #define HWCAP_ILRCPC (1 << 26) #define HWCAP_FLAGM (1 << 27) +#define HWCAP_SSBS (1 << 28) +#define HWCAP_SB (1 << 29) +#define HWCAP_PACA (1 << 30) +#define HWCAP_PACG (1UL << 31) + +#define HWCAP2_DCPODP (1 << 0) +#define HWCAP2_SVE2 (1 << 1) +#define HWCAP2_SVEAES (1 << 2) +#define HWCAP2_SVEPMULL (1 << 3) +#define HWCAP2_SVEBITPERM (1 << 4) +#define HWCAP2_SVESHA3 (1 << 5) +#define HWCAP2_SVESM4 (1 << 6) +#define HWCAP2_FLAGM2 (1 << 7) +#define HWCAP2_FRINT (1 << 8) +#define HWCAP2_SVEI8MM (1 << 9) +#define HWCAP2_SVEF32MM (1 << 10) +#define HWCAP2_SVEF64MM (1 << 11) +#define HWCAP2_SVEBF16 (1 << 12) +#define HWCAP2_I8MM (1 << 13) +#define HWCAP2_BF16 (1 << 14) +#define HWCAP2_DGH (1 << 15) +#define HWCAP2_RNG (1 << 16) +#define HWCAP2_BTI (1 << 17) +#define HWCAP2_MTE (1 << 18) diff --git a/arch/aarch64/bits/ipc.h b/arch/aarch64/bits/ipc.h deleted file mode 100644 index 6f3328a8..00000000 --- a/arch/aarch64/bits/ipc.h +++ /dev/null @@ -1,14 +0,0 @@ -struct ipc_perm { - key_t __ipc_perm_key; - uid_t uid; - gid_t gid; - uid_t cuid; - gid_t cgid; - mode_t mode; - unsigned short __ipc_perm_seq; - - unsigned long __pad1; - unsigned long __pad2; -}; - -#define IPC_64 0 diff --git a/arch/aarch64/bits/limits.h b/arch/aarch64/bits/limits.h deleted file mode 100644 index 0226588c..00000000 --- a/arch/aarch64/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/aarch64/bits/mman.h b/arch/aarch64/bits/mman.h new file mode 100644 index 00000000..8fad5ceb --- /dev/null +++ b/arch/aarch64/bits/mman.h @@ -0,0 +1,2 @@ +#define PROT_BTI 0x10 +#define PROT_MTE 0x20 diff --git a/arch/aarch64/bits/msg.h b/arch/aarch64/bits/msg.h deleted file mode 100644 index 641e1703..00000000 --- a/arch/aarch64/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/aarch64/bits/sem.h b/arch/aarch64/bits/sem.h deleted file mode 100644 index e46ced95..00000000 --- a/arch/aarch64/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/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h index b71261f5..5098c734 100644 --- a/arch/aarch64/bits/signal.h +++ b/arch/aarch64/bits/signal.h @@ -11,7 +11,7 @@ typedef unsigned long greg_t; typedef unsigned long gregset_t[34]; typedef struct { - long double vregs[32]; + __uint128_t vregs[32]; unsigned int fpsr; unsigned int fpcr; } fpregset_t; @@ -34,7 +34,7 @@ struct fpsimd_context { struct _aarch64_ctx head; unsigned int fpsr; unsigned int fpcr; - long double vregs[32]; + __uint128_t vregs[32]; }; struct esr_context { struct _aarch64_ctx head; diff --git a/arch/aarch64/bits/socket.h b/arch/aarch64/bits/socket.h deleted file mode 100644 index c11677e9..00000000 --- a/arch/aarch64/bits/socket.h +++ /dev/null @@ -1,33 +0,0 @@ -#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; -}; diff --git a/arch/aarch64/bits/syscall.h.in b/arch/aarch64/bits/syscall.h.in index 47a969bc..ea5a152a 100644 --- a/arch/aarch64/bits/syscall.h.in +++ b/arch/aarch64/bits/syscall.h.in @@ -275,4 +275,33 @@ #define __NR_pkey_free 290 #define __NR_statx 291 #define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/aarch64/bits/user.h b/arch/aarch64/bits/user.h index d12cdf7f..8a1002aa 100644 --- a/arch/aarch64/bits/user.h +++ b/arch/aarch64/bits/user.h @@ -6,7 +6,7 @@ struct user_regs_struct { }; struct user_fpsimd_struct { - long double vregs[32]; + __uint128_t vregs[32]; unsigned int fpsr; unsigned int fpcr; }; diff --git a/arch/aarch64/fp_arch.h b/arch/aarch64/fp_arch.h new file mode 100644 index 00000000..f3d445b9 --- /dev/null +++ b/arch/aarch64/fp_arch.h @@ -0,0 +1,25 @@ +#define fp_barrierf fp_barrierf +static inline float fp_barrierf(float x) +{ + __asm__ __volatile__ ("" : "+w"(x)); + return x; +} + +#define fp_barrier fp_barrier +static inline double fp_barrier(double x) +{ + __asm__ __volatile__ ("" : "+w"(x)); + return x; +} + +#define fp_force_evalf fp_force_evalf +static inline void fp_force_evalf(float x) +{ + __asm__ __volatile__ ("" : "+w"(x)); +} + +#define fp_force_eval fp_force_eval +static inline void fp_force_eval(double x) +{ + __asm__ __volatile__ ("" : "+w"(x)); +} diff --git a/arch/aarch64/kstat.h b/arch/aarch64/kstat.h new file mode 100644 index 00000000..92625f36 --- /dev/null +++ b/arch/aarch64/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned __unused[2]; +}; diff --git a/arch/aarch64/pthread_arch.h b/arch/aarch64/pthread_arch.h index e64b126d..3909616c 100644 --- a/arch/aarch64/pthread_arch.h +++ b/arch/aarch64/pthread_arch.h @@ -1,12 +1,11 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - char *self; - __asm__ ("mrs %0,tpidr_el0" : "=r"(self)); - return (void*)(self - sizeof(struct pthread)); + uintptr_t tp; + __asm__ ("mrs %0,tpidr_el0" : "=r"(tp)); + return tp; } #define TLS_ABOVE_TP #define GAP_ABOVE_TP 16 -#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread)) #define MC_PC pc diff --git a/arch/aarch64/reloc.h b/arch/aarch64/reloc.h index 40cf0b28..b1b68c72 100644 --- a/arch/aarch64/reloc.h +++ b/arch/aarch64/reloc.h @@ -1,5 +1,3 @@ -#include <endian.h> - #if __BYTE_ORDER == __BIG_ENDIAN #define ENDIAN_SUFFIX "_be" #else diff --git a/arch/aarch64/syscall_arch.h b/arch/aarch64/syscall_arch.h index 25f5ce67..504983aa 100644 --- a/arch/aarch64/syscall_arch.h +++ b/arch/aarch64/syscall_arch.h @@ -74,3 +74,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo #define VDSO_USEFUL #define VDSO_CGT_SYM "__kernel_clock_gettime" #define VDSO_CGT_VER "LINUX_2.6.39" + +#define IPC_64 0 diff --git a/arch/arm/arch.mak b/arch/arm/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/arm/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h index e427836a..9e3937cc 100644 --- a/arch/arm/atomic_arch.h +++ b/arch/arm/atomic_arch.h @@ -83,7 +83,7 @@ static inline void a_crash() : : : "memory"); } -#if __ARM_ARCH >= 5 +#if __ARM_ARCH >= 5 && (!__thumb__ || __thumb2__) #define a_clz_32 a_clz_32 static inline int a_clz_32(uint32_t x) diff --git a/arch/arm/bits/alltypes.h.in b/arch/arm/bits/alltypes.h.in index 667963c7..d62bd7bd 100644 --- a/arch/arm/bits/alltypes.h.in +++ b/arch/arm/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 __ARMEB__ +#define __BYTE_ORDER 4321 +#else +#define __BYTE_ORDER 1234 +#endif + +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus TYPEDEF unsigned 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/arm/bits/endian.h b/arch/arm/bits/endian.h deleted file mode 100644 index 5953724a..00000000 --- a/arch/arm/bits/endian.h +++ /dev/null @@ -1,5 +0,0 @@ -#if __ARMEB__ -#define __BYTE_ORDER __BIG_ENDIAN -#else -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif diff --git a/arch/arm/bits/ipcstat.h b/arch/arm/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/arm/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/arm/bits/limits.h b/arch/arm/bits/limits.h deleted file mode 100644 index fbc6d238..00000000 --- a/arch/arm/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/s390x/bits/msg.h b/arch/arm/bits/msg.h index 2e23ca27..7bbbb2bf 100644 --- a/arch/s390x/bits/msg.h +++ b/arch/arm/bits/msg.h @@ -1,12 +1,18 @@ struct msqid_ds { struct ipc_perm msg_perm; - time_t msg_stime; - time_t msg_rtime; - time_t msg_ctime; + 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; unsigned long msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; 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/arm/bits/sem.h b/arch/arm/bits/sem.h new file mode 100644 index 00000000..544e3d2a --- /dev/null +++ b/arch/arm/bits/sem.h @@ -0,0 +1,18 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/arm/bits/shm.h b/arch/arm/bits/shm.h new file mode 100644 index 00000000..725fb469 --- /dev/null +++ b/arch/arm/bits/shm.h @@ -0,0 +1,31 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + unsigned long __shm_atime_lo; + unsigned long __shm_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; +}; + +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/arm/bits/stat.h b/arch/arm/bits/stat.h index 22b19bbf..5d7828cf 100644 --- a/arch/arm/bits/stat.h +++ b/arch/arm/bits/stat.h @@ -14,8 +14,12 @@ struct stat { off_t st_size; blksize_t st_blksize; blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + ino_t st_ino; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - ino_t st_ino; }; diff --git a/arch/arm/bits/syscall.h.in b/arch/arm/bits/syscall.h.in index 13a3b66c..157b304d 100644 --- a/arch/arm/bits/syscall.h.in +++ b/arch/arm/bits/syscall.h.in @@ -55,8 +55,8 @@ #define __NR_sethostname 74 #define __NR_setrlimit 75 #define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_symlink 83 @@ -211,14 +211,14 @@ #define __NR_remap_file_pages 253 #define __NR_set_tid_address 256 #define __NR_timer_create 257 -#define __NR_timer_settime 258 -#define __NR_timer_gettime 259 +#define __NR_timer_settime32 258 +#define __NR_timer_gettime32 259 #define __NR_timer_getoverrun 260 #define __NR_timer_delete 261 -#define __NR_clock_settime 262 -#define __NR_clock_gettime 263 -#define __NR_clock_getres 264 -#define __NR_clock_nanosleep 265 +#define __NR_clock_settime32 262 +#define __NR_clock_gettime32 263 +#define __NR_clock_getres_time32 264 +#define __NR_clock_nanosleep_time32 265 #define __NR_statfs64 266 #define __NR_fstatfs64 267 #define __NR_tgkill 268 @@ -308,8 +308,8 @@ #define __NR_timerfd_create 350 #define __NR_eventfd 351 #define __NR_fallocate 352 -#define __NR_timerfd_settime 353 -#define __NR_timerfd_gettime 354 +#define __NR_timerfd_settime32 353 +#define __NR_timerfd_gettime32 354 #define __NR_signalfd4 355 #define __NR_eventfd2 356 #define __NR_epoll_create1 357 @@ -354,6 +354,56 @@ #define __NR_pkey_free 396 #define __NR_statx 397 #define __NR_rseq 398 +#define __NR_io_pgetevents 399 +#define __NR_migrate_pages 400 +#define __NR_kexec_file_load 401 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 #define __ARM_NR_breakpoint 0x0f0001 #define __ARM_NR_cacheflush 0x0f0002 diff --git a/arch/arm/kstat.h b/arch/arm/kstat.h new file mode 100644 index 00000000..af449c95 --- /dev/null +++ b/arch/arm/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + int __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + int __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + ino_t st_ino; +}; diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h index e689ea21..157e2eae 100644 --- a/arch/arm/pthread_arch.h +++ b/arch/arm/pthread_arch.h @@ -1,11 +1,11 @@ #if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 -static inline pthread_t __pthread_self() +static inline uintptr_t __get_tp() { - char *p; - __asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) ); - return (void *)(p-sizeof(struct pthread)); + uintptr_t tp; + __asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(tp) ); + return tp; } #else @@ -16,18 +16,17 @@ static inline pthread_t __pthread_self() #define BLX "blx" #endif -static inline pthread_t __pthread_self() +static inline uintptr_t __get_tp() { extern hidden uintptr_t __a_gettp_ptr; - register uintptr_t p __asm__("r0"); - __asm__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" ); - return (void *)(p-sizeof(struct pthread)); + register uintptr_t tp __asm__("r0"); + __asm__ ( BLX " %1" : "=r"(tp) : "r"(__a_gettp_ptr) : "cc", "lr" ); + return tp; } #endif #define TLS_ABOVE_TP #define GAP_ABOVE_TP 8 -#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread)) #define MC_PC arm_pc diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h index 2c2e7f58..d98eb8af 100644 --- a/arch/arm/reloc.h +++ b/arch/arm/reloc.h @@ -1,5 +1,3 @@ -#include <endian.h> - #if __BYTE_ORDER == __BIG_ENDIAN #define ENDIAN_SUFFIX "eb" #else @@ -28,7 +26,7 @@ #define REL_TPOFF R_ARM_TLS_TPOFF32 #define REL_TLSDESC R_ARM_TLS_DESC -#define TLSDESC_BACKWARDS +#define TLSDESC_BACKWARDS 1 #define CRTJMP(pc,sp) __asm__ __volatile__( \ "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" ) diff --git a/arch/arm/syscall_arch.h b/arch/arm/syscall_arch.h index 53fb155c..624e992e 100644 --- a/arch/arm/syscall_arch.h +++ b/arch/arm/syscall_arch.h @@ -98,10 +98,13 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5)); } -#define VDSO_USEFUL -#define VDSO_CGT_SYM "__vdso_clock_gettime" -#define VDSO_CGT_VER "LINUX_2.6" - #define SYSCALL_FADVISE_6_ARG #define SYSCALL_IPC_BROKEN_MODE + +#define VDSO_USEFUL +#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 VDSO_CGT_WORKAROUND 1 diff --git a/arch/generic/bits/dirent.h b/arch/generic/bits/dirent.h new file mode 100644 index 00000000..c845fe82 --- /dev/null +++ b/arch/generic/bits/dirent.h @@ -0,0 +1,11 @@ +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF +#define _DIRENT_HAVE_D_TYPE + +struct dirent { + ino_t d_ino; + off_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; diff --git a/arch/generic/bits/fcntl.h b/arch/generic/bits/fcntl.h index ae233cc0..730a98cf 100644 --- a/arch/generic/bits/fcntl.h +++ b/arch/generic/bits/fcntl.h @@ -30,9 +30,15 @@ #define F_SETSIG 10 #define F_GETSIG 11 +#if __LONG_MAX == 0x7fffffffL #define F_GETLK 12 #define F_SETLK 13 #define F_SETLKW 14 +#else +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#endif #define F_SETOWN_EX 15 #define F_GETOWN_EX 16 diff --git a/arch/generic/bits/ioctl.h b/arch/generic/bits/ioctl.h index 42a8f1a2..60ae8b85 100644 --- a/arch/generic/bits/ioctl.h +++ b/arch/generic/bits/ioctl.h @@ -64,6 +64,8 @@ #define TIOCGPTLCK 0x80045439 #define TIOCGEXCL 0x80045440 #define TIOCGPTPEER 0x5441 +#define TIOCGISO7816 0x80285442 +#define TIOCSISO7816 0xc0285443 #define FIONCLEX 0x5450 #define FIOCLEX 0x5451 @@ -82,24 +84,6 @@ #define TIOCGICOUNT 0x545D #define FIOQSIZE 0x5460 -#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 @@ -115,92 +99,17 @@ 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 FIOSETOWN 0x8901 #define SIOCSPGRP 0x8902 #define FIOGETOWN 0x8903 #define SIOCGPGRP 0x8904 #define SIOCATMARK 0x8905 +#if __LONG_MAX == 0x7fffffff +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) +#else #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 +#endif #include <bits/ioctl_fix.h> diff --git a/arch/generic/bits/ipc.h b/arch/generic/bits/ipc.h index 779c42fd..40d6f3a2 100644 --- a/arch/generic/bits/ipc.h +++ b/arch/generic/bits/ipc.h @@ -9,5 +9,3 @@ struct ipc_perm { long __pad1; long __pad2; }; - -#define IPC_64 0x100 diff --git a/arch/generic/bits/ipcstat.h b/arch/generic/bits/ipcstat.h new file mode 100644 index 00000000..0018ad1e --- /dev/null +++ b/arch/generic/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 2 diff --git a/arch/generic/bits/limits.h b/arch/generic/bits/limits.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/arch/generic/bits/limits.h diff --git a/arch/generic/bits/msg.h b/arch/generic/bits/msg.h index bc8436c4..2e23ca27 100644 --- a/arch/generic/bits/msg.h +++ b/arch/generic/bits/msg.h @@ -1,11 +1,8 @@ struct msqid_ds { struct ipc_perm msg_perm; time_t msg_stime; - int __unused1; time_t msg_rtime; - int __unused2; time_t msg_ctime; - int __unused3; unsigned long msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; diff --git a/arch/generic/bits/sem.h b/arch/generic/bits/sem.h index c629b81e..5184eb59 100644 --- a/arch/generic/bits/sem.h +++ b/arch/generic/bits/sem.h @@ -1,16 +1,14 @@ struct semid_ds { struct ipc_perm sem_perm; time_t sem_otime; - time_t __unused1; time_t sem_ctime; - time_t __unused2; #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; + long __unused3; + long __unused4; }; diff --git a/arch/generic/bits/shm.h b/arch/generic/bits/shm.h index 45d1d157..8d193781 100644 --- a/arch/generic/bits/shm.h +++ b/arch/generic/bits/shm.h @@ -4,11 +4,8 @@ struct shmid_ds { struct ipc_perm shm_perm; size_t shm_segsz; time_t shm_atime; - int __unused1; time_t shm_dtime; - int __unused2; time_t shm_ctime; - int __unused3; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; @@ -25,4 +22,3 @@ struct shm_info { unsigned long shm_tot, shm_rss, shm_swp; unsigned long __swap_attempts, __swap_successes; }; - diff --git a/arch/generic/bits/socket.h b/arch/generic/bits/socket.h index 1f73b995..e69de29b 100644 --- a/arch/generic/bits/socket.h +++ b/arch/generic/bits/socket.h @@ -1,15 +0,0 @@ -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; -}; diff --git a/arch/generic/fp_arch.h b/arch/generic/fp_arch.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/arch/generic/fp_arch.h diff --git a/arch/i386/arch.mak b/arch/i386/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/i386/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in index 1a8432d3..6feb03a6 100644 --- a/arch/i386/bits/alltypes.h.in +++ b/arch/i386/bits/alltypes.h.in @@ -1,14 +1,10 @@ +#define _REDIR_TIME64 1 #define _Addr int #define _Int64 long long #define _Reg int -#if __GNUC__ >= 3 -TYPEDEF __builtin_va_list va_list; -TYPEDEF __builtin_va_list __isoc_va_list; -#else -TYPEDEF struct __va_list * va_list; -TYPEDEF struct __va_list * __isoc_va_list; -#endif +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus #ifdef __WCHAR_TYPE__ @@ -33,14 +29,3 @@ TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __l #else TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t; #endif - -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/i386/bits/endian.h b/arch/i386/bits/endian.h deleted file mode 100644 index 172c338f..00000000 --- a/arch/i386/bits/endian.h +++ /dev/null @@ -1 +0,0 @@ -#define __BYTE_ORDER __LITTLE_ENDIAN diff --git a/arch/i386/bits/ipcstat.h b/arch/i386/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/i386/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/i386/bits/limits.h b/arch/i386/bits/limits.h index c340ceb2..07743b6f 100644 --- a/arch/i386/bits/limits.h +++ b/arch/i386/bits/limits.h @@ -1,8 +1 @@ -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGESIZE 4096 -#define LONG_BIT 32 -#endif - -#define LONG_MAX 0x7fffffffL -#define LLONG_MAX 0x7fffffffffffffffLL diff --git a/arch/i386/bits/msg.h b/arch/i386/bits/msg.h new file mode 100644 index 00000000..7bbbb2bf --- /dev/null +++ b/arch/i386/bits/msg.h @@ -0,0 +1,18 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + 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; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + 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/i386/bits/sem.h b/arch/i386/bits/sem.h new file mode 100644 index 00000000..65661542 --- /dev/null +++ b/arch/i386/bits/sem.h @@ -0,0 +1,13 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/x86_64/bits/shm.h b/arch/i386/bits/shm.h index 6652d659..725fb469 100644 --- a/arch/x86_64/bits/shm.h +++ b/arch/i386/bits/shm.h @@ -3,14 +3,21 @@ 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_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; unsigned long __pad1; unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; }; struct shminfo { @@ -22,4 +29,3 @@ struct shm_info { unsigned long shm_tot, shm_rss, shm_swp; unsigned long __swap_attempts, __swap_successes; }; - diff --git a/arch/i386/bits/stat.h b/arch/i386/bits/stat.h index 22b19bbf..5d7828cf 100644 --- a/arch/i386/bits/stat.h +++ b/arch/i386/bits/stat.h @@ -14,8 +14,12 @@ struct stat { off_t st_size; blksize_t st_blksize; blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + ino_t st_ino; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - ino_t st_ino; }; diff --git a/arch/i386/bits/syscall.h.in b/arch/i386/bits/syscall.h.in index 47f4ae03..55e91cc4 100644 --- a/arch/i386/bits/syscall.h.in +++ b/arch/i386/bits/syscall.h.in @@ -76,8 +76,8 @@ #define __NR_setrlimit 75 #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ #define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 @@ -257,14 +257,14 @@ #define __NR_remap_file_pages 257 #define __NR_set_tid_address 258 #define __NR_timer_create 259 -#define __NR_timer_settime (__NR_timer_create+1) -#define __NR_timer_gettime (__NR_timer_create+2) +#define __NR_timer_settime32 (__NR_timer_create+1) +#define __NR_timer_gettime32 (__NR_timer_create+2) #define __NR_timer_getoverrun (__NR_timer_create+3) #define __NR_timer_delete (__NR_timer_create+4) -#define __NR_clock_settime (__NR_timer_create+5) -#define __NR_clock_gettime (__NR_timer_create+6) -#define __NR_clock_getres (__NR_timer_create+7) -#define __NR_clock_nanosleep (__NR_timer_create+8) +#define __NR_clock_settime32 (__NR_timer_create+5) +#define __NR_clock_gettime32 (__NR_timer_create+6) +#define __NR_clock_getres_time32 (__NR_timer_create+7) +#define __NR_clock_nanosleep_time32 (__NR_timer_create+8) #define __NR_statfs64 268 #define __NR_fstatfs64 269 #define __NR_tgkill 270 @@ -322,8 +322,8 @@ #define __NR_timerfd_create 322 #define __NR_eventfd 323 #define __NR_fallocate 324 -#define __NR_timerfd_settime 325 -#define __NR_timerfd_gettime 326 +#define __NR_timerfd_settime32 325 +#define __NR_timerfd_gettime32 326 #define __NR_signalfd4 327 #define __NR_eventfd2 328 #define __NR_epoll_create1 329 @@ -384,4 +384,62 @@ #define __NR_arch_prctl 384 #define __NR_io_pgetevents 385 #define __NR_rseq 386 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_memfd_secret 447 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/i386/kstat.h b/arch/i386/kstat.h new file mode 100644 index 00000000..af449c95 --- /dev/null +++ b/arch/i386/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + int __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + int __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + ino_t st_ino; +}; diff --git a/arch/i386/pthread_arch.h b/arch/i386/pthread_arch.h index 6f600b9e..a639c382 100644 --- a/arch/i386/pthread_arch.h +++ b/arch/i386/pthread_arch.h @@ -1,10 +1,8 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - struct pthread *self; - __asm__ ("movl %%gs:0,%0" : "=r" (self) ); - return self; + uintptr_t tp; + __asm__ ("movl %%gs:0,%0" : "=r" (tp) ); + return tp; } -#define TP_ADJ(p) (p) - #define MC_PC gregs[REG_EIP] diff --git a/arch/i386/syscall_arch.h b/arch/i386/syscall_arch.h index 4c9d874a..f92b7aa9 100644 --- a/arch/i386/syscall_arch.h +++ b/arch/i386/syscall_arch.h @@ -3,57 +3,87 @@ ((union { long long ll; long l[2]; }){ .ll = x }).l[1] #define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) +#if SYSCALL_NO_TLS +#define SYSCALL_INSNS "int $128" +#else +#define SYSCALL_INSNS "call *%%gs:16" +#endif + +#define SYSCALL_INSNS_12 "xchg %%ebx,%%edx ; " SYSCALL_INSNS " ; xchg %%ebx,%%edx" +#define SYSCALL_INSNS_34 "xchg %%ebx,%%edi ; " SYSCALL_INSNS " ; xchg %%ebx,%%edi" + static inline long __syscall0(long n) { unsigned long __ret; - __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n) : "memory"); + __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n) : "memory"); return __ret; } static inline long __syscall1(long n, long a1) { unsigned long __ret; - __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1) : "memory"); + __asm__ __volatile__ (SYSCALL_INSNS_12 : "=a"(__ret) : "a"(n), "d"(a1) : "memory"); return __ret; } static inline long __syscall2(long n, long a1, long a2) { unsigned long __ret; - __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory"); + __asm__ __volatile__ (SYSCALL_INSNS_12 : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory"); return __ret; } static inline long __syscall3(long n, long a1, long a2, long a3) { unsigned long __ret; - __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3) : "memory"); +#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) + __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3) : "memory"); +#else + __asm__ __volatile__ (SYSCALL_INSNS_34 : "=a"(__ret) : "a"(n), "D"(a1), "c"(a2), "d"(a3) : "memory"); +#endif return __ret; } static inline long __syscall4(long n, long a1, long a2, long a3, long a4) { unsigned long __ret; - __asm__ __volatile__ (".hidden __vsyscall ; call __vsyscall" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4) : "memory"); +#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) + __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4) : "memory"); +#else + __asm__ __volatile__ (SYSCALL_INSNS_34 : "=a"(__ret) : "a"(n), "D"(a1), "c"(a2), "d"(a3), "S"(a4) : "memory"); +#endif return __ret; } static inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5) { unsigned long __ret; - __asm__ __volatile__ ("push %6 ; .hidden __vsyscall ; call __vsyscall ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(a5) : "memory"); +#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) + __asm__ __volatile__ (SYSCALL_INSNS + : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory"); +#else + __asm__ __volatile__ ("pushl %2 ; push %%ebx ; mov 4(%%esp),%%ebx ; " SYSCALL_INSNS " ; pop %%ebx ; add $4,%%esp" + : "=a"(__ret) : "a"(n), "g"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory"); +#endif return __ret; } static inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6) { unsigned long __ret; - __asm__ __volatile__ ("push %6 ; .hidden __vsyscall6 ; call __vsyscall6 ; add $4,%%esp" : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2), "D"(a3), "S"(a4), "g"(0+(long[]){a5, a6}) : "memory"); +#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM) + __asm__ __volatile__ ("pushl %7 ; push %%ebp ; mov 4(%%esp),%%ebp ; " SYSCALL_INSNS " ; pop %%ebp ; add $4,%%esp" + : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5), "g"(a6) : "memory"); +#else + unsigned long a1a6[2] = { a1, a6 }; + __asm__ __volatile__ ("pushl %1 ; push %%ebx ; push %%ebp ; mov 8(%%esp),%%ebx ; mov 4(%%ebx),%%ebp ; mov (%%ebx),%%ebx ; " SYSCALL_INSNS " ; pop %%ebp ; pop %%ebx ; add $4,%%esp" + : "=a"(__ret) : "g"(&a1a6), "a"(n), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory"); +#endif return __ret; } #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 SYSCALL_USE_SOCKETCALL diff --git a/arch/loongarch64/atomic_arch.h b/arch/loongarch64/atomic_arch.h new file mode 100644 index 00000000..2225d027 --- /dev/null +++ b/arch/loongarch64/atomic_arch.h @@ -0,0 +1,53 @@ +#define a_ll a_ll +static inline int a_ll(volatile int *p) +{ + int v; + __asm__ __volatile__ ( + "ll.w %0, %1" + : "=r"(v) + : "ZC"(*p)); + return v; +} + +#define a_sc a_sc +static inline int a_sc(volatile int *p, int v) +{ + int r; + __asm__ __volatile__ ( + "sc.w %0, %1" + : "=r"(r), "=ZC"(*p) + : "0"(v) : "memory"); + return r; +} + +#define a_ll_p a_ll_p +static inline void *a_ll_p(volatile void *p) +{ + void *v; + __asm__ __volatile__ ( + "ll.d %0, %1" + : "=r"(v) + : "ZC"(*(void *volatile *)p)); + return v; +} + +#define a_sc_p a_sc_p +static inline int a_sc_p(volatile void *p, void *v) +{ + long r; + __asm__ __volatile__ ( + "sc.d %0, %1" + : "=r"(r), "=ZC"(*(void *volatile *)p) + : "0"(v) + : "memory"); + return r; +} + +#define a_barrier a_barrier +static inline void a_barrier() +{ + __asm__ __volatile__ ("dbar 0" : : : "memory"); +} + +#define a_pre_llsc a_barrier +#define a_post_llsc a_barrier diff --git a/arch/loongarch64/bits/alltypes.h.in b/arch/loongarch64/bits/alltypes.h.in new file mode 100644 index 00000000..d1807aca --- /dev/null +++ b/arch/loongarch64/bits/alltypes.h.in @@ -0,0 +1,18 @@ +#define _Addr long +#define _Int64 long +#define _Reg long + +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffffffffffL + +#ifndef __cplusplus +TYPEDEF int wchar_t; +#endif + +TYPEDEF float float_t; +TYPEDEF double double_t; + +TYPEDEF struct { long long __ll; long double __ld; } max_align_t; + +TYPEDEF unsigned nlink_t; +TYPEDEF int blksize_t; diff --git a/arch/loongarch64/bits/fenv.h b/arch/loongarch64/bits/fenv.h new file mode 100644 index 00000000..264cafb5 --- /dev/null +++ b/arch/loongarch64/bits/fenv.h @@ -0,0 +1,20 @@ +#define FE_INEXACT 0x010000 +#define FE_UNDERFLOW 0x020000 +#define FE_OVERFLOW 0x040000 +#define FE_DIVBYZERO 0x080000 +#define FE_INVALID 0x100000 + +#define FE_ALL_EXCEPT 0x1F0000 + +#define FE_TONEAREST 0x000 +#define FE_TOWARDZERO 0x100 +#define FE_UPWARD 0x200 +#define FE_DOWNWARD 0x300 + +typedef unsigned fexcept_t; + +typedef struct { + unsigned __cw; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/arch/loongarch64/bits/float.h b/arch/loongarch64/bits/float.h new file mode 100644 index 00000000..719c7908 --- /dev/null +++ b/arch/loongarch64/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L + +#define LDBL_MANT_DIG 113 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MAX_EXP 16384 + +#define LDBL_DIG 33 +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_10_EXP 4932 + +#define DECIMAL_DIG 36 diff --git a/arch/loongarch64/bits/posix.h b/arch/loongarch64/bits/posix.h new file mode 100644 index 00000000..8068ce98 --- /dev/null +++ b/arch/loongarch64/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V7_LP64_OFF64 1 diff --git a/arch/loongarch64/bits/reg.h b/arch/loongarch64/bits/reg.h new file mode 100644 index 00000000..2633f39d --- /dev/null +++ b/arch/loongarch64/bits/reg.h @@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 64 diff --git a/arch/loongarch64/bits/setjmp.h b/arch/loongarch64/bits/setjmp.h new file mode 100644 index 00000000..3b15e87b --- /dev/null +++ b/arch/loongarch64/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long __jmp_buf[23]; diff --git a/arch/loongarch64/bits/signal.h b/arch/loongarch64/bits/signal.h new file mode 100644 index 00000000..5a9ed8c9 --- /dev/null +++ b/arch/loongarch64/bits/signal.h @@ -0,0 +1,101 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 4096 +#define SIGSTKSZ 16384 +#endif + +#if defined(_GNU_SOURCE) +#define LARCH_NGREG 32 +#define LARCH_REG_RA 1 +#define LARCH_REG_SP 3 +#define LARCH_REG_S0 23 +#define LARCH_REG_S1 24 +#define LARCH_REG_A0 4 +#define LARCH_REG_S2 25 +#define LARCH_REG_NARGS 8 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long greg_t, gregset_t[32]; + +struct sigcontext { + unsigned long sc_pc; + unsigned long sc_regs[32]; + unsigned sc_flags; + unsigned long sc_extcontext[] __attribute__((__aligned__(16))); +}; +#endif + +typedef struct { + unsigned long __pc; + unsigned long __gregs[32]; + unsigned __flags; + unsigned long __extcontext[] __attribute__((__aligned__(16))); +} mcontext_t; + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext +{ + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + long __uc_pad; + mcontext_t uc_mcontext; +} ucontext_t; + +#define __uc_flags uc_flags + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/arch/loongarch64/bits/stat.h b/arch/loongarch64/bits/stat.h new file mode 100644 index 00000000..b7f4221b --- /dev/null +++ b/arch/loongarch64/bits/stat.h @@ -0,0 +1,18 @@ +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned __unused[2]; +}; diff --git a/arch/loongarch64/bits/stdint.h b/arch/loongarch64/bits/stdint.h new file mode 100644 index 00000000..1bb147f2 --- /dev/null +++ b/arch/loongarch64/bits/stdint.h @@ -0,0 +1,20 @@ +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/loongarch64/bits/syscall.h.in b/arch/loongarch64/bits/syscall.h.in new file mode 100644 index 00000000..2afb4ea1 --- /dev/null +++ b/arch/loongarch64/bits/syscall.h.in @@ -0,0 +1,316 @@ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_io_getevents 4 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR3264_fcntl 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_umount2 39 +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR3264_statfs 43 +#define __NR3264_fstatfs 44 +#define __NR3264_truncate 45 +#define __NR3264_ftruncate 46 +#define __NR_fallocate 47 +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR3264_lseek 62 +#define __NR_read 63 +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR3264_sendfile 71 +#define __NR_pselect6 72 +#define __NR_ppoll 73 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +#define __NR_sync_file_range 84 +#define __NR_timerfd_create 85 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_gettime 87 +#define __NR_utimensat 88 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_futex 98 +#define __NR_set_robust_list 99 +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +#define __NR_timer_gettime 108 +#define __NR_timer_getoverrun 109 +#define __NR_timer_settime 110 +#define __NR_timer_delete 111 +#define __NR_clock_settime 112 +#define __NR_clock_gettime 113 +#define __NR_clock_getres 114 +#define __NR_clock_nanosleep 115 +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_rr_get_interval 127 +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +#define __NR_getcpu 168 +#define __NR_gettimeofday 169 +#define __NR_settimeofday 170 +#define __NR_adjtimex 171 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedreceive 183 +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +#define __NR_semtimedop 192 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR3264_mmap 222 +#define __NR3264_fadvise64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +#define __NR_move_pages 239 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +#define __NR_accept4 242 +#define __NR_recvmmsg 243 +#define __NR_arch_specific_syscall 244 +#define __NR_wait4 260 +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +#define __NR_open_by_handle_at 265 +#define __NR_clock_adjtime 266 +#define __NR_syncfs 267 +#define __NR_setns 268 +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +#define __NR_finit_module 273 +#define __NR_sched_setattr 274 +#define __NR_sched_getattr 275 +#define __NR_renameat2 276 +#define __NR_seccomp 277 +#define __NR_getrandom 278 +#define __NR_memfd_create 279 +#define __NR_bpf 280 +#define __NR_execveat 281 +#define __NR_userfaultfd 282 +#define __NR_membarrier 283 +#define __NR_mlock2 284 +#define __NR_copy_file_range 285 +#define __NR_preadv2 286 +#define __NR_pwritev2 287 +#define __NR_pkey_mprotect 288 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_statx 291 +#define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_quotactl_fd 443 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 +#define __NR_map_shadow_stack 453 +#define __NR_futex_wake 454 +#define __NR_futex_wait 455 +#define __NR_futex_requeue 456 +#define __NR_fcntl __NR3264_fcntl +#define __NR_statfs __NR3264_statfs +#define __NR_fstatfs __NR3264_fstatfs +#define __NR_truncate __NR3264_truncate +#define __NR_ftruncate __NR3264_ftruncate +#define __NR_lseek __NR3264_lseek +#define __NR_sendfile __NR3264_sendfile +#define __NR_mmap __NR3264_mmap +#define __NR_fadvise64 __NR3264_fadvise64 diff --git a/arch/loongarch64/bits/user.h b/arch/loongarch64/bits/user.h new file mode 100644 index 00000000..fd9b7b22 --- /dev/null +++ b/arch/loongarch64/bits/user.h @@ -0,0 +1,24 @@ +#define ELF_NGREG 45 +#define ELF_NFPREG 34 + +struct user_regs_struct { + unsigned long regs[32]; + unsigned long orig_a0; + unsigned long csr_era; + unsigned long csr_badv; + unsigned long reserved[10]; +}; + +struct user_fp_struct { + unsigned long fpr[32]; + unsigned long fcc; + unsigned int fcsr; +}; + +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; + +typedef union { + double d; + float f; +} elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; diff --git a/arch/loongarch64/crt_arch.h b/arch/loongarch64/crt_arch.h new file mode 100644 index 00000000..e0760d9e --- /dev/null +++ b/arch/loongarch64/crt_arch.h @@ -0,0 +1,13 @@ +__asm__( +".text \n" +".global " START "\n" +".type " START ", @function\n" +START ":\n" +" move $fp, $zero\n" +" move $a0, $sp\n" +".weak _DYNAMIC\n" +".hidden _DYNAMIC\n" +" la.local $a1, _DYNAMIC\n" +" bstrins.d $sp, $zero, 3, 0\n" +" b " START "_c\n" +); diff --git a/arch/loongarch64/pthread_arch.h b/arch/loongarch64/pthread_arch.h new file mode 100644 index 00000000..365f6ca8 --- /dev/null +++ b/arch/loongarch64/pthread_arch.h @@ -0,0 +1,11 @@ +static inline uintptr_t __get_tp() +{ + register uintptr_t tp __asm__("tp"); + __asm__ ("" : "=r" (tp) ); + return tp; +} + +#define TLS_ABOVE_TP +#define GAP_ABOVE_TP 0 +#define DTP_OFFSET 0 +#define MC_PC __pc diff --git a/arch/loongarch64/reloc.h b/arch/loongarch64/reloc.h new file mode 100644 index 00000000..61eaca9e --- /dev/null +++ b/arch/loongarch64/reloc.h @@ -0,0 +1,29 @@ +#ifdef __loongarch_soft_float +#define FP_SUFFIX "-sf" +#elif defined __loongarch_single_float +#define FP_SUFFIX "-sp" +#else +#define FP_SUFFIX "" +#endif + +#define LDSO_ARCH "loongarch64" FP_SUFFIX + +#define TPOFF_K 0 + +#define REL_PLT R_LARCH_JUMP_SLOT +#define REL_COPY R_LARCH_COPY +#define REL_DTPMOD R_LARCH_TLS_DTPMOD64 +#define REL_DTPOFF R_LARCH_TLS_DTPREL64 +#define REL_TPOFF R_LARCH_TLS_TPREL64 +#define REL_RELATIVE R_LARCH_RELATIVE +#define REL_SYMBOLIC R_LARCH_64 + +#define CRTJMP(pc,sp) __asm__ __volatile__( \ + "move $sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) + +#define GETFUNCSYM(fp, sym, got) __asm__ ( \ + ".hidden " #sym "\n" \ + ".align 8 \n" \ + " la.local $t1, "#sym" \n" \ + " move %0, $t1 \n" \ + : "=r"(*(fp)) : : "memory" ) diff --git a/arch/loongarch64/syscall_arch.h b/arch/loongarch64/syscall_arch.h new file mode 100644 index 00000000..4d5e1885 --- /dev/null +++ b/arch/loongarch64/syscall_arch.h @@ -0,0 +1,137 @@ +#define __SYSCALL_LL_E(x) (x) +#define __SYSCALL_LL_O(x) (x) + +#define SYSCALL_CLOBBERLIST \ + "$t0", "$t1", "$t2", "$t3", \ + "$t4", "$t5", "$t6", "$t7", "$t8", "memory" + +static inline long __syscall0(long n) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0"); + + __asm__ __volatile__ ( + "syscall 0" + : "=r"(a0) + : "r"(a7) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall1(long n, long a) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall2(long n, long a, long b) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + register long a1 __asm__("$a1") = b; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7), "r"(a1) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + register long a1 __asm__("$a1") = b; + register long a2 __asm__("$a2") = c; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7), "r"(a1), "r"(a2) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + register long a1 __asm__("$a1") = b; + register long a2 __asm__("$a2") = c; + register long a3 __asm__("$a3") = d; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7), "r"(a1), "r"(a2), "r"(a3) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + register long a1 __asm__("$a1") = b; + register long a2 __asm__("$a2") = c; + register long a3 __asm__("$a3") = d; + register long a4 __asm__("$a4") = e; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + register long a1 __asm__("$a1") = b; + register long a2 __asm__("$a2") = c; + register long a3 __asm__("$a3") = d; + register long a4 __asm__("$a4") = e; + register long a5 __asm__("$a5") = f; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5) + : SYSCALL_CLOBBERLIST); + return a0; +} + +static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g) +{ + register long a7 __asm__("$a7") = n; + register long a0 __asm__("$a0") = a; + register long a1 __asm__("$a1") = b; + register long a2 __asm__("$a2") = c; + register long a3 __asm__("$a3") = d; + register long a4 __asm__("$a4") = e; + register long a5 __asm__("$a5") = f; + register long a6 __asm__("$a6") = g; + + __asm__ __volatile__ ( + "syscall 0" + : "+r"(a0) + : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6) + : SYSCALL_CLOBBERLIST); + return a0; +} + +#define VDSO_USEFUL +#define VDSO_CGT_SYM "__vdso_clock_gettime" +#define VDSO_CGT_VER "LINUX_5.10" + +#define IPC_64 0 diff --git a/arch/m68k/arch.mak b/arch/m68k/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/m68k/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/m68k/bits/alltypes.h.in b/arch/m68k/bits/alltypes.h.in index a4a8141f..f5646909 100644 --- a/arch/m68k/bits/alltypes.h.in +++ b/arch/m68k/bits/alltypes.h.in @@ -1,13 +1,18 @@ +#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; +#define __BYTE_ORDER 4321 +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus +#ifdef __WCHAR_TYPE__ +TYPEDEF __WCHAR_TYPE__ wchar_t; +#else TYPEDEF long wchar_t; #endif +#endif #if __mcffpu__ TYPEDEF float float_t; @@ -18,14 +23,3 @@ TYPEDEF long double double_t; #endif 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/m68k/bits/endian.h b/arch/m68k/bits/endian.h deleted file mode 100644 index ef074b77..00000000 --- a/arch/m68k/bits/endian.h +++ /dev/null @@ -1 +0,0 @@ -#define __BYTE_ORDER __BIG_ENDIAN diff --git a/arch/m68k/bits/ipcstat.h b/arch/m68k/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/m68k/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/m68k/bits/limits.h b/arch/m68k/bits/limits.h deleted file mode 100644 index fbc6d238..00000000 --- a/arch/m68k/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/m68k/bits/msg.h b/arch/m68k/bits/msg.h new file mode 100644 index 00000000..7bbbb2bf --- /dev/null +++ b/arch/m68k/bits/msg.h @@ -0,0 +1,18 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + 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; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + 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/m68k/bits/sem.h b/arch/m68k/bits/sem.h new file mode 100644 index 00000000..d88338e6 --- /dev/null +++ b/arch/m68k/bits/sem.h @@ -0,0 +1,13 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/mips64/bits/shm.h b/arch/m68k/bits/shm.h index 8d193781..725fb469 100644 --- a/arch/mips64/bits/shm.h +++ b/arch/m68k/bits/shm.h @@ -3,14 +3,21 @@ 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_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; unsigned long __pad1; unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; }; struct shminfo { diff --git a/arch/m68k/bits/stat.h b/arch/m68k/bits/stat.h index 0f7b66a1..f8768147 100644 --- a/arch/m68k/bits/stat.h +++ b/arch/m68k/bits/stat.h @@ -14,8 +14,12 @@ struct stat { off_t st_size; blksize_t st_blksize; blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + ino_t st_ino; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - ino_t st_ino; }; diff --git a/arch/m68k/bits/syscall.h.in b/arch/m68k/bits/syscall.h.in index 89cf114c..5cd84602 100644 --- a/arch/m68k/bits/syscall.h.in +++ b/arch/m68k/bits/syscall.h.in @@ -67,8 +67,8 @@ #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 @@ -235,14 +235,14 @@ #define __NR_remap_file_pages 252 #define __NR_set_tid_address 253 #define __NR_timer_create 254 -#define __NR_timer_settime 255 -#define __NR_timer_gettime 256 +#define __NR_timer_settime32 255 +#define __NR_timer_gettime32 256 #define __NR_timer_getoverrun 257 #define __NR_timer_delete 258 -#define __NR_clock_settime 259 -#define __NR_clock_gettime 260 -#define __NR_clock_getres 261 -#define __NR_clock_nanosleep 262 +#define __NR_clock_settime32 259 +#define __NR_clock_gettime32 260 +#define __NR_clock_getres_time32 261 +#define __NR_clock_nanosleep_time32 262 #define __NR_statfs64 263 #define __NR_fstatfs64 264 #define __NR_tgkill 265 @@ -300,8 +300,8 @@ #define __NR_timerfd_create 318 #define __NR_eventfd 319 #define __NR_fallocate 320 -#define __NR_timerfd_settime 321 -#define __NR_timerfd_gettime 322 +#define __NR_timerfd_settime32 321 +#define __NR_timerfd_gettime32 322 #define __NR_signalfd4 323 #define __NR_eventfd2 324 #define __NR_epoll_create1 325 @@ -359,3 +359,65 @@ #define __NR_preadv2 377 #define __NR_pwritev2 378 #define __NR_statx 379 +#define __NR_seccomp 380 +#define __NR_pkey_mprotect 381 +#define __NR_pkey_alloc 382 +#define __NR_pkey_free 383 +#define __NR_rseq 384 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/m68k/bits/user.h b/arch/m68k/bits/user.h index 9a4ca128..6a443919 100644 --- a/arch/m68k/bits/user.h +++ b/arch/m68k/bits/user.h @@ -27,6 +27,11 @@ struct user { char u_comm[32]; }; +#define ELF_NGREG 20 +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; +typedef struct user_m68kfp_struct elf_fpregset_t; + #define NBPG 4096 #define UPAGES 1 #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/arch/m68k/kstat.h b/arch/m68k/kstat.h new file mode 100644 index 00000000..ac13e272 --- /dev/null +++ b/arch/m68k/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + short __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + short __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + ino_t st_ino; +}; diff --git a/arch/m68k/pthread_arch.h b/arch/m68k/pthread_arch.h index 02d5b8a0..5bea4e1a 100644 --- a/arch/m68k/pthread_arch.h +++ b/arch/m68k/pthread_arch.h @@ -1,13 +1,12 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - uintptr_t tp = __syscall(SYS_get_thread_area); - return (pthread_t)(tp - 0x7000 - sizeof(struct pthread)); + return __syscall(SYS_get_thread_area); } #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 gregs[R_PC] diff --git a/arch/m68k/syscall_arch.h b/arch/m68k/syscall_arch.h index af79c306..6a9d0ae8 100644 --- a/arch/m68k/syscall_arch.h +++ b/arch/m68k/syscall_arch.h @@ -87,5 +87,4 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo return d0; } -#define SYSCALL_USE_SOCKETCALL #define SYSCALL_IPC_BROKEN_MODE diff --git a/arch/microblaze/arch.mak b/arch/microblaze/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/microblaze/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/microblaze/bits/alltypes.h.in b/arch/microblaze/bits/alltypes.h.in index 66ca18ad..9a4ce29d 100644 --- a/arch/microblaze/bits/alltypes.h.in +++ b/arch/microblaze/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 __MICROBLAZEEL__ +#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/microblaze/bits/endian.h b/arch/microblaze/bits/endian.h deleted file mode 100644 index d82a92ac..00000000 --- a/arch/microblaze/bits/endian.h +++ /dev/null @@ -1,5 +0,0 @@ -#if __MICROBLAZEEL__ -#define __BYTE_ORDER __LITTLE_ENDIAN -#else -#define __BYTE_ORDER __BIG_ENDIAN -#endif diff --git a/arch/microblaze/bits/ipcstat.h b/arch/microblaze/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/microblaze/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/microblaze/bits/limits.h b/arch/microblaze/bits/limits.h deleted file mode 100644 index fbc6d238..00000000 --- a/arch/microblaze/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/microblaze/bits/msg.h b/arch/microblaze/bits/msg.h new file mode 100644 index 00000000..7bbbb2bf --- /dev/null +++ b/arch/microblaze/bits/msg.h @@ -0,0 +1,18 @@ +struct msqid_ds { + struct ipc_perm msg_perm; + 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; + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + 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/microblaze/bits/sem.h b/arch/microblaze/bits/sem.h new file mode 100644 index 00000000..544e3d2a --- /dev/null +++ b/arch/microblaze/bits/sem.h @@ -0,0 +1,18 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/microblaze/bits/shm.h b/arch/microblaze/bits/shm.h new file mode 100644 index 00000000..725fb469 --- /dev/null +++ b/arch/microblaze/bits/shm.h @@ -0,0 +1,31 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + unsigned long __shm_atime_lo; + unsigned long __shm_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned long __pad1; + unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; +}; + +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/microblaze/bits/signal.h b/arch/microblaze/bits/signal.h index 490f83bf..f25b7c6a 100644 --- a/arch/microblaze/bits/signal.h +++ b/arch/microblaze/bits/signal.h @@ -46,7 +46,6 @@ typedef struct __ucontext { #define SA_RESTART 0x10000000 #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 -#define SA_RESTORER 0x04000000 #endif diff --git a/arch/microblaze/bits/stat.h b/arch/microblaze/bits/stat.h index ce6a6bd0..8a4d509a 100644 --- a/arch/microblaze/bits/stat.h +++ b/arch/microblaze/bits/stat.h @@ -14,8 +14,12 @@ struct stat { blksize_t st_blksize; int __st_blksize_padding; blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + unsigned __unused[2]; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - unsigned __unused[2]; }; diff --git a/arch/microblaze/bits/syscall.h.in b/arch/microblaze/bits/syscall.h.in index f0583961..40860e6d 100644 --- a/arch/microblaze/bits/syscall.h.in +++ b/arch/microblaze/bits/syscall.h.in @@ -76,8 +76,8 @@ #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 @@ -255,14 +255,14 @@ #define __NR_remap_file_pages 257 #define __NR_set_tid_address 258 #define __NR_timer_create 259 -#define __NR_timer_settime 260 -#define __NR_timer_gettime 261 +#define __NR_timer_settime32 260 +#define __NR_timer_gettime32 261 #define __NR_timer_getoverrun 262 #define __NR_timer_delete 263 -#define __NR_clock_settime 264 -#define __NR_clock_gettime 265 -#define __NR_clock_getres 266 -#define __NR_clock_nanosleep 267 +#define __NR_clock_settime32 264 +#define __NR_clock_gettime32 265 +#define __NR_clock_getres_time32 266 +#define __NR_clock_nanosleep_time32 267 #define __NR_statfs64 268 #define __NR_fstatfs64 269 #define __NR_tgkill 270 @@ -320,8 +320,8 @@ #define __NR_eventfd 323 #define __NR_fallocate 324 #define __NR_semtimedop 325 -#define __NR_timerfd_settime 326 -#define __NR_timerfd_gettime 327 +#define __NR_timerfd_settime32 326 +#define __NR_timerfd_gettime32 327 #define __NR_semctl 328 #define __NR_semget 329 #define __NR_semop 330 @@ -395,4 +395,51 @@ #define __NR_statx 398 #define __NR_io_pgetevents 399 #define __NR_rseq 400 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/microblaze/kstat.h b/arch/microblaze/kstat.h new file mode 100644 index 00000000..c1449579 --- /dev/null +++ b/arch/microblaze/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + long long __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + int __st_blksize_padding; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned __unused[2]; +}; diff --git a/arch/microblaze/pthread_arch.h b/arch/microblaze/pthread_arch.h index f6ba8de9..ff26624e 100644 --- a/arch/microblaze/pthread_arch.h +++ b/arch/microblaze/pthread_arch.h @@ -1,10 +1,8 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - struct pthread *self; - __asm__ ("ori %0, r21, 0" : "=r" (self) ); - return self; + uintptr_t tp; + __asm__ ("ori %0, r21, 0" : "=r" (tp) ); + return tp; } -#define TP_ADJ(p) (p) - #define MC_PC regs.pc diff --git a/arch/microblaze/reloc.h b/arch/microblaze/reloc.h index 0a030c7e..6302c6ee 100644 --- a/arch/microblaze/reloc.h +++ b/arch/microblaze/reloc.h @@ -1,5 +1,3 @@ -#include <endian.h> - #if __BYTE_ORDER == __LITTLE_ENDIAN #define ENDIAN_SUFFIX "el" #else diff --git a/arch/microblaze/syscall_arch.h b/arch/microblaze/syscall_arch.h index 6cf631ad..61d8248e 100644 --- a/arch/microblaze/syscall_arch.h +++ b/arch/microblaze/syscall_arch.h @@ -1,9 +1,7 @@ #define __SYSCALL_LL_E(x) \ ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ ((union { long long ll; long l[2]; }){ .ll = x }).l[1] -#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) - -#ifndef __clang__ +#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) static __inline long __syscall0(long n) { @@ -96,11 +94,6 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo return r3; } -#else - -#undef SYSCALL_NO_INLINE -#define SYSCALL_NO_INLINE - -#endif - #define SYSCALL_IPC_BROKEN_MODE + +#undef SYS_socketcall 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 b8f77cb5..e20bf19e 100644 --- a/arch/mips/bits/ioctl.h +++ b/arch/mips/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,90 +105,10 @@ 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) #define SIOCSPGRP _IOW('s', 8, pid_t) #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 +#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/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/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 01de67b8..5b7c38de 100644 --- a/arch/mips/syscall_arch.h +++ b/arch/mips/syscall_arch.h @@ -3,20 +3,16 @@ ((union { long long ll; long l[2]; }){ .ll = x }).l[1] #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) -hidden long (__syscall)(long, ...); - #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) @@ -25,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) @@ -38,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) @@ -53,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) @@ -72,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) @@ -91,35 +78,76 @@ 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) { - long r2 = (__syscall)(n, a, b, c, d, e); - if (r2 > -4096UL) return r2; - if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b); - if (n == SYS_fstatat64) __stat_fix(c); - return r2; + 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"); + __asm__ __volatile__ ( + "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), "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) { - long r2 = (__syscall)(n, a, b, c, d, e, f); - if (r2 > -4096UL) return r2; - if (n == SYS_stat64 || n == SYS_fstat64 || n == SYS_lstat64) __stat_fix(b); - if (n == SYS_fstatat64) __stat_fix(c); - return r2; + 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"); + __asm__ __volatile__ ( + "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), "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) +{ + 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 r10 __asm__("$10") = g; + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "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), "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 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/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 diff --git a/arch/mipsn32/arch.mak b/arch/mipsn32/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/mipsn32/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/mipsn32/bits/alltypes.h.in b/arch/mipsn32/bits/alltypes.h.in index 66ca18ad..ff934a4c 100644 --- a/arch/mipsn32/bits/alltypes.h.in +++ b/arch/mipsn32/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/mipsn32/bits/endian.h b/arch/mipsn32/bits/endian.h deleted file mode 100644 index 5399dcb5..00000000 --- a/arch/mipsn32/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/mipsn32/bits/ioctl.h b/arch/mipsn32/bits/ioctl.h index b8f77cb5..e20bf19e 100644 --- a/arch/mipsn32/bits/ioctl.h +++ b/arch/mipsn32/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,90 +105,10 @@ 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) #define SIOCSPGRP _IOW('s', 8, pid_t) #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 +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) diff --git a/arch/mipsn32/bits/ipcstat.h b/arch/mipsn32/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/mipsn32/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/mipsn32/bits/limits.h b/arch/mipsn32/bits/limits.h deleted file mode 100644 index fbc6d238..00000000 --- a/arch/mipsn32/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/mipsn32/bits/msg.h b/arch/mipsn32/bits/msg.h index f28aece8..c734dbb5 100644 --- a/arch/mipsn32/bits/msg.h +++ b/arch/mipsn32/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/mipsn32/bits/sem.h b/arch/mipsn32/bits/sem.h index e46ced95..fe6f0948 100644 --- a/arch/mipsn32/bits/sem.h +++ b/arch/mipsn32/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/mipsn32/bits/shm.h b/arch/mipsn32/bits/shm.h index 8d193781..ab8c642d 100644 --- a/arch/mipsn32/bits/shm.h +++ b/arch/mipsn32/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 { diff --git a/arch/mipsn32/bits/signal.h b/arch/mipsn32/bits/signal.h index c31ad07e..ffec7fd0 100644 --- a/arch/mipsn32/bits/signal.h +++ b/arch/mipsn32/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/mipsn32/bits/socket.h b/arch/mipsn32/bits/socket.h index b82c7d34..02fbb88b 100644 --- a/arch/mipsn32/bits/socket.h +++ b/arch/mipsn32/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/mipsn32/bits/stat.h b/arch/mipsn32/bits/stat.h index f4d1df83..6e2f2808 100644 --- a/arch/mipsn32/bits/stat.h +++ b/arch/mipsn32/bits/stat.h @@ -1,6 +1,3 @@ -#include <string.h> -#include <bits/alltypes.h> - struct stat { dev_t st_dev; long __pad1[2]; @@ -12,11 +9,15 @@ struct stat { dev_t st_rdev; long __pad2[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 __pad3; blkcnt_t st_blocks; - long __pad4[14]; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __pad4[2]; }; diff --git a/arch/mipsn32/bits/syscall.h.in b/arch/mipsn32/bits/syscall.h.in index c1726180..9a4bd301 100644 --- a/arch/mipsn32/bits/syscall.h.in +++ b/arch/mipsn32/bits/syscall.h.in @@ -92,7 +92,7 @@ #define __NR_fchown 6091 #define __NR_lchown 6092 #define __NR_umask 6093 -#define __NR_gettimeofday 6094 +#define __NR_gettimeofday_time32 6094 #define __NR_getrlimit 6095 #define __NR_getrusage 6096 #define __NR_sysinfo 6097 @@ -157,7 +157,7 @@ #define __NR_chroot 6156 #define __NR_sync 6157 #define __NR_acct 6158 -#define __NR_settimeofday 6159 +#define __NR_settimeofday_time32 6159 #define __NR_mount 6160 #define __NR_umount2 6161 #define __NR_swapon 6162 @@ -219,14 +219,14 @@ #define __NR_fstatfs64 6218 #define __NR_sendfile64 6219 #define __NR_timer_create 6220 -#define __NR_timer_settime 6221 -#define __NR_timer_gettime 6222 +#define __NR_timer_settime32 6221 +#define __NR_timer_gettime32 6222 #define __NR_timer_getoverrun 6223 #define __NR_timer_delete 6224 -#define __NR_clock_settime 6225 -#define __NR_clock_gettime 6226 -#define __NR_clock_getres 6227 -#define __NR_clock_nanosleep 6228 +#define __NR_clock_settime32 6225 +#define __NR_clock_gettime32 6226 +#define __NR_clock_getres_time32 6227 +#define __NR_clock_nanosleep_time32 6228 #define __NR_tgkill 6229 #define __NR_utimes 6230 #define __NR_mbind 6231 @@ -282,8 +282,8 @@ #define __NR_eventfd 6282 #define __NR_fallocate 6283 #define __NR_timerfd_create 6284 -#define __NR_timerfd_gettime 6285 -#define __NR_timerfd_settime 6286 +#define __NR_timerfd_gettime32 6285 +#define __NR_timerfd_settime32 6286 #define __NR_signalfd4 6287 #define __NR_eventfd2 6288 #define __NR_epoll_create1 6289 @@ -330,4 +330,51 @@ #define __NR_statx 6330 #define __NR_rseq 6331 #define __NR_io_pgetevents 6332 +#define __NR_clock_gettime64 6403 +#define __NR_clock_settime64 6404 +#define __NR_clock_adjtime64 6405 +#define __NR_clock_getres_time64 6406 +#define __NR_clock_nanosleep_time64 6407 +#define __NR_timer_gettime64 6408 +#define __NR_timer_settime64 6409 +#define __NR_timerfd_gettime64 6410 +#define __NR_timerfd_settime64 6411 +#define __NR_utimensat_time64 6412 +#define __NR_pselect6_time64 6413 +#define __NR_ppoll_time64 6414 +#define __NR_io_pgetevents_time64 6416 +#define __NR_recvmmsg_time64 6417 +#define __NR_mq_timedsend_time64 6418 +#define __NR_mq_timedreceive_time64 6419 +#define __NR_semtimedop_time64 6420 +#define __NR_rt_sigtimedwait_time64 6421 +#define __NR_futex_time64 6422 +#define __NR_sched_rr_get_interval_time64 6423 +#define __NR_pidfd_send_signal 6424 +#define __NR_io_uring_setup 6425 +#define __NR_io_uring_enter 6426 +#define __NR_io_uring_register 6427 +#define __NR_open_tree 6428 +#define __NR_move_mount 6429 +#define __NR_fsopen 6430 +#define __NR_fsconfig 6431 +#define __NR_fsmount 6432 +#define __NR_fspick 6433 +#define __NR_pidfd_open 6434 +#define __NR_clone3 6435 +#define __NR_close_range 6436 +#define __NR_openat2 6437 +#define __NR_pidfd_getfd 6438 +#define __NR_faccessat2 6439 +#define __NR_process_madvise 6440 +#define __NR_epoll_pwait2 6441 +#define __NR_mount_setattr 6442 +#define __NR_landlock_create_ruleset 6444 +#define __NR_landlock_add_rule 6445 +#define __NR_landlock_restrict_self 6446 +#define __NR_process_mrelease 6448 +#define __NR_futex_waitv 6449 +#define __NR_set_mempolicy_home_node 6450 +#define __NR_cachestat 6451 +#define __NR_fchmodat2 6452 diff --git a/arch/mipsn32/bits/termios.h b/arch/mipsn32/bits/termios.h index f7b9dd2e..9d571f78 100644 --- a/arch/mipsn32/bits/termios.h +++ b/arch/mipsn32/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/mipsn32/ksigaction.h b/arch/mipsn32/ksigaction.h index b565f1fc..485abf75 100644 --- a/arch/mipsn32/ksigaction.h +++ b/arch/mipsn32/ksigaction.h @@ -4,7 +4,7 @@ struct k_sigaction { unsigned flags; void (*handler)(int); unsigned long mask[4]; - void (*restorer)(); + void *unused; }; hidden void __restore(), __restore_rt(); diff --git a/arch/mipsn32/kstat.h b/arch/mipsn32/kstat.h new file mode 100644 index 00000000..3841559c --- /dev/null +++ b/arch/mipsn32/kstat.h @@ -0,0 +1,22 @@ +struct kstat { + unsigned st_dev; + long __pad1[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 __pad2[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 __pad3; + blkcnt_t st_blocks; + long __pad4[14]; +}; diff --git a/arch/mipsn32/pthread_arch.h b/arch/mipsn32/pthread_arch.h index 1e7839ea..c45347ab 100644 --- a/arch/mipsn32/pthread_arch.h +++ b/arch/mipsn32/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/mipsn32/reloc.h b/arch/mipsn32/reloc.h index 728aaab2..bf00bd6a 100644 --- a/arch/mipsn32/reloc.h +++ b/arch/mipsn32/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/mipsn32/syscall_arch.h b/arch/mipsn32/syscall_arch.h index f6a1fbae..c681905d 100644 --- a/arch/mipsn32/syscall_arch.h +++ b/arch/mipsn32/syscall_arch.h @@ -1,20 +1,16 @@ #define __SYSCALL_LL_E(x) (x) #define __SYSCALL_LL_O(x) (x) -hidden long (__syscall)(long, ...); - #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", "$10", "$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", "$10", "$11", "$12", "$13", \ + "$14", "$15", "$24", "$25", "hi", "lo", "memory" #endif static inline long __syscall0(long n) @@ -22,11 +18,11 @@ static inline long __syscall0(long n) register long r7 __asm__("$7"); 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; + "daddu $2,$0,%2 ; syscall" + : "=&r"(r2), "=r"(r7) + : "ir"(n), "0"(r2) + : SYSCALL_CLOBBERLIST); + return r7 && r2>0 ? -r2 : r2; } static inline long __syscall1(long n, long a) @@ -35,12 +31,11 @@ static inline long __syscall1(long n, long a) register long r7 __asm__("$7"); 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; + "daddu $2,$0,%2 ; syscall" + : "=&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) @@ -49,16 +44,13 @@ static inline long __syscall2(long n, long a, long b) register long r5 __asm__("$5") = b; register long r7 __asm__("$7"); 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_stat || n == SYS_fstat || n == SYS_lstat) __stat_fix(b); - return ret; + "daddu $2,$0,%2 ; syscall" + : "=&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) @@ -68,16 +60,13 @@ static inline long __syscall3(long n, long a, long b, long c) register long r6 __asm__("$6") = c; register long r7 __asm__("$7"); 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_stat || n == SYS_fstat || n == SYS_lstat) __stat_fix(b); - return ret; + "daddu $2,$0,%2 ; syscall" + : "=&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) @@ -87,37 +76,55 @@ static inline long __syscall4(long n, long a, long b, long c, long d) register long r6 __asm__("$6") = c; register long r7 __asm__("$7") = 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_stat || n == SYS_fstat || n == SYS_lstat) __stat_fix(b); - if (n == SYS_newfstatat) __stat_fix(c); - return ret; + "daddu $2,$0,%2 ; syscall" + : "=&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 = (__syscall)(n, a, b, c, d, e); - if (r2 > -4096UL) return r2; - if (n == SYS_stat || n == SYS_fstat || n == SYS_lstat) __stat_fix(b); - if (n == SYS_newfstatat) __stat_fix(c); - return r2; + 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"); + + __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 = (__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(b); - if (n == SYS_newfstatat) __stat_fix(c); - return r2; + 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"); + + __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_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 diff --git a/arch/or1k/arch.mak b/arch/or1k/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/or1k/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/or1k/bits/alltypes.h.in b/arch/or1k/bits/alltypes.h.in index 667963c7..7d3e291a 100644 --- a/arch/or1k/bits/alltypes.h.in +++ b/arch/or1k/bits/alltypes.h.in @@ -1,9 +1,10 @@ +#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; +#define __BYTE_ORDER 4321 +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus TYPEDEF unsigned wchar_t; @@ -13,14 +14,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/or1k/bits/endian.h b/arch/or1k/bits/endian.h deleted file mode 100644 index ef074b77..00000000 --- a/arch/or1k/bits/endian.h +++ /dev/null @@ -1 +0,0 @@ -#define __BYTE_ORDER __BIG_ENDIAN diff --git a/arch/or1k/bits/ipc.h b/arch/or1k/bits/ipc.h deleted file mode 100644 index 3d894e30..00000000 --- a/arch/or1k/bits/ipc.h +++ /dev/null @@ -1,13 +0,0 @@ -struct ipc_perm { - key_t __ipc_perm_key; - uid_t uid; - gid_t gid; - uid_t cuid; - gid_t cgid; - mode_t mode; - int __ipc_perm_seq; - long __pad1; - long __pad2; -}; - -#define IPC_64 0 diff --git a/arch/or1k/bits/ipcstat.h b/arch/or1k/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/or1k/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/or1k/bits/limits.h b/arch/or1k/bits/limits.h index 3a811c99..fac47aad 100644 --- a/arch/or1k/bits/limits.h +++ b/arch/or1k/bits/limits.h @@ -1,8 +1 @@ -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGESIZE 8192 -#define LONG_BIT 32 -#endif - -#define LONG_MAX 0x7fffffffL -#define LLONG_MAX 0x7fffffffffffffffLL diff --git a/arch/or1k/bits/msg.h b/arch/or1k/bits/msg.h index bc8436c4..7bbbb2bf 100644 --- a/arch/or1k/bits/msg.h +++ b/arch/or1k/bits/msg.h @@ -1,15 +1,18 @@ struct msqid_ds { struct ipc_perm msg_perm; - 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; unsigned long msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; 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/or1k/bits/sem.h b/arch/or1k/bits/sem.h new file mode 100644 index 00000000..d88338e6 --- /dev/null +++ b/arch/or1k/bits/sem.h @@ -0,0 +1,13 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/s390x/bits/shm.h b/arch/or1k/bits/shm.h index 6652d659..725fb469 100644 --- a/arch/s390x/bits/shm.h +++ b/arch/or1k/bits/shm.h @@ -3,14 +3,21 @@ 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_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; unsigned long __pad1; unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; }; struct shminfo { @@ -22,4 +29,3 @@ struct shm_info { unsigned long shm_tot, shm_rss, shm_swp; unsigned long __swap_attempts, __swap_successes; }; - diff --git a/arch/or1k/bits/signal.h b/arch/or1k/bits/signal.h index be576d1d..c45be676 100644 --- a/arch/or1k/bits/signal.h +++ b/arch/or1k/bits/signal.h @@ -43,7 +43,6 @@ typedef struct __ucontext { #define SA_RESTART 0x10000000 #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 -#define SA_RESTORER 0x04000000 #endif diff --git a/arch/or1k/bits/stat.h b/arch/or1k/bits/stat.h index ce6a6bd0..cde3fd02 100644 --- a/arch/or1k/bits/stat.h +++ b/arch/or1k/bits/stat.h @@ -14,8 +14,12 @@ struct stat { blksize_t st_blksize; int __st_blksize_padding; blkcnt_t st_blocks; - 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; unsigned __unused[2]; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; }; diff --git a/arch/or1k/bits/syscall.h.in b/arch/or1k/bits/syscall.h.in index 76ba2c6e..00812bf8 100644 --- a/arch/or1k/bits/syscall.h.in +++ b/arch/or1k/bits/syscall.h.in @@ -85,8 +85,8 @@ #define __NR_fdatasync 83 #define __NR_sync_file_range 84 #define __NR_timerfd_create 85 -#define __NR_timerfd_settime 86 -#define __NR_timerfd_gettime 87 +#define __NR_timerfd_settime32 86 +#define __NR_timerfd_gettime32 87 #define __NR_utimensat 88 #define __NR_acct 89 #define __NR_capget 90 @@ -107,14 +107,14 @@ #define __NR_init_module 105 #define __NR_delete_module 106 #define __NR_timer_create 107 -#define __NR_timer_gettime 108 +#define __NR_timer_gettime32 108 #define __NR_timer_getoverrun 109 -#define __NR_timer_settime 110 +#define __NR_timer_settime32 110 #define __NR_timer_delete 111 -#define __NR_clock_settime 112 -#define __NR_clock_gettime 113 -#define __NR_clock_getres 114 -#define __NR_clock_nanosleep 115 +#define __NR_clock_settime32 112 +#define __NR_clock_gettime32 113 +#define __NR_clock_getres_time32 114 +#define __NR_clock_nanosleep_time32 115 #define __NR_syslog 116 #define __NR_ptrace 117 #define __NR_sched_setparam 118 @@ -168,8 +168,8 @@ #define __NR_umask 166 #define __NR_prctl 167 #define __NR_getcpu 168 -#define __NR_gettimeofday 169 -#define __NR_settimeofday 170 +#define __NR_gettimeofday_time32 169 +#define __NR_settimeofday_time32 170 #define __NR_adjtimex 171 #define __NR_getpid 172 #define __NR_getppid 173 @@ -277,4 +277,53 @@ #define __NR_pkey_free 290 #define __NR_statx 291 #define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/or1k/kstat.h b/arch/or1k/kstat.h new file mode 100644 index 00000000..c1449579 --- /dev/null +++ b/arch/or1k/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + long long __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + int __st_blksize_padding; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned __unused[2]; +}; diff --git a/arch/or1k/pthread_arch.h b/arch/or1k/pthread_arch.h index 1b806f89..f75ea7e4 100644 --- a/arch/or1k/pthread_arch.h +++ b/arch/or1k/pthread_arch.h @@ -1,18 +1,16 @@ -/* or1k use variant I, but with the twist that tp points to the end of TCB */ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { #ifdef __clang__ - char *tp; + uintptr_t tp; __asm__ ("l.ori %0, r10, 0" : "=r" (tp) ); #else - register char *tp __asm__("r10"); + register uintptr_t tp __asm__("r10"); __asm__ ("" : "=r" (tp) ); #endif - return (struct pthread *) (tp - sizeof(struct pthread)); + return tp; } #define TLS_ABOVE_TP #define GAP_ABOVE_TP 0 -#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread)) #define MC_PC regs.pc diff --git a/arch/or1k/syscall_arch.h b/arch/or1k/syscall_arch.h index caff7ece..21738ce0 100644 --- a/arch/or1k/syscall_arch.h +++ b/arch/or1k/syscall_arch.h @@ -5,8 +5,6 @@ #define SYSCALL_MMAP2_UNIT 8192ULL -#ifndef __clang__ - static __inline long __syscall0(long n) { register unsigned long r11 __asm__("r11") = n; @@ -114,9 +112,4 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo return r11; } -#else - -#undef SYSCALL_NO_INLINE -#define SYSCALL_NO_INLINE - -#endif +#define IPC_64 0 diff --git a/arch/powerpc/arch.mak b/arch/powerpc/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/powerpc/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/powerpc/bits/alltypes.h.in b/arch/powerpc/bits/alltypes.h.in index 37f27d6f..b48df6a6 100644 --- a/arch/powerpc/bits/alltypes.h.in +++ b/arch/powerpc/bits/alltypes.h.in @@ -1,26 +1,20 @@ +#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; +#define __BYTE_ORDER 4321 +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus +#ifdef __WCHAR_TYPE__ +TYPEDEF __WCHAR_TYPE__ wchar_t; +#else TYPEDEF long wchar_t; #endif +#endif 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/powerpc/bits/endian.h b/arch/powerpc/bits/endian.h deleted file mode 100644 index 4442abf4..00000000 --- a/arch/powerpc/bits/endian.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef __BIG_ENDIAN__ - #if __BIG_ENDIAN__ - #define __BYTE_ORDER __BIG_ENDIAN - #endif -#endif /* __BIG_ENDIAN__ */ - -#ifdef __LITTLE_ENDIAN__ - #if __LITTLE_ENDIAN__ - #define __BYTE_ORDER __LITTLE_ENDIAN - #endif -#endif /* __LITTLE_ENDIAN__ */ - -#ifndef __BYTE_ORDER - #define __BYTE_ORDER __BIG_ENDIAN -#endif diff --git a/arch/powerpc/bits/fenv.h b/arch/powerpc/bits/fenv.h index c5a3e5c5..5b15c69a 100644 --- a/arch/powerpc/bits/fenv.h +++ b/arch/powerpc/bits/fenv.h @@ -1,4 +1,4 @@ -#ifdef _SOFT_FLOAT +#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) #define FE_ALL_EXCEPT 0 #define FE_TONEAREST 0 #else diff --git a/arch/powerpc/bits/ioctl.h b/arch/powerpc/bits/ioctl.h index 47586234..ac9bfd20 100644 --- a/arch/powerpc/bits/ioctl.h +++ b/arch/powerpc/bits/ioctl.h @@ -78,14 +78,6 @@ #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TIOCPKT 0x5420 -#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 TIOCNOTTY 0x5422 #define TIOCSETD 0x5423 @@ -113,105 +105,16 @@ #define TIOCSLCKTRMIOS 0x5457 #define TIOCSERGSTRUCT 0x5458 #define TIOCSERGETLSR 0x5459 -#define TIOCSER_TEMT 0x01 #define TIOCSERGETMULTI 0x545A #define TIOCSERSETMULTI 0x545B #define TIOCMIWAIT 0x545C #define TIOCGICOUNT 0x545D - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#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 FIOSETOWN 0x8901 #define SIOCSPGRP 0x8902 #define FIOGETOWN 0x8903 #define SIOCGPGRP 0x8904 #define SIOCATMARK 0x8905 -#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 +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) diff --git a/arch/powerpc/bits/ipc.h b/arch/powerpc/bits/ipc.h index 3f2ede07..a388d56b 100644 --- a/arch/powerpc/bits/ipc.h +++ b/arch/powerpc/bits/ipc.h @@ -10,6 +10,3 @@ struct ipc_perm { long long __pad2; long long __pad3; }; - -#define IPC_64 0x100 - diff --git a/arch/powerpc/bits/ipcstat.h b/arch/powerpc/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/powerpc/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/powerpc/bits/limits.h b/arch/powerpc/bits/limits.h deleted file mode 100644 index fbc6d238..00000000 --- a/arch/powerpc/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/powerpc/bits/mman.h b/arch/powerpc/bits/mman.h index b3a675a8..95ec4358 100644 --- a/arch/powerpc/bits/mman.h +++ b/arch/powerpc/bits/mman.h @@ -4,7 +4,6 @@ #define MAP_NORESERVE 0x40 #undef MAP_LOCKED #define MAP_LOCKED 0x80 -#undef MAP_SYNC #undef MCL_CURRENT #define MCL_CURRENT 0x2000 diff --git a/arch/powerpc/bits/msg.h b/arch/powerpc/bits/msg.h index 171c11a3..9fb15dcc 100644 --- a/arch/powerpc/bits/msg.h +++ b/arch/powerpc/bits/msg.h @@ -1,15 +1,18 @@ struct msqid_ds { struct ipc_perm msg_perm; - 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; unsigned long msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; 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/powerpc/bits/ptrace.h b/arch/powerpc/bits/ptrace.h index 75086ca0..303a0735 100644 --- a/arch/powerpc/bits/ptrace.h +++ b/arch/powerpc/bits/ptrace.h @@ -8,6 +8,8 @@ #define PTRACE_SET_DEBUGREG 0x1a #define PTRACE_GETVSRREGS 0x1b #define PTRACE_SETVSRREGS 0x1c +#define PTRACE_SYSEMU 0x1d +#define PTRACE_SYSEMU_SINGLESTEP 0x1e #define PTRACE_SINGLEBLOCK 0x100 #define PT_GETVRREGS PTRACE_GETVRREGS diff --git a/arch/powerpc/bits/sem.h b/arch/powerpc/bits/sem.h index bc2d6d1f..28be4845 100644 --- a/arch/powerpc/bits/sem.h +++ b/arch/powerpc/bits/sem.h @@ -1,10 +1,12 @@ struct semid_ds { struct ipc_perm sem_perm; - int __unused1; - time_t sem_otime; - int __unused2; - time_t sem_ctime; + unsigned long __sem_otime_hi; + unsigned long __sem_otime_lo; + unsigned long __sem_ctime_hi; + unsigned long __sem_ctime_lo; unsigned short __sem_nsems_pad, sem_nsems; long __unused3; long __unused4; + time_t sem_otime; + time_t sem_ctime; }; diff --git a/arch/powerpc/bits/shm.h b/arch/powerpc/bits/shm.h index 40e5e8be..7f1ca17e 100644 --- a/arch/powerpc/bits/shm.h +++ b/arch/powerpc/bits/shm.h @@ -2,19 +2,21 @@ struct shmid_ds { struct ipc_perm shm_perm; - int __unused1; - time_t shm_atime; - int __unused2; - time_t shm_dtime; - int __unused3; - time_t shm_ctime; - int __unused4; + unsigned long __shm_atime_hi; + unsigned long __shm_atime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_ctime_hi; + unsigned long __shm_ctime_lo; + unsigned long __pad1; size_t shm_segsz; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; - unsigned long __pad1; unsigned long __pad2; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; }; struct shminfo { @@ -26,4 +28,3 @@ struct shm_info { unsigned long shm_tot, shm_rss, shm_swp; unsigned long __swap_attempts, __swap_successes; }; - diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h index 06efb11c..c1bf3caf 100644 --- a/arch/powerpc/bits/signal.h +++ b/arch/powerpc/bits/signal.h @@ -28,7 +28,7 @@ struct sigcontext { int signal; unsigned long handler; unsigned long oldmask; - void *regs; + struct pt_regs *regs; }; typedef struct { diff --git a/arch/powerpc/bits/socket.h b/arch/powerpc/bits/socket.h index a94b8bdb..b19ed42b 100644 --- a/arch/powerpc/bits/socket.h +++ b/arch/powerpc/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 SO_DEBUG 1 #define SO_REUSEADDR 2 #define SO_TYPE 3 @@ -31,8 +15,6 @@ struct cmsghdr { #define SO_REUSEPORT 15 #define SO_RCVLOWAT 16 #define SO_SNDLOWAT 17 -#define SO_RCVTIMEO 18 -#define SO_SNDTIMEO 19 #define SO_PASSCRED 20 #define SO_PEERCRED 21 #define SO_ACCEPTCONN 30 diff --git a/arch/powerpc/bits/stat.h b/arch/powerpc/bits/stat.h index dcb896fd..585d98e9 100644 --- a/arch/powerpc/bits/stat.h +++ b/arch/powerpc/bits/stat.h @@ -13,8 +13,12 @@ struct stat { off_t st_size; blksize_t st_blksize; blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + unsigned __unused[2]; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - unsigned __unused[2]; }; diff --git a/arch/powerpc/bits/syscall.h.in b/arch/powerpc/bits/syscall.h.in index 54e155f2..ea95f3ed 100644 --- a/arch/powerpc/bits/syscall.h.in +++ b/arch/powerpc/bits/syscall.h.in @@ -76,8 +76,8 @@ #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_select 82 @@ -238,14 +238,14 @@ #define __NR_epoll_wait 238 #define __NR_remap_file_pages 239 #define __NR_timer_create 240 -#define __NR_timer_settime 241 -#define __NR_timer_gettime 242 +#define __NR_timer_settime32 241 +#define __NR_timer_gettime32 242 #define __NR_timer_getoverrun 243 #define __NR_timer_delete 244 -#define __NR_clock_settime 245 -#define __NR_clock_gettime 246 -#define __NR_clock_getres 247 -#define __NR_clock_nanosleep 248 +#define __NR_clock_settime32 245 +#define __NR_clock_gettime32 246 +#define __NR_clock_getres_time32 247 +#define __NR_clock_nanosleep_time32 248 #define __NR_swapcontext 249 #define __NR_tgkill 250 #define __NR_utimes 251 @@ -307,8 +307,8 @@ #define __NR_sync_file_range2 308 #define __NR_fallocate 309 #define __NR_subpage_prot 310 -#define __NR_timerfd_settime 311 -#define __NR_timerfd_gettime 312 +#define __NR_timerfd_settime32 311 +#define __NR_timerfd_gettime32 312 #define __NR_signalfd4 313 #define __NR_eventfd2 314 #define __NR_epoll_create1 315 @@ -373,4 +373,61 @@ #define __NR_pkey_mprotect 386 #define __NR_rseq 387 #define __NR_io_pgetevents 388 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/powerpc/bits/termios.h b/arch/powerpc/bits/termios.h index e3f22e86..da1f406b 100644 --- a/arch/powerpc/bits/termios.h +++ b/arch/powerpc/bits/termios.h @@ -167,5 +167,5 @@ struct termios { #define EXTPROC 0x10000000 #define XTABS 00006000 -#define TIOCSER_TEMT 0x01 +#define TIOCSER_TEMT 1 #endif diff --git a/arch/powerpc/bits/user.h b/arch/powerpc/bits/user.h index 6cc8aaf7..7f528746 100644 --- a/arch/powerpc/bits/user.h +++ b/arch/powerpc/bits/user.h @@ -1,10 +1,8 @@ -struct pt_regs { - unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq; - unsigned long trap, dar, dsisr, result; -}; - struct user { - struct pt_regs regs; + struct { + unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq; + unsigned long trap, dar, dsisr, result; + } regs; unsigned long u_tsize, u_dsize, u_ssize; unsigned long start_code, start_data, start_stack; long signal; diff --git a/arch/powerpc/kstat.h b/arch/powerpc/kstat.h new file mode 100644 index 00000000..5a611e7b --- /dev/null +++ b/arch/powerpc/kstat.h @@ -0,0 +1,20 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + short __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned __unused[2]; +}; diff --git a/arch/powerpc/pthread_arch.h b/arch/powerpc/pthread_arch.h index ae0f28d6..42e88b07 100644 --- a/arch/powerpc/pthread_arch.h +++ b/arch/powerpc/pthread_arch.h @@ -1,18 +1,16 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - register char *tp __asm__("r2"); + register uintptr_t tp __asm__("r2"); __asm__ ("" : "=r" (tp) ); - 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 // the kernel calls the ip "nip", it's the first saved value after the 32 // GPRs. #define MC_PC gregs[32] - -#define CANARY canary_at_end diff --git a/arch/powerpc/reloc.h b/arch/powerpc/reloc.h index 1b4cab36..fdfbf827 100644 --- a/arch/powerpc/reloc.h +++ b/arch/powerpc/reloc.h @@ -1,4 +1,4 @@ -#ifdef _SOFT_FLOAT +#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) #define FP_SUFFIX "-sf" #else #define FP_SUFFIX "" @@ -9,6 +9,7 @@ #define TPOFF_K (-0x7000) #define REL_SYMBOLIC R_PPC_ADDR32 +#define REL_USYMBOLIC R_PPC_UADDR32 #define REL_GOT R_PPC_GLOB_DAT #define REL_PLT R_PPC_JMP_SLOT #define REL_RELATIVE R_PPC_RELATIVE diff --git a/arch/powerpc/syscall_arch.h b/arch/powerpc/syscall_arch.h index 004060e6..ede97c1c 100644 --- a/arch/powerpc/syscall_arch.h +++ b/arch/powerpc/syscall_arch.h @@ -3,7 +3,92 @@ ((union { long long ll; long l[2]; }){ .ll = x }).l[1] #define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) -#undef SYSCALL_NO_INLINE -#define SYSCALL_NO_INLINE +static inline long __syscall0(long n) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3"); + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "=r"(r3) + :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"); + return r3; +} + +static inline long __syscall1(long n, long a) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3") = a; + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "+r"(r3) + :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"); + return r3; +} + +static inline long __syscall2(long n, long a, long b) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3") = a; + register long r4 __asm__("r4") = b; + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "+r"(r3), "+r"(r4) + :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"); + return r3; +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3") = a; + register long r4 __asm__("r4") = b; + register long r5 __asm__("r5") = c; + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5) + :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12"); + return r3; +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3") = a; + register long r4 __asm__("r4") = b; + register long r5 __asm__("r5") = c; + register long r6 __asm__("r6") = d; + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6) + :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12"); + return r3; +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3") = a; + register long r4 __asm__("r4") = b; + register long r5 __asm__("r5") = c; + register long r6 __asm__("r6") = d; + register long r7 __asm__("r7") = e; + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7) + :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12"); + return r3; +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long r0 __asm__("r0") = n; + register long r3 __asm__("r3") = a; + register long r4 __asm__("r4") = b; + register long r5 __asm__("r5") = c; + register long r6 __asm__("r6") = d; + register long r7 __asm__("r7") = e; + register long r8 __asm__("r8") = f; + __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:" + : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8) + :: "memory", "cr0", "r9", "r10", "r11", "r12"); + return r3; +} #define SYSCALL_FADVISE_6_ARG + +#define SO_RCVTIMEO_OLD 18 +#define SO_SNDTIMEO_OLD 19 diff --git a/arch/powerpc64/bits/alltypes.h.in b/arch/powerpc64/bits/alltypes.h.in index 5b205851..143ffa8d 100644 --- a/arch/powerpc64/bits/alltypes.h.in +++ b/arch/powerpc64/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 __BIG_ENDIAN__ +#define __BYTE_ORDER 4321 +#else +#define __BYTE_ORDER 1234 +#endif + +#define __LONG_MAX 0x7fffffffffffffffL #ifndef __cplusplus TYPEDEF int wchar_t; @@ -13,14 +18,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[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/powerpc64/bits/endian.h b/arch/powerpc64/bits/endian.h deleted file mode 100644 index 2016cb20..00000000 --- a/arch/powerpc64/bits/endian.h +++ /dev/null @@ -1,5 +0,0 @@ -#if __BIG_ENDIAN__ -#define __BYTE_ORDER __BIG_ENDIAN -#else -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif diff --git a/arch/powerpc64/bits/ioctl.h b/arch/powerpc64/bits/ioctl.h index 47586234..b6cbb18f 100644 --- a/arch/powerpc64/bits/ioctl.h +++ b/arch/powerpc64/bits/ioctl.h @@ -78,14 +78,6 @@ #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TIOCPKT 0x5420 -#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 TIOCNOTTY 0x5422 #define TIOCSETD 0x5423 @@ -113,38 +105,12 @@ #define TIOCSLCKTRMIOS 0x5457 #define TIOCSERGSTRUCT 0x5458 #define TIOCSERGETLSR 0x5459 -#define TIOCSER_TEMT 0x01 #define TIOCSERGETMULTI 0x545A #define TIOCSERSETMULTI 0x545B #define TIOCMIWAIT 0x545C #define TIOCGICOUNT 0x545D - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#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 FIOSETOWN 0x8901 #define SIOCSPGRP 0x8902 #define FIOGETOWN 0x8903 @@ -152,66 +118,3 @@ struct winsize { #define SIOCATMARK 0x8905 #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/powerpc64/bits/ipc.h b/arch/powerpc64/bits/ipc.h index 3f2ede07..a388d56b 100644 --- a/arch/powerpc64/bits/ipc.h +++ b/arch/powerpc64/bits/ipc.h @@ -10,6 +10,3 @@ struct ipc_perm { long long __pad2; long long __pad3; }; - -#define IPC_64 0x100 - diff --git a/arch/powerpc64/bits/limits.h b/arch/powerpc64/bits/limits.h deleted file mode 100644 index 0226588c..00000000 --- a/arch/powerpc64/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/powerpc64/bits/mman.h b/arch/powerpc64/bits/mman.h index b3a675a8..95ec4358 100644 --- a/arch/powerpc64/bits/mman.h +++ b/arch/powerpc64/bits/mman.h @@ -4,7 +4,6 @@ #define MAP_NORESERVE 0x40 #undef MAP_LOCKED #define MAP_LOCKED 0x80 -#undef MAP_SYNC #undef MCL_CURRENT #define MCL_CURRENT 0x2000 diff --git a/arch/powerpc64/bits/ptrace.h b/arch/powerpc64/bits/ptrace.h index 75086ca0..303a0735 100644 --- a/arch/powerpc64/bits/ptrace.h +++ b/arch/powerpc64/bits/ptrace.h @@ -8,6 +8,8 @@ #define PTRACE_SET_DEBUGREG 0x1a #define PTRACE_GETVSRREGS 0x1b #define PTRACE_SETVSRREGS 0x1c +#define PTRACE_SYSEMU 0x1d +#define PTRACE_SYSEMU_SINGLESTEP 0x1e #define PTRACE_SINGLEBLOCK 0x100 #define PT_GETVRREGS PTRACE_GETVRREGS diff --git a/arch/powerpc64/bits/sem.h b/arch/powerpc64/bits/sem.h deleted file mode 100644 index 558184db..00000000 --- a/arch/powerpc64/bits/sem.h +++ /dev/null @@ -1,13 +0,0 @@ -#include <endian.h> - -struct semid_ds { - struct ipc_perm sem_perm; - time_t sem_otime; - time_t sem_ctime; -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned short __pad[3], sem_nsems; -#else - unsigned short sem_nsems, __pad[3]; -#endif - unsigned long __unused[2]; -}; diff --git a/arch/powerpc64/bits/shm.h b/arch/powerpc64/bits/shm.h index 8108c3a8..b7f73a8d 100644 --- a/arch/powerpc64/bits/shm.h +++ b/arch/powerpc64/bits/shm.h @@ -21,4 +21,3 @@ struct shm_info { unsigned long shm_tot, shm_rss, shm_swp; unsigned long __swap_attempts, __swap_successes; }; - diff --git a/arch/powerpc64/bits/signal.h b/arch/powerpc64/bits/signal.h index 34693a68..d5493b18 100644 --- a/arch/powerpc64/bits/signal.h +++ b/arch/powerpc64/bits/signal.h @@ -9,18 +9,21 @@ #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) typedef unsigned long greg_t, gregset_t[48]; +typedef double fpregset_t[33]; typedef struct { - double fpregs[32]; - double fpscr; -} fpregset_t; - -typedef struct { - unsigned __int128 vrregs[32]; - unsigned _pad[3]; - unsigned vrsave; - unsigned vscr; - unsigned _pad2[3]; +#ifdef __GNUC__ + __attribute__((__aligned__(16))) +#endif + unsigned vrregs[32][4]; + struct { +#if __BIG_ENDIAN__ + unsigned _pad[3], vscr_word; +#else + unsigned vscr_word, _pad[3]; +#endif + } vscr; + unsigned vrsave, _pad[3]; } vrregset_t; typedef struct sigcontext { @@ -29,7 +32,7 @@ typedef struct sigcontext { int _pad0; unsigned long handler; unsigned long oldmask; - void *regs; + struct pt_regs *regs; gregset_t gp_regs; fpregset_t fp_regs; vrregset_t *v_regs; diff --git a/arch/powerpc64/bits/socket.h b/arch/powerpc64/bits/socket.h index 0f3c9aac..557e324f 100644 --- a/arch/powerpc64/bits/socket.h +++ b/arch/powerpc64/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 SO_DEBUG 1 #define SO_REUSEADDR 2 #define SO_TYPE 3 diff --git a/arch/powerpc64/bits/syscall.h.in b/arch/powerpc64/bits/syscall.h.in index 4e29cedf..43551079 100644 --- a/arch/powerpc64/bits/syscall.h.in +++ b/arch/powerpc64/bits/syscall.h.in @@ -364,4 +364,42 @@ #define __NR_pkey_mprotect 386 #define __NR_rseq 387 #define __NR_io_pgetevents 388 +#define __NR_semtimedop 392 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/powerpc64/bits/termios.h b/arch/powerpc64/bits/termios.h index e3f22e86..da1f406b 100644 --- a/arch/powerpc64/bits/termios.h +++ b/arch/powerpc64/bits/termios.h @@ -167,5 +167,5 @@ struct termios { #define EXTPROC 0x10000000 #define XTABS 00006000 -#define TIOCSER_TEMT 0x01 +#define TIOCSER_TEMT 1 #endif diff --git a/arch/powerpc64/bits/user.h b/arch/powerpc64/bits/user.h index 7ca459b3..7e75d201 100644 --- a/arch/powerpc64/bits/user.h +++ b/arch/powerpc64/bits/user.h @@ -1,10 +1,8 @@ -struct pt_regs { - unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe; - unsigned long trap, dar, dsisr, result; -}; - struct user { - struct pt_regs regs; + struct { + unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe; + unsigned long trap, dar, dsisr, result; + } regs; unsigned long u_tsize, u_dsize, u_ssize; unsigned long start_code, start_data, start_stack; long signal; diff --git a/arch/powerpc64/kstat.h b/arch/powerpc64/kstat.h new file mode 100644 index 00000000..887b3e26 --- /dev/null +++ b/arch/powerpc64/kstat.h @@ -0,0 +1,19 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned long __unused[3]; +}; diff --git a/arch/powerpc64/pthread_arch.h b/arch/powerpc64/pthread_arch.h index 79c3ecd8..1b7b9079 100644 --- a/arch/powerpc64/pthread_arch.h +++ b/arch/powerpc64/pthread_arch.h @@ -1,18 +1,16 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - register char *tp __asm__("r13"); + register uintptr_t tp __asm__("r13"); __asm__ ("" : "=r" (tp) ); - 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 // the kernel calls the ip "nip", it's the first saved value after the 32 // GPRs. #define MC_PC gp_regs[32] - -#define CANARY canary_at_end diff --git a/arch/powerpc64/reloc.h b/arch/powerpc64/reloc.h index faf70acd..2f1bba05 100644 --- a/arch/powerpc64/reloc.h +++ b/arch/powerpc64/reloc.h @@ -1,5 +1,3 @@ -#include <endian.h> - #if __BYTE_ORDER == __LITTLE_ENDIAN #define ENDIAN_SUFFIX "le" #else @@ -11,6 +9,7 @@ #define TPOFF_K (-0x7000) #define REL_SYMBOLIC R_PPC64_ADDR64 +#define REL_USYMBOLIC R_PPC64_UADDR64 #define REL_GOT R_PPC64_GLOB_DAT #define REL_PLT R_PPC64_JMP_SLOT #define REL_RELATIVE R_PPC64_RELATIVE diff --git a/arch/powerpc64/syscall_arch.h b/arch/powerpc64/syscall_arch.h index 1e730625..76b4e335 100644 --- a/arch/powerpc64/syscall_arch.h +++ b/arch/powerpc64/syscall_arch.h @@ -85,3 +85,6 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo :: "memory", "cr0", "r9", "r10", "r11", "r12"); return r3; } + +#define SO_RCVTIMEO_OLD 18 +#define SO_SNDTIMEO_OLD 19 diff --git a/arch/riscv32/atomic_arch.h b/arch/riscv32/atomic_arch.h new file mode 100644 index 00000000..4d418f63 --- /dev/null +++ b/arch/riscv32/atomic_arch.h @@ -0,0 +1,21 @@ +#define a_barrier a_barrier +static inline void a_barrier() +{ + __asm__ __volatile__ ("fence rw,rw" : : : "memory"); +} + +#define a_cas a_cas +static inline int a_cas(volatile int *p, int t, int s) +{ + int old, tmp; + __asm__ __volatile__ ( + "\n1: lr.w.aqrl %0, (%2)\n" + " bne %0, %3, 1f\n" + " sc.w.aqrl %1, %4, (%2)\n" + " bnez %1, 1b\n" + "1:" + : "=&r"(old), "=&r"(tmp) + : "r"(p), "r"((long)t), "r"((long)s) + : "memory"); + return old; +} diff --git a/arch/riscv32/bits/alltypes.h.in b/arch/riscv32/bits/alltypes.h.in new file mode 100644 index 00000000..e2b6129e --- /dev/null +++ b/arch/riscv32/bits/alltypes.h.in @@ -0,0 +1,18 @@ +#define _Addr int +#define _Int64 long long +#define _Reg int + +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffL + +#ifndef __cplusplus +TYPEDEF int wchar_t; +#endif + +TYPEDEF int blksize_t; +TYPEDEF unsigned int nlink_t; + +TYPEDEF float float_t; +TYPEDEF double double_t; + +TYPEDEF struct { long long __ll; long double __ld; } max_align_t; diff --git a/arch/riscv32/bits/fenv.h b/arch/riscv32/bits/fenv.h new file mode 100644 index 00000000..806ec40f --- /dev/null +++ b/arch/riscv32/bits/fenv.h @@ -0,0 +1,17 @@ +#define FE_INVALID 16 +#define FE_DIVBYZERO 8 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 2 +#define FE_INEXACT 1 + +#define FE_ALL_EXCEPT 31 + +#define FE_TONEAREST 0 +#define FE_DOWNWARD 2 +#define FE_UPWARD 3 +#define FE_TOWARDZERO 1 + +typedef unsigned int fexcept_t; +typedef unsigned int fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/arch/riscv32/bits/float.h b/arch/riscv32/bits/float.h new file mode 100644 index 00000000..719c7908 --- /dev/null +++ b/arch/riscv32/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L + +#define LDBL_MANT_DIG 113 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MAX_EXP 16384 + +#define LDBL_DIG 33 +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_10_EXP 4932 + +#define DECIMAL_DIG 36 diff --git a/arch/riscv32/bits/ipcstat.h b/arch/riscv32/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/riscv32/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/powerpc64/bits/msg.h b/arch/riscv32/bits/msg.h index 2e23ca27..7bbbb2bf 100644 --- a/arch/powerpc64/bits/msg.h +++ b/arch/riscv32/bits/msg.h @@ -1,12 +1,18 @@ struct msqid_ds { struct ipc_perm msg_perm; - time_t msg_stime; - time_t msg_rtime; - time_t msg_ctime; + 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; unsigned long msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; 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/riscv32/bits/posix.h b/arch/riscv32/bits/posix.h new file mode 100644 index 00000000..8897d37d --- /dev/null +++ b/arch/riscv32/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_ILP32_OFFBIG 1 +#define _POSIX_V7_ILP32_OFFBIG 1 diff --git a/arch/riscv32/bits/reg.h b/arch/riscv32/bits/reg.h new file mode 100644 index 00000000..0192a293 --- /dev/null +++ b/arch/riscv32/bits/reg.h @@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 32 diff --git a/arch/riscv32/bits/sem.h b/arch/riscv32/bits/sem.h new file mode 100644 index 00000000..544e3d2a --- /dev/null +++ b/arch/riscv32/bits/sem.h @@ -0,0 +1,18 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/riscv32/bits/setjmp.h b/arch/riscv32/bits/setjmp.h new file mode 100644 index 00000000..51e96276 --- /dev/null +++ b/arch/riscv32/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long long __jmp_buf[19]; diff --git a/arch/aarch64/bits/shm.h b/arch/riscv32/bits/shm.h index 8d193781..725fb469 100644 --- a/arch/aarch64/bits/shm.h +++ b/arch/riscv32/bits/shm.h @@ -3,14 +3,21 @@ 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_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; unsigned long __pad1; unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; }; struct shminfo { diff --git a/arch/riscv32/bits/signal.h b/arch/riscv32/bits/signal.h new file mode 100644 index 00000000..271e7da6 --- /dev/null +++ b/arch/riscv32/bits/signal.h @@ -0,0 +1,120 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +# define MINSIGSTKSZ 2048 +# define SIGSTKSZ 8192 +#endif + +typedef unsigned long __riscv_mc_gp_state[32]; + +struct __riscv_mc_f_ext_state { + unsigned int __f[32]; + unsigned int __fcsr; +}; + +struct __riscv_mc_d_ext_state { + unsigned long long __f[32]; + unsigned int __fcsr; +}; + +struct __riscv_mc_q_ext_state { + unsigned long long __f[64] __attribute__((aligned(16))); + unsigned int __fcsr; + unsigned int __reserved[3]; +}; + +union __riscv_mc_fp_state { + struct __riscv_mc_f_ext_state __f; + struct __riscv_mc_d_ext_state __d; + struct __riscv_mc_q_ext_state __q; +}; + +typedef struct mcontext_t { + __riscv_mc_gp_state __gregs; + union __riscv_mc_fp_state __fpregs; +} mcontext_t; + +#if defined(_GNU_SOURCE) +#define REG_PC 0 +#define REG_RA 1 +#define REG_SP 2 +#define REG_TP 4 +#define REG_S0 8 +#define REG_S1 9 +#define REG_A0 10 +#define REG_S2 18 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long greg_t; +typedef unsigned long gregset_t[32]; +typedef union __riscv_mc_fp_state fpregset_t; +struct sigcontext { + gregset_t gregs; + fpregset_t fpregs; +}; +#endif + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext +{ + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + mcontext_t uc_mcontext; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/arch/riscv32/bits/stat.h b/arch/riscv32/bits/stat.h new file mode 100644 index 00000000..f6d9e864 --- /dev/null +++ b/arch/riscv32/bits/stat.h @@ -0,0 +1,18 @@ +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned __unused[2]; +}; diff --git a/arch/riscv32/bits/stdint.h b/arch/riscv32/bits/stdint.h new file mode 100644 index 00000000..d1b27121 --- /dev/null +++ b/arch/riscv32/bits/stdint.h @@ -0,0 +1,20 @@ +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/riscv32/bits/syscall.h.in b/arch/riscv32/bits/syscall.h.in new file mode 100644 index 00000000..9228d840 --- /dev/null +++ b/arch/riscv32/bits/syscall.h.in @@ -0,0 +1,300 @@ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_fcntl64 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_umount2 39 +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR_statfs64 43 +#define __NR_fstatfs64 44 +#define __NR_truncate64 45 +#define __NR_ftruncate64 46 +#define __NR_fallocate 47 +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR__llseek 62 +#define __NR_read 63 +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR_sendfile64 71 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +#define __NR_sync_file_range 84 +#define __NR_timerfd_create 85 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_set_robust_list 99 +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +#define __NR_timer_getoverrun 109 +#define __NR_timer_delete 111 +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +#define __NR_getcpu 168 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR_mmap2 222 +#define __NR_fadvise64_64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +#define __NR_move_pages 239 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +#define __NR_accept4 242 +#define __NR_arch_specific_syscall 244 +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +#define __NR_open_by_handle_at 265 +#define __NR_syncfs 267 +#define __NR_setns 268 +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +#define __NR_finit_module 273 +#define __NR_sched_setattr 274 +#define __NR_sched_getattr 275 +#define __NR_renameat2 276 +#define __NR_seccomp 277 +#define __NR_getrandom 278 +#define __NR_memfd_create 279 +#define __NR_bpf 280 +#define __NR_execveat 281 +#define __NR_userfaultfd 282 +#define __NR_membarrier 283 +#define __NR_mlock2 284 +#define __NR_copy_file_range 285 +#define __NR_preadv2 286 +#define __NR_pwritev2 287 +#define __NR_pkey_mprotect 288 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_statx 291 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 +#define __NR_futex __NR_futex_time64 + +#define __NR_sysriscv __NR_arch_specific_syscall +#define __NR_riscv_flush_icache (__NR_sysriscv + 15) diff --git a/arch/riscv32/bits/user.h b/arch/riscv32/bits/user.h new file mode 100644 index 00000000..0d37de0b --- /dev/null +++ b/arch/riscv32/bits/user.h @@ -0,0 +1,6 @@ +#include <signal.h> + +#define ELF_NGREG 32 +#define ELF_NFPREG 33 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; +typedef union __riscv_mc_fp_state elf_fpregset_t; diff --git a/arch/riscv32/crt_arch.h b/arch/riscv32/crt_arch.h new file mode 100644 index 00000000..6b93fcfd --- /dev/null +++ b/arch/riscv32/crt_arch.h @@ -0,0 +1,19 @@ +__asm__( +".section .sdata,\"aw\"\n" +".text\n" +".global " START "\n" +".type " START ",%function\n" +START ":\n" +".weak __global_pointer$\n" +".hidden __global_pointer$\n" +".option push\n" +".option norelax\n\t" +"lla gp, __global_pointer$\n" +".option pop\n\t" +"mv a0, sp\n" +".weak _DYNAMIC\n" +".hidden _DYNAMIC\n\t" +"lla a1, _DYNAMIC\n\t" +"andi sp, sp, -16\n\t" +"tail " START "_c" +); diff --git a/arch/riscv32/kstat.h b/arch/riscv32/kstat.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/arch/riscv32/kstat.h diff --git a/arch/riscv32/pthread_arch.h b/arch/riscv32/pthread_arch.h new file mode 100644 index 00000000..a20d7fba --- /dev/null +++ b/arch/riscv32/pthread_arch.h @@ -0,0 +1,13 @@ +static inline uintptr_t __get_tp() +{ + uintptr_t tp; + __asm__ __volatile__("mv %0, tp" : "=r"(tp)); + return tp; +} + +#define TLS_ABOVE_TP +#define GAP_ABOVE_TP 0 + +#define DTP_OFFSET 0x800 + +#define MC_PC __gregs[0] diff --git a/arch/riscv32/reloc.h b/arch/riscv32/reloc.h new file mode 100644 index 00000000..59d15f17 --- /dev/null +++ b/arch/riscv32/reloc.h @@ -0,0 +1,22 @@ +#if defined __riscv_float_abi_soft +#define RISCV_FP_SUFFIX "-sf" +#elif defined __riscv_float_abi_single +#define RISCV_FP_SUFFIX "-sp" +#elif defined __riscv_float_abi_double +#define RISCV_FP_SUFFIX "" +#endif + +#define LDSO_ARCH "riscv32" RISCV_FP_SUFFIX + +#define TPOFF_K 0 + +#define REL_SYMBOLIC R_RISCV_32 +#define REL_PLT R_RISCV_JUMP_SLOT +#define REL_RELATIVE R_RISCV_RELATIVE +#define REL_COPY R_RISCV_COPY +#define REL_DTPMOD R_RISCV_TLS_DTPMOD32 +#define REL_DTPOFF R_RISCV_TLS_DTPREL32 +#define REL_TPOFF R_RISCV_TLS_TPREL32 + +#define CRTJMP(pc,sp) __asm__ __volatile__( \ + "mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) diff --git a/arch/riscv32/syscall_arch.h b/arch/riscv32/syscall_arch.h new file mode 100644 index 00000000..c507f15f --- /dev/null +++ b/arch/riscv32/syscall_arch.h @@ -0,0 +1,80 @@ +#define __SYSCALL_LL_E(x) \ +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ +((union { long long ll; long l[2]; }){ .ll = x }).l[1] +#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) + +#define __asm_syscall(...) \ + __asm__ __volatile__ ("ecall\n\t" \ + : "=r"(a0) : __VA_ARGS__ : "memory"); \ + return a0; \ + +static inline long __syscall0(long n) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0"); + __asm_syscall("r"(a7)) +} + +static inline long __syscall1(long n, long a) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + __asm_syscall("r"(a7), "0"(a0)) +} + +static inline long __syscall2(long n, long a, long b) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + __asm_syscall("r"(a7), "0"(a0), "r"(a1)) +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2)) +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3)) +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + register long a4 __asm__("a4") = e; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4)) +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + register long a4 __asm__("a4") = e; + register long a5 __asm__("a5") = f; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5)) +} + +#define VDSO_USEFUL +/* We don't have a clock_gettime function. +#define VDSO_CGT_SYM "__vdso_clock_gettime" +#define VDSO_CGT_VER "LINUX_2.6" */ + +#define IPC_64 0 diff --git a/arch/riscv64/atomic_arch.h b/arch/riscv64/atomic_arch.h new file mode 100644 index 00000000..0c382588 --- /dev/null +++ b/arch/riscv64/atomic_arch.h @@ -0,0 +1,38 @@ +#define a_barrier a_barrier +static inline void a_barrier() +{ + __asm__ __volatile__ ("fence rw,rw" : : : "memory"); +} + +#define a_cas a_cas +static inline int a_cas(volatile int *p, int t, int s) +{ + int old, tmp; + __asm__ __volatile__ ( + "\n1: lr.w.aqrl %0, (%2)\n" + " bne %0, %3, 1f\n" + " sc.w.aqrl %1, %4, (%2)\n" + " bnez %1, 1b\n" + "1:" + : "=&r"(old), "=&r"(tmp) + : "r"(p), "r"((long)t), "r"((long)s) + : "memory"); + return old; +} + +#define a_cas_p a_cas_p +static inline void *a_cas_p(volatile void *p, void *t, void *s) +{ + void *old; + int tmp; + __asm__ __volatile__ ( + "\n1: lr.d.aqrl %0, (%2)\n" + " bne %0, %3, 1f\n" + " sc.d.aqrl %1, %4, (%2)\n" + " bnez %1, 1b\n" + "1:" + : "=&r"(old), "=&r"(tmp) + : "r"(p), "r"(t), "r"(s) + : "memory"); + return old; +} diff --git a/arch/riscv64/bits/alltypes.h.in b/arch/riscv64/bits/alltypes.h.in new file mode 100644 index 00000000..4579d174 --- /dev/null +++ b/arch/riscv64/bits/alltypes.h.in @@ -0,0 +1,18 @@ +#define _Addr long +#define _Int64 long +#define _Reg long + +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffffffffffL + +#ifndef __cplusplus +TYPEDEF int wchar_t; +#endif + +TYPEDEF int blksize_t; +TYPEDEF unsigned int nlink_t; + +TYPEDEF float float_t; +TYPEDEF double double_t; + +TYPEDEF struct { long long __ll; long double __ld; } max_align_t; diff --git a/arch/riscv64/bits/fenv.h b/arch/riscv64/bits/fenv.h new file mode 100644 index 00000000..806ec40f --- /dev/null +++ b/arch/riscv64/bits/fenv.h @@ -0,0 +1,17 @@ +#define FE_INVALID 16 +#define FE_DIVBYZERO 8 +#define FE_OVERFLOW 4 +#define FE_UNDERFLOW 2 +#define FE_INEXACT 1 + +#define FE_ALL_EXCEPT 31 + +#define FE_TONEAREST 0 +#define FE_DOWNWARD 2 +#define FE_UPWARD 3 +#define FE_TOWARDZERO 1 + +typedef unsigned int fexcept_t; +typedef unsigned int fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/arch/riscv64/bits/float.h b/arch/riscv64/bits/float.h new file mode 100644 index 00000000..719c7908 --- /dev/null +++ b/arch/riscv64/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L + +#define LDBL_MANT_DIG 113 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MAX_EXP 16384 + +#define LDBL_DIG 33 +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_10_EXP 4932 + +#define DECIMAL_DIG 36 diff --git a/arch/riscv64/bits/posix.h b/arch/riscv64/bits/posix.h new file mode 100644 index 00000000..8068ce98 --- /dev/null +++ b/arch/riscv64/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_LP64_OFF64 1 +#define _POSIX_V7_LP64_OFF64 1 diff --git a/arch/riscv64/bits/reg.h b/arch/riscv64/bits/reg.h new file mode 100644 index 00000000..2633f39d --- /dev/null +++ b/arch/riscv64/bits/reg.h @@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 64 diff --git a/arch/riscv64/bits/setjmp.h b/arch/riscv64/bits/setjmp.h new file mode 100644 index 00000000..ad7e4016 --- /dev/null +++ b/arch/riscv64/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long __jmp_buf[26]; diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h new file mode 100644 index 00000000..6a53feb7 --- /dev/null +++ b/arch/riscv64/bits/signal.h @@ -0,0 +1,119 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +# define MINSIGSTKSZ 2048 +# define SIGSTKSZ 8192 +#endif + +typedef unsigned long __riscv_mc_gp_state[32]; + +struct __riscv_mc_f_ext_state { + unsigned int __f[32]; + unsigned int __fcsr; +}; + +struct __riscv_mc_d_ext_state { + unsigned long long __f[32]; + unsigned int __fcsr; +}; + +struct __riscv_mc_q_ext_state { + unsigned long long __f[64] __attribute__((aligned(16))); + unsigned int __fcsr; + unsigned int __reserved[3]; +}; + +union __riscv_mc_fp_state { + struct __riscv_mc_f_ext_state __f; + struct __riscv_mc_d_ext_state __d; + struct __riscv_mc_q_ext_state __q; +}; + +typedef struct mcontext_t { + __riscv_mc_gp_state __gregs; + union __riscv_mc_fp_state __fpregs; +} mcontext_t; + +#if defined(_GNU_SOURCE) +#define REG_PC 0 +#define REG_RA 1 +#define REG_SP 2 +#define REG_TP 4 +#define REG_S0 8 +#define REG_S1 9 +#define REG_A0 10 +#define REG_S2 18 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long greg_t; +typedef unsigned long gregset_t[32]; +typedef union __riscv_mc_fp_state fpregset_t; +struct sigcontext { + gregset_t gregs; + fpregset_t fpregs; +}; +#endif + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct __ucontext +{ + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + mcontext_t uc_mcontext; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 2 +#define SA_SIGINFO 4 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 diff --git a/arch/riscv64/bits/stat.h b/arch/riscv64/bits/stat.h new file mode 100644 index 00000000..b7f4221b --- /dev/null +++ b/arch/riscv64/bits/stat.h @@ -0,0 +1,18 @@ +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned __unused[2]; +}; diff --git a/arch/riscv64/bits/stdint.h b/arch/riscv64/bits/stdint.h new file mode 100644 index 00000000..1bb147f2 --- /dev/null +++ b/arch/riscv64/bits/stdint.h @@ -0,0 +1,20 @@ +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/riscv64/bits/syscall.h.in b/arch/riscv64/bits/syscall.h.in new file mode 100644 index 00000000..e362bd0e --- /dev/null +++ b/arch/riscv64/bits/syscall.h.in @@ -0,0 +1,309 @@ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_io_getevents 4 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_fcntl 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_umount2 39 +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR_statfs 43 +#define __NR_fstatfs 44 +#define __NR_truncate 45 +#define __NR_ftruncate 46 +#define __NR_fallocate 47 +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR_lseek 62 +#define __NR_read 63 +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR_sendfile 71 +#define __NR_pselect6 72 +#define __NR_ppoll 73 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR_newfstatat 79 +#define __NR_fstat 80 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +#define __NR_sync_file_range 84 +#define __NR_timerfd_create 85 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_gettime 87 +#define __NR_utimensat 88 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_futex 98 +#define __NR_set_robust_list 99 +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +#define __NR_timer_gettime 108 +#define __NR_timer_getoverrun 109 +#define __NR_timer_settime 110 +#define __NR_timer_delete 111 +#define __NR_clock_settime 112 +#define __NR_clock_gettime 113 +#define __NR_clock_getres 114 +#define __NR_clock_nanosleep 115 +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_rr_get_interval 127 +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrlimit 163 +#define __NR_setrlimit 164 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +#define __NR_getcpu 168 +#define __NR_gettimeofday 169 +#define __NR_settimeofday 170 +#define __NR_adjtimex 171 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedreceive 183 +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +#define __NR_semtimedop 192 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR_mmap 222 +#define __NR_fadvise64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +#define __NR_move_pages 239 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +#define __NR_accept4 242 +#define __NR_recvmmsg 243 +#define __NR_arch_specific_syscall 244 +#define __NR_wait4 260 +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +#define __NR_open_by_handle_at 265 +#define __NR_clock_adjtime 266 +#define __NR_syncfs 267 +#define __NR_setns 268 +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +#define __NR_finit_module 273 +#define __NR_sched_setattr 274 +#define __NR_sched_getattr 275 +#define __NR_renameat2 276 +#define __NR_seccomp 277 +#define __NR_getrandom 278 +#define __NR_memfd_create 279 +#define __NR_bpf 280 +#define __NR_execveat 281 +#define __NR_userfaultfd 282 +#define __NR_membarrier 283 +#define __NR_mlock2 284 +#define __NR_copy_file_range 285 +#define __NR_preadv2 286 +#define __NR_pwritev2 287 +#define __NR_pkey_mprotect 288 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_statx 291 +#define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 + +#define __NR_sysriscv __NR_arch_specific_syscall +#define __NR_riscv_flush_icache (__NR_sysriscv + 15) diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h new file mode 100644 index 00000000..0d37de0b --- /dev/null +++ b/arch/riscv64/bits/user.h @@ -0,0 +1,6 @@ +#include <signal.h> + +#define ELF_NGREG 32 +#define ELF_NFPREG 33 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; +typedef union __riscv_mc_fp_state elf_fpregset_t; diff --git a/arch/riscv64/crt_arch.h b/arch/riscv64/crt_arch.h new file mode 100644 index 00000000..6b93fcfd --- /dev/null +++ b/arch/riscv64/crt_arch.h @@ -0,0 +1,19 @@ +__asm__( +".section .sdata,\"aw\"\n" +".text\n" +".global " START "\n" +".type " START ",%function\n" +START ":\n" +".weak __global_pointer$\n" +".hidden __global_pointer$\n" +".option push\n" +".option norelax\n\t" +"lla gp, __global_pointer$\n" +".option pop\n\t" +"mv a0, sp\n" +".weak _DYNAMIC\n" +".hidden _DYNAMIC\n\t" +"lla a1, _DYNAMIC\n\t" +"andi sp, sp, -16\n\t" +"tail " START "_c" +); diff --git a/arch/riscv64/kstat.h b/arch/riscv64/kstat.h new file mode 100644 index 00000000..92625f36 --- /dev/null +++ b/arch/riscv64/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + unsigned long __pad; + off_t st_size; + blksize_t st_blksize; + int __pad2; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + unsigned __unused[2]; +}; diff --git a/arch/riscv64/pthread_arch.h b/arch/riscv64/pthread_arch.h new file mode 100644 index 00000000..a20d7fba --- /dev/null +++ b/arch/riscv64/pthread_arch.h @@ -0,0 +1,13 @@ +static inline uintptr_t __get_tp() +{ + uintptr_t tp; + __asm__ __volatile__("mv %0, tp" : "=r"(tp)); + return tp; +} + +#define TLS_ABOVE_TP +#define GAP_ABOVE_TP 0 + +#define DTP_OFFSET 0x800 + +#define MC_PC __gregs[0] diff --git a/arch/riscv64/reloc.h b/arch/riscv64/reloc.h new file mode 100644 index 00000000..7c7c0611 --- /dev/null +++ b/arch/riscv64/reloc.h @@ -0,0 +1,23 @@ +#if defined __riscv_float_abi_soft +#define RISCV_FP_SUFFIX "-sf" +#elif defined __riscv_float_abi_single +#define RISCV_FP_SUFFIX "-sp" +#elif defined __riscv_float_abi_double +#define RISCV_FP_SUFFIX "" +#endif + +#define LDSO_ARCH "riscv64" RISCV_FP_SUFFIX + +#define TPOFF_K 0 + +#define REL_SYMBOLIC R_RISCV_64 +#define REL_PLT R_RISCV_JUMP_SLOT +#define REL_RELATIVE R_RISCV_RELATIVE +#define REL_COPY R_RISCV_COPY +#define REL_DTPMOD R_RISCV_TLS_DTPMOD64 +#define REL_DTPOFF R_RISCV_TLS_DTPREL64 +#define REL_TPOFF R_RISCV_TLS_TPREL64 +#define REL_TLSDESC R_RISCV_TLSDESC + +#define CRTJMP(pc,sp) __asm__ __volatile__( \ + "mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) diff --git a/arch/riscv64/syscall_arch.h b/arch/riscv64/syscall_arch.h new file mode 100644 index 00000000..7fd042cd --- /dev/null +++ b/arch/riscv64/syscall_arch.h @@ -0,0 +1,78 @@ +#define __SYSCALL_LL_E(x) (x) +#define __SYSCALL_LL_O(x) (x) + +#define __asm_syscall(...) \ + __asm__ __volatile__ ("ecall\n\t" \ + : "=r"(a0) : __VA_ARGS__ : "memory"); \ + return a0; \ + +static inline long __syscall0(long n) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0"); + __asm_syscall("r"(a7)) +} + +static inline long __syscall1(long n, long a) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + __asm_syscall("r"(a7), "0"(a0)) +} + +static inline long __syscall2(long n, long a, long b) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + __asm_syscall("r"(a7), "0"(a0), "r"(a1)) +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2)) +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3)) +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + register long a4 __asm__("a4") = e; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4)) +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long a7 __asm__("a7") = n; + register long a0 __asm__("a0") = a; + register long a1 __asm__("a1") = b; + register long a2 __asm__("a2") = c; + register long a3 __asm__("a3") = d; + register long a4 __asm__("a4") = e; + register long a5 __asm__("a5") = f; + __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5)) +} + +#define VDSO_USEFUL +/* We don't have a clock_gettime function. +#define VDSO_CGT_SYM "__vdso_clock_gettime" +#define VDSO_CGT_VER "LINUX_2.6" */ + +#define IPC_64 0 diff --git a/arch/s390x/bits/alltypes.h.in b/arch/s390x/bits/alltypes.h.in index 1a838462..6c0eb7f4 100644 --- a/arch/s390x/bits/alltypes.h.in +++ b/arch/s390x/bits/alltypes.h.in @@ -2,25 +2,18 @@ #define _Int64 long #define _Reg long -TYPEDEF __builtin_va_list va_list; -TYPEDEF __builtin_va_list __isoc_va_list; +#define __BYTE_ORDER 4321 +#define __LONG_MAX 0x7fffffffffffffffL #ifndef __cplusplus TYPEDEF int wchar_t; #endif +#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 1 TYPEDEF double float_t; +#else +TYPEDEF float float_t; +#endif 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[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/s390x/bits/endian.h b/arch/s390x/bits/endian.h deleted file mode 100644 index ef074b77..00000000 --- a/arch/s390x/bits/endian.h +++ /dev/null @@ -1 +0,0 @@ -#define __BYTE_ORDER __BIG_ENDIAN diff --git a/arch/s390x/bits/fcntl.h b/arch/s390x/bits/fcntl.h index 1eca6ba5..a231efb4 100644 --- a/arch/s390x/bits/fcntl.h +++ b/arch/s390x/bits/fcntl.h @@ -38,3 +38,6 @@ #define F_GETOWN_EX 16 #define F_GETOWNER_UIDS 17 + +#define POSIX_FADV_DONTNEED 6 +#define POSIX_FADV_NOREUSE 7 diff --git a/arch/s390x/bits/float.h b/arch/s390x/bits/float.h index 90b73bee..e188cb61 100644 --- a/arch/s390x/bits/float.h +++ b/arch/s390x/bits/float.h @@ -1,4 +1,8 @@ -#define FLT_EVAL_METHOD 1 +#ifdef __FLT_EVAL_METHOD__ +#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ +#else +#define FLT_EVAL_METHOD 0 +#endif #define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L #define LDBL_MIN 3.36210314311209350626267781732175260e-4932L diff --git a/arch/s390x/bits/ipc.h b/arch/s390x/bits/ipc.h deleted file mode 100644 index 4710c12b..00000000 --- a/arch/s390x/bits/ipc.h +++ /dev/null @@ -1,14 +0,0 @@ -struct ipc_perm { - key_t __ipc_perm_key; - uid_t uid; - gid_t gid; - uid_t cuid; - gid_t cgid; - mode_t mode; - unsigned short __pad1; - unsigned short __ipc_perm_seq; - unsigned long __pad2; - unsigned long __pad3; -}; - -#define IPC_64 0x100 diff --git a/arch/s390x/bits/limits.h b/arch/s390x/bits/limits.h index 86ef7663..07743b6f 100644 --- a/arch/s390x/bits/limits.h +++ b/arch/s390x/bits/limits.h @@ -1,8 +1 @@ -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGESIZE 4096 -#define LONG_BIT 64 -#endif - -#define LONG_MAX 0x7fffffffffffffffL -#define LLONG_MAX 0x7fffffffffffffffLL diff --git a/arch/s390x/bits/ptrace.h b/arch/s390x/bits/ptrace.h index d50e3262..a06cb077 100644 --- a/arch/s390x/bits/ptrace.h +++ b/arch/s390x/bits/ptrace.h @@ -1,4 +1,7 @@ #define PTRACE_SINGLEBLOCK 12 +#define PTRACE_OLDSETOPTIONS 21 +#define PTRACE_SYSEMU 31 +#define PTRACE_SYSEMU_SINGLESTEP 32 #define PTRACE_PEEKUSR_AREA 0x5000 #define PTRACE_POKEUSR_AREA 0x5001 #define PTRACE_GET_LAST_BREAK 0x5006 diff --git a/arch/s390x/bits/sem.h b/arch/s390x/bits/sem.h deleted file mode 100644 index 644f68a0..00000000 --- a/arch/s390x/bits/sem.h +++ /dev/null @@ -1,7 +0,0 @@ -struct semid_ds { - struct ipc_perm sem_perm; - time_t sem_otime; - time_t sem_ctime; - unsigned short __pad[3], sem_nsems; - unsigned long __unused[2]; -}; diff --git a/arch/s390x/bits/socket.h b/arch/s390x/bits/socket.h deleted file mode 100644 index 2b81bfec..00000000 --- a/arch/s390x/bits/socket.h +++ /dev/null @@ -1,44 +0,0 @@ -struct msghdr { - void *msg_name; - socklen_t msg_namelen; - struct iovec *msg_iov; - int __pad1, msg_iovlen; - void *msg_control; - int __pad2; - socklen_t msg_controllen; - int msg_flags; -}; - -struct cmsghdr { - int __pad1; - socklen_t cmsg_len; - int cmsg_level; - int cmsg_type; -}; - -#define SO_DEBUG 1 -#define SO_REUSEADDR 2 -#define SO_TYPE 3 -#define SO_ERROR 4 -#define SO_DONTROUTE 5 -#define SO_BROADCAST 6 -#define SO_SNDBUF 7 -#define SO_RCVBUF 8 -#define SO_KEEPALIVE 9 -#define SO_OOBINLINE 10 -#define SO_NO_CHECK 11 -#define SO_PRIORITY 12 -#define SO_LINGER 13 -#define SO_BSDCOMPAT 14 -#define SO_REUSEPORT 15 -#define SO_PASSCRED 16 -#define SO_PEERCRED 17 -#define SO_RCVLOWAT 18 -#define SO_SNDLOWAT 19 -#define SO_RCVTIMEO 20 -#define SO_SNDTIMEO 21 -#define SO_ACCEPTCONN 30 -#define SO_SNDBUFFORCE 32 -#define SO_RCVBUFFORCE 33 -#define SO_PROTOCOL 38 -#define SO_DOMAIN 39 diff --git a/arch/s390x/bits/syscall.h.in b/arch/s390x/bits/syscall.h.in index 85a18e79..e60711a6 100644 --- a/arch/s390x/bits/syscall.h.in +++ b/arch/s390x/bits/syscall.h.in @@ -326,4 +326,46 @@ #define __NR_kexec_file_load 381 #define __NR_io_pgetevents 382 #define __NR_rseq 383 +#define __NR_pkey_mprotect 384 +#define __NR_pkey_alloc 385 +#define __NR_pkey_free 386 +#define __NR_semtimedop 392 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_memfd_secret 447 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/s390x/kstat.h b/arch/s390x/kstat.h new file mode 100644 index 00000000..001c10be --- /dev/null +++ b/arch/s390x/kstat.h @@ -0,0 +1,19 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + 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; + blkcnt_t st_blocks; + unsigned long __unused[3]; +}; diff --git a/arch/s390x/pthread_arch.h b/arch/s390x/pthread_arch.h index e2251f1f..e54fec3f 100644 --- a/arch/s390x/pthread_arch.h +++ b/arch/s390x/pthread_arch.h @@ -1,14 +1,12 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - struct pthread *self; + uintptr_t tp; __asm__ ( "ear %0, %%a0\n" "sllg %0, %0, 32\n" "ear %0, %%a1\n" - : "=r"(self)); - return self; + : "=r"(tp)); + return tp; } -#define TP_ADJ(p) (p) - #define MC_PC psw.addr diff --git a/arch/s390x/reloc.h b/arch/s390x/reloc.h index a238dc65..6e5c1fb8 100644 --- a/arch/s390x/reloc.h +++ b/arch/s390x/reloc.h @@ -1,5 +1,3 @@ -#include <endian.h> - #define LDSO_ARCH "s390x" #define REL_SYMBOLIC R_390_64 diff --git a/arch/s390x/syscall_arch.h b/arch/s390x/syscall_arch.h index afb99852..83cc9a27 100644 --- a/arch/s390x/syscall_arch.h +++ b/arch/s390x/syscall_arch.h @@ -72,5 +72,3 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo register long r7 __asm__("r7") = f; __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7)); } - -#define SYSCALL_USE_SOCKETCALL diff --git a/arch/sh/arch.mak b/arch/sh/arch.mak new file mode 100644 index 00000000..aa4d05ce --- /dev/null +++ b/arch/sh/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/arch/sh/bits/alltypes.h.in b/arch/sh/bits/alltypes.h.in index 37f27d6f..6a538352 100644 --- a/arch/sh/bits/alltypes.h.in +++ b/arch/sh/bits/alltypes.h.in @@ -1,26 +1,25 @@ +#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 __BIG_ENDIAN__ +#define __BYTE_ORDER 4321 +#else +#define __BYTE_ORDER 1234 +#endif + +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus +#ifdef __WCHAR_TYPE__ +TYPEDEF __WCHAR_TYPE__ wchar_t; +#else TYPEDEF long wchar_t; #endif +#endif 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/sh/bits/endian.h b/arch/sh/bits/endian.h deleted file mode 100644 index 2016cb20..00000000 --- a/arch/sh/bits/endian.h +++ /dev/null @@ -1,5 +0,0 @@ -#if __BIG_ENDIAN__ -#define __BYTE_ORDER __BIG_ENDIAN -#else -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif diff --git a/arch/sh/bits/ioctl.h b/arch/sh/bits/ioctl.h index 3c7ab4bb..370b6901 100644 --- a/arch/sh/bits/ioctl.h +++ b/arch/sh/bits/ioctl.h @@ -65,14 +65,6 @@ #define TIOCGSERIAL _IOR('T', 30, char[60]) #define TIOCSSERIAL _IOW('T', 31, char[60]) #define TIOCPKT _IOW('T', 32, int) -#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 TIOCNOTTY _IO('T', 34) #define TIOCSETD _IOW('T', 35, int) @@ -104,105 +96,17 @@ #define TIOCSLCKTRMIOS _IO('T', 87) #define TIOCSERGSTRUCT _IOR('T', 88, char[216]) #define TIOCSERGETLSR _IOR('T', 89, unsigned int) -#define TIOCSER_TEMT 0x01 #define TIOCSERGETMULTI _IOR('T', 90, char[168]) #define TIOCSERSETMULTI _IOW('T', 91, char[168]) #define TIOCMIWAIT _IO('T', 92) #define TIOCGICOUNT _IO('T', 93) -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#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) #define SIOCSPGRP _IOW('s', 8, int) #define SIOCGPGRP _IOW('s', 9, int) -#define SIOCGSTAMP _IOR('s', 100, char[8]) -#define SIOCGSTAMPNS _IOR('s', 101, char[8]) - -#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 +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) diff --git a/arch/sh/bits/ipcstat.h b/arch/sh/bits/ipcstat.h new file mode 100644 index 00000000..4f4fcb0c --- /dev/null +++ b/arch/sh/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/arch/sh/bits/limits.h b/arch/sh/bits/limits.h index c340ceb2..07743b6f 100644 --- a/arch/sh/bits/limits.h +++ b/arch/sh/bits/limits.h @@ -1,8 +1 @@ -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGESIZE 4096 -#define LONG_BIT 32 -#endif - -#define LONG_MAX 0x7fffffffL -#define LLONG_MAX 0x7fffffffffffffffLL diff --git a/arch/x86_64/bits/msg.h b/arch/sh/bits/msg.h index 2e23ca27..7bbbb2bf 100644 --- a/arch/x86_64/bits/msg.h +++ b/arch/sh/bits/msg.h @@ -1,12 +1,18 @@ struct msqid_ds { struct ipc_perm msg_perm; - time_t msg_stime; - time_t msg_rtime; - time_t msg_ctime; + 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; unsigned long msg_cbytes; msgqnum_t msg_qnum; msglen_t msg_qbytes; 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/sh/bits/sem.h b/arch/sh/bits/sem.h new file mode 100644 index 00000000..544e3d2a --- /dev/null +++ b/arch/sh/bits/sem.h @@ -0,0 +1,18 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_lo; + unsigned long __sem_ctime_hi; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + long __unused3; + long __unused4; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/arch/sh/bits/shm.h b/arch/sh/bits/shm.h index 6cdac131..adc01e34 100644 --- a/arch/sh/bits/shm.h +++ b/arch/sh/bits/shm.h @@ -3,17 +3,21 @@ struct shmid_ds { struct ipc_perm shm_perm; size_t shm_segsz; - time_t shm_atime; - int __unused1; - time_t shm_dtime; - int __unused2; - time_t shm_ctime; - int __unused3; + unsigned long __shm_atime_lo; + unsigned long __shm_atime_hi; + unsigned long __shm_dtime_lo; + unsigned long __shm_dtime_hi; + unsigned long __shm_ctime_lo; + unsigned long __shm_ctime_hi; pid_t shm_cpid; pid_t shm_lpid; unsigned long shm_nattch; unsigned long __pad1; unsigned long __pad2; + unsigned long __pad3; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; }; struct shminfo { diff --git a/arch/sh/bits/signal.h b/arch/sh/bits/signal.h index 160311fa..d0b14828 100644 --- a/arch/sh/bits/signal.h +++ b/arch/sh/bits/signal.h @@ -9,7 +9,16 @@ #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) typedef int greg_t, gregset_t[16]; typedef int freg_t, fpregset_t[16]; -typedef struct sigcontext { +typedef struct { + unsigned long oldmask; + unsigned long gregs[16]; + unsigned long pc, pr, sr; + unsigned long gbr, mach, macl; + unsigned long fpregs[16]; + unsigned long xfpregs[16]; + unsigned int fpscr, fpul, ownedfp; +} mcontext_t; +struct sigcontext { unsigned long oldmask; unsigned long sc_regs[16]; unsigned long sc_pc, sc_pr, sc_sr; @@ -17,7 +26,7 @@ typedef struct sigcontext { unsigned long sc_fpregs[16]; unsigned long sc_xfpregs[16]; unsigned int sc_fpscr, sc_fpul, sc_ownedfp; -} mcontext_t; +}; #else typedef struct { unsigned long __regs[58]; diff --git a/arch/sh/bits/stat.h b/arch/sh/bits/stat.h index 22b19bbf..5d7828cf 100644 --- a/arch/sh/bits/stat.h +++ b/arch/sh/bits/stat.h @@ -14,8 +14,12 @@ struct stat { off_t st_size; blksize_t st_blksize; blkcnt_t st_blocks; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + ino_t st_ino; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - ino_t st_ino; }; diff --git a/arch/sh/bits/syscall.h.in b/arch/sh/bits/syscall.h.in index 420f4a0f..915a79cd 100644 --- a/arch/sh/bits/syscall.h.in +++ b/arch/sh/bits/syscall.h.in @@ -67,8 +67,8 @@ #define __NR_setrlimit 75 #define __NR_getrlimit 76 #define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 +#define __NR_gettimeofday_time32 78 +#define __NR_settimeofday_time32 79 #define __NR_getgroups 80 #define __NR_setgroups 81 #define __NR_symlink 83 @@ -231,14 +231,14 @@ #define __NR_remap_file_pages 257 #define __NR_set_tid_address 258 #define __NR_timer_create 259 -#define __NR_timer_settime 260 -#define __NR_timer_gettime 261 +#define __NR_timer_settime32 260 +#define __NR_timer_gettime32 261 #define __NR_timer_getoverrun 262 #define __NR_timer_delete 263 -#define __NR_clock_settime 264 -#define __NR_clock_gettime 265 -#define __NR_clock_getres 266 -#define __NR_clock_nanosleep 267 +#define __NR_clock_settime32 264 +#define __NR_clock_gettime32 265 +#define __NR_clock_getres_time32 266 +#define __NR_clock_nanosleep_time32 267 #define __NR_statfs64 268 #define __NR_fstatfs64 269 #define __NR_tgkill 270 @@ -294,8 +294,8 @@ #define __NR_timerfd_create 322 #define __NR_eventfd 323 #define __NR_fallocate 324 -#define __NR_timerfd_settime 325 -#define __NR_timerfd_gettime 326 +#define __NR_timerfd_settime32 325 +#define __NR_timerfd_gettime32 326 #define __NR_signalfd4 327 #define __NR_eventfd2 328 #define __NR_epoll_create1 329 @@ -352,4 +352,66 @@ #define __NR_copy_file_range 380 #define __NR_preadv2 381 #define __NR_pwritev2 382 +#define __NR_statx 383 +#define __NR_pkey_mprotect 384 +#define __NR_pkey_alloc 385 +#define __NR_pkey_free 386 +#define __NR_rseq 387 +#define __NR_semget 393 +#define __NR_semctl 394 +#define __NR_shmget 395 +#define __NR_shmctl 396 +#define __NR_shmat 397 +#define __NR_shmdt 398 +#define __NR_msgget 399 +#define __NR_msgsnd 400 +#define __NR_msgrcv 401 +#define __NR_msgctl 402 +#define __NR_clock_gettime64 403 +#define __NR_clock_settime64 404 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_nanosleep_time64 407 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_utimensat_time64 412 +#define __NR_pselect6_time64 413 +#define __NR_ppoll_time64 414 +#define __NR_io_pgetevents_time64 416 +#define __NR_recvmmsg_time64 417 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_timedreceive_time64 419 +#define __NR_semtimedop_time64 420 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_futex_time64 422 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/sh/bits/user.h b/arch/sh/bits/user.h index d7363f74..07fe843b 100644 --- a/arch/sh/bits/user.h +++ b/arch/sh/bits/user.h @@ -17,34 +17,6 @@ #define REG_FPSCR 55 #define REG_FPUL 56 -struct pt_regs { - unsigned long regs[16]; - unsigned long pc; - unsigned long pr; - unsigned long sr; - unsigned long gbr; - unsigned long mach; - unsigned long macl; - long tra; -}; - -struct pt_dspregs { - unsigned long a1; - unsigned long a0g; - unsigned long a1g; - unsigned long m0; - unsigned long m1; - unsigned long a0; - unsigned long x0; - unsigned long x1; - unsigned long y0; - unsigned long y1; - unsigned long dsr; - unsigned long rs; - unsigned long re; - unsigned long mod; -}; - struct user_fpu_struct { unsigned long fp_regs[16]; unsigned long xfp_regs[16]; @@ -58,7 +30,11 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef struct user_fpu_struct elf_fpregset_t; struct user { - struct pt_regs regs; + struct { + unsigned long regs[16]; + unsigned long pc, pr, sr, gbr, mach, macl; + long tra; + } regs; struct user_fpu_struct fpu; int u_fpvalid; unsigned long u_tsize; diff --git a/arch/sh/kstat.h b/arch/sh/kstat.h new file mode 100644 index 00000000..af449c95 --- /dev/null +++ b/arch/sh/kstat.h @@ -0,0 +1,21 @@ +struct kstat { + dev_t st_dev; + int __st_dev_padding; + long __st_ino_truncated; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + int __st_rdev_padding; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + ino_t st_ino; +}; diff --git a/arch/sh/pthread_arch.h b/arch/sh/pthread_arch.h index 3ee9c1a9..199c2d55 100644 --- a/arch/sh/pthread_arch.h +++ b/arch/sh/pthread_arch.h @@ -1,17 +1,16 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - char *self; - __asm__ ("stc gbr,%0" : "=r" (self) ); - return (struct pthread *) (self - sizeof(struct pthread)); + uintptr_t tp; + __asm__ ("stc gbr,%0" : "=r" (tp) ); + return tp; } #define TLS_ABOVE_TP #define GAP_ABOVE_TP 8 -#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread)) -#define MC_PC sc_pc +#define MC_PC pc #ifdef __FDPIC__ -#define MC_GOT sc_regs[12] +#define MC_GOT gregs[12] #define CANCEL_GOT (*(uintptr_t *)((char *)__syscall_cp_asm+sizeof(uintptr_t))) #endif diff --git a/arch/sh/reloc.h b/arch/sh/reloc.h index a1f16cb1..17b1a9a9 100644 --- a/arch/sh/reloc.h +++ b/arch/sh/reloc.h @@ -1,5 +1,3 @@ -#include <endian.h> - #if __BYTE_ORDER == __BIG_ENDIAN #define ENDIAN_SUFFIX "eb" #else diff --git a/arch/sh/syscall_arch.h b/arch/sh/syscall_arch.h index 48f61d94..628d8d37 100644 --- a/arch/sh/syscall_arch.h +++ b/arch/sh/syscall_arch.h @@ -88,3 +88,6 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo } #define SYSCALL_IPC_BROKEN_MODE + +#define SIOCGSTAMP_OLD (2U<<30 | 's'<<8 | 100 | 8<<16) +#define SIOCGSTAMPNS_OLD (2U<<30 | 's'<<8 | 101 | 8<<16) diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in index 16391295..9f9d2410 100644 --- a/arch/x32/bits/alltypes.h.in +++ b/arch/x32/bits/alltypes.h.in @@ -2,12 +2,16 @@ #define _Int64 long long #define _Reg long long -TYPEDEF __builtin_va_list va_list; -TYPEDEF __builtin_va_list __isoc_va_list; +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffL #ifndef __cplusplus +#ifdef __WCHAR_TYPE__ +TYPEDEF __WCHAR_TYPE__ wchar_t; +#else TYPEDEF long wchar_t; #endif +#endif #if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2 TYPEDEF long double float_t; @@ -18,14 +22,3 @@ TYPEDEF double double_t; #endif TYPEDEF struct { long long __ll; long double __ld; } max_align_t; - -TYPEDEF long long time_t; -TYPEDEF long 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/x32/bits/endian.h b/arch/x32/bits/endian.h deleted file mode 100644 index 172c338f..00000000 --- a/arch/x32/bits/endian.h +++ /dev/null @@ -1 +0,0 @@ -#define __BYTE_ORDER __LITTLE_ENDIAN diff --git a/arch/x32/bits/fcntl.h b/arch/x32/bits/fcntl.h index 1b88ad39..08627f81 100644 --- a/arch/x32/bits/fcntl.h +++ b/arch/x32/bits/fcntl.h @@ -13,7 +13,7 @@ #define O_ASYNC 020000 #define O_DIRECT 040000 -#define O_LARGEFILE 0 +#define O_LARGEFILE 0100000 #define O_NOATIME 01000000 #define O_PATH 010000000 #define O_TMPFILE 020200000 diff --git a/arch/x32/bits/ioctl_fix.h b/arch/x32/bits/ioctl_fix.h new file mode 100644 index 00000000..83b957bd --- /dev/null +++ b/arch/x32/bits/ioctl_fix.h @@ -0,0 +1,4 @@ +#undef SIOCGSTAMP +#undef SIOCGSTAMPNS +#define SIOCGSTAMP 0x8906 +#define SIOCGSTAMPNS 0x8907 diff --git a/arch/x32/bits/ipc.h b/arch/x32/bits/ipc.h index 55d2e41a..a12380f6 100644 --- a/arch/x32/bits/ipc.h +++ b/arch/x32/bits/ipc.h @@ -9,5 +9,3 @@ struct ipc_perm { long long __pad1; long long __pad2; }; - -#define IPC_64 0 diff --git a/arch/x32/bits/limits.h b/arch/x32/bits/limits.h index c340ceb2..07743b6f 100644 --- a/arch/x32/bits/limits.h +++ b/arch/x32/bits/limits.h @@ -1,8 +1 @@ -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGESIZE 4096 -#define LONG_BIT 32 -#endif - -#define LONG_MAX 0x7fffffffL -#define LLONG_MAX 0x7fffffffffffffffLL diff --git a/arch/x32/bits/sem.h b/arch/x32/bits/sem.h new file mode 100644 index 00000000..18745f4c --- /dev/null +++ b/arch/x32/bits/sem.h @@ -0,0 +1,11 @@ +struct semid_ds { + struct ipc_perm sem_perm; + time_t sem_otime; + long long __unused1; + time_t sem_ctime; + long long __unused2; + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long long)-sizeof(short)]; + long long __unused3; + long long __unused4; +}; diff --git a/arch/x32/bits/socket.h b/arch/x32/bits/socket.h index a4c89f3d..8d830010 100644 --- a/arch/x32/bits/socket.h +++ b/arch/x32/bits/socket.h @@ -1,16 +1,5 @@ -struct msghdr { - void *msg_name; - socklen_t msg_namelen; - struct iovec *msg_iov; - int msg_iovlen, __pad1; - void *msg_control; - socklen_t msg_controllen, __pad2; - int msg_flags; -}; - -struct cmsghdr { - socklen_t cmsg_len; - int __pad1; - int cmsg_level; - int cmsg_type; -}; +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 +#define SO_TIMESTAMP 29 +#define SO_TIMESTAMPNS 35 +#define SO_TIMESTAMPING 37 diff --git a/arch/x32/bits/syscall.h.in b/arch/x32/bits/syscall.h.in index 67d89f91..1d065eea 100644 --- a/arch/x32/bits/syscall.h.in +++ b/arch/x32/bits/syscall.h.in @@ -286,6 +286,35 @@ #define __NR_statx (0x40000000 + 332) #define __NR_io_pgetevents (0x40000000 + 333) #define __NR_rseq (0x40000000 + 334) +#define __NR_pidfd_send_signal (0x40000000 + 424) +#define __NR_io_uring_setup (0x40000000 + 425) +#define __NR_io_uring_enter (0x40000000 + 426) +#define __NR_io_uring_register (0x40000000 + 427) +#define __NR_open_tree (0x40000000 + 428) +#define __NR_move_mount (0x40000000 + 429) +#define __NR_fsopen (0x40000000 + 430) +#define __NR_fsconfig (0x40000000 + 431) +#define __NR_fsmount (0x40000000 + 432) +#define __NR_fspick (0x40000000 + 433) +#define __NR_pidfd_open (0x40000000 + 434) +#define __NR_clone3 (0x40000000 + 435) +#define __NR_close_range (0x40000000 + 436) +#define __NR_openat2 (0x40000000 + 437) +#define __NR_pidfd_getfd (0x40000000 + 438) +#define __NR_faccessat2 (0x40000000 + 439) +#define __NR_process_madvise (0x40000000 + 440) +#define __NR_epoll_pwait2 (0x40000000 + 441) +#define __NR_mount_setattr (0x40000000 + 442) +#define __NR_landlock_create_ruleset (0x40000000 + 444) +#define __NR_landlock_add_rule (0x40000000 + 445) +#define __NR_landlock_restrict_self (0x40000000 + 446) +#define __NR_memfd_secret (0x40000000 + 447) +#define __NR_process_mrelease (0x40000000 + 448) +#define __NR_futex_waitv (0x40000000 + 449) +#define __NR_set_mempolicy_home_node (0x40000000 + 450) +#define __NR_cachestat (0x40000000 + 451) +#define __NR_fchmodat2 (0x40000000 + 452) + #define __NR_rt_sigaction (0x40000000 + 512) #define __NR_rt_sigreturn (0x40000000 + 513) diff --git a/arch/x32/bits/user.h b/arch/x32/bits/user.h index 4073cc06..eac82a14 100644 --- a/arch/x32/bits/user.h +++ b/arch/x32/bits/user.h @@ -1,5 +1,5 @@ #undef __WORDSIZE -#define __WORDSIZE 64 +#define __WORDSIZE 32 typedef struct user_fpregs_struct { uint16_t cwd, swd, ftw, fop; diff --git a/arch/x32/kstat.h b/arch/x32/kstat.h new file mode 100644 index 00000000..ce25fce3 --- /dev/null +++ b/arch/x32/kstat.h @@ -0,0 +1,22 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + unsigned int __pad0; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + + long long st_atime_sec; + long st_atime_nsec; + long long st_mtime_sec; + long st_mtime_nsec; + long long st_ctime_sec; + long st_ctime_nsec; + long long __unused[3]; +}; diff --git a/arch/x32/pthread_arch.h b/arch/x32/pthread_arch.h index f640a1a1..c1e7716d 100644 --- a/arch/x32/pthread_arch.h +++ b/arch/x32/pthread_arch.h @@ -1,14 +1,12 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - struct pthread *self; - __asm__ ("mov %%fs:0,%0" : "=r" (self) ); - return self; + uintptr_t tp; + __asm__ ("mov %%fs:0,%0" : "=r" (tp) ); + return tp; } -#define TP_ADJ(p) (p) - #define MC_PC gregs[REG_RIP] -#define CANARY canary2 +#define CANARY_PAD #define tls_mod_off_t unsigned long long diff --git a/arch/x32/syscall_arch.h b/arch/x32/syscall_arch.h index 344da03c..e0111cc0 100644 --- a/arch/x32/syscall_arch.h +++ b/arch/x32/syscall_arch.h @@ -3,35 +3,6 @@ #define __scc(X) sizeof(1?(X):0ULL) < 8 ? (unsigned long) (X) : (long long) (X) typedef long long syscall_arg_t; -struct __timespec { long long tv_sec; long tv_nsec; }; -struct __timespec_kernel { long long tv_sec; long long tv_nsec; }; -#define __tsc(X) ((struct __timespec*)(unsigned long)(X)) -#define __fixup(X) do { if(X) { \ - ts->tv_sec = __tsc(X)->tv_sec; \ - ts->tv_nsec = __tsc(X)->tv_nsec; \ - (X) = (unsigned long)ts; } } while(0) -#define __fixup_case_2 \ - case SYS_nanosleep: \ - __fixup(a1); break; \ - case SYS_clock_settime: \ - __fixup(a2); break; -#define __fixup_case_3 \ - case SYS_clock_nanosleep: case SYS_rt_sigtimedwait: case SYS_ppoll: \ - __fixup(a3); break; \ - case SYS_utimensat: \ - if(a3) { \ - ts[0].tv_sec = __tsc(a3)[0].tv_sec; \ - ts[0].tv_nsec = __tsc(a3)[0].tv_nsec; \ - ts[1].tv_sec = __tsc(a3)[1].tv_sec; \ - ts[1].tv_nsec = __tsc(a3)[1].tv_nsec; \ - a3 = (unsigned long)ts; \ - } break; -#define __fixup_case_4 \ - case SYS_futex: \ - if((a2 & (~128 /* FUTEX_PRIVATE_FLAG */)) == 0 /* FUTEX_WAIT */) __fixup(a4); break; -#define __fixup_case_5 \ - case SYS_mq_timedsend: case SYS_mq_timedreceive: case SYS_pselect6: \ - __fixup(a5); break; static __inline long __syscall0(long long n) { @@ -50,10 +21,6 @@ static __inline long __syscall1(long long n, long long a1) static __inline long __syscall2(long long n, long long a1, long long a2) { unsigned long ret; - struct __timespec_kernel ts[1]; - switch (n) { - __fixup_case_2; - } __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2) : "rcx", "r11", "memory"); return ret; @@ -62,11 +29,6 @@ static __inline long __syscall2(long long n, long long a1, long long a2) static __inline long __syscall3(long long n, long long a1, long long a2, long long a3) { unsigned long ret; - struct __timespec_kernel ts[2]; - switch (n) { - __fixup_case_2; - __fixup_case_3; - } __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2), "d"(a3) : "rcx", "r11", "memory"); return ret; @@ -77,12 +39,6 @@ static __inline long __syscall4(long long n, long long a1, long long a2, long lo { unsigned long ret; register long long a4 __asm__("r10") = a4_; - struct __timespec_kernel ts[2]; - switch (n) { - __fixup_case_2; - __fixup_case_3; - __fixup_case_4; - } __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(a4): "rcx", "r11", "memory"); return ret; @@ -94,13 +50,6 @@ static __inline long __syscall5(long long n, long long a1, long long a2, long lo unsigned long ret; register long long a4 __asm__("r10") = a4_; register long long a5 __asm__("r8") = a5_; - struct __timespec_kernel ts[2]; - switch (n) { - __fixup_case_2; - __fixup_case_3; - __fixup_case_4; - __fixup_case_5; - } __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(a4), "r"(a5) : "rcx", "r11", "memory"); return ret; @@ -113,14 +62,32 @@ static __inline long __syscall6(long long n, long long a1, long long a2, long lo register long long a4 __asm__("r10") = a4_; register long long a5 __asm__("r8") = a5_; register long long a6 __asm__("r9") = a6_; - struct __timespec_kernel ts[2]; - switch (n) { - __fixup_case_2; - __fixup_case_3; - __fixup_case_4; - __fixup_case_5; - } __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(a4), "r"(a5), "r"(a6) : "rcx", "r11", "memory"); return ret; } + +#undef SYS_futimesat + +#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 +#define SYS_getrusage_time64 SYS_getrusage +#define SYS_wait4_time64 SYS_wait4 + +#define IPC_64 0 diff --git a/arch/x86_64/bits/alltypes.h.in b/arch/x86_64/bits/alltypes.h.in index dc551d47..5cd8a299 100644 --- a/arch/x86_64/bits/alltypes.h.in +++ b/arch/x86_64/bits/alltypes.h.in @@ -2,8 +2,8 @@ #define _Int64 long #define _Reg long -TYPEDEF __builtin_va_list va_list; -TYPEDEF __builtin_va_list __isoc_va_list; +#define __BYTE_ORDER 1234 +#define __LONG_MAX 0x7fffffffffffffffL #ifndef __cplusplus TYPEDEF int wchar_t; @@ -18,14 +18,3 @@ TYPEDEF double double_t; #endif TYPEDEF struct { long long __ll; long double __ld; } max_align_t; - -TYPEDEF long time_t; -TYPEDEF long suseconds_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/x86_64/bits/endian.h b/arch/x86_64/bits/endian.h deleted file mode 100644 index 172c338f..00000000 --- a/arch/x86_64/bits/endian.h +++ /dev/null @@ -1 +0,0 @@ -#define __BYTE_ORDER __LITTLE_ENDIAN diff --git a/arch/x86_64/bits/fcntl.h b/arch/x86_64/bits/fcntl.h deleted file mode 100644 index 1b88ad39..00000000 --- a/arch/x86_64/bits/fcntl.h +++ /dev/null @@ -1,40 +0,0 @@ -#define O_CREAT 0100 -#define O_EXCL 0200 -#define O_NOCTTY 0400 -#define O_TRUNC 01000 -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_DSYNC 010000 -#define O_SYNC 04010000 -#define O_RSYNC 04010000 -#define O_DIRECTORY 0200000 -#define O_NOFOLLOW 0400000 -#define O_CLOEXEC 02000000 - -#define O_ASYNC 020000 -#define O_DIRECT 040000 -#define O_LARGEFILE 0 -#define O_NOATIME 01000000 -#define O_PATH 010000000 -#define O_TMPFILE 020200000 -#define O_NDELAY O_NONBLOCK - -#define F_DUPFD 0 -#define F_GETFD 1 -#define F_SETFD 2 -#define F_GETFL 3 -#define F_SETFL 4 - -#define F_SETOWN 8 -#define F_GETOWN 9 -#define F_SETSIG 10 -#define F_GETSIG 11 - -#define F_GETLK 5 -#define F_SETLK 6 -#define F_SETLKW 7 - -#define F_SETOWN_EX 15 -#define F_GETOWN_EX 16 - -#define F_GETOWNER_UIDS 17 diff --git a/arch/x86_64/bits/ipc.h b/arch/x86_64/bits/ipc.h deleted file mode 100644 index 3d894e30..00000000 --- a/arch/x86_64/bits/ipc.h +++ /dev/null @@ -1,13 +0,0 @@ -struct ipc_perm { - key_t __ipc_perm_key; - uid_t uid; - gid_t gid; - uid_t cuid; - gid_t cgid; - mode_t mode; - int __ipc_perm_seq; - long __pad1; - long __pad2; -}; - -#define IPC_64 0 diff --git a/arch/x86_64/bits/limits.h b/arch/x86_64/bits/limits.h index 86ef7663..07743b6f 100644 --- a/arch/x86_64/bits/limits.h +++ b/arch/x86_64/bits/limits.h @@ -1,8 +1 @@ -#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGESIZE 4096 -#define LONG_BIT 64 -#endif - -#define LONG_MAX 0x7fffffffffffffffL -#define LLONG_MAX 0x7fffffffffffffffLL diff --git a/arch/x86_64/bits/sem.h b/arch/x86_64/bits/sem.h new file mode 100644 index 00000000..e61571c1 --- /dev/null +++ b/arch/x86_64/bits/sem.h @@ -0,0 +1,11 @@ +struct semid_ds { + struct ipc_perm sem_perm; + time_t sem_otime; + long __unused1; + time_t sem_ctime; + long __unused2; + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + long __unused3; + long __unused4; +}; diff --git a/arch/x86_64/bits/socket.h b/arch/x86_64/bits/socket.h deleted file mode 100644 index a4c89f3d..00000000 --- a/arch/x86_64/bits/socket.h +++ /dev/null @@ -1,16 +0,0 @@ -struct msghdr { - void *msg_name; - socklen_t msg_namelen; - struct iovec *msg_iov; - int msg_iovlen, __pad1; - void *msg_control; - socklen_t msg_controllen, __pad2; - int msg_flags; -}; - -struct cmsghdr { - socklen_t cmsg_len; - int __pad1; - int cmsg_level; - int cmsg_type; -}; diff --git a/arch/x86_64/bits/syscall.h.in b/arch/x86_64/bits/syscall.h.in index 9cdb7789..6543bbba 100644 --- a/arch/x86_64/bits/syscall.h.in +++ b/arch/x86_64/bits/syscall.h.in @@ -333,4 +333,32 @@ #define __NR_statx 332 #define __NR_io_pgetevents 333 #define __NR_rseq 334 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_memfd_secret 447 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 diff --git a/arch/x86_64/kstat.h b/arch/x86_64/kstat.h new file mode 100644 index 00000000..5976c04e --- /dev/null +++ b/arch/x86_64/kstat.h @@ -0,0 +1,22 @@ +struct kstat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + unsigned int __pad0; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + long __unused[3]; +}; diff --git a/arch/x86_64/pthread_arch.h b/arch/x86_64/pthread_arch.h index 65e880c6..c8c63f2e 100644 --- a/arch/x86_64/pthread_arch.h +++ b/arch/x86_64/pthread_arch.h @@ -1,10 +1,8 @@ -static inline struct pthread *__pthread_self() +static inline uintptr_t __get_tp() { - struct pthread *self; - __asm__ ("mov %%fs:0,%0" : "=r" (self) ); - return self; + uintptr_t tp; + __asm__ ("mov %%fs:0,%0" : "=r" (tp) ); + return tp; } -#define TP_ADJ(p) (p) - #define MC_PC gregs[REG_RIP] diff --git a/arch/x86_64/syscall_arch.h b/arch/x86_64/syscall_arch.h index 54e05ff6..92d5c179 100644 --- a/arch/x86_64/syscall_arch.h +++ b/arch/x86_64/syscall_arch.h @@ -66,3 +66,5 @@ static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long #define VDSO_CGT_VER "LINUX_2.6" #define VDSO_GETCPU_SYM "__vdso_getcpu" #define VDSO_GETCPU_VER "LINUX_2.6" + +#define IPC_64 0 |