diff --git a/arch/aarch64/bits/alltypes.h.in b/arch/aarch64/bits/alltypes.h.in index ac235b7..99f1654 100644 --- a/arch/aarch64/bits/alltypes.h.in +++ b/arch/aarch64/bits/alltypes.h.in @@ -19,9 +19,9 @@ TYPEDEF double double_t; TYPEDEF long time_t; TYPEDEF long suseconds_t; -TYPEDEF struct { union { int __i[16]; volatile int __vi[16]; unsigned long __s[8]; } __u; } pthread_attr_t; -TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t; -TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; volatile void *volatile __p[6]; } __u; } mtx_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; diff --git a/arch/aarch64/bits/shm.h b/arch/aarch64/bits/shm.h index aed0cfb..e62fdf8 100644 --- a/arch/aarch64/bits/shm.h +++ b/arch/aarch64/bits/shm.h @@ -14,7 +14,6 @@ struct shmid_ds unsigned long __pad2; }; -#ifdef _GNU_SOURCE struct shminfo { unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; }; @@ -24,4 +23,3 @@ struct shm_info { unsigned long shm_tot, shm_rss, shm_swp; unsigned long swap_attempts, swap_successes; }; -#endif diff --git a/arch/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h index a179626..66ee356 100644 --- a/arch/aarch64/bits/signal.h +++ b/arch/aarch64/bits/signal.h @@ -5,6 +5,8 @@ typedef unsigned long greg_t; typedef unsigned long gregset_t[34]; +// TODO: __uint128_t in public header +// this is the same as user_fpsimd_struct in user.h typedef struct { __uint128_t vregs[32]; unsigned int fpsr; @@ -15,11 +17,12 @@ typedef struct sigcontext unsigned long fault_address; unsigned long regs[31]; unsigned long sp, pc, pstate; - unsigned long __reserved[512] __attribute((__aligned__(16))); + // TODO: __aligned__ attribute in public header + unsigned long __reserved[512] __attribute__((__aligned__(16))); } mcontext_t; #else typedef struct { - unsigned long __regs[36+512] __attribute((__aligned__(16))); + unsigned long __regs[36+512] __attribute__((__aligned__(16))); } mcontext_t; #endif diff --git a/arch/aarch64/bits/syscall.h b/arch/aarch64/bits/syscall.h index dc16ee1..d7a1420 100644 --- a/arch/aarch64/bits/syscall.h +++ b/arch/aarch64/bits/syscall.h @@ -1,56 +1,3 @@ -// TODO: generic syscall numbers for 32 vs 64bit systems -#if 1 -#define __NR_fcntl 25 -#define __NR_statfs 43 -#define __NR_fstatfs 44 -#define __NR_truncate 45 -#define __NR_ftruncate 46 -#define __NR_lseek 62 -#define __NR_sendfile 71 -#define __NR_newfstatat 79 -#define __NR_fstat 80 -#define __NR_mmap 222 -#define __NR_fadvise64 223 - -#define SYS_fcntl 25 -#define SYS_statfs 43 -#define SYS_fstatfs 44 -#define SYS_truncate 45 -#define SYS_ftruncate 46 -#define SYS_lseek 62 -#define SYS_sendfile 71 -#define SYS_newfstatat 79 -#define SYS_fstat 80 -#define SYS_mmap 222 -#define SYS_fadvise64 223 -#else -#define __NR_fcntl64 25 -#define __NR_statfs64 34 -#define __NR_fstatfs64 44 -#define __NR_truncate64 45 -#define __NR_ftruncate64 46 -#define __NR_llseek 62 -#define __NR__llseek 62 -#define __NR_sendfile64 71 -#define __NR_fstatat64 79 -#define __NR_fstat64 80 -#define __NR_mmap2 222 -#define __NR_fadvise64_64 223 - -#define SYS_fcntl64 25 -#define SYS_statfs64 34 -#define SYS_fstatfs64 44 -#define SYS_truncate64 45 -#define SYS_ftruncate64 46 -#define SYS_llseek 62 -#define SYS__llseek 62 -#define SYS_sendfile64 71 -#define SYS_fstatat64 79 -#define SYS_fstat64 80 -#define SYS_mmap2 222 -#define SYS_fadvise64_64 223 -#endif - #define __NR_io_setup 0 #define __NR_io_destroy 1 #define __NR_io_submit 2 @@ -76,7 +23,7 @@ #define __NR_epoll_pwait 22 #define __NR_dup 23 #define __NR_dup3 24 -//#define __NR_fcntl64 25 +#define __NR_fcntl 25 #define __NR_inotify_init1 26 #define __NR_inotify_add_watch 27 #define __NR_inotify_rm_watch 28 @@ -94,10 +41,10 @@ #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_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 @@ -113,7 +60,7 @@ #define __NR_pipe2 59 #define __NR_quotactl 60 #define __NR_getdents64 61 -//#define __NR__llseek 62 +#define __NR_lseek 62 #define __NR_read 63 #define __NR_write 64 #define __NR_readv 65 @@ -122,7 +69,7 @@ #define __NR_pwrite64 68 #define __NR_preadv 69 #define __NR_pwritev 70 -//#define __NR_sendfile64 71 +#define __NR_sendfile 71 #define __NR_pselect6 72 #define __NR_ppoll 73 #define __NR_signalfd4 74 @@ -130,8 +77,8 @@ #define __NR_splice 76 #define __NR_tee 77 #define __NR_readlinkat 78 -//#define __NR_fstatat64 79 -//#define __NR_fstat64 80 +#define __NR_fstatat 79 +#define __NR_fstat 80 #define __NR_sync 81 #define __NR_fsync 82 #define __NR_fdatasync 83 @@ -273,8 +220,8 @@ #define __NR_keyctl 219 #define __NR_clone 220 #define __NR_execve 221 -//#define __NR_mmap2 222 -//#define __NR_fadvise64_64 223 +#define __NR_mmap 222 +#define __NR_fadvise64 223 #define __NR_swapon 224 #define __NR_swapoff 225 #define __NR_mprotect 226 @@ -344,7 +291,7 @@ #define SYS_epoll_pwait __NR_epoll_pwait #define SYS_dup __NR_dup #define SYS_dup3 __NR_dup3 -//#define SYS_fcntl64 __NR_fcntl64 +#define SYS_fcntl __NR_fcntl #define SYS_inotify_init1 __NR_inotify_init1 #define SYS_inotify_add_watch __NR_inotify_add_watch #define SYS_inotify_rm_watch __NR_inotify_rm_watch @@ -362,10 +309,10 @@ #define SYS_mount __NR_mount #define SYS_pivot_root __NR_pivot_root #define SYS_nfsservctl __NR_nfsservctl -//#define SYS_statfs64 __NR_statfs64 -//#define SYS_fstatfs64 __NR_fstatfs64 -//#define SYS_truncate64 __NR_truncate64 -//#define SYS_ftruncate64 __NR_ftruncate64 +#define SYS_statfs __NR_statfs +#define SYS_fstatfs __NR_fstatfs +#define SYS_truncate __NR_truncate +#define SYS_ftruncate __NR_ftruncate #define SYS_fallocate __NR_fallocate #define SYS_faccessat __NR_faccessat #define SYS_chdir __NR_chdir @@ -381,7 +328,7 @@ #define SYS_pipe2 __NR_pipe2 #define SYS_quotactl __NR_quotactl #define SYS_getdents64 __NR_getdents64 -//#define SYS__llseek __NR__llseek +#define SYS_lseek __NR_lseek #define SYS_read __NR_read #define SYS_write __NR_write #define SYS_readv __NR_readv @@ -390,7 +337,7 @@ #define SYS_pwrite64 __NR_pwrite64 #define SYS_preadv __NR_preadv #define SYS_pwritev __NR_pwritev -//#define SYS_sendfile64 __NR_sendfile64 +#define SYS_sendfile __NR_sendfile #define SYS_pselect6 __NR_pselect6 #define SYS_ppoll __NR_ppoll #define SYS_signalfd4 __NR_signalfd4 @@ -398,8 +345,8 @@ #define SYS_splice __NR_splice #define SYS_tee __NR_tee #define SYS_readlinkat __NR_readlinkat -//#define SYS_fstatat64 __NR_fstatat64 -//#define SYS_fstat64 __NR_fstat64 +#define SYS_fstatat __NR_fstatat +#define SYS_fstat __NR_fstat #define SYS_sync __NR_sync #define SYS_fsync __NR_fsync #define SYS_fdatasync __NR_fdatasync @@ -541,8 +488,8 @@ #define SYS_keyctl __NR_keyctl #define SYS_clone __NR_clone #define SYS_execve __NR_execve -//#define SYS_mmap2 __NR_mmap2 -//#define SYS_fadvise64_64 __NR_fadvise64_64 +#define SYS_mmap __NR_mmap +#define SYS_fadvise64 __NR_fadvise64 #define SYS_swapon __NR_swapon #define SYS_swapoff __NR_swapoff #define SYS_mprotect __NR_mprotect diff --git a/arch/aarch64/syscall_arch.h b/arch/aarch64/syscall_arch.h index 623f00e..7f6e1b6 100644 --- a/arch/aarch64/syscall_arch.h +++ b/arch/aarch64/syscall_arch.h @@ -74,3 +74,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo register long x5 __asm__("x5") = f; __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5)); } + +#define VDSO_USEFUL +#define VDSO_CGT_SYM "__kernel_clock_gettime" +#define VDSO_CGT_VER "LINUX_2.6.39" diff --git a/src/ldso/aarch64/tlsdesc.s b/src/ldso/aarch64/tlsdesc.s index 578948f..c72c18b 100644 --- a/src/ldso/aarch64/tlsdesc.s +++ b/src/ldso/aarch64/tlsdesc.s @@ -24,6 +24,7 @@ __tlsdesc_dynamic: mrs x1,tpidr_el0 // tp ldr x0,[x0,#8] // p ldr x2,[x0] // p->modidx + // TODO: change pthread struct so dtv can be accessed without sizeof sub x3,x1,#288 ldr x3,[x3] // dtv ldr x4,[x3] // dtv[0] diff --git a/src/thread/aarch64/syscall_cp.s b/src/thread/aarch64/syscall_cp.s index 774c266..6302a0b 100644 --- a/src/thread/aarch64/syscall_cp.s +++ b/src/thread/aarch64/syscall_cp.s @@ -10,7 +10,7 @@ __syscall_cp_asm: .global __cp_begin __cp_begin: ldr w0,[x0] - cbnz w0,__cancel + cbnz w0,1f mov x8,x1 mov x0,x2 mov x1,x3 @@ -22,3 +22,6 @@ __cp_begin: .global __cp_end __cp_end: ret + + // cbnz might not be able to jump far enough +1: b __cancel