resolved conflicts for merge of 08e72d01 to jb-dev-plus-aosp

Change-Id: If00e354a5953ed54b31963d4f8ea77e1603c321e
diff --git a/libc/Android.mk b/libc/Android.mk
index a403146..6c535dc 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -465,6 +465,13 @@
   libc_common_cflags += -DDEBUG
 endif
 
+# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
+# the appropriate BoardConfig.mk file.
+#
+ifneq ($(BOARD_MALLOC_ALIGNMENT),)
+  libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
+endif
+
 ifeq ($(TARGET_ARCH),arm)
   libc_common_cflags += -fstrict-aliasing
   libc_crt_target_cflags := -mthumb-interwork
@@ -478,6 +485,14 @@
   ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
     libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
   endif
+  #
+  # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
+  # library it should use to 32-byte version of memcpy, and not
+  # the 64-byte version.
+  #
+  ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
+    libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
+  endif
   ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
     libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
   endif
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 1923ea0..504a050 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -22,18 +22,18 @@
 #        assembler template for the syscall; it's up to the bionic implementation to provide
 #        a relevant C stub
 #
-#      - additionally, if the syscall number is different amoung ARM, and x86, use:
-#        return_type funcname[:syscall_name](parameters) arm_number,x86_number
+#      - additionally, if the syscall number is different amoung ARM, and x86, MIPS use:
+#        return_type funcname[:syscall_name](parameters) arm_number,x86_number, mips_number
 #
 # the file is processed by a python script named gensyscalls.py
 #
 
 # process management
-void    _exit:exit_group (int)      248,252
+void    _exit:exit_group (int)      248,252,246
 void    _exit_thread:exit (int)     1
 pid_t   __fork:fork (void)           2
-pid_t   _waitpid:waitpid (pid_t, int*, int, struct rusage*)   -1,7
-int     __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*)          280,284
+pid_t   _waitpid:waitpid (pid_t, int*, int, struct rusage*)   -1,7,7
+int     __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*)          280,284,278
 
 # NOTE: this system call is never called directly, but we list it there
 #       to have __NR_clone properly defined.
@@ -42,72 +42,87 @@
 
 int     execve (const char*, char* const*, char* const*)  11
 
-int     __setuid:setuid32 (uid_t)    213
-uid_t   getuid:getuid32 ()         199
-gid_t   getgid:getgid32 ()         200
-uid_t   geteuid:geteuid32 ()       201
-gid_t   getegid:getegid32 ()       202
-uid_t   getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid)   209
-gid_t   getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid)   211
-pid_t   gettid()                   224
-ssize_t readahead(int, off64_t, size_t)     225
-int     getgroups:getgroups32(int, gid_t *)    205
+int     __setuid:setuid32 (uid_t)    213,213,-1
+int     __setuid:setuid (uid_t)   -1,-1,23
+uid_t   getuid:getuid32 ()         199,199,-1
+uid_t   getuid:getuid ()           -1,-1,24
+gid_t   getgid:getgid32 ()         200,200,-1
+gid_t   getgid:getgid ()           -1,-1,47
+uid_t   geteuid:geteuid32 ()       201,201,-1
+uid_t   geteuid:geteuid ()         -1,-1,49
+gid_t   getegid:getegid32 ()       202,202,-1
+gid_t   getegid:getegid ()         -1,-1,50
+uid_t   getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid)   209,209,-1
+uid_t   getresuid:getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)     -1,-1,186
+gid_t   getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid)   211,211,-1
+gid_t   getresgid:getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)     -1,-1,191
+pid_t   gettid()                   224,224,222
+ssize_t readahead(int, off64_t, size_t)     225,225,223
+int     getgroups:getgroups32(int, gid_t *)    205,205,-1
+int     getgroups:getgroups(int, gid_t *)      -1,-1,80
 pid_t   getpgid(pid_t)             132
 pid_t   getppid()                  64
 pid_t   setsid()                   66
-int     setgid:setgid32(gid_t)     214
+int     setgid:setgid32(gid_t)     214,214,-1
+int     setgid:setgid(gid_t)       -1,-1,46
 int     seteuid:seteuid32(uid_t)   stub
-int     __setreuid:setreuid32(uid_t, uid_t)   203
-int     __setresuid:setresuid32(uid_t, uid_t, uid_t)   208
-int     setresgid:setresgid32(gid_t, gid_t, gid_t)   210
+int     __setreuid:setreuid32(uid_t, uid_t)   203,203,-1
+int     __setreuid:setreuid(uid_t, uid_t)     -1,-1,70
+int     __setresuid:setresuid32(uid_t, uid_t, uid_t)   208,208,-1
+int     __setresuid:setresuid(uid_t, uid_t, uid_t)     -1,-1,185
+int     setresgid:setresgid32(gid_t, gid_t, gid_t)   210,210,-1
+int     setresgid:setresgid(gid_t, gid_t, gid_t)     -1,-1,190
 void*   __brk:brk(void*)           45
 # see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
-int     kill(pid_t, int)           -1,37
-int     tkill(pid_t tid, int sig)  -1,238
-int     tgkill(pid_t tgid, pid_t tid, int sig)  -1,270
+int     kill(pid_t, int)           -1,37,37
+int     tkill(pid_t tid, int sig)  -1,238,236
+int     tgkill(pid_t tgid, pid_t tid, int sig)  -1,270,266
 int     __ptrace:ptrace(int request, int pid, void* addr, void* data)  26
-int     __set_thread_area:set_thread_area(void*  user_desc)  -1,243
+int     __set_thread_area:set_thread_area(void*  user_desc)  -1,243,283
 int     __getpriority:getpriority(int, int)  96
 int     setpriority(int, int, int)   97
 int     setrlimit(int resource, const struct rlimit *rlp)  75
-int     getrlimit:ugetrlimit(int resource, struct rlimit *rlp)  191
+int     getrlimit:ugetrlimit(int resource, struct rlimit *rlp)  191,191,-1
+int     getrlimit:getrlimit(int resource, struct rlimit *rlp)  -1,-1,76
 int     getrusage(int who, struct rusage*  r_usage)  77
-int     setgroups:setgroups32(int, const gid_t *)   206
+int     setgroups:setgroups32(int, const gid_t *)   206,206,-1
+int     setgroups:setgroups(int, const gid_t *)     -1,-1,81
 pid_t   getpgrp(void)  stub
 int     setpgid(pid_t, pid_t)  57
-pid_t   vfork(void)  190,-1,190
-int     setregid:setregid32(gid_t, gid_t)  204
+pid_t   vfork(void)  190,-1,-1
+int     setregid:setregid32(gid_t, gid_t)  204,204,-1
+int     setregid:setregid(gid_t, gid_t)    -1,-1,71
 int     chroot(const char *)  61
 # IMPORTANT: Even though <sys/prctl.h> declares prctl(int,...), the syscall stub must take 6 arguments
 #            to match the kernel implementation.
-int     prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5)  172
-int     capget(cap_user_header_t header, cap_user_data_t data) 184
-int     capset(cap_user_header_t header, const cap_user_data_t data) 185
-int     sigaltstack(const stack_t*, stack_t*) 186
+int     prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5)  172,172,192
+int     capget(cap_user_header_t header, cap_user_data_t data) 184,184,204
+int     capset(cap_user_header_t header, const cap_user_data_t data) 185,185,205
+int     sigaltstack(const stack_t*, stack_t*) 186,186,206
 int     acct(const char*  filepath)  51
 
 # file descriptors
 ssize_t     read (int, void*, size_t)        3
 ssize_t     write (int, const void*, size_t)       4
-ssize_t     pread64 (int, void *, size_t, off64_t) 180
-ssize_t     pwrite64 (int, void *, size_t, off64_t) 181
+ssize_t     pread64 (int, void *, size_t, off64_t) 180,180,200
+ssize_t     pwrite64 (int, void *, size_t, off64_t) 181,181,201
 int         __open:open (const char*, int, mode_t)  5
-int         __openat:openat (int, const char*, int, mode_t)  322,295
+int         __openat:openat (int, const char*, int, mode_t)  322,295,288
 int         close (int)                      6
 int         creat(const char*, mode_t)       stub
 off_t       lseek(int, off_t, int)           19
 int         __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int)  140
 pid_t       getpid ()    20
 void *      mmap(void *, size_t, int, int, int, long)  stub
-void *      __mmap2:mmap2(void*, size_t, int, int, int, long)   192
+void *      __mmap2:mmap2(void*, size_t, int, int, int, long)   192,192,210
 int         munmap(void *, size_t)  91
-void *      mremap(void *, size_t, size_t, unsigned long)  163
+void *      mremap(void *, size_t, size_t, unsigned long)  163,163,167
 int         msync(const void *, size_t, int)    144
 int         mprotect(const void *, size_t, int)  125
-int         madvise(const void *, size_t, int)  220,219
-int         mlock(const void *addr, size_t len)    150
-int         munlock(const void *addr, size_t len)   151
-int         mincore(void*  start, size_t  length, unsigned char*  vec)   219,218
+int         madvise(const void *, size_t, int)  220,219,218
+int         mlock(const void *addr, size_t len)    150,150,154
+int         munlock(const void *addr, size_t len)   151,151,155
+int         mincore(void*  start, size_t  length, unsigned char*  vec)   219,218,217
 int         __ioctl:ioctl(int, int, void *)  54
 int         readv(int, const struct iovec *, int)   145
 int         writev(int, const struct iovec *, int)  146
@@ -115,144 +130,147 @@
 int         flock(int, int)   143
 int         fchmod(int, mode_t)  94
 int         dup(int)  41
-int         pipe(int *)  42,42
-int         pipe2(int *, int) 359,331
+int         pipe(int *)  42,42,-1
+int         pipe2(int *, int) 359,331,328
 int         dup2(int, int)   63
 int         select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *)  142
 int         ftruncate(int, off_t)  93
-int         ftruncate64(int, off64_t) 194
-int         getdents:getdents64(unsigned int, struct dirent *, unsigned int)   217,220
+int         ftruncate64(int, off64_t) 194,194,212
+int         getdents:getdents64(unsigned int, struct dirent *, unsigned int)   217,220,219
 int         fsync(int)  118
-int         fdatasync(int) 148
-int         fchown:fchown32(int, uid_t, gid_t)  207
+int         fdatasync(int) 148,148,152
+int         fchown:fchown32(int, uid_t, gid_t)  207,207,-1
+int         fchown:fchown(int, uid_t, gid_t)    -1,-1,95
 void        sync(void)  36
-int         __fcntl64:fcntl64(int, int, void *)  221
-int         __fstatfs64:fstatfs64(int, size_t, struct statfs *)  267,269
-ssize_t     sendfile(int out_fd, int in_fd, off_t *offset, size_t count)  187
-int         fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags)   327,300
-int         mkdirat(int dirfd, const char *pathname, mode_t mode)  323,296
-int         fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags)  325,298
-int         fchmodat(int dirfd, const char *path, mode_t mode, int flags)  333,306
-int         renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath)  329,302
-int         fsetxattr(int, const char *, const void *, size_t, int) 228
-ssize_t     fgetxattr(int, const char *, void *, size_t) 231
-ssize_t     flistxattr(int, char *, size_t) 234
-int         fremovexattr(int, const char *) 237
+int         __fcntl64:fcntl64(int, int, void *)  221,221,220
+int         __fstatfs64:fstatfs64(int, size_t, struct statfs *)  267,269,256
+ssize_t     sendfile(int out_fd, int in_fd, off_t *offset, size_t count)  187,187,207
+int         fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags)   327,300,293
+int         mkdirat(int dirfd, const char *pathname, mode_t mode)  323,296,289
+int         fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags)  325,298,291
+int         fchmodat(int dirfd, const char *path, mode_t mode, int flags)  333,306,299
+int         renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath)  329,302,295
+int         fsetxattr(int, const char *, const void *, size_t, int) 228,228,226
+ssize_t     fgetxattr(int, const char *, void *, size_t) 231,231,229
+ssize_t     flistxattr(int, char *, size_t) 234,234,232
+int         fremovexattr(int, const char *) 237,237,235
 
 # file system
 int     link (const char*, const char*)  9
 int     unlink (const char*)             10
-int     unlinkat (int, const char *, int)   328,301
+int     unlinkat (int, const char *, int)   328,301,294
 int     chdir (const char*)              12
 int     mknod (const char*, mode_t, dev_t)  14
 int     chmod (const char*,mode_t)          15
-int     chown:chown32(const char *, uid_t, gid_t)  212
-int     lchown:lchown32 (const char*, uid_t, gid_t)  198
+int     chown:chown32(const char *, uid_t, gid_t)  212,212,-1
+int     chown:chown(const char *, uid_t, gid_t)    -1,-1,202
+int     lchown:lchown32 (const char*, uid_t, gid_t)  198,198,-1
+int     lchown:lchown (const char*, uid_t, gid_t)  -1,-1,16
 int     mount (const char*, const char*, const char*, unsigned long, const void*)  21
 int     umount(const char*)  stub
 int     umount2 (const char*, int)  52
-int     fstat:fstat64(int, struct stat*)    197
-int     stat:stat64(const char *, struct stat *)  195
-int     lstat:lstat64(const char *, struct stat *)  196
+int     fstat:fstat64(int, struct stat*)    197,197,215
+int     stat:stat64(const char *, struct stat *)  195,195,213
+int     lstat:lstat64(const char *, struct stat *)  196,196,214
 int     mkdir(const char *, mode_t) 39
 int     readlink(const char *, char *, size_t)  85
 int     rmdir(const char *)  40
 int     rename(const char *, const char *)  38
-int     __getcwd:getcwd(char * buf, size_t size)  183
+int     __getcwd:getcwd(char * buf, size_t size)  183,183,203
 int     access(const char *, int)  33
-int     faccessat(int, const char *, int, int)  334,307
+int     faccessat(int, const char *, int, int)  334,307,300
 int     symlink(const char *, const char *)  83
 int     fchdir(int)    133
 int     truncate(const char*, off_t)    92
-int     setxattr(const char *, const char *, const void *, size_t, int) 226
-int     lsetxattr(const char *, const char *, const void *, size_t, int) 227
-ssize_t getxattr(const char *, const char *, void *, size_t) 229
-ssize_t lgetxattr(const char *, const char *, void *, size_t) 230
-ssize_t listxattr(const char *, char *, size_t) 232
-ssize_t llistxattr(const char *, char *, size_t) 233
-int     removexattr(const char *, const char *) 235
-int     lremovexattr(const char *, const char *) 236
-int     __statfs64:statfs64(const char *, size_t, struct statfs *)  266,268
+int     setxattr(const char *, const char *, const void *, size_t, int) 226,226,224
+int     lsetxattr(const char *, const char *, const void *, size_t, int) 227,227,225
+ssize_t getxattr(const char *, const char *, void *, size_t) 229,229,227
+ssize_t lgetxattr(const char *, const char *, void *, size_t) 230,230,228
+ssize_t listxattr(const char *, char *, size_t) 232,232,230
+ssize_t llistxattr(const char *, char *, size_t) 233,233,231
+int     removexattr(const char *, const char *) 235,235,233
+int     lremovexattr(const char *, const char *) 236,236,234
+int     __statfs64:statfs64(const char *, size_t, struct statfs *)  266,268,255
 
 # time
 int           pause ()                       29
 int           gettimeofday(struct timeval*, struct timezone*)       78
 int           settimeofday(const struct timeval*, const struct timezone*)   79
 clock_t       times(struct tms *)       43
-int           nanosleep(const struct timespec *, struct timespec *)   162
-int           clock_gettime(clockid_t clk_id, struct timespec *tp)    263,265
-int           clock_settime(clockid_t clk_id, const struct timespec *tp)  262,264
-int           clock_getres(clockid_t clk_id, struct timespec *res)   264,266
-int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem)  265,267
+int           nanosleep(const struct timespec *, struct timespec *)   162,162,166
+int           clock_gettime(clockid_t clk_id, struct timespec *tp)    263,265,263
+int           clock_settime(clockid_t clk_id, const struct timespec *tp)  262,264,262
+int           clock_getres(clockid_t clk_id, struct timespec *res)   264,266,264
+int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem)  265,267,265
 int           getitimer(int, const struct itimerval *)   105
 int           setitimer(int, const struct itimerval *, struct itimerval *)  104
-int           __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)    257,259
-int           __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 258,260
-int           __timer_gettime:timer_gettime(timer_t, struct itimerspec*)                                259,261
-int           __timer_getoverrun:timer_getoverrun(timer_t)                                              260,262
-int           __timer_delete:timer_delete(timer_t)                                                      261,263
-int           utimes(const char*, const struct timeval tvp[2])                          269, 271
-int           utimensat(int, const char *, const struct timespec times[2], int)         348, 320, 320
+int           __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid)    257,259,257
+int           __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 258,260,258
+int           __timer_gettime:timer_gettime(timer_t, struct itimerspec*)                                259,261,259
+int           __timer_getoverrun:timer_getoverrun(timer_t)                                              260,262,260
+int           __timer_delete:timer_delete(timer_t)                                                      261,263,261
+int           utimes(const char*, const struct timeval tvp[2])                          269,271,267
+int           utimensat(int, const char *, const struct timespec times[2], int)         348,320,316
 
 # signals
 int     sigaction(int, const struct sigaction *, struct sigaction *)  67
 int     sigprocmask(int, const sigset_t *, sigset_t *)  126
 int     __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask)  72
-int     __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize)  174
-int     __rt_sigprocmask:rt_sigprocmask (int  how, const sigset_t *set, sigset_t *oset, size_t sigsetsize)  175
-int     __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t  *info, struct timespec_t  *timeout, size_t  sigset_size)  177
+int     __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize)  174,174,194
+int     __rt_sigprocmask:rt_sigprocmask (int  how, const sigset_t *set, sigset_t *oset, size_t sigsetsize)  175,175,195
+int     __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t  *info, struct timespec_t  *timeout, size_t  sigset_size)  177,177,197
 int     sigpending(sigset_t *)  73
 
 # sockets
-int           socket(int, int, int)              281,-1
-int           socketpair(int, int, int, int*)    288,-1
-int           bind(int, struct sockaddr *, int)  282,-1
-int           connect(int, struct sockaddr *, socklen_t)   283,-1
-int           listen(int, int)                   284,-1
-int           accept(int, struct sockaddr *, socklen_t *)  285,-1
-int           getsockname(int, struct sockaddr *, socklen_t *)  286,-1
-int           getpeername(int, struct sockaddr *, socklen_t *)  287,-1
-int           sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  290,-1
-int           recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  292,-1
-int           shutdown(int, int)  293,-1
-int           setsockopt(int, int, int, const void *, socklen_t)  294,-1
-int           getsockopt(int, int, int, void *, socklen_t *)    295,-1
-int           sendmsg(int, const struct msghdr *, unsigned int)  296,-1
-int           recvmsg(int, struct msghdr *, unsigned int)   297,-1
+int           socket(int, int, int)              281,-1,183
+int           socketpair(int, int, int, int*)    288,-1,184
+int           bind(int, struct sockaddr *, int)  282,-1,169
+int           connect(int, struct sockaddr *, socklen_t)   283,-1,170
+int           listen(int, int)                   284,-1,174
+int           accept(int, struct sockaddr *, socklen_t *)  285,-1,168
+int           getsockname(int, struct sockaddr *, socklen_t *)  286,-1,172
+int           getpeername(int, struct sockaddr *, socklen_t *)  287,-1,171
+int           sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  290,-1,180
+int           recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  292,-1,176
+int           shutdown(int, int)  293,-1,182
+int           setsockopt(int, int, int, const void *, socklen_t)  294,-1,181
+int           getsockopt(int, int, int, void *, socklen_t *)    295,-1,173
+int           sendmsg(int, const struct msghdr *, unsigned int)  296,-1,179
+int           recvmsg(int, struct msghdr *, unsigned int)   297,-1,177
 
 # sockets for x86. These are done as an "indexed" call to socketcall syscall.
-int           socket:socketcall:1 (int, int, int) -1,102
-int           bind:socketcall:2 (int, struct sockaddr *, int)  -1,102
-int           connect:socketcall:3(int, struct sockaddr *, socklen_t)   -1,102
-int           listen:socketcall:4(int, int)                   -1,102
-int           accept:socketcall:5(int, struct sockaddr *, socklen_t *)  -1,102
-int           getsockname:socketcall:6(int, struct sockaddr *, socklen_t *)  -1,102
-int           getpeername:socketcall:7(int, struct sockaddr *, socklen_t *)  -1,102
-int           socketpair:socketcall:8(int, int, int, int*)    -1,102
-int           sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  -1,102
-int           recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  -1,102
+int           socket:socketcall:1 (int, int, int) -1,102,-1
+int           bind:socketcall:2 (int, struct sockaddr *, int)  -1,102,-1
+int           connect:socketcall:3(int, struct sockaddr *, socklen_t)   -1,102,-1
+int           listen:socketcall:4(int, int)                   -1,102,-1
+int           accept:socketcall:5(int, struct sockaddr *, socklen_t *)  -1,102,-1
+int           getsockname:socketcall:6(int, struct sockaddr *, socklen_t *)  -1,102,-1
+int           getpeername:socketcall:7(int, struct sockaddr *, socklen_t *)  -1,102,-1
+int           socketpair:socketcall:8(int, int, int, int*)    -1,102,-1
+int           sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t)  -1,102,-1
+int           recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *)  -1,102,-1
 int           shutdown:socketcall:13(int, int)  -1,102,-1
-int           setsockopt:socketcall:14(int, int, int, const void *, socklen_t)  -1,102
-int           getsockopt:socketcall:15(int, int, int, void *, socklen_t *)    -1,102
-int           sendmsg:socketcall:16(int, const struct msghdr *, unsigned int)  -1,102
-int           recvmsg:socketcall:17(int, struct msghdr *, unsigned int)   -1,102
+int           setsockopt:socketcall:14(int, int, int, const void *, socklen_t)  -1,102,-1
+int           getsockopt:socketcall:15(int, int, int, void *, socklen_t *)    -1,102,-1
+int           sendmsg:socketcall:16(int, const struct msghdr *, unsigned int)  -1,102,-1
+int           recvmsg:socketcall:17(int, struct msghdr *, unsigned int)   -1,102,-1
 
 # scheduler & real-time
-int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)  156
-int sched_getscheduler(pid_t pid)  157
-int sched_yield(void)  158
-int sched_setparam(pid_t pid, const struct sched_param *param)  154
-int sched_getparam(pid_t pid, struct sched_param *param)  155
-int sched_get_priority_max(int policy)  159
-int sched_get_priority_min(int policy)  160
-int sched_rr_get_interval(pid_t pid, struct timespec *interval)  161
-int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 241
-int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set)  242
-int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318
+int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)  156,156,160
+int sched_getscheduler(pid_t pid)  157,157,161
+int sched_yield(void)  158,158,162
+int sched_setparam(pid_t pid, const struct sched_param *param)  154,154,158
+int sched_getparam(pid_t pid, struct sched_param *param)  155,155,159
+int sched_get_priority_max(int policy)  159,159,163
+int sched_get_priority_min(int policy)  160,160,164
+int sched_rr_get_interval(pid_t pid, struct timespec *interval)  161,161,165
+int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 241,241,239
+int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set)  242,242,240
+int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318,312
 
 # io priorities
-int ioprio_set(int which, int who, int ioprio) 314,289
-int ioprio_get(int which, int who) 315,290
+int ioprio_set(int which, int who, int ioprio) 314,289,314
+int ioprio_get(int which, int who) 315,290,315
 
 # other
 int     uname(struct utsname *)  122
@@ -268,21 +286,25 @@
 long    perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 364
 
 # futex
-int	futex(void *, int, int, void *, void *, int) 240
+int	futex(void *, int, int, void *, void *, int) 240,240,238
 
 # epoll
-int     epoll_create(int size)     250,254
-int     epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)    251,255
-int     epoll_wait(int epfd, struct epoll_event *events, int max, int timeout)   252,256
+int     epoll_create(int size)     250,254,248
+int     epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)    251,255,249
+int     epoll_wait(int epfd, struct epoll_event *events, int max, int timeout)   252,256,250
 
-int     inotify_init(void)      316,291,290
-int     inotify_add_watch(int, const char *, unsigned int)  317,292
-int     inotify_rm_watch(int, unsigned int)  318,293
+int     inotify_init(void)      316,291,284
+int     inotify_add_watch(int, const char *, unsigned int)  317,292,285
+int     inotify_rm_watch(int, unsigned int)  318,293,286
 
-int     poll(struct pollfd *, unsigned int, long)  168
+int     poll(struct pollfd *, unsigned int, long)  168,168,188
 
