diff options
Diffstat (limited to 'libc-top-half/musl/arch/mips')
34 files changed, 1688 insertions, 0 deletions
diff --git a/libc-top-half/musl/arch/mips/arch.mak b/libc-top-half/musl/arch/mips/arch.mak new file mode 100644 index 0000000..aa4d05c --- /dev/null +++ b/libc-top-half/musl/arch/mips/arch.mak @@ -0,0 +1 @@ +COMPAT_SRC_DIRS = compat/time32 diff --git a/libc-top-half/musl/arch/mips/atomic_arch.h b/libc-top-half/musl/arch/mips/atomic_arch.h new file mode 100644 index 0000000..1248d17 --- /dev/null +++ b/libc-top-half/musl/arch/mips/atomic_arch.h @@ -0,0 +1,58 @@ +#if __mips_isa_rev < 6 +#define LLSC_M "m" +#else +#define LLSC_M "ZC" +#endif + +#define a_ll a_ll +static inline int a_ll(volatile int *p) +{ + int v; +#if __mips < 2 + __asm__ __volatile__ ( + ".set push ; .set mips2\n\t" + "ll %0, %1" + "\n\t.set pop" + : "=r"(v) : "m"(*p)); +#else + __asm__ __volatile__ ( + "ll %0, %1" + : "=r"(v) : LLSC_M(*p)); +#endif + return v; +} + +#define a_sc a_sc +static inline int a_sc(volatile int *p, int v) +{ + int r; +#if __mips < 2 + __asm__ __volatile__ ( + ".set push ; .set mips2\n\t" + "sc %0, %1" + "\n\t.set pop" + : "=r"(r), "=m"(*p) : "0"(v) : "memory"); +#else + __asm__ __volatile__ ( + "sc %0, %1" + : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory"); +#endif + return r; +} + +#define a_barrier a_barrier +static inline void a_barrier() +{ +#if __mips < 2 + /* mips2 sync, but using too many directives causes + * gcc not to inline it, so encode with .long instead. */ + __asm__ __volatile__ (".long 0xf" : : : "memory"); +#else + __asm__ __volatile__ ("sync" : : : "memory"); +#endif +} + +#define a_pre_llsc a_barrier +#define a_post_llsc a_barrier + +#undef LLSC_M diff --git a/libc-top-half/musl/arch/mips/bits/alltypes.h.in b/libc-top-half/musl/arch/mips/bits/alltypes.h.in new file mode 100644 index 0000000..ff934a4 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/alltypes.h.in @@ -0,0 +1,21 @@ +#define _REDIR_TIME64 1 +#define _Addr int +#define _Int64 long long +#define _Reg int + +#if _MIPSEL || __MIPSEL || __MIPSEL__ +#define __BYTE_ORDER 1234 +#else +#define __BYTE_ORDER 4321 +#endif + +#define __LONG_MAX 0x7fffffffL + +#ifndef __cplusplus +TYPEDEF int wchar_t; +#endif + +TYPEDEF float float_t; +TYPEDEF double double_t; + +TYPEDEF struct { long long __ll; long double __ld; } max_align_t; diff --git a/libc-top-half/musl/arch/mips/bits/errno.h b/libc-top-half/musl/arch/mips/bits/errno.h new file mode 100644 index 0000000..1bb91e3 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/errno.h @@ -0,0 +1,134 @@ +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define ENOMSG 35 +#define EIDRM 36 +#define ECHRNG 37 +#define EL2NSYNC 38 +#define EL3HLT 39 +#define EL3RST 40 +#define ELNRNG 41 +#define EUNATCH 42 +#define ENOCSI 43 +#define EL2HLT 44 +#define EDEADLK 45 +#define ENOLCK 46 +#define EBADE 50 +#define EBADR 51 +#define EXFULL 52 +#define ENOANO 53 +#define EBADRQC 54 +#define EBADSLT 55 +#define EDEADLOCK 56 +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EDOTDOT 73 +#define EMULTIHOP 74 +#define EBADMSG 77 +#define ENAMETOOLONG 78 +#define EOVERFLOW 79 +#define ENOTUNIQ 80 +#define EBADFD 81 +#define EREMCHG 82 +#define ELIBACC 83 +#define ELIBBAD 84 +#define ELIBSCN 85 +#define ELIBMAX 86 +#define ELIBEXEC 87 +#define EILSEQ 88 +#define ENOSYS 89 +#define ELOOP 90 +#define ERESTART 91 +#define ESTRPIPE 92 +#define ENOTEMPTY 93 +#define EUSERS 94 +#define ENOTSOCK 95 +#define EDESTADDRREQ 96 +#define EMSGSIZE 97 +#define EPROTOTYPE 98 +#define ENOPROTOOPT 99 +#define EPROTONOSUPPORT 120 +#define ESOCKTNOSUPPORT 121 +#define EOPNOTSUPP 122 +#define ENOTSUP EOPNOTSUPP +#define EPFNOSUPPORT 123 +#define EAFNOSUPPORT 124 +#define EADDRINUSE 125 +#define EADDRNOTAVAIL 126 +#define ENETDOWN 127 +#define ENETUNREACH 128 +#define ENETRESET 129 +#define ECONNABORTED 130 +#define ECONNRESET 131 +#define ENOBUFS 132 +#define EISCONN 133 +#define ENOTCONN 134 +#define EUCLEAN 135 +#define ENOTNAM 137 +#define ENAVAIL 138 +#define EISNAM 139 +#define EREMOTEIO 140 +#define ESHUTDOWN 143 +#define ETOOMANYREFS 144 +#define ETIMEDOUT 145 +#define ECONNREFUSED 146 +#define EHOSTDOWN 147 +#define EHOSTUNREACH 148 +#define EWOULDBLOCK EAGAIN +#define EALREADY 149 +#define EINPROGRESS 150 +#define ESTALE 151 +#define ECANCELED 158 +#define ENOMEDIUM 159 +#define EMEDIUMTYPE 160 +#define ENOKEY 161 +#define EKEYEXPIRED 162 +#define EKEYREVOKED 163 +#define EKEYREJECTED 164 +#define EOWNERDEAD 165 +#define ENOTRECOVERABLE 166 +#define ERFKILL 167 +#define EHWPOISON 168 +#define EDQUOT 1133 diff --git a/libc-top-half/musl/arch/mips/bits/fcntl.h b/libc-top-half/musl/arch/mips/bits/fcntl.h new file mode 100644 index 0000000..9fd8c23 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/fcntl.h @@ -0,0 +1,40 @@ +#define O_CREAT 0400 +#define O_EXCL 02000 +#define O_NOCTTY 04000 +#define O_TRUNC 01000 +#define O_APPEND 0010 +#define O_NONBLOCK 0200 +#define O_DSYNC 0020 +#define O_SYNC 040020 +#define O_RSYNC 040020 +#define O_DIRECTORY 0200000 +#define O_NOFOLLOW 0400000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 010000 +#define O_DIRECT 0100000 +#define O_LARGEFILE 020000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020200000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 24 +#define F_GETOWN 23 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK 33 +#define F_SETLK 34 +#define F_SETLKW 35 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/libc-top-half/musl/arch/mips/bits/fenv.h b/libc-top-half/musl/arch/mips/bits/fenv.h new file mode 100644 index 0000000..589e71c --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/fenv.h @@ -0,0 +1,25 @@ +#ifdef __mips_soft_float +#define FE_ALL_EXCEPT 0 +#define FE_TONEAREST 0 +#else +#define FE_INEXACT 4 +#define FE_UNDERFLOW 8 +#define FE_OVERFLOW 16 +#define FE_DIVBYZERO 32 +#define FE_INVALID 64 + +#define FE_ALL_EXCEPT 124 + +#define FE_TONEAREST 0 +#define FE_TOWARDZERO 1 +#define FE_UPWARD 2 +#define FE_DOWNWARD 3 +#endif + +typedef unsigned short fexcept_t; + +typedef struct { + unsigned __cw; +} fenv_t; + +#define FE_DFL_ENV ((const fenv_t *) -1) diff --git a/libc-top-half/musl/arch/mips/bits/float.h b/libc-top-half/musl/arch/mips/bits/float.h new file mode 100644 index 0000000..c4a655e --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 4.94065645841246544177e-324L +#define LDBL_MIN 2.22507385850720138309e-308L +#define LDBL_MAX 1.79769313486231570815e+308L +#define LDBL_EPSILON 2.22044604925031308085e-16L + +#define LDBL_MANT_DIG 53 +#define LDBL_MIN_EXP (-1021) +#define LDBL_MAX_EXP 1024 + +#define LDBL_DIG 15 +#define LDBL_MIN_10_EXP (-307) +#define LDBL_MAX_10_EXP 308 + +#define DECIMAL_DIG 17 diff --git a/libc-top-half/musl/arch/mips/bits/hwcap.h b/libc-top-half/musl/arch/mips/bits/hwcap.h new file mode 100644 index 0000000..7986deb --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/hwcap.h @@ -0,0 +1,14 @@ +#define HWCAP_MIPS_R6 (1 << 0) +#define HWCAP_MIPS_MSA (1 << 1) +#define HWCAP_MIPS_CRC32 (1 << 2) +#define HWCAP_MIPS_MIPS16 (1 << 3) +#define HWCAP_MIPS_MDMX (1 << 4) +#define HWCAP_MIPS_MIPS3D (1 << 5) +#define HWCAP_MIPS_SMARTMIPS (1 << 6) +#define HWCAP_MIPS_DSP (1 << 7) +#define HWCAP_MIPS_DSP2 (1 << 8) +#define HWCAP_MIPS_DSP3 (1 << 9) +#define HWCAP_MIPS_MIPS16E2 (1 << 10) +#define HWCAP_LOONGSON_MMI (1 << 11) +#define HWCAP_LOONGSON_EXT (1 << 12) +#define HWCAP_LOONGSON_EXT2 (1 << 13) diff --git a/libc-top-half/musl/arch/mips/bits/ioctl.h b/libc-top-half/musl/arch/mips/bits/ioctl.h new file mode 100644 index 0000000..e20bf19 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/ioctl.h @@ -0,0 +1,114 @@ +#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) ) +#define _IOC_NONE 1U +#define _IOC_READ 2U +#define _IOC_WRITE 4U + +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) + +#define TCGETA 0x5401 +#define TCSETA 0x5402 +#define TCSETAW 0x5403 +#define TCSETAF 0x5404 +#define TCSBRK 0x5405 +#define TCXONC 0x5406 +#define TCFLSH 0x5407 +#define TCGETS 0x540D +#define TCSETS 0x540E +#define TCSETSW 0x540F +#define TCSETSF 0x5410 + +#define TIOCEXCL 0x740D +#define TIOCNXCL 0x740E +#define TIOCOUTQ 0x7472 +#define TIOCSTI 0x5472 +#define TIOCMGET 0x741D +#define TIOCMBIS 0x741B +#define TIOCMBIC 0x741C +#define TIOCMSET 0x741A + +#define TIOCPKT 0x5470 +#define TIOCSWINSZ _IOW('t', 103, struct winsize) +#define TIOCGWINSZ _IOR('t', 104, struct winsize) +#define TIOCNOTTY 0x5471 +#define TIOCSETD 0x7401 +#define TIOCGETD 0x7400 + +#define FIOCLEX 0x6601 +#define FIONCLEX 0x6602 +#define FIOASYNC 0x667D +#define FIONBIO 0x667E +#define FIOQSIZE 0x667F + +#define TIOCGLTC 0x7474 +#define TIOCSLTC 0x7475 +#define TIOCSPGRP _IOW('t', 118, int) +#define TIOCGPGRP _IOR('t', 119, int) +#define TIOCCONS _IOW('t', 120, int) + +#define FIONREAD 0x467F +#define TIOCINQ FIONREAD + +#define TIOCGETP 0x7408 +#define TIOCSETP 0x7409 +#define TIOCSETN 0x740A + +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x7416 +#define TIOCGRS485 _IOR('T', 0x2E, char[32]) +#define TIOCSRS485 _IOWR('T', 0x2F, char[32]) +#define TIOCGPTN _IOR('T', 0x30, unsigned int) +#define TIOCSPTLCK _IOW('T', 0x31, int) +#define TIOCGDEV _IOR('T', 0x32, unsigned int) +#define TIOCSIG _IOW('T', 0x36, int) +#define TIOCVHANGUP 0x5437 +#define TIOCGPKT _IOR('T', 0x38, int) +#define TIOCGPTLCK _IOR('T', 0x39, int) +#define TIOCGEXCL _IOR('T', 0x40, int) +#define TIOCGPTPEER _IO('T', 0x41) + +#define TIOCSCTTY 0x5480 +#define TIOCGSOFTCAR 0x5481 +#define TIOCSSOFTCAR 0x5482 +#define TIOCLINUX 0x5483 +#define TIOCGSERIAL 0x5484 +#define TIOCSSERIAL 0x5485 +#define TCSBRKP 0x5486 + +#define TIOCSERCONFIG 0x5488 +#define TIOCSERGWILD 0x5489 +#define TIOCSERSWILD 0x548A +#define TIOCGLCKTRMIOS 0x548B +#define TIOCSLCKTRMIOS 0x548C +#define TIOCSERGSTRUCT 0x548D +#define TIOCSERGETLSR 0x548E +#define TIOCSERGETMULTI 0x548F +#define TIOCSERSETMULTI 0x5490 +#define TIOCMIWAIT 0x5491 +#define TIOCGICOUNT 0x5492 + +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x010 +#define TIOCM_SR 0x020 +#define TIOCM_CTS 0x040 +#define TIOCM_CAR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RNG 0x200 +#define TIOCM_RI TIOCM_RNG +#define TIOCM_DSR 0x400 +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +#define FIOGETOWN _IOR('f', 123, int) +#define FIOSETOWN _IOW('f', 124, int) +#define SIOCATMARK _IOR('s', 7, int) +#define SIOCSPGRP _IOW('s', 8, pid_t) +#define SIOCGPGRP _IOR('s', 9, pid_t) +#define SIOCGSTAMP _IOR(0x89, 6, char[16]) +#define SIOCGSTAMPNS _IOR(0x89, 7, char[16]) diff --git a/libc-top-half/musl/arch/mips/bits/ipcstat.h b/libc-top-half/musl/arch/mips/bits/ipcstat.h new file mode 100644 index 0000000..4f4fcb0 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/ipcstat.h @@ -0,0 +1 @@ +#define IPC_STAT 0x102 diff --git a/libc-top-half/musl/arch/mips/bits/mman.h b/libc-top-half/musl/arch/mips/bits/mman.h new file mode 100644 index 0000000..9027bb6 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/mman.h @@ -0,0 +1,25 @@ +#undef MAP_ANON +#define MAP_ANON 0x800 +#undef MAP_NORESERVE +#define MAP_NORESERVE 0x0400 +#undef MAP_GROWSDOWN +#define MAP_GROWSDOWN 0x1000 +#undef MAP_DENYWRITE +#define MAP_DENYWRITE 0x2000 +#undef MAP_EXECUTABLE +#define MAP_EXECUTABLE 0x4000 +#undef MAP_LOCKED +#define MAP_LOCKED 0x8000 +#undef MAP_POPULATE +#define MAP_POPULATE 0x10000 +#undef MAP_NONBLOCK +#define MAP_NONBLOCK 0x20000 +#undef MAP_STACK +#define MAP_STACK 0x40000 +#undef MAP_HUGETLB +#define MAP_HUGETLB 0x80000 +#undef MAP_SYNC + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#undef MADV_SOFT_OFFLINE +#endif diff --git a/libc-top-half/musl/arch/mips/bits/msg.h b/libc-top-half/musl/arch/mips/bits/msg.h new file mode 100644 index 0000000..c734dbb --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/msg.h @@ -0,0 +1,27 @@ +struct msqid_ds { + struct ipc_perm msg_perm; +#if _MIPSEL || __MIPSEL || __MIPSEL__ + unsigned long __msg_stime_lo; + unsigned long __msg_stime_hi; + unsigned long __msg_rtime_lo; + unsigned long __msg_rtime_hi; + unsigned long __msg_ctime_lo; + unsigned long __msg_ctime_hi; +#else + unsigned long __msg_stime_hi; + unsigned long __msg_stime_lo; + unsigned long __msg_rtime_hi; + unsigned long __msg_rtime_lo; + unsigned long __msg_ctime_hi; + unsigned long __msg_ctime_lo; +#endif + unsigned long msg_cbytes; + msgqnum_t msg_qnum; + msglen_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + unsigned long __unused[2]; + time_t msg_stime; + time_t msg_rtime; + time_t msg_ctime; +}; diff --git a/libc-top-half/musl/arch/mips/bits/poll.h b/libc-top-half/musl/arch/mips/bits/poll.h new file mode 100644 index 0000000..b0b1ed6 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/poll.h @@ -0,0 +1,2 @@ +#define POLLWRNORM POLLOUT +#define POLLWRBAND 0x100 diff --git a/libc-top-half/musl/arch/mips/bits/posix.h b/libc-top-half/musl/arch/mips/bits/posix.h new file mode 100644 index 0000000..30a3871 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_ILP32_OFFBIG 1 +#define _POSIX_V7_ILP32_OFFBIG 1 diff --git a/libc-top-half/musl/arch/mips/bits/ptrace.h b/libc-top-half/musl/arch/mips/bits/ptrace.h new file mode 100644 index 0000000..77a01c0 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/ptrace.h @@ -0,0 +1,9 @@ +#define PTRACE_GET_THREAD_AREA 25 +#define PTRACE_SET_THREAD_AREA 26 +#define PTRACE_PEEKTEXT_3264 0xc0 +#define PTRACE_PEEKDATA_3264 0xc1 +#define PTRACE_POKETEXT_3264 0xc2 +#define PTRACE_POKEDATA_3264 0xc3 +#define PTRACE_GET_THREAD_AREA_3264 0xc4 +#define PTRACE_GET_WATCH_REGS 0xd0 +#define PTRACE_SET_WATCH_REGS 0xd1 diff --git a/libc-top-half/musl/arch/mips/bits/reg.h b/libc-top-half/musl/arch/mips/bits/reg.h new file mode 100644 index 0000000..0c37098 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/reg.h @@ -0,0 +1,47 @@ +#undef __WORDSIZE +#define __WORDSIZE 32 + +#define EF_R0 6 +#define EF_R1 7 +#define EF_R2 8 +#define EF_R3 9 +#define EF_R4 10 +#define EF_R5 11 +#define EF_R6 12 +#define EF_R7 13 +#define EF_R8 14 +#define EF_R9 15 +#define EF_R10 16 +#define EF_R11 17 +#define EF_R12 18 +#define EF_R13 19 +#define EF_R14 20 +#define EF_R15 21 +#define EF_R16 22 +#define EF_R17 23 +#define EF_R18 24 +#define EF_R19 25 +#define EF_R20 26 +#define EF_R21 27 +#define EF_R22 28 +#define EF_R23 29 +#define EF_R24 30 +#define EF_R25 31 + +#define EF_R26 32 +#define EF_R27 33 +#define EF_R28 34 +#define EF_R29 35 +#define EF_R30 36 +#define EF_R31 37 + +#define EF_LO 38 +#define EF_HI 39 + +#define EF_CP0_EPC 40 +#define EF_CP0_BADVADDR 41 +#define EF_CP0_STATUS 42 +#define EF_CP0_CAUSE 43 +#define EF_UNUSED0 44 + +#define EF_SIZE 180 diff --git a/libc-top-half/musl/arch/mips/bits/resource.h b/libc-top-half/musl/arch/mips/bits/resource.h new file mode 100644 index 0000000..414a405 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/resource.h @@ -0,0 +1,5 @@ +#define RLIMIT_NOFILE 5 +#define RLIMIT_AS 6 +#define RLIMIT_RSS 7 +#define RLIMIT_NPROC 8 +#define RLIMIT_MEMLOCK 9 diff --git a/libc-top-half/musl/arch/mips/bits/sem.h b/libc-top-half/musl/arch/mips/bits/sem.h new file mode 100644 index 0000000..fe6f094 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/sem.h @@ -0,0 +1,16 @@ +struct semid_ds { + struct ipc_perm sem_perm; + unsigned long __sem_otime_lo; + unsigned long __sem_ctime_lo; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned short sem_nsems; + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; +#else + char __sem_nsems_pad[sizeof(long)-sizeof(short)]; + unsigned short sem_nsems; +#endif + unsigned long __sem_otime_hi; + unsigned long __sem_ctime_hi; + time_t sem_otime; + time_t sem_ctime; +}; diff --git a/libc-top-half/musl/arch/mips/bits/setjmp.h b/libc-top-half/musl/arch/mips/bits/setjmp.h new file mode 100644 index 0000000..30229a0 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long long __jmp_buf[13]; diff --git a/libc-top-half/musl/arch/mips/bits/shm.h b/libc-top-half/musl/arch/mips/bits/shm.h new file mode 100644 index 0000000..ab8c642 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/shm.h @@ -0,0 +1,29 @@ +#define SHMLBA 4096 + +struct shmid_ds { + struct ipc_perm shm_perm; + size_t shm_segsz; + unsigned long __shm_atime_lo; + unsigned long __shm_dtime_lo; + unsigned long __shm_ctime_lo; + pid_t shm_cpid; + pid_t shm_lpid; + unsigned long shm_nattch; + unsigned short __shm_atime_hi; + unsigned short __shm_dtime_hi; + unsigned short __shm_ctime_hi; + unsigned short __pad1; + time_t shm_atime; + time_t shm_dtime; + time_t shm_ctime; +}; + +struct shminfo { + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4]; +}; + +struct shm_info { + int __used_ids; + unsigned long shm_tot, shm_rss, shm_swp; + unsigned long __swap_attempts, __swap_successes; +}; diff --git a/libc-top-half/musl/arch/mips/bits/signal.h b/libc-top-half/musl/arch/mips/bits/signal.h new file mode 100644 index 0000000..1b69e76 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/signal.h @@ -0,0 +1,124 @@ +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +typedef unsigned long long greg_t, gregset_t[32]; +typedef struct { + union { + double fp_dregs[32]; + struct { + float _fp_fregs; + unsigned _fp_pad; + } fp_fregs[32]; + } fp_r; +} fpregset_t; +struct sigcontext { + unsigned sc_regmask, sc_status; + unsigned long long sc_pc; + gregset_t sc_regs; + fpregset_t sc_fpregs; + unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp; + unsigned long long sc_mdhi, sc_mdlo; + unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3; +}; +typedef struct { + unsigned regmask, status; + unsigned long long pc; + gregset_t gregs; + fpregset_t fpregs; + unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp; + unsigned long long mdhi, mdlo; + unsigned long hi1, lo1, hi2, lo2, hi3, lo3; +} mcontext_t; +#else +typedef struct { + unsigned __mc1[2]; + unsigned long long __mc2[65]; + unsigned __mc3[5]; + unsigned long long __mc4[2]; + unsigned __mc5[6]; +} mcontext_t; +#endif + +struct sigaltstack { + void *ss_sp; + size_t ss_size; + int ss_flags; +}; + +typedef struct __ucontext { + unsigned long uc_flags; + struct __ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; +} ucontext_t; + +#define SA_NOCLDSTOP 1 +#define SA_NOCLDWAIT 0x10000 +#define SA_SIGINFO 8 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_RESTORER 0x04000000 + +#undef SIG_BLOCK +#undef SIG_UNBLOCK +#undef SIG_SETMASK +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 + +#undef SI_ASYNCIO +#undef SI_MESGQ +#undef SI_TIMER +#define SI_ASYNCIO (-2) +#define SI_MESGQ (-4) +#define SI_TIMER (-3) + +#define __SI_SWAP_ERRNO_CODE + +#endif + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGEMT 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGBUS 10 +#define SIGSEGV 11 +#define SIGSYS 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGUSR1 16 +#define SIGUSR2 17 +#define SIGCHLD 18 +#define SIGPWR 19 +#define SIGWINCH 20 +#define SIGURG 21 +#define SIGIO 22 +#define SIGPOLL SIGIO +#define SIGSTOP 23 +#define SIGTSTP 24 +#define SIGCONT 25 +#define SIGTTIN 26 +#define SIGTTOU 27 +#define SIGVTALRM 28 +#define SIGPROF 29 +#define SIGXCPU 30 +#define SIGXFSZ 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 128 diff --git a/libc-top-half/musl/arch/mips/bits/socket.h b/libc-top-half/musl/arch/mips/bits/socket.h new file mode 100644 index 0000000..02fbb88 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/socket.h @@ -0,0 +1,35 @@ +#define SOCK_STREAM 2 +#define SOCK_DGRAM 1 + +#define SOL_SOCKET 65535 + +#define SO_DEBUG 1 + +#define SO_REUSEADDR 0x0004 +#define SO_KEEPALIVE 0x0008 +#define SO_DONTROUTE 0x0010 +#define SO_BROADCAST 0x0020 +#define SO_LINGER 0x0080 +#define SO_OOBINLINE 0x0100 +#define SO_REUSEPORT 0x0200 +#define SO_SNDBUF 0x1001 +#define SO_RCVBUF 0x1002 +#define SO_SNDLOWAT 0x1003 +#define SO_RCVLOWAT 0x1004 +#define SO_ERROR 0x1007 +#define SO_TYPE 0x1008 +#define SO_ACCEPTCONN 0x1009 +#define SO_PROTOCOL 0x1028 +#define SO_DOMAIN 0x1029 + +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_BSDCOMPAT 14 +#define SO_PASSCRED 17 +#define SO_PEERCRED 18 +#define SO_PEERSEC 30 +#define SO_SNDBUFFORCE 31 +#define SO_RCVBUFFORCE 33 + +#define SOCK_NONBLOCK 0200 +#define SOCK_CLOEXEC 02000000 diff --git a/libc-top-half/musl/arch/mips/bits/stat.h b/libc-top-half/musl/arch/mips/bits/stat.h new file mode 100644 index 0000000..48d4ac8 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/stat.h @@ -0,0 +1,26 @@ +/* copied from kernel definition, but with padding replaced + * by the corresponding correctly-sized userspace types. */ + +struct stat { + dev_t st_dev; + long __st_padding1[2]; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + long __st_padding2[2]; + off_t st_size; + struct { + long tv_sec; + long tv_nsec; + } __st_atim32, __st_mtim32, __st_ctim32; + blksize_t st_blksize; + long __st_padding3; + blkcnt_t st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __st_padding4[2]; +}; diff --git a/libc-top-half/musl/arch/mips/bits/statfs.h b/libc-top-half/musl/arch/mips/bits/statfs.h new file mode 100644 index 0000000..a73bd54 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/statfs.h @@ -0,0 +1,8 @@ +struct statfs { + unsigned long f_type, f_bsize, f_frsize; + fsblkcnt_t f_blocks, f_bfree; + fsfilcnt_t f_files, f_ffree; + fsblkcnt_t f_bavail; + fsid_t f_fsid; + unsigned long f_namelen, f_flags, f_spare[5]; +}; diff --git a/libc-top-half/musl/arch/mips/bits/stdint.h b/libc-top-half/musl/arch/mips/bits/stdint.h new file mode 100644 index 0000000..d1b2712 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/stdint.h @@ -0,0 +1,20 @@ +typedef int32_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef uint32_t uint_fast16_t; +typedef uint32_t uint_fast32_t; + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN + +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX + +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#define SIZE_MAX UINT32_MAX diff --git a/libc-top-half/musl/arch/mips/bits/syscall.h.in b/libc-top-half/musl/arch/mips/bits/syscall.h.in new file mode 100644 index 0000000..63e3503 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/syscall.h.in @@ -0,0 +1,421 @@ +#define __NR_syscall 4000 +#define __NR_exit 4001 +#define __NR_fork 4002 +#define __NR_read 4003 +#define __NR_write 4004 +#define __NR_open 4005 +#define __NR_close 4006 +#define __NR_waitpid 4007 +#define __NR_creat 4008 +#define __NR_link 4009 +#define __NR_unlink 4010 +#define __NR_execve 4011 +#define __NR_chdir 4012 +#define __NR_time 4013 +#define __NR_mknod 4014 +#define __NR_chmod 4015 +#define __NR_lchown 4016 +#define __NR_break 4017 +#define __NR_unused18 4018 +#define __NR_lseek 4019 +#define __NR_getpid 4020 +#define __NR_mount 4021 +#define __NR_umount 4022 +#define __NR_setuid 4023 +#define __NR_getuid 4024 +#define __NR_stime 4025 +#define __NR_ptrace 4026 +#define __NR_alarm 4027 +#define __NR_unused28 4028 +#define __NR_pause 4029 +#define __NR_utime 4030 +#define __NR_stty 4031 +#define __NR_gtty 4032 +#define __NR_access 4033 +#define __NR_nice 4034 +#define __NR_ftime 4035 +#define __NR_sync 4036 +#define __NR_kill 4037 +#define __NR_rename 4038 +#define __NR_mkdir 4039 +#define __NR_rmdir 4040 +#define __NR_dup 4041 +#define __NR_pipe 4042 +#define __NR_times 4043 +#define __NR_prof 4044 +#define __NR_brk 4045 +#define __NR_setgid 4046 +#define __NR_getgid 4047 +#define __NR_signal 4048 +#define __NR_geteuid 4049 +#define __NR_getegid 4050 +#define __NR_acct 4051 +#define __NR_umount2 4052 +#define __NR_lock 4053 +#define __NR_ioctl 4054 +#define __NR_fcntl 4055 +#define __NR_mpx 4056 +#define __NR_setpgid 4057 +#define __NR_ulimit 4058 +#define __NR_unused59 4059 +#define __NR_umask 4060 +#define __NR_chroot 4061 +#define __NR_ustat 4062 +#define __NR_dup2 4063 +#define __NR_getppid 4064 +#define __NR_getpgrp 4065 +#define __NR_setsid 4066 +#define __NR_sigaction 4067 +#define __NR_sgetmask 4068 +#define __NR_ssetmask 4069 +#define __NR_setreuid 4070 +#define __NR_setregid 4071 +#define __NR_sigsuspend 4072 +#define __NR_sigpending 4073 +#define __NR_sethostname 4074 +#define __NR_setrlimit 4075 +#define __NR_getrlimit 4076 +#define __NR_getrusage 4077 +#define __NR_gettimeofday_time32 4078 +#define __NR_settimeofday_time32 4079 +#define __NR_getgroups 4080 +#define __NR_setgroups 4081 +#define __NR_reserved82 4082 +#define __NR_symlink 4083 +#define __NR_unused84 4084 +#define __NR_readlink 4085 +#define __NR_uselib 4086 +#define __NR_swapon 4087 +#define __NR_reboot 4088 +#define __NR_readdir 4089 +#define __NR_mmap 4090 +#define __NR_munmap 4091 +#define __NR_truncate 4092 +#define __NR_ftruncate 4093 +#define __NR_fchmod 4094 +#define __NR_fchown 4095 +#define __NR_getpriority 4096 +#define __NR_setpriority 4097 +#define __NR_profil 4098 +#define __NR_statfs 4099 +#define __NR_fstatfs 4100 +#define __NR_ioperm 4101 +#define __NR_socketcall 4102 +#define __NR_syslog 4103 +#define __NR_setitimer 4104 +#define __NR_getitimer 4105 +#define __NR_stat 4106 +#define __NR_lstat 4107 +#define __NR_fstat 4108 +#define __NR_unused109 4109 +#define __NR_iopl 4110 +#define __NR_vhangup 4111 +#define __NR_idle 4112 +#define __NR_vm86 4113 +#define __NR_wait4 4114 +#define __NR_swapoff 4115 +#define __NR_sysinfo 4116 +#define __NR_ipc 4117 +#define __NR_fsync 4118 +#define __NR_sigreturn 4119 +#define __NR_clone 4120 +#define __NR_setdomainname 4121 +#define __NR_uname 4122 +#define __NR_modify_ldt 4123 +#define __NR_adjtimex 4124 +#define __NR_mprotect 4125 +#define __NR_sigprocmask 4126 +#define __NR_create_module 4127 +#define __NR_init_module 4128 +#define __NR_delete_module 4129 +#define __NR_get_kernel_syms 4130 +#define __NR_quotactl 4131 +#define __NR_getpgid 4132 +#define __NR_fchdir 4133 +#define __NR_bdflush 4134 +#define __NR_sysfs 4135 +#define __NR_personality 4136 +#define __NR_afs_syscall 4137 +#define __NR_setfsuid 4138 +#define __NR_setfsgid 4139 +#define __NR__llseek 4140 +#define __NR_getdents 4141 +#define __NR__newselect 4142 +#define __NR_flock 4143 +#define __NR_msync 4144 +#define __NR_readv 4145 +#define __NR_writev 4146 +#define __NR_cacheflush 4147 +#define __NR_cachectl 4148 +#define __NR_sysmips 4149 +#define __NR_unused150 4150 +#define __NR_getsid 4151 +#define __NR_fdatasync 4152 +#define __NR__sysctl 4153 +#define __NR_mlock 4154 +#define __NR_munlock 4155 +#define __NR_mlockall 4156 +#define __NR_munlockall 4157 +#define __NR_sched_setparam 4158 +#define __NR_sched_getparam 4159 +#define __NR_sched_setscheduler 4160 +#define __NR_sched_getscheduler 4161 +#define __NR_sched_yield 4162 +#define __NR_sched_get_priority_max 4163 +#define __NR_sched_get_priority_min 4164 +#define __NR_sched_rr_get_interval 4165 +#define __NR_nanosleep 4166 +#define __NR_mremap 4167 +#define __NR_accept 4168 +#define __NR_bind 4169 +#define __NR_connect 4170 +#define __NR_getpeername 4171 +#define __NR_getsockname 4172 +#define __NR_getsockopt 4173 +#define __NR_listen 4174 +#define __NR_recv 4175 +#define __NR_recvfrom 4176 +#define __NR_recvmsg 4177 +#define __NR_send 4178 +#define __NR_sendmsg 4179 +#define __NR_sendto 4180 +#define __NR_setsockopt 4181 +#define __NR_shutdown 4182 +#define __NR_socket 4183 +#define __NR_socketpair 4184 +#define __NR_setresuid 4185 +#define __NR_getresuid 4186 +#define __NR_query_module 4187 +#define __NR_poll 4188 +#define __NR_nfsservctl 4189 +#define __NR_setresgid 4190 +#define __NR_getresgid 4191 +#define __NR_prctl 4192 +#define __NR_rt_sigreturn 4193 +#define __NR_rt_sigaction 4194 +#define __NR_rt_sigprocmask 4195 +#define __NR_rt_sigpending 4196 +#define __NR_rt_sigtimedwait 4197 +#define __NR_rt_sigqueueinfo 4198 +#define __NR_rt_sigsuspend 4199 +#define __NR_pread64 4200 +#define __NR_pwrite64 4201 +#define __NR_chown 4202 +#define __NR_getcwd 4203 +#define __NR_capget 4204 +#define __NR_capset 4205 +#define __NR_sigaltstack 4206 +#define __NR_sendfile 4207 +#define __NR_getpmsg 4208 +#define __NR_putpmsg 4209 +#define __NR_mmap2 4210 +#define __NR_truncate64 4211 +#define __NR_ftruncate64 4212 +#define __NR_stat64 4213 +#define __NR_lstat64 4214 +#define __NR_fstat64 4215 +#define __NR_pivot_root 4216 +#define __NR_mincore 4217 +#define __NR_madvise 4218 +#define __NR_getdents64 4219 +#define __NR_fcntl64 4220 +#define __NR_reserved221 4221 +#define __NR_gettid 4222 +#define __NR_readahead 4223 +#define __NR_setxattr 4224 +#define __NR_lsetxattr 4225 +#define __NR_fsetxattr 4226 +#define __NR_getxattr 4227 +#define __NR_lgetxattr 4228 +#define __NR_fgetxattr 4229 +#define __NR_listxattr 4230 +#define __NR_llistxattr 4231 +#define __NR_flistxattr 4232 +#define __NR_removexattr 4233 +#define __NR_lremovexattr 4234 +#define __NR_fremovexattr 4235 +#define __NR_tkill 4236 +#define __NR_sendfile64 4237 +#define __NR_futex 4238 +#define __NR_sched_setaffinity 4239 +#define __NR_sched_getaffinity 4240 +#define __NR_io_setup 4241 +#define __NR_io_destroy 4242 +#define __NR_io_getevents 4243 +#define __NR_io_submit 4244 +#define __NR_io_cancel 4245 +#define __NR_exit_group 4246 +#define __NR_lookup_dcookie 4247 +#define __NR_epoll_create 4248 +#define __NR_epoll_ctl 4249 +#define __NR_epoll_wait 4250 +#define __NR_remap_file_pages 4251 +#define __NR_set_tid_address 4252 +#define __NR_restart_syscall 4253 +#define __NR_fadvise64 4254 +#define __NR_statfs64 4255 +#define __NR_fstatfs64 4256 +#define __NR_timer_create 4257 +#define __NR_timer_settime32 4258 +#define __NR_timer_gettime32 4259 +#define __NR_timer_getoverrun 4260 +#define __NR_timer_delete 4261 +#define __NR_clock_settime32 4262 +#define __NR_clock_gettime32 4263 +#define __NR_clock_getres_time32 4264 +#define __NR_clock_nanosleep_time32 4265 +#define __NR_tgkill 4266 +#define __NR_utimes 4267 +#define __NR_mbind 4268 +#define __NR_get_mempolicy 4269 +#define __NR_set_mempolicy 4270 +#define __NR_mq_open 4271 +#define __NR_mq_unlink 4272 +#define __NR_mq_timedsend 4273 +#define __NR_mq_timedreceive 4274 +#define __NR_mq_notify 4275 +#define __NR_mq_getsetattr 4276 +#define __NR_vserver 4277 +#define __NR_waitid 4278 +#define __NR_add_key 4280 +#define __NR_request_key 4281 +#define __NR_keyctl 4282 +#define __NR_set_thread_area 4283 +#define __NR_inotify_init 4284 +#define __NR_inotify_add_watch 4285 +#define __NR_inotify_rm_watch 4286 +#define __NR_migrate_pages 4287 +#define __NR_openat 4288 +#define __NR_mkdirat 4289 +#define __NR_mknodat 4290 +#define __NR_fchownat 4291 +#define __NR_futimesat 4292 +#define __NR_fstatat64 4293 +#define __NR_unlinkat 4294 +#define __NR_renameat 4295 +#define __NR_linkat 4296 +#define __NR_symlinkat 4297 +#define __NR_readlinkat 4298 +#define __NR_fchmodat 4299 +#define __NR_faccessat 4300 +#define __NR_pselect6 4301 +#define __NR_ppoll 4302 +#define __NR_unshare 4303 +#define __NR_splice 4304 +#define __NR_sync_file_range 4305 +#define __NR_tee 4306 +#define __NR_vmsplice 4307 +#define __NR_move_pages 4308 +#define __NR_set_robust_list 4309 +#define __NR_get_robust_list 4310 +#define __NR_kexec_load 4311 +#define __NR_getcpu 4312 +#define __NR_epoll_pwait 4313 +#define __NR_ioprio_set 4314 +#define __NR_ioprio_get 4315 +#define __NR_utimensat 4316 +#define __NR_signalfd 4317 +#define __NR_timerfd 4318 +#define __NR_eventfd 4319 +#define __NR_fallocate 4320 +#define __NR_timerfd_create 4321 +#define __NR_timerfd_gettime32 4322 +#define __NR_timerfd_settime32 4323 +#define __NR_signalfd4 4324 +#define __NR_eventfd2 4325 +#define __NR_epoll_create1 4326 +#define __NR_dup3 4327 +#define __NR_pipe2 4328 +#define __NR_inotify_init1 4329 +#define __NR_preadv 4330 +#define __NR_pwritev 4331 +#define __NR_rt_tgsigqueueinfo 4332 +#define __NR_perf_event_open 4333 +#define __NR_accept4 4334 +#define __NR_recvmmsg 4335 +#define __NR_fanotify_init 4336 +#define __NR_fanotify_mark 4337 +#define __NR_prlimit64 4338 +#define __NR_name_to_handle_at 4339 +#define __NR_open_by_handle_at 4340 +#define __NR_clock_adjtime 4341 +#define __NR_syncfs 4342 +#define __NR_sendmmsg 4343 +#define __NR_setns 4344 +#define __NR_process_vm_readv 4345 +#define __NR_process_vm_writev 4346 +#define __NR_kcmp 4347 +#define __NR_finit_module 4348 +#define __NR_sched_setattr 4349 +#define __NR_sched_getattr 4350 +#define __NR_renameat2 4351 +#define __NR_seccomp 4352 +#define __NR_getrandom 4353 +#define __NR_memfd_create 4354 +#define __NR_bpf 4355 +#define __NR_execveat 4356 +#define __NR_userfaultfd 4357 +#define __NR_membarrier 4358 +#define __NR_mlock2 4359 +#define __NR_copy_file_range 4360 +#define __NR_preadv2 4361 +#define __NR_pwritev2 4362 +#define __NR_pkey_mprotect 4363 +#define __NR_pkey_alloc 4364 +#define __NR_pkey_free 4365 +#define __NR_statx 4366 +#define __NR_rseq 4367 +#define __NR_io_pgetevents 4368 +#define __NR_semget 4393 +#define __NR_semctl 4394 +#define __NR_shmget 4395 +#define __NR_shmctl 4396 +#define __NR_shmat 4397 +#define __NR_shmdt 4398 +#define __NR_msgget 4399 +#define __NR_msgsnd 4400 +#define __NR_msgrcv 4401 +#define __NR_msgctl 4402 +#define __NR_clock_gettime64 4403 +#define __NR_clock_settime64 4404 +#define __NR_clock_adjtime64 4405 +#define __NR_clock_getres_time64 4406 +#define __NR_clock_nanosleep_time64 4407 +#define __NR_timer_gettime64 4408 +#define __NR_timer_settime64 4409 +#define __NR_timerfd_gettime64 4410 +#define __NR_timerfd_settime64 4411 +#define __NR_utimensat_time64 4412 +#define __NR_pselect6_time64 4413 +#define __NR_ppoll_time64 4414 +#define __NR_io_pgetevents_time64 4416 +#define __NR_recvmmsg_time64 4417 +#define __NR_mq_timedsend_time64 4418 +#define __NR_mq_timedreceive_time64 4419 +#define __NR_semtimedop_time64 4420 +#define __NR_rt_sigtimedwait_time64 4421 +#define __NR_futex_time64 4422 +#define __NR_sched_rr_get_interval_time64 4423 +#define __NR_pidfd_send_signal 4424 +#define __NR_io_uring_setup 4425 +#define __NR_io_uring_enter 4426 +#define __NR_io_uring_register 4427 +#define __NR_open_tree 4428 +#define __NR_move_mount 4429 +#define __NR_fsopen 4430 +#define __NR_fsconfig 4431 +#define __NR_fsmount 4432 +#define __NR_fspick 4433 +#define __NR_pidfd_open 4434 +#define __NR_clone3 4435 +#define __NR_close_range 4436 +#define __NR_openat2 4437 +#define __NR_pidfd_getfd 4438 +#define __NR_faccessat2 4439 +#define __NR_process_madvise 4440 +#define __NR_epoll_pwait2 4441 +#define __NR_mount_setattr 4442 +#define __NR_landlock_create_ruleset 4444 +#define __NR_landlock_add_rule 4445 +#define __NR_landlock_restrict_self 4446 + diff --git a/libc-top-half/musl/arch/mips/bits/termios.h b/libc-top-half/musl/arch/mips/bits/termios.h new file mode 100644 index 0000000..9d571f7 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/termios.h @@ -0,0 +1,169 @@ +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[NCCS]; + speed_t __c_ispeed; + speed_t __c_ospeed; +}; + +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VMIN 4 +#define VTIME 5 +#define VEOL2 6 +#define VSWTC 7 +#define VSWTCH 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOF 16 +#define VEOL 17 + +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 +#endif + +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 + +#define B0 0000000 +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 + +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 + +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 + +#define ISIG 0000001 +#define ICANON 0000002 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define IEXTEN 0000400 +#define TOSTOP 0100000 +#define ITOSTOP 0100000 + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define EXTA 0000016 +#define EXTB 0000017 +#define CBAUD 0010017 +#define CBAUDEX 0010000 +#define CIBAUD 002003600000 +#define CMSPAR 010000000000 +#define CRTSCTS 020000000000 + +#define XCASE 0000004 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0020000 +#define PENDIN 0040000 +#define EXTPROC 0200000 + +#define XTABS 0014000 +#define TIOCSER_TEMT 1 +#endif diff --git a/libc-top-half/musl/arch/mips/bits/user.h b/libc-top-half/musl/arch/mips/bits/user.h new file mode 100644 index 0000000..3e26249 --- /dev/null +++ b/libc-top-half/musl/arch/mips/bits/user.h @@ -0,0 +1,13 @@ +struct user { + unsigned long regs[45+64]; + unsigned long u_tsize, u_dsize, u_ssize; + unsigned long start_code, start_data, start_stack; + long signal; + void *u_ar0; + unsigned long magic; + char u_comm[32]; +}; +#define ELF_NGREG 45 +#define ELF_NFPREG 33 +typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; +typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG]; diff --git a/libc-top-half/musl/arch/mips/crt_arch.h b/libc-top-half/musl/arch/mips/crt_arch.h new file mode 100644 index 0000000..9fc50d7 --- /dev/null +++ b/libc-top-half/musl/arch/mips/crt_arch.h @@ -0,0 +1,29 @@ +__asm__( +".set push\n" +".set noreorder\n" +".text \n" +".global _" START "\n" +".global " START "\n" +".type _" START ", @function\n" +".type " START ", @function\n" +"_" START ":\n" +"" START ":\n" +" bal 1f \n" +" move $fp, $0 \n" +" .gpword . \n" +" .gpword " START "_c \n" +".weak _DYNAMIC \n" +".hidden _DYNAMIC \n" +" .gpword _DYNAMIC \n" +"1: lw $gp, 0($ra) \n" +" subu $gp, $ra, $gp \n" +" move $4, $sp \n" +" lw $5, 8($ra) \n" +" addu $5, $5, $gp \n" +" lw $25, 4($ra) \n" +" addu $25, $25, $gp \n" +" and $sp, $sp, -8 \n" +" jalr $25 \n" +" subu $sp, $sp, 16 \n" +".set pop \n" +); diff --git a/libc-top-half/musl/arch/mips/ksigaction.h b/libc-top-half/musl/arch/mips/ksigaction.h new file mode 100644 index 0000000..63fdfab --- /dev/null +++ b/libc-top-half/musl/arch/mips/ksigaction.h @@ -0,0 +1,13 @@ +#include <features.h> + +struct k_sigaction { + unsigned flags; + void (*handler)(int); + unsigned long mask[4]; + /* The following field is past the end of the structure the + * kernel will read or write, and exists only to avoid having + * mips-specific preprocessor conditionals in sigaction.c. */ + void (*restorer)(); +}; + +hidden void __restore(), __restore_rt(); diff --git a/libc-top-half/musl/arch/mips/kstat.h b/libc-top-half/musl/arch/mips/kstat.h new file mode 100644 index 0000000..5e637ea --- /dev/null +++ b/libc-top-half/musl/arch/mips/kstat.h @@ -0,0 +1,22 @@ +struct kstat { + unsigned st_dev; + long __st_padding1[3]; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + unsigned st_rdev; + long __st_padding2[3]; + off_t st_size; + long st_atime_sec; + long st_atime_nsec; + long st_mtime_sec; + long st_mtime_nsec; + long st_ctime_sec; + long st_ctime_nsec; + blksize_t st_blksize; + long __st_padding3; + blkcnt_t st_blocks; + long __st_padding4[14]; +}; diff --git a/libc-top-half/musl/arch/mips/pthread_arch.h b/libc-top-half/musl/arch/mips/pthread_arch.h new file mode 100644 index 0000000..376b774 --- /dev/null +++ b/libc-top-half/musl/arch/mips/pthread_arch.h @@ -0,0 +1,18 @@ +static inline uintptr_t __get_tp() +{ + register uintptr_t tp __asm__("$3"); +#if __mips_isa_rev < 2 + __asm__ (".word 0x7c03e83b" : "=r" (tp) ); +#else + __asm__ ("rdhwr %0, $29" : "=r" (tp) ); +#endif + return tp; +} + +#define TLS_ABOVE_TP +#define GAP_ABOVE_TP 0 + +#define TP_OFFSET 0x7000 +#define DTP_OFFSET 0x8000 + +#define MC_PC pc diff --git a/libc-top-half/musl/arch/mips/reloc.h b/libc-top-half/musl/arch/mips/reloc.h new file mode 100644 index 0000000..88d2363 --- /dev/null +++ b/libc-top-half/musl/arch/mips/reloc.h @@ -0,0 +1,50 @@ +#if __mips_isa_rev >= 6 +#define ISA_SUFFIX "r6" +#else +#define ISA_SUFFIX "" +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define ENDIAN_SUFFIX "el" +#else +#define ENDIAN_SUFFIX "" +#endif + +#ifdef __mips_soft_float +#define FP_SUFFIX "-sf" +#else +#define FP_SUFFIX "" +#endif + +#define LDSO_ARCH "mips" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX + +#define TPOFF_K (-0x7000) + +#define REL_SYM_OR_REL R_MIPS_REL32 +#define REL_PLT R_MIPS_JUMP_SLOT +#define REL_COPY R_MIPS_COPY +#define REL_DTPMOD R_MIPS_TLS_DTPMOD32 +#define REL_DTPOFF R_MIPS_TLS_DTPREL32 +#define REL_TPOFF R_MIPS_TLS_TPREL32 + +#define NEED_MIPS_GOT_RELOCS 1 +#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP +#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + +#define CRTJMP(pc,sp) __asm__ __volatile__( \ + "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) + +#define GETFUNCSYM(fp, sym, got) __asm__ ( \ + ".hidden " #sym "\n" \ + ".set push \n" \ + ".set noreorder \n" \ + " bal 1f \n" \ + " nop \n" \ + " .gpword . \n" \ + " .gpword " #sym " \n" \ + "1: lw %0, ($ra) \n" \ + " subu %0, $ra, %0 \n" \ + " lw $ra, 4($ra) \n" \ + " addu %0, %0, $ra \n" \ + ".set pop \n" \ + : "=r"(*(fp)) : : "memory", "ra" ) diff --git a/libc-top-half/musl/arch/mips/syscall_arch.h b/libc-top-half/musl/arch/mips/syscall_arch.h new file mode 100644 index 0000000..5b7c38d --- /dev/null +++ b/libc-top-half/musl/arch/mips/syscall_arch.h @@ -0,0 +1,153 @@ +#define __SYSCALL_LL_E(x) \ +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ +((union { long long ll; long l[2]; }){ .ll = x }).l[1] +#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) + +#define SYSCALL_RLIM_INFINITY (-1UL/2) + +#if __mips_isa_rev >= 6 +#define SYSCALL_CLOBBERLIST \ + "$1", "$3", "$11", "$12", "$13", \ + "$14", "$15", "$24", "$25", "memory" +#else +#define SYSCALL_CLOBBERLIST \ + "$1", "$3", "$11", "$12", "$13", \ + "$14", "$15", "$24", "$25", "hi", "lo", "memory" +#endif + +static inline long __syscall0(long n) +{ + register long r7 __asm__("$7"); + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "addu $2,$0,%2 ; syscall" + : "=&r"(r2), "=r"(r7) + : "ir"(n), "0"(r2) + : SYSCALL_CLOBBERLIST, "$8", "$9", "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall1(long n, long a) +{ + register long r4 __asm__("$4") = a; + register long r7 __asm__("$7"); + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "addu $2,$0,%2 ; syscall" + : "=&r"(r2), "=r"(r7) + : "ir"(n), "0"(r2), "r"(r4) + : SYSCALL_CLOBBERLIST, "$8", "$9", "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall2(long n, long a, long b) +{ + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; + register long r7 __asm__("$7"); + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "addu $2,$0,%2 ; syscall" + : "=&r"(r2), "=r"(r7) + : "ir"(n), "0"(r2), "r"(r4), "r"(r5) + : SYSCALL_CLOBBERLIST, "$8", "$9", "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; + register long r6 __asm__("$6") = c; + register long r7 __asm__("$7"); + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "addu $2,$0,%2 ; syscall" + : "=&r"(r2), "=r"(r7) + : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) + : SYSCALL_CLOBBERLIST, "$8", "$9", "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; + register long r6 __asm__("$6") = c; + register long r7 __asm__("$7") = d; + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "addu $2,$0,%2 ; syscall" + : "=&r"(r2), "+r"(r7) + : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) + : SYSCALL_CLOBBERLIST, "$8", "$9", "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; + register long r6 __asm__("$6") = c; + register long r7 __asm__("$7") = d; + register long r8 __asm__("$8") = e; + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "subu $sp,$sp,32 ; sw $8,16($sp) ; " + "addu $2,$0,%3 ; syscall ;" + "addu $sp,$sp,32" + : "=&r"(r2), "+r"(r7), "+r"(r8) + : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) + : SYSCALL_CLOBBERLIST, "$9", "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; + register long r6 __asm__("$6") = c; + register long r7 __asm__("$7") = d; + register long r8 __asm__("$8") = e; + register long r9 __asm__("$9") = f; + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; " + "addu $2,$0,%4 ; syscall ;" + "addu $sp,$sp,32" + : "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9) + : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) + : SYSCALL_CLOBBERLIST, "$10"); + return r7 && r2>0 ? -r2 : r2; +} + +static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g) +{ + register long r4 __asm__("$4") = a; + register long r5 __asm__("$5") = b; + register long r6 __asm__("$6") = c; + register long r7 __asm__("$7") = d; + register long r8 __asm__("$8") = e; + register long r9 __asm__("$9") = f; + register long r10 __asm__("$10") = g; + register long r2 __asm__("$2"); + __asm__ __volatile__ ( + "subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; sw $10,24($sp) ; " + "addu $2,$0,%5 ; syscall ;" + "addu $sp,$sp,32" + : "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10) + : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) + : SYSCALL_CLOBBERLIST); + return r7 && r2>0 ? -r2 : r2; +} + +#define VDSO_USEFUL +#define VDSO_CGT32_SYM "__vdso_clock_gettime" +#define VDSO_CGT32_VER "LINUX_2.6" +#define VDSO_CGT_SYM "__vdso_clock_gettime64" +#define VDSO_CGT_VER "LINUX_2.6" + +#define SO_SNDTIMEO_OLD 0x1005 +#define SO_RCVTIMEO_OLD 0x1006 + +#undef SYS_socketcall |