| author | |
| committer | |
| log | 0098e650fbceae74c8c468716c0810476f72ec47 |
| tree | aff7e7e8e7d4ee4a81b5df4cb19f91dc6e40380b |
| parent | 85a46ee520270f90c13ecd3db7db490a06a31b11 |
adds loongarch64 and riscv32138 files changed, 2917 insertions(+), 123 deletions(-)
lib/libc/musl/arch/aarch64/bits/syscall.h.in+5| ... | ... | @@ -299,4 +299,9 @@ |
| 299 | 299 | #define __NR_landlock_create_ruleset	444 |
| 300 | 300 | #define __NR_landlock_add_rule	445 |
| 301 | 301 | #define __NR_landlock_restrict_self	446 |
| 302 | #define __NR_process_mrelease	448 | |
| 303 | #define __NR_futex_waitv	449 | |
| 304 | #define __NR_set_mempolicy_home_node	450 | |
| 305 | #define __NR_cachestat		451 | |
| 306 | #define __NR_fchmodat2		452 | |
| 302 | 307 |
lib/libc/musl/arch/arm/bits/syscall.h.in+5| ... | ... | @@ -399,6 +399,11 @@ |
| 399 | 399 | #define __NR_landlock_create_ruleset	444 |
| 400 | 400 | #define __NR_landlock_add_rule	445 |
| 401 | 401 | #define __NR_landlock_restrict_self	446 |
| 402 | #define __NR_process_mrelease	448 | |
| 403 | #define __NR_futex_waitv	449 | |
| 404 | #define __NR_set_mempolicy_home_node	450 | |
| 405 | #define __NR_cachestat		451 | |
| 406 | #define __NR_fchmodat2		452 | |
| 402 | 407 | |
| 403 | 408 | #define __ARM_NR_breakpoint	0x0f0001 |
| 404 | 409 | #define __ARM_NR_cacheflush	0x0f0002 |
lib/libc/musl/arch/arm/reloc.h+1-1| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | #define REL_TPOFF R_ARM_TLS_TPOFF32 |
| 27 | 27 | #define REL_TLSDESC R_ARM_TLS_DESC |
| 28 | 28 | |
| 29 | #define TLSDESC_BACKWARDS | |
| 29 | #define TLSDESC_BACKWARDS 1 | |
| 30 | 30 | |
| 31 | 31 | #define CRTJMP(pc,sp) __asm__ __volatile__( \ |
| 32 | 32 | 	"mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" ) |
lib/libc/musl/arch/i386/bits/syscall.h.in+6| ... | ... | @@ -436,4 +436,10 @@ |
| 436 | 436 | #define __NR_landlock_create_ruleset	444 |
| 437 | 437 | #define __NR_landlock_add_rule	445 |
| 438 | 438 | #define __NR_landlock_restrict_self	446 |
| 439 | #define __NR_memfd_secret	447 | |
| 440 | #define __NR_process_mrelease	448 | |
| 441 | #define __NR_futex_waitv	449 | |
| 442 | #define __NR_set_mempolicy_home_node	450 | |
| 443 | #define __NR_cachestat		451 | |
| 444 | #define __NR_fchmodat2		452 | |
| 439 | 445 |
lib/libc/musl/arch/loongarch64/atomic_arch.h created+53| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | #define a_ll a_ll | |
| 2 | static inline int a_ll(volatile int *p) | |
| 3 | { | |
| 4 | 	int v; | |
| 5 | 	__asm__ __volatile__ ( | |
| 6 | 		"ll.w %0, %1" | |
| 7 | 		: "=r"(v) | |
| 8 | 		: "ZC"(*p)); | |
| 9 | 	return v; | |
| 10 | } | |
| 11 | ||
| 12 | #define a_sc a_sc | |
| 13 | static inline int a_sc(volatile int *p, int v) | |
| 14 | { | |
| 15 | 	int r; | |
| 16 | 	__asm__ __volatile__ ( | |
| 17 | 		"sc.w %0, %1" | |
| 18 | 		: "=r"(r), "=ZC"(*p) | |
| 19 | 		: "0"(v) : "memory"); | |
| 20 | 	return r; | |
| 21 | } | |
| 22 | ||
| 23 | #define a_ll_p a_ll_p | |
| 24 | static inline void *a_ll_p(volatile void *p) | |
| 25 | { | |
| 26 | 	void *v; | |
| 27 | 	__asm__ __volatile__ ( | |
| 28 | 		"ll.d %0, %1" | |
| 29 | 		: "=r"(v) | |
| 30 | 		: "ZC"(*(void *volatile *)p)); | |
| 31 | 	return v; | |
| 32 | } | |
| 33 | ||
| 34 | #define a_sc_p a_sc_p | |
| 35 | static inline int a_sc_p(volatile void *p, void *v) | |
| 36 | { | |
| 37 | 	long r; | |
| 38 | 	__asm__ __volatile__ ( | |
| 39 | 		"sc.d %0, %1" | |
| 40 | 		: "=r"(r), "=ZC"(*(void *volatile *)p) | |
| 41 | 		: "0"(v) | |
| 42 | 		: "memory"); | |
| 43 | 	return r; | |
| 44 | } | |
| 45 | ||
| 46 | #define a_barrier a_barrier | |
| 47 | static inline void a_barrier() | |
| 48 | { | |
| 49 | 	__asm__ __volatile__ ("dbar 0" : : : "memory"); | |
| 50 | } | |
| 51 | ||
| 52 | #define a_pre_llsc a_barrier | |
| 53 | #define a_post_llsc a_barrier |
lib/libc/musl/arch/loongarch64/bits/alltypes.h.in created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | #define _Addr long | |
| 2 | #define _Int64 long | |
| 3 | #define _Reg long | |
| 4 | ||
| 5 | #define __BYTE_ORDER 1234 | |
| 6 | #define __LONG_MAX 0x7fffffffffffffffL | |
| 7 | ||
| 8 | #ifndef __cplusplus | |
| 9 | TYPEDEF int wchar_t; | |
| 10 | #endif | |
| 11 | ||
| 12 | TYPEDEF float float_t; | |
| 13 | TYPEDEF double double_t; | |
| 14 | ||
| 15 | TYPEDEF struct { long long __ll; long double __ld; } max_align_t; | |
| 16 | ||
| 17 | TYPEDEF unsigned nlink_t; | |
| 18 | TYPEDEF int blksize_t; |
lib/libc/musl/arch/loongarch64/bits/fenv.h created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | #define FE_INEXACT 0x010000 | |
| 2 | #define FE_UNDERFLOW 0x020000 | |
| 3 | #define FE_OVERFLOW 0x040000 | |
| 4 | #define FE_DIVBYZERO 0x080000 | |
| 5 | #define FE_INVALID 0x100000 | |
| 6 | ||
| 7 | #define FE_ALL_EXCEPT 0x1F0000 | |
| 8 | ||
| 9 | #define FE_TONEAREST 0x000 | |
| 10 | #define FE_TOWARDZERO 0x100 | |
| 11 | #define FE_UPWARD 0x200 | |
| 12 | #define FE_DOWNWARD 0x300 | |
| 13 | ||
| 14 | typedef unsigned fexcept_t; | |
| 15 | ||
| 16 | typedef struct { | |
| 17 | 	unsigned __cw; | |
| 18 | } fenv_t; | |
| 19 | ||
| 20 | #define FE_DFL_ENV ((const fenv_t *) -1) |
lib/libc/musl/arch/loongarch64/bits/float.h created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | #define FLT_EVAL_METHOD 0 | |
| 2 | ||
| 3 | #define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L | |
| 4 | #define LDBL_MIN 3.36210314311209350626267781732175260e-4932L | |
| 5 | #define LDBL_MAX 1.18973149535723176508575932662800702e+4932L | |
| 6 | #define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L | |
| 7 | ||
| 8 | #define LDBL_MANT_DIG 113 | |
| 9 | #define LDBL_MIN_EXP (-16381) | |
| 10 | #define LDBL_MAX_EXP 16384 | |
| 11 | ||
| 12 | #define LDBL_DIG 33 | |
| 13 | #define LDBL_MIN_10_EXP (-4931) | |
| 14 | #define LDBL_MAX_10_EXP 4932 | |
| 15 | ||
| 16 | #define DECIMAL_DIG 36 |
lib/libc/musl/arch/loongarch64/bits/posix.h created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | #define _POSIX_V6_LP64_OFF64 1 | |
| 2 | #define _POSIX_V7_LP64_OFF64 1 |
lib/libc/musl/arch/loongarch64/bits/reg.h created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | #undef __WORDSIZE | |
| 2 | #define __WORDSIZE 64 |
lib/libc/musl/arch/loongarch64/bits/setjmp.h created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | typedef unsigned long __jmp_buf[23]; |
lib/libc/musl/arch/loongarch64/bits/signal.h created+101| ... | ... | @@ -0,0 +1,101 @@ |
| 1 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ | |
| 2 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 3 | ||
| 4 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 5 | #define MINSIGSTKSZ 4096 | |
| 6 | #define SIGSTKSZ 16384 | |
| 7 | #endif | |
| 8 | ||
| 9 | #if defined(_GNU_SOURCE) | |
| 10 | #define LARCH_NGREG 32 | |
| 11 | #define LARCH_REG_RA 1 | |
| 12 | #define LARCH_REG_SP 3 | |
| 13 | #define LARCH_REG_S0 23 | |
| 14 | #define LARCH_REG_S1 24 | |
| 15 | #define LARCH_REG_A0 4 | |
| 16 | #define LARCH_REG_S2 25 | |
| 17 | #define LARCH_REG_NARGS 8 | |
| 18 | #endif | |
| 19 | ||
| 20 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 21 | typedef unsigned long greg_t, gregset_t[32]; | |
| 22 | ||
| 23 | struct sigcontext { | |
| 24 | 	unsigned long sc_pc; | |
| 25 | 	unsigned long sc_regs[32]; | |
| 26 | 	unsigned sc_flags; | |
| 27 | 	unsigned long sc_extcontext[] __attribute__((__aligned__(16))); | |
| 28 | }; | |
| 29 | #endif | |
| 30 | ||
| 31 | typedef struct { | |
| 32 | 	unsigned long __pc; | |
| 33 | 	unsigned long __gregs[32]; | |
| 34 | 	unsigned __flags; | |
| 35 | 	unsigned long __extcontext[] __attribute__((__aligned__(16))); | |
| 36 | } mcontext_t; | |
| 37 | ||
| 38 | struct sigaltstack { | |
| 39 | 	void *ss_sp; | |
| 40 | 	int ss_flags; | |
| 41 | 	size_t ss_size; | |
| 42 | }; | |
| 43 | ||
| 44 | typedef struct __ucontext | |
| 45 | { | |
| 46 | 	unsigned long uc_flags; | |
| 47 | 	struct __ucontext *uc_link; | |
| 48 | 	stack_t uc_stack; | |
| 49 | 	sigset_t uc_sigmask; | |
| 50 | 	long __uc_pad; | |
| 51 | 	mcontext_t uc_mcontext; | |
| 52 | } ucontext_t; | |
| 53 | ||
| 54 | #define __uc_flags uc_flags | |
| 55 | ||
| 56 | #define SA_NOCLDSTOP 1 | |
| 57 | #define SA_NOCLDWAIT 2 | |
| 58 | #define SA_SIGINFO 4 | |
| 59 | #define SA_ONSTACK 0x08000000 | |
| 60 | #define SA_RESTART 0x10000000 | |
| 61 | #define SA_NODEFER 0x40000000 | |
| 62 | #define SA_RESETHAND 0x80000000 | |
| 63 | ||
| 64 | #endif | |
| 65 | ||
| 66 | #define SIGHUP 1 | |
| 67 | #define SIGINT 2 | |
| 68 | #define SIGQUIT 3 | |
| 69 | #define SIGILL 4 | |
| 70 | #define SIGTRAP 5 | |
| 71 | #define SIGABRT 6 | |
| 72 | #define SIGIOT SIGABRT | |
| 73 | #define SIGBUS 7 | |
| 74 | #define SIGFPE 8 | |
| 75 | #define SIGKILL 9 | |
| 76 | #define SIGUSR1 10 | |
| 77 | #define SIGSEGV 11 | |
| 78 | #define SIGUSR2 12 | |
| 79 | #define SIGPIPE 13 | |
| 80 | #define SIGALRM 14 | |
| 81 | #define SIGTERM 15 | |
| 82 | #define SIGSTKFLT 16 | |
| 83 | #define SIGCHLD 17 | |
| 84 | #define SIGCONT 18 | |
| 85 | #define SIGSTOP 19 | |
| 86 | #define SIGTSTP 20 | |
| 87 | #define SIGTTIN 21 | |
| 88 | #define SIGTTOU 22 | |
| 89 | #define SIGURG 23 | |
| 90 | #define SIGXCPU 24 | |
| 91 | #define SIGXFSZ 25 | |
| 92 | #define SIGVTALRM 26 | |
| 93 | #define SIGPROF 27 | |
| 94 | #define SIGWINCH 28 | |
| 95 | #define SIGIO 29 | |
| 96 | #define SIGPOLL SIGIO | |
| 97 | #define SIGPWR 30 | |
| 98 | #define SIGSYS 31 | |
| 99 | #define SIGUNUSED SIGSYS | |
| 100 | ||
| 101 | #define _NSIG 65 |
lib/libc/musl/arch/loongarch64/bits/stat.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | struct stat { | |
| 2 | 	dev_t st_dev; | |
| 3 | 	ino_t st_ino; | |
| 4 | 	mode_t st_mode; | |
| 5 | 	nlink_t st_nlink; | |
| 6 | 	uid_t st_uid; | |
| 7 | 	gid_t st_gid; | |
| 8 | 	dev_t st_rdev; | |
| 9 | 	unsigned long __pad; | |
| 10 | 	off_t st_size; | |
| 11 | 	blksize_t st_blksize; | |
| 12 | 	int __pad2; | |
| 13 | 	blkcnt_t st_blocks; | |
| 14 | 	struct timespec st_atim; | |
| 15 | 	struct timespec st_mtim; | |
| 16 | 	struct timespec st_ctim; | |
| 17 | 	unsigned __unused[2]; | |
| 18 | }; |
lib/libc/musl/arch/loongarch64/bits/stdint.h created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | typedef int32_t int_fast16_t; | |
| 2 | typedef int32_t int_fast32_t; | |
| 3 | typedef uint32_t uint_fast16_t; | |
| 4 | typedef uint32_t uint_fast32_t; | |
| 5 | ||
| 6 | #define INT_FAST16_MIN INT32_MIN | |
| 7 | #define INT_FAST32_MIN INT32_MIN | |
| 8 | ||
| 9 | #define INT_FAST16_MAX INT32_MAX | |
| 10 | #define INT_FAST32_MAX INT32_MAX | |
| 11 | ||
| 12 | #define UINT_FAST16_MAX UINT32_MAX | |
| 13 | #define UINT_FAST32_MAX UINT32_MAX | |
| 14 | ||
| 15 | #define INTPTR_MIN INT64_MIN | |
| 16 | #define INTPTR_MAX INT64_MAX | |
| 17 | #define UINTPTR_MAX UINT64_MAX | |
| 18 | #define PTRDIFF_MIN INT64_MIN | |
| 19 | #define PTRDIFF_MAX INT64_MAX | |
| 20 | #define SIZE_MAX UINT64_MAX |
lib/libc/musl/arch/loongarch64/bits/syscall.h.in created+316| ... | ... | @@ -0,0 +1,316 @@ |
| 1 | #define __NR_io_setup 0 | |
| 2 | #define __NR_io_destroy 1 | |
| 3 | #define __NR_io_submit 2 | |
| 4 | #define __NR_io_cancel 3 | |
| 5 | #define __NR_io_getevents 4 | |
| 6 | #define __NR_setxattr 5 | |
| 7 | #define __NR_lsetxattr 6 | |
| 8 | #define __NR_fsetxattr 7 | |
| 9 | #define __NR_getxattr 8 | |
| 10 | #define __NR_lgetxattr 9 | |
| 11 | #define __NR_fgetxattr 10 | |
| 12 | #define __NR_listxattr 11 | |
| 13 | #define __NR_llistxattr 12 | |
| 14 | #define __NR_flistxattr 13 | |
| 15 | #define __NR_removexattr 14 | |
| 16 | #define __NR_lremovexattr 15 | |
| 17 | #define __NR_fremovexattr 16 | |
| 18 | #define __NR_getcwd 17 | |
| 19 | #define __NR_lookup_dcookie 18 | |
| 20 | #define __NR_eventfd2 19 | |
| 21 | #define __NR_epoll_create1 20 | |
| 22 | #define __NR_epoll_ctl 21 | |
| 23 | #define __NR_epoll_pwait 22 | |
| 24 | #define __NR_dup 23 | |
| 25 | #define __NR_dup3 24 | |
| 26 | #define __NR3264_fcntl 25 | |
| 27 | #define __NR_inotify_init1 26 | |
| 28 | #define __NR_inotify_add_watch 27 | |
| 29 | #define __NR_inotify_rm_watch 28 | |
| 30 | #define __NR_ioctl 29 | |
| 31 | #define __NR_ioprio_set 30 | |
| 32 | #define __NR_ioprio_get 31 | |
| 33 | #define __NR_flock 32 | |
| 34 | #define __NR_mknodat 33 | |
| 35 | #define __NR_mkdirat 34 | |
| 36 | #define __NR_unlinkat 35 | |
| 37 | #define __NR_symlinkat 36 | |
| 38 | #define __NR_linkat 37 | |
| 39 | #define __NR_umount2 39 | |
| 40 | #define __NR_mount 40 | |
| 41 | #define __NR_pivot_root 41 | |
| 42 | #define __NR_nfsservctl 42 | |
| 43 | #define __NR3264_statfs 43 | |
| 44 | #define __NR3264_fstatfs 44 | |
| 45 | #define __NR3264_truncate 45 | |
| 46 | #define __NR3264_ftruncate 46 | |
| 47 | #define __NR_fallocate 47 | |
| 48 | #define __NR_faccessat 48 | |
| 49 | #define __NR_chdir 49 | |
| 50 | #define __NR_fchdir 50 | |
| 51 | #define __NR_chroot 51 | |
| 52 | #define __NR_fchmod 52 | |
| 53 | #define __NR_fchmodat 53 | |
| 54 | #define __NR_fchownat 54 | |
| 55 | #define __NR_fchown 55 | |
| 56 | #define __NR_openat 56 | |
| 57 | #define __NR_close 57 | |
| 58 | #define __NR_vhangup 58 | |
| 59 | #define __NR_pipe2 59 | |
| 60 | #define __NR_quotactl 60 | |
| 61 | #define __NR_getdents64 61 | |
| 62 | #define __NR3264_lseek 62 | |
| 63 | #define __NR_read 63 | |
| 64 | #define __NR_write 64 | |
| 65 | #define __NR_readv 65 | |
| 66 | #define __NR_writev 66 | |
| 67 | #define __NR_pread64 67 | |
| 68 | #define __NR_pwrite64 68 | |
| 69 | #define __NR_preadv 69 | |
| 70 | #define __NR_pwritev 70 | |
| 71 | #define __NR3264_sendfile 71 | |
| 72 | #define __NR_pselect6 72 | |
| 73 | #define __NR_ppoll 73 | |
| 74 | #define __NR_signalfd4 74 | |
| 75 | #define __NR_vmsplice 75 | |
| 76 | #define __NR_splice 76 | |
| 77 | #define __NR_tee 77 | |
| 78 | #define __NR_readlinkat 78 | |
| 79 | #define __NR_sync 81 | |
| 80 | #define __NR_fsync 82 | |
| 81 | #define __NR_fdatasync 83 | |
| 82 | #define __NR_sync_file_range 84 | |
| 83 | #define __NR_timerfd_create 85 | |
| 84 | #define __NR_timerfd_settime 86 | |
| 85 | #define __NR_timerfd_gettime 87 | |
| 86 | #define __NR_utimensat 88 | |
| 87 | #define __NR_acct 89 | |
| 88 | #define __NR_capget 90 | |
| 89 | #define __NR_capset 91 | |
| 90 | #define __NR_personality 92 | |
| 91 | #define __NR_exit 93 | |
| 92 | #define __NR_exit_group 94 | |
| 93 | #define __NR_waitid 95 | |
| 94 | #define __NR_set_tid_address 96 | |
| 95 | #define __NR_unshare 97 | |
| 96 | #define __NR_futex 98 | |
| 97 | #define __NR_set_robust_list 99 | |
| 98 | #define __NR_get_robust_list 100 | |
| 99 | #define __NR_nanosleep 101 | |
| 100 | #define __NR_getitimer 102 | |
| 101 | #define __NR_setitimer 103 | |
| 102 | #define __NR_kexec_load 104 | |
| 103 | #define __NR_init_module 105 | |
| 104 | #define __NR_delete_module 106 | |
| 105 | #define __NR_timer_create 107 | |
| 106 | #define __NR_timer_gettime 108 | |
| 107 | #define __NR_timer_getoverrun 109 | |
| 108 | #define __NR_timer_settime 110 | |
| 109 | #define __NR_timer_delete 111 | |
| 110 | #define __NR_clock_settime 112 | |
| 111 | #define __NR_clock_gettime 113 | |
| 112 | #define __NR_clock_getres 114 | |
| 113 | #define __NR_clock_nanosleep 115 | |
| 114 | #define __NR_syslog 116 | |
| 115 | #define __NR_ptrace 117 | |
| 116 | #define __NR_sched_setparam 118 | |
| 117 | #define __NR_sched_setscheduler 119 | |
| 118 | #define __NR_sched_getscheduler 120 | |
| 119 | #define __NR_sched_getparam 121 | |
| 120 | #define __NR_sched_setaffinity 122 | |
| 121 | #define __NR_sched_getaffinity 123 | |
| 122 | #define __NR_sched_yield 124 | |
| 123 | #define __NR_sched_get_priority_max 125 | |
| 124 | #define __NR_sched_get_priority_min 126 | |
| 125 | #define __NR_sched_rr_get_interval 127 | |
| 126 | #define __NR_restart_syscall 128 | |
| 127 | #define __NR_kill 129 | |
| 128 | #define __NR_tkill 130 | |
| 129 | #define __NR_tgkill 131 | |
| 130 | #define __NR_sigaltstack 132 | |
| 131 | #define __NR_rt_sigsuspend 133 | |
| 132 | #define __NR_rt_sigaction 134 | |
| 133 | #define __NR_rt_sigprocmask 135 | |
| 134 | #define __NR_rt_sigpending 136 | |
| 135 | #define __NR_rt_sigtimedwait 137 | |
| 136 | #define __NR_rt_sigqueueinfo 138 | |
| 137 | #define __NR_rt_sigreturn 139 | |
| 138 | #define __NR_setpriority 140 | |
| 139 | #define __NR_getpriority 141 | |
| 140 | #define __NR_reboot 142 | |
| 141 | #define __NR_setregid 143 | |
| 142 | #define __NR_setgid 144 | |
| 143 | #define __NR_setreuid 145 | |
| 144 | #define __NR_setuid 146 | |
| 145 | #define __NR_setresuid 147 | |
| 146 | #define __NR_getresuid 148 | |
| 147 | #define __NR_setresgid 149 | |
| 148 | #define __NR_getresgid 150 | |
| 149 | #define __NR_setfsuid 151 | |
| 150 | #define __NR_setfsgid 152 | |
| 151 | #define __NR_times 153 | |
| 152 | #define __NR_setpgid 154 | |
| 153 | #define __NR_getpgid 155 | |
| 154 | #define __NR_getsid 156 | |
| 155 | #define __NR_setsid 157 | |
| 156 | #define __NR_getgroups 158 | |
| 157 | #define __NR_setgroups 159 | |
| 158 | #define __NR_uname 160 | |
| 159 | #define __NR_sethostname 161 | |
| 160 | #define __NR_setdomainname 162 | |
| 161 | #define __NR_getrusage 165 | |
| 162 | #define __NR_umask 166 | |
| 163 | #define __NR_prctl 167 | |
| 164 | #define __NR_getcpu 168 | |
| 165 | #define __NR_gettimeofday 169 | |
| 166 | #define __NR_settimeofday 170 | |
| 167 | #define __NR_adjtimex 171 | |
| 168 | #define __NR_getpid 172 | |
| 169 | #define __NR_getppid 173 | |
| 170 | #define __NR_getuid 174 | |
| 171 | #define __NR_geteuid 175 | |
| 172 | #define __NR_getgid 176 | |
| 173 | #define __NR_getegid 177 | |
| 174 | #define __NR_gettid 178 | |
| 175 | #define __NR_sysinfo 179 | |
| 176 | #define __NR_mq_open 180 | |
| 177 | #define __NR_mq_unlink 181 | |
| 178 | #define __NR_mq_timedsend 182 | |
| 179 | #define __NR_mq_timedreceive 183 | |
| 180 | #define __NR_mq_notify 184 | |
| 181 | #define __NR_mq_getsetattr 185 | |
| 182 | #define __NR_msgget 186 | |
| 183 | #define __NR_msgctl 187 | |
| 184 | #define __NR_msgrcv 188 | |
| 185 | #define __NR_msgsnd 189 | |
| 186 | #define __NR_semget 190 | |
| 187 | #define __NR_semctl 191 | |
| 188 | #define __NR_semtimedop 192 | |
| 189 | #define __NR_semop 193 | |
| 190 | #define __NR_shmget 194 | |
| 191 | #define __NR_shmctl 195 | |
| 192 | #define __NR_shmat 196 | |
| 193 | #define __NR_shmdt 197 | |
| 194 | #define __NR_socket 198 | |
| 195 | #define __NR_socketpair 199 | |
| 196 | #define __NR_bind 200 | |
| 197 | #define __NR_listen 201 | |
| 198 | #define __NR_accept 202 | |
| 199 | #define __NR_connect 203 | |
| 200 | #define __NR_getsockname 204 | |
| 201 | #define __NR_getpeername 205 | |
| 202 | #define __NR_sendto 206 | |
| 203 | #define __NR_recvfrom 207 | |
| 204 | #define __NR_setsockopt 208 | |
| 205 | #define __NR_getsockopt 209 | |
| 206 | #define __NR_shutdown 210 | |
| 207 | #define __NR_sendmsg 211 | |
| 208 | #define __NR_recvmsg 212 | |
| 209 | #define __NR_readahead 213 | |
| 210 | #define __NR_brk 214 | |
| 211 | #define __NR_munmap 215 | |
| 212 | #define __NR_mremap 216 | |
| 213 | #define __NR_add_key 217 | |
| 214 | #define __NR_request_key 218 | |
| 215 | #define __NR_keyctl 219 | |
| 216 | #define __NR_clone 220 | |
| 217 | #define __NR_execve 221 | |
| 218 | #define __NR3264_mmap 222 | |
| 219 | #define __NR3264_fadvise64 223 | |
| 220 | #define __NR_swapon 224 | |
| 221 | #define __NR_swapoff 225 | |
| 222 | #define __NR_mprotect 226 | |
| 223 | #define __NR_msync 227 | |
| 224 | #define __NR_mlock 228 | |
| 225 | #define __NR_munlock 229 | |
| 226 | #define __NR_mlockall 230 | |
| 227 | #define __NR_munlockall 231 | |
| 228 | #define __NR_mincore 232 | |
| 229 | #define __NR_madvise 233 | |
| 230 | #define __NR_remap_file_pages 234 | |
| 231 | #define __NR_mbind 235 | |
| 232 | #define __NR_get_mempolicy 236 | |
| 233 | #define __NR_set_mempolicy 237 | |
| 234 | #define __NR_migrate_pages 238 | |
| 235 | #define __NR_move_pages 239 | |
| 236 | #define __NR_rt_tgsigqueueinfo 240 | |
| 237 | #define __NR_perf_event_open 241 | |
| 238 | #define __NR_accept4 242 | |
| 239 | #define __NR_recvmmsg 243 | |
| 240 | #define __NR_arch_specific_syscall 244 | |
| 241 | #define __NR_wait4 260 | |
| 242 | #define __NR_prlimit64 261 | |
| 243 | #define __NR_fanotify_init 262 | |
| 244 | #define __NR_fanotify_mark 263 | |
| 245 | #define __NR_name_to_handle_at 264 | |
| 246 | #define __NR_open_by_handle_at 265 | |
| 247 | #define __NR_clock_adjtime 266 | |
| 248 | #define __NR_syncfs 267 | |
| 249 | #define __NR_setns 268 | |
| 250 | #define __NR_sendmmsg 269 | |
| 251 | #define __NR_process_vm_readv 270 | |
| 252 | #define __NR_process_vm_writev 271 | |
| 253 | #define __NR_kcmp 272 | |
| 254 | #define __NR_finit_module 273 | |
| 255 | #define __NR_sched_setattr 274 | |
| 256 | #define __NR_sched_getattr 275 | |
| 257 | #define __NR_renameat2 276 | |
| 258 | #define __NR_seccomp 277 | |
| 259 | #define __NR_getrandom 278 | |
| 260 | #define __NR_memfd_create 279 | |
| 261 | #define __NR_bpf 280 | |
| 262 | #define __NR_execveat 281 | |
| 263 | #define __NR_userfaultfd 282 | |
| 264 | #define __NR_membarrier 283 | |
| 265 | #define __NR_mlock2 284 | |
| 266 | #define __NR_copy_file_range 285 | |
| 267 | #define __NR_preadv2 286 | |
| 268 | #define __NR_pwritev2 287 | |
| 269 | #define __NR_pkey_mprotect 288 | |
| 270 | #define __NR_pkey_alloc 289 | |
| 271 | #define __NR_pkey_free 290 | |
| 272 | #define __NR_statx 291 | |
| 273 | #define __NR_io_pgetevents 292 | |
| 274 | #define __NR_rseq 293 | |
| 275 | #define __NR_kexec_file_load 294 | |
| 276 | #define __NR_pidfd_send_signal 424 | |
| 277 | #define __NR_io_uring_setup 425 | |
| 278 | #define __NR_io_uring_enter 426 | |
| 279 | #define __NR_io_uring_register 427 | |
| 280 | #define __NR_open_tree 428 | |
| 281 | #define __NR_move_mount 429 | |
| 282 | #define __NR_fsopen 430 | |
| 283 | #define __NR_fsconfig 431 | |
| 284 | #define __NR_fsmount 432 | |
| 285 | #define __NR_fspick 433 | |
| 286 | #define __NR_pidfd_open 434 | |
| 287 | #define __NR_clone3 435 | |
| 288 | #define __NR_close_range 436 | |
| 289 | #define __NR_openat2 437 | |
| 290 | #define __NR_pidfd_getfd 438 | |
| 291 | #define __NR_faccessat2 439 | |
| 292 | #define __NR_process_madvise 440 | |
| 293 | #define __NR_epoll_pwait2 441 | |
| 294 | #define __NR_mount_setattr 442 | |
| 295 | #define __NR_quotactl_fd 443 | |
| 296 | #define __NR_landlock_create_ruleset 444 | |
| 297 | #define __NR_landlock_add_rule 445 | |
| 298 | #define __NR_landlock_restrict_self 446 | |
| 299 | #define __NR_process_mrelease 448 | |
| 300 | #define __NR_futex_waitv 449 | |
| 301 | #define __NR_set_mempolicy_home_node 450 | |
| 302 | #define __NR_cachestat 451 | |
| 303 | #define __NR_fchmodat2 452 | |
| 304 | #define __NR_map_shadow_stack 453 | |
| 305 | #define __NR_futex_wake 454 | |
| 306 | #define __NR_futex_wait 455 | |
| 307 | #define __NR_futex_requeue 456 | |
| 308 | #define __NR_fcntl __NR3264_fcntl | |
| 309 | #define __NR_statfs __NR3264_statfs | |
| 310 | #define __NR_fstatfs __NR3264_fstatfs | |
| 311 | #define __NR_truncate __NR3264_truncate | |
| 312 | #define __NR_ftruncate __NR3264_ftruncate | |
| 313 | #define __NR_lseek __NR3264_lseek | |
| 314 | #define __NR_sendfile __NR3264_sendfile | |
| 315 | #define __NR_mmap __NR3264_mmap | |
| 316 | #define __NR_fadvise64 __NR3264_fadvise64 |
lib/libc/musl/arch/loongarch64/bits/user.h created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | #define ELF_NGREG 45 | |
| 2 | #define ELF_NFPREG 34 | |
| 3 | ||
| 4 | struct user_regs_struct { | |
| 5 | 	unsigned long regs[32]; | |
| 6 | 	unsigned long orig_a0; | |
| 7 | 	unsigned long csr_era; | |
| 8 | 	unsigned long csr_badv; | |
| 9 | 	unsigned long reserved[10]; | |
| 10 | }; | |
| 11 | ||
| 12 | struct user_fp_struct { | |
| 13 | 	unsigned long fpr[32]; | |
| 14 | 	unsigned long fcc; | |
| 15 | 	unsigned int fcsr; | |
| 16 | }; | |
| 17 | ||
| 18 | typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; | |
| 19 | ||
| 20 | typedef union { | |
| 21 | 	double d; | |
| 22 | 	float f; | |
| 23 | } elf_fpreg_t; | |
| 24 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; |
lib/libc/musl/arch/loongarch64/crt_arch.h created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | __asm__( | |
| 2 | ".text \n" | |
| 3 | ".global " START "\n" | |
| 4 | ".type " START ", @function\n" | |
| 5 | START ":\n" | |
| 6 | "	move $fp, $zero\n" | |
| 7 | "	move $a0, $sp\n" | |
| 8 | ".weak _DYNAMIC\n" | |
| 9 | ".hidden _DYNAMIC\n" | |
| 10 | "	la.local $a1, _DYNAMIC\n" | |
| 11 | "	bstrins.d $sp, $zero, 3, 0\n" | |
| 12 | "	b " START "_c\n" | |
| 13 | ); |
lib/libc/musl/arch/loongarch64/pthread_arch.h created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | static inline uintptr_t __get_tp() | |
| 2 | { | |
| 3 | 	register uintptr_t tp __asm__("tp"); | |
| 4 | 	__asm__ ("" : "=r" (tp) ); | |
| 5 | 	return tp; | |
| 6 | } | |
| 7 | ||
| 8 | #define TLS_ABOVE_TP | |
| 9 | #define GAP_ABOVE_TP 0 | |
| 10 | #define DTP_OFFSET 0 | |
| 11 | #define MC_PC __pc |
lib/libc/musl/arch/loongarch64/reloc.h created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | #ifdef __loongarch_soft_float | |
| 2 | #define FP_SUFFIX "-sf" | |
| 3 | #elif defined __loongarch_single_float | |
| 4 | #define FP_SUFFIX "-sp" | |
| 5 | #else | |
| 6 | #define FP_SUFFIX "" | |
| 7 | #endif | |
| 8 | ||
| 9 | #define LDSO_ARCH "loongarch64" FP_SUFFIX | |
| 10 | ||
| 11 | #define TPOFF_K 0 | |
| 12 | ||
| 13 | #define REL_PLT R_LARCH_JUMP_SLOT | |
| 14 | #define REL_COPY R_LARCH_COPY | |
| 15 | #define REL_DTPMOD R_LARCH_TLS_DTPMOD64 | |
| 16 | #define REL_DTPOFF R_LARCH_TLS_DTPREL64 | |
| 17 | #define REL_TPOFF R_LARCH_TLS_TPREL64 | |
| 18 | #define REL_RELATIVE R_LARCH_RELATIVE | |
| 19 | #define REL_SYMBOLIC R_LARCH_64 | |
| 20 | ||
| 21 | #define CRTJMP(pc,sp) __asm__ __volatile__( \ | |
| 22 | 	"move $sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) | |
| 23 | ||
| 24 | #define GETFUNCSYM(fp, sym, got) __asm__ ( \ | |
| 25 | 	".hidden " #sym "\n" \ | |
| 26 | 	".align 8 \n" \ | |
| 27 | 	"	la.local $t1, "#sym" \n" \ | |
| 28 | 	"	move %0, $t1 \n" \ | |
| 29 | 	: "=r"(*(fp)) : : "memory" ) |
lib/libc/musl/arch/loongarch64/syscall_arch.h created+137| ... | ... | @@ -0,0 +1,137 @@ |
| 1 | #define __SYSCALL_LL_E(x) (x) | |
| 2 | #define __SYSCALL_LL_O(x) (x) | |
| 3 | ||
| 4 | #define SYSCALL_CLOBBERLIST \ | |
| 5 | 	"$t0", "$t1", "$t2", "$t3", \ | |
| 6 | 	"$t4", "$t5", "$t6", "$t7", "$t8", "memory" | |
| 7 | ||
| 8 | static inline long __syscall0(long n) | |
| 9 | { | |
| 10 | 	register long a7 __asm__("$a7") = n; | |
| 11 | 	register long a0 __asm__("$a0"); | |
| 12 | ||
| 13 | 	__asm__ __volatile__ ( | |
| 14 | 		"syscall 0" | |
| 15 | 		: "=r"(a0) | |
| 16 | 		: "r"(a7) | |
| 17 | 		: SYSCALL_CLOBBERLIST); | |
| 18 | 	return a0; | |
| 19 | } | |
| 20 | ||
| 21 | static inline long __syscall1(long n, long a) | |
| 22 | { | |
| 23 | 	register long a7 __asm__("$a7") = n; | |
| 24 | 	register long a0 __asm__("$a0") = a; | |
| 25 | ||
| 26 | 	__asm__ __volatile__ ( | |
| 27 | 		"syscall 0" | |
| 28 | 		: "+r"(a0) | |
| 29 | 		: "r"(a7) | |
| 30 | 		: SYSCALL_CLOBBERLIST); | |
| 31 | 	return a0; | |
| 32 | } | |
| 33 | ||
| 34 | static inline long __syscall2(long n, long a, long b) | |
| 35 | { | |
| 36 | 	register long a7 __asm__("$a7") = n; | |
| 37 | 	register long a0 __asm__("$a0") = a; | |
| 38 | 	register long a1 __asm__("$a1") = b; | |
| 39 | ||
| 40 | 	__asm__ __volatile__ ( | |
| 41 | 		"syscall 0" | |
| 42 | 		: "+r"(a0) | |
| 43 | 	 : "r"(a7), "r"(a1) | |
| 44 | 		: SYSCALL_CLOBBERLIST); | |
| 45 | 	return a0; | |
| 46 | } | |
| 47 | ||
| 48 | static inline long __syscall3(long n, long a, long b, long c) | |
| 49 | { | |
| 50 | 	register long a7 __asm__("$a7") = n; | |
| 51 | 	register long a0 __asm__("$a0") = a; | |
| 52 | 	register long a1 __asm__("$a1") = b; | |
| 53 | 	register long a2 __asm__("$a2") = c; | |
| 54 | ||
| 55 | 	__asm__ __volatile__ ( | |
| 56 | 		"syscall 0" | |
| 57 | 		: "+r"(a0) | |
| 58 | 	 : "r"(a7), "r"(a1), "r"(a2) | |
| 59 | 		: SYSCALL_CLOBBERLIST); | |
| 60 | 	return a0; | |
| 61 | } | |
| 62 | ||
| 63 | static inline long __syscall4(long n, long a, long b, long c, long d) | |
| 64 | { | |
| 65 | 	register long a7 __asm__("$a7") = n; | |
| 66 | 	register long a0 __asm__("$a0") = a; | |
| 67 | 	register long a1 __asm__("$a1") = b; | |
| 68 | 	register long a2 __asm__("$a2") = c; | |
| 69 | 	register long a3 __asm__("$a3") = d; | |
| 70 | ||
| 71 | 	__asm__ __volatile__ ( | |
| 72 | 		"syscall 0" | |
| 73 | 		: "+r"(a0) | |
| 74 | 	 : "r"(a7), "r"(a1), "r"(a2), "r"(a3) | |
| 75 | 		: SYSCALL_CLOBBERLIST); | |
| 76 | 	return a0; | |
| 77 | } | |
| 78 | ||
| 79 | static inline long __syscall5(long n, long a, long b, long c, long d, long e) | |
| 80 | { | |
| 81 | 	register long a7 __asm__("$a7") = n; | |
| 82 | 	register long a0 __asm__("$a0") = a; | |
| 83 | 	register long a1 __asm__("$a1") = b; | |
| 84 | 	register long a2 __asm__("$a2") = c; | |
| 85 | 	register long a3 __asm__("$a3") = d; | |
| 86 | 	register long a4 __asm__("$a4") = e; | |
| 87 | ||
| 88 | 	__asm__ __volatile__ ( | |
| 89 | 		"syscall 0" | |
| 90 | 		: "+r"(a0) | |
| 91 | 	 : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4) | |
| 92 | 		: SYSCALL_CLOBBERLIST); | |
| 93 | 	return a0; | |
| 94 | } | |
| 95 | ||
| 96 | static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) | |
| 97 | { | |
| 98 | 	register long a7 __asm__("$a7") = n; | |
| 99 | 	register long a0 __asm__("$a0") = a; | |
| 100 | 	register long a1 __asm__("$a1") = b; | |
| 101 | 	register long a2 __asm__("$a2") = c; | |
| 102 | 	register long a3 __asm__("$a3") = d; | |
| 103 | 	register long a4 __asm__("$a4") = e; | |
| 104 | 	register long a5 __asm__("$a5") = f; | |
| 105 | ||
| 106 | 	__asm__ __volatile__ ( | |
| 107 | 		"syscall 0" | |
| 108 | 		: "+r"(a0) | |
| 109 | 	 : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5) | |
| 110 | 		: SYSCALL_CLOBBERLIST); | |
| 111 | 	return a0; | |
| 112 | } | |
| 113 | ||
| 114 | static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g) | |
| 115 | { | |
| 116 | 	register long a7 __asm__("$a7") = n; | |
| 117 | 	register long a0 __asm__("$a0") = a; | |
| 118 | 	register long a1 __asm__("$a1") = b; | |
| 119 | 	register long a2 __asm__("$a2") = c; | |
| 120 | 	register long a3 __asm__("$a3") = d; | |
| 121 | 	register long a4 __asm__("$a4") = e; | |
| 122 | 	register long a5 __asm__("$a5") = f; | |
| 123 | 	register long a6 __asm__("$a6") = g; | |
| 124 | ||
| 125 | 	__asm__ __volatile__ ( | |
| 126 | 		"syscall 0" | |
| 127 | 		: "+r"(a0) | |
| 128 | 	 : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6) | |
| 129 | 		: SYSCALL_CLOBBERLIST); | |
| 130 | 	return a0; | |
| 131 | } | |
| 132 | ||
| 133 | #define VDSO_USEFUL | |
| 134 | #define VDSO_CGT_SYM "__vdso_clock_gettime" | |
| 135 | #define VDSO_CGT_VER "LINUX_5.10" | |
| 136 | ||
| 137 | #define IPC_64 0 |
lib/libc/musl/arch/m68k/bits/syscall.h.in+5| ... | ... | @@ -416,3 +416,8 @@ |
| 416 | 416 | #define __NR_landlock_create_ruleset	444 |
| 417 | 417 | #define __NR_landlock_add_rule	445 |
| 418 | 418 | #define __NR_landlock_restrict_self	446 |
| 419 | #define __NR_process_mrelease	448 | |
| 420 | #define __NR_futex_waitv	449 | |
| 421 | #define __NR_set_mempolicy_home_node	450 | |
| 422 | #define __NR_cachestat		451 | |
| 423 | #define __NR_fchmodat2		452 |
lib/libc/musl/arch/mips/bits/syscall.h.in+5| ... | ... | @@ -418,4 +418,9 @@ |
| 418 | 418 | #define __NR_landlock_create_ruleset	4444 |
| 419 | 419 | #define __NR_landlock_add_rule	4445 |
| 420 | 420 | #define __NR_landlock_restrict_self	4446 |
| 421 | #define __NR_process_mrelease	4448 | |
| 422 | #define __NR_futex_waitv	4449 | |
| 423 | #define __NR_set_mempolicy_home_node	4450 | |
| 424 | #define __NR_cachestat		4451 | |
| 425 | #define __NR_fchmodat2		4452 | |
| 421 | 426 |
lib/libc/musl/arch/mips64/bits/syscall.h.in+5| ... | ... | @@ -348,4 +348,9 @@ |
| 348 | 348 | #define __NR_landlock_create_ruleset	5444 |
| 349 | 349 | #define __NR_landlock_add_rule	5445 |
| 350 | 350 | #define __NR_landlock_restrict_self	5446 |
| 351 | #define __NR_process_mrelease	5448 | |
| 352 | #define __NR_futex_waitv	5449 | |
| 353 | #define __NR_set_mempolicy_home_node	5450 | |
| 354 | #define __NR_cachestat		5451 | |
| 355 | #define __NR_fchmodat2		5452 | |
| 351 | 356 |
lib/libc/musl/arch/powerpc/bits/syscall.h.in+5| ... | ... | @@ -425,4 +425,9 @@ |
| 425 | 425 | #define __NR_landlock_create_ruleset	444 |
| 426 | 426 | #define __NR_landlock_add_rule	445 |
| 427 | 427 | #define __NR_landlock_restrict_self	446 |
| 428 | #define __NR_process_mrelease	448 | |
| 429 | #define __NR_futex_waitv	449 | |
| 430 | #define __NR_set_mempolicy_home_node	450 | |
| 431 | #define __NR_cachestat		451 | |
| 432 | #define __NR_fchmodat2		452 | |
| 428 | 433 |
lib/libc/musl/arch/powerpc64/bits/syscall.h.in+5| ... | ... | @@ -397,4 +397,9 @@ |
| 397 | 397 | #define __NR_landlock_create_ruleset	444 |
| 398 | 398 | #define __NR_landlock_add_rule	445 |
| 399 | 399 | #define __NR_landlock_restrict_self	446 |
| 400 | #define __NR_process_mrelease	448 | |
| 401 | #define __NR_futex_waitv	449 | |
| 402 | #define __NR_set_mempolicy_home_node	450 | |
| 403 | #define __NR_cachestat		451 | |
| 404 | #define __NR_fchmodat2		452 | |
| 400 | 405 |
lib/libc/musl/arch/riscv32/atomic_arch.h created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | #define a_barrier a_barrier | |
| 2 | static inline void a_barrier() | |
| 3 | { | |
| 4 | 	__asm__ __volatile__ ("fence rw,rw" : : : "memory"); | |
| 5 | } | |
| 6 | ||
| 7 | #define a_cas a_cas | |
| 8 | static inline int a_cas(volatile int *p, int t, int s) | |
| 9 | { | |
| 10 | 	int old, tmp; | |
| 11 | 	__asm__ __volatile__ ( | |
| 12 | 		"\n1:	lr.w.aqrl %0, (%2)\n" | |
| 13 | 		"	bne %0, %3, 1f\n" | |
| 14 | 		"	sc.w.aqrl %1, %4, (%2)\n" | |
| 15 | 		"	bnez %1, 1b\n" | |
| 16 | 		"1:" | |
| 17 | 		: "=&r"(old), "=&r"(tmp) | |
| 18 | 		: "r"(p), "r"((long)t), "r"((long)s) | |
| 19 | 		: "memory"); | |
| 20 | 	return old; | |
| 21 | } |
lib/libc/musl/arch/riscv32/bits/alltypes.h.in created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | #define _Addr int | |
| 2 | #define _Int64 long long | |
| 3 | #define _Reg int | |
| 4 | ||
| 5 | #define __BYTE_ORDER 1234 | |
| 6 | #define __LONG_MAX 0x7fffffffL | |
| 7 | ||
| 8 | #ifndef __cplusplus | |
| 9 | TYPEDEF int wchar_t; | |
| 10 | #endif | |
| 11 | ||
| 12 | TYPEDEF int blksize_t; | |
| 13 | TYPEDEF unsigned int nlink_t; | |
| 14 | ||
| 15 | TYPEDEF float float_t; | |
| 16 | TYPEDEF double double_t; | |
| 17 | ||
| 18 | TYPEDEF struct { long long __ll; long double __ld; } max_align_t; |
lib/libc/musl/arch/riscv32/bits/fenv.h created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | #define FE_INVALID 16 | |
| 2 | #define FE_DIVBYZERO 8 | |
| 3 | #define FE_OVERFLOW 4 | |
| 4 | #define FE_UNDERFLOW 2 | |
| 5 | #define FE_INEXACT 1 | |
| 6 | ||
| 7 | #define FE_ALL_EXCEPT 31 | |
| 8 | ||
| 9 | #define FE_TONEAREST 0 | |
| 10 | #define FE_DOWNWARD 2 | |
| 11 | #define FE_UPWARD 3 | |
| 12 | #define FE_TOWARDZERO 1 | |
| 13 | ||
| 14 | typedef unsigned int fexcept_t; | |
| 15 | typedef unsigned int fenv_t; | |
| 16 | ||
| 17 | #define FE_DFL_ENV ((const fenv_t *) -1) |
lib/libc/musl/arch/riscv32/bits/float.h created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | #define FLT_EVAL_METHOD 0 | |
| 2 | ||
| 3 | #define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L | |
| 4 | #define LDBL_MIN 3.36210314311209350626267781732175260e-4932L | |
| 5 | #define LDBL_MAX 1.18973149535723176508575932662800702e+4932L | |
| 6 | #define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L | |
| 7 | ||
| 8 | #define LDBL_MANT_DIG 113 | |
| 9 | #define LDBL_MIN_EXP (-16381) | |
| 10 | #define LDBL_MAX_EXP 16384 | |
| 11 | ||
| 12 | #define LDBL_DIG 33 | |
| 13 | #define LDBL_MIN_10_EXP (-4931) | |
| 14 | #define LDBL_MAX_10_EXP 4932 | |
| 15 | ||
| 16 | #define DECIMAL_DIG 36 |
lib/libc/musl/arch/riscv32/bits/ipcstat.h created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | #define IPC_STAT 0x102 |
lib/libc/musl/arch/riscv32/bits/msg.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | struct msqid_ds { | |
| 2 | 	struct ipc_perm msg_perm; | |
| 3 | 	unsigned long __msg_stime_lo; | |
| 4 | 	unsigned long __msg_stime_hi; | |
| 5 | 	unsigned long __msg_rtime_lo; | |
| 6 | 	unsigned long __msg_rtime_hi; | |
| 7 | 	unsigned long __msg_ctime_lo; | |
| 8 | 	unsigned long __msg_ctime_hi; | |
| 9 | 	unsigned long msg_cbytes; | |
| 10 | 	msgqnum_t msg_qnum; | |
| 11 | 	msglen_t msg_qbytes; | |
| 12 | 	pid_t msg_lspid; | |
| 13 | 	pid_t msg_lrpid; | |
| 14 | 	unsigned long __unused[2]; | |
| 15 | 	time_t msg_stime; | |
| 16 | 	time_t msg_rtime; | |
| 17 | 	time_t msg_ctime; | |
| 18 | }; |
lib/libc/musl/arch/riscv32/bits/posix.h created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | #define _POSIX_V6_ILP32_OFFBIG 1 | |
| 2 | #define _POSIX_V7_ILP32_OFFBIG 1 |
lib/libc/musl/arch/riscv32/bits/reg.h created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | #undef __WORDSIZE | |
| 2 | #define __WORDSIZE 32 |
lib/libc/musl/arch/riscv32/bits/sem.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | struct semid_ds { | |
| 2 | 	struct ipc_perm sem_perm; | |
| 3 | 	unsigned long __sem_otime_lo; | |
| 4 | 	unsigned long __sem_otime_hi; | |
| 5 | 	unsigned long __sem_ctime_lo; | |
| 6 | 	unsigned long __sem_ctime_hi; | |
| 7 | #if __BYTE_ORDER == __LITTLE_ENDIAN | |
| 8 | 	unsigned short sem_nsems; | |
| 9 | 	char __sem_nsems_pad[sizeof(long)-sizeof(short)]; | |
| 10 | #else | |
| 11 | 	char __sem_nsems_pad[sizeof(long)-sizeof(short)]; | |
| 12 | 	unsigned short sem_nsems; | |
| 13 | #endif | |
| 14 | 	long __unused3; | |
| 15 | 	long __unused4; | |
| 16 | 	time_t sem_otime; | |
| 17 | 	time_t sem_ctime; | |
| 18 | }; |
lib/libc/musl/arch/riscv32/bits/setjmp.h created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | typedef unsigned long long __jmp_buf[19]; |
lib/libc/musl/arch/riscv32/bits/shm.h created+31| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | #define SHMLBA 4096 | |
| 2 | ||
| 3 | struct shmid_ds { | |
| 4 | 	struct ipc_perm shm_perm; | |
| 5 | 	size_t shm_segsz; | |
| 6 | 	unsigned long __shm_atime_lo; | |
| 7 | 	unsigned long __shm_atime_hi; | |
| 8 | 	unsigned long __shm_dtime_lo; | |
| 9 | 	unsigned long __shm_dtime_hi; | |
| 10 | 	unsigned long __shm_ctime_lo; | |
| 11 | 	unsigned long __shm_ctime_hi; | |
| 12 | 	pid_t shm_cpid; | |
| 13 | 	pid_t shm_lpid; | |
| 14 | 	unsigned long shm_nattch; | |
| 15 | 	unsigned long __pad1; | |
| 16 | 	unsigned long __pad2; | |
| 17 | 	unsigned long __pad3; | |
| 18 | 	time_t shm_atime; | |
| 19 | 	time_t shm_dtime; | |
| 20 | 	time_t shm_ctime; | |
| 21 | }; | |
| 22 | ||
| 23 | struct shminfo { | |
| 24 | 	unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; | |
| 25 | }; | |
| 26 | ||
| 27 | struct shm_info { | |
| 28 | 	int __used_ids; | |
| 29 | 	unsigned long shm_tot, shm_rss, shm_swp; | |
| 30 | 	unsigned long __swap_attempts, __swap_successes; | |
| 31 | }; |
lib/libc/musl/arch/riscv32/bits/signal.h created+120| ... | ... | @@ -0,0 +1,120 @@ |
| 1 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ | |
| 2 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 3 | ||
| 4 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 5 | # define MINSIGSTKSZ 2048 | |
| 6 | # define SIGSTKSZ 8192 | |
| 7 | #endif | |
| 8 | ||
| 9 | typedef unsigned long __riscv_mc_gp_state[32]; | |
| 10 | ||
| 11 | struct __riscv_mc_f_ext_state { | |
| 12 | 	unsigned int __f[32]; | |
| 13 | 	unsigned int __fcsr; | |
| 14 | }; | |
| 15 | ||
| 16 | struct __riscv_mc_d_ext_state { | |
| 17 | 	unsigned long long __f[32]; | |
| 18 | 	unsigned int __fcsr; | |
| 19 | }; | |
| 20 | ||
| 21 | struct __riscv_mc_q_ext_state { | |
| 22 | 	unsigned long long __f[64] __attribute__((aligned(16))); | |
| 23 | 	unsigned int __fcsr; | |
| 24 | 	unsigned int __reserved[3]; | |
| 25 | }; | |
| 26 | ||
| 27 | union __riscv_mc_fp_state { | |
| 28 | 	struct __riscv_mc_f_ext_state __f; | |
| 29 | 	struct __riscv_mc_d_ext_state __d; | |
| 30 | 	struct __riscv_mc_q_ext_state __q; | |
| 31 | }; | |
| 32 | ||
| 33 | typedef struct mcontext_t { | |
| 34 | 	__riscv_mc_gp_state __gregs; | |
| 35 | 	union __riscv_mc_fp_state __fpregs; | |
| 36 | } mcontext_t; | |
| 37 | ||
| 38 | #if defined(_GNU_SOURCE) | |
| 39 | #define REG_PC 0 | |
| 40 | #define REG_RA 1 | |
| 41 | #define REG_SP 2 | |
| 42 | #define REG_TP 4 | |
| 43 | #define REG_S0 8 | |
| 44 | #define REG_S1 9 | |
| 45 | #define REG_A0 10 | |
| 46 | #define REG_S2 18 | |
| 47 | #endif | |
| 48 | ||
| 49 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 50 | typedef unsigned long greg_t; | |
| 51 | typedef unsigned long gregset_t[32]; | |
| 52 | typedef union __riscv_mc_fp_state fpregset_t; | |
| 53 | struct sigcontext { | |
| 54 | 	gregset_t gregs; | |
| 55 | 	fpregset_t fpregs; | |
| 56 | }; | |
| 57 | #endif | |
| 58 | ||
| 59 | struct sigaltstack { | |
| 60 | 	void *ss_sp; | |
| 61 | 	int ss_flags; | |
| 62 | 	size_t ss_size; | |
| 63 | }; | |
| 64 | ||
| 65 | typedef struct __ucontext | |
| 66 | { | |
| 67 | 	unsigned long uc_flags; | |
| 68 | 	struct __ucontext *uc_link; | |
| 69 | 	stack_t uc_stack; | |
| 70 | 	sigset_t uc_sigmask; | |
| 71 | 	mcontext_t uc_mcontext; | |
| 72 | } ucontext_t; | |
| 73 | ||
| 74 | #define SA_NOCLDSTOP 1 | |
| 75 | #define SA_NOCLDWAIT 2 | |
| 76 | #define SA_SIGINFO 4 | |
| 77 | #define SA_ONSTACK 0x08000000 | |
| 78 | #define SA_RESTART 0x10000000 | |
| 79 | #define SA_NODEFER 0x40000000 | |
| 80 | #define SA_RESETHAND 0x80000000 | |
| 81 | #define SA_RESTORER 0x04000000 | |
| 82 | ||
| 83 | #endif | |
| 84 | ||
| 85 | #define SIGHUP 1 | |
| 86 | #define SIGINT 2 | |
| 87 | #define SIGQUIT 3 | |
| 88 | #define SIGILL 4 | |
| 89 | #define SIGTRAP 5 | |
| 90 | #define SIGABRT 6 | |
| 91 | #define SIGIOT SIGABRT | |
| 92 | #define SIGBUS 7 | |
| 93 | #define SIGFPE 8 | |
| 94 | #define SIGKILL 9 | |
| 95 | #define SIGUSR1 10 | |
| 96 | #define SIGSEGV 11 | |
| 97 | #define SIGUSR2 12 | |
| 98 | #define SIGPIPE 13 | |
| 99 | #define SIGALRM 14 | |
| 100 | #define SIGTERM 15 | |
| 101 | #define SIGSTKFLT 16 | |
| 102 | #define SIGCHLD 17 | |
| 103 | #define SIGCONT 18 | |
| 104 | #define SIGSTOP 19 | |
| 105 | #define SIGTSTP 20 | |
| 106 | #define SIGTTIN 21 | |
| 107 | #define SIGTTOU 22 | |
| 108 | #define SIGURG 23 | |
| 109 | #define SIGXCPU 24 | |
| 110 | #define SIGXFSZ 25 | |
| 111 | #define SIGVTALRM 26 | |
| 112 | #define SIGPROF 27 | |
| 113 | #define SIGWINCH 28 | |
| 114 | #define SIGIO 29 | |
| 115 | #define SIGPOLL SIGIO | |
| 116 | #define SIGPWR 30 | |
| 117 | #define SIGSYS 31 | |
| 118 | #define SIGUNUSED SIGSYS | |
| 119 | ||
| 120 | #define _NSIG 65 |
lib/libc/musl/arch/riscv32/bits/stat.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | struct stat { | |
| 2 | 	dev_t st_dev; | |
| 3 | 	ino_t st_ino; | |
| 4 | 	mode_t st_mode; | |
| 5 | 	nlink_t st_nlink; | |
| 6 | 	uid_t st_uid; | |
| 7 | 	gid_t st_gid; | |
| 8 | 	dev_t st_rdev; | |
| 9 | 	unsigned long long __pad; | |
| 10 | 	off_t st_size; | |
| 11 | 	blksize_t st_blksize; | |
| 12 | 	int __pad2; | |
| 13 | 	blkcnt_t st_blocks; | |
| 14 | 	struct timespec st_atim; | |
| 15 | 	struct timespec st_mtim; | |
| 16 | 	struct timespec st_ctim; | |
| 17 | 	unsigned __unused[2]; | |
| 18 | }; |
lib/libc/musl/arch/riscv32/bits/stdint.h created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | typedef int32_t int_fast16_t; | |
| 2 | typedef int32_t int_fast32_t; | |
| 3 | typedef uint32_t uint_fast16_t; | |
| 4 | typedef uint32_t uint_fast32_t; | |
| 5 | ||
| 6 | #define INT_FAST16_MIN INT32_MIN | |
| 7 | #define INT_FAST32_MIN INT32_MIN | |
| 8 | ||
| 9 | #define INT_FAST16_MAX INT32_MAX | |
| 10 | #define INT_FAST32_MAX INT32_MAX | |
| 11 | ||
| 12 | #define UINT_FAST16_MAX UINT32_MAX | |
| 13 | #define UINT_FAST32_MAX UINT32_MAX | |
| 14 | ||
| 15 | #define INTPTR_MIN INT32_MIN | |
| 16 | #define INTPTR_MAX INT32_MAX | |
| 17 | #define UINTPTR_MAX UINT32_MAX | |
| 18 | #define PTRDIFF_MIN INT32_MIN | |
| 19 | #define PTRDIFF_MAX INT32_MAX | |
| 20 | #define SIZE_MAX UINT32_MAX |
lib/libc/musl/arch/riscv32/bits/syscall.h.in created+300| ... | ... | @@ -0,0 +1,300 @@ |
| 1 | #define __NR_io_setup 0 | |
| 2 | #define __NR_io_destroy 1 | |
| 3 | #define __NR_io_submit 2 | |
| 4 | #define __NR_io_cancel 3 | |
| 5 | #define __NR_setxattr 5 | |
| 6 | #define __NR_lsetxattr 6 | |
| 7 | #define __NR_fsetxattr 7 | |
| 8 | #define __NR_getxattr 8 | |
| 9 | #define __NR_lgetxattr 9 | |
| 10 | #define __NR_fgetxattr 10 | |
| 11 | #define __NR_listxattr 11 | |
| 12 | #define __NR_llistxattr 12 | |
| 13 | #define __NR_flistxattr 13 | |
| 14 | #define __NR_removexattr 14 | |
| 15 | #define __NR_lremovexattr 15 | |
| 16 | #define __NR_fremovexattr 16 | |
| 17 | #define __NR_getcwd 17 | |
| 18 | #define __NR_lookup_dcookie 18 | |
| 19 | #define __NR_eventfd2 19 | |
| 20 | #define __NR_epoll_create1 20 | |
| 21 | #define __NR_epoll_ctl 21 | |
| 22 | #define __NR_epoll_pwait 22 | |
| 23 | #define __NR_dup 23 | |
| 24 | #define __NR_dup3 24 | |
| 25 | #define __NR_fcntl64 25 | |
| 26 | #define __NR_inotify_init1 26 | |
| 27 | #define __NR_inotify_add_watch 27 | |
| 28 | #define __NR_inotify_rm_watch 28 | |
| 29 | #define __NR_ioctl 29 | |
| 30 | #define __NR_ioprio_set 30 | |
| 31 | #define __NR_ioprio_get 31 | |
| 32 | #define __NR_flock 32 | |
| 33 | #define __NR_mknodat 33 | |
| 34 | #define __NR_mkdirat 34 | |
| 35 | #define __NR_unlinkat 35 | |
| 36 | #define __NR_symlinkat 36 | |
| 37 | #define __NR_linkat 37 | |
| 38 | #define __NR_umount2 39 | |
| 39 | #define __NR_mount 40 | |
| 40 | #define __NR_pivot_root 41 | |
| 41 | #define __NR_nfsservctl 42 | |
| 42 | #define __NR_statfs64 43 | |
| 43 | #define __NR_fstatfs64 44 | |
| 44 | #define __NR_truncate64 45 | |
| 45 | #define __NR_ftruncate64 46 | |
| 46 | #define __NR_fallocate 47 | |
| 47 | #define __NR_faccessat 48 | |
| 48 | #define __NR_chdir 49 | |
| 49 | #define __NR_fchdir 50 | |
| 50 | #define __NR_chroot 51 | |
| 51 | #define __NR_fchmod 52 | |
| 52 | #define __NR_fchmodat 53 | |
| 53 | #define __NR_fchownat 54 | |
| 54 | #define __NR_fchown 55 | |
| 55 | #define __NR_openat 56 | |
| 56 | #define __NR_close 57 | |
| 57 | #define __NR_vhangup 58 | |
| 58 | #define __NR_pipe2 59 | |
| 59 | #define __NR_quotactl 60 | |
| 60 | #define __NR_getdents64 61 | |
| 61 | #define __NR__llseek 62 | |
| 62 | #define __NR_read 63 | |
| 63 | #define __NR_write 64 | |
| 64 | #define __NR_readv 65 | |
| 65 | #define __NR_writev 66 | |
| 66 | #define __NR_pread64 67 | |
| 67 | #define __NR_pwrite64 68 | |
| 68 | #define __NR_preadv 69 | |
| 69 | #define __NR_pwritev 70 | |
| 70 | #define __NR_sendfile64 71 | |
| 71 | #define __NR_signalfd4 74 | |
| 72 | #define __NR_vmsplice 75 | |
| 73 | #define __NR_splice 76 | |
| 74 | #define __NR_tee 77 | |
| 75 | #define __NR_readlinkat 78 | |
| 76 | #define __NR_sync 81 | |
| 77 | #define __NR_fsync 82 | |
| 78 | #define __NR_fdatasync 83 | |
| 79 | #define __NR_sync_file_range 84 | |
| 80 | #define __NR_timerfd_create 85 | |
| 81 | #define __NR_acct 89 | |
| 82 | #define __NR_capget 90 | |
| 83 | #define __NR_capset 91 | |
| 84 | #define __NR_personality 92 | |
| 85 | #define __NR_exit 93 | |
| 86 | #define __NR_exit_group 94 | |
| 87 | #define __NR_waitid 95 | |
| 88 | #define __NR_set_tid_address 96 | |
| 89 | #define __NR_unshare 97 | |
| 90 | #define __NR_set_robust_list 99 | |
| 91 | #define __NR_get_robust_list 100 | |
| 92 | #define __NR_nanosleep 101 | |
| 93 | #define __NR_getitimer 102 | |
| 94 | #define __NR_setitimer 103 | |
| 95 | #define __NR_kexec_load 104 | |
| 96 | #define __NR_init_module 105 | |
| 97 | #define __NR_delete_module 106 | |
| 98 | #define __NR_timer_create 107 | |
| 99 | #define __NR_timer_getoverrun 109 | |
| 100 | #define __NR_timer_delete 111 | |
| 101 | #define __NR_syslog 116 | |
| 102 | #define __NR_ptrace 117 | |
| 103 | #define __NR_sched_setparam 118 | |
| 104 | #define __NR_sched_setscheduler 119 | |
| 105 | #define __NR_sched_getscheduler 120 | |
| 106 | #define __NR_sched_getparam 121 | |
| 107 | #define __NR_sched_setaffinity 122 | |
| 108 | #define __NR_sched_getaffinity 123 | |
| 109 | #define __NR_sched_yield 124 | |
| 110 | #define __NR_sched_get_priority_max 125 | |
| 111 | #define __NR_sched_get_priority_min 126 | |
| 112 | #define __NR_restart_syscall 128 | |
| 113 | #define __NR_kill 129 | |
| 114 | #define __NR_tkill 130 | |
| 115 | #define __NR_tgkill 131 | |
| 116 | #define __NR_sigaltstack 132 | |
| 117 | #define __NR_rt_sigsuspend 133 | |
| 118 | #define __NR_rt_sigaction 134 | |
| 119 | #define __NR_rt_sigprocmask 135 | |
| 120 | #define __NR_rt_sigpending 136 | |
| 121 | #define __NR_rt_sigqueueinfo 138 | |
| 122 | #define __NR_rt_sigreturn 139 | |
| 123 | #define __NR_setpriority 140 | |
| 124 | #define __NR_getpriority 141 | |
| 125 | #define __NR_reboot 142 | |
| 126 | #define __NR_setregid 143 | |
| 127 | #define __NR_setgid 144 | |
| 128 | #define __NR_setreuid 145 | |
| 129 | #define __NR_setuid 146 | |
| 130 | #define __NR_setresuid 147 | |
| 131 | #define __NR_getresuid 148 | |
| 132 | #define __NR_setresgid 149 | |
| 133 | #define __NR_getresgid 150 | |
| 134 | #define __NR_setfsuid 151 | |
| 135 | #define __NR_setfsgid 152 | |
| 136 | #define __NR_times 153 | |
| 137 | #define __NR_setpgid 154 | |
| 138 | #define __NR_getpgid 155 | |
| 139 | #define __NR_getsid 156 | |
| 140 | #define __NR_setsid 157 | |
| 141 | #define __NR_getgroups 158 | |
| 142 | #define __NR_setgroups 159 | |
| 143 | #define __NR_uname 160 | |
| 144 | #define __NR_sethostname 161 | |
| 145 | #define __NR_setdomainname 162 | |
| 146 | #define __NR_getrusage 165 | |
| 147 | #define __NR_umask 166 | |
| 148 | #define __NR_prctl 167 | |
| 149 | #define __NR_getcpu 168 | |
| 150 | #define __NR_getpid 172 | |
| 151 | #define __NR_getppid 173 | |
| 152 | #define __NR_getuid 174 | |
| 153 | #define __NR_geteuid 175 | |
| 154 | #define __NR_getgid 176 | |
| 155 | #define __NR_getegid 177 | |
| 156 | #define __NR_gettid 178 | |
| 157 | #define __NR_sysinfo 179 | |
| 158 | #define __NR_mq_open 180 | |
| 159 | #define __NR_mq_unlink 181 | |
| 160 | #define __NR_mq_notify 184 | |
| 161 | #define __NR_mq_getsetattr 185 | |
| 162 | #define __NR_msgget 186 | |
| 163 | #define __NR_msgctl 187 | |
| 164 | #define __NR_msgrcv 188 | |
| 165 | #define __NR_msgsnd 189 | |
| 166 | #define __NR_semget 190 | |
| 167 | #define __NR_semctl 191 | |
| 168 | #define __NR_semop 193 | |
| 169 | #define __NR_shmget 194 | |
| 170 | #define __NR_shmctl 195 | |
| 171 | #define __NR_shmat 196 | |
| 172 | #define __NR_shmdt 197 | |
| 173 | #define __NR_socket 198 | |
| 174 | #define __NR_socketpair 199 | |
| 175 | #define __NR_bind 200 | |
| 176 | #define __NR_listen 201 | |
| 177 | #define __NR_accept 202 | |
| 178 | #define __NR_connect 203 | |
| 179 | #define __NR_getsockname 204 | |
| 180 | #define __NR_getpeername 205 | |
| 181 | #define __NR_sendto 206 | |
| 182 | #define __NR_recvfrom 207 | |
| 183 | #define __NR_setsockopt 208 | |
| 184 | #define __NR_getsockopt 209 | |
| 185 | #define __NR_shutdown 210 | |
| 186 | #define __NR_sendmsg 211 | |
| 187 | #define __NR_recvmsg 212 | |
| 188 | #define __NR_readahead 213 | |
| 189 | #define __NR_brk 214 | |
| 190 | #define __NR_munmap 215 | |
| 191 | #define __NR_mremap 216 | |
| 192 | #define __NR_add_key 217 | |
| 193 | #define __NR_request_key 218 | |
| 194 | #define __NR_keyctl 219 | |
| 195 | #define __NR_clone 220 | |
| 196 | #define __NR_execve 221 | |
| 197 | #define __NR_mmap2 222 | |
| 198 | #define __NR_fadvise64_64 223 | |
| 199 | #define __NR_swapon 224 | |
| 200 | #define __NR_swapoff 225 | |
| 201 | #define __NR_mprotect 226 | |
| 202 | #define __NR_msync 227 | |
| 203 | #define __NR_mlock 228 | |
| 204 | #define __NR_munlock 229 | |
| 205 | #define __NR_mlockall 230 | |
| 206 | #define __NR_munlockall 231 | |
| 207 | #define __NR_mincore 232 | |
| 208 | #define __NR_madvise 233 | |
| 209 | #define __NR_remap_file_pages 234 | |
| 210 | #define __NR_mbind 235 | |
| 211 | #define __NR_get_mempolicy 236 | |
| 212 | #define __NR_set_mempolicy 237 | |
| 213 | #define __NR_migrate_pages 238 | |
| 214 | #define __NR_move_pages 239 | |
| 215 | #define __NR_rt_tgsigqueueinfo 240 | |
| 216 | #define __NR_perf_event_open 241 | |
| 217 | #define __NR_accept4 242 | |
| 218 | #define __NR_arch_specific_syscall 244 | |
| 219 | #define __NR_prlimit64 261 | |
| 220 | #define __NR_fanotify_init 262 | |
| 221 | #define __NR_fanotify_mark 263 | |
| 222 | #define __NR_name_to_handle_at 264 | |
| 223 | #define __NR_open_by_handle_at 265 | |
| 224 | #define __NR_syncfs 267 | |
| 225 | #define __NR_setns 268 | |
| 226 | #define __NR_sendmmsg 269 | |
| 227 | #define __NR_process_vm_readv 270 | |
| 228 | #define __NR_process_vm_writev 271 | |
| 229 | #define __NR_kcmp 272 | |
| 230 | #define __NR_finit_module 273 | |
| 231 | #define __NR_sched_setattr 274 | |
| 232 | #define __NR_sched_getattr 275 | |
| 233 | #define __NR_renameat2 276 | |
| 234 | #define __NR_seccomp 277 | |
| 235 | #define __NR_getrandom 278 | |
| 236 | #define __NR_memfd_create 279 | |
| 237 | #define __NR_bpf 280 | |
| 238 | #define __NR_execveat 281 | |
| 239 | #define __NR_userfaultfd 282 | |
| 240 | #define __NR_membarrier 283 | |
| 241 | #define __NR_mlock2 284 | |
| 242 | #define __NR_copy_file_range 285 | |
| 243 | #define __NR_preadv2 286 | |
| 244 | #define __NR_pwritev2 287 | |
| 245 | #define __NR_pkey_mprotect 288 | |
| 246 | #define __NR_pkey_alloc 289 | |
| 247 | #define __NR_pkey_free 290 | |
| 248 | #define __NR_statx 291 | |
| 249 | #define __NR_rseq 293 | |
| 250 | #define __NR_kexec_file_load 294 | |
| 251 | #define __NR_clock_gettime64		403 | |
| 252 | #define __NR_clock_settime64		404 | |
| 253 | #define __NR_clock_adjtime64		405 | |
| 254 | #define __NR_clock_getres_time64	406 | |
| 255 | #define __NR_clock_nanosleep_time64	407 | |
| 256 | #define __NR_timer_gettime64		408 | |
| 257 | #define __NR_timer_settime64		409 | |
| 258 | #define __NR_timerfd_gettime64		410 | |
| 259 | #define __NR_timerfd_settime64		411 | |
| 260 | #define __NR_utimensat_time64		412 | |
| 261 | #define __NR_pselect6_time64		413 | |
| 262 | #define __NR_ppoll_time64		414 | |
| 263 | #define __NR_io_pgetevents_time64	416 | |
| 264 | #define __NR_recvmmsg_time64		417 | |
| 265 | #define __NR_mq_timedsend_time64	418 | |
| 266 | #define __NR_mq_timedreceive_time64	419 | |
| 267 | #define __NR_semtimedop_time64		420 | |
| 268 | #define __NR_rt_sigtimedwait_time64	421 | |
| 269 | #define __NR_futex_time64		422 | |
| 270 | #define __NR_sched_rr_get_interval_time64 423 | |
| 271 | #define __NR_pidfd_send_signal 424 | |
| 272 | #define __NR_io_uring_setup 425 | |
| 273 | #define __NR_io_uring_enter 426 | |
| 274 | #define __NR_io_uring_register 427 | |
| 275 | #define __NR_open_tree		428 | |
| 276 | #define __NR_move_mount		429 | |
| 277 | #define __NR_fsopen		430 | |
| 278 | #define __NR_fsconfig		431 | |
| 279 | #define __NR_fsmount		432 | |
| 280 | #define __NR_fspick		433 | |
| 281 | #define __NR_pidfd_open		434 | |
| 282 | #define __NR_clone3		435 | |
| 283 | #define __NR_openat2		437 | |
| 284 | #define __NR_pidfd_getfd	438 | |
| 285 | #define __NR_faccessat2		439 | |
| 286 | #define __NR_process_madvise	440 | |
| 287 | #define __NR_epoll_pwait2	441 | |
| 288 | #define __NR_mount_setattr	442 | |
| 289 | #define __NR_landlock_create_ruleset	444 | |
| 290 | #define __NR_landlock_add_rule	445 | |
| 291 | #define __NR_landlock_restrict_self	446 | |
| 292 | #define __NR_process_mrelease	448 | |
| 293 | #define __NR_futex_waitv	449 | |
| 294 | #define __NR_set_mempolicy_home_node	450 | |
| 295 | #define __NR_cachestat		451 | |
| 296 | #define __NR_fchmodat2		452 | |
| 297 | #define __NR_futex __NR_futex_time64 | |
| 298 | ||
| 299 | #define __NR_sysriscv __NR_arch_specific_syscall | |
| 300 | #define __NR_riscv_flush_icache (__NR_sysriscv + 15) |
lib/libc/musl/arch/riscv32/bits/user.h created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | #include <signal.h> | |
| 2 | ||
| 3 | #define ELF_NGREG 32 | |
| 4 | #define ELF_NFPREG 33 | |
| 5 | typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; | |
| 6 | typedef union __riscv_mc_fp_state elf_fpregset_t; |
lib/libc/musl/arch/riscv32/crt_arch.h created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | __asm__( | |
| 2 | ".section .sdata,\"aw\"\n" | |
| 3 | ".text\n" | |
| 4 | ".global " START "\n" | |
| 5 | ".type " START ",%function\n" | |
| 6 | START ":\n" | |
| 7 | ".weak __global_pointer$\n" | |
| 8 | ".hidden __global_pointer$\n" | |
| 9 | ".option push\n" | |
| 10 | ".option norelax\n\t" | |
| 11 | "lla gp, __global_pointer$\n" | |
| 12 | ".option pop\n\t" | |
| 13 | "mv a0, sp\n" | |
| 14 | ".weak _DYNAMIC\n" | |
| 15 | ".hidden _DYNAMIC\n\t" | |
| 16 | "lla a1, _DYNAMIC\n\t" | |
| 17 | "andi sp, sp, -16\n\t" | |
| 18 | "tail " START "_c" | |
| 19 | ); |
lib/libc/musl/arch/riscv32/kstat.h createdlib/libc/musl/arch/riscv32/pthread_arch.h created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | static inline uintptr_t __get_tp() | |
| 2 | { | |
| 3 | 	uintptr_t tp; | |
| 4 | 	__asm__ __volatile__("mv %0, tp" : "=r"(tp)); | |
| 5 | 	return tp; | |
| 6 | } | |
| 7 | ||
| 8 | #define TLS_ABOVE_TP | |
| 9 | #define GAP_ABOVE_TP 0 | |
| 10 | ||
| 11 | #define DTP_OFFSET 0x800 | |
| 12 | ||
| 13 | #define MC_PC __gregs[0] |
lib/libc/musl/arch/riscv32/reloc.h created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | #if defined __riscv_float_abi_soft | |
| 2 | #define RISCV_FP_SUFFIX "-sf" | |
| 3 | #elif defined __riscv_float_abi_single | |
| 4 | #define RISCV_FP_SUFFIX "-sp" | |
| 5 | #elif defined __riscv_float_abi_double | |
| 6 | #define RISCV_FP_SUFFIX "" | |
| 7 | #endif | |
| 8 | ||
| 9 | #define LDSO_ARCH "riscv32" RISCV_FP_SUFFIX | |
| 10 | ||
| 11 | #define TPOFF_K 0 | |
| 12 | ||
| 13 | #define REL_SYMBOLIC R_RISCV_32 | |
| 14 | #define REL_PLT R_RISCV_JUMP_SLOT | |
| 15 | #define REL_RELATIVE R_RISCV_RELATIVE | |
| 16 | #define REL_COPY R_RISCV_COPY | |
| 17 | #define REL_DTPMOD R_RISCV_TLS_DTPMOD32 | |
| 18 | #define REL_DTPOFF R_RISCV_TLS_DTPREL32 | |
| 19 | #define REL_TPOFF R_RISCV_TLS_TPREL32 | |
| 20 | ||
| 21 | #define CRTJMP(pc,sp) __asm__ __volatile__( \ | |
| 22 | 	"mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) |
lib/libc/musl/arch/riscv32/syscall_arch.h created+80| ... | ... | @@ -0,0 +1,80 @@ |
| 1 | #define __SYSCALL_LL_E(x) \ | |
| 2 | ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ | |
| 3 | ((union { long long ll; long l[2]; }){ .ll = x }).l[1] | |
| 4 | #define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) | |
| 5 | ||
| 6 | #define __asm_syscall(...) \ | |
| 7 | 	__asm__ __volatile__ ("ecall\n\t" \ | |
| 8 | 	: "=r"(a0) : __VA_ARGS__ : "memory"); \ | |
| 9 | 	return a0; \ | |
| 10 | ||
| 11 | static inline long __syscall0(long n) | |
| 12 | { | |
| 13 | 	register long a7 __asm__("a7") = n; | |
| 14 | 	register long a0 __asm__("a0"); | |
| 15 | 	__asm_syscall("r"(a7)) | |
| 16 | } | |
| 17 | ||
| 18 | static inline long __syscall1(long n, long a) | |
| 19 | { | |
| 20 | 	register long a7 __asm__("a7") = n; | |
| 21 | 	register long a0 __asm__("a0") = a; | |
| 22 | 	__asm_syscall("r"(a7), "0"(a0)) | |
| 23 | } | |
| 24 | ||
| 25 | static inline long __syscall2(long n, long a, long b) | |
| 26 | { | |
| 27 | 	register long a7 __asm__("a7") = n; | |
| 28 | 	register long a0 __asm__("a0") = a; | |
| 29 | 	register long a1 __asm__("a1") = b; | |
| 30 | 	__asm_syscall("r"(a7), "0"(a0), "r"(a1)) | |
| 31 | } | |
| 32 | ||
| 33 | static inline long __syscall3(long n, long a, long b, long c) | |
| 34 | { | |
| 35 | 	register long a7 __asm__("a7") = n; | |
| 36 | 	register long a0 __asm__("a0") = a; | |
| 37 | 	register long a1 __asm__("a1") = b; | |
| 38 | 	register long a2 __asm__("a2") = c; | |
| 39 | 	__asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2)) | |
| 40 | } | |
| 41 | ||
| 42 | static inline long __syscall4(long n, long a, long b, long c, long d) | |
| 43 | { | |
| 44 | 	register long a7 __asm__("a7") = n; | |
| 45 | 	register long a0 __asm__("a0") = a; | |
| 46 | 	register long a1 __asm__("a1") = b; | |
| 47 | 	register long a2 __asm__("a2") = c; | |
| 48 | 	register long a3 __asm__("a3") = d; | |
| 49 | 	__asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3)) | |
| 50 | } | |
| 51 | ||
| 52 | static inline long __syscall5(long n, long a, long b, long c, long d, long e) | |
| 53 | { | |
| 54 | 	register long a7 __asm__("a7") = n; | |
| 55 | 	register long a0 __asm__("a0") = a; | |
| 56 | 	register long a1 __asm__("a1") = b; | |
| 57 | 	register long a2 __asm__("a2") = c; | |
| 58 | 	register long a3 __asm__("a3") = d; | |
| 59 | 	register long a4 __asm__("a4") = e; | |
| 60 | 	__asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4)) | |
| 61 | } | |
| 62 | ||
| 63 | static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) | |
| 64 | { | |
| 65 | 	register long a7 __asm__("a7") = n; | |
| 66 | 	register long a0 __asm__("a0") = a; | |
| 67 | 	register long a1 __asm__("a1") = b; | |
| 68 | 	register long a2 __asm__("a2") = c; | |
| 69 | 	register long a3 __asm__("a3") = d; | |
| 70 | 	register long a4 __asm__("a4") = e; | |
| 71 | 	register long a5 __asm__("a5") = f; | |
| 72 | 	__asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5)) | |
| 73 | } | |
| 74 | ||
| 75 | #define VDSO_USEFUL | |
| 76 | /* We don't have a clock_gettime function. | |
| 77 | #define VDSO_CGT_SYM "__vdso_clock_gettime" | |
| 78 | #define VDSO_CGT_VER "LINUX_2.6" */ | |
| 79 | ||
| 80 | #define IPC_64 0 |
lib/libc/musl/arch/riscv64/bits/signal.h+2| ... | ... | @@ -41,7 +41,9 @@ typedef struct mcontext_t { |
| 41 | 41 | #define REG_SP 2 |
| 42 | 42 | #define REG_TP 4 |
| 43 | 43 | #define REG_S0 8 |
| 44 | #define REG_S1 9 | |
| 44 | 45 | #define REG_A0 10 |
| 46 | #define REG_S2 18 | |
| 45 | 47 | #endif |
| 46 | 48 | |
| 47 | 49 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
lib/libc/musl/arch/riscv64/bits/syscall.h.in+5| ... | ... | @@ -299,6 +299,11 @@ |
| 299 | 299 | #define __NR_landlock_create_ruleset	444 |
| 300 | 300 | #define __NR_landlock_add_rule	445 |
| 301 | 301 | #define __NR_landlock_restrict_self	446 |
| 302 | #define __NR_process_mrelease	448 | |
| 303 | #define __NR_futex_waitv	449 | |
| 304 | #define __NR_set_mempolicy_home_node	450 | |
| 305 | #define __NR_cachestat		451 | |
| 306 | #define __NR_fchmodat2		452 | |
| 302 | 307 | |
| 303 | 308 | #define __NR_sysriscv __NR_arch_specific_syscall |
| 304 | 309 | #define __NR_riscv_flush_icache (__NR_sysriscv + 15) |
lib/libc/musl/arch/riscv64/reloc.h+1| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | #define REL_DTPMOD R_RISCV_TLS_DTPMOD64 |
| 18 | 18 | #define REL_DTPOFF R_RISCV_TLS_DTPREL64 |
| 19 | 19 | #define REL_TPOFF R_RISCV_TLS_TPREL64 |
| 20 | #define REL_TLSDESC R_RISCV_TLSDESC | |
| 20 | 21 | |
| 21 | 22 | #define CRTJMP(pc,sp) __asm__ __volatile__( \ |
| 22 | 23 | 	"mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) |
lib/libc/musl/arch/s390x/bits/syscall.h.in+6| ... | ... | @@ -362,4 +362,10 @@ |
| 362 | 362 | #define __NR_landlock_create_ruleset	444 |
| 363 | 363 | #define __NR_landlock_add_rule	445 |
| 364 | 364 | #define __NR_landlock_restrict_self	446 |
| 365 | #define __NR_memfd_secret	447 | |
| 366 | #define __NR_process_mrelease	448 | |
| 367 | #define __NR_futex_waitv	449 | |
| 368 | #define __NR_set_mempolicy_home_node	450 | |
| 369 | #define __NR_cachestat		451 | |
| 370 | #define __NR_fchmodat2		452 | |
| 365 | 371 |
lib/libc/musl/arch/x86_64/bits/syscall.h.in+6| ... | ... | @@ -355,4 +355,10 @@ |
| 355 | 355 | #define __NR_landlock_create_ruleset	444 |
| 356 | 356 | #define __NR_landlock_add_rule	445 |
| 357 | 357 | #define __NR_landlock_restrict_self	446 |
| 358 | #define __NR_memfd_secret	447 | |
| 359 | #define __NR_process_mrelease	448 | |
| 360 | #define __NR_futex_waitv	449 | |
| 361 | #define __NR_set_mempolicy_home_node	450 | |
| 362 | #define __NR_cachestat		451 | |
| 363 | #define __NR_fchmodat2		452 | |
| 358 | 364 |
lib/libc/musl/include/elf.h+120-7| ... | ... | @@ -315,7 +315,8 @@ typedef struct { |
| 315 | 315 | #define EM_RISCV	243 |
| 316 | 316 | #define EM_BPF		247 |
| 317 | 317 | #define EM_CSKY		252 |
| 318 | #define EM_NUM		253 | |
| 318 | #define EM_LOONGARCH	258 | |
| 319 | #define EM_NUM		259 | |
| 319 | 320 | |
| 320 | 321 | #define EM_ALPHA	0x9026 |
| 321 | 322 | |
| ... | ... | @@ -558,6 +559,11 @@ typedef struct { |
| 558 | 559 | |
| 559 | 560 | |
| 560 | 561 | |
| 562 | typedef Elf32_Word Elf32_Relr; | |
| 563 | typedef Elf64_Xword Elf64_Relr; | |
| 564 | ||
| 565 | ||
| 566 | ||
| 561 | 567 | #define ELF32_R_SYM(val)		((val) >> 8) |
| 562 | 568 | #define ELF32_R_TYPE(val)		((val) & 0xff) |
| 563 | 569 | #define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff)) |
| ... | ... | @@ -698,7 +704,14 @@ typedef struct { |
| 698 | 704 | #define NT_MIPS_DSP	0x800 |
| 699 | 705 | #define NT_MIPS_FP_MODE	0x801 |
| 700 | 706 | #define NT_MIPS_MSA	0x802 |
| 707 | #define NT_RISCV_CSR	0x900 | |
| 708 | #define NT_RISCV_VECTOR	0x901 | |
| 701 | 709 | #define NT_VERSION	1 |
| 710 | #define NT_LOONGARCH_CPUCFG	0xa00 | |
| 711 | #define NT_LOONGARCH_CSR	0xa01 | |
| 712 | #define NT_LOONGARCH_LSX	0xa02 | |
| 713 | #define NT_LOONGARCH_LASX	0xa03 | |
| 714 | #define NT_LOONGARCH_LBT	0xa04 | |
| 702 | 715 | |
| 703 | 716 | |
| 704 | 717 | |
| ... | ... | @@ -3249,6 +3262,7 @@ enum |
| 3249 | 3262 | #define R_RISCV_TLS_DTPREL64 9 |
| 3250 | 3263 | #define R_RISCV_TLS_TPREL32 10 |
| 3251 | 3264 | #define R_RISCV_TLS_TPREL64 11 |
| 3265 | #define R_RISCV_TLSDESC 12 | |
| 3252 | 3266 | |
| 3253 | 3267 | #define R_RISCV_BRANCH 16 |
| 3254 | 3268 | #define R_RISCV_JAL 17 |
| ... | ... | @@ -3275,16 +3289,11 @@ enum |
| 3275 | 3289 | #define R_RISCV_SUB16 38 |
| 3276 | 3290 | #define R_RISCV_SUB32 39 |
| 3277 | 3291 | #define R_RISCV_SUB64 40 |
| 3278 | #define R_RISCV_GNU_VTINHERIT 41 | |
| 3279 | #define R_RISCV_GNU_VTENTRY 42 | |
| 3292 | #define R_RISCV_GOT32_PCREL 41 | |
| 3280 | 3293 | #define R_RISCV_ALIGN 43 |
| 3281 | 3294 | #define R_RISCV_RVC_BRANCH 44 |
| 3282 | 3295 | #define R_RISCV_RVC_JUMP 45 |
| 3283 | 3296 | #define R_RISCV_RVC_LUI 46 |
| 3284 | #define R_RISCV_GPREL_I 47 | |
| 3285 | #define R_RISCV_GPREL_S 48 | |
| 3286 | #define R_RISCV_TPREL_I 49 | |
| 3287 | #define R_RISCV_TPREL_S 50 | |
| 3288 | 3297 | #define R_RISCV_RELAX 51 |
| 3289 | 3298 | #define R_RISCV_SUB6 52 |
| 3290 | 3299 | #define R_RISCV_SET6 53 |
| ... | ... | @@ -3292,6 +3301,110 @@ enum |
| 3292 | 3301 | #define R_RISCV_SET16 55 |
| 3293 | 3302 | #define R_RISCV_SET32 56 |
| 3294 | 3303 | #define R_RISCV_32_PCREL 57 |
| 3304 | #define R_RISCV_IRELATIVE 58 | |
| 3305 | #define R_RISCV_PLT32 59 | |
| 3306 | #define R_RISCV_SET_ULEB128 60 | |
| 3307 | #define R_RISCV_SUB_ULEB128 61 | |
| 3308 | #define R_RISCV_TLSDESC_HI20 62 | |
| 3309 | #define R_RISCV_TLSDESC_LOAD_LO12 63 | |
| 3310 | #define R_RISCV_TLSDESC_ADD_LO12 64 | |
| 3311 | #define R_RISCV_TLSDESC_CALL 65 | |
| 3312 | ||
| 3313 | #define EF_LARCH_ABI_MODIFIER_MASK 0x07 | |
| 3314 | #define EF_LARCH_ABI_SOFT_FLOAT 0x01 | |
| 3315 | #define EF_LARCH_ABI_SINGLE_FLOAT 0x02 | |
| 3316 | #define EF_LARCH_ABI_DOUBLE_FLOAT 0x03 | |
| 3317 | #define EF_LARCH_OBJABI_V1 0x40 | |
| 3318 | ||
| 3319 | #define R_LARCH_NONE 0 | |
| 3320 | #define R_LARCH_32 1 | |
| 3321 | #define R_LARCH_64 2 | |
| 3322 | #define R_LARCH_RELATIVE 3 | |
| 3323 | #define R_LARCH_COPY 4 | |
| 3324 | #define R_LARCH_JUMP_SLOT 5 | |
| 3325 | #define R_LARCH_TLS_DTPMOD32 6 | |
| 3326 | #define R_LARCH_TLS_DTPMOD64 7 | |
| 3327 | #define R_LARCH_TLS_DTPREL32 8 | |
| 3328 | #define R_LARCH_TLS_DTPREL64 9 | |
| 3329 | #define R_LARCH_TLS_TPREL32 10 | |
| 3330 | #define R_LARCH_TLS_TPREL64 11 | |
| 3331 | #define R_LARCH_IRELATIVE 12 | |
| 3332 | #define R_LARCH_MARK_LA 20 | |
| 3333 | #define R_LARCH_MARK_PCREL 21 | |
| 3334 | #define R_LARCH_SOP_PUSH_PCREL 22 | |
| 3335 | #define R_LARCH_SOP_PUSH_ABSOLUTE 23 | |
| 3336 | #define R_LARCH_SOP_PUSH_DUP 24 | |
| 3337 | #define R_LARCH_SOP_PUSH_GPREL 25 | |
| 3338 | #define R_LARCH_SOP_PUSH_TLS_TPREL 26 | |
| 3339 | #define R_LARCH_SOP_PUSH_TLS_GOT 27 | |
| 3340 | #define R_LARCH_SOP_PUSH_TLS_GD 28 | |
| 3341 | #define R_LARCH_SOP_PUSH_PLT_PCREL 29 | |
| 3342 | #define R_LARCH_SOP_ASSERT 30 | |
| 3343 | #define R_LARCH_SOP_NOT 31 | |
| 3344 | #define R_LARCH_SOP_SUB 32 | |
| 3345 | #define R_LARCH_SOP_SL 33 | |
| 3346 | #define R_LARCH_SOP_SR 34 | |
| 3347 | #define R_LARCH_SOP_ADD 35 | |
| 3348 | #define R_LARCH_SOP_AND 36 | |
| 3349 | #define R_LARCH_SOP_IF_ELSE 37 | |
| 3350 | #define R_LARCH_SOP_POP_32_S_10_5 38 | |
| 3351 | #define R_LARCH_SOP_POP_32_U_10_12 39 | |
| 3352 | #define R_LARCH_SOP_POP_32_S_10_12 40 | |
| 3353 | #define R_LARCH_SOP_POP_32_S_10_16 41 | |
| 3354 | #define R_LARCH_SOP_POP_32_S_10_16_S2 42 | |
| 3355 | #define R_LARCH_SOP_POP_32_S_5_20 43 | |
| 3356 | #define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44 | |
| 3357 | #define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45 | |
| 3358 | #define R_LARCH_SOP_POP_32_U 46 | |
| 3359 | #define R_LARCH_ADD8 47 | |
| 3360 | #define R_LARCH_ADD16 48 | |
| 3361 | #define R_LARCH_ADD24 49 | |
| 3362 | #define R_LARCH_ADD32 50 | |
| 3363 | #define R_LARCH_ADD64 51 | |
| 3364 | #define R_LARCH_SUB8 52 | |
| 3365 | #define R_LARCH_SUB16 53 | |
| 3366 | #define R_LARCH_SUB24 54 | |
| 3367 | #define R_LARCH_SUB32 55 | |
| 3368 | #define R_LARCH_SUB64 56 | |
| 3369 | #define R_LARCH_GNU_VTINHERIT 57 | |
| 3370 | #define R_LARCH_GNU_VTENTRY 58 | |
| 3371 | #define R_LARCH_B16 64 | |
| 3372 | #define R_LARCH_B21 65 | |
| 3373 | #define R_LARCH_B26 66 | |
| 3374 | #define R_LARCH_ABS_HI20 67 | |
| 3375 | #define R_LARCH_ABS_LO12 68 | |
| 3376 | #define R_LARCH_ABS64_LO20 69 | |
| 3377 | #define R_LARCH_ABS64_HI12 70 | |
| 3378 | #define R_LARCH_PCALA_HI20 71 | |
| 3379 | #define R_LARCH_PCALA_LO12 72 | |
| 3380 | #define R_LARCH_PCALA64_LO20 73 | |
| 3381 | #define R_LARCH_PCALA64_HI12 74 | |
| 3382 | #define R_LARCH_GOT_PC_HI20 75 | |
| 3383 | #define R_LARCH_GOT_PC_LO12 76 | |
| 3384 | #define R_LARCH_GOT64_PC_LO20 77 | |
| 3385 | #define R_LARCH_GOT64_PC_HI12 78 | |
| 3386 | #define R_LARCH_GOT_HI20 79 | |
| 3387 | #define R_LARCH_GOT_LO12 80 | |
| 3388 | #define R_LARCH_GOT64_LO20 81 | |
| 3389 | #define R_LARCH_GOT64_HI12 82 | |
| 3390 | #define R_LARCH_TLS_LE_HI20 83 | |
| 3391 | #define R_LARCH_TLS_LE_LO12 84 | |
| 3392 | #define R_LARCH_TLS_LE64_LO20 85 | |
| 3393 | #define R_LARCH_TLS_LE64_HI12 86 | |
| 3394 | #define R_LARCH_TLS_IE_PC_HI20 87 | |
| 3395 | #define R_LARCH_TLS_IE_PC_LO12 88 | |
| 3396 | #define R_LARCH_TLS_IE64_PC_LO20 89 | |
| 3397 | #define R_LARCH_TLS_IE64_PC_HI12 90 | |
| 3398 | #define R_LARCH_TLS_IE_HI20 91 | |
| 3399 | #define R_LARCH_TLS_IE_LO12 92 | |
| 3400 | #define R_LARCH_TLS_IE64_LO20 93 | |
| 3401 | #define R_LARCH_TLS_IE64_HI12 94 | |
| 3402 | #define R_LARCH_TLS_LD_PC_HI20 95 | |
| 3403 | #define R_LARCH_TLS_LD_HI20 96 | |
| 3404 | #define R_LARCH_TLS_GD_PC_HI20 97 | |
| 3405 | #define R_LARCH_TLS_GD_HI20 98 | |
| 3406 | #define R_LARCH_32_PCREL 99 | |
| 3407 | #define R_LARCH_RELAX 100 | |
| 3295 | 3408 | |
| 3296 | 3409 | #ifdef __cplusplus |
| 3297 | 3410 | } |
lib/libc/musl/include/fcntl.h+3-1| ... | ... | @@ -184,7 +184,6 @@ struct f_owner_ex { |
| 184 | 184 | #define SPLICE_F_MORE 4 |
| 185 | 185 | #define SPLICE_F_GIFT 8 |
| 186 | 186 | int fallocate(int, int, off_t, off_t); |
| 187 | #define fallocate64 fallocate | |
| 188 | 187 | int name_to_handle_at(int, const char *, struct file_handle *, int *, int); |
| 189 | 188 | int open_by_handle_at(int, struct file_handle *, int); |
| 190 | 189 | ssize_t readahead(int, off_t, size_t); |
| ... | ... | @@ -207,6 +206,9 @@ ssize_t tee(int, int, size_t, unsigned); |
| 207 | 206 | #define posix_fadvise64 posix_fadvise |
| 208 | 207 | #define posix_fallocate64 posix_fallocate |
| 209 | 208 | #define off64_t off_t |
| 209 | #if defined(_GNU_SOURCE) | |
| 210 | #define fallocate64 fallocate | |
| 211 | #endif | |
| 210 | 212 | #endif |
| 211 | 213 | |
| 212 | 214 | #ifdef __cplusplus |
lib/libc/musl/include/poll.h+2-2| ... | ... | @@ -36,7 +36,7 @@ struct pollfd { |
| 36 | 36 | |
| 37 | 37 | int poll (struct pollfd *, nfds_t, int); |
| 38 | 38 | |
| 39 | #ifdef _GNU_SOURCE | |
| 39 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 40 | 40 | #define __NEED_time_t |
| 41 | 41 | #define __NEED_struct_timespec |
| 42 | 42 | #define __NEED_sigset_t |
| ... | ... | @@ -45,7 +45,7 @@ int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *); |
| 45 | 45 | #endif |
| 46 | 46 | |
| 47 | 47 | #if _REDIR_TIME64 |
| 48 | #ifdef _GNU_SOURCE | |
| 48 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | |
| 49 | 49 | __REDIR(ppoll, __ppoll_time64); |
| 50 | 50 | #endif |
| 51 | 51 | #endif |
lib/libc/musl/include/stdc-predef.h+5| ... | ... | @@ -7,7 +7,12 @@ |
| 7 | 7 | #define __STDC_IEC_559__ 1 |
| 8 | 8 | #endif |
| 9 | 9 | |
| 10 | #if !defined(__STDC_UTF_16__) | |
| 10 | 11 | #define __STDC_UTF_16__ 1 |
| 12 | #endif | |
| 13 | ||
| 14 | #if !defined(__STDC_UTF_32__) | |
| 11 | 15 | #define __STDC_UTF_32__ 1 |
| 16 | #endif | |
| 12 | 17 | |
| 13 | 18 | #endif |
lib/libc/musl/include/string.h-3| ... | ... | @@ -95,9 +95,6 @@ char *strchrnul(const char *, int); |
| 95 | 95 | char *strcasestr(const char *, const char *); |
| 96 | 96 | void *memrchr(const void *, int, size_t); |
| 97 | 97 | void *mempcpy(void *, const void *, size_t); |
| 98 | #ifndef __cplusplus | |
| 99 | char *basename(); | |
| 100 | #endif | |
| 101 | 98 | #endif |
| 102 | 99 | |
| 103 | 100 | #ifdef __cplusplus |
lib/libc/musl/include/sys/stat.h+55| ... | ... | @@ -18,6 +18,13 @@ extern "C" { |
| 18 | 18 | #define __NEED_blkcnt_t |
| 19 | 19 | #define __NEED_struct_timespec |
| 20 | 20 | |
| 21 | #ifdef _GNU_SOURCE | |
| 22 | #define __NEED_int64_t | |
| 23 | #define __NEED_uint64_t | |
| 24 | #define __NEED_uint32_t | |
| 25 | #define __NEED_uint16_t | |
| 26 | #endif | |
| 27 | ||
| 21 | 28 | #include <bits/alltypes.h> |
| 22 | 29 | |
| 23 | 30 | #include <bits/stat.h> |
| ... | ... | @@ -98,6 +105,54 @@ int lchmod(const char *, mode_t); |
| 98 | 105 | #define S_IEXEC S_IXUSR |
| 99 | 106 | #endif |
| 100 | 107 | |
| 108 | #if defined(_GNU_SOURCE) | |
| 109 | #define STATX_TYPE 1U | |
| 110 | #define STATX_MODE 2U | |
| 111 | #define STATX_NLINK 4U | |
| 112 | #define STATX_UID 8U | |
| 113 | #define STATX_GID 0x10U | |
| 114 | #define STATX_ATIME 0x20U | |
| 115 | #define STATX_MTIME 0x40U | |
| 116 | #define STATX_CTIME 0x80U | |
| 117 | #define STATX_INO 0x100U | |
| 118 | #define STATX_SIZE 0x200U | |
| 119 | #define STATX_BLOCKS 0x400U | |
| 120 | #define STATX_BASIC_STATS 0x7ffU | |
| 121 | #define STATX_BTIME 0x800U | |
| 122 | #define STATX_ALL 0xfffU | |
| 123 | ||
| 124 | struct statx_timestamp { | |
| 125 | 	int64_t tv_sec; | |
| 126 | 	uint32_t tv_nsec, __pad; | |
| 127 | }; | |
| 128 | ||
| 129 | struct statx { | |
| 130 | 	uint32_t stx_mask; | |
| 131 | 	uint32_t stx_blksize; | |
| 132 | 	uint64_t stx_attributes; | |
| 133 | 	uint32_t stx_nlink; | |
| 134 | 	uint32_t stx_uid; | |
| 135 | 	uint32_t stx_gid; | |
| 136 | 	uint16_t stx_mode; | |
| 137 | 	uint16_t __pad0[1]; | |
| 138 | 	uint64_t stx_ino; | |
| 139 | 	uint64_t stx_size; | |
| 140 | 	uint64_t stx_blocks; | |
| 141 | 	uint64_t stx_attributes_mask; | |
| 142 | 	struct statx_timestamp stx_atime; | |
| 143 | 	struct statx_timestamp stx_btime; | |
| 144 | 	struct statx_timestamp stx_ctime; | |
| 145 | 	struct statx_timestamp stx_mtime; | |
| 146 | 	uint32_t stx_rdev_major; | |
| 147 | 	uint32_t stx_rdev_minor; | |
| 148 | 	uint32_t stx_dev_major; | |
| 149 | 	uint32_t stx_dev_minor; | |
| 150 | 	uint64_t __pad1[14]; | |
| 151 | }; | |
| 152 | ||
| 153 | int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict); | |
| 154 | #endif | |
| 155 | ||
| 101 | 156 | #if defined(_LARGEFILE64_SOURCE) |
| 102 | 157 | #define stat64 stat |
| 103 | 158 | #define fstat64 fstat |
lib/libc/musl/include/sys/statvfs.h+2-1| ... | ... | @@ -23,7 +23,8 @@ struct statvfs { |
| 23 | 23 | 	unsigned long f_fsid; |
| 24 | 24 | #endif |
| 25 | 25 | 	unsigned long f_flag, f_namemax; |
| 26 | 	int __reserved[6]; | |
| 26 | 	unsigned int f_type; | |
| 27 | 	int __reserved[5]; | |
| 27 | 28 | }; |
| 28 | 29 | |
| 29 | 30 | int statvfs (const char *__restrict, struct statvfs *__restrict); |
lib/libc/musl/include/sys/uio.h+7| ... | ... | @@ -39,6 +39,13 @@ ssize_t pwritev (int, const struct iovec *, int, off_t); |
| 39 | 39 | #ifdef _GNU_SOURCE |
| 40 | 40 | ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long); |
| 41 | 41 | ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long); |
| 42 | ssize_t preadv2 (int, const struct iovec *, int, off_t, int); | |
| 43 | ssize_t pwritev2 (int, const struct iovec *, int, off_t, int); | |
| 44 | #define RWF_HIPRI 0x00000001 | |
| 45 | #define RWF_DSYNC 0x00000002 | |
| 46 | #define RWF_SYNC 0x00000004 | |
| 47 | #define RWF_NOWAIT 0x00000008 | |
| 48 | #define RWF_APPEND 0x00000010 | |
| 42 | 49 | #endif |
| 43 | 50 | |
| 44 | 51 | #ifdef __cplusplus |
lib/libc/musl/src/fenv/loongarch64/fenv.S created+78| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | #ifndef __loongarch_soft_float | |
| 2 | ||
| 3 | #ifdef BROKEN_LOONGARCH_FCSR_ASM | |
| 4 | #define FCSR $r0 | |
| 5 | #else | |
| 6 | #define FCSR $fcsr0 | |
| 7 | #endif | |
| 8 | ||
| 9 | .global feclearexcept | |
| 10 | .type feclearexcept,@function | |
| 11 | feclearexcept: | |
| 12 | 	li.w $t0, 0x1f0000 | |
| 13 | 	and $a0, $a0, $t0 | |
| 14 | 	movfcsr2gr $t1, FCSR | |
| 15 | 	andn $t1, $t1, $a0 | |
| 16 | 	movgr2fcsr FCSR, $t1 | |
| 17 | 	li.w $a0, 0 | |
| 18 | 	jr $ra | |
| 19 | ||
| 20 | .global feraiseexcept | |
| 21 | .type feraiseexcept,@function | |
| 22 | feraiseexcept: | |
| 23 | 	li.w $t0, 0x1f0000 | |
| 24 | 	and $a0, $a0, $t0 | |
| 25 | 	movfcsr2gr $t1, FCSR | |
| 26 | 	or $t1, $t1, $a0 | |
| 27 | 	movgr2fcsr FCSR, $t1 | |
| 28 | 	li.w $a0, 0 | |
| 29 | 	jr $ra | |
| 30 | ||
| 31 | .global fetestexcept | |
| 32 | .type fetestexcept,@function | |
| 33 | fetestexcept: | |
| 34 | 	li.w $t0, 0x1f0000 | |
| 35 | 	and $a0, $a0, $t0 | |
| 36 | 	movfcsr2gr $t1, FCSR | |
| 37 | 	and $a0, $t1, $a0 | |
| 38 | 	jr $ra | |
| 39 | ||
| 40 | .global fegetround | |
| 41 | .type fegetround,@function | |
| 42 | fegetround: | |
| 43 | 	movfcsr2gr $t0, FCSR | |
| 44 | 	andi $a0, $t0, 0x300 | |
| 45 | 	jr $ra | |
| 46 | ||
| 47 | .global __fesetround | |
| 48 | .hidden __fesetround | |
| 49 | .type __fesetround,@function | |
| 50 | __fesetround: | |
| 51 | 	li.w $t0, 0x300 | |
| 52 | 	and $a0, $a0, $t0 | |
| 53 | 	movfcsr2gr $t1, FCSR | |
| 54 | 	andn $t1, $t1, $t0 | |
| 55 | 	or $t1, $t1, $a0 | |
| 56 | 	movgr2fcsr FCSR, $t1 | |
| 57 | 	li.w $a0, 0 | |
| 58 | 	jr $ra | |
| 59 | ||
| 60 | .global fegetenv | |
| 61 | .type fegetenv,@function | |
| 62 | fegetenv: | |
| 63 | 	movfcsr2gr $t0, FCSR | |
| 64 | 	st.w $t0, $a0, 0 | |
| 65 | 	li.w $a0, 0 | |
| 66 | 	jr $ra | |
| 67 | ||
| 68 | .global fesetenv | |
| 69 | .type fesetenv,@function | |
| 70 | fesetenv: | |
| 71 | 	addi.d $t0, $a0, 1 | |
| 72 | 	beq $t0, $r0, 1f | |
| 73 | 	ld.w $t0, $a0, 0 | |
| 74 | 1:	movgr2fcsr FCSR, $t0 | |
| 75 | 	li.w $a0, 0 | |
| 76 | 	jr $ra | |
| 77 | ||
| 78 | #endif |
lib/libc/musl/src/fenv/riscv32/fenv-sf.c created+3| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | #ifndef __riscv_flen | |
| 2 | #include "../fenv.c" | |
| 3 | #endif |
lib/libc/musl/src/fenv/riscv32/fenv.S created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | #ifdef __riscv_flen | |
| 2 | ||
| 3 | .global feclearexcept | |
| 4 | .type feclearexcept, %function | |
| 5 | feclearexcept: | |
| 6 | 	csrc fflags, a0 | |
| 7 | 	li a0, 0 | |
| 8 | 	ret | |
| 9 | ||
| 10 | .global feraiseexcept | |
| 11 | .type feraiseexcept, %function | |
| 12 | feraiseexcept: | |
| 13 | 	csrs fflags, a0 | |
| 14 | 	li a0, 0 | |
| 15 | 	ret | |
| 16 | ||
| 17 | .global fetestexcept | |
| 18 | .type fetestexcept, %function | |
| 19 | fetestexcept: | |
| 20 | 	frflags t0 | |
| 21 | 	and a0, t0, a0 | |
| 22 | 	ret | |
| 23 | ||
| 24 | .global fegetround | |
| 25 | .type fegetround, %function | |
| 26 | fegetround: | |
| 27 | 	frrm a0 | |
| 28 | 	ret | |
| 29 | ||
| 30 | .global __fesetround | |
| 31 | .type __fesetround, %function | |
| 32 | __fesetround: | |
| 33 | 	fsrm t0, a0 | |
| 34 | 	li a0, 0 | |
| 35 | 	ret | |
| 36 | ||
| 37 | .global fegetenv | |
| 38 | .type fegetenv, %function | |
| 39 | fegetenv: | |
| 40 | 	frcsr t0 | |
| 41 | 	sw t0, 0(a0) | |
| 42 | 	li a0, 0 | |
| 43 | 	ret | |
| 44 | ||
| 45 | .global fesetenv | |
| 46 | .type fesetenv, %function | |
| 47 | fesetenv: | |
| 48 | 	li t2, -1 | |
| 49 | 	li t1, 0 | |
| 50 | 	beq a0, t2, 1f | |
| 51 | 	lw t1, 0(a0) | |
| 52 | 1:	fscsr t1 | |
| 53 | 	li a0, 0 | |
| 54 | 	ret | |
| 55 | ||
| 56 | #endif |
lib/libc/musl/src/internal/dynlink.h+4| ... | ... | @@ -73,6 +73,10 @@ struct fdpic_dummy_loadmap { |
| 73 | 73 | #define DL_NOMMU_SUPPORT 0 |
| 74 | 74 | #endif |
| 75 | 75 | |
| 76 | #ifndef TLSDESC_BACKWARDS | |
| 77 | #define TLSDESC_BACKWARDS 0 | |
| 78 | #endif | |
| 79 | ||
| 76 | 80 | #if !DL_FDPIC |
| 77 | 81 | #define IS_RELATIVE(x,s) ( \ |
| 78 | 82 | 	(R_TYPE(x) == REL_RELATIVE) || \ |
lib/libc/musl/src/internal/emulate_wait4.c created+55| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | #include <sys/wait.h> | |
| 2 | #include "syscall.h" | |
| 3 | ||
| 4 | #ifndef SYS_wait4 | |
| 5 | hidden long __emulate_wait4(int pid, int *status, int options, void *kru, int cp) | |
| 6 | { | |
| 7 | 	idtype_t t; | |
| 8 | 	int r; | |
| 9 | 	siginfo_t info; | |
| 10 | ||
| 11 | 	info.si_pid = 0; | |
| 12 | 	if (pid < -1) { | |
| 13 | 		t = P_PGID; | |
| 14 | 		pid = -pid; | |
| 15 | 	} else if (pid == -1) { | |
| 16 | 		t = P_ALL; | |
| 17 | 	} else if (pid == 0) { | |
| 18 | 		t = P_PGID; | |
| 19 | 	} else { | |
| 20 | 		t = P_PID; | |
| 21 | 	} | |
| 22 | ||
| 23 | 	if (cp) r = __syscall_cp(SYS_waitid, t, pid, &info, options|WEXITED, kru); | |
| 24 | 	else r = __syscall(SYS_waitid, t, pid, &info, options|WEXITED, kru); | |
| 25 | ||
| 26 | 	if (r<0) return r; | |
| 27 | ||
| 28 | 	if (info.si_pid && status) { | |
| 29 | 		int sw=0; | |
| 30 | 		switch (info.si_code) { | |
| 31 | 		case CLD_CONTINUED: | |
| 32 | 			sw = 0xffff; | |
| 33 | 			break; | |
| 34 | 		case CLD_DUMPED: | |
| 35 | 			sw = info.si_status&0x7f | 0x80; | |
| 36 | 			break; | |
| 37 | 		case CLD_EXITED: | |
| 38 | 			sw = (info.si_status&0xff) << 8; | |
| 39 | 			break; | |
| 40 | 		case CLD_KILLED: | |
| 41 | 			sw = info.si_status&0x7f; | |
| 42 | 			break; | |
| 43 | 		case CLD_STOPPED: | |
| 44 | 		case CLD_TRAPPED: | |
| 45 | 			/* see ptrace(2); the high bits of si_status can contain */ | |
| 46 | 			/* PTRACE_EVENT_ values which must be preserved */ | |
| 47 | 			sw = (info.si_status << 8) + 0x7f; | |
| 48 | 			break; | |
| 49 | 		} | |
| 50 | 		*status = sw; | |
| 51 | 	} | |
| 52 | ||
| 53 | 	return info.si_pid; | |
| 54 | } | |
| 55 | #endif |
lib/libc/musl/src/internal/fork_impl.h+2| ... | ... | @@ -17,3 +17,5 @@ extern hidden volatile int *const __vmlock_lockptr; |
| 17 | 17 | hidden void __malloc_atfork(int); |
| 18 | 18 | hidden void __ldso_atfork(int); |
| 19 | 19 | hidden void __pthread_key_atfork(int); |
| 20 | ||
| 21 | hidden void __post_Fork(int); |
lib/libc/musl/src/internal/syscall.h+12| ... | ... | @@ -391,6 +391,18 @@ static inline long __alt_socketcall(int sys, int sock, int cp, syscall_arg_t a, |
| 391 | 391 | #define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__) |
| 392 | 392 | #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__)) |
| 393 | 393 | |
| 394 | #ifdef SYS_wait4 | |
| 395 | #define __sys_wait4(a,b,c,d) __syscall(SYS_wait4,a,b,c,d) | |
| 396 | #define __sys_wait4_cp(a,b,c,d) __syscall_cp(SYS_wait4,a,b,c,d) | |
| 397 | #else | |
| 398 | hidden long __emulate_wait4(int, int *, int, void *, int); | |
| 399 | #define __sys_wait4(a,b,c,d) __emulate_wait4(a,b,c,d,0) | |
| 400 | #define __sys_wait4_cp(a,b,c,d) __emulate_wait4(a,b,c,d,1) | |
| 401 | #endif | |
| 402 | ||
| 403 | #define sys_wait4(a,b,c,d) __syscall_ret(__sys_wait4(a,b,c,d)) | |
| 404 | #define sys_wait4_cp(a,b,c,d) __syscall_ret(__sys_wait4_cp(a,b,c,d)) | |
| 405 | ||
| 394 | 406 | hidden void __procfdname(char __buf[static 15+3*sizeof(int)], unsigned); |
| 395 | 407 | |
| 396 | 408 | hidden void *__vdsosym(const char *, const char *); |
lib/libc/musl/src/internal/version.h+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | #define VERSION "1.2.4" | |
| 1 | #define VERSION "1.2.5" |
lib/libc/musl/src/ldso/loongarch64/dlsym.s created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | .global dlsym | |
| 2 | .hidden __dlsym | |
| 3 | .type dlsym,@function | |
| 4 | dlsym: | |
| 5 | 	move $a2, $ra | |
| 6 | 	la.global $t0, __dlsym | |
| 7 | 	jr $t0 |
lib/libc/musl/src/ldso/riscv32/dlsym.s created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | .global dlsym | |
| 2 | .hidden __dlsym | |
| 3 | .type dlsym, %function | |
| 4 | dlsym: | |
| 5 | 	mv a2, ra | |
| 6 | 	tail __dlsym |
lib/libc/musl/src/ldso/riscv64/tlsdesc.s created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | .text | |
| 2 | .global __tlsdesc_static | |
| 3 | .hidden __tlsdesc_static | |
| 4 | .type __tlsdesc_static,%function | |
| 5 | __tlsdesc_static: | |
| 6 | 	ld a0,8(a0) | |
| 7 | 	jr t0 | |
| 8 | ||
| 9 | .global __tlsdesc_dynamic | |
| 10 | .hidden __tlsdesc_dynamic | |
| 11 | .type __tlsdesc_dynamic,%function | |
| 12 | __tlsdesc_dynamic: | |
| 13 | 	add sp,sp,-16 | |
| 14 | 	sd t1,(sp) | |
| 15 | 	sd t2,8(sp) | |
| 16 | ||
| 17 | 	ld t2,-8(tp) # t2=dtv | |
| 18 | ||
| 19 | 	ld a0,8(a0) # a0=&{modidx,off} | |
| 20 | 	ld t1,8(a0) # t1=off | |
| 21 | 	ld a0,(a0) # a0=modidx | |
| 22 | 	sll a0,a0,3 # a0=8*modidx | |
| 23 | ||
| 24 | 	add a0,a0,t2 # a0=dtv+8*modidx | |
| 25 | 	ld a0,(a0) # a0=dtv[modidx] | |
| 26 | 	add a0,a0,t1 # a0=dtv[modidx]+off | |
| 27 | 	sub a0,a0,tp # a0=dtv[modidx]+off-tp | |
| 28 | ||
| 29 | 	ld t1,(sp) | |
| 30 | 	ld t2,8(sp) | |
| 31 | 	add sp,sp,16 | |
| 32 | 	jr t0 |
lib/libc/musl/src/ldso/sh/dlsym.s+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | dlsym: |
| 6 | 6 | 	mov.l L1, r0 |
| 7 | 7 | 1:	braf r0 |
| 8 | 	 mov.l @r15, r6 | |
| 8 | 	 sts pr, r6 | |
| 9 | 9 | |
| 10 | 10 | .align 2 |
| 11 | 11 | L1:	.long __dlsym@PLT-(1b+4-.) |
lib/libc/musl/src/linux/cache.c+2-1| ... | ... | @@ -21,7 +21,7 @@ weak_alias(__cachectl, cachectl); |
| 21 | 21 | #ifdef SYS_riscv_flush_icache |
| 22 | 22 | |
| 23 | 23 | #define VDSO_FLUSH_ICACHE_SYM "__vdso_flush_icache" |
| 24 | #define VDSO_FLUSH_ICACHE_VER "LINUX_4.5" | |
| 24 | #define VDSO_FLUSH_ICACHE_VER "LINUX_4.15" | |
| 25 | 25 | |
| 26 | 26 | static void *volatile vdso_func; |
| 27 | 27 | |
| ... | ... | @@ -45,6 +45,7 @@ int __riscv_flush_icache(void *start, void *end, unsigned long int flags) |
| 45 | 45 | 		if (!r) return r; |
| 46 | 46 | 		if (r != -ENOSYS) return __syscall_ret(r); |
| 47 | 47 | 	} |
| 48 | 	return syscall(SYS_riscv_flush_icache, start, end, flags); | |
| 48 | 49 | } |
| 49 | 50 | weak_alias(__riscv_flush_icache, riscv_flush_icache); |
| 50 | 51 | #endif |
lib/libc/musl/src/linux/clone.c+50-6| ... | ... | @@ -4,18 +4,62 @@ |
| 4 | 4 | #include <sched.h> |
| 5 | 5 | #include "pthread_impl.h" |
| 6 | 6 | #include "syscall.h" |
| 7 | #include "lock.h" | |
| 8 | #include "fork_impl.h" | |
| 9 | ||
| 10 | struct clone_start_args { | |
| 11 | 	int (*func)(void *); | |
| 12 | 	void *arg; | |
| 13 | 	sigset_t sigmask; | |
| 14 | }; | |
| 15 | ||
| 16 | static int clone_start(void *arg) | |
| 17 | { | |
| 18 | 	struct clone_start_args *csa = arg; | |
| 19 | 	__post_Fork(0); | |
| 20 | 	__restore_sigs(&csa->sigmask); | |
| 21 | 	return csa->func(csa->arg); | |
| 22 | } | |
| 7 | 23 | |
| 8 | 24 | int clone(int (*func)(void *), void *stack, int flags, void *arg, ...) |
| 9 | 25 | { |
| 26 | 	struct clone_start_args csa; | |
| 10 | 27 | 	va_list ap; |
| 11 | 	pid_t *ptid, *ctid; | |
| 12 | 	void *tls; | |
| 28 | 	pid_t *ptid = 0, *ctid = 0; | |
| 29 | 	void *tls = 0; | |
| 30 | ||
| 31 | 	/* Flags that produce an invalid thread/TLS state are disallowed. */ | |
| 32 | 	int badflags = CLONE_THREAD | CLONE_SETTLS | CLONE_CHILD_CLEARTID; | |
| 33 | ||
| 34 | 	if ((flags & badflags) || !stack) | |
| 35 | 		return __syscall_ret(-EINVAL); | |
| 13 | 36 | |
| 14 | 37 | 	va_start(ap, arg); |
| 15 | 	ptid = va_arg(ap, pid_t *); | |
| 16 | 	tls = va_arg(ap, void *); | |
| 17 | 	ctid = va_arg(ap, pid_t *); | |
| 38 | 	if (flags & (CLONE_PIDFD | CLONE_PARENT_SETTID | CLONE_CHILD_SETTID)) | |
| 39 | 	 	ptid = va_arg(ap, pid_t *); | |
| 40 | 	if (flags & CLONE_CHILD_SETTID) { | |
| 41 | 		tls = va_arg(ap, void *); | |
| 42 | 		ctid = va_arg(ap, pid_t *); | |
| 43 | 	} | |
| 18 | 44 | 	va_end(ap); |
| 19 | 45 | |
| 20 | 	return __syscall_ret(__clone(func, stack, flags, arg, ptid, tls, ctid)); | |
| 46 | 	/* If CLONE_VM is used, it's impossible to give the child a consistent | |
| 47 | 	 * thread structure. In this case, the best we can do is assume the | |
| 48 | 	 * caller is content with an extremely restrictive execution context | |
| 49 | 	 * like the one vfork() would provide. */ | |
| 50 | 	if (flags & CLONE_VM) return __syscall_ret( | |
| 51 | 		__clone(func, stack, flags, arg, ptid, tls, ctid)); | |
| 52 | ||
| 53 | 	__block_all_sigs(&csa.sigmask); | |
| 54 | 	LOCK(__abort_lock); | |
| 55 | ||
| 56 | 	/* Setup the a wrapper start function for the child process to do | |
| 57 | 	 * mimic _Fork in producing a consistent execution state. */ | |
| 58 | 	csa.func = func; | |
| 59 | 	csa.arg = arg; | |
| 60 | 	int ret = __clone(clone_start, stack, flags, &csa, ptid, tls, ctid); | |
| 61 | ||
| 62 | 	__post_Fork(ret); | |
| 63 | 	__restore_sigs(&csa.sigmask); | |
| 64 | 	return __syscall_ret(ret); | |
| 21 | 65 | } |
lib/libc/musl/src/linux/ppoll.c deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | #define _GNU_SOURCE | |
| 2 | #include <poll.h> | |
| 3 | #include <signal.h> | |
| 4 | #include <errno.h> | |
| 5 | #include "syscall.h" | |
| 6 | ||
| 7 | #define IS32BIT(x) !((x)+0x80000000ULL>>32) | |
| 8 | #define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63)) | |
| 9 | ||
| 10 | int ppoll(struct pollfd *fds, nfds_t n, const struct timespec *to, const sigset_t *mask) | |
| 11 | { | |
| 12 | 	time_t s = to ? to->tv_sec : 0; | |
| 13 | 	long ns = to ? to->tv_nsec : 0; | |
| 14 | #ifdef SYS_ppoll_time64 | |
| 15 | 	int r = -ENOSYS; | |
| 16 | 	if (SYS_ppoll == SYS_ppoll_time64 || !IS32BIT(s)) | |
| 17 | 		r = __syscall_cp(SYS_ppoll_time64, fds, n, | |
| 18 | 			to ? ((long long[]){s, ns}) : 0, | |
| 19 | 			mask, _NSIG/8); | |
| 20 | 	if (SYS_ppoll == SYS_ppoll_time64 || r != -ENOSYS) | |
| 21 | 		return __syscall_ret(r); | |
| 22 | 	s = CLAMP(s); | |
| 23 | #endif | |
| 24 | 	return syscall_cp(SYS_ppoll, fds, n, | |
| 25 | 		to ? ((long[]){s, ns}) : 0, mask, _NSIG/8); | |
| 26 | } |
lib/libc/musl/src/linux/preadv2.c created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | #define _GNU_SOURCE | |
| 2 | #include <sys/uio.h> | |
| 3 | #include <unistd.h> | |
| 4 | #include "syscall.h" | |
| 5 | ||
| 6 | ssize_t preadv2(int fd, const struct iovec *iov, int count, off_t ofs, int flags) | |
| 7 | { | |
| 8 | #ifdef SYS_preadv | |
| 9 | 	if (!flags) { | |
| 10 | 		if (ofs==-1) return readv(fd, iov, count); | |
| 11 | 		return syscall_cp(SYS_preadv, fd, iov, count, | |
| 12 | 			(long)(ofs), (long)(ofs>>32)); | |
| 13 | 	} | |
| 14 | #endif | |
| 15 | 	return syscall_cp(SYS_preadv2, fd, iov, count, | |
| 16 | 		(long)(ofs), (long)(ofs>>32), flags); | |
| 17 | } |
lib/libc/musl/src/linux/pwritev2.c created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | #define _GNU_SOURCE | |
| 2 | #include <sys/uio.h> | |
| 3 | #include <unistd.h> | |
| 4 | #include "syscall.h" | |
| 5 | ||
| 6 | ssize_t pwritev2(int fd, const struct iovec *iov, int count, off_t ofs, int flags) | |
| 7 | { | |
| 8 | #ifdef SYS_pwritev | |
| 9 | 	if (!flags) { | |
| 10 | 		if (ofs==-1) return writev(fd, iov, count); | |
| 11 | 		return syscall_cp(SYS_pwritev, fd, iov, count, | |
| 12 | 			(long)(ofs), (long)(ofs>>32)); | |
| 13 | 	} | |
| 14 | #endif | |
| 15 | 	return syscall_cp(SYS_pwritev2, fd, iov, count, | |
| 16 | 		(long)(ofs), (long)(ofs>>32), flags); | |
| 17 | } |
lib/libc/musl/src/linux/statx.c created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | #define _GNU_SOURCE | |
| 2 | #include <sys/stat.h> | |
| 3 | #include <string.h> | |
| 4 | #include <syscall.h> | |
| 5 | #include <sys/sysmacros.h> | |
| 6 | #include <errno.h> | |
| 7 | ||
| 8 | int statx(int dirfd, const char *restrict path, int flags, unsigned mask, struct statx *restrict stx) | |
| 9 | { | |
| 10 | 	int ret = __syscall(SYS_statx, dirfd, path, flags, mask, stx); | |
| 11 | ||
| 12 | #ifndef SYS_fstatat | |
| 13 | 	return __syscall_ret(ret); | |
| 14 | #endif | |
| 15 | ||
| 16 | 	if (ret != -ENOSYS) return __syscall_ret(ret); | |
| 17 | ||
| 18 | 	struct stat st; | |
| 19 | 	ret = fstatat(dirfd, path, &st, flags); | |
| 20 | 	if (ret) return ret; | |
| 21 | ||
| 22 | 	stx->stx_dev_major = major(st.st_dev); | |
| 23 | 	stx->stx_dev_minor = minor(st.st_dev); | |
| 24 | 	stx->stx_ino = st.st_ino; | |
| 25 | 	stx->stx_mode = st.st_mode; | |
| 26 | 	stx->stx_nlink = st.st_nlink; | |
| 27 | 	stx->stx_uid = st.st_uid; | |
| 28 | 	stx->stx_gid = st.st_gid; | |
| 29 | 	stx->stx_size = st.st_size; | |
| 30 | 	stx->stx_blksize = st.st_blksize; | |
| 31 | 	stx->stx_blocks = st.st_blocks; | |
| 32 | 	stx->stx_atime.tv_sec = st.st_atim.tv_sec; | |
| 33 | 	stx->stx_atime.tv_nsec = st.st_atim.tv_nsec; | |
| 34 | 	stx->stx_mtime.tv_sec = st.st_mtim.tv_sec; | |
| 35 | 	stx->stx_mtime.tv_nsec = st.st_mtim.tv_nsec; | |
| 36 | 	stx->stx_ctime.tv_sec = st.st_ctim.tv_sec; | |
| 37 | 	stx->stx_ctime.tv_nsec = st.st_ctim.tv_nsec; | |
| 38 | 	stx->stx_btime = (struct statx_timestamp){.tv_sec=0, .tv_nsec=0}; | |
| 39 | 	stx->stx_mask = STATX_BASIC_STATS; | |
| 40 | ||
| 41 | 	return 0; | |
| 42 | } |
lib/libc/musl/src/linux/wait4.c+1-1| ... | ... | @@ -26,7 +26,7 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru) |
| 26 | 26 | 	} |
| 27 | 27 | #endif |
| 28 | 28 | 	char *dest = ru ? (char *)&ru->ru_maxrss - 4*sizeof(long) : 0; |
| 29 | 	r = __syscall(SYS_wait4, pid, status, options, dest); | |
| 29 | 	r = __sys_wait4(pid, status, options, dest); | |
| 30 | 30 | 	if (r>0 && ru && sizeof(time_t) > sizeof(long)) { |
| 31 | 31 | 		long kru[4]; |
| 32 | 32 | 		memcpy(kru, dest, 4*sizeof(long)); |
lib/libc/musl/src/locale/iconv.c+1-1| ... | ... | @@ -49,7 +49,7 @@ static const unsigned char charmaps[] = |
| 49 | 49 | "ucs4\0utf32\0\0\313" |
| 50 | 50 | "ucs2\0\0\314" |
| 51 | 51 | "eucjp\0\0\320" |
| 52 | "shiftjis\0sjis\0\0\321" | |
| 52 | "shiftjis\0sjis\0cp932\0\0\321" | |
| 53 | 53 | "iso2022jp\0\0\322" |
| 54 | 54 | "gb18030\0\0\330" |
| 55 | 55 | "gbk\0\0\331" |
lib/libc/musl/src/math/acoshl.c+7-3| ... | ... | @@ -10,14 +10,18 @@ long double acoshl(long double x) |
| 10 | 10 | long double acoshl(long double x) |
| 11 | 11 | { |
| 12 | 12 | 	union ldshape u = {x}; |
| 13 | 	int e = u.i.se & 0x7fff; | |
| 13 | 	int e = u.i.se; | |
| 14 | 14 | |
| 15 | 15 | 	if (e < 0x3fff + 1) |
| 16 | 		/* |x| < 2, invalid if x < 1 or nan */ | |
| 16 | 		/* 0 <= x < 2, invalid if x < 1 */ | |
| 17 | 17 | 		return log1pl(x-1 + sqrtl((x-1)*(x-1)+2*(x-1))); |
| 18 | 18 | 	if (e < 0x3fff + 32) |
| 19 | 		/* |x| < 0x1p32 */ | |
| 19 | 		/* 2 <= x < 0x1p32 */ | |
| 20 | 20 | 		return logl(2*x - 1/(x+sqrtl(x*x-1))); |
| 21 | 	if (e & 0x8000) | |
| 22 | 		/* x < 0 or x = -0, invalid */ | |
| 23 | 		return (x - x) / (x - x); | |
| 24 | 	/* 0x1p32 <= x or nan */ | |
| 21 | 25 | 	return logl(x) + 0.693147180559945309417232121458176568L; |
| 22 | 26 | } |
| 23 | 27 | #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 |
lib/libc/musl/src/math/powl.c+21-13| ... | ... | @@ -212,25 +212,33 @@ long double powl(long double x, long double y) |
| 212 | 212 | 	} |
| 213 | 213 | 	if (x == 1.0) |
| 214 | 214 | 		return 1.0; /* 1**y = 1, even if y is nan */ |
| 215 | 	if (x == -1.0 && !isfinite(y)) | |
| 216 | 		return 1.0; /* -1**inf = 1 */ | |
| 217 | 215 | 	if (y == 0.0) |
| 218 | 216 | 		return 1.0; /* x**0 = 1, even if x is nan */ |
| 219 | 217 | 	if (y == 1.0) |
| 220 | 218 | 		return x; |
| 221 | 	if (y >= LDBL_MAX) { | |
| 222 | 		if (x > 1.0 || x < -1.0) | |
| 223 | 			return INFINITY; | |
| 224 | 		if (x != 0.0) | |
| 225 | 			return 0.0; | |
| 226 | 	} | |
| 227 | 	if (y <= -LDBL_MAX) { | |
| 228 | 		if (x > 1.0 || x < -1.0) | |
| 219 | 	/* if y*log2(x) < log2(LDBL_TRUE_MIN)-1 then x^y uflows to 0 | |
| 220 | 	 if y*log2(x) > -log2(LDBL_TRUE_MIN)+1 > LDBL_MAX_EXP then x^y oflows | |
| 221 | 	 if |x|!=1 then |log2(x)| > |log(x)| > LDBL_EPSILON/2 so | |
| 222 | 	 x^y oflows/uflows if |y|*LDBL_EPSILON/2 > -log2(LDBL_TRUE_MIN)+1 */ | |
| 223 | 	if (fabsl(y) > 2*(-LDBL_MIN_EXP+LDBL_MANT_DIG+1)/LDBL_EPSILON) { | |
| 224 | 		/* y is not an odd int */ | |
| 225 | 		if (x == -1.0) | |
| 226 | 			return 1.0; | |
| 227 | 		if (y == INFINITY) { | |
| 228 | 			if (x > 1.0 || x < -1.0) | |
| 229 | 				return INFINITY; | |
| 229 | 230 | 			return 0.0; |
| 230 | 		if (x != 0.0 || y == -INFINITY) | |
| 231 | 		} | |
| 232 | 		if (y == -INFINITY) { | |
| 233 | 			if (x > 1.0 || x < -1.0) | |
| 234 | 				return 0.0; | |
| 231 | 235 | 			return INFINITY; |
| 236 | 		} | |
| 237 | 		if ((x > 1.0 || x < -1.0) == (y > 0)) | |
| 238 | 			return huge * huge; | |
| 239 | 		return twom10000 * twom10000; | |
| 232 | 240 | 	} |
| 233 | 	if (x >= LDBL_MAX) { | |
| 241 | 	if (x == INFINITY) { | |
| 234 | 242 | 		if (y > 0.0) |
| 235 | 243 | 			return INFINITY; |
| 236 | 244 | 		return 0.0; |
| ... | ... | @@ -253,7 +261,7 @@ long double powl(long double x, long double y) |
| 253 | 261 | 			yoddint = 1; |
| 254 | 262 | 	} |
| 255 | 263 | |
| 256 | 	if (x <= -LDBL_MAX) { | |
| 264 | 	if (x == -INFINITY) { | |
| 257 | 265 | 		if (y > 0.0) { |
| 258 | 266 | 			if (yoddint) |
| 259 | 267 | 				return -INFINITY; |
lib/libc/musl/src/math/riscv32/copysign.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double copysign(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysign.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/copysignf.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float copysignf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysignf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fabs.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fabs(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("fabs.d %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fabs.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fabsf.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fabsf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("fabs.s %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fabsf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fma.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fma(double x, double y, double z) | |
| 6 | { | |
| 7 | 	__asm__ ("fmadd.d %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fma.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmaf.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fmaf(float x, float y, float z) | |
| 6 | { | |
| 7 | 	__asm__ ("fmadd.s %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmaf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmax.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fmax(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmax.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmaxf.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fmaxf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmaxf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fmin.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double fmin(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fmin.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/fminf.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float fminf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../fminf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/sqrt.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double sqrt(double x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.d %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrt.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/sqrtf.c created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float sqrtf(float x) | |
| 6 | { | |
| 7 | 	__asm__ ("fsqrt.s %0, %1" : "=f"(x) : "f"(x)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../sqrtf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/sqrtl.c+2-2| ... | ... | @@ -205,7 +205,7 @@ long double sqrtl(long double x) |
| 205 | 205 | 	top = (top + 0x3fff) >> 1; |
| 206 | 206 | |
| 207 | 207 | 	/* r ~ 1/sqrt(m) */ |
| 208 | 	static const uint64_t three = 0xc0000000; | |
| 208 | 	const uint64_t three = 0xc0000000; | |
| 209 | 209 | 	uint64_t r, s, d, u, i; |
| 210 | 210 | 	i = (ix.hi >> 42) % 128; |
| 211 | 211 | 	r = (uint32_t)__rsqrt_tab[i] << 16; |
| ... | ... | @@ -227,7 +227,7 @@ long double sqrtl(long double x) |
| 227 | 227 | 	r = mul64(u, r) << 1; |
| 228 | 228 | 	/* |r sqrt(m) - 1| < 0x1.c001p-59, switch to 128bit */ |
| 229 | 229 | |
| 230 | 	static const u128 threel = {.hi=three<<32, .lo=0}; | |
| 230 | 	const u128 threel = {.hi=three<<32, .lo=0}; | |
| 231 | 231 | 	u128 rl, sl, dl, ul; |
| 232 | 232 | 	rl.hi = r; |
| 233 | 233 | 	rl.lo = 0; |
lib/libc/musl/src/misc/mntent.c+41-5| ... | ... | @@ -20,6 +20,42 @@ int endmntent(FILE *f) |
| 20 | 20 | 	return 1; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | static char *unescape_ent(char *beg) | |
| 24 | { | |
| 25 | 	char *dest = beg; | |
| 26 | 	const char *src = beg; | |
| 27 | 	while (*src) { | |
| 28 | 		const char *val; | |
| 29 | 		unsigned char cval = 0; | |
| 30 | 		if (*src != '\\') { | |
| 31 | 			*dest++ = *src++; | |
| 32 | 			continue; | |
| 33 | 		} | |
| 34 | 		if (src[1] == '\\') { | |
| 35 | 			++src; | |
| 36 | 			*dest++ = *src++; | |
| 37 | 			continue; | |
| 38 | 		} | |
| 39 | 		val = src + 1; | |
| 40 | 		for (int i = 0; i < 3; ++i) { | |
| 41 | 			if (*val >= '0' && *val <= '7') { | |
| 42 | 				cval <<= 3; | |
| 43 | 				cval += *val++ - '0'; | |
| 44 | 			} else { | |
| 45 | 				break; | |
| 46 | 			} | |
| 47 | 		} | |
| 48 | 		if (cval) { | |
| 49 | 			*dest++ = cval; | |
| 50 | 			src = val; | |
| 51 | 		} else { | |
| 52 | 			*dest++ = *src++; | |
| 53 | 		} | |
| 54 | 	} | |
| 55 | 	*dest = 0; | |
| 56 | 	return beg; | |
| 57 | } | |
| 58 | ||
| 23 | 59 | struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen) |
| 24 | 60 | { |
| 25 | 61 | 	int n[8], use_internal = (linebuf == SENTINEL); |
| ... | ... | @@ -45,7 +81,7 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle |
| 45 | 81 | 		len = strlen(linebuf); |
| 46 | 82 | 		if (len > INT_MAX) continue; |
| 47 | 83 | 		for (i = 0; i < sizeof n / sizeof *n; i++) n[i] = len; |
| 48 | 		sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d", | |
| 84 | 		sscanf(linebuf, " %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %n%*[^ \t]%n %d %d", | |
| 49 | 85 | 			n, n+1, n+2, n+3, n+4, n+5, n+6, n+7, |
| 50 | 86 | 			&mnt->mnt_freq, &mnt->mnt_passno); |
| 51 | 87 | 	} while (linebuf[n[0]] == '#' || n[1]==len); |
| ... | ... | @@ -55,10 +91,10 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle |
| 55 | 91 | 	linebuf[n[5]] = 0; |
| 56 | 92 | 	linebuf[n[7]] = 0; |
| 57 | 93 | |
| 58 | 	mnt->mnt_fsname = linebuf+n[0]; | |
| 59 | 	mnt->mnt_dir = linebuf+n[2]; | |
| 60 | 	mnt->mnt_type = linebuf+n[4]; | |
| 61 | 	mnt->mnt_opts = linebuf+n[6]; | |
| 94 | 	mnt->mnt_fsname = unescape_ent(linebuf+n[0]); | |
| 95 | 	mnt->mnt_dir = unescape_ent(linebuf+n[2]); | |
| 96 | 	mnt->mnt_type = unescape_ent(linebuf+n[4]); | |
| 97 | 	mnt->mnt_opts = unescape_ent(linebuf+n[6]); | |
| 62 | 98 | |
| 63 | 99 | 	return mnt; |
| 64 | 100 | } |
lib/libc/musl/src/misc/syslog.c+2-1| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #include <fcntl.h> |
| 12 | 12 | #include "lock.h" |
| 13 | 13 | #include "fork_impl.h" |
| 14 | #include "locale_impl.h" | |
| 14 | 15 | |
| 15 | 16 | static volatile int lock[1]; |
| 16 | 17 | static char log_ident[32]; |
| ... | ... | @@ -99,7 +100,7 @@ static void _vsyslog(int priority, const char *message, va_list ap) |
| 99 | 100 | |
| 100 | 101 | 	now = time(NULL); |
| 101 | 102 | 	gmtime_r(&now, &tm); |
| 102 | 	strftime(timebuf, sizeof timebuf, "%b %e %T", &tm); | |
| 103 | 	strftime_l(timebuf, sizeof timebuf, "%b %e %T", &tm, C_LOCALE); | |
| 103 | 104 | |
| 104 | 105 | 	pid = (log_opt & LOG_PID) ? getpid() : 0; |
| 105 | 106 | 	l = snprintf(buf, sizeof buf, "<%d>%s %n%s%s%.0d%s: ", |
lib/libc/musl/src/multibyte/mbrtowc.c+1-1| ... | ... | @@ -8,7 +8,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate |
| 8 | 8 | 	static unsigned internal_state; |
| 9 | 9 | 	unsigned c; |
| 10 | 10 | 	const unsigned char *s = (const void *)src; |
| 11 | 	const unsigned N = n; | |
| 11 | 	const size_t N = n; | |
| 12 | 12 | 	wchar_t dummy; |
| 13 | 13 | |
| 14 | 14 | 	if (!st) st = (void *)&internal_state; |
lib/libc/musl/src/network/dns_parse.c+2-3| ... | ... | @@ -12,16 +12,15 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c |
| 12 | 12 | 	p = r+12; |
| 13 | 13 | 	qdcount = r[4]*256 + r[5]; |
| 14 | 14 | 	ancount = r[6]*256 + r[7]; |
| 15 | 	if (qdcount+ancount > 64) return -1; | |
| 16 | 15 | 	while (qdcount--) { |
| 17 | 16 | 		while (p-r < rlen && *p-1U < 127) p++; |
| 18 | 		if (p>r+rlen-6 || *p>193 || (*p==193 && p[1]>254)) | |
| 17 | 		if (p>r+rlen-6) | |
| 19 | 18 | 			return -1; |
| 20 | 19 | 		p += 5 + !!*p; |
| 21 | 20 | 	} |
| 22 | 21 | 	while (ancount--) { |
| 23 | 22 | 		while (p-r < rlen && *p-1U < 127) p++; |
| 24 | 		if (p>r+rlen-12 || *p>193 || (*p==193 && p[1]>254)) | |
| 23 | 		if (p>r+rlen-12) | |
| 25 | 24 | 			return -1; |
| 26 | 25 | 		p += 1 + !!*p; |
| 27 | 26 | 		len = p[8]*256 + p[9]; |
lib/libc/musl/src/network/getnameinfo.c+3-1| ... | ... | @@ -162,8 +162,10 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t sl, |
| 162 | 162 | 			query[3] = 0; /* don't need AD flag */ |
| 163 | 163 | 			int rlen = __res_send(query, qlen, reply, sizeof reply); |
| 164 | 164 | 			buf[0] = 0; |
| 165 | 			if (rlen > 0) | |
| 165 | 			if (rlen > 0) { | |
| 166 | 				if (rlen > sizeof reply) rlen = sizeof reply; | |
| 166 | 167 | 				__dns_parse(reply, rlen, dns_parse_callback, buf); |
| 168 | 			} | |
| 167 | 169 | 		} |
| 168 | 170 | 		if (!*buf) { |
| 169 | 171 | 			if (flags & NI_NAMEREQD) return EAI_NONAME; |
lib/libc/musl/src/network/lookup_name.c+1-1| ... | ... | @@ -109,7 +109,7 @@ struct dpc_ctx { |
| 109 | 109 | #define RR_CNAME 5 |
| 110 | 110 | #define RR_AAAA 28 |
| 111 | 111 | |
| 112 | #define ABUF_SIZE 768 | |
| 112 | #define ABUF_SIZE 4800 | |
| 113 | 113 | |
| 114 | 114 | static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet, int plen) |
| 115 | 115 | { |
lib/libc/musl/src/process/_Fork.c+17-11| ... | ... | @@ -5,24 +5,16 @@ |
| 5 | 5 | #include "lock.h" |
| 6 | 6 | #include "pthread_impl.h" |
| 7 | 7 | #include "aio_impl.h" |
| 8 | #include "fork_impl.h" | |
| 8 | 9 | |
| 9 | 10 | static void dummy(int x) { } |
| 10 | 11 | weak_alias(dummy, __aio_atfork); |
| 11 | 12 | |
| 12 | pid_t _Fork(void) | |
| 13 | void __post_Fork(int ret) | |
| 13 | 14 | { |
| 14 | 	pid_t ret; | |
| 15 | 	sigset_t set; | |
| 16 | 	__block_all_sigs(&set); | |
| 17 | 	LOCK(__abort_lock); | |
| 18 | #ifdef SYS_fork | |
| 19 | 	ret = __syscall(SYS_fork); | |
| 20 | #else | |
| 21 | 	ret = __syscall(SYS_clone, SIGCHLD, 0); | |
| 22 | #endif | |
| 23 | 15 | 	if (!ret) { |
| 24 | 16 | 		pthread_t self = __pthread_self(); |
| 25 | 		self->tid = __syscall(SYS_gettid); | |
| 17 | 		self->tid = __syscall(SYS_set_tid_address, &__thread_list_lock); | |
| 26 | 18 | 		self->robust_list.off = 0; |
| 27 | 19 | 		self->robust_list.pending = 0; |
| 28 | 20 | 		self->next = self->prev = self; |
| ... | ... | @@ -32,6 +24,20 @@ pid_t _Fork(void) |
| 32 | 24 | 	} |
| 33 | 25 | 	UNLOCK(__abort_lock); |
| 34 | 26 | 	if (!ret) __aio_atfork(1); |
| 27 | } | |
| 28 | ||
| 29 | pid_t _Fork(void) | |
| 30 | { | |
| 31 | 	pid_t ret; | |
| 32 | 	sigset_t set; | |
| 33 | 	__block_all_sigs(&set); | |
| 34 | 	LOCK(__abort_lock); | |
| 35 | #ifdef SYS_fork | |
| 36 | 	ret = __syscall(SYS_fork); | |
| 37 | #else | |
| 38 | 	ret = __syscall(SYS_clone, SIGCHLD, 0); | |
| 39 | #endif | |
| 40 | 	__post_Fork(ret); | |
| 35 | 41 | 	__restore_sigs(&set); |
| 36 | 42 | 	return __syscall_ret(ret); |
| 37 | 43 | } |
lib/libc/musl/src/process/posix_spawn.c+6-1| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | #include <unistd.h> |
| 5 | 5 | #include <signal.h> |
| 6 | 6 | #include <fcntl.h> |
| 7 | #include <errno.h> | |
| 7 | 8 | #include <sys/wait.h> |
| 8 | 9 | #include "syscall.h" |
| 9 | 10 | #include "lock.h" |
| ... | ... | @@ -156,7 +157,11 @@ static int child(void *args_vp) |
| 156 | 157 | fail: |
| 157 | 158 | 	/* Since sizeof errno < PIPE_BUF, the write is atomic. */ |
| 158 | 159 | 	ret = -ret; |
| 159 | 	if (ret) while (__syscall(SYS_write, p, &ret, sizeof ret) < 0); | |
| 160 | 	if (ret) { | |
| 161 | 		int r; | |
| 162 | 		do r = __syscall(SYS_write, p, &ret, sizeof ret); | |
| 163 | 		while (r<0 && r!=-EPIPE); | |
| 164 | 	} | |
| 160 | 165 | 	_exit(127); |
| 161 | 166 | } |
| 162 | 167 |
lib/libc/musl/src/process/waitpid.c+1-1| ... | ... | @@ -3,5 +3,5 @@ |
| 3 | 3 | |
| 4 | 4 | pid_t waitpid(pid_t pid, int *status, int options) |
| 5 | 5 | { |
| 6 | 	return syscall_cp(SYS_wait4, pid, status, options, 0); | |
| 6 | 	return sys_wait4_cp(pid, status, options, 0); | |
| 7 | 7 | } |
lib/libc/musl/src/regex/glob.c+1-1| ... | ... | @@ -265,7 +265,7 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i |
| 265 | 265 | 			if (append(&tail, pat, strlen(pat), 0)) |
| 266 | 266 | 				return GLOB_NOSPACE; |
| 267 | 267 | 			cnt++; |
| 268 | 		} else | |
| 268 | 		} else if (!error) | |
| 269 | 269 | 			return GLOB_NOMATCH; |
| 270 | 270 | 	} |
| 271 | 271 |
lib/libc/musl/src/select/ppoll.c created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | #define _BSD_SOURCE | |
| 2 | #include <poll.h> | |
| 3 | #include <signal.h> | |
| 4 | #include <errno.h> | |
| 5 | #include "syscall.h" | |
| 6 | ||
| 7 | #define IS32BIT(x) !((x)+0x80000000ULL>>32) | |
| 8 | #define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63)) | |
| 9 | ||
| 10 | int ppoll(struct pollfd *fds, nfds_t n, const struct timespec *to, const sigset_t *mask) | |
| 11 | { | |
| 12 | 	time_t s = to ? to->tv_sec : 0; | |
| 13 | 	long ns = to ? to->tv_nsec : 0; | |
| 14 | #ifdef SYS_ppoll_time64 | |
| 15 | 	int r = -ENOSYS; | |
| 16 | 	if (SYS_ppoll == SYS_ppoll_time64 || !IS32BIT(s)) | |
| 17 | 		r = __syscall_cp(SYS_ppoll_time64, fds, n, | |
| 18 | 			to ? ((long long[]){s, ns}) : 0, | |
| 19 | 			mask, _NSIG/8); | |
| 20 | 	if (SYS_ppoll == SYS_ppoll_time64 || r != -ENOSYS) | |
| 21 | 		return __syscall_ret(r); | |
| 22 | 	s = CLAMP(s); | |
| 23 | #endif | |
| 24 | 	return syscall_cp(SYS_ppoll, fds, n, | |
| 25 | 		to ? ((long[]){s, ns}) : 0, mask, _NSIG/8); | |
| 26 | } |
lib/libc/musl/src/setjmp/loongarch64/longjmp.S created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | .global _longjmp | |
| 2 | .global longjmp | |
| 3 | .type _longjmp,@function | |
| 4 | .type longjmp,@function | |
| 5 | _longjmp: | |
| 6 | longjmp: | |
| 7 | 	ld.d $ra, $a0, 0 | |
| 8 | 	ld.d $sp, $a0, 8 | |
| 9 | 	ld.d $r21,$a0, 16 | |
| 10 | 	ld.d $fp, $a0, 24 | |
| 11 | 	ld.d $s0, $a0, 32 | |
| 12 | 	ld.d $s1, $a0, 40 | |
| 13 | 	ld.d $s2, $a0, 48 | |
| 14 | 	ld.d $s3, $a0, 56 | |
| 15 | 	ld.d $s4, $a0, 64 | |
| 16 | 	ld.d $s5, $a0, 72 | |
| 17 | 	ld.d $s6, $a0, 80 | |
| 18 | 	ld.d $s7, $a0, 88 | |
| 19 | 	ld.d $s8, $a0, 96 | |
| 20 | #ifndef __loongarch_soft_float | |
| 21 | 	fld.d $fs0, $a0, 104 | |
| 22 | 	fld.d $fs1, $a0, 112 | |
| 23 | 	fld.d $fs2, $a0, 120 | |
| 24 | 	fld.d $fs3, $a0, 128 | |
| 25 | 	fld.d $fs4, $a0, 136 | |
| 26 | 	fld.d $fs5, $a0, 144 | |
| 27 | 	fld.d $fs6, $a0, 152 | |
| 28 | 	fld.d $fs7, $a0, 160 | |
| 29 | #endif | |
| 30 | 	sltui $a0, $a1, 1 | |
| 31 | 	add.d $a0, $a0, $a1 | |
| 32 | 	jr $ra |
lib/libc/musl/src/setjmp/loongarch64/setjmp.S created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | .global __setjmp | |
| 2 | .global _setjmp | |
| 3 | .global setjmp | |
| 4 | .type __setjmp,@function | |
| 5 | .type _setjmp,@function | |
| 6 | .type setjmp,@function | |
| 7 | __setjmp: | |
| 8 | _setjmp: | |
| 9 | setjmp: | |
| 10 | 	st.d $ra, $a0, 0 | |
| 11 | 	st.d $sp, $a0, 8 | |
| 12 | 	st.d $r21,$a0, 16 | |
| 13 | 	st.d $fp, $a0, 24 | |
| 14 | 	st.d $s0, $a0, 32 | |
| 15 | 	st.d $s1, $a0, 40 | |
| 16 | 	st.d $s2, $a0, 48 | |
| 17 | 	st.d $s3, $a0, 56 | |
| 18 | 	st.d $s4, $a0, 64 | |
| 19 | 	st.d $s5, $a0, 72 | |
| 20 | 	st.d $s6, $a0, 80 | |
| 21 | 	st.d $s7, $a0, 88 | |
| 22 | 	st.d $s8, $a0, 96 | |
| 23 | #ifndef __loongarch_soft_float | |
| 24 | 	fst.d $fs0, $a0, 104 | |
| 25 | 	fst.d $fs1, $a0, 112 | |
| 26 | 	fst.d $fs2, $a0, 120 | |
| 27 | 	fst.d $fs3, $a0, 128 | |
| 28 | 	fst.d $fs4, $a0, 136 | |
| 29 | 	fst.d $fs5, $a0, 144 | |
| 30 | 	fst.d $fs6, $a0, 152 | |
| 31 | 	fst.d $fs7, $a0, 160 | |
| 32 | #endif | |
| 33 | 	move $a0, $zero | |
| 34 | 	jr $ra |
lib/libc/musl/src/setjmp/riscv32/longjmp.S created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | .global __longjmp | |
| 2 | .global _longjmp | |
| 3 | .global longjmp | |
| 4 | .type __longjmp, %function | |
| 5 | .type _longjmp, %function | |
| 6 | .type longjmp, %function | |
| 7 | __longjmp: | |
| 8 | _longjmp: | |
| 9 | longjmp: | |
| 10 | 	lw s0, 0(a0) | |
| 11 | 	lw s1, 4(a0) | |
| 12 | 	lw s2, 8(a0) | |
| 13 | 	lw s3, 12(a0) | |
| 14 | 	lw s4, 16(a0) | |
| 15 | 	lw s5, 20(a0) | |
| 16 | 	lw s6, 24(a0) | |
| 17 | 	lw s7, 28(a0) | |
| 18 | 	lw s8, 32(a0) | |
| 19 | 	lw s9, 36(a0) | |
| 20 | 	lw s10, 40(a0) | |
| 21 | 	lw s11, 44(a0) | |
| 22 | 	lw sp, 48(a0) | |
| 23 | 	lw ra, 52(a0) | |
| 24 | ||
| 25 | #ifndef __riscv_float_abi_soft | |
| 26 | 	fld fs0, 56(a0) | |
| 27 | 	fld fs1, 64(a0) | |
| 28 | 	fld fs2, 72(a0) | |
| 29 | 	fld fs3, 80(a0) | |
| 30 | 	fld fs4, 88(a0) | |
| 31 | 	fld fs5, 96(a0) | |
| 32 | 	fld fs6, 104(a0) | |
| 33 | 	fld fs7, 112(a0) | |
| 34 | 	fld fs8, 120(a0) | |
| 35 | 	fld fs9, 128(a0) | |
| 36 | 	fld fs10, 136(a0) | |
| 37 | 	fld fs11, 144(a0) | |
| 38 | #endif | |
| 39 | ||
| 40 | 	seqz a0, a1 | |
| 41 | 	add a0, a0, a1 | |
| 42 | 	ret |
lib/libc/musl/src/setjmp/riscv32/setjmp.S created+41| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | .global __setjmp | |
| 2 | .global _setjmp | |
| 3 | .global setjmp | |
| 4 | .type __setjmp, %function | |
| 5 | .type _setjmp, %function | |
| 6 | .type setjmp, %function | |
| 7 | __setjmp: | |
| 8 | _setjmp: | |
| 9 | setjmp: | |
| 10 | 	sw s0, 0(a0) | |
| 11 | 	sw s1, 4(a0) | |
| 12 | 	sw s2, 8(a0) | |
| 13 | 	sw s3, 12(a0) | |
| 14 | 	sw s4, 16(a0) | |
| 15 | 	sw s5, 20(a0) | |
| 16 | 	sw s6, 24(a0) | |
| 17 | 	sw s7, 28(a0) | |
| 18 | 	sw s8, 32(a0) | |
| 19 | 	sw s9, 36(a0) | |
| 20 | 	sw s10, 40(a0) | |
| 21 | 	sw s11, 44(a0) | |
| 22 | 	sw sp, 48(a0) | |
| 23 | 	sw ra, 52(a0) | |
| 24 | ||
| 25 | #ifndef __riscv_float_abi_soft | |
| 26 | 	fsd fs0, 56(a0) | |
| 27 | 	fsd fs1, 64(a0) | |
| 28 | 	fsd fs2, 72(a0) | |
| 29 | 	fsd fs3, 80(a0) | |
| 30 | 	fsd fs4, 88(a0) | |
| 31 | 	fsd fs5, 96(a0) | |
| 32 | 	fsd fs6, 104(a0) | |
| 33 | 	fsd fs7, 112(a0) | |
| 34 | 	fsd fs8, 120(a0) | |
| 35 | 	fsd fs9, 128(a0) | |
| 36 | 	fsd fs10, 136(a0) | |
| 37 | 	fsd fs11, 144(a0) | |
| 38 | #endif | |
| 39 | ||
| 40 | 	li a0, 0 | |
| 41 | 	ret |
lib/libc/musl/src/signal/loongarch64/restore.s created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | .global __restore_rt | |
| 2 | .global __restore | |
| 3 | .hidden __restore_rt | |
| 4 | .hidden __restore | |
| 5 | .type __restore_rt,@function | |
| 6 | .type __restore,@function | |
| 7 | __restore_rt: | |
| 8 | __restore: | |
| 9 | 	li.w $a7, 139 | |
| 10 | 	syscall 0 |
lib/libc/musl/src/signal/loongarch64/sigsetjmp.s created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | .global sigsetjmp | |
| 2 | .global __sigsetjmp | |
| 3 | .type sigsetjmp,@function | |
| 4 | .type __sigsetjmp,@function | |
| 5 | sigsetjmp: | |
| 6 | __sigsetjmp: | |
| 7 | 	beq $a1, $zero, 1f | |
| 8 | 	st.d $ra, $a0, 184 | |
| 9 | 	st.d $s0, $a0, 200 #184+8+8 | |
| 10 | 	move $s0, $a0 | |
| 11 | ||
| 12 | 	la.global $t0, setjmp | |
| 13 | 	jirl $ra, $t0, 0 | |
| 14 | ||
| 15 | 	move $a1, $a0 # Return from 'setjmp' or 'longjmp' | |
| 16 | 	move $a0, $s0 | |
| 17 | 	ld.d $ra, $a0, 184 | |
| 18 | 	ld.d $s0, $a0, 200 #184+8+8 | |
| 19 | ||
| 20 | .hidden __sigsetjmp_tail | |
| 21 | 	la.global $t0, __sigsetjmp_tail | |
| 22 | 	jr $t0 | |
| 23 | 1: | |
| 24 | 	la.global $t0, setjmp | |
| 25 | 	jr $t0 |
lib/libc/musl/src/signal/riscv32/restore.s created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | .global __restore | |
| 2 | .type __restore, %function | |
| 3 | __restore: | |
| 4 | .global __restore_rt | |
| 5 | .type __restore_rt, %function | |
| 6 | __restore_rt: | |
| 7 | 	li a7, 139 # SYS_rt_sigreturn | |
| 8 | 	ecall |
lib/libc/musl/src/signal/riscv32/sigsetjmp.s created+23| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | .global sigsetjmp | |
| 2 | .global __sigsetjmp | |
| 3 | .type sigsetjmp, %function | |
| 4 | .type __sigsetjmp, %function | |
| 5 | sigsetjmp: | |
| 6 | __sigsetjmp: | |
| 7 | 	bnez a1, 1f | |
| 8 | 	tail setjmp | |
| 9 | 1: | |
| 10 | ||
| 11 | 	sw ra, 152(a0) | |
| 12 | 	sw s0, 164(a0) | |
| 13 | 	mv s0, a0 | |
| 14 | ||
| 15 | 	call setjmp | |
| 16 | ||
| 17 | 	mv a1, a0 | |
| 18 | 	mv a0, s0 | |
| 19 | 	lw s0, 164(a0) | |
| 20 | 	lw ra, 152(a0) | |
| 21 | ||
| 22 | .hidden __sigsetjmp_tail | |
| 23 | 	tail __sigsetjmp_tail |
lib/libc/musl/src/signal/sh/sigsetjmp.s+1-1| ... | ... | @@ -27,7 +27,7 @@ __sigsetjmp: |
| 27 | 27 | |
| 28 | 28 | 	mov.l 3f, r0 |
| 29 | 29 | 4:	braf r0 |
| 30 | 	 mov.l @(4+8,r4), r8 | |
| 30 | 	 mov.l @(4+8,r6), r8 | |
| 31 | 31 | |
| 32 | 32 | 9:	mov.l 5f, r0 |
| 33 | 33 | 6:	braf r0 |
lib/libc/musl/src/stat/fchmodat.c+5-2| ... | ... | @@ -5,13 +5,16 @@ |
| 5 | 5 | |
| 6 | 6 | int fchmodat(int fd, const char *path, mode_t mode, int flag) |
| 7 | 7 | { |
| 8 | 	if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag); | |
| 8 | 	if (!flag) return syscall(SYS_fchmodat, fd, path, mode); | |
| 9 | ||
| 10 | 	int ret = __syscall(SYS_fchmodat2, fd, path, mode, flag); | |
| 11 | 	if (ret != -ENOSYS) return __syscall_ret(ret); | |
| 9 | 12 | |
| 10 | 13 | 	if (flag != AT_SYMLINK_NOFOLLOW) |
| 11 | 14 | 		return __syscall_ret(-EINVAL); |
| 12 | 15 | |
| 13 | 16 | 	struct stat st; |
| 14 | 	int ret, fd2; | |
| 17 | 	int fd2; | |
| 15 | 18 | 	char proc[15+3*sizeof(int)]; |
| 16 | 19 | |
| 17 | 20 | 	if (fstatat(fd, path, &st, flag)) |
lib/libc/musl/src/stat/fstatat.c+1| ... | ... | @@ -36,6 +36,7 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric |
| 36 | 36 | { |
| 37 | 37 | 	struct statx stx; |
| 38 | 38 | |
| 39 | 	flag |= AT_NO_AUTOMOUNT; | |
| 39 | 40 | 	int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx); |
| 40 | 41 | 	if (ret) return ret; |
| 41 | 42 |
lib/libc/musl/src/stat/statvfs.c+1| ... | ... | @@ -39,6 +39,7 @@ static void fixup(struct statvfs *out, const struct statfs *in) |
| 39 | 39 | 	out->f_fsid = in->f_fsid.__val[0]; |
| 40 | 40 | 	out->f_flag = in->f_flags; |
| 41 | 41 | 	out->f_namemax = in->f_namelen; |
| 42 | 	out->f_type = in->f_type; | |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | int statvfs(const char *restrict path, struct statvfs *restrict buf) |
lib/libc/musl/src/stdio/pclose.c+1-1| ... | ... | @@ -7,7 +7,7 @@ int pclose(FILE *f) |
| 7 | 7 | 	int status, r; |
| 8 | 8 | 	pid_t pid = f->pipe_pid; |
| 9 | 9 | 	fclose(f); |
| 10 | 	while ((r=__syscall(SYS_wait4, pid, &status, 0, 0)) == -EINTR); | |
| 10 | 	while ((r=__sys_wait4(pid, &status, 0, 0)) == -EINTR); | |
| 11 | 11 | 	if (r<0) return __syscall_ret(r); |
| 12 | 12 | 	return status; |
| 13 | 13 | } |
lib/libc/musl/src/stdio/vfprintf.c+5-3| ... | ... | @@ -52,7 +52,7 @@ static const unsigned char states[]['z'-'A'+1] = { |
| 52 | 52 | 		S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT, |
| 53 | 53 | 		S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL, |
| 54 | 54 | 		S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL, |
| 55 | 		S('c') = CHAR, S('C') = INT, | |
| 55 | 		S('c') = INT, S('C') = UINT, | |
| 56 | 56 | 		S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR, |
| 57 | 57 | 		S('m') = NOARG, |
| 58 | 58 | 		S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, |
| ... | ... | @@ -62,7 +62,7 @@ static const unsigned char states[]['z'-'A'+1] = { |
| 62 | 62 | 		S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG, |
| 63 | 63 | 		S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL, |
| 64 | 64 | 		S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL, |
| 65 | 		S('c') = INT, S('s') = PTR, S('n') = PTR, | |
| 65 | 		S('c') = UINT, S('s') = PTR, S('n') = PTR, | |
| 66 | 66 | 		S('l') = LLPRE, |
| 67 | 67 | 	}, { /* 2: ll-prefixed */ |
| 68 | 68 | 		S('d') = LLONG, S('i') = LLONG, |
| ... | ... | @@ -437,7 +437,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, |
| 437 | 437 | 	unsigned st, ps; |
| 438 | 438 | 	int cnt=0, l=0; |
| 439 | 439 | 	size_t i; |
| 440 | 	char buf[sizeof(uintmax_t)*3+3+LDBL_MANT_DIG/4]; | |
| 440 | 	char buf[sizeof(uintmax_t)*3]; | |
| 441 | 441 | 	const char *prefix; |
| 442 | 442 | 	int t, pl; |
| 443 | 443 | 	wchar_t wc[2], *ws; |
| ... | ... | @@ -588,6 +588,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, |
| 588 | 588 | 			} |
| 589 | 589 | 			p = MAX(p, z-a + !arg.i); |
| 590 | 590 | 			break; |
| 591 | 		narrow_c: | |
| 591 | 592 | 		case 'c': |
| 592 | 593 | 			*(a=z-(p=1))=arg.i; |
| 593 | 594 | 			fl &= ~ZERO_PAD; |
| ... | ... | @@ -602,6 +603,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, |
| 602 | 603 | 			fl &= ~ZERO_PAD; |
| 603 | 604 | 			break; |
| 604 | 605 | 		case 'C': |
| 606 | 			if (!arg.i) goto narrow_c; | |
| 605 | 607 | 			wc[0] = arg.i; |
| 606 | 608 | 			wc[1] = 0; |
| 607 | 609 | 			arg.p = wc; |
lib/libc/musl/src/stdio/vfwprintf.c+2-2| ... | ... | @@ -45,7 +45,7 @@ static const unsigned char states[]['z'-'A'+1] = { |
| 45 | 45 | 		S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT, |
| 46 | 46 | 		S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL, |
| 47 | 47 | 		S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL, |
| 48 | 		S('c') = CHAR, S('C') = INT, | |
| 48 | 		S('c') = INT, S('C') = UINT, | |
| 49 | 49 | 		S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR, |
| 50 | 50 | 		S('m') = NOARG, |
| 51 | 51 | 		S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, |
| ... | ... | @@ -55,7 +55,7 @@ static const unsigned char states[]['z'-'A'+1] = { |
| 55 | 55 | 		S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG, |
| 56 | 56 | 		S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL, |
| 57 | 57 | 		S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL, |
| 58 | 		S('c') = INT, S('s') = PTR, S('n') = PTR, | |
| 58 | 		S('c') = UINT, S('s') = PTR, S('n') = PTR, | |
| 59 | 59 | 		S('l') = LLPRE, |
| 60 | 60 | 	}, { /* 2: ll-prefixed */ |
| 61 | 61 | 		S('d') = LLONG, S('i') = LLONG, |
lib/libc/musl/src/stdio/vsnprintf.c-5| ... | ... | @@ -45,11 +45,6 @@ int vsnprintf(char *restrict s, size_t n, const char *restrict fmt, va_list ap) |
| 45 | 45 | 		.cookie = &c, |
| 46 | 46 | 	}; |
| 47 | 47 | |
| 48 | 	if (n > INT_MAX) { | |
| 49 | 		errno = EOVERFLOW; | |
| 50 | 		return -1; | |
| 51 | 	} | |
| 52 | ||
| 53 | 48 | 	*c.s = 0; |
| 54 | 49 | 	return vfprintf(&f, fmt, ap); |
| 55 | 50 | } |
lib/libc/musl/src/stdio/vswprintf.c-3| ... | ... | @@ -51,9 +51,6 @@ int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_lis |
| 51 | 51 | |
| 52 | 52 | 	if (!n) { |
| 53 | 53 | 		return -1; |
| 54 | 	} else if (n > INT_MAX) { | |
| 55 | 		errno = EOVERFLOW; | |
| 56 | 		return -1; | |
| 57 | 54 | 	} |
| 58 | 55 | 	r = vfwprintf(&f, fmt, ap); |
| 59 | 56 | 	sw_write(&f, 0, 0); |
lib/libc/musl/src/thread/loongarch64/__set_thread_area.s created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | .global __set_thread_area | |
| 2 | .hidden __set_thread_area | |
| 3 | .type __set_thread_area,@function | |
| 4 | __set_thread_area: | |
| 5 | 	move $tp, $a0 | |
| 6 | 	move $a0, $zero | |
| 7 | 	jr $ra |
lib/libc/musl/src/thread/loongarch64/__unmapself.s created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | .global __unmapself | |
| 2 | .type __unmapself, @function | |
| 3 | __unmapself: | |
| 4 | 	li.d $a7, 215 # call munmap | |
| 5 | 	syscall 0 | |
| 6 | 	li.d $a7, 93 # call exit | |
| 7 | 	syscall 0 |
lib/libc/musl/src/thread/loongarch64/clone.s created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | #__clone(func, stack, flags, arg, ptid, tls, ctid) | |
| 2 | # a0, a1, a2, a3, a4, a5, a6 | |
| 3 | # sys_clone(flags, stack, ptid, ctid, tls) | |
| 4 | # a0, a1, a2, a3, a4 | |
| 5 | ||
| 6 | .global __clone | |
| 7 | .hidden __clone | |
| 8 | .type __clone,@function | |
| 9 | __clone: | |
| 10 | 	bstrins.d $a1, $zero, 3, 0 #stack to 16 align | |
| 11 | 	# Save function pointer and argument pointer on new thread stack | |
| 12 | 	addi.d $a1, $a1, -16 | |
| 13 | 	st.d $a0, $a1, 0 # save function pointer | |
| 14 | 	st.d $a3, $a1, 8 # save argument pointer | |
| 15 | 	or $a0, $a2, $zero | |
| 16 | 	or $a2, $a4, $zero | |
| 17 | 	or $a3, $a6, $zero | |
| 18 | 	or $a4, $a5, $zero | |
| 19 | 	ori $a7, $zero, 220 | |
| 20 | 	syscall 0 # call clone | |
| 21 | ||
| 22 | 	beqz $a0, 1f # whether child process | |
| 23 | 	jirl $zero, $ra, 0 # parent process return | |
| 24 | 1: | |
| 25 | 	ld.d $t8, $sp, 0 # function pointer | |
| 26 | 	ld.d $a0, $sp, 8 # argument pointer | |
| 27 | 	jirl $ra, $t8, 0 # call the user's function | |
| 28 | 	ori $a7, $zero, 93 | |
| 29 | 	syscall 0 # child process exit |
lib/libc/musl/src/thread/loongarch64/syscall_cp.s created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | .global __cp_begin | |
| 2 | .hidden __cp_begin | |
| 3 | .global __cp_end | |
| 4 | .hidden __cp_end | |
| 5 | .global __cp_cancel | |
| 6 | .hidden __cp_cancel | |
| 7 | .hidden __cancel | |
| 8 | .global __syscall_cp_asm | |
| 9 | .hidden __syscall_cp_asm | |
| 10 | .type __syscall_cp_asm,@function | |
| 11 | ||
| 12 | __syscall_cp_asm: | |
| 13 | __cp_begin: | |
| 14 | 	ld.w $a0, $a0, 0 | |
| 15 | 	bnez $a0, __cp_cancel | |
| 16 | 	move $t8, $a1 # reserve system call number | |
| 17 | 	move $a0, $a2 | |
| 18 | 	move $a1, $a3 | |
| 19 | 	move $a2, $a4 | |
| 20 | 	move $a3, $a5 | |
| 21 | 	move $a4, $a6 | |
| 22 | 	move $a5, $a7 | |
| 23 | 	move $a7, $t8 | |
| 24 | 	syscall 0 | |
| 25 | __cp_end: | |
| 26 | 	jr $ra | |
| 27 | __cp_cancel: | |
| 28 | 	la.local $t8, __cancel | |
| 29 | 	jr $t8 |
lib/libc/musl/src/thread/riscv32/__set_thread_area.s created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | .global __set_thread_area | |
| 2 | .type __set_thread_area, %function | |
| 3 | __set_thread_area: | |
| 4 | 	mv tp, a0 | |
| 5 | 	li a0, 0 | |
| 6 | 	ret |
lib/libc/musl/src/thread/riscv32/__unmapself.s created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | .global __unmapself | |
| 2 | .type __unmapself, %function | |
| 3 | __unmapself: | |
| 4 | 	li a7, 215 # SYS_munmap | |
| 5 | 	ecall | |
| 6 | 	li a7, 93 # SYS_exit | |
| 7 | 	ecall |
lib/libc/musl/src/thread/riscv32/clone.s created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | # __clone(func, stack, flags, arg, ptid, tls, ctid) | |
| 2 | # a0, a1, a2, a3, a4, a5, a6 | |
| 3 | ||
| 4 | # syscall(SYS_clone, flags, stack, ptid, tls, ctid) | |
| 5 | # a7 a0, a1, a2, a3, a4 | |
| 6 | ||
| 7 | .global __clone | |
| 8 | .type __clone, %function | |
| 9 | __clone: | |
| 10 | 	# Save func and arg to stack | |
| 11 | 	addi a1, a1, -16 | |
| 12 | 	sw a0, 0(a1) | |
| 13 | 	sw a3, 4(a1) | |
| 14 | ||
| 15 | 	# Call SYS_clone | |
| 16 | 	mv a0, a2 | |
| 17 | 	mv a2, a4 | |
| 18 | 	mv a3, a5 | |
| 19 | 	mv a4, a6 | |
| 20 | 	li a7, 220 # SYS_clone | |
| 21 | 	ecall | |
| 22 | ||
| 23 | 	beqz a0, 1f | |
| 24 | 	# Parent | |
| 25 | 	ret | |
| 26 | ||
| 27 | 	# Child | |
| 28 | 1: lw a1, 0(sp) | |
| 29 | 	lw a0, 4(sp) | |
| 30 | 	jalr a1 | |
| 31 | ||
| 32 | 	# Exit | |
| 33 | 	li a7, 93 # SYS_exit | |
| 34 | 	ecall |
lib/libc/musl/src/thread/riscv32/syscall_cp.s created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | .global __cp_begin | |
| 2 | .hidden __cp_begin | |
| 3 | .global __cp_end | |
| 4 | .hidden __cp_end | |
| 5 | .global __cp_cancel | |
| 6 | .hidden __cp_cancel | |
| 7 | .hidden __cancel | |
| 8 | .global __syscall_cp_asm | |
| 9 | .hidden __syscall_cp_asm | |
| 10 | .type __syscall_cp_asm, %function | |
| 11 | __syscall_cp_asm: | |
| 12 | __cp_begin: | |
| 13 | 	lw t0, 0(a0) | |
| 14 | 	bnez t0, __cp_cancel | |
| 15 | ||
| 16 | 	mv t0, a1 | |
| 17 | 	mv a0, a2 | |
| 18 | 	mv a1, a3 | |
| 19 | 	mv a2, a4 | |
| 20 | 	mv a3, a5 | |
| 21 | 	mv a4, a6 | |
| 22 | 	mv a5, a7 | |
| 23 | 	lw a6, 0(sp) | |
| 24 | 	mv a7, t0 | |
| 25 | 	ecall | |
| 26 | __cp_end: | |
| 27 | 	ret | |
| 28 | __cp_cancel: | |
| 29 | 	tail __cancel |
lib/libc/musl/src/thread/synccall.c+5-3| ... | ... | @@ -11,7 +11,7 @@ weak_alias(dummy_0, __tl_unlock); |
| 11 | 11 | |
| 12 | 12 | static int target_tid; |
| 13 | 13 | static void (*callback)(void *), *context; |
| 14 | static sem_t target_sem, caller_sem; | |
| 14 | static sem_t target_sem, caller_sem, exit_sem; | |
| 15 | 15 | |
| 16 | 16 | static void dummy(void *p) |
| 17 | 17 | { |
| ... | ... | @@ -33,7 +33,7 @@ static void handler(int sig) |
| 33 | 33 | 	/* Inform caller we've complered the callback and wait |
| 34 | 34 | 	 * for the caller to release us to return. */ |
| 35 | 35 | 	sem_post(&caller_sem); |
| 36 | 	sem_wait(&target_sem); | |
| 36 | 	sem_wait(&exit_sem); | |
| 37 | 37 | |
| 38 | 38 | 	/* Inform caller we are returning and state is destroyable. */ |
| 39 | 39 | 	sem_post(&caller_sem); |
| ... | ... | @@ -62,6 +62,7 @@ void __synccall(void (*func)(void *), void *ctx) |
| 62 | 62 | |
| 63 | 63 | 	sem_init(&target_sem, 0, 0); |
| 64 | 64 | 	sem_init(&caller_sem, 0, 0); |
| 65 | 	sem_init(&exit_sem, 0, 0); | |
| 65 | 66 | |
| 66 | 67 | 	if (!libc.threads_minus_1 || __syscall(SYS_gettid) != self->tid) |
| 67 | 68 | 		goto single_threaded; |
| ... | ... | @@ -107,12 +108,13 @@ single_threaded: |
| 107 | 108 | 	/* Only release the caught threads once all threads, including the |
| 108 | 109 | 	 * caller, have returned from the callback function. */ |
| 109 | 110 | 	for (i=0; i<count; i++) |
| 110 | 		sem_post(&target_sem); | |
| 111 | 		sem_post(&exit_sem); | |
| 111 | 112 | 	for (i=0; i<count; i++) |
| 112 | 113 | 		sem_wait(&caller_sem); |
| 113 | 114 | |
| 114 | 115 | 	sem_destroy(&caller_sem); |
| 115 | 116 | 	sem_destroy(&target_sem); |
| 117 | 	sem_destroy(&exit_sem); | |
| 116 | 118 | |
| 117 | 119 | 	pthread_setcancelstate(cs, 0); |
| 118 | 120 | 	__tl_unlock(); |
lib/libc/musl/src/time/__year_to_secs.c+2-2| ... | ... | @@ -10,9 +10,9 @@ long long __year_to_secs(long long year, int *is_leap) |
| 10 | 10 | 		return 31536000*(y-70) + 86400*leaps; |
| 11 | 11 | 	} |
| 12 | 12 | |
| 13 | 	int cycles, centuries, leaps, rem; | |
| 13 | 	int cycles, centuries, leaps, rem, dummy; | |
| 14 | 14 | |
| 15 | 	if (!is_leap) is_leap = &(int){0}; | |
| 15 | 	if (!is_leap) is_leap = &dummy; | |
| 16 | 16 | 	cycles = (year-100) / 400; |
| 17 | 17 | 	rem = (year-100) % 400; |
| 18 | 18 | 	if (rem < 0) { |
lib/libc/musl/src/time/strftime.c+7-1| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | #include <string.h> |
| 4 | 4 | #include <langinfo.h> |
| 5 | 5 | #include <locale.h> |
| 6 | #include <ctype.h> | |
| 6 | 7 | #include <time.h> |
| 7 | 8 | #include <limits.h> |
| 8 | 9 | #include "locale_impl.h" |
| ... | ... | @@ -233,7 +234,12 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st |
| 233 | 234 | 		pad = 0; |
| 234 | 235 | 		if (*f == '-' || *f == '_' || *f == '0') pad = *f++; |
| 235 | 236 | 		if ((plus = (*f == '+'))) f++; |
| 236 | 		width = strtoul(f, &p, 10); | |
| 237 | 		if (isdigit(*f)) { | |
| 238 | 			width = strtoul(f, &p, 10); | |
| 239 | 		} else { | |
| 240 | 			width = 0; | |
| 241 | 			p = (void *)f; | |
| 242 | 		} | |
| 237 | 243 | 		if (*p == 'C' || *p == 'F' || *p == 'G' || *p == 'Y') { |
| 238 | 244 | 			if (!width && p!=f) width = 1; |
| 239 | 245 | 		} else { |
lib/libc/musl/src/time/timer_create.c+1-1| ... | ... | @@ -61,7 +61,7 @@ static void *start(void *arg) |
| 61 | 61 | |
| 62 | 62 | int timer_create(clockid_t clk, struct sigevent *restrict evp, timer_t *restrict res) |
| 63 | 63 | { |
| 64 | 	volatile static int init = 0; | |
| 64 | 	static volatile int init = 0; | |
| 65 | 65 | 	pthread_t td; |
| 66 | 66 | 	pthread_attr_t attr; |
| 67 | 67 | 	int r; |
lib/libc/musl/src/unistd/faccessat.c+1-1| ... | ... | @@ -53,7 +53,7 @@ int faccessat(int fd, const char *filename, int amode, int flag) |
| 53 | 53 | 	if (pid<0 || __syscall(SYS_read, p[0], &ret, sizeof ret) != sizeof(ret)) |
| 54 | 54 | 		ret = -EBUSY; |
| 55 | 55 | 	__syscall(SYS_close, p[0]); |
| 56 | 	__syscall(SYS_wait4, pid, &status, __WCLONE, 0); | |
| 56 | 	__sys_wait4(pid, &status, __WCLONE, 0); | |
| 57 | 57 | |
| 58 | 58 | 	__restore_sigs(&set); |
| 59 | 59 |
lib/libc/musl/src/unistd/setxid.c+1-1| ... | ... | @@ -30,5 +30,5 @@ int __setxid(int nr, int id, int eid, int sid) |
| 30 | 30 | 	 * trigger the safety kill above. */ |
| 31 | 31 | 	struct ctx c = { .nr = nr, .id = id, .eid = eid, .sid = sid, .ret = 1 }; |
| 32 | 32 | 	__synccall(do_setxid, &c); |
| 33 | 	return __syscall_ret(c.ret); | |
| 33 | 	return __syscall_ret(c.ret > 0 ? -EAGAIN : c.ret); | |
| 34 | 34 | } |
lib/std/zig/target.zig+2| ... | ... | @@ -102,10 +102,12 @@ pub fn muslArchName(arch: std.Target.Cpu.Arch) [:0]const u8 { |
| 102 | 102 | .aarch64, .aarch64_be => return "aarch64", |
| 103 | 103 | .arm, .armeb, .thumb, .thumbeb => return "arm", |
| 104 | 104 | .x86 => return "i386", |
| 105 | .loongarch64 => return "loongarch64", | |
| 105 | 106 | .mips, .mipsel => return "mips", |
| 106 | 107 | .mips64el, .mips64 => return "mips64", |
| 107 | 108 | .powerpc => return "powerpc", |
| 108 | 109 | .powerpc64, .powerpc64le => return "powerpc64", |
| 110 | .riscv32 => return "riscv32", | |
| 109 | 111 | .riscv64 => return "riscv64", |
| 110 | 112 | .s390x => return "s390x", |
| 111 | 113 | .wasm32, .wasm64 => return "wasm", |
src/musl.zig+41-1| ... | ... | @@ -314,6 +314,7 @@ fn isMuslArchName(name: []const u8) bool { |
| 314 | 314 | "arm", |
| 315 | 315 | "generic", |
| 316 | 316 | "i386", |
| 317 | "loongarch64", | |
| 317 | 318 | "m68k", |
| 318 | 319 | "microblaze", |
| 319 | 320 | "mips", |
| ... | ... | @@ -322,6 +323,7 @@ fn isMuslArchName(name: []const u8) bool { |
| 322 | 323 | "or1k", |
| 323 | 324 | "powerpc", |
| 324 | 325 | "powerpc64", |
| 326 | "riscv32", | |
| 325 | 327 | "riscv64", |
| 326 | 328 | "s390x", |
| 327 | 329 | "sh", |
| ... | ... | @@ -607,6 +609,7 @@ const src_files = [_][]const u8{ |
| 607 | 609 | "musl/src/fenv/fesetround.c", |
| 608 | 610 | "musl/src/fenv/feupdateenv.c", |
| 609 | 611 | "musl/src/fenv/i386/fenv.s", |
| 612 | "musl/src/fenv/loongarch64/fenv.S", | |
| 610 | 613 | "musl/src/fenv/m68k/fenv.c", |
| 611 | 614 | "musl/src/fenv/mips/fenv-sf.c", |
| 612 | 615 | "musl/src/fenv/mips/fenv.S", |
| ... | ... | @@ -617,6 +620,8 @@ const src_files = [_][]const u8{ |
| 617 | 620 | "musl/src/fenv/powerpc/fenv-sf.c", |
| 618 | 621 | "musl/src/fenv/powerpc/fenv.S", |
| 619 | 622 | "musl/src/fenv/powerpc64/fenv.c", |
| 623 | "musl/src/fenv/riscv32/fenv-sf.c", | |
| 624 | "musl/src/fenv/riscv32/fenv.S", | |
| 620 | 625 | "musl/src/fenv/riscv64/fenv-sf.c", |
| 621 | 626 | "musl/src/fenv/riscv64/fenv.S", |
| 622 | 627 | "musl/src/fenv/s390x/fenv.c", |
| ... | ... | @@ -625,6 +630,7 @@ const src_files = [_][]const u8{ |
| 625 | 630 | "musl/src/fenv/x32/fenv.s", |
| 626 | 631 | "musl/src/fenv/x86_64/fenv.s", |
| 627 | 632 | "musl/src/internal/defsysinfo.c", |
| 633 | "musl/src/internal/emulate_wait4.c", | |
| 628 | 634 | "musl/src/internal/floatscan.c", |
| 629 | 635 | "musl/src/internal/i386/defsysinfo.s", |
| 630 | 636 | "musl/src/internal/intscan.c", |
| ... | ... | @@ -665,6 +671,7 @@ const src_files = [_][]const u8{ |
| 665 | 671 | "musl/src/ldso/i386/dlsym.s", |
| 666 | 672 | "musl/src/ldso/i386/dlsym_time64.S", |
| 667 | 673 | "musl/src/ldso/i386/tlsdesc.s", |
| 674 | "musl/src/ldso/loongarch64/dlsym.s", | |
| 668 | 675 | "musl/src/ldso/m68k/dlsym.s", |
| 669 | 676 | "musl/src/ldso/m68k/dlsym_time64.S", |
| 670 | 677 | "musl/src/ldso/microblaze/dlsym.s", |
| ... | ... | @@ -679,7 +686,9 @@ const src_files = [_][]const u8{ |
| 679 | 686 | "musl/src/ldso/powerpc/dlsym.s", |
| 680 | 687 | "musl/src/ldso/powerpc/dlsym_time64.S", |
| 681 | 688 | "musl/src/ldso/powerpc64/dlsym.s", |
| 689 | "musl/src/ldso/riscv32/dlsym.s", | |
| 682 | 690 | "musl/src/ldso/riscv64/dlsym.s", |
| 691 | "musl/src/ldso/riscv64/tlsdesc.s", | |
| 683 | 692 | "musl/src/ldso/s390x/dlsym.s", |
| 684 | 693 | "musl/src/ldso/sh/dlsym.s", |
| 685 | 694 | "musl/src/ldso/sh/dlsym_time64.S", |
| ... | ... | @@ -734,11 +743,12 @@ const src_files = [_][]const u8{ |
| 734 | 743 | "musl/src/linux/open_by_handle_at.c", |
| 735 | 744 | "musl/src/linux/personality.c", |
| 736 | 745 | "musl/src/linux/pivot_root.c", |
| 737 | "musl/src/linux/ppoll.c", | |
| 738 | 746 | "musl/src/linux/prctl.c", |
| 747 | "musl/src/linux/preadv2.c", | |
| 739 | 748 | "musl/src/linux/prlimit.c", |
| 740 | 749 | "musl/src/linux/process_vm.c", |
| 741 | 750 | "musl/src/linux/ptrace.c", |
| 751 | "musl/src/linux/pwritev2.c", | |
| 742 | 752 | "musl/src/linux/quotactl.c", |
| 743 | 753 | "musl/src/linux/readahead.c", |
| 744 | 754 | "musl/src/linux/reboot.c", |
| ... | ... | @@ -753,6 +763,7 @@ const src_files = [_][]const u8{ |
| 753 | 763 | "musl/src/linux/settimeofday.c", |
| 754 | 764 | "musl/src/linux/signalfd.c", |
| 755 | 765 | "musl/src/linux/splice.c", |
| 766 | "musl/src/linux/statx.c", | |
| 756 | 767 | "musl/src/linux/stime.c", |
| 757 | 768 | "musl/src/linux/swap.c", |
| 758 | 769 | "musl/src/linux/sync_file_range.c", |
| ... | ... | @@ -1147,6 +1158,18 @@ const src_files = [_][]const u8{ |
| 1147 | 1158 | "musl/src/math/rint.c", |
| 1148 | 1159 | "musl/src/math/rintf.c", |
| 1149 | 1160 | "musl/src/math/rintl.c", |
| 1161 | "musl/src/math/riscv32/copysign.c", | |
| 1162 | "musl/src/math/riscv32/copysignf.c", | |
| 1163 | "musl/src/math/riscv32/fabs.c", | |
| 1164 | "musl/src/math/riscv32/fabsf.c", | |
| 1165 | "musl/src/math/riscv32/fma.c", | |
| 1166 | "musl/src/math/riscv32/fmaf.c", | |
| 1167 | "musl/src/math/riscv32/fmax.c", | |
| 1168 | "musl/src/math/riscv32/fmaxf.c", | |
| 1169 | "musl/src/math/riscv32/fmin.c", | |
| 1170 | "musl/src/math/riscv32/fminf.c", | |
| 1171 | "musl/src/math/riscv32/sqrt.c", | |
| 1172 | "musl/src/math/riscv32/sqrtf.c", | |
| 1150 | 1173 | "musl/src/math/riscv64/copysign.c", |
| 1151 | 1174 | "musl/src/math/riscv64/copysignf.c", |
| 1152 | 1175 | "musl/src/math/riscv64/fabs.c", |
| ... | ... | @@ -1546,6 +1569,7 @@ const src_files = [_][]const u8{ |
| 1546 | 1569 | "musl/src/search/tsearch.c", |
| 1547 | 1570 | "musl/src/search/twalk.c", |
| 1548 | 1571 | "musl/src/select/poll.c", |
| 1572 | "musl/src/select/ppoll.c", | |
| 1549 | 1573 | "musl/src/select/pselect.c", |
| 1550 | 1574 | "musl/src/select/select.c", |
| 1551 | 1575 | "musl/src/setjmp/aarch64/longjmp.s", |
| ... | ... | @@ -1555,6 +1579,8 @@ const src_files = [_][]const u8{ |
| 1555 | 1579 | "musl/src/setjmp/i386/longjmp.s", |
| 1556 | 1580 | "musl/src/setjmp/i386/setjmp.s", |
| 1557 | 1581 | "musl/src/setjmp/longjmp.c", |
| 1582 | "musl/src/setjmp/loongarch64/longjmp.S", | |
| 1583 | "musl/src/setjmp/loongarch64/setjmp.S", | |
| 1558 | 1584 | "musl/src/setjmp/m68k/longjmp.s", |
| 1559 | 1585 | "musl/src/setjmp/m68k/setjmp.s", |
| 1560 | 1586 | "musl/src/setjmp/microblaze/longjmp.s", |
| ... | ... | @@ -1571,6 +1597,8 @@ const src_files = [_][]const u8{ |
| 1571 | 1597 | "musl/src/setjmp/powerpc/setjmp.S", |
| 1572 | 1598 | "musl/src/setjmp/powerpc64/longjmp.s", |
| 1573 | 1599 | "musl/src/setjmp/powerpc64/setjmp.s", |
| 1600 | "musl/src/setjmp/riscv32/longjmp.S", | |
| 1601 | "musl/src/setjmp/riscv32/setjmp.S", | |
| 1574 | 1602 | "musl/src/setjmp/riscv64/longjmp.S", |
| 1575 | 1603 | "musl/src/setjmp/riscv64/setjmp.S", |
| 1576 | 1604 | "musl/src/setjmp/s390x/longjmp.s", |
| ... | ... | @@ -1592,6 +1620,8 @@ const src_files = [_][]const u8{ |
| 1592 | 1620 | "musl/src/signal/i386/sigsetjmp.s", |
| 1593 | 1621 | "musl/src/signal/kill.c", |
| 1594 | 1622 | "musl/src/signal/killpg.c", |
| 1623 | "musl/src/signal/loongarch64/restore.s", | |
| 1624 | "musl/src/signal/loongarch64/sigsetjmp.s", | |
| 1595 | 1625 | "musl/src/signal/m68k/sigsetjmp.s", |
| 1596 | 1626 | "musl/src/signal/microblaze/restore.s", |
| 1597 | 1627 | "musl/src/signal/microblaze/sigsetjmp.s", |
| ... | ... | @@ -1607,6 +1637,8 @@ const src_files = [_][]const u8{ |
| 1607 | 1637 | "musl/src/signal/psignal.c", |
| 1608 | 1638 | "musl/src/signal/raise.c", |
| 1609 | 1639 | "musl/src/signal/restore.c", |
| 1640 | "musl/src/signal/riscv32/restore.s", | |
| 1641 | "musl/src/signal/riscv32/sigsetjmp.s", | |
| 1610 | 1642 | "musl/src/signal/riscv64/restore.s", |
| 1611 | 1643 | "musl/src/signal/riscv64/sigsetjmp.s", |
| 1612 | 1644 | "musl/src/signal/s390x/restore.s", |
| ... | ... | @@ -1943,6 +1975,10 @@ const src_files = [_][]const u8{ |
| 1943 | 1975 | "musl/src/thread/i386/syscall_cp.s", |
| 1944 | 1976 | "musl/src/thread/i386/tls.s", |
| 1945 | 1977 | "musl/src/thread/lock_ptc.c", |
| 1978 | "musl/src/thread/loongarch64/__set_thread_area.s", | |
| 1979 | "musl/src/thread/loongarch64/__unmapself.s", | |
| 1980 | "musl/src/thread/loongarch64/clone.s", | |
| 1981 | "musl/src/thread/loongarch64/syscall_cp.s", | |
| 1946 | 1982 | "musl/src/thread/m68k/__m68k_read_tp.s", |
| 1947 | 1983 | "musl/src/thread/m68k/clone.s", |
| 1948 | 1984 | "musl/src/thread/m68k/syscall_cp.s", |
| ... | ... | @@ -2063,6 +2099,10 @@ const src_files = [_][]const u8{ |
| 2063 | 2099 | "musl/src/thread/pthread_spin_trylock.c", |
| 2064 | 2100 | "musl/src/thread/pthread_spin_unlock.c", |
| 2065 | 2101 | "musl/src/thread/pthread_testcancel.c", |
| 2102 | "musl/src/thread/riscv32/__set_thread_area.s", | |
| 2103 | "musl/src/thread/riscv32/__unmapself.s", | |
| 2104 | "musl/src/thread/riscv32/clone.s", | |
| 2105 | "musl/src/thread/riscv32/syscall_cp.s", | |
| 2066 | 2106 | "musl/src/thread/riscv64/__set_thread_area.s", |
| 2067 | 2107 | "musl/src/thread/riscv64/__unmapself.s", |
| 2068 | 2108 | "musl/src/thread/riscv64/clone.s", |