-int     eventfd:eventfd2(unsigned int, int)  356,328
+int     eventfd:eventfd2(unsigned int, int)  356,328,325
 
 # ARM-specific ARM_NR_BASE == 0x0f0000 == 983040
-int     __set_tls:ARM_set_tls(void*)                                 983045,-1
-int     cacheflush:ARM_cacheflush(long start, long end, long flags)  983042,-1
+int     __set_tls:ARM_set_tls(void*)                                 983045,-1,-1
+int     cacheflush:ARM_cacheflush(long start, long end, long flags)  983042,-1,-1
+
+# MIPS-specific
+int	_flush_cache:cacheflush(char *addr, const int nbytes, const int op)	-1,-1,147
+int	syscall(int number,...) -1,-1,0
diff --git a/libc/arch-arm/bionic/memcpy.S b/libc/arch-arm/bionic/memcpy.S
index 8c0b4d7..8453cc0 100644
--- a/libc/arch-arm/bionic/memcpy.S
+++ b/libc/arch-arm/bionic/memcpy.S
@@ -34,23 +34,28 @@
         .text
         .fpu    neon
 
+#ifdef HAVE_32_BYTE_CACHE_LINE
+/* a prefetch distance of 2 cache-lines */
+#define CACHE_LINE_SIZE     32
+#define PREFETCH_DISTANCE   (CACHE_LINE_SIZE*2)
+#else
 /* a prefetch distance of 4 cache-lines works best experimentally */
 #define CACHE_LINE_SIZE     64
 #define PREFETCH_DISTANCE   (CACHE_LINE_SIZE*4)
+#endif
 
 ENTRY(memcpy)
         .save       {r0, lr}
-        stmfd       sp!, {r0, lr}
-
         /* start preloading as early as possible */
         pld         [r1, #(CACHE_LINE_SIZE*0)]
+        stmfd       sp!, {r0, lr}
         pld         [r1, #(CACHE_LINE_SIZE*1)]
 
         /* do we have at least 16-bytes to copy (needed for alignment below) */
         cmp         r2, #16
         blo         5f
 
-        /* align destination to half cache-line for the write-buffer */
+        /* align destination to cache-line for the write-buffer */
         rsb         r3, r0, #0
         ands        r3, r3, #0xF
         beq         0f
@@ -79,6 +84,26 @@
         pld         [r1, #(CACHE_LINE_SIZE*0)]
         pld         [r1, #(CACHE_LINE_SIZE*1)]
 
+#ifdef HAVE_32_BYTE_CACHE_LINE
+        /* make sure we have at least 32 bytes to copy */
+        subs        r2, r2, #32
+        blo         4f
+
+        /* preload all the cache lines we need.
+         * NOTE: the number of pld below depends on PREFETCH_DISTANCE,
+         * ideally would would increase the distance in the main loop to
+         * avoid the goofy code below. In practice this doesn't seem to make
+         * a big difference.
+         */
+        pld         [r1, #(PREFETCH_DISTANCE)]
+
+1:      /* The main loop copies 32 bytes at a time */
+        vld1.8      {d0  - d3},   [r1]!
+        pld         [r1, #(PREFETCH_DISTANCE)]
+        subs        r2, r2, #32
+        vst1.8      {d0  - d3},   [r0, :128]!
+        bhs         1b
+#else
         /* make sure we have at least 64 bytes to copy */
         subs        r2, r2, #64
         blo         2f
@@ -112,7 +137,7 @@
         subs        r2, r2, #32
         vst1.8      {d0 - d3},  [r0, :128]!
         bhs         3b
-
+#endif
 4:      /* less than 32 left */
         add         r2, r2, #32
         tst         r2, #0x10
diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk
new file mode 100644
index 0000000..8c0c4dc
--- /dev/null
+++ b/libc/arch-mips/syscalls.mk
@@ -0,0 +1,201 @@
+# auto-generated by gensyscalls.py, do not touch
+syscall_src := 
+syscall_src += arch-mips/syscalls/_exit.S
+syscall_src += arch-mips/syscalls/_exit_thread.S
+syscall_src += arch-mips/syscalls/__fork.S
+syscall_src += arch-mips/syscalls/_waitpid.S
+syscall_src += arch-mips/syscalls/__waitid.S
+syscall_src += arch-mips/syscalls/__sys_clone.S
+syscall_src += arch-mips/syscalls/execve.S
+syscall_src += arch-mips/syscalls/__setuid.S
+syscall_src += arch-mips/syscalls/getuid.S
+syscall_src += arch-mips/syscalls/getgid.S
+syscall_src += arch-mips/syscalls/geteuid.S
+syscall_src += arch-mips/syscalls/getegid.S
+syscall_src += arch-mips/syscalls/getresuid.S
+syscall_src += arch-mips/syscalls/getresgid.S
+syscall_src += arch-mips/syscalls/gettid.S
+syscall_src += arch-mips/syscalls/readahead.S
+syscall_src += arch-mips/syscalls/getgroups.S
+syscall_src += arch-mips/syscalls/getpgid.S
+syscall_src += arch-mips/syscalls/getppid.S
+syscall_src += arch-mips/syscalls/setsid.S
+syscall_src += arch-mips/syscalls/setgid.S
+syscall_src += arch-mips/syscalls/__setreuid.S
+syscall_src += arch-mips/syscalls/__setresuid.S
+syscall_src += arch-mips/syscalls/setresgid.S
+syscall_src += arch-mips/syscalls/__brk.S
+syscall_src += arch-mips/syscalls/kill.S
+syscall_src += arch-mips/syscalls/tkill.S
+syscall_src += arch-mips/syscalls/tgkill.S
+syscall_src += arch-mips/syscalls/__ptrace.S
+syscall_src += arch-mips/syscalls/__set_thread_area.S
+syscall_src += arch-mips/syscalls/__getpriority.S
+syscall_src += arch-mips/syscalls/setpriority.S
+syscall_src += arch-mips/syscalls/setrlimit.S
+syscall_src += arch-mips/syscalls/getrlimit.S
+syscall_src += arch-mips/syscalls/getrusage.S
+syscall_src += arch-mips/syscalls/setgroups.S
+syscall_src += arch-mips/syscalls/setpgid.S
+syscall_src += arch-mips/syscalls/setregid.S
+syscall_src += arch-mips/syscalls/chroot.S
+syscall_src += arch-mips/syscalls/prctl.S
+syscall_src += arch-mips/syscalls/capget.S
+syscall_src += arch-mips/syscalls/capset.S
+syscall_src += arch-mips/syscalls/sigaltstack.S
+syscall_src += arch-mips/syscalls/acct.S
+syscall_src += arch-mips/syscalls/read.S
+syscall_src += arch-mips/syscalls/write.S
+syscall_src += arch-mips/syscalls/pread64.S
+syscall_src += arch-mips/syscalls/pwrite64.S
+syscall_src += arch-mips/syscalls/__open.S
+syscall_src += arch-mips/syscalls/__openat.S
+syscall_src += arch-mips/syscalls/close.S
+syscall_src += arch-mips/syscalls/lseek.S
+syscall_src += arch-mips/syscalls/__llseek.S
+syscall_src += arch-mips/syscalls/getpid.S
+syscall_src += arch-mips/syscalls/__mmap2.S
+syscall_src += arch-mips/syscalls/munmap.S
+syscall_src += arch-mips/syscalls/mremap.S
+syscall_src += arch-mips/syscalls/msync.S
+syscall_src += arch-mips/syscalls/mprotect.S
+syscall_src += arch-mips/syscalls/madvise.S
+syscall_src += arch-mips/syscalls/mlock.S
+syscall_src += arch-mips/syscalls/munlock.S
+syscall_src += arch-mips/syscalls/mincore.S
+syscall_src += arch-mips/syscalls/__ioctl.S
+syscall_src += arch-mips/syscalls/readv.S
+syscall_src += arch-mips/syscalls/writev.S
+syscall_src += arch-mips/syscalls/__fcntl.S
+syscall_src += arch-mips/syscalls/flock.S
+syscall_src += arch-mips/syscalls/fchmod.S
+syscall_src += arch-mips/syscalls/dup.S
+syscall_src += arch-mips/syscalls/pipe2.S
+syscall_src += arch-mips/syscalls/dup2.S
+syscall_src += arch-mips/syscalls/select.S
+syscall_src += arch-mips/syscalls/ftruncate.S
+syscall_src += arch-mips/syscalls/ftruncate64.S
+syscall_src += arch-mips/syscalls/getdents.S
+syscall_src += arch-mips/syscalls/fsync.S
+syscall_src += arch-mips/syscalls/fdatasync.S
+syscall_src += arch-mips/syscalls/fchown.S
+syscall_src += arch-mips/syscalls/sync.S
+syscall_src += arch-mips/syscalls/__fcntl64.S
+syscall_src += arch-mips/syscalls/__fstatfs64.S
+syscall_src += arch-mips/syscalls/sendfile.S
+syscall_src += arch-mips/syscalls/fstatat.S
+syscall_src += arch-mips/syscalls/mkdirat.S
+syscall_src += arch-mips/syscalls/fchownat.S
+syscall_src += arch-mips/syscalls/fchmodat.S
+syscall_src += arch-mips/syscalls/renameat.S
+syscall_src += arch-mips/syscalls/fsetxattr.S
+syscall_src += arch-mips/syscalls/fgetxattr.S
+syscall_src += arch-mips/syscalls/flistxattr.S
+syscall_src += arch-mips/syscalls/fremovexattr.S
+syscall_src += arch-mips/syscalls/link.S
+syscall_src += arch-mips/syscalls/unlink.S
+syscall_src += arch-mips/syscalls/unlinkat.S
+syscall_src += arch-mips/syscalls/chdir.S
+syscall_src += arch-mips/syscalls/mknod.S
+syscall_src += arch-mips/syscalls/chmod.S
+syscall_src += arch-mips/syscalls/chown.S
+syscall_src += arch-mips/syscalls/lchown.S
+syscall_src += arch-mips/syscalls/mount.S
+syscall_src += arch-mips/syscalls/umount2.S
+syscall_src += arch-mips/syscalls/fstat.S
+syscall_src += arch-mips/syscalls/stat.S
+syscall_src += arch-mips/syscalls/lstat.S
+syscall_src += arch-mips/syscalls/mkdir.S
+syscall_src += arch-mips/syscalls/readlink.S
+syscall_src += arch-mips/syscalls/rmdir.S
+syscall_src += arch-mips/syscalls/rename.S
+syscall_src += arch-mips/syscalls/__getcwd.S
+syscall_src += arch-mips/syscalls/access.S
+syscall_src += arch-mips/syscalls/faccessat.S
+syscall_src += arch-mips/syscalls/symlink.S
+syscall_src += arch-mips/syscalls/fchdir.S
+syscall_src += arch-mips/syscalls/truncate.S
+syscall_src += arch-mips/syscalls/setxattr.S
+syscall_src += arch-mips/syscalls/lsetxattr.S
+syscall_src += arch-mips/syscalls/getxattr.S
+syscall_src += arch-mips/syscalls/lgetxattr.S
+syscall_src += arch-mips/syscalls/listxattr.S
+syscall_src += arch-mips/syscalls/llistxattr.S
+syscall_src += arch-mips/syscalls/removexattr.S
+syscall_src += arch-mips/syscalls/lremovexattr.S
+syscall_src += arch-mips/syscalls/__statfs64.S
+syscall_src += arch-mips/syscalls/pause.S
+syscall_src += arch-mips/syscalls/gettimeofday.S
+syscall_src += arch-mips/syscalls/settimeofday.S
+syscall_src += arch-mips/syscalls/times.S
+syscall_src += arch-mips/syscalls/nanosleep.S
+syscall_src += arch-mips/syscalls/clock_gettime.S
+syscall_src += arch-mips/syscalls/clock_settime.S
+syscall_src += arch-mips/syscalls/clock_getres.S
+syscall_src += arch-mips/syscalls/clock_nanosleep.S
+syscall_src += arch-mips/syscalls/getitimer.S
+syscall_src += arch-mips/syscalls/setitimer.S
+syscall_src += arch-mips/syscalls/__timer_create.S
+syscall_src += arch-mips/syscalls/__timer_settime.S
+syscall_src += arch-mips/syscalls/__timer_gettime.S
+syscall_src += arch-mips/syscalls/__timer_getoverrun.S
+syscall_src += arch-mips/syscalls/__timer_delete.S
+syscall_src += arch-mips/syscalls/utimes.S
+syscall_src += arch-mips/syscalls/utimensat.S
+syscall_src += arch-mips/syscalls/sigaction.S
+syscall_src += arch-mips/syscalls/sigprocmask.S
+syscall_src += arch-mips/syscalls/__sigsuspend.S
+syscall_src += arch-mips/syscalls/__rt_sigaction.S
+syscall_src += arch-mips/syscalls/__rt_sigprocmask.S
+syscall_src += arch-mips/syscalls/__rt_sigtimedwait.S
+syscall_src += arch-mips/syscalls/sigpending.S
+syscall_src += arch-mips/syscalls/socket.S
+syscall_src += arch-mips/syscalls/socketpair.S
+syscall_src += arch-mips/syscalls/bind.S
+syscall_src += arch-mips/syscalls/connect.S
+syscall_src += arch-mips/syscalls/listen.S
+syscall_src += arch-mips/syscalls/accept.S
+syscall_src += arch-mips/syscalls/getsockname.S
+syscall_src += arch-mips/syscalls/getpeername.S
+syscall_src += arch-mips/syscalls/sendto.S
+syscall_src += arch-mips/syscalls/recvfrom.S
+syscall_src += arch-mips/syscalls/shutdown.S
+syscall_src += arch-mips/syscalls/setsockopt.S
+syscall_src += arch-mips/syscalls/getsockopt.S
+syscall_src += arch-mips/syscalls/sendmsg.S
+syscall_src += arch-mips/syscalls/recvmsg.S
+syscall_src += arch-mips/syscalls/sched_setscheduler.S
+syscall_src += arch-mips/syscalls/sched_getscheduler.S
+syscall_src += arch-mips/syscalls/sched_yield.S
+syscall_src += arch-mips/syscalls/sched_setparam.S
+syscall_src += arch-mips/syscalls/sched_getparam.S
+syscall_src += arch-mips/syscalls/sched_get_priority_max.S
+syscall_src += arch-mips/syscalls/sched_get_priority_min.S
+syscall_src += arch-mips/syscalls/sched_rr_get_interval.S
+syscall_src += arch-mips/syscalls/sched_setaffinity.S
+syscall_src += arch-mips/syscalls/__sched_getaffinity.S
+syscall_src += arch-mips/syscalls/__getcpu.S
+syscall_src += arch-mips/syscalls/ioprio_set.S
+syscall_src += arch-mips/syscalls/ioprio_get.S
+syscall_src += arch-mips/syscalls/uname.S
+syscall_src += arch-mips/syscalls/__wait4.S
+syscall_src += arch-mips/syscalls/umask.S
+syscall_src += arch-mips/syscalls/__reboot.S
+syscall_src += arch-mips/syscalls/__syslog.S
+syscall_src += arch-mips/syscalls/init_module.S
+syscall_src += arch-mips/syscalls/delete_module.S
+syscall_src += arch-mips/syscalls/klogctl.S
+syscall_src += arch-mips/syscalls/sysinfo.S
+syscall_src += arch-mips/syscalls/personality.S
+syscall_src += arch-mips/syscalls/perf_event_open.S
+syscall_src += arch-mips/syscalls/futex.S
+syscall_src += arch-mips/syscalls/epoll_create.S
+syscall_src += arch-mips/syscalls/epoll_ctl.S
+syscall_src += arch-mips/syscalls/epoll_wait.S
+syscall_src += arch-mips/syscalls/inotify_init.S
+syscall_src += arch-mips/syscalls/inotify_add_watch.S
+syscall_src += arch-mips/syscalls/inotify_rm_watch.S
+syscall_src += arch-mips/syscalls/poll.S
+syscall_src += arch-mips/syscalls/eventfd.S
+syscall_src += arch-mips/syscalls/_flush_cache.S
+syscall_src += arch-mips/syscalls/syscall.S
diff --git a/libc/arch-mips/syscalls/__brk.S b/libc/arch-mips/syscalls/__brk.S
new file mode 100644
index 0000000..1f09772
--- /dev/null
+++ b/libc/arch-mips/syscalls/__brk.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __brk
+    .align 4
+    .ent __brk
+
+__brk:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_brk
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __brk
diff --git a/libc/arch-mips/syscalls/__fcntl.S b/libc/arch-mips/syscalls/__fcntl.S
new file mode 100644
index 0000000..6dd76e3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fcntl.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __fcntl
+    .align 4
+    .ent __fcntl
+
+__fcntl:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fcntl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __fcntl
diff --git a/libc/arch-mips/syscalls/__fcntl64.S b/libc/arch-mips/syscalls/__fcntl64.S
new file mode 100644
index 0000000..e82e382
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fcntl64.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __fcntl64
+    .align 4
+    .ent __fcntl64
+
+__fcntl64:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fcntl64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __fcntl64
diff --git a/libc/arch-mips/syscalls/__fork.S b/libc/arch-mips/syscalls/__fork.S
new file mode 100644
index 0000000..db30472
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fork.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __fork
+    .align 4
+    .ent __fork
+
+__fork:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fork
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __fork
diff --git a/libc/arch-mips/syscalls/__fstatfs64.S b/libc/arch-mips/syscalls/__fstatfs64.S
new file mode 100644
index 0000000..6485d10
--- /dev/null
+++ b/libc/arch-mips/syscalls/__fstatfs64.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __fstatfs64
+    .align 4
+    .ent __fstatfs64
+
+__fstatfs64:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fstatfs64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __fstatfs64
diff --git a/libc/arch-mips/syscalls/__getcpu.S b/libc/arch-mips/syscalls/__getcpu.S
new file mode 100644
index 0000000..90d59f4
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getcpu.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __getcpu
+    .align 4
+    .ent __getcpu
+
+__getcpu:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getcpu
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __getcpu
diff --git a/libc/arch-mips/syscalls/__getcwd.S b/libc/arch-mips/syscalls/__getcwd.S
new file mode 100644
index 0000000..e8fa340
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getcwd.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __getcwd
+    .align 4
+    .ent __getcwd
+
+__getcwd:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getcwd
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __getcwd
diff --git a/libc/arch-mips/syscalls/__getpriority.S b/libc/arch-mips/syscalls/__getpriority.S
new file mode 100644
index 0000000..7cabd31
--- /dev/null
+++ b/libc/arch-mips/syscalls/__getpriority.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __getpriority
+    .align 4
+    .ent __getpriority
+
+__getpriority:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpriority
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __getpriority
diff --git a/libc/arch-mips/syscalls/__ioctl.S b/libc/arch-mips/syscalls/__ioctl.S
new file mode 100644
index 0000000..2524e02
--- /dev/null
+++ b/libc/arch-mips/syscalls/__ioctl.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __ioctl
+    .align 4
+    .ent __ioctl
+
+__ioctl:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ioctl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __ioctl
diff --git a/libc/arch-mips/syscalls/__llseek.S b/libc/arch-mips/syscalls/__llseek.S
new file mode 100644
index 0000000..fbfd583
--- /dev/null
+++ b/libc/arch-mips/syscalls/__llseek.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __llseek
+    .align 4
+    .ent __llseek
+
+__llseek:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR__llseek
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __llseek
diff --git a/libc/arch-mips/syscalls/__mmap2.S b/libc/arch-mips/syscalls/__mmap2.S
new file mode 100644
index 0000000..98f97eb
--- /dev/null
+++ b/libc/arch-mips/syscalls/__mmap2.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __mmap2
+    .align 4
+    .ent __mmap2
+
+__mmap2:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mmap2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __mmap2
diff --git a/libc/arch-mips/syscalls/__open.S b/libc/arch-mips/syscalls/__open.S
new file mode 100644
index 0000000..0ccb286
--- /dev/null
+++ b/libc/arch-mips/syscalls/__open.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __open
+    .align 4
+    .ent __open
+
+__open:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_open
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __open
diff --git a/libc/arch-mips/syscalls/__openat.S b/libc/arch-mips/syscalls/__openat.S
new file mode 100644
index 0000000..04399b4
--- /dev/null
+++ b/libc/arch-mips/syscalls/__openat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __openat
+    .align 4
+    .ent __openat
+
+__openat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_openat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __openat
diff --git a/libc/arch-mips/syscalls/__ptrace.S b/libc/arch-mips/syscalls/__ptrace.S
new file mode 100644
index 0000000..0bcba9f
--- /dev/null
+++ b/libc/arch-mips/syscalls/__ptrace.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __ptrace
+    .align 4
+    .ent __ptrace
+
+__ptrace:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ptrace
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __ptrace
diff --git a/libc/arch-mips/syscalls/__reboot.S b/libc/arch-mips/syscalls/__reboot.S
new file mode 100644
index 0000000..5e8e57a
--- /dev/null
+++ b/libc/arch-mips/syscalls/__reboot.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __reboot
+    .align 4
+    .ent __reboot
+
+__reboot:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_reboot
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __reboot
diff --git a/libc/arch-mips/syscalls/__rt_sigaction.S b/libc/arch-mips/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..43a571a
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigaction.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __rt_sigaction
+    .align 4
+    .ent __rt_sigaction
+
+__rt_sigaction:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigaction
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __rt_sigaction
diff --git a/libc/arch-mips/syscalls/__rt_sigprocmask.S b/libc/arch-mips/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..59a8894
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __rt_sigprocmask
+    .align 4
+    .ent __rt_sigprocmask
+
+__rt_sigprocmask:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigprocmask
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __rt_sigprocmask
diff --git a/libc/arch-mips/syscalls/__rt_sigtimedwait.S b/libc/arch-mips/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..dae872e
--- /dev/null
+++ b/libc/arch-mips/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __rt_sigtimedwait
+    .align 4
+    .ent __rt_sigtimedwait
+
+__rt_sigtimedwait:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rt_sigtimedwait
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __rt_sigtimedwait
diff --git a/libc/arch-mips/syscalls/__sched_getaffinity.S b/libc/arch-mips/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..cc01ff2
--- /dev/null
+++ b/libc/arch-mips/syscalls/__sched_getaffinity.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __sched_getaffinity
+    .align 4
+    .ent __sched_getaffinity
+
+__sched_getaffinity:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_getaffinity
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __sched_getaffinity
diff --git a/libc/arch-mips/syscalls/__set_thread_area.S b/libc/arch-mips/syscalls/__set_thread_area.S
new file mode 100644
index 0000000..2aac901
--- /dev/null
+++ b/libc/arch-mips/syscalls/__set_thread_area.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __set_thread_area
+    .align 4
+    .ent __set_thread_area
+
+__set_thread_area:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_set_thread_area
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __set_thread_area
diff --git a/libc/arch-mips/syscalls/__setresuid.S b/libc/arch-mips/syscalls/__setresuid.S
new file mode 100644
index 0000000..e00d2e1
--- /dev/null
+++ b/libc/arch-mips/syscalls/__setresuid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __setresuid
+    .align 4
+    .ent __setresuid
+
+__setresuid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setresuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __setresuid
diff --git a/libc/arch-mips/syscalls/__setreuid.S b/libc/arch-mips/syscalls/__setreuid.S
new file mode 100644
index 0000000..b45f3fc
--- /dev/null
+++ b/libc/arch-mips/syscalls/__setreuid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __setreuid
+    .align 4
+    .ent __setreuid
+
+__setreuid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setreuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __setreuid
diff --git a/libc/arch-mips/syscalls/__setuid.S b/libc/arch-mips/syscalls/__setuid.S
new file mode 100644
index 0000000..c221526
--- /dev/null
+++ b/libc/arch-mips/syscalls/__setuid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __setuid
+    .align 4
+    .ent __setuid
+
+__setuid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __setuid
diff --git a/libc/arch-mips/syscalls/__sigsuspend.S b/libc/arch-mips/syscalls/__sigsuspend.S
new file mode 100644
index 0000000..b622efe
--- /dev/null
+++ b/libc/arch-mips/syscalls/__sigsuspend.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __sigsuspend
+    .align 4
+    .ent __sigsuspend
+
+__sigsuspend:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigsuspend
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __sigsuspend
diff --git a/libc/arch-mips/syscalls/__statfs64.S b/libc/arch-mips/syscalls/__statfs64.S
new file mode 100644
index 0000000..4d1b17f
--- /dev/null
+++ b/libc/arch-mips/syscalls/__statfs64.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __statfs64
+    .align 4
+    .ent __statfs64
+
+__statfs64:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_statfs64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __statfs64
diff --git a/libc/arch-mips/syscalls/__sys_clone.S b/libc/arch-mips/syscalls/__sys_clone.S
new file mode 100644
index 0000000..3451e02
--- /dev/null
+++ b/libc/arch-mips/syscalls/__sys_clone.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __sys_clone
+    .align 4
+    .ent __sys_clone
+
+__sys_clone:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clone
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __sys_clone
diff --git a/libc/arch-mips/syscalls/__syslog.S b/libc/arch-mips/syscalls/__syslog.S
new file mode 100644
index 0000000..bdc194d
--- /dev/null
+++ b/libc/arch-mips/syscalls/__syslog.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __syslog
+    .align 4
+    .ent __syslog
+
+__syslog:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_syslog
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __syslog
diff --git a/libc/arch-mips/syscalls/__timer_create.S b/libc/arch-mips/syscalls/__timer_create.S
new file mode 100644
index 0000000..140d0d1
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_create.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __timer_create
+    .align 4
+    .ent __timer_create
+
+__timer_create:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_create
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __timer_create
diff --git a/libc/arch-mips/syscalls/__timer_delete.S b/libc/arch-mips/syscalls/__timer_delete.S
new file mode 100644
index 0000000..4f362e6
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_delete.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __timer_delete
+    .align 4
+    .ent __timer_delete
+
+__timer_delete:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_delete
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __timer_delete
diff --git a/libc/arch-mips/syscalls/__timer_getoverrun.S b/libc/arch-mips/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..68afa1c
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_getoverrun.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __timer_getoverrun
+    .align 4
+    .ent __timer_getoverrun
+
+__timer_getoverrun:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_getoverrun
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __timer_getoverrun
diff --git a/libc/arch-mips/syscalls/__timer_gettime.S b/libc/arch-mips/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..4a70da6
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_gettime.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __timer_gettime
+    .align 4
+    .ent __timer_gettime
+
+__timer_gettime:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_gettime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __timer_gettime
diff --git a/libc/arch-mips/syscalls/__timer_settime.S b/libc/arch-mips/syscalls/__timer_settime.S
new file mode 100644
index 0000000..ad84606
--- /dev/null
+++ b/libc/arch-mips/syscalls/__timer_settime.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __timer_settime
+    .align 4
+    .ent __timer_settime
+
+__timer_settime:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_timer_settime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __timer_settime
diff --git a/libc/arch-mips/syscalls/__wait4.S b/libc/arch-mips/syscalls/__wait4.S
new file mode 100644
index 0000000..713b7cb
--- /dev/null
+++ b/libc/arch-mips/syscalls/__wait4.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __wait4
+    .align 4
+    .ent __wait4
+
+__wait4:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_wait4
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __wait4
diff --git a/libc/arch-mips/syscalls/__waitid.S b/libc/arch-mips/syscalls/__waitid.S
new file mode 100644
index 0000000..83e5aa3
--- /dev/null
+++ b/libc/arch-mips/syscalls/__waitid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl __waitid
+    .align 4
+    .ent __waitid
+
+__waitid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_waitid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end __waitid
diff --git a/libc/arch-mips/syscalls/_exit.S b/libc/arch-mips/syscalls/_exit.S
new file mode 100644
index 0000000..b7ec876
--- /dev/null
+++ b/libc/arch-mips/syscalls/_exit.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl _exit
+    .align 4
+    .ent _exit
+
+_exit:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_exit_group
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end _exit
diff --git a/libc/arch-mips/syscalls/_exit_thread.S b/libc/arch-mips/syscalls/_exit_thread.S
new file mode 100644
index 0000000..0af9d3d
--- /dev/null
+++ b/libc/arch-mips/syscalls/_exit_thread.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl _exit_thread
+    .align 4
+    .ent _exit_thread
+
+_exit_thread:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_exit
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end _exit_thread
diff --git a/libc/arch-mips/syscalls/_flush_cache.S b/libc/arch-mips/syscalls/_flush_cache.S
new file mode 100644
index 0000000..07dee66
--- /dev/null
+++ b/libc/arch-mips/syscalls/_flush_cache.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl _flush_cache
+    .align 4
+    .ent _flush_cache
+
+_flush_cache:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_cacheflush
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end _flush_cache
diff --git a/libc/arch-mips/syscalls/_waitpid.S b/libc/arch-mips/syscalls/_waitpid.S
new file mode 100644
index 0000000..20db3a8
--- /dev/null
+++ b/libc/arch-mips/syscalls/_waitpid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl _waitpid
+    .align 4
+    .ent _waitpid
+
+_waitpid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_waitpid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end _waitpid
diff --git a/libc/arch-mips/syscalls/accept.S b/libc/arch-mips/syscalls/accept.S
new file mode 100644
index 0000000..c19216e
--- /dev/null
+++ b/libc/arch-mips/syscalls/accept.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl accept
+    .align 4
+    .ent accept
+
+accept:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_accept
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end accept
diff --git a/libc/arch-mips/syscalls/access.S b/libc/arch-mips/syscalls/access.S
new file mode 100644
index 0000000..a22ed92
--- /dev/null
+++ b/libc/arch-mips/syscalls/access.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl access
+    .align 4
+    .ent access
+
+access:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_access
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end access
diff --git a/libc/arch-mips/syscalls/acct.S b/libc/arch-mips/syscalls/acct.S
new file mode 100644
index 0000000..5235ede
--- /dev/null
+++ b/libc/arch-mips/syscalls/acct.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl acct
+    .align 4
+    .ent acct
+
+acct:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_acct
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end acct
diff --git a/libc/arch-mips/syscalls/bind.S b/libc/arch-mips/syscalls/bind.S
new file mode 100644
index 0000000..4f00922
--- /dev/null
+++ b/libc/arch-mips/syscalls/bind.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl bind
+    .align 4
+    .ent bind
+
+bind:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_bind
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end bind
diff --git a/libc/arch-mips/syscalls/capget.S b/libc/arch-mips/syscalls/capget.S
new file mode 100644
index 0000000..80e55ee
--- /dev/null
+++ b/libc/arch-mips/syscalls/capget.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl capget
+    .align 4
+    .ent capget
+
+capget:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_capget
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end capget
diff --git a/libc/arch-mips/syscalls/capset.S b/libc/arch-mips/syscalls/capset.S
new file mode 100644
index 0000000..0e4a3be
--- /dev/null
+++ b/libc/arch-mips/syscalls/capset.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl capset
+    .align 4
+    .ent capset
+
+capset:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_capset
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end capset
diff --git a/libc/arch-mips/syscalls/chdir.S b/libc/arch-mips/syscalls/chdir.S
new file mode 100644
index 0000000..42eb37c
--- /dev/null
+++ b/libc/arch-mips/syscalls/chdir.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl chdir
+    .align 4
+    .ent chdir
+
+chdir:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_chdir
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end chdir
diff --git a/libc/arch-mips/syscalls/chmod.S b/libc/arch-mips/syscalls/chmod.S
new file mode 100644
index 0000000..7ea3ede
--- /dev/null
+++ b/libc/arch-mips/syscalls/chmod.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl chmod
+    .align 4
+    .ent chmod
+
+chmod:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_chmod
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end chmod
diff --git a/libc/arch-mips/syscalls/chown.S b/libc/arch-mips/syscalls/chown.S
new file mode 100644
index 0000000..5fb1e32
--- /dev/null
+++ b/libc/arch-mips/syscalls/chown.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl chown
+    .align 4
+    .ent chown
+
+chown:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_chown
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end chown
diff --git a/libc/arch-mips/syscalls/chroot.S b/libc/arch-mips/syscalls/chroot.S
new file mode 100644
index 0000000..fafb6a2
--- /dev/null
+++ b/libc/arch-mips/syscalls/chroot.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl chroot
+    .align 4
+    .ent chroot
+
+chroot:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_chroot
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end chroot
diff --git a/libc/arch-mips/syscalls/clock_getres.S b/libc/arch-mips/syscalls/clock_getres.S
new file mode 100644
index 0000000..4021b14
--- /dev/null
+++ b/libc/arch-mips/syscalls/clock_getres.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl clock_getres
+    .align 4
+    .ent clock_getres
+
+clock_getres:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_getres
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end clock_getres
diff --git a/libc/arch-mips/syscalls/clock_gettime.S b/libc/arch-mips/syscalls/clock_gettime.S
new file mode 100644
index 0000000..ba7afb9
--- /dev/null
+++ b/libc/arch-mips/syscalls/clock_gettime.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl clock_gettime
+    .align 4
+    .ent clock_gettime
+
+clock_gettime:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_gettime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end clock_gettime
diff --git a/libc/arch-mips/syscalls/clock_nanosleep.S b/libc/arch-mips/syscalls/clock_nanosleep.S
new file mode 100644
index 0000000..1a9aef5
--- /dev/null
+++ b/libc/arch-mips/syscalls/clock_nanosleep.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl clock_nanosleep
+    .align 4
+    .ent clock_nanosleep
+
+clock_nanosleep:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_nanosleep
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end clock_nanosleep
diff --git a/libc/arch-mips/syscalls/clock_settime.S b/libc/arch-mips/syscalls/clock_settime.S
new file mode 100644
index 0000000..65d4388
--- /dev/null
+++ b/libc/arch-mips/syscalls/clock_settime.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl clock_settime
+    .align 4
+    .ent clock_settime
+
+clock_settime:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_clock_settime
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end clock_settime
diff --git a/libc/arch-mips/syscalls/close.S b/libc/arch-mips/syscalls/close.S
new file mode 100644
index 0000000..07ff4e3
--- /dev/null
+++ b/libc/arch-mips/syscalls/close.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl close
+    .align 4
+    .ent close
+
+close:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_close
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end close
diff --git a/libc/arch-mips/syscalls/connect.S b/libc/arch-mips/syscalls/connect.S
new file mode 100644
index 0000000..d1fc280
--- /dev/null
+++ b/libc/arch-mips/syscalls/connect.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl connect
+    .align 4
+    .ent connect
+
+connect:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_connect
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end connect
diff --git a/libc/arch-mips/syscalls/delete_module.S b/libc/arch-mips/syscalls/delete_module.S
new file mode 100644
index 0000000..db80ba7
--- /dev/null
+++ b/libc/arch-mips/syscalls/delete_module.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl delete_module
+    .align 4
+    .ent delete_module
+
+delete_module:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_delete_module
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end delete_module
diff --git a/libc/arch-mips/syscalls/dup.S b/libc/arch-mips/syscalls/dup.S
new file mode 100644
index 0000000..e815749
--- /dev/null
+++ b/libc/arch-mips/syscalls/dup.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl dup
+    .align 4
+    .ent dup
+
+dup:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_dup
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end dup
diff --git a/libc/arch-mips/syscalls/dup2.S b/libc/arch-mips/syscalls/dup2.S
new file mode 100644
index 0000000..6fb151f
--- /dev/null
+++ b/libc/arch-mips/syscalls/dup2.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl dup2
+    .align 4
+    .ent dup2
+
+dup2:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_dup2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end dup2
diff --git a/libc/arch-mips/syscalls/epoll_create.S b/libc/arch-mips/syscalls/epoll_create.S
new file mode 100644
index 0000000..e5e420b
--- /dev/null
+++ b/libc/arch-mips/syscalls/epoll_create.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl epoll_create
+    .align 4
+    .ent epoll_create
+
+epoll_create:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_epoll_create
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end epoll_create
diff --git a/libc/arch-mips/syscalls/epoll_ctl.S b/libc/arch-mips/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..f4f9f05
--- /dev/null
+++ b/libc/arch-mips/syscalls/epoll_ctl.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl epoll_ctl
+    .align 4
+    .ent epoll_ctl
+
+epoll_ctl:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_epoll_ctl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end epoll_ctl
diff --git a/libc/arch-mips/syscalls/epoll_wait.S b/libc/arch-mips/syscalls/epoll_wait.S
new file mode 100644
index 0000000..64d33fb
--- /dev/null
+++ b/libc/arch-mips/syscalls/epoll_wait.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl epoll_wait
+    .align 4
+    .ent epoll_wait
+
+epoll_wait:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_epoll_wait
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end epoll_wait
diff --git a/libc/arch-mips/syscalls/eventfd.S b/libc/arch-mips/syscalls/eventfd.S
new file mode 100644
index 0000000..5c4e22b
--- /dev/null
+++ b/libc/arch-mips/syscalls/eventfd.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl eventfd
+    .align 4
+    .ent eventfd
+
+eventfd:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_eventfd2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end eventfd
diff --git a/libc/arch-mips/syscalls/execve.S b/libc/arch-mips/syscalls/execve.S
new file mode 100644
index 0000000..31b9276
--- /dev/null
+++ b/libc/arch-mips/syscalls/execve.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl execve
+    .align 4
+    .ent execve
+
+execve:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_execve
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end execve
diff --git a/libc/arch-mips/syscalls/faccessat.S b/libc/arch-mips/syscalls/faccessat.S
new file mode 100644
index 0000000..97db4c0
--- /dev/null
+++ b/libc/arch-mips/syscalls/faccessat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl faccessat
+    .align 4
+    .ent faccessat
+
+faccessat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_faccessat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end faccessat
diff --git a/libc/arch-mips/syscalls/fchdir.S b/libc/arch-mips/syscalls/fchdir.S
new file mode 100644
index 0000000..93298bd
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchdir.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fchdir
+    .align 4
+    .ent fchdir
+
+fchdir:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchdir
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fchdir
diff --git a/libc/arch-mips/syscalls/fchmod.S b/libc/arch-mips/syscalls/fchmod.S
new file mode 100644
index 0000000..f483567
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchmod.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fchmod
+    .align 4
+    .ent fchmod
+
+fchmod:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchmod
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fchmod
diff --git a/libc/arch-mips/syscalls/fchmodat.S b/libc/arch-mips/syscalls/fchmodat.S
new file mode 100644
index 0000000..8ba1bbe
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchmodat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fchmodat
+    .align 4
+    .ent fchmodat
+
+fchmodat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchmodat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fchmodat
diff --git a/libc/arch-mips/syscalls/fchown.S b/libc/arch-mips/syscalls/fchown.S
new file mode 100644
index 0000000..24fc08f
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchown.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fchown
+    .align 4
+    .ent fchown
+
+fchown:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchown
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fchown
diff --git a/libc/arch-mips/syscalls/fchownat.S b/libc/arch-mips/syscalls/fchownat.S
new file mode 100644
index 0000000..983ed56
--- /dev/null
+++ b/libc/arch-mips/syscalls/fchownat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fchownat
+    .align 4
+    .ent fchownat
+
+fchownat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fchownat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fchownat
diff --git a/libc/arch-mips/syscalls/fdatasync.S b/libc/arch-mips/syscalls/fdatasync.S
new file mode 100644
index 0000000..312439d
--- /dev/null
+++ b/libc/arch-mips/syscalls/fdatasync.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fdatasync
+    .align 4
+    .ent fdatasync
+
+fdatasync:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fdatasync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fdatasync
diff --git a/libc/arch-mips/syscalls/fgetxattr.S b/libc/arch-mips/syscalls/fgetxattr.S
new file mode 100644
index 0000000..7e77e61
--- /dev/null
+++ b/libc/arch-mips/syscalls/fgetxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fgetxattr
+    .align 4
+    .ent fgetxattr
+
+fgetxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fgetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fgetxattr
diff --git a/libc/arch-mips/syscalls/flistxattr.S b/libc/arch-mips/syscalls/flistxattr.S
new file mode 100644
index 0000000..26e26e1
--- /dev/null
+++ b/libc/arch-mips/syscalls/flistxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl flistxattr
+    .align 4
+    .ent flistxattr
+
+flistxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_flistxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end flistxattr
diff --git a/libc/arch-mips/syscalls/flock.S b/libc/arch-mips/syscalls/flock.S
new file mode 100644
index 0000000..f9a3142
--- /dev/null
+++ b/libc/arch-mips/syscalls/flock.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl flock
+    .align 4
+    .ent flock
+
+flock:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_flock
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end flock
diff --git a/libc/arch-mips/syscalls/fremovexattr.S b/libc/arch-mips/syscalls/fremovexattr.S
new file mode 100644
index 0000000..db3eb6c
--- /dev/null
+++ b/libc/arch-mips/syscalls/fremovexattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fremovexattr
+    .align 4
+    .ent fremovexattr
+
+fremovexattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fremovexattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fremovexattr
diff --git a/libc/arch-mips/syscalls/fsetxattr.S b/libc/arch-mips/syscalls/fsetxattr.S
new file mode 100644
index 0000000..9e666f2
--- /dev/null
+++ b/libc/arch-mips/syscalls/fsetxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fsetxattr
+    .align 4
+    .ent fsetxattr
+
+fsetxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fsetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fsetxattr
diff --git a/libc/arch-mips/syscalls/fstat.S b/libc/arch-mips/syscalls/fstat.S
new file mode 100644
index 0000000..73d7235
--- /dev/null
+++ b/libc/arch-mips/syscalls/fstat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fstat
+    .align 4
+    .ent fstat
+
+fstat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fstat64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fstat
diff --git a/libc/arch-mips/syscalls/fstatat.S b/libc/arch-mips/syscalls/fstatat.S
new file mode 100644
index 0000000..3ae229e
--- /dev/null
+++ b/libc/arch-mips/syscalls/fstatat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fstatat
+    .align 4
+    .ent fstatat
+
+fstatat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fstatat64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fstatat
diff --git a/libc/arch-mips/syscalls/fsync.S b/libc/arch-mips/syscalls/fsync.S
new file mode 100644
index 0000000..e1cd316
--- /dev/null
+++ b/libc/arch-mips/syscalls/fsync.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl fsync
+    .align 4
+    .ent fsync
+
+fsync:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_fsync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end fsync
diff --git a/libc/arch-mips/syscalls/ftruncate.S b/libc/arch-mips/syscalls/ftruncate.S
new file mode 100644
index 0000000..5d72b43
--- /dev/null
+++ b/libc/arch-mips/syscalls/ftruncate.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl ftruncate
+    .align 4
+    .ent ftruncate
+
+ftruncate:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ftruncate
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end ftruncate
diff --git a/libc/arch-mips/syscalls/ftruncate64.S b/libc/arch-mips/syscalls/ftruncate64.S
new file mode 100644
index 0000000..216ae38
--- /dev/null
+++ b/libc/arch-mips/syscalls/ftruncate64.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl ftruncate64
+    .align 4
+    .ent ftruncate64
+
+ftruncate64:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ftruncate64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end ftruncate64
diff --git a/libc/arch-mips/syscalls/futex.S b/libc/arch-mips/syscalls/futex.S
new file mode 100644
index 0000000..65e537a
--- /dev/null
+++ b/libc/arch-mips/syscalls/futex.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl futex
+    .align 4
+    .ent futex
+
+futex:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_futex
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end futex
diff --git a/libc/arch-mips/syscalls/getdents.S b/libc/arch-mips/syscalls/getdents.S
new file mode 100644
index 0000000..8ff0f26
--- /dev/null
+++ b/libc/arch-mips/syscalls/getdents.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getdents
+    .align 4
+    .ent getdents
+
+getdents:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getdents64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getdents
diff --git a/libc/arch-mips/syscalls/getegid.S b/libc/arch-mips/syscalls/getegid.S
new file mode 100644
index 0000000..dc2a04b
--- /dev/null
+++ b/libc/arch-mips/syscalls/getegid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getegid
+    .align 4
+    .ent getegid
+
+getegid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getegid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getegid
diff --git a/libc/arch-mips/syscalls/geteuid.S b/libc/arch-mips/syscalls/geteuid.S
new file mode 100644
index 0000000..8beca88
--- /dev/null
+++ b/libc/arch-mips/syscalls/geteuid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl geteuid
+    .align 4
+    .ent geteuid
+
+geteuid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_geteuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end geteuid
diff --git a/libc/arch-mips/syscalls/getgid.S b/libc/arch-mips/syscalls/getgid.S
new file mode 100644
index 0000000..6a615ee
--- /dev/null
+++ b/libc/arch-mips/syscalls/getgid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getgid
+    .align 4
+    .ent getgid
+
+getgid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getgid
diff --git a/libc/arch-mips/syscalls/getgroups.S b/libc/arch-mips/syscalls/getgroups.S
new file mode 100644
index 0000000..8be7308
--- /dev/null
+++ b/libc/arch-mips/syscalls/getgroups.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getgroups
+    .align 4
+    .ent getgroups
+
+getgroups:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getgroups
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getgroups
diff --git a/libc/arch-mips/syscalls/getitimer.S b/libc/arch-mips/syscalls/getitimer.S
new file mode 100644
index 0000000..3df1d11
--- /dev/null
+++ b/libc/arch-mips/syscalls/getitimer.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getitimer
+    .align 4
+    .ent getitimer
+
+getitimer:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getitimer
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getitimer
diff --git a/libc/arch-mips/syscalls/getpeername.S b/libc/arch-mips/syscalls/getpeername.S
new file mode 100644
index 0000000..4a3beda
--- /dev/null
+++ b/libc/arch-mips/syscalls/getpeername.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getpeername
+    .align 4
+    .ent getpeername
+
+getpeername:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpeername
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getpeername
diff --git a/libc/arch-mips/syscalls/getpgid.S b/libc/arch-mips/syscalls/getpgid.S
new file mode 100644
index 0000000..fd79351
--- /dev/null
+++ b/libc/arch-mips/syscalls/getpgid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getpgid
+    .align 4
+    .ent getpgid
+
+getpgid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getpgid
diff --git a/libc/arch-mips/syscalls/getpid.S b/libc/arch-mips/syscalls/getpid.S
new file mode 100644
index 0000000..f52e31b
--- /dev/null
+++ b/libc/arch-mips/syscalls/getpid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getpid
+    .align 4
+    .ent getpid
+
+getpid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getpid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getpid
diff --git a/libc/arch-mips/syscalls/getppid.S b/libc/arch-mips/syscalls/getppid.S
new file mode 100644
index 0000000..5e3fe19
--- /dev/null
+++ b/libc/arch-mips/syscalls/getppid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getppid
+    .align 4
+    .ent getppid
+
+getppid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getppid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getppid
diff --git a/libc/arch-mips/syscalls/getresgid.S b/libc/arch-mips/syscalls/getresgid.S
new file mode 100644
index 0000000..8e9bf39
--- /dev/null
+++ b/libc/arch-mips/syscalls/getresgid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getresgid
+    .align 4
+    .ent getresgid
+
+getresgid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getresgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getresgid
diff --git a/libc/arch-mips/syscalls/getresuid.S b/libc/arch-mips/syscalls/getresuid.S
new file mode 100644
index 0000000..ff27cde
--- /dev/null
+++ b/libc/arch-mips/syscalls/getresuid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getresuid
+    .align 4
+    .ent getresuid
+
+getresuid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getresuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getresuid
diff --git a/libc/arch-mips/syscalls/getrlimit.S b/libc/arch-mips/syscalls/getrlimit.S
new file mode 100644
index 0000000..72ed7d8
--- /dev/null
+++ b/libc/arch-mips/syscalls/getrlimit.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getrlimit
+    .align 4
+    .ent getrlimit
+
+getrlimit:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getrlimit
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getrlimit
diff --git a/libc/arch-mips/syscalls/getrusage.S b/libc/arch-mips/syscalls/getrusage.S
new file mode 100644
index 0000000..4c0f7d0
--- /dev/null
+++ b/libc/arch-mips/syscalls/getrusage.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getrusage
+    .align 4
+    .ent getrusage
+
+getrusage:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getrusage
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getrusage
diff --git a/libc/arch-mips/syscalls/getsockname.S b/libc/arch-mips/syscalls/getsockname.S
new file mode 100644
index 0000000..e3d41f9
--- /dev/null
+++ b/libc/arch-mips/syscalls/getsockname.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getsockname
+    .align 4
+    .ent getsockname
+
+getsockname:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getsockname
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getsockname
diff --git a/libc/arch-mips/syscalls/getsockopt.S b/libc/arch-mips/syscalls/getsockopt.S
new file mode 100644
index 0000000..d55ae6a
--- /dev/null
+++ b/libc/arch-mips/syscalls/getsockopt.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getsockopt
+    .align 4
+    .ent getsockopt
+
+getsockopt:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getsockopt
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getsockopt
diff --git a/libc/arch-mips/syscalls/gettid.S b/libc/arch-mips/syscalls/gettid.S
new file mode 100644
index 0000000..de37df5
--- /dev/null
+++ b/libc/arch-mips/syscalls/gettid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl gettid
+    .align 4
+    .ent gettid
+
+gettid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_gettid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end gettid
diff --git a/libc/arch-mips/syscalls/gettimeofday.S b/libc/arch-mips/syscalls/gettimeofday.S
new file mode 100644
index 0000000..a9a93a5
--- /dev/null
+++ b/libc/arch-mips/syscalls/gettimeofday.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl gettimeofday
+    .align 4
+    .ent gettimeofday
+
+gettimeofday:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_gettimeofday
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end gettimeofday
diff --git a/libc/arch-mips/syscalls/getuid.S b/libc/arch-mips/syscalls/getuid.S
new file mode 100644
index 0000000..e5ba698
--- /dev/null
+++ b/libc/arch-mips/syscalls/getuid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getuid
+    .align 4
+    .ent getuid
+
+getuid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getuid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getuid
diff --git a/libc/arch-mips/syscalls/getxattr.S b/libc/arch-mips/syscalls/getxattr.S
new file mode 100644
index 0000000..6c70579
--- /dev/null
+++ b/libc/arch-mips/syscalls/getxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl getxattr
+    .align 4
+    .ent getxattr
+
+getxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_getxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end getxattr
diff --git a/libc/arch-mips/syscalls/init_module.S b/libc/arch-mips/syscalls/init_module.S
new file mode 100644
index 0000000..5cfbd2f
--- /dev/null
+++ b/libc/arch-mips/syscalls/init_module.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl init_module
+    .align 4
+    .ent init_module
+
+init_module:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_init_module
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end init_module
diff --git a/libc/arch-mips/syscalls/inotify_add_watch.S b/libc/arch-mips/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..8dde667
--- /dev/null
+++ b/libc/arch-mips/syscalls/inotify_add_watch.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl inotify_add_watch
+    .align 4
+    .ent inotify_add_watch
+
+inotify_add_watch:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_inotify_add_watch
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end inotify_add_watch
diff --git a/libc/arch-mips/syscalls/inotify_init.S b/libc/arch-mips/syscalls/inotify_init.S
new file mode 100644
index 0000000..cde4667
--- /dev/null
+++ b/libc/arch-mips/syscalls/inotify_init.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl inotify_init
+    .align 4
+    .ent inotify_init
+
+inotify_init:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_inotify_init
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end inotify_init
diff --git a/libc/arch-mips/syscalls/inotify_rm_watch.S b/libc/arch-mips/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..1b2964e
--- /dev/null
+++ b/libc/arch-mips/syscalls/inotify_rm_watch.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl inotify_rm_watch
+    .align 4
+    .ent inotify_rm_watch
+
+inotify_rm_watch:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_inotify_rm_watch
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end inotify_rm_watch
diff --git a/libc/arch-mips/syscalls/ioprio_get.S b/libc/arch-mips/syscalls/ioprio_get.S
new file mode 100644
index 0000000..f7f2441
--- /dev/null
+++ b/libc/arch-mips/syscalls/ioprio_get.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl ioprio_get
+    .align 4
+    .ent ioprio_get
+
+ioprio_get:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ioprio_get
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end ioprio_get
diff --git a/libc/arch-mips/syscalls/ioprio_set.S b/libc/arch-mips/syscalls/ioprio_set.S
new file mode 100644
index 0000000..33a30e7
--- /dev/null
+++ b/libc/arch-mips/syscalls/ioprio_set.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl ioprio_set
+    .align 4
+    .ent ioprio_set
+
+ioprio_set:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_ioprio_set
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end ioprio_set
diff --git a/libc/arch-mips/syscalls/kill.S b/libc/arch-mips/syscalls/kill.S
new file mode 100644
index 0000000..a6640ff
--- /dev/null
+++ b/libc/arch-mips/syscalls/kill.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl kill
+    .align 4
+    .ent kill
+
+kill:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_kill
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end kill
diff --git a/libc/arch-mips/syscalls/klogctl.S b/libc/arch-mips/syscalls/klogctl.S
new file mode 100644
index 0000000..8c41dcf
--- /dev/null
+++ b/libc/arch-mips/syscalls/klogctl.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl klogctl
+    .align 4
+    .ent klogctl
+
+klogctl:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_syslog
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end klogctl
diff --git a/libc/arch-mips/syscalls/lchown.S b/libc/arch-mips/syscalls/lchown.S
new file mode 100644
index 0000000..9fb4660
--- /dev/null
+++ b/libc/arch-mips/syscalls/lchown.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl lchown
+    .align 4
+    .ent lchown
+
+lchown:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lchown
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end lchown
diff --git a/libc/arch-mips/syscalls/lgetxattr.S b/libc/arch-mips/syscalls/lgetxattr.S
new file mode 100644
index 0000000..d546d28
--- /dev/null
+++ b/libc/arch-mips/syscalls/lgetxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl lgetxattr
+    .align 4
+    .ent lgetxattr
+
+lgetxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lgetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end lgetxattr
diff --git a/libc/arch-mips/syscalls/link.S b/libc/arch-mips/syscalls/link.S
new file mode 100644
index 0000000..4096b44
--- /dev/null
+++ b/libc/arch-mips/syscalls/link.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl link
+    .align 4
+    .ent link
+
+link:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_link
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end link
diff --git a/libc/arch-mips/syscalls/listen.S b/libc/arch-mips/syscalls/listen.S
new file mode 100644
index 0000000..f365d1d
--- /dev/null
+++ b/libc/arch-mips/syscalls/listen.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl listen
+    .align 4
+    .ent listen
+
+listen:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_listen
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end listen
diff --git a/libc/arch-mips/syscalls/listxattr.S b/libc/arch-mips/syscalls/listxattr.S
new file mode 100644
index 0000000..90b4544
--- /dev/null
+++ b/libc/arch-mips/syscalls/listxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl listxattr
+    .align 4
+    .ent listxattr
+
+listxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_listxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end listxattr
diff --git a/libc/arch-mips/syscalls/llistxattr.S b/libc/arch-mips/syscalls/llistxattr.S
new file mode 100644
index 0000000..e74bf85
--- /dev/null
+++ b/libc/arch-mips/syscalls/llistxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl llistxattr
+    .align 4
+    .ent llistxattr
+
+llistxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_llistxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end llistxattr
diff --git a/libc/arch-mips/syscalls/lremovexattr.S b/libc/arch-mips/syscalls/lremovexattr.S
new file mode 100644
index 0000000..a8d8df9
--- /dev/null
+++ b/libc/arch-mips/syscalls/lremovexattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl lremovexattr
+    .align 4
+    .ent lremovexattr
+
+lremovexattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lremovexattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end lremovexattr
diff --git a/libc/arch-mips/syscalls/lseek.S b/libc/arch-mips/syscalls/lseek.S
new file mode 100644
index 0000000..bf486ac
--- /dev/null
+++ b/libc/arch-mips/syscalls/lseek.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl lseek
+    .align 4
+    .ent lseek
+
+lseek:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lseek
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end lseek
diff --git a/libc/arch-mips/syscalls/lsetxattr.S b/libc/arch-mips/syscalls/lsetxattr.S
new file mode 100644
index 0000000..19a0fdf
--- /dev/null
+++ b/libc/arch-mips/syscalls/lsetxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl lsetxattr
+    .align 4
+    .ent lsetxattr
+
+lsetxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lsetxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end lsetxattr
diff --git a/libc/arch-mips/syscalls/lstat.S b/libc/arch-mips/syscalls/lstat.S
new file mode 100644
index 0000000..355d1da
--- /dev/null
+++ b/libc/arch-mips/syscalls/lstat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl lstat
+    .align 4
+    .ent lstat
+
+lstat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_lstat64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end lstat
diff --git a/libc/arch-mips/syscalls/madvise.S b/libc/arch-mips/syscalls/madvise.S
new file mode 100644
index 0000000..4df7325
--- /dev/null
+++ b/libc/arch-mips/syscalls/madvise.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl madvise
+    .align 4
+    .ent madvise
+
+madvise:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_madvise
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end madvise
diff --git a/libc/arch-mips/syscalls/mincore.S b/libc/arch-mips/syscalls/mincore.S
new file mode 100644
index 0000000..8f467cd
--- /dev/null
+++ b/libc/arch-mips/syscalls/mincore.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mincore
+    .align 4
+    .ent mincore
+
+mincore:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mincore
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mincore
diff --git a/libc/arch-mips/syscalls/mkdir.S b/libc/arch-mips/syscalls/mkdir.S
new file mode 100644
index 0000000..abf7db8
--- /dev/null
+++ b/libc/arch-mips/syscalls/mkdir.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mkdir
+    .align 4
+    .ent mkdir
+
+mkdir:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mkdir
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mkdir
diff --git a/libc/arch-mips/syscalls/mkdirat.S b/libc/arch-mips/syscalls/mkdirat.S
new file mode 100644
index 0000000..4ccbe3b
--- /dev/null
+++ b/libc/arch-mips/syscalls/mkdirat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mkdirat
+    .align 4
+    .ent mkdirat
+
+mkdirat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mkdirat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mkdirat
diff --git a/libc/arch-mips/syscalls/mknod.S b/libc/arch-mips/syscalls/mknod.S
new file mode 100644
index 0000000..5ebb0ad
--- /dev/null
+++ b/libc/arch-mips/syscalls/mknod.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mknod
+    .align 4
+    .ent mknod
+
+mknod:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mknod
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mknod
diff --git a/libc/arch-mips/syscalls/mlock.S b/libc/arch-mips/syscalls/mlock.S
new file mode 100644
index 0000000..99aca6e
--- /dev/null
+++ b/libc/arch-mips/syscalls/mlock.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mlock
+    .align 4
+    .ent mlock
+
+mlock:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mlock
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mlock
diff --git a/libc/arch-mips/syscalls/mount.S b/libc/arch-mips/syscalls/mount.S
new file mode 100644
index 0000000..1b3385a
--- /dev/null
+++ b/libc/arch-mips/syscalls/mount.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mount
+    .align 4
+    .ent mount
+
+mount:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mount
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mount
diff --git a/libc/arch-mips/syscalls/mprotect.S b/libc/arch-mips/syscalls/mprotect.S
new file mode 100644
index 0000000..4dc3bea
--- /dev/null
+++ b/libc/arch-mips/syscalls/mprotect.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mprotect
+    .align 4
+    .ent mprotect
+
+mprotect:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mprotect
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mprotect
diff --git a/libc/arch-mips/syscalls/mremap.S b/libc/arch-mips/syscalls/mremap.S
new file mode 100644
index 0000000..721ccd9
--- /dev/null
+++ b/libc/arch-mips/syscalls/mremap.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl mremap
+    .align 4
+    .ent mremap
+
+mremap:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_mremap
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end mremap
diff --git a/libc/arch-mips/syscalls/msync.S b/libc/arch-mips/syscalls/msync.S
new file mode 100644
index 0000000..37e1c9a
--- /dev/null
+++ b/libc/arch-mips/syscalls/msync.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl msync
+    .align 4
+    .ent msync
+
+msync:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_msync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end msync
diff --git a/libc/arch-mips/syscalls/munlock.S b/libc/arch-mips/syscalls/munlock.S
new file mode 100644
index 0000000..befc282
--- /dev/null
+++ b/libc/arch-mips/syscalls/munlock.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl munlock
+    .align 4
+    .ent munlock
+
+munlock:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_munlock
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end munlock
diff --git a/libc/arch-mips/syscalls/munmap.S b/libc/arch-mips/syscalls/munmap.S
new file mode 100644
index 0000000..5b717a9
--- /dev/null
+++ b/libc/arch-mips/syscalls/munmap.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl munmap
+    .align 4
+    .ent munmap
+
+munmap:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_munmap
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end munmap
diff --git a/libc/arch-mips/syscalls/nanosleep.S b/libc/arch-mips/syscalls/nanosleep.S
new file mode 100644
index 0000000..58ace12
--- /dev/null
+++ b/libc/arch-mips/syscalls/nanosleep.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl nanosleep
+    .align 4
+    .ent nanosleep
+
+nanosleep:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_nanosleep
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end nanosleep
diff --git a/libc/arch-mips/syscalls/pause.S b/libc/arch-mips/syscalls/pause.S
new file mode 100644
index 0000000..70346b4
--- /dev/null
+++ b/libc/arch-mips/syscalls/pause.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl pause
+    .align 4
+    .ent pause
+
+pause:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pause
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end pause
diff --git a/libc/arch-mips/syscalls/perf_event_open.S b/libc/arch-mips/syscalls/perf_event_open.S
new file mode 100644
index 0000000..22c9c3c
--- /dev/null
+++ b/libc/arch-mips/syscalls/perf_event_open.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl perf_event_open
+    .align 4
+    .ent perf_event_open
+
+perf_event_open:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_perf_event_open
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end perf_event_open
diff --git a/libc/arch-mips/syscalls/personality.S b/libc/arch-mips/syscalls/personality.S
new file mode 100644
index 0000000..0020469
--- /dev/null
+++ b/libc/arch-mips/syscalls/personality.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl personality
+    .align 4
+    .ent personality
+
+personality:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_personality
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end personality
diff --git a/libc/arch-mips/syscalls/pipe2.S b/libc/arch-mips/syscalls/pipe2.S
new file mode 100644
index 0000000..9dfde29
--- /dev/null
+++ b/libc/arch-mips/syscalls/pipe2.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl pipe2
+    .align 4
+    .ent pipe2
+
+pipe2:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pipe2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end pipe2
diff --git a/libc/arch-mips/syscalls/poll.S b/libc/arch-mips/syscalls/poll.S
new file mode 100644
index 0000000..c1fec97
--- /dev/null
+++ b/libc/arch-mips/syscalls/poll.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl poll
+    .align 4
+    .ent poll
+
+poll:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_poll
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end poll
diff --git a/libc/arch-mips/syscalls/prctl.S b/libc/arch-mips/syscalls/prctl.S
new file mode 100644
index 0000000..aaf1344
--- /dev/null
+++ b/libc/arch-mips/syscalls/prctl.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl prctl
+    .align 4
+    .ent prctl
+
+prctl:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_prctl
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end prctl
diff --git a/libc/arch-mips/syscalls/pread64.S b/libc/arch-mips/syscalls/pread64.S
new file mode 100644
index 0000000..86e817c
--- /dev/null
+++ b/libc/arch-mips/syscalls/pread64.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl pread64
+    .align 4
+    .ent pread64
+
+pread64:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pread64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end pread64
diff --git a/libc/arch-mips/syscalls/pwrite64.S b/libc/arch-mips/syscalls/pwrite64.S
new file mode 100644
index 0000000..a8dcd98
--- /dev/null
+++ b/libc/arch-mips/syscalls/pwrite64.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl pwrite64
+    .align 4
+    .ent pwrite64
+
+pwrite64:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_pwrite64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end pwrite64
diff --git a/libc/arch-mips/syscalls/read.S b/libc/arch-mips/syscalls/read.S
new file mode 100644
index 0000000..75816cd
--- /dev/null
+++ b/libc/arch-mips/syscalls/read.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl read
+    .align 4
+    .ent read
+
+read:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_read
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end read
diff --git a/libc/arch-mips/syscalls/readahead.S b/libc/arch-mips/syscalls/readahead.S
new file mode 100644
index 0000000..5ec600d
--- /dev/null
+++ b/libc/arch-mips/syscalls/readahead.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl readahead
+    .align 4
+    .ent readahead
+
+readahead:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_readahead
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end readahead
diff --git a/libc/arch-mips/syscalls/readlink.S b/libc/arch-mips/syscalls/readlink.S
new file mode 100644
index 0000000..ccdd596
--- /dev/null
+++ b/libc/arch-mips/syscalls/readlink.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl readlink
+    .align 4
+    .ent readlink
+
+readlink:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_readlink
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end readlink
diff --git a/libc/arch-mips/syscalls/readv.S b/libc/arch-mips/syscalls/readv.S
new file mode 100644
index 0000000..0561c18
--- /dev/null
+++ b/libc/arch-mips/syscalls/readv.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl readv
+    .align 4
+    .ent readv
+
+readv:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_readv
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end readv
diff --git a/libc/arch-mips/syscalls/recvfrom.S b/libc/arch-mips/syscalls/recvfrom.S
new file mode 100644
index 0000000..cf3441d
--- /dev/null
+++ b/libc/arch-mips/syscalls/recvfrom.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl recvfrom
+    .align 4
+    .ent recvfrom
+
+recvfrom:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_recvfrom
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end recvfrom
diff --git a/libc/arch-mips/syscalls/recvmsg.S b/libc/arch-mips/syscalls/recvmsg.S
new file mode 100644
index 0000000..5f22c49
--- /dev/null
+++ b/libc/arch-mips/syscalls/recvmsg.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl recvmsg
+    .align 4
+    .ent recvmsg
+
+recvmsg:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_recvmsg
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end recvmsg
diff --git a/libc/arch-mips/syscalls/removexattr.S b/libc/arch-mips/syscalls/removexattr.S
new file mode 100644
index 0000000..7d12b96
--- /dev/null
+++ b/libc/arch-mips/syscalls/removexattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl removexattr
+    .align 4
+    .ent removexattr
+
+removexattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_removexattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end removexattr
diff --git a/libc/arch-mips/syscalls/rename.S b/libc/arch-mips/syscalls/rename.S
new file mode 100644
index 0000000..950d579
--- /dev/null
+++ b/libc/arch-mips/syscalls/rename.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl rename
+    .align 4
+    .ent rename
+
+rename:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rename
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end rename
diff --git a/libc/arch-mips/syscalls/renameat.S b/libc/arch-mips/syscalls/renameat.S
new file mode 100644
index 0000000..a2f3c4f
--- /dev/null
+++ b/libc/arch-mips/syscalls/renameat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl renameat
+    .align 4
+    .ent renameat
+
+renameat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_renameat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end renameat
diff --git a/libc/arch-mips/syscalls/rmdir.S b/libc/arch-mips/syscalls/rmdir.S
new file mode 100644
index 0000000..2f77d0d
--- /dev/null
+++ b/libc/arch-mips/syscalls/rmdir.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl rmdir
+    .align 4
+    .ent rmdir
+
+rmdir:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_rmdir
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end rmdir
diff --git a/libc/arch-mips/syscalls/sched_get_priority_max.S b/libc/arch-mips/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..158b0fe
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_get_priority_max.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_get_priority_max
+    .align 4
+    .ent sched_get_priority_max
+
+sched_get_priority_max:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_get_priority_max
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_get_priority_max
diff --git a/libc/arch-mips/syscalls/sched_get_priority_min.S b/libc/arch-mips/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..8c07d72
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_get_priority_min.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_get_priority_min
+    .align 4
+    .ent sched_get_priority_min
+
+sched_get_priority_min:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_get_priority_min
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_get_priority_min
diff --git a/libc/arch-mips/syscalls/sched_getparam.S b/libc/arch-mips/syscalls/sched_getparam.S
new file mode 100644
index 0000000..6aba7cf
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_getparam.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_getparam
+    .align 4
+    .ent sched_getparam
+
+sched_getparam:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_getparam
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_getparam
diff --git a/libc/arch-mips/syscalls/sched_getscheduler.S b/libc/arch-mips/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..33d7f49
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_getscheduler.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_getscheduler
+    .align 4
+    .ent sched_getscheduler
+
+sched_getscheduler:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_getscheduler
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_getscheduler
diff --git a/libc/arch-mips/syscalls/sched_rr_get_interval.S b/libc/arch-mips/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..e634ed0
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_rr_get_interval
+    .align 4
+    .ent sched_rr_get_interval
+
+sched_rr_get_interval:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_rr_get_interval
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_rr_get_interval
diff --git a/libc/arch-mips/syscalls/sched_setaffinity.S b/libc/arch-mips/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..aefc240
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_setaffinity.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_setaffinity
+    .align 4
+    .ent sched_setaffinity
+
+sched_setaffinity:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_setaffinity
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_setaffinity
diff --git a/libc/arch-mips/syscalls/sched_setparam.S b/libc/arch-mips/syscalls/sched_setparam.S
new file mode 100644
index 0000000..4d646bd
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_setparam.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_setparam
+    .align 4
+    .ent sched_setparam
+
+sched_setparam:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_setparam
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_setparam
diff --git a/libc/arch-mips/syscalls/sched_setscheduler.S b/libc/arch-mips/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..a79e39c
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_setscheduler.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_setscheduler
+    .align 4
+    .ent sched_setscheduler
+
+sched_setscheduler:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_setscheduler
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_setscheduler
diff --git a/libc/arch-mips/syscalls/sched_yield.S b/libc/arch-mips/syscalls/sched_yield.S
new file mode 100644
index 0000000..c7c99dc
--- /dev/null
+++ b/libc/arch-mips/syscalls/sched_yield.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sched_yield
+    .align 4
+    .ent sched_yield
+
+sched_yield:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sched_yield
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sched_yield
diff --git a/libc/arch-mips/syscalls/select.S b/libc/arch-mips/syscalls/select.S
new file mode 100644
index 0000000..ce4112f
--- /dev/null
+++ b/libc/arch-mips/syscalls/select.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl select
+    .align 4
+    .ent select
+
+select:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR__newselect
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end select
diff --git a/libc/arch-mips/syscalls/sendfile.S b/libc/arch-mips/syscalls/sendfile.S
new file mode 100644
index 0000000..c4c176e
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendfile.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sendfile
+    .align 4
+    .ent sendfile
+
+sendfile:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendfile
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sendfile
diff --git a/libc/arch-mips/syscalls/sendmsg.S b/libc/arch-mips/syscalls/sendmsg.S
new file mode 100644
index 0000000..1913f13
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendmsg.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sendmsg
+    .align 4
+    .ent sendmsg
+
+sendmsg:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendmsg
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sendmsg
diff --git a/libc/arch-mips/syscalls/sendto.S b/libc/arch-mips/syscalls/sendto.S
new file mode 100644
index 0000000..f17743d
--- /dev/null
+++ b/libc/arch-mips/syscalls/sendto.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sendto
+    .align 4
+    .ent sendto
+
+sendto:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sendto
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sendto
diff --git a/libc/arch-mips/syscalls/setgid.S b/libc/arch-mips/syscalls/setgid.S
new file mode 100644
index 0000000..83dbfe5
--- /dev/null
+++ b/libc/arch-mips/syscalls/setgid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setgid
+    .align 4
+    .ent setgid
+
+setgid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setgid
diff --git a/libc/arch-mips/syscalls/setgroups.S b/libc/arch-mips/syscalls/setgroups.S
new file mode 100644
index 0000000..ef9327d
--- /dev/null
+++ b/libc/arch-mips/syscalls/setgroups.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setgroups
+    .align 4
+    .ent setgroups
+
+setgroups:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setgroups
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setgroups
diff --git a/libc/arch-mips/syscalls/setitimer.S b/libc/arch-mips/syscalls/setitimer.S
new file mode 100644
index 0000000..b042e07
--- /dev/null
+++ b/libc/arch-mips/syscalls/setitimer.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setitimer
+    .align 4
+    .ent setitimer
+
+setitimer:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setitimer
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setitimer
diff --git a/libc/arch-mips/syscalls/setpgid.S b/libc/arch-mips/syscalls/setpgid.S
new file mode 100644
index 0000000..2ddc828
--- /dev/null
+++ b/libc/arch-mips/syscalls/setpgid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setpgid
+    .align 4
+    .ent setpgid
+
+setpgid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setpgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setpgid
diff --git a/libc/arch-mips/syscalls/setpriority.S b/libc/arch-mips/syscalls/setpriority.S
new file mode 100644
index 0000000..02550e9
--- /dev/null
+++ b/libc/arch-mips/syscalls/setpriority.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setpriority
+    .align 4
+    .ent setpriority
+
+setpriority:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setpriority
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setpriority
diff --git a/libc/arch-mips/syscalls/setregid.S b/libc/arch-mips/syscalls/setregid.S
new file mode 100644
index 0000000..619b3a1
--- /dev/null
+++ b/libc/arch-mips/syscalls/setregid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setregid
+    .align 4
+    .ent setregid
+
+setregid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setregid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setregid
diff --git a/libc/arch-mips/syscalls/setresgid.S b/libc/arch-mips/syscalls/setresgid.S
new file mode 100644
index 0000000..3ff94c7
--- /dev/null
+++ b/libc/arch-mips/syscalls/setresgid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setresgid
+    .align 4
+    .ent setresgid
+
+setresgid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setresgid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setresgid
diff --git a/libc/arch-mips/syscalls/setrlimit.S b/libc/arch-mips/syscalls/setrlimit.S
new file mode 100644
index 0000000..3ec37c5
--- /dev/null
+++ b/libc/arch-mips/syscalls/setrlimit.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setrlimit
+    .align 4
+    .ent setrlimit
+
+setrlimit:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setrlimit
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setrlimit
diff --git a/libc/arch-mips/syscalls/setsid.S b/libc/arch-mips/syscalls/setsid.S
new file mode 100644
index 0000000..2a09663
--- /dev/null
+++ b/libc/arch-mips/syscalls/setsid.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setsid
+    .align 4
+    .ent setsid
+
+setsid:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setsid
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setsid
diff --git a/libc/arch-mips/syscalls/setsockopt.S b/libc/arch-mips/syscalls/setsockopt.S
new file mode 100644
index 0000000..dc5e62f
--- /dev/null
+++ b/libc/arch-mips/syscalls/setsockopt.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setsockopt
+    .align 4
+    .ent setsockopt
+
+setsockopt:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setsockopt
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setsockopt
diff --git a/libc/arch-mips/syscalls/settimeofday.S b/libc/arch-mips/syscalls/settimeofday.S
new file mode 100644
index 0000000..f7c03ea
--- /dev/null
+++ b/libc/arch-mips/syscalls/settimeofday.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl settimeofday
+    .align 4
+    .ent settimeofday
+
+settimeofday:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_settimeofday
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end settimeofday
diff --git a/libc/arch-mips/syscalls/setxattr.S b/libc/arch-mips/syscalls/setxattr.S
new file mode 100644
index 0000000..baa78a4
--- /dev/null
+++ b/libc/arch-mips/syscalls/setxattr.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl setxattr
+    .align 4
+    .ent setxattr
+
+setxattr:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_setxattr
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end setxattr
diff --git a/libc/arch-mips/syscalls/shutdown.S b/libc/arch-mips/syscalls/shutdown.S
new file mode 100644
index 0000000..b80d99b
--- /dev/null
+++ b/libc/arch-mips/syscalls/shutdown.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl shutdown
+    .align 4
+    .ent shutdown
+
+shutdown:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_shutdown
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end shutdown
diff --git a/libc/arch-mips/syscalls/sigaction.S b/libc/arch-mips/syscalls/sigaction.S
new file mode 100644
index 0000000..700da54
--- /dev/null
+++ b/libc/arch-mips/syscalls/sigaction.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sigaction
+    .align 4
+    .ent sigaction
+
+sigaction:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigaction
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sigaction
diff --git a/libc/arch-mips/syscalls/sigaltstack.S b/libc/arch-mips/syscalls/sigaltstack.S
new file mode 100644
index 0000000..d2a4a9a
--- /dev/null
+++ b/libc/arch-mips/syscalls/sigaltstack.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sigaltstack
+    .align 4
+    .ent sigaltstack
+
+sigaltstack:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigaltstack
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sigaltstack
diff --git a/libc/arch-mips/syscalls/sigpending.S b/libc/arch-mips/syscalls/sigpending.S
new file mode 100644
index 0000000..68df4db
--- /dev/null
+++ b/libc/arch-mips/syscalls/sigpending.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sigpending
+    .align 4
+    .ent sigpending
+
+sigpending:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigpending
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sigpending
diff --git a/libc/arch-mips/syscalls/sigprocmask.S b/libc/arch-mips/syscalls/sigprocmask.S
new file mode 100644
index 0000000..17c01cb
--- /dev/null
+++ b/libc/arch-mips/syscalls/sigprocmask.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sigprocmask
+    .align 4
+    .ent sigprocmask
+
+sigprocmask:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sigprocmask
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sigprocmask
diff --git a/libc/arch-mips/syscalls/socket.S b/libc/arch-mips/syscalls/socket.S
new file mode 100644
index 0000000..e7d43f9
--- /dev/null
+++ b/libc/arch-mips/syscalls/socket.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl socket
+    .align 4
+    .ent socket
+
+socket:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_socket
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end socket
diff --git a/libc/arch-mips/syscalls/socketpair.S b/libc/arch-mips/syscalls/socketpair.S
new file mode 100644
index 0000000..97c67af
--- /dev/null
+++ b/libc/arch-mips/syscalls/socketpair.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl socketpair
+    .align 4
+    .ent socketpair
+
+socketpair:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_socketpair
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end socketpair
diff --git a/libc/arch-mips/syscalls/stat.S b/libc/arch-mips/syscalls/stat.S
new file mode 100644
index 0000000..aec910d
--- /dev/null
+++ b/libc/arch-mips/syscalls/stat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl stat
+    .align 4
+    .ent stat
+
+stat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_stat64
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end stat
diff --git a/libc/arch-mips/syscalls/symlink.S b/libc/arch-mips/syscalls/symlink.S
new file mode 100644
index 0000000..f81c6dd
--- /dev/null
+++ b/libc/arch-mips/syscalls/symlink.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl symlink
+    .align 4
+    .ent symlink
+
+symlink:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_symlink
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end symlink
diff --git a/libc/arch-mips/syscalls/sync.S b/libc/arch-mips/syscalls/sync.S
new file mode 100644
index 0000000..a122873
--- /dev/null
+++ b/libc/arch-mips/syscalls/sync.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sync
+    .align 4
+    .ent sync
+
+sync:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sync
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sync
diff --git a/libc/arch-mips/syscalls/syscall.S b/libc/arch-mips/syscalls/syscall.S
new file mode 100644
index 0000000..2192bd5
--- /dev/null
+++ b/libc/arch-mips/syscalls/syscall.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl syscall
+    .align 4
+    .ent syscall
+
+syscall:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_syscall
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end syscall
diff --git a/libc/arch-mips/syscalls/sysinfo.S b/libc/arch-mips/syscalls/sysinfo.S
new file mode 100644
index 0000000..4577af9
--- /dev/null
+++ b/libc/arch-mips/syscalls/sysinfo.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl sysinfo
+    .align 4
+    .ent sysinfo
+
+sysinfo:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_sysinfo
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end sysinfo
diff --git a/libc/arch-mips/syscalls/tgkill.S b/libc/arch-mips/syscalls/tgkill.S
new file mode 100644
index 0000000..57b3a85
--- /dev/null
+++ b/libc/arch-mips/syscalls/tgkill.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl tgkill
+    .align 4
+    .ent tgkill
+
+tgkill:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_tgkill
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end tgkill
diff --git a/libc/arch-mips/syscalls/times.S b/libc/arch-mips/syscalls/times.S
new file mode 100644
index 0000000..3e8950d
--- /dev/null
+++ b/libc/arch-mips/syscalls/times.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl times
+    .align 4
+    .ent times
+
+times:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_times
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end times
diff --git a/libc/arch-mips/syscalls/tkill.S b/libc/arch-mips/syscalls/tkill.S
new file mode 100644
index 0000000..3037baa
--- /dev/null
+++ b/libc/arch-mips/syscalls/tkill.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl tkill
+    .align 4
+    .ent tkill
+
+tkill:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_tkill
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end tkill
diff --git a/libc/arch-mips/syscalls/truncate.S b/libc/arch-mips/syscalls/truncate.S
new file mode 100644
index 0000000..4a8f12c
--- /dev/null
+++ b/libc/arch-mips/syscalls/truncate.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl truncate
+    .align 4
+    .ent truncate
+
+truncate:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_truncate
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end truncate
diff --git a/libc/arch-mips/syscalls/umask.S b/libc/arch-mips/syscalls/umask.S
new file mode 100644
index 0000000..eee911e
--- /dev/null
+++ b/libc/arch-mips/syscalls/umask.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl umask
+    .align 4
+    .ent umask
+
+umask:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_umask
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end umask
diff --git a/libc/arch-mips/syscalls/umount2.S b/libc/arch-mips/syscalls/umount2.S
new file mode 100644
index 0000000..c6d9df6
--- /dev/null
+++ b/libc/arch-mips/syscalls/umount2.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl umount2
+    .align 4
+    .ent umount2
+
+umount2:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_umount2
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end umount2
diff --git a/libc/arch-mips/syscalls/uname.S b/libc/arch-mips/syscalls/uname.S
new file mode 100644
index 0000000..7e4f780
--- /dev/null
+++ b/libc/arch-mips/syscalls/uname.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl uname
+    .align 4
+    .ent uname
+
+uname:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_uname
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end uname
diff --git a/libc/arch-mips/syscalls/unlink.S b/libc/arch-mips/syscalls/unlink.S
new file mode 100644
index 0000000..fd8dad9
--- /dev/null
+++ b/libc/arch-mips/syscalls/unlink.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl unlink
+    .align 4
+    .ent unlink
+
+unlink:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_unlink
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end unlink
diff --git a/libc/arch-mips/syscalls/unlinkat.S b/libc/arch-mips/syscalls/unlinkat.S
new file mode 100644
index 0000000..793ab5e
--- /dev/null
+++ b/libc/arch-mips/syscalls/unlinkat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl unlinkat
+    .align 4
+    .ent unlinkat
+
+unlinkat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_unlinkat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end unlinkat
diff --git a/libc/arch-mips/syscalls/utimensat.S b/libc/arch-mips/syscalls/utimensat.S
new file mode 100644
index 0000000..435c49e
--- /dev/null
+++ b/libc/arch-mips/syscalls/utimensat.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl utimensat
+    .align 4
+    .ent utimensat
+
+utimensat:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_utimensat
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end utimensat
diff --git a/libc/arch-mips/syscalls/utimes.S b/libc/arch-mips/syscalls/utimes.S
new file mode 100644
index 0000000..8ce1e44
--- /dev/null
+++ b/libc/arch-mips/syscalls/utimes.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl utimes
+    .align 4
+    .ent utimes
+
+utimes:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_utimes
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end utimes
diff --git a/libc/arch-mips/syscalls/write.S b/libc/arch-mips/syscalls/write.S
new file mode 100644
index 0000000..a772ace
--- /dev/null
+++ b/libc/arch-mips/syscalls/write.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl write
+    .align 4
+    .ent write
+
+write:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_write
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end write
diff --git a/libc/arch-mips/syscalls/writev.S b/libc/arch-mips/syscalls/writev.S
new file mode 100644
index 0000000..bdacb42
--- /dev/null
+++ b/libc/arch-mips/syscalls/writev.S
@@ -0,0 +1,22 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl writev
+    .align 4
+    .ent writev
+
+writev:
+    .set noreorder
+    .cpload $t9
+    li $v0, __NR_writev
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end writev
diff --git a/libc/bionic/malloc_debug_leak.c b/libc/bionic/malloc_debug_leak.c
index e0bcee9..e584502 100644
--- a/libc/bionic/malloc_debug_leak.c
+++ b/libc/bionic/malloc_debug_leak.c
@@ -25,26 +25,26 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
+#include <dlfcn.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <pthread.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
 #include <stdio.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <fcntl.h>
 #include <unwind.h>
-#include <dlfcn.h>
 
-#include <sys/socket.h>
-#include <sys/un.h>
+#include <arpa/inet.h>
 #include <sys/select.h>
-#include <sys/types.h>
+#include <sys/socket.h>
 #include <sys/system_properties.h>
+#include <sys/types.h>
+#include <sys/un.h>
 
 #include "dlmalloc.h"
 #include "logd.h"
@@ -372,7 +372,11 @@
 
 void* chk_malloc(size_t bytes)
 {
-    char* buffer = (char*)dlmalloc(bytes + CHK_OVERHEAD_SIZE);
+    size_t size = bytes + CHK_OVERHEAD_SIZE;
+    if (size < bytes) { // Overflow.
+        return NULL;
+    }
+    uint8_t* buffer = (uint8_t*) dlmalloc(size);
     if (buffer) {
         memset(buffer, CHK_SENTINEL_VALUE, bytes + CHK_OVERHEAD_SIZE);
         size_t offset = dlmalloc_usable_size(buffer) - sizeof(size_t);
@@ -505,7 +509,12 @@
     // 1. allocate enough memory and include our header
     // 2. set the base pointer to be right after our header
 
-    void* base = dlmalloc(bytes + sizeof(AllocationEntry));
+    size_t size = bytes + sizeof(AllocationEntry);
+    if (size < bytes) { // Overflow.
+        return NULL;
+    }
+
+    void* base = dlmalloc(size);
     if (base != NULL) {
         pthread_mutex_lock(&gAllocationsMutex);
 
@@ -615,6 +624,10 @@
     // we will align by at least MALLOC_ALIGNMENT bytes
     // and at most alignment-MALLOC_ALIGNMENT bytes
     size_t size = (alignment-MALLOC_ALIGNMENT) + bytes;
+    if (size < bytes) { // Overflow.
+        return NULL;
+    }
+
     void* base = leak_malloc(size);
     if (base != NULL) {
         intptr_t ptr = (intptr_t)base;
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 5cad167..2e2c09d 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -25,31 +25,32 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include <sys/types.h>
-#include <unistd.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <malloc.h>
+#include <memory.h>
+#include <pthread.h>
 #include <signal.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <errno.h>
 #include <sys/atomics.h>
-#include <bionic_tls.h>
 #include <sys/mman.h>
-#include <pthread.h>
-#include <time.h>
-#include "pthread_internal.h"
-#include "thread_private.h"
-#include <limits.h>
-#include <memory.h>
-#include <assert.h>
-#include <malloc.h>
-#include <bionic_futex.h>
-#include <bionic_atomic_inline.h>
 #include <sys/prctl.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <bionic_pthread.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "bionic_atomic_inline.h"
+#include "bionic_futex.h"
+#include "bionic_pthread.h"
+#include "bionic_tls.h"
+#include "pthread_internal.h"
+#include "thread_private.h"
 
 extern void pthread_debug_mutex_lock_check(pthread_mutex_t *mutex);
 extern void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex);
@@ -80,6 +81,8 @@
 
 void ATTRIBUTES _thread_created_hook(pid_t thread_id);
 
+static const int kPthreadInitFailed = 1;
+
 #define PTHREAD_ATTR_FLAG_DETACHED      0x00000001
 #define PTHREAD_ATTR_FLAG_USER_STACK    0x00000002
 
@@ -97,35 +100,16 @@
     .sched_priority = 0
 };
 
-#define  INIT_THREADS  1
-
-static pthread_internal_t*  gThreadList = NULL;
+static pthread_internal_t* gThreadList = NULL;
 static pthread_mutex_t gThreadListLock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t gDebuggerNotificationLock = PTHREAD_MUTEX_INITIALIZER;
 
 
-/* we simply malloc/free the internal pthread_internal_t structures. we may
- * want to use a different allocation scheme in the future, but this one should
- * be largely enough
- */
-static pthread_internal_t*
-_pthread_internal_alloc(void)
-{
-    pthread_internal_t*   thread;
-
-    thread = calloc( sizeof(*thread), 1 );
-    if (thread)
-        thread->intern = 1;
-
-    return thread;
-}
-
 static void
-_pthread_internal_free( pthread_internal_t*  thread )
+_pthread_internal_free(pthread_internal_t* thread)
 {
-    if (thread && thread->intern) {
-        thread->intern = 0;  /* just in case */
-        free (thread);
+    if (thread != NULL) {
+        free(thread);
     }
 }
 
@@ -194,32 +178,35 @@
 
 
 /*
- * This trampoline is called from the assembly clone() function
+ * This trampoline is called from the assembly _pthread_clone() function.
  */
 void __thread_entry(int (*func)(void*), void *arg, void **tls)
 {
-    int retValue;
-    pthread_internal_t * thrInfo;
-
     // Wait for our creating thread to release us. This lets it have time to
-    // notify gdb about this thread before it starts doing anything.
+    // notify gdb about this thread before we start doing anything.
     //
     // This also provides the memory barrier needed to ensure that all memory
     // accesses previously made by the creating thread are visible to us.
-    pthread_mutex_t * start_mutex = (pthread_mutex_t *)&tls[TLS_SLOT_SELF];
+    pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF];
     pthread_mutex_lock(start_mutex);
     pthread_mutex_destroy(start_mutex);
 
-    thrInfo = (pthread_internal_t *) tls[TLS_SLOT_THREAD_ID];
+    pthread_internal_t* thread = (pthread_internal_t*) tls[TLS_SLOT_THREAD_ID];
+    __init_tls(tls, thread);
 
-    __init_tls( tls, thrInfo );
+    if ((thread->internal_flags & kPthreadInitFailed) != 0) {
+        pthread_exit(NULL);
+    }
 
-    pthread_exit( (void*)func(arg) );
+    int result = func(arg);
+    pthread_exit((void*) result);
 }
 
 __LIBC_ABI_PRIVATE__
-void _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base)
+int _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base)
 {
+    int error = 0;
+
     if (attr == NULL) {
         thread->attr = gDefaultPthreadAttr;
     } else {
@@ -228,40 +215,42 @@
     thread->attr.stack_base = stack_base;
     thread->kernel_id       = kernel_id;
 
-    // set the scheduling policy/priority of the thread
+    // Make a note of whether the user supplied this stack (so we know whether or not to free it).
+    if (attr->stack_base == stack_base) {
+        thread->attr.flags |= PTHREAD_ATTR_FLAG_USER_STACK;
+    }
+
+    // Set the scheduling policy/priority of the thread.
     if (thread->attr.sched_policy != SCHED_NORMAL) {
         struct sched_param param;
         param.sched_priority = thread->attr.sched_priority;
-        sched_setscheduler(kernel_id, thread->attr.sched_policy, &param);
+        if (sched_setscheduler(kernel_id, thread->attr.sched_policy, &param) == -1) {
+            error = errno;
+        }
     }
 
     pthread_cond_init(&thread->join_cond, NULL);
     thread->join_count = 0;
 
     thread->cleanup_stack = NULL;
+
+    _pthread_internal_add(thread);
+    return error;
 }
 
-
-/* XXX stacks not reclaimed if thread spawn fails */
-/* XXX stacks address spaces should be reused if available again */
-
 static void *mkstack(size_t size, size_t guard_size)
 {
-    void * stack;
-
     pthread_mutex_lock(&mmap_lock);
 
-    stack = mmap(NULL, size,
-                 PROT_READ | PROT_WRITE,
-                 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
-                 -1, 0);
-
-    if(stack == MAP_FAILED) {
+    int prot = PROT_READ | PROT_WRITE;
+    int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE;
+    void* stack = mmap(NULL, size, prot, flags, -1, 0);
+    if (stack == MAP_FAILED) {
         stack = NULL;
         goto done;
     }
 
-    if(mprotect(stack, guard_size, PROT_NONE)){
+    if (mprotect(stack, guard_size, PROT_NONE) == -1) {
         munmap(stack, size);
         stack = NULL;
         goto done;
@@ -298,13 +287,7 @@
 int pthread_create(pthread_t *thread_out, pthread_attr_t const * attr,
                    void *(*start_routine)(void *), void * arg)
 {
-    char*   stack;
-    void**  tls;
-    int tid;
-    pthread_mutex_t * start_mutex;
-    pthread_internal_t * thread;
-    int                  madestack = 0;
-    int     old_errno = errno;
+    int old_errno = errno;
 
     /* this will inform the rest of the C library that at least one thread
      * was created. this will enforce certain functions to acquire/release
@@ -315,31 +298,28 @@
      */
     __isthreaded = 1;
 
-    thread = _pthread_internal_alloc();
-    if (thread == NULL)
+    pthread_internal_t* thread = calloc(sizeof(*thread), 1);
+    if (thread == NULL) {
         return ENOMEM;
+    }
 
     if (attr == NULL) {
         attr = &gDefaultPthreadAttr;
     }
 
     // make sure the stack is PAGE_SIZE aligned
-    size_t stackSize = (attr->stack_size +
-                        (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
-
-    if (!attr->stack_base) {
-        stack = mkstack(stackSize, attr->guard_size);
-        if(stack == NULL) {
+    size_t stack_size = (attr->stack_size + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
+    uint8_t* stack = attr->stack_base;
+    if (stack == NULL) {
+        stack = mkstack(stack_size, attr->guard_size);
+        if (stack == NULL) {
             _pthread_internal_free(thread);
             return ENOMEM;
         }
-        madestack = 1;
-    } else {
-        stack = attr->stack_base;
     }
 
     // Make room for TLS
-    tls = (void**)(stack + stackSize - BIONIC_TLS_SLOTS*sizeof(void*));
+    void** tls = (void**)(stack + stack_size - BIONIC_TLS_SLOTS*sizeof(void*));
 
     // Create a mutex for the thread in TLS_SLOT_SELF to wait on once it starts so we can keep
     // it from doing anything until after we notify the debugger about it
@@ -347,43 +327,47 @@
     // This also provides the memory barrier we need to ensure that all
     // memory accesses previously performed by this thread are visible to
     // the new thread.
-    start_mutex = (pthread_mutex_t *) &tls[TLS_SLOT_SELF];
+    pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF];
     pthread_mutex_init(start_mutex, NULL);
     pthread_mutex_lock(start_mutex);
 
     tls[TLS_SLOT_THREAD_ID] = thread;
 
-    tid = __pthread_clone((int(*)(void*))start_routine, tls,
-                CLONE_FILES | CLONE_FS | CLONE_VM | CLONE_SIGHAND
-                | CLONE_THREAD | CLONE_SYSVSEM | CLONE_DETACHED,
-                arg);
+    int flags = CLONE_FILES | CLONE_FS | CLONE_VM | CLONE_SIGHAND |
+                CLONE_THREAD | CLONE_SYSVSEM | CLONE_DETACHED;
+    int tid = __pthread_clone((int(*)(void*))start_routine, tls, flags, arg);
 
-    if(tid < 0) {
-        int  result;
-        if (madestack)
-            munmap(stack, stackSize);
+    if (tid < 0) {
+        int clone_errno = errno;
+        pthread_mutex_unlock(start_mutex);
+        if (stack != attr->stack_base) {
+            munmap(stack, stack_size);
+        }
         _pthread_internal_free(thread);
-        result = errno;
         errno = old_errno;
-        return result;
+        return clone_errno;
     }
 
-    _init_thread(thread, tid, (pthread_attr_t*)attr, stack);
+    int init_errno = _init_thread(thread, tid, (pthread_attr_t*) attr, stack);
+    if (init_errno != 0) {
+        // Mark the thread detached and let its __thread_entry run to
+        // completion. (It'll just exit immediately, cleaning up its resources.)
+        thread->internal_flags |= kPthreadInitFailed;
+        thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED;
+        pthread_mutex_unlock(start_mutex);
+        errno = old_errno;
+        return init_errno;
+    }
 
-    _pthread_internal_add(thread);
-
-    if (!madestack)
-        thread->attr.flags |= PTHREAD_ATTR_FLAG_USER_STACK;
-
-    // Notify any debuggers about the new thread
+    // Notify any debuggers about the new thread.
     pthread_mutex_lock(&gDebuggerNotificationLock);
     _thread_created_hook(tid);
     pthread_mutex_unlock(&gDebuggerNotificationLock);
 
-    // Let the thread do it's thing
+    // Let the thread run.
     pthread_mutex_unlock(start_mutex);
 
-    *thread_out = (pthread_t)thread;
+    *thread_out = (pthread_t) thread;
     return 0;
 }
 
@@ -593,6 +577,17 @@
         _pthread_internal_remove(thread);
         _pthread_internal_free(thread);
     } else {
+        pthread_mutex_lock(&gThreadListLock);
+
+       /* make sure that the thread struct doesn't have stale pointers to a stack that
+        * will be unmapped after the exit call below.
+        */
+        if (!user_stack) {
+            thread->attr.stack_base = NULL;
+            thread->attr.stack_size = 0;
+            thread->tls = NULL;
+        }
+
        /* the join_count field is used to store the number of threads waiting for
         * the termination of this thread with pthread_join(),
         *
@@ -605,7 +600,6 @@
         * is gone (as well as its TLS area). when another thread calls pthread_join()
         * on it, it will immediately free the thread and return.
         */
-        pthread_mutex_lock(&gThreadListLock);
         thread->return_value = retval;
         if (thread->join_count > 0) {
             pthread_cond_broadcast(&thread->join_cond);
@@ -1958,7 +1952,9 @@
          * similarly, it is possible to have thr->tls == NULL for threads that
          * were just recently created through pthread_create() but whose
          * startup trampoline (__thread_entry) hasn't been run yet by the
-         * scheduler. so check for this too.
+         * scheduler. thr->tls will also be NULL after it's stack has been
+         * unmapped but before the ongoing pthread_join() is finished.
+         * so check for this too.
          */
         if (thr->join_count < 0 || !thr->tls)
             continue;
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 268cacf..2bd110c 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -41,12 +41,12 @@
     pthread_cond_t              join_cond;
     int                         join_count;
     void*                       return_value;
-    int                         intern;
+    int                         internal_flags;
     __pthread_cleanup_t*        cleanup_stack;
     void**                      tls;         /* thread-local storage area */
 } pthread_internal_t;
 
-extern void _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base);
+extern int _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base);
 void _pthread_internal_add( pthread_internal_t*  thread );
 pthread_internal_t* __get_thread(void);
 
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index d09e955..c8a654c 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -1,17 +1,94 @@
 /* auto-generated by gensyscalls.py, do not touch */
 #ifndef _BIONIC_LINUX_SYSCALLS_H_
+#define _BIONIC_LINUX_SYSCALLS_H_
 
-#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H
+#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H && !defined __ASM_MIPS_UNISTD_H
 #if defined __arm__ && !defined __ARM_EABI__ && !defined __thumb__
-  #  define __NR_SYSCALL_BASE  0x900000
-  #else
-  #  define  __NR_SYSCALL_BASE  0
-  #endif
+  #  define __NR_SYSCALL_BASE 0x900000
+#elif defined(__mips__)
+  #  define __NR_SYSCALL_BASE 4000
+#else
+  #  define __NR_SYSCALL_BASE 0
+#endif
 
 #define __NR_exit                         (__NR_SYSCALL_BASE + 1)
 #define __NR_fork                         (__NR_SYSCALL_BASE + 2)
-#define __NR_clone                        (__NR_SYSCALL_BASE + 120)
+#define __NR_read                         (__NR_SYSCALL_BASE + 3)
+#define __NR_write                        (__NR_SYSCALL_BASE + 4)
+#define __NR_open                         (__NR_SYSCALL_BASE + 5)
+#define __NR_close                        (__NR_SYSCALL_BASE + 6)
+#define __NR_link                         (__NR_SYSCALL_BASE + 9)
+#define __NR_unlink                       (__NR_SYSCALL_BASE + 10)
 #define __NR_execve                       (__NR_SYSCALL_BASE + 11)
+#define __NR_chdir                        (__NR_SYSCALL_BASE + 12)
+#define __NR_mknod                        (__NR_SYSCALL_BASE + 14)
+#define __NR_chmod                        (__NR_SYSCALL_BASE + 15)
+#define __NR_lseek                        (__NR_SYSCALL_BASE + 19)
+#define __NR_getpid                       (__NR_SYSCALL_BASE + 20)
+#define __NR_mount                        (__NR_SYSCALL_BASE + 21)
+#define __NR_ptrace                       (__NR_SYSCALL_BASE + 26)
+#define __NR_pause                        (__NR_SYSCALL_BASE + 29)
+#define __NR_access                       (__NR_SYSCALL_BASE + 33)
+#define __NR_sync                         (__NR_SYSCALL_BASE + 36)
+#define __NR_rename                       (__NR_SYSCALL_BASE + 38)
+#define __NR_mkdir                        (__NR_SYSCALL_BASE + 39)
+#define __NR_rmdir                        (__NR_SYSCALL_BASE + 40)
+#define __NR_dup                          (__NR_SYSCALL_BASE + 41)
+#define __NR_times                        (__NR_SYSCALL_BASE + 43)
+#define __NR_brk                          (__NR_SYSCALL_BASE + 45)
+#define __NR_acct                         (__NR_SYSCALL_BASE + 51)
+#define __NR_umount2                      (__NR_SYSCALL_BASE + 52)
+#define __NR_ioctl                        (__NR_SYSCALL_BASE + 54)
+#define __NR_fcntl                        (__NR_SYSCALL_BASE + 55)
+#define __NR_setpgid                      (__NR_SYSCALL_BASE + 57)
+#define __NR_umask                        (__NR_SYSCALL_BASE + 60)
+#define __NR_chroot                       (__NR_SYSCALL_BASE + 61)
+#define __NR_dup2                         (__NR_SYSCALL_BASE + 63)
+#define __NR_getppid                      (__NR_SYSCALL_BASE + 64)
+#define __NR_setsid                       (__NR_SYSCALL_BASE + 66)
+#define __NR_sigaction                    (__NR_SYSCALL_BASE + 67)
+#define __NR_sigsuspend                   (__NR_SYSCALL_BASE + 72)
+#define __NR_sigpending                   (__NR_SYSCALL_BASE + 73)
+#define __NR_setrlimit                    (__NR_SYSCALL_BASE + 75)
+#define __NR_getrusage                    (__NR_SYSCALL_BASE + 77)
+#define __NR_gettimeofday                 (__NR_SYSCALL_BASE + 78)
+#define __NR_settimeofday                 (__NR_SYSCALL_BASE + 79)
+#define __NR_symlink                      (__NR_SYSCALL_BASE + 83)
+#define __NR_readlink                     (__NR_SYSCALL_BASE + 85)
+#define __NR_reboot                       (__NR_SYSCALL_BASE + 88)
+#define __NR_munmap                       (__NR_SYSCALL_BASE + 91)
+#define __NR_truncate                     (__NR_SYSCALL_BASE + 92)
+#define __NR_ftruncate                    (__NR_SYSCALL_BASE + 93)
+#define __NR_fchmod                       (__NR_SYSCALL_BASE + 94)
+#define __NR_getpriority                  (__NR_SYSCALL_BASE + 96)
+#define __NR_setpriority                  (__NR_SYSCALL_BASE + 97)
+#define __NR_syslog                       (__NR_SYSCALL_BASE + 103)
+#define __NR_syslog                       (__NR_SYSCALL_BASE + 103)
+#define __NR_setitimer                    (__NR_SYSCALL_BASE + 104)
+#define __NR_getitimer                    (__NR_SYSCALL_BASE + 105)
+#define __NR_wait4                        (__NR_SYSCALL_BASE + 114)
+#define __NR_sysinfo                      (__NR_SYSCALL_BASE + 116)
+#define __NR_fsync                        (__NR_SYSCALL_BASE + 118)
+#define __NR_clone                        (__NR_SYSCALL_BASE + 120)
+#define __NR_uname                        (__NR_SYSCALL_BASE + 122)
+#define __NR_mprotect                     (__NR_SYSCALL_BASE + 125)
+#define __NR_sigprocmask                  (__NR_SYSCALL_BASE + 126)
+#define __NR_init_module                  (__NR_SYSCALL_BASE + 128)
+#define __NR_delete_module                (__NR_SYSCALL_BASE + 129)
+#define __NR_getpgid                      (__NR_SYSCALL_BASE + 132)
+#define __NR_fchdir                       (__NR_SYSCALL_BASE + 133)
+#define __NR_personality                  (__NR_SYSCALL_BASE + 136)
+#define __NR__llseek                      (__NR_SYSCALL_BASE + 140)
+#define __NR__newselect                   (__NR_SYSCALL_BASE + 142)
+#define __NR_flock                        (__NR_SYSCALL_BASE + 143)
+#define __NR_msync                        (__NR_SYSCALL_BASE + 144)
+#define __NR_readv                        (__NR_SYSCALL_BASE + 145)
+#define __NR_writev                       (__NR_SYSCALL_BASE + 146)
+#define __NR_perf_event_open              (__NR_SYSCALL_BASE + 364)
+
+#ifdef __arm__
+#define __NR_exit_group                   (__NR_SYSCALL_BASE + 248)
+#define __NR_waitid                       (__NR_SYSCALL_BASE + 280)
 #define __NR_setuid32                     (__NR_SYSCALL_BASE + 213)
 #define __NR_getuid32                     (__NR_SYSCALL_BASE + 199)
 #define __NR_getgid32                     (__NR_SYSCALL_BASE + 200)
@@ -22,88 +99,53 @@
 #define __NR_gettid                       (__NR_SYSCALL_BASE + 224)
 #define __NR_readahead                    (__NR_SYSCALL_BASE + 225)
 #define __NR_getgroups32                  (__NR_SYSCALL_BASE + 205)
-#define __NR_getpgid                      (__NR_SYSCALL_BASE + 132)
-#define __NR_getppid                      (__NR_SYSCALL_BASE + 64)
-#define __NR_setsid                       (__NR_SYSCALL_BASE + 66)
 #define __NR_setgid32                     (__NR_SYSCALL_BASE + 214)
 #define __NR_setreuid32                   (__NR_SYSCALL_BASE + 203)
 #define __NR_setresuid32                  (__NR_SYSCALL_BASE + 208)
 #define __NR_setresgid32                  (__NR_SYSCALL_BASE + 210)
-#define __NR_brk                          (__NR_SYSCALL_BASE + 45)
-#define __NR_ptrace                       (__NR_SYSCALL_BASE + 26)
-#define __NR_getpriority                  (__NR_SYSCALL_BASE + 96)
-#define __NR_setpriority                  (__NR_SYSCALL_BASE + 97)
-#define __NR_setrlimit                    (__NR_SYSCALL_BASE + 75)
 #define __NR_ugetrlimit                   (__NR_SYSCALL_BASE + 191)
-#define __NR_getrusage                    (__NR_SYSCALL_BASE + 77)
 #define __NR_setgroups32                  (__NR_SYSCALL_BASE + 206)
-#define __NR_setpgid                      (__NR_SYSCALL_BASE + 57)
+#define __NR_vfork                        (__NR_SYSCALL_BASE + 190)
 #define __NR_setregid32                   (__NR_SYSCALL_BASE + 204)
-#define __NR_chroot                       (__NR_SYSCALL_BASE + 61)
 #define __NR_prctl                        (__NR_SYSCALL_BASE + 172)
 #define __NR_capget                       (__NR_SYSCALL_BASE + 184)
 #define __NR_capset                       (__NR_SYSCALL_BASE + 185)
 #define __NR_sigaltstack                  (__NR_SYSCALL_BASE + 186)
-#define __NR_acct                         (__NR_SYSCALL_BASE + 51)
-#define __NR_read                         (__NR_SYSCALL_BASE + 3)
-#define __NR_write                        (__NR_SYSCALL_BASE + 4)
 #define __NR_pread64                      (__NR_SYSCALL_BASE + 180)
 #define __NR_pwrite64                     (__NR_SYSCALL_BASE + 181)
-#define __NR_open                         (__NR_SYSCALL_BASE + 5)
-#define __NR_close                        (__NR_SYSCALL_BASE + 6)
-#define __NR_lseek                        (__NR_SYSCALL_BASE + 19)
-#define __NR__llseek                      (__NR_SYSCALL_BASE + 140)
-#define __NR_getpid                       (__NR_SYSCALL_BASE + 20)
+#define __NR_openat                       (__NR_SYSCALL_BASE + 322)
 #define __NR_mmap2                        (__NR_SYSCALL_BASE + 192)
-#define __NR_munmap                       (__NR_SYSCALL_BASE + 91)
 #define __NR_mremap                       (__NR_SYSCALL_BASE + 163)
-#define __NR_msync                        (__NR_SYSCALL_BASE + 144)
-#define __NR_mprotect                     (__NR_SYSCALL_BASE + 125)
+#define __NR_madvise                      (__NR_SYSCALL_BASE + 220)
 #define __NR_mlock                        (__NR_SYSCALL_BASE + 150)
 #define __NR_munlock                      (__NR_SYSCALL_BASE + 151)
-#define __NR_ioctl                        (__NR_SYSCALL_BASE + 54)
-#define __NR_readv                        (__NR_SYSCALL_BASE + 145)
-#define __NR_writev                       (__NR_SYSCALL_BASE + 146)
-#define __NR_fcntl                        (__NR_SYSCALL_BASE + 55)
-#define __NR_flock                        (__NR_SYSCALL_BASE + 143)
-#define __NR_fchmod                       (__NR_SYSCALL_BASE + 94)
-#define __NR_dup                          (__NR_SYSCALL_BASE + 41)
+#define __NR_mincore                      (__NR_SYSCALL_BASE + 219)
 #define __NR_pipe                         (__NR_SYSCALL_BASE + 42)
-#define __NR_dup2                         (__NR_SYSCALL_BASE + 63)
-#define __NR__newselect                   (__NR_SYSCALL_BASE + 142)
-#define __NR_ftruncate                    (__NR_SYSCALL_BASE + 93)
+#define __NR_pipe2                        (__NR_SYSCALL_BASE + 359)
 #define __NR_ftruncate64                  (__NR_SYSCALL_BASE + 194)
-#define __NR_fsync                        (__NR_SYSCALL_BASE + 118)
+#define __NR_getdents64                   (__NR_SYSCALL_BASE + 217)
 #define __NR_fdatasync                    (__NR_SYSCALL_BASE + 148)
 #define __NR_fchown32                     (__NR_SYSCALL_BASE + 207)
-#define __NR_sync                         (__NR_SYSCALL_BASE + 36)
 #define __NR_fcntl64                      (__NR_SYSCALL_BASE + 221)
+#define __NR_fstatfs64                    (__NR_SYSCALL_BASE + 267)
 #define __NR_sendfile                     (__NR_SYSCALL_BASE + 187)
+#define __NR_fstatat64                    (__NR_SYSCALL_BASE + 327)
+#define __NR_mkdirat                      (__NR_SYSCALL_BASE + 323)
+#define __NR_fchownat                     (__NR_SYSCALL_BASE + 325)
+#define __NR_fchmodat                     (__NR_SYSCALL_BASE + 333)
+#define __NR_renameat                     (__NR_SYSCALL_BASE + 329)
 #define __NR_fsetxattr                    (__NR_SYSCALL_BASE + 228)
 #define __NR_fgetxattr                    (__NR_SYSCALL_BASE + 231)
 #define __NR_flistxattr                   (__NR_SYSCALL_BASE + 234)
 #define __NR_fremovexattr                 (__NR_SYSCALL_BASE + 237)
-#define __NR_link                         (__NR_SYSCALL_BASE + 9)
-#define __NR_unlink                       (__NR_SYSCALL_BASE + 10)
-#define __NR_chdir                        (__NR_SYSCALL_BASE + 12)
-#define __NR_mknod                        (__NR_SYSCALL_BASE + 14)
-#define __NR_chmod                        (__NR_SYSCALL_BASE + 15)
+#define __NR_unlinkat                     (__NR_SYSCALL_BASE + 328)
 #define __NR_chown32                      (__NR_SYSCALL_BASE + 212)
 #define __NR_lchown32                     (__NR_SYSCALL_BASE + 198)
-#define __NR_mount                        (__NR_SYSCALL_BASE + 21)
-#define __NR_umount2                      (__NR_SYSCALL_BASE + 52)
 #define __NR_fstat64                      (__NR_SYSCALL_BASE + 197)
 #define __NR_stat64                       (__NR_SYSCALL_BASE + 195)
 #define __NR_lstat64                      (__NR_SYSCALL_BASE + 196)
-#define __NR_mkdir                        (__NR_SYSCALL_BASE + 39)
-#define __NR_readlink                     (__NR_SYSCALL_BASE + 85)
-#define __NR_rmdir                        (__NR_SYSCALL_BASE + 40)
-#define __NR_rename                       (__NR_SYSCALL_BASE + 38)
 #define __NR_getcwd                       (__NR_SYSCALL_BASE + 183)
-#define __NR_access                       (__NR_SYSCALL_BASE + 33)
-#define __NR_symlink                      (__NR_SYSCALL_BASE + 83)
-#define __NR_fchdir                       (__NR_SYSCALL_BASE + 133)
-#define __NR_truncate                     (__NR_SYSCALL_BASE + 92)
+#define __NR_faccessat                    (__NR_SYSCALL_BASE + 334)
 #define __NR_setxattr                     (__NR_SYSCALL_BASE + 226)
 #define __NR_lsetxattr                    (__NR_SYSCALL_BASE + 227)
 #define __NR_getxattr                     (__NR_SYSCALL_BASE + 229)
@@ -112,62 +154,8 @@
 #define __NR_llistxattr                   (__NR_SYSCALL_BASE + 233)
 #define __NR_removexattr                  (__NR_SYSCALL_BASE + 235)
 #define __NR_lremovexattr                 (__NR_SYSCALL_BASE + 236)
-#define __NR_pause                        (__NR_SYSCALL_BASE + 29)
-#define __NR_gettimeofday                 (__NR_SYSCALL_BASE + 78)
-#define __NR_settimeofday                 (__NR_SYSCALL_BASE + 79)
-#define __NR_times                        (__NR_SYSCALL_BASE + 43)
-#define __NR_nanosleep                    (__NR_SYSCALL_BASE + 162)
-#define __NR_getitimer                    (__NR_SYSCALL_BASE + 105)
-#define __NR_setitimer                    (__NR_SYSCALL_BASE + 104)
-#define __NR_sigaction                    (__NR_SYSCALL_BASE + 67)
-#define __NR_sigprocmask                  (__NR_SYSCALL_BASE + 126)
-#define __NR_sigsuspend                   (__NR_SYSCALL_BASE + 72)
-#define __NR_rt_sigaction                 (__NR_SYSCALL_BASE + 174)
-#define __NR_rt_sigprocmask               (__NR_SYSCALL_BASE + 175)
-#define __NR_rt_sigtimedwait              (__NR_SYSCALL_BASE + 177)
-#define __NR_sigpending                   (__NR_SYSCALL_BASE + 73)
-#define __NR_sched_setscheduler           (__NR_SYSCALL_BASE + 156)
-#define __NR_sched_getscheduler           (__NR_SYSCALL_BASE + 157)
-#define __NR_sched_yield                  (__NR_SYSCALL_BASE + 158)
-#define __NR_sched_setparam               (__NR_SYSCALL_BASE + 154)
-#define __NR_sched_getparam               (__NR_SYSCALL_BASE + 155)
-#define __NR_sched_get_priority_max       (__NR_SYSCALL_BASE + 159)
-#define __NR_sched_get_priority_min       (__NR_SYSCALL_BASE + 160)
-#define __NR_sched_rr_get_interval        (__NR_SYSCALL_BASE + 161)
-#define __NR_sched_setaffinity            (__NR_SYSCALL_BASE + 241)
-#define __NR_sched_getaffinity            (__NR_SYSCALL_BASE + 242)
-#define __NR_uname                        (__NR_SYSCALL_BASE + 122)
-#define __NR_wait4                        (__NR_SYSCALL_BASE + 114)
-#define __NR_umask                        (__NR_SYSCALL_BASE + 60)
-#define __NR_reboot                       (__NR_SYSCALL_BASE + 88)
-#define __NR_syslog                       (__NR_SYSCALL_BASE + 103)
-#define __NR_init_module                  (__NR_SYSCALL_BASE + 128)
-#define __NR_delete_module                (__NR_SYSCALL_BASE + 129)
-#define __NR_syslog                       (__NR_SYSCALL_BASE + 103)
-#define __NR_sysinfo                      (__NR_SYSCALL_BASE + 116)
-#define __NR_personality                  (__NR_SYSCALL_BASE + 136)
-#define __NR_perf_event_open              (__NR_SYSCALL_BASE + 364)
-#define __NR_futex                        (__NR_SYSCALL_BASE + 240)
-#define __NR_poll                         (__NR_SYSCALL_BASE + 168)
-
-#ifdef __arm__
-#define __NR_exit_group                   (__NR_SYSCALL_BASE + 248)
-#define __NR_waitid                       (__NR_SYSCALL_BASE + 280)
-#define __NR_vfork                        (__NR_SYSCALL_BASE + 190)
-#define __NR_openat                       (__NR_SYSCALL_BASE + 322)
-#define __NR_madvise                      (__NR_SYSCALL_BASE + 220)
-#define __NR_mincore                      (__NR_SYSCALL_BASE + 219)
-#define __NR_pipe2                        (__NR_SYSCALL_BASE + 359)
-#define __NR_getdents64                   (__NR_SYSCALL_BASE + 217)
-#define __NR_fstatfs64                    (__NR_SYSCALL_BASE + 267)
-#define __NR_fstatat64                    (__NR_SYSCALL_BASE + 327)
-#define __NR_mkdirat                      (__NR_SYSCALL_BASE + 323)
-#define __NR_fchownat                     (__NR_SYSCALL_BASE + 325)
-#define __NR_fchmodat                     (__NR_SYSCALL_BASE + 333)
-#define __NR_renameat                     (__NR_SYSCALL_BASE + 329)
-#define __NR_unlinkat                     (__NR_SYSCALL_BASE + 328)
-#define __NR_faccessat                    (__NR_SYSCALL_BASE + 334)
 #define __NR_statfs64                     (__NR_SYSCALL_BASE + 266)
+#define __NR_nanosleep                    (__NR_SYSCALL_BASE + 162)
 #define __NR_clock_gettime                (__NR_SYSCALL_BASE + 263)
 #define __NR_clock_settime                (__NR_SYSCALL_BASE + 262)
 #define __NR_clock_getres                 (__NR_SYSCALL_BASE + 264)
@@ -179,6 +167,9 @@
 #define __NR_timer_delete                 (__NR_SYSCALL_BASE + 261)
 #define __NR_utimes                       (__NR_SYSCALL_BASE + 269)
 #define __NR_utimensat                    (__NR_SYSCALL_BASE + 348)
+#define __NR_rt_sigaction                 (__NR_SYSCALL_BASE + 174)
+#define __NR_rt_sigprocmask               (__NR_SYSCALL_BASE + 175)
+#define __NR_rt_sigtimedwait              (__NR_SYSCALL_BASE + 177)
 #define __NR_socket                       (__NR_SYSCALL_BASE + 281)
 #define __NR_socketpair                   (__NR_SYSCALL_BASE + 288)
 #define __NR_bind                         (__NR_SYSCALL_BASE + 282)
@@ -194,64 +185,271 @@
 #define __NR_getsockopt                   (__NR_SYSCALL_BASE + 295)
 #define __NR_sendmsg                      (__NR_SYSCALL_BASE + 296)
 #define __NR_recvmsg                      (__NR_SYSCALL_BASE + 297)
+#define __NR_sched_setscheduler           (__NR_SYSCALL_BASE + 156)
+#define __NR_sched_getscheduler           (__NR_SYSCALL_BASE + 157)
+#define __NR_sched_yield                  (__NR_SYSCALL_BASE + 158)
+#define __NR_sched_setparam               (__NR_SYSCALL_BASE + 154)
+#define __NR_sched_getparam               (__NR_SYSCALL_BASE + 155)
+#define __NR_sched_get_priority_max       (__NR_SYSCALL_BASE + 159)
+#define __NR_sched_get_priority_min       (__NR_SYSCALL_BASE + 160)
+#define __NR_sched_rr_get_interval        (__NR_SYSCALL_BASE + 161)
+#define __NR_sched_setaffinity            (__NR_SYSCALL_BASE + 241)
+#define __NR_sched_getaffinity            (__NR_SYSCALL_BASE + 242)
 #define __NR_getcpu                       (__NR_SYSCALL_BASE + 345)
 #define __NR_ioprio_set                   (__NR_SYSCALL_BASE + 314)
 #define __NR_ioprio_get                   (__NR_SYSCALL_BASE + 315)
+#define __NR_futex                        (__NR_SYSCALL_BASE + 240)
 #define __NR_epoll_create                 (__NR_SYSCALL_BASE + 250)
 #define __NR_epoll_ctl                    (__NR_SYSCALL_BASE + 251)
 #define __NR_epoll_wait                   (__NR_SYSCALL_BASE + 252)
 #define __NR_inotify_init                 (__NR_SYSCALL_BASE + 316)
 #define __NR_inotify_add_watch            (__NR_SYSCALL_BASE + 317)
 #define __NR_inotify_rm_watch             (__NR_SYSCALL_BASE + 318)
+#define __NR_poll                         (__NR_SYSCALL_BASE + 168)
 #define __NR_eventfd2                     (__NR_SYSCALL_BASE + 356)
 #define __NR_ARM_set_tls                  (__NR_SYSCALL_BASE + 983045)
 #define __NR_ARM_cacheflush               (__NR_SYSCALL_BASE + 983042)
 #endif
 
 #ifdef __i386__
-#define __NR_exit_group                   (__NR_SYSCALL_BASE + 252)
 #define __NR_waitpid                      (__NR_SYSCALL_BASE + 7)
-#define __NR_waitid                       (__NR_SYSCALL_BASE + 284)
 #define __NR_kill                         (__NR_SYSCALL_BASE + 37)
-#define __NR_tkill                        (__NR_SYSCALL_BASE + 238)
-#define __NR_tgkill                       (__NR_SYSCALL_BASE + 270)
-#define __NR_set_thread_area              (__NR_SYSCALL_BASE + 243)
-#define __NR_openat                       (__NR_SYSCALL_BASE + 295)
-#define __NR_madvise                      (__NR_SYSCALL_BASE + 219)
+#define __NR_pipe                         (__NR_SYSCALL_BASE + 42)
+#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
+#define __NR_fdatasync                    (__NR_SYSCALL_BASE + 148)
+#define __NR_mlock                        (__NR_SYSCALL_BASE + 150)
+#define __NR_munlock                      (__NR_SYSCALL_BASE + 151)
+#define __NR_sched_setparam               (__NR_SYSCALL_BASE + 154)
+#define __NR_sched_getparam               (__NR_SYSCALL_BASE + 155)
+#define __NR_sched_setscheduler           (__NR_SYSCALL_BASE + 156)
+#define __NR_sched_getscheduler           (__NR_SYSCALL_BASE + 157)
+#define __NR_sched_yield                  (__NR_SYSCALL_BASE + 158)
+#define __NR_sched_get_priority_max       (__NR_SYSCALL_BASE + 159)
+#define __NR_sched_get_priority_min       (__NR_SYSCALL_BASE + 160)
+#define __NR_sched_rr_get_interval        (__NR_SYSCALL_BASE + 161)
+#define __NR_nanosleep                    (__NR_SYSCALL_BASE + 162)
+#define __NR_mremap                       (__NR_SYSCALL_BASE + 163)
+#define __NR_poll                         (__NR_SYSCALL_BASE + 168)
+#define __NR_prctl                        (__NR_SYSCALL_BASE + 172)
+#define __NR_rt_sigaction                 (__NR_SYSCALL_BASE + 174)
+#define __NR_rt_sigprocmask               (__NR_SYSCALL_BASE + 175)
+#define __NR_rt_sigtimedwait              (__NR_SYSCALL_BASE + 177)
+#define __NR_pread64                      (__NR_SYSCALL_BASE + 180)
+#define __NR_pwrite64                     (__NR_SYSCALL_BASE + 181)
+#define __NR_getcwd                       (__NR_SYSCALL_BASE + 183)
+#define __NR_capget                       (__NR_SYSCALL_BASE + 184)
+#define __NR_capset                       (__NR_SYSCALL_BASE + 185)
+#define __NR_sigaltstack                  (__NR_SYSCALL_BASE + 186)
+#define __NR_sendfile                     (__NR_SYSCALL_BASE + 187)
+#define __NR_ugetrlimit                   (__NR_SYSCALL_BASE + 191)
+#define __NR_mmap2                        (__NR_SYSCALL_BASE + 192)
+#define __NR_ftruncate64                  (__NR_SYSCALL_BASE + 194)
+#define __NR_stat64                       (__NR_SYSCALL_BASE + 195)
+#define __NR_lstat64                      (__NR_SYSCALL_BASE + 196)
+#define __NR_fstat64                      (__NR_SYSCALL_BASE + 197)
+#define __NR_lchown32                     (__NR_SYSCALL_BASE + 198)
+#define __NR_getuid32                     (__NR_SYSCALL_BASE + 199)
+#define __NR_getgid32                     (__NR_SYSCALL_BASE + 200)
+#define __NR_geteuid32                    (__NR_SYSCALL_BASE + 201)
+#define __NR_getegid32                    (__NR_SYSCALL_BASE + 202)
+#define __NR_setreuid32                   (__NR_SYSCALL_BASE + 203)
+#define __NR_setregid32                   (__NR_SYSCALL_BASE + 204)
+#define __NR_getgroups32                  (__NR_SYSCALL_BASE + 205)
+#define __NR_setgroups32                  (__NR_SYSCALL_BASE + 206)
+#define __NR_fchown32                     (__NR_SYSCALL_BASE + 207)
+#define __NR_setresuid32                  (__NR_SYSCALL_BASE + 208)
+#define __NR_getresuid32                  (__NR_SYSCALL_BASE + 209)
+#define __NR_setresgid32                  (__NR_SYSCALL_BASE + 210)
+#define __NR_getresgid32                  (__NR_SYSCALL_BASE + 211)
+#define __NR_chown32                      (__NR_SYSCALL_BASE + 212)
+#define __NR_setuid32                     (__NR_SYSCALL_BASE + 213)
+#define __NR_setgid32                     (__NR_SYSCALL_BASE + 214)
 #define __NR_mincore                      (__NR_SYSCALL_BASE + 218)
-#define __NR_pipe2                        (__NR_SYSCALL_BASE + 331)
+#define __NR_madvise                      (__NR_SYSCALL_BASE + 219)
 #define __NR_getdents64                   (__NR_SYSCALL_BASE + 220)
-#define __NR_fstatfs64                    (__NR_SYSCALL_BASE + 269)
-#define __NR_fstatat64                    (__NR_SYSCALL_BASE + 300)
-#define __NR_mkdirat                      (__NR_SYSCALL_BASE + 296)
-#define __NR_fchownat                     (__NR_SYSCALL_BASE + 298)
-#define __NR_fchmodat                     (__NR_SYSCALL_BASE + 306)
-#define __NR_renameat                     (__NR_SYSCALL_BASE + 302)
-#define __NR_unlinkat                     (__NR_SYSCALL_BASE + 301)
-#define __NR_faccessat                    (__NR_SYSCALL_BASE + 307)
-#define __NR_statfs64                     (__NR_SYSCALL_BASE + 268)
-#define __NR_clock_gettime                (__NR_SYSCALL_BASE + 265)
-#define __NR_clock_settime                (__NR_SYSCALL_BASE + 264)
-#define __NR_clock_getres                 (__NR_SYSCALL_BASE + 266)
-#define __NR_clock_nanosleep              (__NR_SYSCALL_BASE + 267)
+#define __NR_fcntl64                      (__NR_SYSCALL_BASE + 221)
+#define __NR_gettid                       (__NR_SYSCALL_BASE + 224)
+#define __NR_readahead                    (__NR_SYSCALL_BASE + 225)
+#define __NR_setxattr                     (__NR_SYSCALL_BASE + 226)
+#define __NR_lsetxattr                    (__NR_SYSCALL_BASE + 227)
+#define __NR_fsetxattr                    (__NR_SYSCALL_BASE + 228)
+#define __NR_getxattr                     (__NR_SYSCALL_BASE + 229)
+#define __NR_lgetxattr                    (__NR_SYSCALL_BASE + 230)
+#define __NR_fgetxattr                    (__NR_SYSCALL_BASE + 231)
+#define __NR_listxattr                    (__NR_SYSCALL_BASE + 232)
+#define __NR_llistxattr                   (__NR_SYSCALL_BASE + 233)
+#define __NR_flistxattr                   (__NR_SYSCALL_BASE + 234)
+#define __NR_removexattr                  (__NR_SYSCALL_BASE + 235)
+#define __NR_lremovexattr                 (__NR_SYSCALL_BASE + 236)
+#define __NR_fremovexattr                 (__NR_SYSCALL_BASE + 237)
+#define __NR_tkill                        (__NR_SYSCALL_BASE + 238)
+#define __NR_futex                        (__NR_SYSCALL_BASE + 240)
+#define __NR_sched_setaffinity            (__NR_SYSCALL_BASE + 241)
+#define __NR_sched_getaffinity            (__NR_SYSCALL_BASE + 242)
+#define __NR_set_thread_area              (__NR_SYSCALL_BASE + 243)
+#define __NR_exit_group                   (__NR_SYSCALL_BASE + 252)
+#define __NR_epoll_create                 (__NR_SYSCALL_BASE + 254)
+#define __NR_epoll_ctl                    (__NR_SYSCALL_BASE + 255)
+#define __NR_epoll_wait                   (__NR_SYSCALL_BASE + 256)
 #define __NR_timer_create                 (__NR_SYSCALL_BASE + 259)
 #define __NR_timer_settime                (__NR_SYSCALL_BASE + 260)
 #define __NR_timer_gettime                (__NR_SYSCALL_BASE + 261)
 #define __NR_timer_getoverrun             (__NR_SYSCALL_BASE + 262)
 #define __NR_timer_delete                 (__NR_SYSCALL_BASE + 263)
+#define __NR_clock_settime                (__NR_SYSCALL_BASE + 264)
+#define __NR_clock_gettime                (__NR_SYSCALL_BASE + 265)
+#define __NR_clock_getres                 (__NR_SYSCALL_BASE + 266)
+#define __NR_clock_nanosleep              (__NR_SYSCALL_BASE + 267)
+#define __NR_statfs64                     (__NR_SYSCALL_BASE + 268)
+#define __NR_fstatfs64                    (__NR_SYSCALL_BASE + 269)
+#define __NR_tgkill                       (__NR_SYSCALL_BASE + 270)
 #define __NR_utimes                       (__NR_SYSCALL_BASE + 271)
-#define __NR_utimensat                    (__NR_SYSCALL_BASE + 320)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_getcpu                       (__NR_SYSCALL_BASE + 318)
+#define __NR_waitid                       (__NR_SYSCALL_BASE + 284)
 #define __NR_ioprio_set                   (__NR_SYSCALL_BASE + 289)
 #define __NR_ioprio_get                   (__NR_SYSCALL_BASE + 290)
-#define __NR_epoll_create                 (__NR_SYSCALL_BASE + 254)
-#define __NR_epoll_ctl                    (__NR_SYSCALL_BASE + 255)
-#define __NR_epoll_wait                   (__NR_SYSCALL_BASE + 256)
 #define __NR_inotify_init                 (__NR_SYSCALL_BASE + 291)
 #define __NR_inotify_add_watch            (__NR_SYSCALL_BASE + 292)
 #define __NR_inotify_rm_watch             (__NR_SYSCALL_BASE + 293)
+#define __NR_openat                       (__NR_SYSCALL_BASE + 295)
+#define __NR_mkdirat                      (__NR_SYSCALL_BASE + 296)
+#define __NR_fchownat                     (__NR_SYSCALL_BASE + 298)
+#define __NR_fstatat64                    (__NR_SYSCALL_BASE + 300)
+#define __NR_unlinkat                     (__NR_SYSCALL_BASE + 301)
+#define __NR_renameat                     (__NR_SYSCALL_BASE + 302)
+#define __NR_fchmodat                     (__NR_SYSCALL_BASE + 306)
+#define __NR_faccessat                    (__NR_SYSCALL_BASE + 307)
+#define __NR_getcpu                       (__NR_SYSCALL_BASE + 318)
+#define __NR_utimensat                    (__NR_SYSCALL_BASE + 320)
 #define __NR_eventfd2                     (__NR_SYSCALL_BASE + 328)
+#define __NR_pipe2                        (__NR_SYSCALL_BASE + 331)
+#endif
+
+#ifdef __mips__
+#define __NR_syscall                      (__NR_SYSCALL_BASE + 0)
+#define __NR_waitpid                      (__NR_SYSCALL_BASE + 7)
+#define __NR_lchown                       (__NR_SYSCALL_BASE + 16)
+#define __NR_setuid                       (__NR_SYSCALL_BASE + 23)
+#define __NR_getuid                       (__NR_SYSCALL_BASE + 24)
+#define __NR_kill                         (__NR_SYSCALL_BASE + 37)
+#define __NR_setgid                       (__NR_SYSCALL_BASE + 46)
+#define __NR_getgid                       (__NR_SYSCALL_BASE + 47)
+#define __NR_geteuid                      (__NR_SYSCALL_BASE + 49)
+#define __NR_getegid                      (__NR_SYSCALL_BASE + 50)
+#define __NR_setreuid                     (__NR_SYSCALL_BASE + 70)
+#define __NR_setregid                     (__NR_SYSCALL_BASE + 71)
+#define __NR_getrlimit                    (__NR_SYSCALL_BASE + 76)
+#define __NR_getgroups                    (__NR_SYSCALL_BASE + 80)
+#define __NR_setgroups                    (__NR_SYSCALL_BASE + 81)
+#define __NR_fchown                       (__NR_SYSCALL_BASE + 95)
+#define __NR_cacheflush                   (__NR_SYSCALL_BASE + 147)
+#define __NR_fdatasync                    (__NR_SYSCALL_BASE + 152)
+#define __NR_mlock                        (__NR_SYSCALL_BASE + 154)
+#define __NR_munlock                      (__NR_SYSCALL_BASE + 155)
+#define __NR_sched_setparam               (__NR_SYSCALL_BASE + 158)
+#define __NR_sched_getparam               (__NR_SYSCALL_BASE + 159)
+#define __NR_sched_setscheduler           (__NR_SYSCALL_BASE + 160)
+#define __NR_sched_getscheduler           (__NR_SYSCALL_BASE + 161)
+#define __NR_sched_yield                  (__NR_SYSCALL_BASE + 162)
+#define __NR_sched_get_priority_max       (__NR_SYSCALL_BASE + 163)
+#define __NR_sched_get_priority_min       (__NR_SYSCALL_BASE + 164)
+#define __NR_sched_rr_get_interval        (__NR_SYSCALL_BASE + 165)
+#define __NR_nanosleep                    (__NR_SYSCALL_BASE + 166)
+#define __NR_mremap                       (__NR_SYSCALL_BASE + 167)
+#define __NR_accept                       (__NR_SYSCALL_BASE + 168)
+#define __NR_bind                         (__NR_SYSCALL_BASE + 169)
+#define __NR_connect                      (__NR_SYSCALL_BASE + 170)
+#define __NR_getpeername                  (__NR_SYSCALL_BASE + 171)
+#define __NR_getsockname                  (__NR_SYSCALL_BASE + 172)
+#define __NR_getsockopt                   (__NR_SYSCALL_BASE + 173)
+#define __NR_listen                       (__NR_SYSCALL_BASE + 174)
+#define __NR_recvfrom                     (__NR_SYSCALL_BASE + 176)
+#define __NR_recvmsg                      (__NR_SYSCALL_BASE + 177)
+#define __NR_sendmsg                      (__NR_SYSCALL_BASE + 179)
+#define __NR_sendto                       (__NR_SYSCALL_BASE + 180)
+#define __NR_setsockopt                   (__NR_SYSCALL_BASE + 181)
+#define __NR_shutdown                     (__NR_SYSCALL_BASE + 182)
+#define __NR_socket                       (__NR_SYSCALL_BASE + 183)
+#define __NR_socketpair                   (__NR_SYSCALL_BASE + 184)
+#define __NR_setresuid                    (__NR_SYSCALL_BASE + 185)
+#define __NR_getresuid                    (__NR_SYSCALL_BASE + 186)
+#define __NR_poll                         (__NR_SYSCALL_BASE + 188)
+#define __NR_setresgid                    (__NR_SYSCALL_BASE + 190)
+#define __NR_getresgid                    (__NR_SYSCALL_BASE + 191)
+#define __NR_prctl                        (__NR_SYSCALL_BASE + 192)
+#define __NR_rt_sigaction                 (__NR_SYSCALL_BASE + 194)
+#define __NR_rt_sigprocmask               (__NR_SYSCALL_BASE + 195)
+#define __NR_rt_sigtimedwait              (__NR_SYSCALL_BASE + 197)
+#define __NR_pread64                      (__NR_SYSCALL_BASE + 200)
+#define __NR_pwrite64                     (__NR_SYSCALL_BASE + 201)
+#define __NR_chown                        (__NR_SYSCALL_BASE + 202)
+#define __NR_getcwd                       (__NR_SYSCALL_BASE + 203)
+#define __NR_capget                       (__NR_SYSCALL_BASE + 204)
+#define __NR_capset                       (__NR_SYSCALL_BASE + 205)
+#define __NR_sigaltstack                  (__NR_SYSCALL_BASE + 206)
+#define __NR_sendfile                     (__NR_SYSCALL_BASE + 207)
+#define __NR_mmap2                        (__NR_SYSCALL_BASE + 210)
+#define __NR_ftruncate64                  (__NR_SYSCALL_BASE + 212)
+#define __NR_stat64                       (__NR_SYSCALL_BASE + 213)
+#define __NR_lstat64                      (__NR_SYSCALL_BASE + 214)
+#define __NR_fstat64                      (__NR_SYSCALL_BASE + 215)
+#define __NR_mincore                      (__NR_SYSCALL_BASE + 217)
+#define __NR_madvise                      (__NR_SYSCALL_BASE + 218)
+#define __NR_getdents64                   (__NR_SYSCALL_BASE + 219)
+#define __NR_fcntl64                      (__NR_SYSCALL_BASE + 220)
+#define __NR_gettid                       (__NR_SYSCALL_BASE + 222)
+#define __NR_readahead                    (__NR_SYSCALL_BASE + 223)
+#define __NR_setxattr                     (__NR_SYSCALL_BASE + 224)
+#define __NR_lsetxattr                    (__NR_SYSCALL_BASE + 225)
+#define __NR_fsetxattr                    (__NR_SYSCALL_BASE + 226)
+#define __NR_getxattr                     (__NR_SYSCALL_BASE + 227)
+#define __NR_lgetxattr                    (__NR_SYSCALL_BASE + 228)
+#define __NR_fgetxattr                    (__NR_SYSCALL_BASE + 229)
+#define __NR_listxattr                    (__NR_SYSCALL_BASE + 230)
+#define __NR_llistxattr                   (__NR_SYSCALL_BASE + 231)
+#define __NR_flistxattr                   (__NR_SYSCALL_BASE + 232)
+#define __NR_removexattr                  (__NR_SYSCALL_BASE + 233)
+#define __NR_lremovexattr                 (__NR_SYSCALL_BASE + 234)
+#define __NR_fremovexattr                 (__NR_SYSCALL_BASE + 235)
+#define __NR_tkill                        (__NR_SYSCALL_BASE + 236)
+#define __NR_futex                        (__NR_SYSCALL_BASE + 238)
+#define __NR_sched_setaffinity            (__NR_SYSCALL_BASE + 239)
+#define __NR_sched_getaffinity            (__NR_SYSCALL_BASE + 240)
+#define __NR_exit_group                   (__NR_SYSCALL_BASE + 246)
+#define __NR_epoll_create                 (__NR_SYSCALL_BASE + 248)
+#define __NR_epoll_ctl                    (__NR_SYSCALL_BASE + 249)
+#define __NR_epoll_wait                   (__NR_SYSCALL_BASE + 250)
+#define __NR_statfs64                     (__NR_SYSCALL_BASE + 255)
+#define __NR_fstatfs64                    (__NR_SYSCALL_BASE + 256)
+#define __NR_timer_create                 (__NR_SYSCALL_BASE + 257)
+#define __NR_timer_settime                (__NR_SYSCALL_BASE + 258)
+#define __NR_timer_gettime                (__NR_SYSCALL_BASE + 259)
+#define __NR_timer_getoverrun             (__NR_SYSCALL_BASE + 260)
+#define __NR_timer_delete                 (__NR_SYSCALL_BASE + 261)
+#define __NR_clock_settime                (__NR_SYSCALL_BASE + 262)
+#define __NR_clock_gettime                (__NR_SYSCALL_BASE + 263)
+#define __NR_clock_getres                 (__NR_SYSCALL_BASE + 264)
+#define __NR_clock_nanosleep              (__NR_SYSCALL_BASE + 265)
+#define __NR_tgkill                       (__NR_SYSCALL_BASE + 266)
+#define __NR_utimes                       (__NR_SYSCALL_BASE + 267)
+#define __NR_waitid                       (__NR_SYSCALL_BASE + 278)
+#define __NR_set_thread_area              (__NR_SYSCALL_BASE + 283)
+#define __NR_inotify_init                 (__NR_SYSCALL_BASE + 284)
+#define __NR_inotify_add_watch            (__NR_SYSCALL_BASE + 285)
+#define __NR_inotify_rm_watch             (__NR_SYSCALL_BASE + 286)
+#define __NR_openat                       (__NR_SYSCALL_BASE + 288)
+#define __NR_mkdirat                      (__NR_SYSCALL_BASE + 289)
+#define __NR_fchownat                     (__NR_SYSCALL_BASE + 291)
+#define __NR_fstatat64                    (__NR_SYSCALL_BASE + 293)
+#define __NR_unlinkat                     (__NR_SYSCALL_BASE + 294)
+#define __NR_renameat                     (__NR_SYSCALL_BASE + 295)
+#define __NR_fchmodat                     (__NR_SYSCALL_BASE + 299)
+#define __NR_faccessat                    (__NR_SYSCALL_BASE + 300)
+#define __NR_getcpu                       (__NR_SYSCALL_BASE + 312)
+#define __NR_ioprio_set                   (__NR_SYSCALL_BASE + 314)
+#define __NR_ioprio_get                   (__NR_SYSCALL_BASE + 315)
+#define __NR_utimensat                    (__NR_SYSCALL_BASE + 316)
+#define __NR_eventfd2                     (__NR_SYSCALL_BASE + 325)
+#define __NR_pipe2                        (__NR_SYSCALL_BASE + 328)
 #endif
 
 #endif
diff --git a/libc/kernel/arch-mips/asm/signal.h b/libc/kernel/arch-mips/asm/signal.h
index b51ad71..5f5ac77 100644
--- a/libc/kernel/arch-mips/asm/signal.h
+++ b/libc/kernel/arch-mips/asm/signal.h
@@ -92,32 +92,33 @@
 #define MINSIGSTKSZ 2048
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SIGSTKSZ 8192
+struct siginfo;
 #define SIG_BLOCK 1  
 #define SIG_UNBLOCK 2  
-#define SIG_SETMASK 3  
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIG_SETMASK 3  
 #include <asm-generic/signal.h>
 struct sigaction {
  unsigned int sa_flags;
- union {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
  __sighandler_t sa_handler;
  void (*sa_sigaction) (int, struct siginfo *, void *);
  } __sigaction_handler;
-#define sa_handler __sigaction_handler.sa_handler
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define sa_handler __sigaction_handler.sa_handler
 #define sa_sigaction __sigaction_handler.sa_sigaction
  sigset_t sa_mask;
 };
-struct k_sigaction {
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct k_sigaction {
  struct sigaction sa;
 };
 typedef struct sigaltstack {
- void *ss_sp;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ void *ss_sp;
  size_t ss_size;
  int ss_flags;
 } stack_t;
-#endif
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/netbsd/resolv/res_cache.c b/libc/netbsd/resolv/res_cache.c
index 9ae627c..0bb2f23 100644
--- a/libc/netbsd/resolv/res_cache.c
+++ b/libc/netbsd/resolv/res_cache.c
@@ -1433,6 +1433,27 @@
     _cache_remove_p(cache, lookup);
 }
 
+/* Remove all expired entries from the hash table.
+ */
+static void _cache_remove_expired(Cache* cache) {
+    Entry* e;
+    time_t now = _time_now();
+
+    for (e = cache->mru_list.mru_next; e != &cache->mru_list;) {
+        // Entry is old, remove
+        if (now >= e->expires) {
+            Entry** lookup = _cache_lookup_p(cache, e);
+            if (*lookup == NULL) { /* should not happen */
+                XLOG("%s: ENTRY NOT IN HTABLE ?", __FUNCTION__);
+                return;
+            }
+            e = e->mru_next;
+            _cache_remove_p(cache, lookup);
+        } else {
+            e = e->mru_next;
+        }
+    }
+}
 
 ResolvCacheStatus
 _resolv_cache_lookup( struct resolv_cache*  cache,
@@ -1547,7 +1568,10 @@
     }
 
     if (cache->num_entries >= cache->max_entries) {
-        _cache_remove_oldest(cache);
+        _cache_remove_expired(cache);
+        if (cache->num_entries >= cache->max_entries) {
+            _cache_remove_oldest(cache);
+        }
         /* need to lookup again */
         lookup = _cache_lookup_p(cache, key);
         e      = *lookup;
diff --git a/libc/tools/bionic_utils.py b/libc/tools/bionic_utils.py
index 0bc947b..abb7820 100644
--- a/libc/tools/bionic_utils.py
+++ b/libc/tools/bionic_utils.py
@@ -4,13 +4,13 @@
 
 # support Bionic architectures, add new ones as appropriate
 #
-bionic_archs = [ "arm", "x86" ]
+bionic_archs = [ "arm", "x86", "mips" ]
 
 # basic debugging trace support
 # call D_setlevel to set the verbosity level
 # and D(), D2(), D3(), D4() to add traces
 #
-verbose = 1
+verbose = 0
 
 def D(msg):
     global verbose
@@ -178,7 +178,7 @@
         self.syscalls = []
         self.lineno   = 0
 
-    def E(msg):
+    def E(self, msg):
         print "%d: %s" % (self.lineno, msg)
 
     def parse_line(self, line):
@@ -238,36 +238,55 @@
 
         number = line[pos_rparen+1:].strip()
         if number == "stub":
-            syscall_id  = -1
-            syscall_id2 = -1
+            syscall_common = -1
+            syscall_arm  = -1
+            syscall_x86 = -1
+            syscall_mips = -1
         else:
             try:
                 if number[0] == '#':
                     number = number[1:].strip()
                 numbers = string.split(number,',')
-                syscall_id  = int(numbers[0])
-                syscall_id2 = syscall_id
-                if len(numbers) > 1:
-                    syscall_id2 = int(numbers[1])
+                if len(numbers) == 1:
+                    syscall_common = int(numbers[0])
+                    syscall_arm = -1
+                    syscall_x86 = -1
+                    syscall_mips = -1
+                else:
+                    if len(numbers) == 3:
+                        syscall_common = -1
+                        syscall_arm  = int(numbers[0])
+                        syscall_x86 = int(numbers[1])
+                        syscall_mips = int(numbers[2])
+                    else:
+                        E("invalid syscall number format in '%s'" % line)
+                        return
             except:
                 E("invalid syscall number in '%s'" % line)
                 return
 
-		global verbose
+        global verbose
         if verbose >= 2:
-            if call_id < 0:
-                print "%s: %d,%d" % (syscall_name, syscall_id, syscall_id2)
+            if call_id == -1:
+                if syscall_common == -1:
+                    print "%s: %d,%d,%d" % (syscall_name, syscall_arm, syscall_x86, syscall_mips)
+                else:
+                    print "%s: %d" % (syscall_name, syscall_common)
             else:
-                print "%s(%d): %d,%d" % (syscall_name, call_id, syscall_id, syscall_id2)
+                if syscall_common == -1:
+                    print "%s(%d): %d,%d,%d" % (syscall_name, call_id, syscall_arm, syscall_x86, syscall_mips)
+                else:
+                    print "%s(%d): %d" % (syscall_name, call_id, syscall_common)
 
-        t = { "id"     : syscall_id,
-              "id2"    : syscall_id2,
+        t = { "armid"  : syscall_arm,
+              "x86id"  : syscall_x86,
+              "mipsid" : syscall_mips,
+              "common" : syscall_common,
               "cid"    : call_id,
               "name"   : syscall_name,
               "func"   : syscall_func,
               "params" : syscall_params,
               "decl"   : "%-15s  %s (%s);" % (return_type, syscall_func, params) }
-
         self.syscalls.append(t)
 
     def parse_file(self, file_path):
diff --git a/libc/tools/checksyscalls.py b/libc/tools/checksyscalls.py
index 2c563d7..286e727 100755
--- a/libc/tools/checksyscalls.py
+++ b/libc/tools/checksyscalls.py
@@ -70,10 +70,17 @@
 re_nr_clock_line = re.compile( r"#define __NR_(\w*)\s*\(__NR_timer_create\+(\w*)\)" )
 re_arm_nr_line   = re.compile( r"#define __ARM_NR_(\w*)\s*\(__ARM_NR_BASE\+\s*(\w*)\)" )
 re_x86_line      = re.compile( r"#define __NR_(\w*)\s*([0-9]*)" )
+re_mips_line     = re.compile( r"#define __NR_(\w*)\s*\(__NR_Linux\s*\+\s*([0-9]*)\)" )
 
 # now read the Linux arm header
 def process_nr_line(line,dict):
 
+    m = re_mips_line.match(line)
+    if m:
+        if dict["Linux"]==4000:
+            dict[m.group(1)] = int(m.group(2))
+        return
+
     m = re_nr_line.match(line)
     if m:
         dict[m.group(1)] = int(m.group(2))
@@ -118,6 +125,7 @@
 
 arm_dict = {}
 x86_dict = {}
+mips_dict = {}
 
 # remove trailing slash from the linux_root, if any
 if linux_root[-1] == '/':
@@ -141,8 +149,15 @@
         print "maybe using a different set of kernel headers might help."
         sys.exit(1)
 
+mips_unistd = find_arch_header(linux_root, "mips", "unistd.h")
+if not mips_unistd:
+    print "WEIRD: Could not locate the Mips unistd.h kernel header file,"
+    print "maybe using a different set of kernel headers might help."
+    sys.exit(1)
+
 process_header( arm_unistd, arm_dict )
 process_header( x86_unistd, x86_dict )
+process_header( mips_unistd, mips_dict )
 
 # now perform the comparison
 errors = 0
@@ -154,18 +169,19 @@
         sc_id   = sc[idname]
         if sc_id >= 0:
             if not arch_dict.has_key(sc_name):
-                print "%s syscall %s not defined, should be %d !!" % (archname, sc_name, sc_id)
+                print "error: %s syscall %s not defined, should be %d" % (archname, sc_name, sc_id)
                 errors += 1
             elif not arch_dict.has_key(sc_name):
-                print "%s syscall %s is not implemented!" % (archname, sc_name)
+                print "error: %s syscall %s is not implemented" % (archname, sc_name)
                 errors += 1
             elif arch_dict[sc_name] != sc_id:
-                print "%s syscall %s should be %d instead of %d !!" % (archname, sc_name, arch_dict[sc_name], sc_id)
+                print "error: %s syscall %s should be %d instead of %d" % (archname, sc_name, arch_dict[sc_name], sc_id)
                 errors += 1
     return errors
 
-errors += check_syscalls("arm", "id", arm_dict)
-errors += check_syscalls("x86", "id2", x86_dict)
+errors += check_syscalls("arm", "armid", arm_dict)
+errors += check_syscalls("x86", "x86id", x86_dict)
+errors += check_syscalls("mips", "mipsid", mips_dict)
 
 if errors == 0:
     print "congratulations, everything's fine !!"
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index bfa9fcc..9a8a8c7 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -1,11 +1,12 @@
 #!/usr/bin/python
 #
-# this tool is used to generate the syscall assmbler templates
-# to be placed into arch-x86/syscalls, as well as the content
-# of arch-x86/linux/_syscalls.h
+# this tool is used to generate the syscall assembler templates
+# to be placed into arch-{arm,x86,mips}/syscalls, as well as the content
+# of arch-{arm,x86,mips}/linux/_syscalls.h
 #
 
 import sys, os.path, glob, re, commands, filecmp, shutil
+import getpass
 
 from bionic_utils import *
 
@@ -31,9 +32,10 @@
 bionic_temp = "/tmp/bionic_gensyscalls/"
 
 # all architectures, update as you see fit
-all_archs = [ "arm", "x86" ]
+all_archs = [ "arm", "x86", "mips" ]
 
 def make_dir( path ):
+    path = os.path.abspath(path)
     if not os.path.exists(path):
         parent = os.path.dirname(path)
         if parent:
@@ -183,6 +185,32 @@
     .fnend
 """
 
+# mips assembler templates for each syscall stub
+#
+mips_call = """/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+    .text
+    .globl %(fname)s
+    .align 4
+    .ent %(fname)s
+
+%(fname)s:
+    .set noreorder
+    .cpload $t9
+    li $v0, %(idname)s
+    syscall
+    bnez $a3, 1f
+    move $a0, $v0
+    j $ra
+    nop
+1:
+    la $t9,__set_errno
+    j $t9
+    nop
+    .set reorder
+    .end %(fname)s
+"""
+
 def param_uses_64bits(param):
     """Returns True iff a syscall parameter description corresponds
        to a 64-bit type."""
@@ -331,6 +359,10 @@
                 return thumb_call_long % t
         return thumb_call_default % t
 
+    def mips_genstub(self,fname, idname):
+        t = { "fname"  : fname,
+              "idname" : idname }
+        return mips_call % t
 
     def superh_genstub(self, fname, flags, idname):
         numargs = int(flags)
@@ -360,7 +392,7 @@
             syscall_params = t["params"]
             syscall_name   = t["name"]
 
-            if t["id"] >= 0:
+            if t["common"] >= 0 or t["armid"] >= 0:
                 num_regs = count_arm_param_registers(syscall_params)
                 if gen_thumb_stubs:
                     t["asm-thumb"] = self.thumb_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
@@ -370,7 +402,7 @@
                     else:
                         t["asm-arm"]   = self.arm_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
 
-            if t["id2"] >= 0:
+            if t["common"] >= 0 or t["x86id"] >= 0:
                 num_regs = count_generic_param_registers(syscall_params)
                 if t["cid"] >= 0:
                     t["asm-x86"] = self.x86_genstub_cid(syscall_func, num_regs, "__NR_"+syscall_name, t["cid"])
@@ -380,55 +412,65 @@
                 E("cid for dispatch syscalls is only supported for x86 in "
                   "'%s'" % syscall_name)
                 return
+            if t["common"] >= 0 or t["mipsid"] >= 0:
+                t["asm-mips"] = self.mips_genstub(syscall_func,"__NR_"+syscall_name)
 
 
     def gen_NR_syscall(self,fp,name,id):
         fp.write( "#define __NR_%-25s    (__NR_SYSCALL_BASE + %d)\n" % (name,id) )
 
-    # now dump the content of linux/_syscalls.h
+    # now dump the content of linux-syscalls.h
     def gen_linux_syscalls_h(self):
         path = "include/sys/linux-syscalls.h"
         D( "generating "+path )
         fp = create_file( path )
         fp.write( "/* auto-generated by gensyscalls.py, do not touch */\n" )
-        fp.write( "#ifndef _BIONIC_LINUX_SYSCALLS_H_\n\n" )
-        fp.write( "#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H\n" )
+        fp.write( "#ifndef _BIONIC_LINUX_SYSCALLS_H_\n" )
+        fp.write( "#define _BIONIC_LINUX_SYSCALLS_H_\n\n" )
+        fp.write( "#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H && !defined __ASM_MIPS_UNISTD_H\n" )
         fp.write( "#if defined __arm__ && !defined __ARM_EABI__ && !defined __thumb__\n" )
-        fp.write( "  #  define __NR_SYSCALL_BASE  0x900000\n" )
-        fp.write( "  #else\n" )
-        fp.write( "  #  define  __NR_SYSCALL_BASE  0\n" )
-        fp.write( "  #endif\n\n" )
+        fp.write( "  #  define __NR_SYSCALL_BASE 0x900000\n" )
+        fp.write( "#elif defined(__mips__)\n" )
+        fp.write( "  #  define __NR_SYSCALL_BASE 4000\n" )
+        fp.write( "#else\n" )
+        fp.write( "  #  define __NR_SYSCALL_BASE 0\n" )
+        fp.write( "#endif\n\n" )
 
         # first, all common syscalls
-        for sc in self.syscalls:
-            sc_id  = sc["id"]
-            sc_id2 = sc["id2"]
+        for sc in sorted(self.syscalls,key=lambda x:x["common"]):
+            sc_id  = sc["common"]
             sc_name = sc["name"]
-            if sc_id == sc_id2 and sc_id >= 0:
+            if sc_id >= 0:
                 self.gen_NR_syscall( fp, sc_name, sc_id )
 
         # now, all arm-specific syscalls
         fp.write( "\n#ifdef __arm__\n" );
         for sc in self.syscalls:
-            sc_id  = sc["id"]
-            sc_id2 = sc["id2"]
+            sc_id  = sc["armid"]
             sc_name = sc["name"]
-            if sc_id != sc_id2 and sc_id >= 0:
+            if sc_id >= 0:
                 self.gen_NR_syscall( fp, sc_name, sc_id )
         fp.write( "#endif\n" );
 
         gen_syscalls = {}
         # finally, all i386-specific syscalls
         fp.write( "\n#ifdef __i386__\n" );
-        for sc in self.syscalls:
-            sc_id  = sc["id"]
-            sc_id2 = sc["id2"]
+        for sc in sorted(self.syscalls,key=lambda x:x["x86id"]):
+            sc_id  = sc["x86id"]
             sc_name = sc["name"]
-            if sc_id != sc_id2 and sc_id2 >= 0 and sc_name not in gen_syscalls:
-                self.gen_NR_syscall( fp, sc_name, sc_id2 )
+            if sc_id >= 0 and sc_name not in gen_syscalls:
+                self.gen_NR_syscall( fp, sc_name, sc_id )
                 gen_syscalls[sc_name] = True
         fp.write( "#endif\n" );
 
+        # all mips-specific syscalls
+        fp.write( "\n#ifdef __mips__\n" );
+        for sc in sorted(self.syscalls,key=lambda x:x["mipsid"]):
+            sc_id = sc["mipsid"]
+            if sc_id >= 0:
+                self.gen_NR_syscall( fp, sc["name"], sc_id )
+        fp.write( "#endif\n" );
+
         fp.write( "\n#endif\n" )
         fp.write( "\n#endif /* _BIONIC_LINUX_SYSCALLS_H_ */\n" );
         fp.close()
@@ -445,6 +487,7 @@
         arch_test = {
             "arm": lambda x: x.has_key("asm-arm") or x.has_key("asm-thumb"),
             "x86": lambda x: x.has_key("asm-x86"),
+            "mips": lambda x: x.has_key("asm-mips")
         }
 
         for sc in self.syscalls:
@@ -454,6 +497,7 @@
         fp.close()
         self.other_files.append( path )
 
+
     # now generate each syscall stub
     def gen_syscall_stubs(self):
         for sc in self.syscalls:
@@ -481,6 +525,13 @@
                 fp.close()
                 self.new_stubs.append( fname )
 
+            if sc.has_key("asm-mips") and 'mips' in all_archs:
+                fname = "arch-mips/syscalls/%s.S" % sc["func"]
+                D2( ">>> generating "+fname )
+                fp = create_file( fname )
+                fp.write(sc["asm-mips"])
+                fp.close()
+                self.new_stubs.append( fname )
 
     def  regenerate(self):
         D( "scanning for existing architecture-specific stub files" )
@@ -498,7 +549,7 @@
 
         if not os.path.exists( bionic_temp ):
             D( "creating %s" % bionic_temp )
-            os.mkdir( bionic_temp )
+            make_dir( bionic_temp )
 
 #        D( "p4 editing source files" )
 #        for arch in all_archs:
diff --git a/libdl/libdl.c b/libdl/libdl.c
index 872c0c9..1d51c37 100644
--- a/libdl/libdl.c
+++ b/libdl/libdl.c
@@ -26,11 +26,11 @@
 
 #ifdef __arm__
 void *dl_unwind_find_exidx(void *pc, int *pcount) { return 0; }
-#elif defined(__i386__) || defined(__sh__)
+#elif defined(__i386__) || defined(__sh__) || defined(__mips__)
 /* we munge the cb definition so we don't have to include any headers here.
  * It won't affect anything since these are just symbols anyway */
 int dl_iterate_phdr(int (*cb)(void *info, void *size, void *data),
                     void *data) { return 0; }
 #else
-#error Unsupported architecture. Only arm and x86 are supported.
+#error Unsupported architecture. Only mips, arm and x86 are supported.
 #endif
diff --git a/libm/Android.mk b/libm/Android.mk
index 57e4d4c..07cb7db 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -152,6 +152,7 @@
 	src/s_isnan.c \
 	src/s_modf.c
 
+libm_common_cflags :=
 
 ifeq ($(TARGET_ARCH),arm)
   libm_common_src_files += \
@@ -162,21 +163,29 @@
 	src/s_scalbnf.c
 
   libm_common_includes = $(LOCAL_PATH)/arm
+endif
 
-else
-  ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-x86)
-    libm_common_src_files += \
+ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-x86)
+  libm_common_src_files += \
 	i387/fenv.c \
 	i387/s_scalbnl.S \
 	i387/s_scalbn.S \
 	i387/s_scalbnf.S
 
-    libm_common_includes = $(LOCAL_PATH)/i386 $(LOCAL_PATH)/i387
-  else
-    $(error "Unknown architecture")
-  endif
+  libm_common_includes = $(LOCAL_PATH)/i386 $(LOCAL_PATH)/i387
 endif
+ifeq ($(TARGET_ARCH),mips)
+  libm_common_src_files += \
+	mips/fenv.c \
+	src/e_ldexpf.c \
+	src/s_scalbln.c \
+	src/s_scalbn.c \
+	src/s_scalbnf.c
 
+  libm_common_includes = $(LOCAL_PATH)/mips
+  # Need to build *rint* functions
+  libm_common_cflags += -fno-builtin-rintf -fno-builtin-rint
+endif
 
 # libm.a
 # ========================================================
@@ -188,6 +197,7 @@
 
 LOCAL_ARM_MODE := arm
 LOCAL_C_INCLUDES += $(libm_common_includes)
+LOCAL_CFLAGS := $(libm_common_cflags)
 
 LOCAL_MODULE:= libm
 
@@ -206,6 +216,7 @@
 LOCAL_ARM_MODE := arm
 
 LOCAL_C_INCLUDES += $(libm_common_includes)
+LOCAL_CFLAGS := $(libm_common_cflags)
 
 LOCAL_MODULE:= libm
 
diff --git a/libm/mips/Makefile.inc b/libm/mips/Makefile.inc
new file mode 100644
index 0000000..9bbfaa1
--- /dev/null
+++ b/libm/mips/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD: src/lib/msun/mips/Makefile.inc,v 1.1 2008/04/26 12:20:29 imp Exp $
+
+LDBL_PREC = 53
diff --git a/libm/mips/_fpmath.h b/libm/mips/_fpmath.h
new file mode 100644
index 0000000..cb6e8c0
--- /dev/null
+++ b/libm/mips/_fpmath.h
@@ -0,0 +1,56 @@
+/*-
+ * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/libc/mips/_fpmath.h,v 1.1 2008/04/26 12:07:59 imp Exp $
+ */
+
+union IEEEl2bits {
+	long double	e;
+	struct {
+#ifndef __MIPSEB__
+		unsigned int	manl	:32;
+		unsigned int	manh	:20;
+		unsigned int	exp	:11;
+		unsigned int	sign	:1;
+#else
+		unsigned int		sign	:1;
+		unsigned int		exp	:11;
+		unsigned int		manh	:20;
+		unsigned int		manl	:32;
+#endif
+	} bits;
+};
+
+#define	LDBL_NBIT	0
+#define	mask_nbit_l(u)	((void)0)
+#define	LDBL_IMPLICIT_NBIT
+
+#define	LDBL_MANH_SIZE	20
+#define	LDBL_MANL_SIZE	32
+
+#define	LDBL_TO_ARRAY32(u, a) do {			\
+	(a)[0] = (uint32_t)(u).bits.manl;		\
+	(a)[1] = (uint32_t)(u).bits.manh;		\
+} while(0)
diff --git a/libm/mips/fenv.c b/libm/mips/fenv.c
new file mode 100644
index 0000000..b5f52da
--- /dev/null
+++ b/libm/mips/fenv.c
@@ -0,0 +1,35 @@
+/*-
+ * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/msun/mips/fenv.c,v 1.1 2008/04/26 12:20:29 imp Exp $
+ */
+
+#include <fenv.h>
+
+/*
+ * Hopefully the system ID byte is immutable, so it's valid to use
+ * this as a default environment.
+ */
+const fenv_t __fe_dfl_env = 0;
diff --git a/libm/mips/fenv.h b/libm/mips/fenv.h
new file mode 100644
index 0000000..061a696
--- /dev/null
+++ b/libm/mips/fenv.h
@@ -0,0 +1,218 @@
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/msun/mips/fenv.h,v 1.1 2008/04/26 12:20:29 imp Exp $
+ */
+
+#ifndef	_FENV_H_
+#define	_FENV_H_
+
+#include <sys/_types.h>
+
+typedef	__uint32_t	fenv_t;
+typedef	__uint32_t	fexcept_t;
+
+/* Exception flags */
+#define	FE_INVALID	0x0001
+#define	FE_DIVBYZERO	0x0002
+#define	FE_OVERFLOW	0x0004
+#define	FE_UNDERFLOW	0x0008
+#define	FE_INEXACT	0x0010
+#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | \
+			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+/* Rounding modes */
+#define	FE_TONEAREST	0x0000
+#define	FE_TOWARDZERO	0x0001
+#define	FE_UPWARD	0x0002
+#define	FE_DOWNWARD	0x0003
+#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
+			 FE_UPWARD | FE_TOWARDZERO)
+/* __BEGIN_DECLS */
+
+/* Default floating-point environment */
+extern const fenv_t	__fe_dfl_env;
+#define	FE_DFL_ENV	(&__fe_dfl_env)
+
+/* We need to be able to map status flag positions to mask flag positions */
+#define _FPUSW_SHIFT	16
+#define	_ENABLE_MASK	(FE_ALL_EXCEPT << _FPUSW_SHIFT)
+
+#ifdef	ARM_HARD_FLOAT
+#define	__rfs(__fpsr)	__asm __volatile("rfs %0" : "=r" (*(__fpsr)))
+#define	__wfs(__fpsr)	__asm __volatile("wfs %0" : : "r" (__fpsr))
+#else
+#define __rfs(__fpsr)
+#define __wfs(__fpsr)
+#endif
+
+static __inline int
+feclearexcept(int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	__fpsr &= ~__excepts;
+	__wfs(__fpsr);
+	return (0);
+}
+
+static __inline int
+fegetexceptflag(fexcept_t *__flagp, int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	*__flagp = __fpsr & __excepts;
+	return (0);
+}
+
+static __inline int
+fesetexceptflag(const fexcept_t *__flagp, int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	__fpsr &= ~__excepts;
+	__fpsr |= *__flagp & __excepts;
+	__wfs(__fpsr);
+	return (0);
+}
+
+static __inline int
+feraiseexcept(int __excepts)
+{
+	fexcept_t __ex = __excepts;
+
+	fesetexceptflag(&__ex, __excepts);	/* XXX */
+	return (0);
+}
+
+static __inline int
+fetestexcept(int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	return (__fpsr & __excepts);
+}
+
+static __inline int
+fegetround(void)
+{
+
+	/*
+	 * Apparently, the rounding mode is specified as part of the
+	 * instruction format on ARM, so the dynamic rounding mode is
+	 * indeterminate.  Some FPUs may differ.
+	 */
+	return (-1);
+}
+
+static __inline int
+fesetround(int __round)
+{
+
+	return (-1);
+}
+
+static __inline int
+fegetenv(fenv_t *__envp)
+{
+
+	__rfs(__envp);
+	return (0);
+}
+
+static __inline int
+feholdexcept(fenv_t *__envp)
+{
+	fenv_t __env;
+
+	__rfs(&__env);
+	*__envp = __env;
+	__env &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
+	__wfs(__env);
+	return (0);
+}
+
+static __inline int
+fesetenv(const fenv_t *__envp)
+{
+
+	__wfs(*__envp);
+	return (0);
+}
+
+static __inline int
+feupdateenv(const fenv_t *__envp)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	__wfs(*__envp);
+	feraiseexcept(__fpsr & FE_ALL_EXCEPT);
+	return (0);
+}
+
+#if __BSD_VISIBLE
+
+static __inline int
+feenableexcept(int __mask)
+{
+	fenv_t __old_fpsr, __new_fpsr;
+
+	__rfs(&__old_fpsr);
+	__new_fpsr = __old_fpsr | (__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT;
+	__wfs(__new_fpsr);
+	return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static __inline int
+fedisableexcept(int __mask)
+{
+	fenv_t __old_fpsr, __new_fpsr;
+
+	__rfs(&__old_fpsr);
+	__new_fpsr = __old_fpsr & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
+	__wfs(__new_fpsr);
+	return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static __inline int
+fegetexcept(void)
+{
+	fenv_t __fpsr;
+
+	__rfs(&__fpsr);
+	return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
+}
+
+#endif /* __BSD_VISIBLE */
+
+/* __END_DECLS */
+
+#endif	/* !_FENV_H_ */
+
diff --git a/libm/src/s_fabsl.c b/libm/src/s_fabsl.c
index 200a9a5..29831d2 100644
--- a/libm/src/s_fabsl.c
+++ b/libm/src/s_fabsl.c
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2003 Dag-Erling Smørgrav
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/msun/src/s_fabsl.c,v 1.2 2003/10/25 19:53:28 des Exp $
+ * $FreeBSD$
  */
 
 #include <math.h>
diff --git a/libthread_db/libthread_db.c b/libthread_db/libthread_db.c
index 86e1cf4..e749377 100644
--- a/libthread_db/libthread_db.c
+++ b/libthread_db/libthread_db.c
@@ -99,7 +99,7 @@
         gEventMsgHandle.tid = gEventMsgHandle.pid;
         return 0x42;
     }
-#else
+#elif defined(__arm__)
     pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)60 /* r15/pc */, NULL);
 
     if (pc == bkpt_addr) {
@@ -109,6 +109,15 @@
         gEventMsgHandle.tid = gEventMsgHandle.pid;
         return 0x42;
     }
+#elif defined(__mips__)
+    pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)(64*4) /* pc */, NULL);
+    if (pc == bkpt_addr) {
+        // The hook function takes the id of the new thread as it's first param,
+        // so grab it from a0
+        gEventMsgHandle.pid = ptrace(PTRACE_PEEKUSR, handle->tid, (void *)(4*4) /* a0 */, NULL);
+        gEventMsgHandle.tid = gEventMsgHandle.pid;
+        return 0x42;
+    }
 #endif
     return 0;
 }