Merge "Remove expired dns cache entries before removing oldest"
diff --git a/Android.mk b/Android.mk
index 43d5499..7c39751 100644
--- a/Android.mk
+++ b/Android.mk
@@ -16,9 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-ifneq ($(TARGET_SIMULATOR),true)
-  include $(call all-subdir-makefiles)
-else
-  # The host dalvikvm needs Android's concatenated & indexed timezone data.
-  include $(LOCAL_PATH)/libc/zoneinfo/Android.mk
-endif
+include $(call all-subdir-makefiles)
diff --git a/libc/Android.mk b/libc/Android.mk
index 2e7cd5a..2628507 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -269,6 +269,7 @@
 	bionic/libc_init_common.c \
 	bionic/logd_write.c \
 	bionic/md5.c \
+	bionic/memmove_words.c \
 	bionic/pututline.c \
 	bionic/realpath.c \
 	bionic/sched_getaffinity.c \
@@ -426,43 +427,6 @@
 libc_arch_dynamic_src_files :=
 else # !x86
 
-ifeq ($(TARGET_ARCH),sh)
-libc_common_src_files += \
-	arch-sh/bionic/__get_pc.S \
-	arch-sh/bionic/__get_sp.S \
-	arch-sh/bionic/_exit_with_stack_teardown.S \
-	arch-sh/bionic/_setjmp.S \
-	arch-sh/bionic/atomics_sh.c \
-	arch-sh/bionic/atomic_cmpxchg.S \
-	arch-sh/bionic/clone.S \
-	arch-sh/bionic/pipe.S \
-	arch-sh/bionic/memcpy.S \
-	arch-sh/bionic/memset.S \
-	arch-sh/bionic/bzero.S \
-	arch-sh/bionic/setjmp.S \
-	arch-sh/bionic/sigsetjmp.S \
-	arch-sh/bionic/syscall.S \
-	arch-sh/bionic/memmove.S \
-	arch-sh/bionic/__set_tls.c \
-	arch-sh/bionic/__get_tls.c \
-	arch-sh/bionic/ffs.S \
-	string/bcopy.c \
-	string/strcmp.c \
-	string/strncmp.c \
-	string/memcmp.c \
-	string/strlen.c \
-	string/strcpy.c \
-	bionic/pthread-atfork.c \
-	bionic/pthread-rwlocks.c \
-	bionic/pthread-timers.c \
-	bionic/ptrace.c \
-	unistd/socketcalls.c
-
-libc_static_common_src_files += \
-        bionic/pthread.c \
-
-endif # sh
-
 endif # !x86
 endif # !arm
 
@@ -479,7 +443,8 @@
 		-DINET6 \
 		-I$(LOCAL_PATH)/private \
 		-DUSE_DL_PREFIX \
-		-DPOSIX_MISTAKE
+		-DPOSIX_MISTAKE \
+                -DLOG_ON_HEAP_ERROR \
 
 # these macro definitions are required to implement the
 # 'timezone' and 'daylight' global variables, as well as
@@ -506,8 +471,19 @@
   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
 else # !arm
-  libc_crt_target_cflags :=
+  ifeq ($(TARGET_ARCH),x86)
+    libc_crt_target_cflags :=
+    # TARGET_GLOBAL_CFLAGS from build/core/combo/TARGET_linux-x86.mk sets all required flags.
+  endif # x86
 endif # !arm
 
 # Define ANDROID_SMP appropriately.
@@ -522,6 +498,10 @@
 #
 libc_crt_target_cflags += -I$(LOCAL_PATH)/private
 
+ifeq ($(TARGET_ARCH),arm)
+libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
+endif
+
 # Define some common includes
 # ========================================================
 libc_common_c_includes := \
@@ -550,18 +530,24 @@
 # that will call __cxa_finalize(&__dso_handle) in order to ensure that
 # static C++ destructors are properly called on dlclose().
 #
+
+libc_crt_target_so_cflags := $(libc_crt_target_cflags)
+ifeq ($(TARGET_ARCH),x86)
+    # This flag must be added for x86 targets, but not for ARM
+    libc_crt_target_so_cflags += -fPIC
+endif
 GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
 $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
 	@mkdir -p $(dir $@)
-	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
+	$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
 ALL_GENERATED_SOURCES += $(GEN)
 
 GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
 $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
 	@mkdir -p $(dir $@)
-	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
+	$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
 ALL_GENERATED_SOURCES += $(GEN)
-endif # TARGET_ARCH == x86
+endif # TARGET_ARCH == x86 || TARGET_ARCH == arm
 
 
 GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
@@ -597,6 +583,9 @@
 
 LOCAL_SRC_FILES := $(libc_common_src_files)
 LOCAL_CFLAGS := $(libc_common_cflags)
+ifeq ($(TARGET_ARCH),arm)
+LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
+endif
 LOCAL_C_INCLUDES := $(libc_common_c_includes)
 LOCAL_MODULE := libc_common
 LOCAL_SYSTEM_SHARED_LIBRARIES :=
@@ -714,8 +703,7 @@
 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
 LOCAL_SYSTEM_SHARED_LIBRARIES :=
 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
-# Don't prelink
-LOCAL_PRELINK_MODULE := false
+
 # Don't install on release build
 LOCAL_MODULE_TAGS := eng debug
 
@@ -741,8 +729,7 @@
 LOCAL_SHARED_LIBRARIES := libc
 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
 LOCAL_SYSTEM_SHARED_LIBRARIES :=
-# Don't prelink
-LOCAL_PRELINK_MODULE := false
+
 # Don't install on release build
 LOCAL_MODULE_TAGS := eng debug
 
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 5653c3c..765d2fa 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -4,7 +4,7 @@
 #
 # each non comment line has the following format:
 #
-# return_type    func_name[:syscall_name[:call_id]]([parameter_list])  (#syscall_number|stub)
+# return_type    func_name[:syscall_name[:call_id]]([parameter_list])  (syscall_number|"stub")
 #
 # note that:
 #      - syscall_name correspond to the name of the syscall, which may differ from
@@ -22,15 +22,15 @@
 #        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, x86 and SuperH, use:
-#        return_type funcname[:syscall_name](parameters) arm_number,x86_number,superh_number
+#      - additionally, if the syscall number is different amoung ARM, and x86, use:
+#        return_type funcname[:syscall_name](parameters) arm_number,x86_number
 #
 # the file is processed by a python script named gensyscalls.py
 #
 
 # process management
 void    _exit:exit_group (int)      248,252
-void    _exit_thread:exit (int)	    1
+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
@@ -47,12 +47,13 @@
 gid_t   getgid:getgid32 ()         200
 uid_t   geteuid:geteuid32 ()       201
 gid_t   getegid:getegid32 ()       202
-uid_t   getresuid:getresuid32 ()   209
-gid_t   getresgid:getresgid32 ()   211
+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
 pid_t   getpgid(pid_t)             132
-pid_t   getppid()		   64
+pid_t   getppid()                  64
 pid_t   setsid()                   66
 int     setgid:setgid32(gid_t)     214
 int     seteuid:seteuid32(uid_t)   stub
@@ -76,6 +77,8 @@
 pid_t   vfork(void)  190,-1,190
 int     setregid:setregid32(gid_t, gid_t)  204
 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
@@ -111,7 +114,7 @@
 int         flock(int, int)   143
 int         fchmod(int, mode_t)  94
 int         dup(int)  41
-int         pipe(int *)  42,42,-1
+int         pipe(int *)  42,42
 int         pipe2(int *, int) 359,331
 int         dup2(int, int)   63
 int         select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *)  142
@@ -130,6 +133,10 @@
 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
 
 # file system
 int     link (const char*, const char*)  9
@@ -155,7 +162,16 @@
 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
+
 # time
 int           pause ()                       29
 int           gettimeofday(struct timeval*, struct timezone*)       78
@@ -165,7 +181,7 @@
 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(const struct timespec *req, struct timespec *rem)  265,267
+int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem)  265,267
 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
@@ -174,6 +190,7 @@
 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
 
 # signals
 int     sigaction(int, const struct sigaction *, struct sigaction *)  67
@@ -202,24 +219,21 @@
 int           recvmsg(int, struct msghdr *, unsigned int)   297,-1
 
 # sockets for x86. These are done as an "indexed" call to socketcall syscall.
-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,-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
-
-# sockets for sh.
-int           __socketcall:__socketcall(int, unsigned long*) -1,-1,102
+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           shutdown:socketcall:13(int, int)  -1,102
+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
 
 # scheduler & real-time
 int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)  156
@@ -232,11 +246,11 @@
 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,318
+int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318
 
 # io priorities
-int ioprio_set(int which, int who, int ioprio) 314,289,288
-int ioprio_get(int which, int who) 315,290,289
+int ioprio_set(int which, int who, int ioprio) 314,289
+int ioprio_get(int which, int who) 315,290
 
 # other
 int     uname(struct utsname *)  122
@@ -248,6 +262,7 @@
 int     delete_module(const char*, unsigned int)   129
 int     klogctl:syslog(int, char *, int)   103
 int     sysinfo(struct sysinfo *)  116
+int     personality(unsigned long)  136
 
 # futex
 int	futex(void *, int, int, void *, void *, int) 240
@@ -258,8 +273,8 @@
 int     epoll_wait(int epfd, struct epoll_event *events, int max, int timeout)   252,256
 
 int     inotify_init(void)      316,291,290
-int     inotify_add_watch(int, const char *, unsigned int)  317,292,291
-int     inotify_rm_watch(int, unsigned int)  318,293,292
+int     inotify_add_watch(int, const char *, unsigned int)  317,292
+int     inotify_rm_watch(int, unsigned int)  318,293
 
 int     poll(struct pollfd *, unsigned int, long)  168
 
diff --git a/libc/arch-arm/bionic/_exit_with_stack_teardown.S b/libc/arch-arm/bionic/_exit_with_stack_teardown.S
index 89f6c90..c2d7758 100644
--- a/libc/arch-arm/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-arm/bionic/_exit_with_stack_teardown.S
@@ -26,15 +26,10 @@
  * SUCH DAMAGE.
  */
 #include <asm/unistd.h>
-
-.text
-.type _exit_with_stack_teardown, #function
-.globl _exit_with_stack_teardown
-.align 4
+#include <machine/asm.h>
 
 @ void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode)
-
-_exit_with_stack_teardown:
+ENTRY(_exit_with_stack_teardown)
 
 #if __ARM_EABI__
     mov     lr, r2
@@ -53,3 +48,4 @@
     @ exit() should never return, cause a crash if it does
     mov		r0, #0
     ldr		r0, [r0]
+END(_exit_with_stack_teardown)
diff --git a/libc/arch-arm/bionic/_setjmp.S b/libc/arch-arm/bionic/_setjmp.S
index 5626219..6b8aa50 100644
--- a/libc/arch-arm/bionic/_setjmp.S
+++ b/libc/arch-arm/bionic/_setjmp.S
@@ -70,6 +70,7 @@
 
         mov	r0, #0x00000000
         bx      lr
+END(_setjmp)
 
 .L_setjmp_magic:
 	.word	_JB_MAGIC__SETJMP
@@ -109,3 +110,4 @@
 	bl	PIC_SYM(_C_LABEL(longjmperror), PLT)
 	bl	PIC_SYM(_C_LABEL(abort), PLT)
 	b	. - 8		/* Cannot get here */
+END(_longjmp)
diff --git a/libc/arch-sh/bionic/__get_sp.S b/libc/arch-arm/bionic/atexit.S
similarity index 69%
copy from libc/arch-sh/bionic/__get_sp.S
copy to libc/arch-arm/bionic/atexit.S
index 0e34a01..beea685 100644
--- a/libc/arch-sh/bionic/__get_sp.S
+++ b/libc/arch-arm/bionic/atexit.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2011 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,38 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-.text
-.type   __get_sp, @function
-.globl  __get_sp
-.align  4
 
-__get_sp:
-    rts
-    mov     r15, r0
-
+#ifndef CRT_LEGACY_WORKAROUND
+	.arch armv5te
+	.fpu softvfp
+	.eabi_attribute 20, 1
+	.eabi_attribute 21, 1
+	.eabi_attribute 23, 3
+	.eabi_attribute 24, 1
+	.eabi_attribute 25, 1
+	.eabi_attribute 26, 2
+	.eabi_attribute 30, 4
+	.eabi_attribute 18, 4
+	.hidden	atexit
+	.code	16
+	.thumb_func
+ENTRY(atexit)
+.LFB0:
+	.save	{r4, lr}
+	push	{r4, lr}
+.LCFI0:
+	ldr	r3, .L3
+	mov	r1, #0
+	@ sp needed for prologue
+.LPIC0:
+	add	r3, pc
+	ldr	r2, [r3]
+	bl	__cxa_atexit
+	pop	{r4, pc}
+.L4:
+	.align	2
+.L3:
+	.word	__dso_handle-(.LPIC0+4)
+.LFE0:
+END(atexit)
+#endif
diff --git a/libc/arch-arm/bionic/atomics_arm.S b/libc/arch-arm/bionic/atomics_arm.S
index d94f6b1..4d9cbcf 100644
--- a/libc/arch-arm/bionic/atomics_arm.S
+++ b/libc/arch-arm/bionic/atomics_arm.S
@@ -26,17 +26,9 @@
  * SUCH DAMAGE.
  */
 #include <sys/linux-syscalls.h>
+#include <machine/asm.h>
 #include <machine/cpu-features.h>
 
-.global __atomic_cmpxchg
-.type __atomic_cmpxchg, %function
-.global __atomic_swap
-.type __atomic_swap, %function
-.global __atomic_dec
-.type __atomic_dec, %function
-.global __atomic_inc
-.type __atomic_inc, %function
-
 #define FUTEX_WAIT 0
 #define FUTEX_WAKE 1
 
@@ -48,8 +40,7 @@
  */
 
 /* r0(addr) -> r0(old) */
-__atomic_dec:
-    .fnstart
+ENTRY(__atomic_dec)
     mov     r1, r0                      @ copy addr so we don't clobber it
 1:  ldrex   r0, [r1]                    @ load current value into r0
     sub     r2, r0, #1                  @ generate new value into r2
@@ -57,11 +48,10 @@
     cmp     r3, #0                      @ success?
     bxeq    lr                          @ yes, return
     b       1b                          @ no, retry
-    .fnend
+END(__atomic_dec)
 
 /* r0(addr) -> r0(old) */
-__atomic_inc:
-    .fnstart
+ENTRY(__atomic_inc)
     mov     r1, r0
 1:  ldrex   r0, [r1]
     add     r2, r0, #1
@@ -69,11 +59,10 @@
     cmp     r3, #0
     bxeq    lr
     b       1b
-    .fnend
+END(__atomic_inc)
 
 /* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
-__atomic_cmpxchg:
-    .fnstart
+ENTRY(__atomic_cmpxchg)
 1:  mov     ip, #2                      @ ip=2 means "new != old"
     ldrex   r3, [r2]                    @ load current value into r3
     teq     r0, r3                      @ new == old?
@@ -82,18 +71,17 @@
     beq     1b                          @ yes, retry
     mov     r0, ip                      @ return 0 on success, 2 on failure
     bx      lr
-    .fnend
+END(__atomic_cmpxchg)
 
 /* r0(new) r1(addr) -> r0(old) */
-__atomic_swap:
-    .fnstart
+ENTRY(__atomic_swap)
 1:  ldrex   r2, [r1]
     strex   r3, r0, [r1]
     teq     r3, #0
     bne     1b
     mov     r0, r2
     bx      lr
-    .fnend
+END(__atomic_swap)
 
 #else /*not defined __ARM_HAVE_LDREX_STREX*/
 /*
@@ -107,8 +95,7 @@
     .equ    kernel_atomic_base, 0xFFFF0FFF
 
 /* r0(addr) -> r0(old) */
-__atomic_dec:
-    .fnstart
+ENTRY(__atomic_dec)
     .save {r4, lr}
     stmdb   sp!, {r4, lr}
     mov     r2, r0
@@ -122,11 +109,10 @@
     add     r0, r1, #1
     ldmia   sp!, {r4, lr}
     bx      lr
-    .fnend
+END(__atomic_dec)
 
 /* r0(addr) -> r0(old) */
-__atomic_inc:
-    .fnstart
+ENTRY(__atomic_inc)
     .save {r4, lr}
     stmdb   sp!, {r4, lr}
     mov     r2, r0
@@ -140,11 +126,10 @@
     sub     r0, r1, #1
     ldmia   sp!, {r4, lr}
     bx      lr
-    .fnend
+END(__atomic_inc)
 
 /* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
-__atomic_cmpxchg:
-    .fnstart
+ENTRY(__atomic_cmpxchg)
     .save {r4, lr}
     stmdb   sp!, {r4, lr}
     mov     r4, r0          /* r4 = save oldvalue */
@@ -160,14 +145,13 @@
 2: @ atomic_cmpxchg
     ldmia   sp!, {r4, lr}
     bx      lr
-    .fnend
+END(__atomic_cmpxchg)
 
 /* r0(new) r1(addr) -> r0(old) */
-__atomic_swap:
-    .fnstart
+ENTRY(__atomic_swap)
     swp     r0, r0, [r1]
     bx      lr
-    .fnend
+END(__atomic_swap)
 
 #endif /*not defined __ARM_HAVE_LDREX_STREX*/
 
@@ -191,18 +175,16 @@
 
 #if __ARM_EABI__
 
-__futex_syscall3:
-    .fnstart
+ENTRY(__futex_syscall3)
     stmdb   sp!, {r4, r7}
     .save   {r4, r7}
     ldr     r7, =__NR_futex
     swi     #0
     ldmia   sp!, {r4, r7}
     bx      lr
-    .fnend
+END(__futex_syscall3)
 
-__futex_wait:
-    .fnstart
+ENTRY(__futex_wait)
     stmdb   sp!, {r4, r7}
     .save   {r4, r7}
     mov     r3, r2
@@ -212,10 +194,9 @@
     swi     #0
     ldmia   sp!, {r4, r7}
     bx      lr
-    .fnend
+END(__futex_wait)
 
-__futex_wake:
-    .fnstart
+ENTRY(__futex_wake)
     .save   {r4, r7}
     stmdb   sp!, {r4, r7}
     mov     r2, r1
@@ -224,28 +205,32 @@
     swi     #0
     ldmia   sp!, {r4, r7}
     bx      lr
-    .fnend
+END(__futex_wake)
 
 #else
 
-__futex_syscall3:
+ENTRY(__futex_syscall3)
     swi     #__NR_futex
     bx      lr
+END(__futex_syscall3)
 
-__futex_wait:
+ENTRY(__futex_wait)
     mov     r3, r2
     mov     r2, r1
     mov     r1, #FUTEX_WAIT
     swi     #__NR_futex
     bx      lr
+END(__futex_wait)
 
-__futex_wake:
+ENTRY(__futex_wake)
     mov     r2, r1
     mov     r1, #FUTEX_WAKE
     swi     #__NR_futex
     bx      lr
+END(__futex_wake)
 
 #endif
 
-__futex_syscall4:
+ENTRY(__futex_syscall4)
     b __futex_syscall3
+END(__futex_syscall4)
diff --git a/libc/arch-arm/bionic/clone.S b/libc/arch-arm/bionic/clone.S
index 9c25053..a95d2d6 100644
--- a/libc/arch-arm/bionic/clone.S
+++ b/libc/arch-arm/bionic/clone.S
@@ -26,14 +26,9 @@
  * SUCH DAMAGE.
  */
 #include <sys/linux-syscalls.h>
+#include <machine/asm.h>
 
-    .text
-    .type __pthread_clone, #function
-    .global __pthread_clone
-    .align 4
-    .fnstart
-
-__pthread_clone:
+ENTRY(__pthread_clone)
     @ insert the args onto the new stack
     str     r0, [r1, #-4]
     str     r3, [r1, #-8]
@@ -73,7 +68,7 @@
 __error:
     mov     r0, #-1
     bx      lr
-    .fnend
+END(__pthread_clone)
 
 
     #
@@ -88,12 +83,8 @@
     #       at the end of the parameter list makes the
     #       implementation much simpler.
     #
-    .type __bionic_clone, #function
-    .globl __bionic_clone
-    .align 4
-    .fnstart
 
-__bionic_clone:
+ENTRY(__bionic_clone)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
 
@@ -124,5 +115,4 @@
     ldr    r0, [sp, #-4]
     ldr    r1, [sp, #-8]
     b      __bionic_clone_entry
-
-    .fnend
+END(__bionic_clone)
diff --git a/libc/arch-arm/bionic/crtbegin_dynamic.S b/libc/arch-arm/bionic/crtbegin_dynamic.S
index d18e715..0999084 100644
--- a/libc/arch-arm/bionic/crtbegin_dynamic.S
+++ b/libc/arch-arm/bionic/crtbegin_dynamic.S
@@ -85,3 +85,4 @@
 	.long -1
 
 #include "__dso_handle.S"
+#include "atexit.S"
diff --git a/libc/arch-arm/bionic/crtbegin_so.S b/libc/arch-arm/bionic/crtbegin_so.S
index bb6b3e2..9275b1e 100644
--- a/libc/arch-arm/bionic/crtbegin_so.S
+++ b/libc/arch-arm/bionic/crtbegin_so.S
@@ -52,4 +52,10 @@
         .long -1
         .long __on_dlclose
 
+#ifdef CRT_LEGACY_WORKAROUND
 #include "__dso_handle.S"
+#else
+#include "__dso_handle_so.S"
+#endif
+
+#include "atexit.S"
diff --git a/libc/arch-arm/bionic/crtbegin_static.S b/libc/arch-arm/bionic/crtbegin_static.S
index 6f9cf25..13b05b2 100644
--- a/libc/arch-arm/bionic/crtbegin_static.S
+++ b/libc/arch-arm/bionic/crtbegin_static.S
@@ -86,3 +86,4 @@
 
 
 #include "__dso_handle.S"
+#include "atexit.S"
diff --git a/libc/arch-arm/bionic/ffs.S b/libc/arch-arm/bionic/ffs.S
index f11141c..c59091f 100644
--- a/libc/arch-arm/bionic/ffs.S
+++ b/libc/arch-arm/bionic/ffs.S
@@ -29,6 +29,7 @@
  */
 
 #include <machine/asm.h>
+#include <machine/cpu-features.h>
 
 /*
  * ffs - find first set bit, this algorithm isolates the first set
@@ -36,8 +37,8 @@
  * 6 bits as an index into the table.  This algorithm should be a win
  * over the checking each bit in turn as per the C compiled version.
  *
- * under ARMv5 there's an instruction called CLZ (count leading Zero's) that
- * could be used
+ * Some newer ARM architectures have an instruction named
+ * CLZ (count leading Zero's) that is used
  *
  * This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on
  * 16 Feb 1994.
@@ -47,7 +48,7 @@
 	/* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
  	rsb     r1, r0, #0
  	ands    r0, r0, r1
-#ifndef __ARM_ARCH_5__
+#ifndef __ARM_HAVE_CLZ
 	/*
 	 * now r0 has at most one set bit, call this X
 	 * if X = 0, all further instructions are skipped
@@ -61,6 +62,7 @@
 	ldrneb  r0, [ r2, r0, lsr #26 ]
 
 	bx		lr
+END(ffs)
 
 .text;
 .type .L_ffs_table, _ASM_TYPE_OBJECT;
@@ -74,9 +76,10 @@
 	.byte	10,  0,  0, 25,  0,  0, 21, 27  /* 40-47 */
 	.byte	31,  0,  0,  0,  0, 24,  0, 20  /* 48-55 */
 	.byte   30,  0, 23, 19, 29, 18, 17,  0  /* 56-63 */
-#else
+#else /* !defined(__ARM_HAVE_CLZ) */
 	clzne	r0, r0
 	rsbne	r0, r0, #32
 	bx		lr
-#endif
+END(ffs)
+#endif /* !defined(__ARM_HAVE_CLZ) */
 
diff --git a/libc/arch-arm/bionic/kill.S b/libc/arch-arm/bionic/kill.S
index 2954091..33dfc2b 100644
--- a/libc/arch-arm/bionic/kill.S
+++ b/libc/arch-arm/bionic/kill.S
@@ -33,17 +33,13 @@
    of a corrupted malloc heap).
 */
 #include <sys/linux-syscalls.h>
+#include <machine/asm.h>
 
 #ifndef __NR_kill
 #define __NR_kill   37
 #endif
 
-    .text
-    .type kill, #function
-    .globl kill
-    .align 4
-
-kill:
+ENTRY(kill)
     stmfd   sp!, {r4-r7, ip, lr}
     ldr     r7, =__NR_kill
     swi     #0
@@ -51,3 +47,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
+END(kill)
diff --git a/libc/arch-arm/bionic/libgcc_compat.c b/libc/arch-arm/bionic/libgcc_compat.c
index 886d025..d184566 100644
--- a/libc/arch-arm/bionic/libgcc_compat.c
+++ b/libc/arch-arm/bionic/libgcc_compat.c
@@ -30,7 +30,7 @@
  * dynamic linker to copy their definition into the final libc.so binary.
  *
  * They are required to ensure backwards binary compatibility with
- * Android 1.5 and Android 1.6 system images. Some applications built
+ * Android 1.5, 1.6 and even 3.0  system images. Some applications built
  * using the NDK require them to be here.
  *
  * Now, for a more elaborate description of the issue:
@@ -68,6 +68,11 @@
  * applications that were generated with a previous version of the NDK
  * still need all 1.5/1.6 helper functions in libc.so and libn.so
  *
+ * After 3.2, the toolchain was updated again, adding __aeabi_f2uiz to the
+ * list of requirements. Technically, this is due to mis-linked NDK libraries
+ * but it is easier to add a single function here than asking several app
+ * developers to fix their build.
+ *
  * Final note: some of the functions below should really be in libm.so to
  *             completely reflect the state of 1.5/1.6 system images. However,
  *             since libm.so depends on libc.so, it's easier to put all of
@@ -96,6 +101,7 @@
     XX(__aeabi_dsub)         \
     XX(__aeabi_f2d)          \
     XX(__aeabi_f2iz)         \
+    XX(__aeabi_f2uiz)        \
     XX(__aeabi_fadd)         \
     XX(__aeabi_fcmpun)       \
     XX(__aeabi_fdiv)         \
diff --git a/libc/arch-arm/bionic/memcmp.S b/libc/arch-arm/bionic/memcmp.S
index 67dcddc..c872a51 100644
--- a/libc/arch-arm/bionic/memcmp.S
+++ b/libc/arch-arm/bionic/memcmp.S
@@ -27,12 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-
-    .text
-
-    .global memcmp
-    .type memcmp, %function
-    .align 4
+#include <machine/asm.h>
 
 /*
  * Optimized memcmp() for ARM9.
@@ -43,8 +38,7 @@
  * (2) The loads are scheduled in a way they won't stall
  */
 
-memcmp:
-        .fnstart
+ENTRY(memcmp)
         PLD         (r0, #0)
         PLD         (r1, #0)
 
@@ -176,7 +170,7 @@
 9:      /* restore registers and return */
         ldmfd       sp!, {r4, lr}
         bx          lr
-        .fnend
+END(memcmp)
 
 
 
diff --git a/libc/arch-arm/bionic/memcmp16.S b/libc/arch-arm/bionic/memcmp16.S
index f398588..99c9b88 100644
--- a/libc/arch-arm/bionic/memcmp16.S
+++ b/libc/arch-arm/bionic/memcmp16.S
@@ -27,12 +27,7 @@
  */
 
 #include <machine/cpu-features.h>
-
-    .text
-
-    .global __memcmp16
-    .type __memcmp16, %function
-    .align 4
+#include <machine/asm.h>
 
 /*
  * Optimized memcmp16() for ARM9.
@@ -43,8 +38,7 @@
  * (2) The loads are scheduled in a way they won't stall
  */
 
-__memcmp16:
-        .fnstart
+ENTRY(__memcmp16)
         PLD         (r0, #0)
         PLD         (r1, #0)
 
@@ -95,8 +89,6 @@
         /* restore registers and return */
         ldmnefd     sp!, {r4, lr}
         bxne        lr
-        .fnend
-
 
 
 0:      /* here the first pointer is aligned, and we have at least 3 words
@@ -237,3 +229,4 @@
 7:      /* fix up the 2 pointers and fallthrough... */
         sub         r1, r1, #2
         b           2b
+END(__memcmp16)
diff --git a/libc/arch-arm/bionic/memcpy.S b/libc/arch-arm/bionic/memcpy.S
index ba55996..815b5f6 100644
--- a/libc/arch-arm/bionic/memcpy.S
+++ b/libc/arch-arm/bionic/memcpy.S
@@ -27,34 +27,35 @@
  */
 
 #include <machine/cpu-features.h>
+#include <machine/asm.h>
 
 #if defined(__ARM_NEON__)
 
         .text
         .fpu    neon
 
-        .global memcpy
-        .type memcpy, %function
-        .align 4
-
+#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
 
-memcpy:
-        .fnstart
+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
@@ -83,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
@@ -116,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
@@ -143,18 +164,12 @@
 
         ldmfd       sp!, {r0, lr}
         bx          lr
-        .fnend
+END(memcpy)
 
 
 #else   /* __ARM_ARCH__ < 7 */
 
 
-	.text
-
-    .global memcpy
-    .type memcpy, %function
-    .align 4
-
 		/*
 		 * Optimized memcpy() for ARM.
          *
@@ -162,12 +177,11 @@
 		 * so we have to preserve R0.
 		 */
 
-memcpy:
+ENTRY(memcpy)
 		/* The stack must always be 64-bits aligned to be compliant with the
 		 * ARM ABI. Since we have to save R0, we might as well save R4
 		 * which we can use for better pipelining of the reads below
 		 */
-        .fnstart
         .save       {r0, r4, lr}
         stmfd       sp!, {r0, r4, lr}
         /* Making room for r5-r11 which will be spilled later */
@@ -504,7 +518,7 @@
         add         sp,  sp, #28
 		ldmfd		sp!, {r0, r4, lr}
 		bx			lr
-        .fnend
+END(memcpy)
 
 
 #endif    /* __ARM_ARCH__ < 7 */
diff --git a/libc/arch-arm/bionic/memset.S b/libc/arch-arm/bionic/memset.S
index 93abe15..273b9e3 100644
--- a/libc/arch-arm/bionic/memset.S
+++ b/libc/arch-arm/bionic/memset.S
@@ -25,15 +25,8 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-	.text
 
-    .global memset
-    .type memset, %function
-
-    .global bzero
-    .type bzero, %function
-
-    .align
+#include <machine/asm.h>
 	
 		/*
 		 * Optimized memset() for ARM.
@@ -41,15 +34,15 @@
          * memset() returns its first argument.
 		 */
 	
-bzero:
+ENTRY(bzero)
         mov     r2, r1
         mov     r1, #0
+END(bzero)
 
-memset:	
+ENTRY(memset)
 		/* compute the offset to align the destination
 		 * offset = (4-(src&3))&3 = -src & 3
 		 */
-        .fnstart
         .save       {r0, r4-r7, lr}
 		stmfd		sp!, {r0, r4-r7, lr}
 		rsb			r3, r0, #0
@@ -113,5 +106,4 @@
 		strcsb		r1, [r0]
         ldmfd		sp!, {r0, r4-r7, lr}
         bx          lr
-        .fnend
-    
+END(memset)
diff --git a/libc/arch-arm/bionic/setjmp.S b/libc/arch-arm/bionic/setjmp.S
index 59aff66..996e55e 100644
--- a/libc/arch-arm/bionic/setjmp.S
+++ b/libc/arch-arm/bionic/setjmp.S
@@ -79,6 +79,7 @@
 
 	mov	r0, #0x00000000
 	bx      lr
+END(setjmp)
 
 .Lsetjmp_magic:
 	.word	_JB_MAGIC_SETJMP
@@ -138,3 +139,4 @@
 	bl	PIC_SYM(_C_LABEL(longjmperror), PLT)
 	bl	PIC_SYM(_C_LABEL(abort), PLT)
 	b	. - 8		/* Cannot get here */
+END(longjmp)
diff --git a/libc/arch-arm/bionic/sigsetjmp.S b/libc/arch-arm/bionic/sigsetjmp.S
index 50e6429..12311e5 100644
--- a/libc/arch-arm/bionic/sigsetjmp.S
+++ b/libc/arch-arm/bionic/sigsetjmp.S
@@ -33,6 +33,8 @@
  * SUCH DAMAGE.
  */
 
+#define _ALIGN_TEXT .align 0
+
 #include <machine/asm.h>
 #include <machine/setjmp.h>
 
@@ -50,6 +52,7 @@
 	teq	r1, #0
 	beq	PIC_SYM(_C_LABEL(_setjmp), PLT)
 	b	PIC_SYM(_C_LABEL(setjmp), PLT)
+END(sigsetjmp)
 
 .L_setjmp_magic:
 	.word	_JB_MAGIC__SETJMP
@@ -60,3 +63,4 @@
 	teq	r2, r3
 	beq	PIC_SYM(_C_LABEL(_longjmp), PLT)
 	b	PIC_SYM(_C_LABEL(longjmp), PLT)
+END(siglongjmp)
diff --git a/libc/arch-arm/bionic/strcmp.S b/libc/arch-arm/bionic/strcmp.S
index 9fdbd56..764a531 100644
--- a/libc/arch-arm/bionic/strcmp.S
+++ b/libc/arch-arm/bionic/strcmp.S
@@ -28,13 +28,10 @@
  */
 
 #include <machine/cpu-features.h>
+#include <machine/asm.h>
 
 	.text
 
-	.global strcmp
-	.type strcmp, %function
-	.align 4
-
 #ifdef __ARMEB__
 #define SHFT2LSB lsl
 #define SHFT2LSBEQ lsleq
@@ -54,8 +51,7 @@
 #define magic1(REG) REG
 #define magic2(REG) REG, lsl #7
 
-strcmp:
-	.fnstart
+ENTRY(strcmp)
 	PLD(r0, #0)
 	PLD(r1, #0)
 	eor	r2, r0, r1
@@ -136,7 +132,6 @@
 #endif
 	ldr	r4, [sp], #4
 	bx	lr
-	.fnend
 
 .Lstrcmp_unaligned:
 	wp1 .req r0
@@ -319,3 +314,4 @@
 	ldr	r4, [sp], #4
 	ldr	r5, [sp], #4
 	bx	lr
+END(strcmp)
diff --git a/libc/arch-arm/bionic/strcpy.S b/libc/arch-arm/bionic/strcpy.S
index 70c353f..21dafda 100644
--- a/libc/arch-arm/bionic/strcpy.S
+++ b/libc/arch-arm/bionic/strcpy.S
@@ -30,15 +30,9 @@
  */
 
 #include <machine/cpu-features.h>
+#include <machine/asm.h>
 
-	.text
-
-	.global strcpy
-	.type strcpy, %function
-	.align 4
-
-strcpy:
-	.fnstart
+ENTRY(strcpy)
 	PLD(r1, #0)
 	eor	r2, r0, r1
 	mov	ip, r0
@@ -136,3 +130,4 @@
 	cmp	r2, #0
 	bne	4b
 	bx	lr
+END(strcpy)
diff --git a/libc/arch-arm/bionic/tkill.S b/libc/arch-arm/bionic/tkill.S
index 7b3301a..fdc5ed4 100644
--- a/libc/arch-arm/bionic/tkill.S
+++ b/libc/arch-arm/bionic/tkill.S
@@ -32,18 +32,15 @@
    abort due to a fatal runtime error (e.g. detection
    of a corrupted malloc heap).
 */
+
 #include <sys/linux-syscalls.h>
+#include <machine/asm.h>
 
 #ifndef __NR_tkill
 #define __NR_tkill  238
 #endif
 
-    .text
-    .type tkill, #function
-    .globl tkill
-    .align 4
-
-tkill:
+ENTRY(tkill)
     stmfd   sp!, {r4-r7, ip, lr}
     ldr     r7, =__NR_tkill
     swi     #0
@@ -51,3 +48,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
+END(tkill)
diff --git a/libc/arch-arm/include/machine/asm.h b/libc/arch-arm/include/machine/asm.h
index c7bd017..047e54d 100644
--- a/libc/arch-arm/include/machine/asm.h
+++ b/libc/arch-arm/include/machine/asm.h
@@ -70,7 +70,13 @@
 #define _ASM_TYPE_FUNCTION	#function
 #define _ASM_TYPE_OBJECT	#object
 #define _ENTRY(x) \
-	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
+	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart
+
+#define _ASM_SIZE(x)	.size x, .-x;
+
+#define _END(x) \
+	.fnend; \
+	_ASM_SIZE(x)
 
 #ifdef GPROF
 # ifdef __ELF__
@@ -86,8 +92,16 @@
 
 #define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
 #define	ENTRY_NP(y)	_ENTRY(_C_LABEL(y))
+#define	END(y)		_END(_C_LABEL(y))
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define	ASENTRY_NP(y)	_ENTRY(_ASM_LABEL(y))
+#define	ASEND(y)	_END(_ASM_LABEL(y))
+
+#ifdef __ELF__
+#define ENTRY_PRIVATE(y)  ENTRY(y); .hidden _C_LABEL(y)
+#else
+#define ENTRY_PRIVATE(y)  ENTRY(y)
+#endif
 
 #define	ASMSTR		.asciz
 
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index 5210d6c..b19fb68 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -14,6 +14,7 @@
 syscall_src += arch-arm/syscalls/getresuid.S
 syscall_src += arch-arm/syscalls/getresgid.S
 syscall_src += arch-arm/syscalls/gettid.S
+syscall_src += arch-arm/syscalls/readahead.S
 syscall_src += arch-arm/syscalls/getgroups.S
 syscall_src += arch-arm/syscalls/getpgid.S
 syscall_src += arch-arm/syscalls/getppid.S
@@ -84,6 +85,10 @@
 syscall_src += arch-arm/syscalls/fchownat.S
 syscall_src += arch-arm/syscalls/fchmodat.S
 syscall_src += arch-arm/syscalls/renameat.S
+syscall_src += arch-arm/syscalls/fsetxattr.S
+syscall_src += arch-arm/syscalls/fgetxattr.S
+syscall_src += arch-arm/syscalls/flistxattr.S
+syscall_src += arch-arm/syscalls/fremovexattr.S
 syscall_src += arch-arm/syscalls/link.S
 syscall_src += arch-arm/syscalls/unlink.S
 syscall_src += arch-arm/syscalls/unlinkat.S
@@ -106,6 +111,14 @@
 syscall_src += arch-arm/syscalls/symlink.S
 syscall_src += arch-arm/syscalls/fchdir.S
 syscall_src += arch-arm/syscalls/truncate.S
+syscall_src += arch-arm/syscalls/setxattr.S
+syscall_src += arch-arm/syscalls/lsetxattr.S
+syscall_src += arch-arm/syscalls/getxattr.S
+syscall_src += arch-arm/syscalls/lgetxattr.S
+syscall_src += arch-arm/syscalls/listxattr.S
+syscall_src += arch-arm/syscalls/llistxattr.S
+syscall_src += arch-arm/syscalls/removexattr.S
+syscall_src += arch-arm/syscalls/lremovexattr.S
 syscall_src += arch-arm/syscalls/__statfs64.S
 syscall_src += arch-arm/syscalls/pause.S
 syscall_src += arch-arm/syscalls/gettimeofday.S
@@ -124,6 +137,7 @@
 syscall_src += arch-arm/syscalls/__timer_getoverrun.S
 syscall_src += arch-arm/syscalls/__timer_delete.S
 syscall_src += arch-arm/syscalls/utimes.S
+syscall_src += arch-arm/syscalls/utimensat.S
 syscall_src += arch-arm/syscalls/sigaction.S
 syscall_src += arch-arm/syscalls/sigprocmask.S
 syscall_src += arch-arm/syscalls/__sigsuspend.S
@@ -168,6 +182,7 @@
 syscall_src += arch-arm/syscalls/delete_module.S
 syscall_src += arch-arm/syscalls/klogctl.S
 syscall_src += arch-arm/syscalls/sysinfo.S
+syscall_src += arch-arm/syscalls/personality.S
 syscall_src += arch-arm/syscalls/futex.S
 syscall_src += arch-arm/syscalls/epoll_create.S
 syscall_src += arch-arm/syscalls/epoll_ctl.S
diff --git a/libc/arch-arm/syscalls/__brk.S b/libc/arch-arm/syscalls/__brk.S
index 99ad2e3..a0854a0 100644
--- a/libc/arch-arm/syscalls/__brk.S
+++ b/libc/arch-arm/syscalls/__brk.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __brk, #function
-    .globl __brk
-    .align 4
-    .fnstart
-
-__brk:
+ENTRY(__brk)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_brk
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__brk)
diff --git a/libc/arch-arm/syscalls/__fcntl.S b/libc/arch-arm/syscalls/__fcntl.S
index 1b7b92f..067ee9a 100644
--- a/libc/arch-arm/syscalls/__fcntl.S
+++ b/libc/arch-arm/syscalls/__fcntl.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __fcntl, #function
-    .globl __fcntl
-    .align 4
-    .fnstart
-
-__fcntl:
+ENTRY(__fcntl)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fcntl
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__fcntl)
diff --git a/libc/arch-arm/syscalls/__fcntl64.S b/libc/arch-arm/syscalls/__fcntl64.S
index d1a6fc8..3d39567 100644
--- a/libc/arch-arm/syscalls/__fcntl64.S
+++ b/libc/arch-arm/syscalls/__fcntl64.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __fcntl64, #function
-    .globl __fcntl64
-    .align 4
-    .fnstart
-
-__fcntl64:
+ENTRY(__fcntl64)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fcntl64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__fcntl64)
diff --git a/libc/arch-arm/syscalls/__fork.S b/libc/arch-arm/syscalls/__fork.S
index fddd276..6cf08ad 100644
--- a/libc/arch-arm/syscalls/__fork.S
+++ b/libc/arch-arm/syscalls/__fork.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __fork, #function
-    .globl __fork
-    .align 4
-    .fnstart
-
-__fork:
+ENTRY(__fork)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fork
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__fork)
diff --git a/libc/arch-arm/syscalls/__fstatfs64.S b/libc/arch-arm/syscalls/__fstatfs64.S
index 00b4e41..e8aa2f4 100644
--- a/libc/arch-arm/syscalls/__fstatfs64.S
+++ b/libc/arch-arm/syscalls/__fstatfs64.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __fstatfs64, #function
-    .globl __fstatfs64
-    .align 4
-    .fnstart
-
-__fstatfs64:
+ENTRY(__fstatfs64)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fstatfs64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__fstatfs64)
diff --git a/libc/arch-arm/syscalls/__getcpu.S b/libc/arch-arm/syscalls/__getcpu.S
index ed6927a..78271eb 100644
--- a/libc/arch-arm/syscalls/__getcpu.S
+++ b/libc/arch-arm/syscalls/__getcpu.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __getcpu, #function
-    .globl __getcpu
-    .align 4
-    .fnstart
-
-__getcpu:
+ENTRY(__getcpu)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getcpu
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__getcpu)
diff --git a/libc/arch-arm/syscalls/__getcwd.S b/libc/arch-arm/syscalls/__getcwd.S
index 6098d09..e09a484 100644
--- a/libc/arch-arm/syscalls/__getcwd.S
+++ b/libc/arch-arm/syscalls/__getcwd.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __getcwd, #function
-    .globl __getcwd
-    .align 4
-    .fnstart
-
-__getcwd:
+ENTRY(__getcwd)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getcwd
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__getcwd)
diff --git a/libc/arch-arm/syscalls/__getpriority.S b/libc/arch-arm/syscalls/__getpriority.S
index 2b652ef..30e335c 100644
--- a/libc/arch-arm/syscalls/__getpriority.S
+++ b/libc/arch-arm/syscalls/__getpriority.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __getpriority, #function
-    .globl __getpriority
-    .align 4
-    .fnstart
-
-__getpriority:
+ENTRY(__getpriority)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getpriority
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__getpriority)
diff --git a/libc/arch-arm/syscalls/__ioctl.S b/libc/arch-arm/syscalls/__ioctl.S
index 2fad231..554809f 100644
--- a/libc/arch-arm/syscalls/__ioctl.S
+++ b/libc/arch-arm/syscalls/__ioctl.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __ioctl, #function
-    .globl __ioctl
-    .align 4
-    .fnstart
-
-__ioctl:
+ENTRY(__ioctl)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ioctl
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__ioctl)
diff --git a/libc/arch-arm/syscalls/__llseek.S b/libc/arch-arm/syscalls/__llseek.S
index 8325e2d..9893886 100644
--- a/libc/arch-arm/syscalls/__llseek.S
+++ b/libc/arch-arm/syscalls/__llseek.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __llseek, #function
-    .globl __llseek
-    .align 4
-    .fnstart
-
-__llseek:
+ENTRY(__llseek)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__llseek)
diff --git a/libc/arch-arm/syscalls/__mmap2.S b/libc/arch-arm/syscalls/__mmap2.S
index d57020a..542b3e0 100644
--- a/libc/arch-arm/syscalls/__mmap2.S
+++ b/libc/arch-arm/syscalls/__mmap2.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __mmap2, #function
-    .globl __mmap2
-    .align 4
-    .fnstart
-
-__mmap2:
+ENTRY(__mmap2)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__mmap2)
diff --git a/libc/arch-arm/syscalls/__open.S b/libc/arch-arm/syscalls/__open.S
index 7e3fb7a..be2f4bf 100644
--- a/libc/arch-arm/syscalls/__open.S
+++ b/libc/arch-arm/syscalls/__open.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __open, #function
-    .globl __open
-    .align 4
-    .fnstart
-
-__open:
+ENTRY(__open)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_open
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__open)
diff --git a/libc/arch-arm/syscalls/__openat.S b/libc/arch-arm/syscalls/__openat.S
index ae92b9d..4d91780 100644
--- a/libc/arch-arm/syscalls/__openat.S
+++ b/libc/arch-arm/syscalls/__openat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __openat, #function
-    .globl __openat
-    .align 4
-    .fnstart
-
-__openat:
+ENTRY(__openat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_openat
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__openat)
diff --git a/libc/arch-arm/syscalls/__ptrace.S b/libc/arch-arm/syscalls/__ptrace.S
index 329a5af..04e0a30 100644
--- a/libc/arch-arm/syscalls/__ptrace.S
+++ b/libc/arch-arm/syscalls/__ptrace.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __ptrace, #function
-    .globl __ptrace
-    .align 4
-    .fnstart
-
-__ptrace:
+ENTRY(__ptrace)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ptrace
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__ptrace)
diff --git a/libc/arch-arm/syscalls/__reboot.S b/libc/arch-arm/syscalls/__reboot.S
index 770e9f8..e75df45 100644
--- a/libc/arch-arm/syscalls/__reboot.S
+++ b/libc/arch-arm/syscalls/__reboot.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __reboot, #function
-    .globl __reboot
-    .align 4
-    .fnstart
-
-__reboot:
+ENTRY(__reboot)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_reboot
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__reboot)
diff --git a/libc/arch-arm/syscalls/__rt_sigaction.S b/libc/arch-arm/syscalls/__rt_sigaction.S
index 29abd55..57a3149 100644
--- a/libc/arch-arm/syscalls/__rt_sigaction.S
+++ b/libc/arch-arm/syscalls/__rt_sigaction.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __rt_sigaction, #function
-    .globl __rt_sigaction
-    .align 4
-    .fnstart
-
-__rt_sigaction:
+ENTRY(__rt_sigaction)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_rt_sigaction
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__rt_sigaction)
diff --git a/libc/arch-arm/syscalls/__rt_sigprocmask.S b/libc/arch-arm/syscalls/__rt_sigprocmask.S
index c3acb54..8220825 100644
--- a/libc/arch-arm/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-arm/syscalls/__rt_sigprocmask.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __rt_sigprocmask, #function
-    .globl __rt_sigprocmask
-    .align 4
-    .fnstart
-
-__rt_sigprocmask:
+ENTRY(__rt_sigprocmask)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_rt_sigprocmask
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__rt_sigprocmask)
diff --git a/libc/arch-arm/syscalls/__rt_sigtimedwait.S b/libc/arch-arm/syscalls/__rt_sigtimedwait.S
index 0fb1573..bce63ed 100644
--- a/libc/arch-arm/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-arm/syscalls/__rt_sigtimedwait.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __rt_sigtimedwait, #function
-    .globl __rt_sigtimedwait
-    .align 4
-    .fnstart
-
-__rt_sigtimedwait:
+ENTRY(__rt_sigtimedwait)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_rt_sigtimedwait
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__rt_sigtimedwait)
diff --git a/libc/arch-arm/syscalls/__sched_getaffinity.S b/libc/arch-arm/syscalls/__sched_getaffinity.S
index 71f2b1d..bdd4517 100644
--- a/libc/arch-arm/syscalls/__sched_getaffinity.S
+++ b/libc/arch-arm/syscalls/__sched_getaffinity.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __sched_getaffinity, #function
-    .globl __sched_getaffinity
-    .align 4
-    .fnstart
-
-__sched_getaffinity:
+ENTRY(__sched_getaffinity)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_getaffinity
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__sched_getaffinity)
diff --git a/libc/arch-arm/syscalls/__set_tls.S b/libc/arch-arm/syscalls/__set_tls.S
index f6a097f..cf5d6b6 100644
--- a/libc/arch-arm/syscalls/__set_tls.S
+++ b/libc/arch-arm/syscalls/__set_tls.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __set_tls, #function
-    .globl __set_tls
-    .align 4
-    .fnstart
-
-__set_tls:
+ENTRY(__set_tls)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ARM_set_tls
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__set_tls)
diff --git a/libc/arch-arm/syscalls/__setresuid.S b/libc/arch-arm/syscalls/__setresuid.S
index 7710772..d5053ba 100644
--- a/libc/arch-arm/syscalls/__setresuid.S
+++ b/libc/arch-arm/syscalls/__setresuid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __setresuid, #function
-    .globl __setresuid
-    .align 4
-    .fnstart
-
-__setresuid:
+ENTRY(__setresuid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setresuid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__setresuid)
diff --git a/libc/arch-arm/syscalls/__setreuid.S b/libc/arch-arm/syscalls/__setreuid.S
index 0c68866..9cd51f6 100644
--- a/libc/arch-arm/syscalls/__setreuid.S
+++ b/libc/arch-arm/syscalls/__setreuid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __setreuid, #function
-    .globl __setreuid
-    .align 4
-    .fnstart
-
-__setreuid:
+ENTRY(__setreuid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setreuid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__setreuid)
diff --git a/libc/arch-arm/syscalls/__setuid.S b/libc/arch-arm/syscalls/__setuid.S
index efc6e56..88dc58e 100644
--- a/libc/arch-arm/syscalls/__setuid.S
+++ b/libc/arch-arm/syscalls/__setuid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __setuid, #function
-    .globl __setuid
-    .align 4
-    .fnstart
-
-__setuid:
+ENTRY(__setuid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setuid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__setuid)
diff --git a/libc/arch-arm/syscalls/__sigsuspend.S b/libc/arch-arm/syscalls/__sigsuspend.S
index 39416f1..1ececb7 100644
--- a/libc/arch-arm/syscalls/__sigsuspend.S
+++ b/libc/arch-arm/syscalls/__sigsuspend.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __sigsuspend, #function
-    .globl __sigsuspend
-    .align 4
-    .fnstart
-
-__sigsuspend:
+ENTRY(__sigsuspend)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sigsuspend
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__sigsuspend)
diff --git a/libc/arch-arm/syscalls/__statfs64.S b/libc/arch-arm/syscalls/__statfs64.S
index f602637..4afef71 100644
--- a/libc/arch-arm/syscalls/__statfs64.S
+++ b/libc/arch-arm/syscalls/__statfs64.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __statfs64, #function
-    .globl __statfs64
-    .align 4
-    .fnstart
-
-__statfs64:
+ENTRY(__statfs64)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_statfs64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__statfs64)
diff --git a/libc/arch-arm/syscalls/__sys_clone.S b/libc/arch-arm/syscalls/__sys_clone.S
index 9fe2641..48046bc 100644
--- a/libc/arch-arm/syscalls/__sys_clone.S
+++ b/libc/arch-arm/syscalls/__sys_clone.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __sys_clone, #function
-    .globl __sys_clone
-    .align 4
-    .fnstart
-
-__sys_clone:
+ENTRY(__sys_clone)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__sys_clone)
diff --git a/libc/arch-arm/syscalls/__syslog.S b/libc/arch-arm/syscalls/__syslog.S
index 3318d76..6dbe745 100644
--- a/libc/arch-arm/syscalls/__syslog.S
+++ b/libc/arch-arm/syscalls/__syslog.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __syslog, #function
-    .globl __syslog
-    .align 4
-    .fnstart
-
-__syslog:
+ENTRY(__syslog)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_syslog
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__syslog)
diff --git a/libc/arch-arm/syscalls/__timer_create.S b/libc/arch-arm/syscalls/__timer_create.S
index 5bc3966..c547137 100644
--- a/libc/arch-arm/syscalls/__timer_create.S
+++ b/libc/arch-arm/syscalls/__timer_create.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __timer_create, #function
-    .globl __timer_create
-    .align 4
-    .fnstart
-
-__timer_create:
+ENTRY(__timer_create)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_timer_create
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__timer_create)
diff --git a/libc/arch-arm/syscalls/__timer_delete.S b/libc/arch-arm/syscalls/__timer_delete.S
index 4ddee01..ca2e0a3 100644
--- a/libc/arch-arm/syscalls/__timer_delete.S
+++ b/libc/arch-arm/syscalls/__timer_delete.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __timer_delete, #function
-    .globl __timer_delete
-    .align 4
-    .fnstart
-
-__timer_delete:
+ENTRY(__timer_delete)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_timer_delete
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__timer_delete)
diff --git a/libc/arch-arm/syscalls/__timer_getoverrun.S b/libc/arch-arm/syscalls/__timer_getoverrun.S
index fb0c87d..b0f18e7 100644
--- a/libc/arch-arm/syscalls/__timer_getoverrun.S
+++ b/libc/arch-arm/syscalls/__timer_getoverrun.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __timer_getoverrun, #function
-    .globl __timer_getoverrun
-    .align 4
-    .fnstart
-
-__timer_getoverrun:
+ENTRY(__timer_getoverrun)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_timer_getoverrun
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__timer_getoverrun)
diff --git a/libc/arch-arm/syscalls/__timer_gettime.S b/libc/arch-arm/syscalls/__timer_gettime.S
index 9d6e446..c172602 100644
--- a/libc/arch-arm/syscalls/__timer_gettime.S
+++ b/libc/arch-arm/syscalls/__timer_gettime.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __timer_gettime, #function
-    .globl __timer_gettime
-    .align 4
-    .fnstart
-
-__timer_gettime:
+ENTRY(__timer_gettime)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_timer_gettime
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__timer_gettime)
diff --git a/libc/arch-arm/syscalls/__timer_settime.S b/libc/arch-arm/syscalls/__timer_settime.S
index a7be132..8220440 100644
--- a/libc/arch-arm/syscalls/__timer_settime.S
+++ b/libc/arch-arm/syscalls/__timer_settime.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __timer_settime, #function
-    .globl __timer_settime
-    .align 4
-    .fnstart
-
-__timer_settime:
+ENTRY(__timer_settime)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_timer_settime
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__timer_settime)
diff --git a/libc/arch-arm/syscalls/__wait4.S b/libc/arch-arm/syscalls/__wait4.S
index 9670177..fa34502 100644
--- a/libc/arch-arm/syscalls/__wait4.S
+++ b/libc/arch-arm/syscalls/__wait4.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __wait4, #function
-    .globl __wait4
-    .align 4
-    .fnstart
-
-__wait4:
+ENTRY(__wait4)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_wait4
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__wait4)
diff --git a/libc/arch-arm/syscalls/__waitid.S b/libc/arch-arm/syscalls/__waitid.S
index fdd0da3..9950e9c 100644
--- a/libc/arch-arm/syscalls/__waitid.S
+++ b/libc/arch-arm/syscalls/__waitid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type __waitid, #function
-    .globl __waitid
-    .align 4
-    .fnstart
-
-__waitid:
+ENTRY(__waitid)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(__waitid)
diff --git a/libc/arch-arm/syscalls/_exit.S b/libc/arch-arm/syscalls/_exit.S
index e750ca3..77487b5 100644
--- a/libc/arch-arm/syscalls/_exit.S
+++ b/libc/arch-arm/syscalls/_exit.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type _exit, #function
-    .globl _exit
-    .align 4
-    .fnstart
-
-_exit:
+ENTRY(_exit)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_exit_group
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(_exit)
diff --git a/libc/arch-arm/syscalls/_exit_thread.S b/libc/arch-arm/syscalls/_exit_thread.S
index c6f868f..bd16ff1 100644
--- a/libc/arch-arm/syscalls/_exit_thread.S
+++ b/libc/arch-arm/syscalls/_exit_thread.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type _exit_thread, #function
-    .globl _exit_thread
-    .align 4
-    .fnstart
-
-_exit_thread:
+ENTRY(_exit_thread)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_exit
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(_exit_thread)
diff --git a/libc/arch-arm/syscalls/accept.S b/libc/arch-arm/syscalls/accept.S
index 6c32f24..0dcfb0c 100644
--- a/libc/arch-arm/syscalls/accept.S
+++ b/libc/arch-arm/syscalls/accept.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type accept, #function
-    .globl accept
-    .align 4
-    .fnstart
-
-accept:
+ENTRY(accept)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_accept
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(accept)
diff --git a/libc/arch-arm/syscalls/access.S b/libc/arch-arm/syscalls/access.S
index 3639106..cf585a3 100644
--- a/libc/arch-arm/syscalls/access.S
+++ b/libc/arch-arm/syscalls/access.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type access, #function
-    .globl access
-    .align 4
-    .fnstart
-
-access:
+ENTRY(access)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_access
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(access)
diff --git a/libc/arch-arm/syscalls/acct.S b/libc/arch-arm/syscalls/acct.S
index d7d8781..85346e4 100644
--- a/libc/arch-arm/syscalls/acct.S
+++ b/libc/arch-arm/syscalls/acct.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type acct, #function
-    .globl acct
-    .align 4
-    .fnstart
-
-acct:
+ENTRY(acct)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_acct
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(acct)
diff --git a/libc/arch-arm/syscalls/bind.S b/libc/arch-arm/syscalls/bind.S
index 66cc667..85d0471 100644
--- a/libc/arch-arm/syscalls/bind.S
+++ b/libc/arch-arm/syscalls/bind.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type bind, #function
-    .globl bind
-    .align 4
-    .fnstart
-
-bind:
+ENTRY(bind)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_bind
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(bind)
diff --git a/libc/arch-arm/syscalls/cacheflush.S b/libc/arch-arm/syscalls/cacheflush.S
index d7fba90..05b2411 100644
--- a/libc/arch-arm/syscalls/cacheflush.S
+++ b/libc/arch-arm/syscalls/cacheflush.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type cacheflush, #function
-    .globl cacheflush
-    .align 4
-    .fnstart
-
-cacheflush:
+ENTRY(cacheflush)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ARM_cacheflush
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(cacheflush)
diff --git a/libc/arch-arm/syscalls/capget.S b/libc/arch-arm/syscalls/capget.S
index 92082a1..0f3ba31 100644
--- a/libc/arch-arm/syscalls/capget.S
+++ b/libc/arch-arm/syscalls/capget.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type capget, #function
-    .globl capget
-    .align 4
-    .fnstart
-
-capget:
+ENTRY(capget)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_capget
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(capget)
diff --git a/libc/arch-arm/syscalls/capset.S b/libc/arch-arm/syscalls/capset.S
index 8a169ed..2254db2 100644
--- a/libc/arch-arm/syscalls/capset.S
+++ b/libc/arch-arm/syscalls/capset.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type capset, #function
-    .globl capset
-    .align 4
-    .fnstart
-
-capset:
+ENTRY(capset)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_capset
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(capset)
diff --git a/libc/arch-arm/syscalls/chdir.S b/libc/arch-arm/syscalls/chdir.S
index ff4ec68..57d6b13 100644
--- a/libc/arch-arm/syscalls/chdir.S
+++ b/libc/arch-arm/syscalls/chdir.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type chdir, #function
-    .globl chdir
-    .align 4
-    .fnstart
-
-chdir:
+ENTRY(chdir)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_chdir
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(chdir)
diff --git a/libc/arch-arm/syscalls/chmod.S b/libc/arch-arm/syscalls/chmod.S
index 56e43c5..8909c6f 100644
--- a/libc/arch-arm/syscalls/chmod.S
+++ b/libc/arch-arm/syscalls/chmod.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type chmod, #function
-    .globl chmod
-    .align 4
-    .fnstart
-
-chmod:
+ENTRY(chmod)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_chmod
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(chmod)
diff --git a/libc/arch-arm/syscalls/chown.S b/libc/arch-arm/syscalls/chown.S
index 1d3032f..cbbd8a8 100644
--- a/libc/arch-arm/syscalls/chown.S
+++ b/libc/arch-arm/syscalls/chown.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type chown, #function
-    .globl chown
-    .align 4
-    .fnstart
-
-chown:
+ENTRY(chown)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_chown32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(chown)
diff --git a/libc/arch-arm/syscalls/chroot.S b/libc/arch-arm/syscalls/chroot.S
index c063d8b..a679172 100644
--- a/libc/arch-arm/syscalls/chroot.S
+++ b/libc/arch-arm/syscalls/chroot.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type chroot, #function
-    .globl chroot
-    .align 4
-    .fnstart
-
-chroot:
+ENTRY(chroot)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_chroot
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(chroot)
diff --git a/libc/arch-arm/syscalls/clock_getres.S b/libc/arch-arm/syscalls/clock_getres.S
index 6fdbe37..705f296 100644
--- a/libc/arch-arm/syscalls/clock_getres.S
+++ b/libc/arch-arm/syscalls/clock_getres.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type clock_getres, #function
-    .globl clock_getres
-    .align 4
-    .fnstart
-
-clock_getres:
+ENTRY(clock_getres)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_clock_getres
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(clock_getres)
diff --git a/libc/arch-arm/syscalls/clock_gettime.S b/libc/arch-arm/syscalls/clock_gettime.S
index 8941b23..a9ab41f 100644
--- a/libc/arch-arm/syscalls/clock_gettime.S
+++ b/libc/arch-arm/syscalls/clock_gettime.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type clock_gettime, #function
-    .globl clock_gettime
-    .align 4
-    .fnstart
-
-clock_gettime:
+ENTRY(clock_gettime)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_clock_gettime
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(clock_gettime)
diff --git a/libc/arch-arm/syscalls/clock_nanosleep.S b/libc/arch-arm/syscalls/clock_nanosleep.S
index 2c10151..f8e7f73 100644
--- a/libc/arch-arm/syscalls/clock_nanosleep.S
+++ b/libc/arch-arm/syscalls/clock_nanosleep.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type clock_nanosleep, #function
-    .globl clock_nanosleep
-    .align 4
-    .fnstart
-
-clock_nanosleep:
+ENTRY(clock_nanosleep)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_clock_nanosleep
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(clock_nanosleep)
diff --git a/libc/arch-arm/syscalls/clock_settime.S b/libc/arch-arm/syscalls/clock_settime.S
index 94614f2..a996441 100644
--- a/libc/arch-arm/syscalls/clock_settime.S
+++ b/libc/arch-arm/syscalls/clock_settime.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type clock_settime, #function
-    .globl clock_settime
-    .align 4
-    .fnstart
-
-clock_settime:
+ENTRY(clock_settime)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_clock_settime
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(clock_settime)
diff --git a/libc/arch-arm/syscalls/close.S b/libc/arch-arm/syscalls/close.S
index e54b100..36d78a4 100644
--- a/libc/arch-arm/syscalls/close.S
+++ b/libc/arch-arm/syscalls/close.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type close, #function
-    .globl close
-    .align 4
-    .fnstart
-
-close:
+ENTRY(close)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_close
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(close)
diff --git a/libc/arch-arm/syscalls/connect.S b/libc/arch-arm/syscalls/connect.S
index b05d6a2..ea14c17 100644
--- a/libc/arch-arm/syscalls/connect.S
+++ b/libc/arch-arm/syscalls/connect.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type connect, #function
-    .globl connect
-    .align 4
-    .fnstart
-
-connect:
+ENTRY(connect)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_connect
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(connect)
diff --git a/libc/arch-arm/syscalls/delete_module.S b/libc/arch-arm/syscalls/delete_module.S
index 69d5966..df8aae0 100644
--- a/libc/arch-arm/syscalls/delete_module.S
+++ b/libc/arch-arm/syscalls/delete_module.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type delete_module, #function
-    .globl delete_module
-    .align 4
-    .fnstart
-
-delete_module:
+ENTRY(delete_module)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_delete_module
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(delete_module)
diff --git a/libc/arch-arm/syscalls/dup.S b/libc/arch-arm/syscalls/dup.S
index 5a5d050..b0c1cda 100644
--- a/libc/arch-arm/syscalls/dup.S
+++ b/libc/arch-arm/syscalls/dup.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type dup, #function
-    .globl dup
-    .align 4
-    .fnstart
-
-dup:
+ENTRY(dup)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_dup
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(dup)
diff --git a/libc/arch-arm/syscalls/dup2.S b/libc/arch-arm/syscalls/dup2.S
index 1ced458..ed346d9 100644
--- a/libc/arch-arm/syscalls/dup2.S
+++ b/libc/arch-arm/syscalls/dup2.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type dup2, #function
-    .globl dup2
-    .align 4
-    .fnstart
-
-dup2:
+ENTRY(dup2)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_dup2
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(dup2)
diff --git a/libc/arch-arm/syscalls/epoll_create.S b/libc/arch-arm/syscalls/epoll_create.S
index 389d4ba..1aab606 100644
--- a/libc/arch-arm/syscalls/epoll_create.S
+++ b/libc/arch-arm/syscalls/epoll_create.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type epoll_create, #function
-    .globl epoll_create
-    .align 4
-    .fnstart
-
-epoll_create:
+ENTRY(epoll_create)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_epoll_create
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(epoll_create)
diff --git a/libc/arch-arm/syscalls/epoll_ctl.S b/libc/arch-arm/syscalls/epoll_ctl.S
index 906d80d..c0ecf06 100644
--- a/libc/arch-arm/syscalls/epoll_ctl.S
+++ b/libc/arch-arm/syscalls/epoll_ctl.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type epoll_ctl, #function
-    .globl epoll_ctl
-    .align 4
-    .fnstart
-
-epoll_ctl:
+ENTRY(epoll_ctl)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_epoll_ctl
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(epoll_ctl)
diff --git a/libc/arch-arm/syscalls/epoll_wait.S b/libc/arch-arm/syscalls/epoll_wait.S
index af74878..3535001 100644
--- a/libc/arch-arm/syscalls/epoll_wait.S
+++ b/libc/arch-arm/syscalls/epoll_wait.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type epoll_wait, #function
-    .globl epoll_wait
-    .align 4
-    .fnstart
-
-epoll_wait:
+ENTRY(epoll_wait)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_epoll_wait
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(epoll_wait)
diff --git a/libc/arch-arm/syscalls/eventfd.S b/libc/arch-arm/syscalls/eventfd.S
index 8d2cce9..857b6c0 100644
--- a/libc/arch-arm/syscalls/eventfd.S
+++ b/libc/arch-arm/syscalls/eventfd.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type eventfd, #function
-    .globl eventfd
-    .align 4
-    .fnstart
-
-eventfd:
+ENTRY(eventfd)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_eventfd2
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(eventfd)
diff --git a/libc/arch-arm/syscalls/execve.S b/libc/arch-arm/syscalls/execve.S
index 2309a1b..1a66167 100644
--- a/libc/arch-arm/syscalls/execve.S
+++ b/libc/arch-arm/syscalls/execve.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type execve, #function
-    .globl execve
-    .align 4
-    .fnstart
-
-execve:
+ENTRY(execve)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_execve
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(execve)
diff --git a/libc/arch-arm/syscalls/fchdir.S b/libc/arch-arm/syscalls/fchdir.S
index 441f3e2..7d80cf0 100644
--- a/libc/arch-arm/syscalls/fchdir.S
+++ b/libc/arch-arm/syscalls/fchdir.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fchdir, #function
-    .globl fchdir
-    .align 4
-    .fnstart
-
-fchdir:
+ENTRY(fchdir)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fchdir
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fchdir)
diff --git a/libc/arch-arm/syscalls/fchmod.S b/libc/arch-arm/syscalls/fchmod.S
index b5f1983..bc8e643 100644
--- a/libc/arch-arm/syscalls/fchmod.S
+++ b/libc/arch-arm/syscalls/fchmod.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fchmod, #function
-    .globl fchmod
-    .align 4
-    .fnstart
-
-fchmod:
+ENTRY(fchmod)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fchmod
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fchmod)
diff --git a/libc/arch-arm/syscalls/fchmodat.S b/libc/arch-arm/syscalls/fchmodat.S
index d6e3916..ac782e5 100644
--- a/libc/arch-arm/syscalls/fchmodat.S
+++ b/libc/arch-arm/syscalls/fchmodat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fchmodat, #function
-    .globl fchmodat
-    .align 4
-    .fnstart
-
-fchmodat:
+ENTRY(fchmodat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fchmodat
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fchmodat)
diff --git a/libc/arch-arm/syscalls/fchown.S b/libc/arch-arm/syscalls/fchown.S
index 7887296..22d7fd2 100644
--- a/libc/arch-arm/syscalls/fchown.S
+++ b/libc/arch-arm/syscalls/fchown.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fchown, #function
-    .globl fchown
-    .align 4
-    .fnstart
-
-fchown:
+ENTRY(fchown)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fchown32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fchown)
diff --git a/libc/arch-arm/syscalls/fchownat.S b/libc/arch-arm/syscalls/fchownat.S
index 2279d2c..1482832 100644
--- a/libc/arch-arm/syscalls/fchownat.S
+++ b/libc/arch-arm/syscalls/fchownat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fchownat, #function
-    .globl fchownat
-    .align 4
-    .fnstart
-
-fchownat:
+ENTRY(fchownat)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fchownat)
diff --git a/libc/arch-arm/syscalls/fdatasync.S b/libc/arch-arm/syscalls/fdatasync.S
index 5981a80..d41e823 100644
--- a/libc/arch-arm/syscalls/fdatasync.S
+++ b/libc/arch-arm/syscalls/fdatasync.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fdatasync, #function
-    .globl fdatasync
-    .align 4
-    .fnstart
-
-fdatasync:
+ENTRY(fdatasync)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fdatasync
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fdatasync)
diff --git a/libc/arch-arm/syscalls/fgetxattr.S b/libc/arch-arm/syscalls/fgetxattr.S
new file mode 100644
index 0000000..32b8ef8
--- /dev/null
+++ b/libc/arch-arm/syscalls/fgetxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(fgetxattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_fgetxattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(fgetxattr)
diff --git a/libc/arch-arm/syscalls/flistxattr.S b/libc/arch-arm/syscalls/flistxattr.S
new file mode 100644
index 0000000..0785e77
--- /dev/null
+++ b/libc/arch-arm/syscalls/flistxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(flistxattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_flistxattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(flistxattr)
diff --git a/libc/arch-arm/syscalls/flock.S b/libc/arch-arm/syscalls/flock.S
index 22e391c..c0d2844 100644
--- a/libc/arch-arm/syscalls/flock.S
+++ b/libc/arch-arm/syscalls/flock.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type flock, #function
-    .globl flock
-    .align 4
-    .fnstart
-
-flock:
+ENTRY(flock)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_flock
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(flock)
diff --git a/libc/arch-arm/syscalls/fremovexattr.S b/libc/arch-arm/syscalls/fremovexattr.S
new file mode 100644
index 0000000..ae97d13
--- /dev/null
+++ b/libc/arch-arm/syscalls/fremovexattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(fremovexattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_fremovexattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(fremovexattr)
diff --git a/libc/arch-arm/syscalls/fsetxattr.S b/libc/arch-arm/syscalls/fsetxattr.S
new file mode 100644
index 0000000..176cad9
--- /dev/null
+++ b/libc/arch-arm/syscalls/fsetxattr.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(fsetxattr)
+    mov     ip, sp
+    .save   {r4, r5, r6, r7}
+    stmfd   sp!, {r4, r5, r6, r7}
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_fsetxattr
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(fsetxattr)
diff --git a/libc/arch-arm/syscalls/fstat.S b/libc/arch-arm/syscalls/fstat.S
index ef1752f..e75649f 100644
--- a/libc/arch-arm/syscalls/fstat.S
+++ b/libc/arch-arm/syscalls/fstat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fstat, #function
-    .globl fstat
-    .align 4
-    .fnstart
-
-fstat:
+ENTRY(fstat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fstat64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fstat)
diff --git a/libc/arch-arm/syscalls/fstatat.S b/libc/arch-arm/syscalls/fstatat.S
index a3dd74a..065ef9f 100644
--- a/libc/arch-arm/syscalls/fstatat.S
+++ b/libc/arch-arm/syscalls/fstatat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fstatat, #function
-    .globl fstatat
-    .align 4
-    .fnstart
-
-fstatat:
+ENTRY(fstatat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fstatat64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fstatat)
diff --git a/libc/arch-arm/syscalls/fsync.S b/libc/arch-arm/syscalls/fsync.S
index 588dfa3..f0de9ca 100644
--- a/libc/arch-arm/syscalls/fsync.S
+++ b/libc/arch-arm/syscalls/fsync.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type fsync, #function
-    .globl fsync
-    .align 4
-    .fnstart
-
-fsync:
+ENTRY(fsync)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_fsync
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(fsync)
diff --git a/libc/arch-arm/syscalls/ftruncate.S b/libc/arch-arm/syscalls/ftruncate.S
index 2d60b41..2e4a308 100644
--- a/libc/arch-arm/syscalls/ftruncate.S
+++ b/libc/arch-arm/syscalls/ftruncate.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type ftruncate, #function
-    .globl ftruncate
-    .align 4
-    .fnstart
-
-ftruncate:
+ENTRY(ftruncate)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ftruncate
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(ftruncate)
diff --git a/libc/arch-arm/syscalls/ftruncate64.S b/libc/arch-arm/syscalls/ftruncate64.S
index 37b4744..7c7b80b 100644
--- a/libc/arch-arm/syscalls/ftruncate64.S
+++ b/libc/arch-arm/syscalls/ftruncate64.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type ftruncate64, #function
-    .globl ftruncate64
-    .align 4
-    .fnstart
-
-ftruncate64:
+ENTRY(ftruncate64)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ftruncate64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(ftruncate64)
diff --git a/libc/arch-arm/syscalls/futex.S b/libc/arch-arm/syscalls/futex.S
index c2d4b7e..47219e3 100644
--- a/libc/arch-arm/syscalls/futex.S
+++ b/libc/arch-arm/syscalls/futex.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type futex, #function
-    .globl futex
-    .align 4
-    .fnstart
-
-futex:
+ENTRY(futex)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(futex)
diff --git a/libc/arch-arm/syscalls/getdents.S b/libc/arch-arm/syscalls/getdents.S
index 312aa0d..82b6e4c 100644
--- a/libc/arch-arm/syscalls/getdents.S
+++ b/libc/arch-arm/syscalls/getdents.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getdents, #function
-    .globl getdents
-    .align 4
-    .fnstart
-
-getdents:
+ENTRY(getdents)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getdents64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getdents)
diff --git a/libc/arch-arm/syscalls/getegid.S b/libc/arch-arm/syscalls/getegid.S
index 26723bf..27ea272 100644
--- a/libc/arch-arm/syscalls/getegid.S
+++ b/libc/arch-arm/syscalls/getegid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getegid, #function
-    .globl getegid
-    .align 4
-    .fnstart
-
-getegid:
+ENTRY(getegid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getegid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getegid)
diff --git a/libc/arch-arm/syscalls/geteuid.S b/libc/arch-arm/syscalls/geteuid.S
index d86959f..d4c9cd1 100644
--- a/libc/arch-arm/syscalls/geteuid.S
+++ b/libc/arch-arm/syscalls/geteuid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type geteuid, #function
-    .globl geteuid
-    .align 4
-    .fnstart
-
-geteuid:
+ENTRY(geteuid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_geteuid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(geteuid)
diff --git a/libc/arch-arm/syscalls/getgid.S b/libc/arch-arm/syscalls/getgid.S
index 1502fdf..9a40fe6 100644
--- a/libc/arch-arm/syscalls/getgid.S
+++ b/libc/arch-arm/syscalls/getgid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getgid, #function
-    .globl getgid
-    .align 4
-    .fnstart
-
-getgid:
+ENTRY(getgid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getgid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getgid)
diff --git a/libc/arch-arm/syscalls/getgroups.S b/libc/arch-arm/syscalls/getgroups.S
index e68fe05..2995cc8 100644
--- a/libc/arch-arm/syscalls/getgroups.S
+++ b/libc/arch-arm/syscalls/getgroups.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getgroups, #function
-    .globl getgroups
-    .align 4
-    .fnstart
-
-getgroups:
+ENTRY(getgroups)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getgroups32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getgroups)
diff --git a/libc/arch-arm/syscalls/getitimer.S b/libc/arch-arm/syscalls/getitimer.S
index 404c2fc..a3f1423 100644
--- a/libc/arch-arm/syscalls/getitimer.S
+++ b/libc/arch-arm/syscalls/getitimer.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getitimer, #function
-    .globl getitimer
-    .align 4
-    .fnstart
-
-getitimer:
+ENTRY(getitimer)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getitimer
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getitimer)
diff --git a/libc/arch-arm/syscalls/getpeername.S b/libc/arch-arm/syscalls/getpeername.S
index f04ec32..f90c344 100644
--- a/libc/arch-arm/syscalls/getpeername.S
+++ b/libc/arch-arm/syscalls/getpeername.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getpeername, #function
-    .globl getpeername
-    .align 4
-    .fnstart
-
-getpeername:
+ENTRY(getpeername)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getpeername
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getpeername)
diff --git a/libc/arch-arm/syscalls/getpgid.S b/libc/arch-arm/syscalls/getpgid.S
index 9397458..0fc57a4 100644
--- a/libc/arch-arm/syscalls/getpgid.S
+++ b/libc/arch-arm/syscalls/getpgid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getpgid, #function
-    .globl getpgid
-    .align 4
-    .fnstart
-
-getpgid:
+ENTRY(getpgid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getpgid
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getpgid)
diff --git a/libc/arch-arm/syscalls/getpid.S b/libc/arch-arm/syscalls/getpid.S
index 1be793a..440ae9b 100644
--- a/libc/arch-arm/syscalls/getpid.S
+++ b/libc/arch-arm/syscalls/getpid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getpid, #function
-    .globl getpid
-    .align 4
-    .fnstart
-
-getpid:
+ENTRY(getpid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getpid
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getpid)
diff --git a/libc/arch-arm/syscalls/getppid.S b/libc/arch-arm/syscalls/getppid.S
index 14185b9..3eb1b86 100644
--- a/libc/arch-arm/syscalls/getppid.S
+++ b/libc/arch-arm/syscalls/getppid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getppid, #function
-    .globl getppid
-    .align 4
-    .fnstart
-
-getppid:
+ENTRY(getppid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getppid
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getppid)
diff --git a/libc/arch-arm/syscalls/getresgid.S b/libc/arch-arm/syscalls/getresgid.S
index 90c90df..a022341 100644
--- a/libc/arch-arm/syscalls/getresgid.S
+++ b/libc/arch-arm/syscalls/getresgid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getresgid, #function
-    .globl getresgid
-    .align 4
-    .fnstart
-
-getresgid:
+ENTRY(getresgid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getresgid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getresgid)
diff --git a/libc/arch-arm/syscalls/getresuid.S b/libc/arch-arm/syscalls/getresuid.S
index e067ac0..23112a6 100644
--- a/libc/arch-arm/syscalls/getresuid.S
+++ b/libc/arch-arm/syscalls/getresuid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getresuid, #function
-    .globl getresuid
-    .align 4
-    .fnstart
-
-getresuid:
+ENTRY(getresuid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getresuid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getresuid)
diff --git a/libc/arch-arm/syscalls/getrlimit.S b/libc/arch-arm/syscalls/getrlimit.S
index 79c1357..8b1c089 100644
--- a/libc/arch-arm/syscalls/getrlimit.S
+++ b/libc/arch-arm/syscalls/getrlimit.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getrlimit, #function
-    .globl getrlimit
-    .align 4
-    .fnstart
-
-getrlimit:
+ENTRY(getrlimit)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ugetrlimit
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getrlimit)
diff --git a/libc/arch-arm/syscalls/getrusage.S b/libc/arch-arm/syscalls/getrusage.S
index 81db153..74fa20b 100644
--- a/libc/arch-arm/syscalls/getrusage.S
+++ b/libc/arch-arm/syscalls/getrusage.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getrusage, #function
-    .globl getrusage
-    .align 4
-    .fnstart
-
-getrusage:
+ENTRY(getrusage)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getrusage
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getrusage)
diff --git a/libc/arch-arm/syscalls/getsockname.S b/libc/arch-arm/syscalls/getsockname.S
index 2ae0876..99470e2 100644
--- a/libc/arch-arm/syscalls/getsockname.S
+++ b/libc/arch-arm/syscalls/getsockname.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getsockname, #function
-    .globl getsockname
-    .align 4
-    .fnstart
-
-getsockname:
+ENTRY(getsockname)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getsockname
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getsockname)
diff --git a/libc/arch-arm/syscalls/getsockopt.S b/libc/arch-arm/syscalls/getsockopt.S
index 76e1b11..d52f441 100644
--- a/libc/arch-arm/syscalls/getsockopt.S
+++ b/libc/arch-arm/syscalls/getsockopt.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getsockopt, #function
-    .globl getsockopt
-    .align 4
-    .fnstart
-
-getsockopt:
+ENTRY(getsockopt)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getsockopt)
diff --git a/libc/arch-arm/syscalls/gettid.S b/libc/arch-arm/syscalls/gettid.S
index e5da45d..f5b15be 100644
--- a/libc/arch-arm/syscalls/gettid.S
+++ b/libc/arch-arm/syscalls/gettid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type gettid, #function
-    .globl gettid
-    .align 4
-    .fnstart
-
-gettid:
+ENTRY(gettid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_gettid
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(gettid)
diff --git a/libc/arch-arm/syscalls/gettimeofday.S b/libc/arch-arm/syscalls/gettimeofday.S
index ba759f2..9b47daf 100644
--- a/libc/arch-arm/syscalls/gettimeofday.S
+++ b/libc/arch-arm/syscalls/gettimeofday.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type gettimeofday, #function
-    .globl gettimeofday
-    .align 4
-    .fnstart
-
-gettimeofday:
+ENTRY(gettimeofday)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_gettimeofday
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(gettimeofday)
diff --git a/libc/arch-arm/syscalls/getuid.S b/libc/arch-arm/syscalls/getuid.S
index 68c3057..053dc31 100644
--- a/libc/arch-arm/syscalls/getuid.S
+++ b/libc/arch-arm/syscalls/getuid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type getuid, #function
-    .globl getuid
-    .align 4
-    .fnstart
-
-getuid:
+ENTRY(getuid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_getuid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(getuid)
diff --git a/libc/arch-arm/syscalls/getxattr.S b/libc/arch-arm/syscalls/getxattr.S
new file mode 100644
index 0000000..18532ce
--- /dev/null
+++ b/libc/arch-arm/syscalls/getxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(getxattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_getxattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(getxattr)
diff --git a/libc/arch-arm/syscalls/init_module.S b/libc/arch-arm/syscalls/init_module.S
index 4e9cd1f..73beb46 100644
--- a/libc/arch-arm/syscalls/init_module.S
+++ b/libc/arch-arm/syscalls/init_module.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type init_module, #function
-    .globl init_module
-    .align 4
-    .fnstart
-
-init_module:
+ENTRY(init_module)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_init_module
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(init_module)
diff --git a/libc/arch-arm/syscalls/inotify_add_watch.S b/libc/arch-arm/syscalls/inotify_add_watch.S
index 823f321..da4a296 100644
--- a/libc/arch-arm/syscalls/inotify_add_watch.S
+++ b/libc/arch-arm/syscalls/inotify_add_watch.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type inotify_add_watch, #function
-    .globl inotify_add_watch
-    .align 4
-    .fnstart
-
-inotify_add_watch:
+ENTRY(inotify_add_watch)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_inotify_add_watch
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(inotify_add_watch)
diff --git a/libc/arch-arm/syscalls/inotify_init.S b/libc/arch-arm/syscalls/inotify_init.S
index c612b83..bac124c 100644
--- a/libc/arch-arm/syscalls/inotify_init.S
+++ b/libc/arch-arm/syscalls/inotify_init.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type inotify_init, #function
-    .globl inotify_init
-    .align 4
-    .fnstart
-
-inotify_init:
+ENTRY(inotify_init)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_inotify_init
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(inotify_init)
diff --git a/libc/arch-arm/syscalls/inotify_rm_watch.S b/libc/arch-arm/syscalls/inotify_rm_watch.S
index 6c416d6..f576480 100644
--- a/libc/arch-arm/syscalls/inotify_rm_watch.S
+++ b/libc/arch-arm/syscalls/inotify_rm_watch.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type inotify_rm_watch, #function
-    .globl inotify_rm_watch
-    .align 4
-    .fnstart
-
-inotify_rm_watch:
+ENTRY(inotify_rm_watch)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_inotify_rm_watch
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(inotify_rm_watch)
diff --git a/libc/arch-arm/syscalls/ioprio_get.S b/libc/arch-arm/syscalls/ioprio_get.S
index d686e98..13739dc 100644
--- a/libc/arch-arm/syscalls/ioprio_get.S
+++ b/libc/arch-arm/syscalls/ioprio_get.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type ioprio_get, #function
-    .globl ioprio_get
-    .align 4
-    .fnstart
-
-ioprio_get:
+ENTRY(ioprio_get)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ioprio_get
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(ioprio_get)
diff --git a/libc/arch-arm/syscalls/ioprio_set.S b/libc/arch-arm/syscalls/ioprio_set.S
index a812557..7e40ee5 100644
--- a/libc/arch-arm/syscalls/ioprio_set.S
+++ b/libc/arch-arm/syscalls/ioprio_set.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type ioprio_set, #function
-    .globl ioprio_set
-    .align 4
-    .fnstart
-
-ioprio_set:
+ENTRY(ioprio_set)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_ioprio_set
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(ioprio_set)
diff --git a/libc/arch-arm/syscalls/klogctl.S b/libc/arch-arm/syscalls/klogctl.S
index aee3474..5434b30 100644
--- a/libc/arch-arm/syscalls/klogctl.S
+++ b/libc/arch-arm/syscalls/klogctl.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type klogctl, #function
-    .globl klogctl
-    .align 4
-    .fnstart
-
-klogctl:
+ENTRY(klogctl)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_syslog
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(klogctl)
diff --git a/libc/arch-arm/syscalls/lchown.S b/libc/arch-arm/syscalls/lchown.S
index f8ee793..789e5af 100644
--- a/libc/arch-arm/syscalls/lchown.S
+++ b/libc/arch-arm/syscalls/lchown.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type lchown, #function
-    .globl lchown
-    .align 4
-    .fnstart
-
-lchown:
+ENTRY(lchown)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_lchown32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(lchown)
diff --git a/libc/arch-arm/syscalls/lgetxattr.S b/libc/arch-arm/syscalls/lgetxattr.S
new file mode 100644
index 0000000..61fc098
--- /dev/null
+++ b/libc/arch-arm/syscalls/lgetxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(lgetxattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_lgetxattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(lgetxattr)
diff --git a/libc/arch-arm/syscalls/link.S b/libc/arch-arm/syscalls/link.S
index f368595..ccf0a1d 100644
--- a/libc/arch-arm/syscalls/link.S
+++ b/libc/arch-arm/syscalls/link.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type link, #function
-    .globl link
-    .align 4
-    .fnstart
-
-link:
+ENTRY(link)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_link
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(link)
diff --git a/libc/arch-arm/syscalls/listen.S b/libc/arch-arm/syscalls/listen.S
index d1a8a6e..bb7f7a4 100644
--- a/libc/arch-arm/syscalls/listen.S
+++ b/libc/arch-arm/syscalls/listen.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type listen, #function
-    .globl listen
-    .align 4
-    .fnstart
-
-listen:
+ENTRY(listen)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_listen
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(listen)
diff --git a/libc/arch-arm/syscalls/listxattr.S b/libc/arch-arm/syscalls/listxattr.S
new file mode 100644
index 0000000..6bbdb6a
--- /dev/null
+++ b/libc/arch-arm/syscalls/listxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(listxattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_listxattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(listxattr)
diff --git a/libc/arch-arm/syscalls/llistxattr.S b/libc/arch-arm/syscalls/llistxattr.S
new file mode 100644
index 0000000..89682df
--- /dev/null
+++ b/libc/arch-arm/syscalls/llistxattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(llistxattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_llistxattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(llistxattr)
diff --git a/libc/arch-arm/syscalls/lremovexattr.S b/libc/arch-arm/syscalls/lremovexattr.S
new file mode 100644
index 0000000..62f6722
--- /dev/null
+++ b/libc/arch-arm/syscalls/lremovexattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(lremovexattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_lremovexattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(lremovexattr)
diff --git a/libc/arch-arm/syscalls/lseek.S b/libc/arch-arm/syscalls/lseek.S
index 47bf06a..2cd0853 100644
--- a/libc/arch-arm/syscalls/lseek.S
+++ b/libc/arch-arm/syscalls/lseek.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type lseek, #function
-    .globl lseek
-    .align 4
-    .fnstart
-
-lseek:
+ENTRY(lseek)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_lseek
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(lseek)
diff --git a/libc/arch-arm/syscalls/lsetxattr.S b/libc/arch-arm/syscalls/lsetxattr.S
new file mode 100644
index 0000000..bde7c24
--- /dev/null
+++ b/libc/arch-arm/syscalls/lsetxattr.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(lsetxattr)
+    mov     ip, sp
+    .save   {r4, r5, r6, r7}
+    stmfd   sp!, {r4, r5, r6, r7}
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_lsetxattr
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(lsetxattr)
diff --git a/libc/arch-arm/syscalls/lstat.S b/libc/arch-arm/syscalls/lstat.S
index f19d12f..dbecefe 100644
--- a/libc/arch-arm/syscalls/lstat.S
+++ b/libc/arch-arm/syscalls/lstat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type lstat, #function
-    .globl lstat
-    .align 4
-    .fnstart
-
-lstat:
+ENTRY(lstat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_lstat64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(lstat)
diff --git a/libc/arch-arm/syscalls/madvise.S b/libc/arch-arm/syscalls/madvise.S
index a992f46..024476f 100644
--- a/libc/arch-arm/syscalls/madvise.S
+++ b/libc/arch-arm/syscalls/madvise.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type madvise, #function
-    .globl madvise
-    .align 4
-    .fnstart
-
-madvise:
+ENTRY(madvise)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_madvise
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(madvise)
diff --git a/libc/arch-arm/syscalls/mincore.S b/libc/arch-arm/syscalls/mincore.S
index c2b5432..7a2a378 100644
--- a/libc/arch-arm/syscalls/mincore.S
+++ b/libc/arch-arm/syscalls/mincore.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mincore, #function
-    .globl mincore
-    .align 4
-    .fnstart
-
-mincore:
+ENTRY(mincore)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mincore
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mincore)
diff --git a/libc/arch-arm/syscalls/mkdir.S b/libc/arch-arm/syscalls/mkdir.S
index ec8372d..e51beab 100644
--- a/libc/arch-arm/syscalls/mkdir.S
+++ b/libc/arch-arm/syscalls/mkdir.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mkdir, #function
-    .globl mkdir
-    .align 4
-    .fnstart
-
-mkdir:
+ENTRY(mkdir)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mkdir
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mkdir)
diff --git a/libc/arch-arm/syscalls/mkdirat.S b/libc/arch-arm/syscalls/mkdirat.S
index e377c66..52f0be3 100644
--- a/libc/arch-arm/syscalls/mkdirat.S
+++ b/libc/arch-arm/syscalls/mkdirat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mkdirat, #function
-    .globl mkdirat
-    .align 4
-    .fnstart
-
-mkdirat:
+ENTRY(mkdirat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mkdirat
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mkdirat)
diff --git a/libc/arch-arm/syscalls/mknod.S b/libc/arch-arm/syscalls/mknod.S
index 0a8b6fa..ac6d976 100644
--- a/libc/arch-arm/syscalls/mknod.S
+++ b/libc/arch-arm/syscalls/mknod.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mknod, #function
-    .globl mknod
-    .align 4
-    .fnstart
-
-mknod:
+ENTRY(mknod)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mknod
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mknod)
diff --git a/libc/arch-arm/syscalls/mlock.S b/libc/arch-arm/syscalls/mlock.S
index 4eff70b..ad140d1 100644
--- a/libc/arch-arm/syscalls/mlock.S
+++ b/libc/arch-arm/syscalls/mlock.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mlock, #function
-    .globl mlock
-    .align 4
-    .fnstart
-
-mlock:
+ENTRY(mlock)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mlock
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mlock)
diff --git a/libc/arch-arm/syscalls/mount.S b/libc/arch-arm/syscalls/mount.S
index a2b9f1d..eb1624c 100644
--- a/libc/arch-arm/syscalls/mount.S
+++ b/libc/arch-arm/syscalls/mount.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mount, #function
-    .globl mount
-    .align 4
-    .fnstart
-
-mount:
+ENTRY(mount)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mount)
diff --git a/libc/arch-arm/syscalls/mprotect.S b/libc/arch-arm/syscalls/mprotect.S
index b10291e..39ae353 100644
--- a/libc/arch-arm/syscalls/mprotect.S
+++ b/libc/arch-arm/syscalls/mprotect.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mprotect, #function
-    .globl mprotect
-    .align 4
-    .fnstart
-
-mprotect:
+ENTRY(mprotect)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mprotect
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mprotect)
diff --git a/libc/arch-arm/syscalls/mremap.S b/libc/arch-arm/syscalls/mremap.S
index 397844a..918f3b7 100644
--- a/libc/arch-arm/syscalls/mremap.S
+++ b/libc/arch-arm/syscalls/mremap.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type mremap, #function
-    .globl mremap
-    .align 4
-    .fnstart
-
-mremap:
+ENTRY(mremap)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_mremap
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(mremap)
diff --git a/libc/arch-arm/syscalls/msync.S b/libc/arch-arm/syscalls/msync.S
index 7ac7cd2..2a5922c 100644
--- a/libc/arch-arm/syscalls/msync.S
+++ b/libc/arch-arm/syscalls/msync.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type msync, #function
-    .globl msync
-    .align 4
-    .fnstart
-
-msync:
+ENTRY(msync)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_msync
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(msync)
diff --git a/libc/arch-arm/syscalls/munlock.S b/libc/arch-arm/syscalls/munlock.S
index 21ee4d2..5a02aaf 100644
--- a/libc/arch-arm/syscalls/munlock.S
+++ b/libc/arch-arm/syscalls/munlock.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type munlock, #function
-    .globl munlock
-    .align 4
-    .fnstart
-
-munlock:
+ENTRY(munlock)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_munlock
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(munlock)
diff --git a/libc/arch-arm/syscalls/munmap.S b/libc/arch-arm/syscalls/munmap.S
index 7765b00..6bb8dd8 100644
--- a/libc/arch-arm/syscalls/munmap.S
+++ b/libc/arch-arm/syscalls/munmap.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type munmap, #function
-    .globl munmap
-    .align 4
-    .fnstart
-
-munmap:
+ENTRY(munmap)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_munmap
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(munmap)
diff --git a/libc/arch-arm/syscalls/nanosleep.S b/libc/arch-arm/syscalls/nanosleep.S
index 1f9b181..af36ced 100644
--- a/libc/arch-arm/syscalls/nanosleep.S
+++ b/libc/arch-arm/syscalls/nanosleep.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type nanosleep, #function
-    .globl nanosleep
-    .align 4
-    .fnstart
-
-nanosleep:
+ENTRY(nanosleep)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_nanosleep
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(nanosleep)
diff --git a/libc/arch-arm/syscalls/pause.S b/libc/arch-arm/syscalls/pause.S
index 3a16ec3..e64f4f3 100644
--- a/libc/arch-arm/syscalls/pause.S
+++ b/libc/arch-arm/syscalls/pause.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type pause, #function
-    .globl pause
-    .align 4
-    .fnstart
-
-pause:
+ENTRY(pause)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_pause
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(pause)
diff --git a/libc/arch-arm/syscalls/personality.S b/libc/arch-arm/syscalls/personality.S
new file mode 100644
index 0000000..17ac686
--- /dev/null
+++ b/libc/arch-arm/syscalls/personality.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(personality)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_personality
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(personality)
diff --git a/libc/arch-arm/syscalls/pipe.S b/libc/arch-arm/syscalls/pipe.S
index 4edc75e..3968703 100644
--- a/libc/arch-arm/syscalls/pipe.S
+++ b/libc/arch-arm/syscalls/pipe.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type pipe, #function
-    .globl pipe
-    .align 4
-    .fnstart
-
-pipe:
+ENTRY(pipe)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_pipe
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(pipe)
diff --git a/libc/arch-arm/syscalls/pipe2.S b/libc/arch-arm/syscalls/pipe2.S
index df77094..da2ecba 100644
--- a/libc/arch-arm/syscalls/pipe2.S
+++ b/libc/arch-arm/syscalls/pipe2.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type pipe2, #function
-    .globl pipe2
-    .align 4
-    .fnstart
-
-pipe2:
+ENTRY(pipe2)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_pipe2
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(pipe2)
diff --git a/libc/arch-arm/syscalls/poll.S b/libc/arch-arm/syscalls/poll.S
index 14b18e3..4d345ea 100644
--- a/libc/arch-arm/syscalls/poll.S
+++ b/libc/arch-arm/syscalls/poll.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type poll, #function
-    .globl poll
-    .align 4
-    .fnstart
-
-poll:
+ENTRY(poll)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_poll
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(poll)
diff --git a/libc/arch-arm/syscalls/prctl.S b/libc/arch-arm/syscalls/prctl.S
index 0dd417b..009dc54 100644
--- a/libc/arch-arm/syscalls/prctl.S
+++ b/libc/arch-arm/syscalls/prctl.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type prctl, #function
-    .globl prctl
-    .align 4
-    .fnstart
-
-prctl:
+ENTRY(prctl)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(prctl)
diff --git a/libc/arch-arm/syscalls/pread64.S b/libc/arch-arm/syscalls/pread64.S
index a54084c..0090fd3 100644
--- a/libc/arch-arm/syscalls/pread64.S
+++ b/libc/arch-arm/syscalls/pread64.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type pread64, #function
-    .globl pread64
-    .align 4
-    .fnstart
-
-pread64:
+ENTRY(pread64)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(pread64)
diff --git a/libc/arch-arm/syscalls/pwrite64.S b/libc/arch-arm/syscalls/pwrite64.S
index f9d56b2..444d78f 100644
--- a/libc/arch-arm/syscalls/pwrite64.S
+++ b/libc/arch-arm/syscalls/pwrite64.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type pwrite64, #function
-    .globl pwrite64
-    .align 4
-    .fnstart
-
-pwrite64:
+ENTRY(pwrite64)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(pwrite64)
diff --git a/libc/arch-arm/syscalls/read.S b/libc/arch-arm/syscalls/read.S
index da9d81c..c062388 100644
--- a/libc/arch-arm/syscalls/read.S
+++ b/libc/arch-arm/syscalls/read.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type read, #function
-    .globl read
-    .align 4
-    .fnstart
-
-read:
+ENTRY(read)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_read
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(read)
diff --git a/libc/arch-arm/syscalls/readahead.S b/libc/arch-arm/syscalls/readahead.S
new file mode 100644
index 0000000..6aa8265
--- /dev/null
+++ b/libc/arch-arm/syscalls/readahead.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(readahead)
+    mov     ip, sp
+    .save   {r4, r5, r6, r7}
+    stmfd   sp!, {r4, r5, r6, r7}
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_readahead
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(readahead)
diff --git a/libc/arch-arm/syscalls/readlink.S b/libc/arch-arm/syscalls/readlink.S
index eb8ae8b..7602e61 100644
--- a/libc/arch-arm/syscalls/readlink.S
+++ b/libc/arch-arm/syscalls/readlink.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type readlink, #function
-    .globl readlink
-    .align 4
-    .fnstart
-
-readlink:
+ENTRY(readlink)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_readlink
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(readlink)
diff --git a/libc/arch-arm/syscalls/readv.S b/libc/arch-arm/syscalls/readv.S
index 045648f..e717e61 100644
--- a/libc/arch-arm/syscalls/readv.S
+++ b/libc/arch-arm/syscalls/readv.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type readv, #function
-    .globl readv
-    .align 4
-    .fnstart
-
-readv:
+ENTRY(readv)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_readv
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(readv)
diff --git a/libc/arch-arm/syscalls/recvfrom.S b/libc/arch-arm/syscalls/recvfrom.S
index 344b60d..df6302f 100644
--- a/libc/arch-arm/syscalls/recvfrom.S
+++ b/libc/arch-arm/syscalls/recvfrom.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type recvfrom, #function
-    .globl recvfrom
-    .align 4
-    .fnstart
-
-recvfrom:
+ENTRY(recvfrom)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(recvfrom)
diff --git a/libc/arch-arm/syscalls/recvmsg.S b/libc/arch-arm/syscalls/recvmsg.S
index 0b4b1be..5c168dc 100644
--- a/libc/arch-arm/syscalls/recvmsg.S
+++ b/libc/arch-arm/syscalls/recvmsg.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type recvmsg, #function
-    .globl recvmsg
-    .align 4
-    .fnstart
-
-recvmsg:
+ENTRY(recvmsg)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_recvmsg
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(recvmsg)
diff --git a/libc/arch-arm/syscalls/removexattr.S b/libc/arch-arm/syscalls/removexattr.S
new file mode 100644
index 0000000..1a44caf
--- /dev/null
+++ b/libc/arch-arm/syscalls/removexattr.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(removexattr)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_removexattr
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(removexattr)
diff --git a/libc/arch-arm/syscalls/rename.S b/libc/arch-arm/syscalls/rename.S
index 89f23b4..930ddb6 100644
--- a/libc/arch-arm/syscalls/rename.S
+++ b/libc/arch-arm/syscalls/rename.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type rename, #function
-    .globl rename
-    .align 4
-    .fnstart
-
-rename:
+ENTRY(rename)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_rename
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(rename)
diff --git a/libc/arch-arm/syscalls/renameat.S b/libc/arch-arm/syscalls/renameat.S
index 1807de7..a13c4ee 100644
--- a/libc/arch-arm/syscalls/renameat.S
+++ b/libc/arch-arm/syscalls/renameat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type renameat, #function
-    .globl renameat
-    .align 4
-    .fnstart
-
-renameat:
+ENTRY(renameat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_renameat
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(renameat)
diff --git a/libc/arch-arm/syscalls/rmdir.S b/libc/arch-arm/syscalls/rmdir.S
index ac2f4b7..09a956f 100644
--- a/libc/arch-arm/syscalls/rmdir.S
+++ b/libc/arch-arm/syscalls/rmdir.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type rmdir, #function
-    .globl rmdir
-    .align 4
-    .fnstart
-
-rmdir:
+ENTRY(rmdir)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_rmdir
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(rmdir)
diff --git a/libc/arch-arm/syscalls/sched_get_priority_max.S b/libc/arch-arm/syscalls/sched_get_priority_max.S
index e94ec93..2dea3b7 100644
--- a/libc/arch-arm/syscalls/sched_get_priority_max.S
+++ b/libc/arch-arm/syscalls/sched_get_priority_max.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_get_priority_max, #function
-    .globl sched_get_priority_max
-    .align 4
-    .fnstart
-
-sched_get_priority_max:
+ENTRY(sched_get_priority_max)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_get_priority_max
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_get_priority_max)
diff --git a/libc/arch-arm/syscalls/sched_get_priority_min.S b/libc/arch-arm/syscalls/sched_get_priority_min.S
index e2ae87e..de8b878 100644
--- a/libc/arch-arm/syscalls/sched_get_priority_min.S
+++ b/libc/arch-arm/syscalls/sched_get_priority_min.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_get_priority_min, #function
-    .globl sched_get_priority_min
-    .align 4
-    .fnstart
-
-sched_get_priority_min:
+ENTRY(sched_get_priority_min)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_get_priority_min
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_get_priority_min)
diff --git a/libc/arch-arm/syscalls/sched_getparam.S b/libc/arch-arm/syscalls/sched_getparam.S
index d9adddc..6434217 100644
--- a/libc/arch-arm/syscalls/sched_getparam.S
+++ b/libc/arch-arm/syscalls/sched_getparam.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_getparam, #function
-    .globl sched_getparam
-    .align 4
-    .fnstart
-
-sched_getparam:
+ENTRY(sched_getparam)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_getparam
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_getparam)
diff --git a/libc/arch-arm/syscalls/sched_getscheduler.S b/libc/arch-arm/syscalls/sched_getscheduler.S
index 2a070c1..8e45ce6 100644
--- a/libc/arch-arm/syscalls/sched_getscheduler.S
+++ b/libc/arch-arm/syscalls/sched_getscheduler.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_getscheduler, #function
-    .globl sched_getscheduler
-    .align 4
-    .fnstart
-
-sched_getscheduler:
+ENTRY(sched_getscheduler)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_getscheduler
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_getscheduler)
diff --git a/libc/arch-arm/syscalls/sched_rr_get_interval.S b/libc/arch-arm/syscalls/sched_rr_get_interval.S
index 7438953..e88d26e 100644
--- a/libc/arch-arm/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-arm/syscalls/sched_rr_get_interval.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_rr_get_interval, #function
-    .globl sched_rr_get_interval
-    .align 4
-    .fnstart
-
-sched_rr_get_interval:
+ENTRY(sched_rr_get_interval)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_rr_get_interval
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_rr_get_interval)
diff --git a/libc/arch-arm/syscalls/sched_setaffinity.S b/libc/arch-arm/syscalls/sched_setaffinity.S
index aedf8f3..b9dd299 100644
--- a/libc/arch-arm/syscalls/sched_setaffinity.S
+++ b/libc/arch-arm/syscalls/sched_setaffinity.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_setaffinity, #function
-    .globl sched_setaffinity
-    .align 4
-    .fnstart
-
-sched_setaffinity:
+ENTRY(sched_setaffinity)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_setaffinity
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_setaffinity)
diff --git a/libc/arch-arm/syscalls/sched_setparam.S b/libc/arch-arm/syscalls/sched_setparam.S
index 6f7f92d..73d6ab6 100644
--- a/libc/arch-arm/syscalls/sched_setparam.S
+++ b/libc/arch-arm/syscalls/sched_setparam.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_setparam, #function
-    .globl sched_setparam
-    .align 4
-    .fnstart
-
-sched_setparam:
+ENTRY(sched_setparam)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_setparam
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_setparam)
diff --git a/libc/arch-arm/syscalls/sched_setscheduler.S b/libc/arch-arm/syscalls/sched_setscheduler.S
index 11667c7..33c28ab 100644
--- a/libc/arch-arm/syscalls/sched_setscheduler.S
+++ b/libc/arch-arm/syscalls/sched_setscheduler.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_setscheduler, #function
-    .globl sched_setscheduler
-    .align 4
-    .fnstart
-
-sched_setscheduler:
+ENTRY(sched_setscheduler)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_setscheduler
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_setscheduler)
diff --git a/libc/arch-arm/syscalls/sched_yield.S b/libc/arch-arm/syscalls/sched_yield.S
index 6ff0141..71628b3 100644
--- a/libc/arch-arm/syscalls/sched_yield.S
+++ b/libc/arch-arm/syscalls/sched_yield.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sched_yield, #function
-    .globl sched_yield
-    .align 4
-    .fnstart
-
-sched_yield:
+ENTRY(sched_yield)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sched_yield
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sched_yield)
diff --git a/libc/arch-arm/syscalls/select.S b/libc/arch-arm/syscalls/select.S
index 0a0ce5d..edd77a3 100644
--- a/libc/arch-arm/syscalls/select.S
+++ b/libc/arch-arm/syscalls/select.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type select, #function
-    .globl select
-    .align 4
-    .fnstart
-
-select:
+ENTRY(select)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(select)
diff --git a/libc/arch-arm/syscalls/sendfile.S b/libc/arch-arm/syscalls/sendfile.S
index 0a1da4f..2790b4b 100644
--- a/libc/arch-arm/syscalls/sendfile.S
+++ b/libc/arch-arm/syscalls/sendfile.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sendfile, #function
-    .globl sendfile
-    .align 4
-    .fnstart
-
-sendfile:
+ENTRY(sendfile)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sendfile
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sendfile)
diff --git a/libc/arch-arm/syscalls/sendmsg.S b/libc/arch-arm/syscalls/sendmsg.S
index eac2d67..99b5479 100644
--- a/libc/arch-arm/syscalls/sendmsg.S
+++ b/libc/arch-arm/syscalls/sendmsg.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sendmsg, #function
-    .globl sendmsg
-    .align 4
-    .fnstart
-
-sendmsg:
+ENTRY(sendmsg)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sendmsg
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sendmsg)
diff --git a/libc/arch-arm/syscalls/sendto.S b/libc/arch-arm/syscalls/sendto.S
index 744891c..302ba8a 100644
--- a/libc/arch-arm/syscalls/sendto.S
+++ b/libc/arch-arm/syscalls/sendto.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sendto, #function
-    .globl sendto
-    .align 4
-    .fnstart
-
-sendto:
+ENTRY(sendto)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sendto)
diff --git a/libc/arch-arm/syscalls/setgid.S b/libc/arch-arm/syscalls/setgid.S
index fdd4ee6..f28687d 100644
--- a/libc/arch-arm/syscalls/setgid.S
+++ b/libc/arch-arm/syscalls/setgid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setgid, #function
-    .globl setgid
-    .align 4
-    .fnstart
-
-setgid:
+ENTRY(setgid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setgid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setgid)
diff --git a/libc/arch-arm/syscalls/setgroups.S b/libc/arch-arm/syscalls/setgroups.S
index cba9dfb..d2c932f 100644
--- a/libc/arch-arm/syscalls/setgroups.S
+++ b/libc/arch-arm/syscalls/setgroups.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setgroups, #function
-    .globl setgroups
-    .align 4
-    .fnstart
-
-setgroups:
+ENTRY(setgroups)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setgroups32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setgroups)
diff --git a/libc/arch-arm/syscalls/setitimer.S b/libc/arch-arm/syscalls/setitimer.S
index b4ad56c..c6b5064 100644
--- a/libc/arch-arm/syscalls/setitimer.S
+++ b/libc/arch-arm/syscalls/setitimer.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setitimer, #function
-    .globl setitimer
-    .align 4
-    .fnstart
-
-setitimer:
+ENTRY(setitimer)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setitimer
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setitimer)
diff --git a/libc/arch-arm/syscalls/setpgid.S b/libc/arch-arm/syscalls/setpgid.S
index 0ec98c6..39e1e03 100644
--- a/libc/arch-arm/syscalls/setpgid.S
+++ b/libc/arch-arm/syscalls/setpgid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setpgid, #function
-    .globl setpgid
-    .align 4
-    .fnstart
-
-setpgid:
+ENTRY(setpgid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setpgid
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setpgid)
diff --git a/libc/arch-arm/syscalls/setpriority.S b/libc/arch-arm/syscalls/setpriority.S
index fa4110a..5cb84a8 100644
--- a/libc/arch-arm/syscalls/setpriority.S
+++ b/libc/arch-arm/syscalls/setpriority.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setpriority, #function
-    .globl setpriority
-    .align 4
-    .fnstart
-
-setpriority:
+ENTRY(setpriority)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setpriority
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setpriority)
diff --git a/libc/arch-arm/syscalls/setregid.S b/libc/arch-arm/syscalls/setregid.S
index 53d9420..bc79e9e 100644
--- a/libc/arch-arm/syscalls/setregid.S
+++ b/libc/arch-arm/syscalls/setregid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setregid, #function
-    .globl setregid
-    .align 4
-    .fnstart
-
-setregid:
+ENTRY(setregid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setregid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setregid)
diff --git a/libc/arch-arm/syscalls/setresgid.S b/libc/arch-arm/syscalls/setresgid.S
index 0382913..711626e 100644
--- a/libc/arch-arm/syscalls/setresgid.S
+++ b/libc/arch-arm/syscalls/setresgid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setresgid, #function
-    .globl setresgid
-    .align 4
-    .fnstart
-
-setresgid:
+ENTRY(setresgid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setresgid32
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setresgid)
diff --git a/libc/arch-arm/syscalls/setrlimit.S b/libc/arch-arm/syscalls/setrlimit.S
index 0a5de48..0fe2467 100644
--- a/libc/arch-arm/syscalls/setrlimit.S
+++ b/libc/arch-arm/syscalls/setrlimit.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setrlimit, #function
-    .globl setrlimit
-    .align 4
-    .fnstart
-
-setrlimit:
+ENTRY(setrlimit)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setrlimit
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setrlimit)
diff --git a/libc/arch-arm/syscalls/setsid.S b/libc/arch-arm/syscalls/setsid.S
index e2b0615..f11b6fb 100644
--- a/libc/arch-arm/syscalls/setsid.S
+++ b/libc/arch-arm/syscalls/setsid.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setsid, #function
-    .globl setsid
-    .align 4
-    .fnstart
-
-setsid:
+ENTRY(setsid)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_setsid
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setsid)
diff --git a/libc/arch-arm/syscalls/setsockopt.S b/libc/arch-arm/syscalls/setsockopt.S
index 01f104f..7ca91dd 100644
--- a/libc/arch-arm/syscalls/setsockopt.S
+++ b/libc/arch-arm/syscalls/setsockopt.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type setsockopt, #function
-    .globl setsockopt
-    .align 4
-    .fnstart
-
-setsockopt:
+ENTRY(setsockopt)
     mov     ip, sp
     .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
@@ -18,4 +13,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(setsockopt)
diff --git a/libc/arch-arm/syscalls/settimeofday.S b/libc/arch-arm/syscalls/settimeofday.S
index 6f79041..2741e05 100644
--- a/libc/arch-arm/syscalls/settimeofday.S
+++ b/libc/arch-arm/syscalls/settimeofday.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type settimeofday, #function
-    .globl settimeofday
-    .align 4
-    .fnstart
-
-settimeofday:
+ENTRY(settimeofday)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_settimeofday
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(settimeofday)
diff --git a/libc/arch-arm/syscalls/setxattr.S b/libc/arch-arm/syscalls/setxattr.S
new file mode 100644
index 0000000..e86fe9f
--- /dev/null
+++ b/libc/arch-arm/syscalls/setxattr.S
@@ -0,0 +1,16 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(setxattr)
+    mov     ip, sp
+    .save   {r4, r5, r6, r7}
+    stmfd   sp!, {r4, r5, r6, r7}
+    ldmfd   ip, {r4, r5, r6}
+    ldr     r7, =__NR_setxattr
+    swi     #0
+    ldmfd   sp!, {r4, r5, r6, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(setxattr)
diff --git a/libc/arch-arm/syscalls/shutdown.S b/libc/arch-arm/syscalls/shutdown.S
index 5bec030..0802631 100644
--- a/libc/arch-arm/syscalls/shutdown.S
+++ b/libc/arch-arm/syscalls/shutdown.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type shutdown, #function
-    .globl shutdown
-    .align 4
-    .fnstart
-
-shutdown:
+ENTRY(shutdown)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_shutdown
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(shutdown)
diff --git a/libc/arch-arm/syscalls/sigaction.S b/libc/arch-arm/syscalls/sigaction.S
index 2696f1e..04a8b94 100644
--- a/libc/arch-arm/syscalls/sigaction.S
+++ b/libc/arch-arm/syscalls/sigaction.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sigaction, #function
-    .globl sigaction
-    .align 4
-    .fnstart
-
-sigaction:
+ENTRY(sigaction)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sigaction
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sigaction)
diff --git a/libc/arch-arm/syscalls/sigaltstack.S b/libc/arch-arm/syscalls/sigaltstack.S
index 3625d0b..b541a87 100644
--- a/libc/arch-arm/syscalls/sigaltstack.S
+++ b/libc/arch-arm/syscalls/sigaltstack.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sigaltstack, #function
-    .globl sigaltstack
-    .align 4
-    .fnstart
-
-sigaltstack:
+ENTRY(sigaltstack)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sigaltstack
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sigaltstack)
diff --git a/libc/arch-arm/syscalls/sigpending.S b/libc/arch-arm/syscalls/sigpending.S
index 58f565a..4c7d919 100644
--- a/libc/arch-arm/syscalls/sigpending.S
+++ b/libc/arch-arm/syscalls/sigpending.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sigpending, #function
-    .globl sigpending
-    .align 4
-    .fnstart
-
-sigpending:
+ENTRY(sigpending)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sigpending
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sigpending)
diff --git a/libc/arch-arm/syscalls/sigprocmask.S b/libc/arch-arm/syscalls/sigprocmask.S
index f157d76..7c59a6b 100644
--- a/libc/arch-arm/syscalls/sigprocmask.S
+++ b/libc/arch-arm/syscalls/sigprocmask.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sigprocmask, #function
-    .globl sigprocmask
-    .align 4
-    .fnstart
-
-sigprocmask:
+ENTRY(sigprocmask)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sigprocmask
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sigprocmask)
diff --git a/libc/arch-arm/syscalls/socket.S b/libc/arch-arm/syscalls/socket.S
index 93c9a53..e28d252 100644
--- a/libc/arch-arm/syscalls/socket.S
+++ b/libc/arch-arm/syscalls/socket.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type socket, #function
-    .globl socket
-    .align 4
-    .fnstart
-
-socket:
+ENTRY(socket)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_socket
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(socket)
diff --git a/libc/arch-arm/syscalls/socketpair.S b/libc/arch-arm/syscalls/socketpair.S
index 1bf07d6..e699000 100644
--- a/libc/arch-arm/syscalls/socketpair.S
+++ b/libc/arch-arm/syscalls/socketpair.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type socketpair, #function
-    .globl socketpair
-    .align 4
-    .fnstart
-
-socketpair:
+ENTRY(socketpair)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_socketpair
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(socketpair)
diff --git a/libc/arch-arm/syscalls/stat.S b/libc/arch-arm/syscalls/stat.S
index 46afcc5..a4669a6 100644
--- a/libc/arch-arm/syscalls/stat.S
+++ b/libc/arch-arm/syscalls/stat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type stat, #function
-    .globl stat
-    .align 4
-    .fnstart
-
-stat:
+ENTRY(stat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_stat64
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(stat)
diff --git a/libc/arch-arm/syscalls/symlink.S b/libc/arch-arm/syscalls/symlink.S
index 83b554e..14a753f 100644
--- a/libc/arch-arm/syscalls/symlink.S
+++ b/libc/arch-arm/syscalls/symlink.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type symlink, #function
-    .globl symlink
-    .align 4
-    .fnstart
-
-symlink:
+ENTRY(symlink)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_symlink
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(symlink)
diff --git a/libc/arch-arm/syscalls/sync.S b/libc/arch-arm/syscalls/sync.S
index 778d38e..68c0c0f 100644
--- a/libc/arch-arm/syscalls/sync.S
+++ b/libc/arch-arm/syscalls/sync.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sync, #function
-    .globl sync
-    .align 4
-    .fnstart
-
-sync:
+ENTRY(sync)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sync
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sync)
diff --git a/libc/arch-arm/syscalls/sysinfo.S b/libc/arch-arm/syscalls/sysinfo.S
index 197324d..2a2fb59 100644
--- a/libc/arch-arm/syscalls/sysinfo.S
+++ b/libc/arch-arm/syscalls/sysinfo.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type sysinfo, #function
-    .globl sysinfo
-    .align 4
-    .fnstart
-
-sysinfo:
+ENTRY(sysinfo)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_sysinfo
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(sysinfo)
diff --git a/libc/arch-arm/syscalls/times.S b/libc/arch-arm/syscalls/times.S
index c1ab0ce..aacb4ca 100644
--- a/libc/arch-arm/syscalls/times.S
+++ b/libc/arch-arm/syscalls/times.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type times, #function
-    .globl times
-    .align 4
-    .fnstart
-
-times:
+ENTRY(times)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_times
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(times)
diff --git a/libc/arch-arm/syscalls/truncate.S b/libc/arch-arm/syscalls/truncate.S
index 674c828..8c0b24f 100644
--- a/libc/arch-arm/syscalls/truncate.S
+++ b/libc/arch-arm/syscalls/truncate.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type truncate, #function
-    .globl truncate
-    .align 4
-    .fnstart
-
-truncate:
+ENTRY(truncate)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_truncate
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(truncate)
diff --git a/libc/arch-arm/syscalls/umask.S b/libc/arch-arm/syscalls/umask.S
index 6f18259..a7bc20b 100644
--- a/libc/arch-arm/syscalls/umask.S
+++ b/libc/arch-arm/syscalls/umask.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type umask, #function
-    .globl umask
-    .align 4
-    .fnstart
-
-umask:
+ENTRY(umask)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_umask
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(umask)
diff --git a/libc/arch-arm/syscalls/umount2.S b/libc/arch-arm/syscalls/umount2.S
index 659c3c0..04b28f4 100644
--- a/libc/arch-arm/syscalls/umount2.S
+++ b/libc/arch-arm/syscalls/umount2.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type umount2, #function
-    .globl umount2
-    .align 4
-    .fnstart
-
-umount2:
+ENTRY(umount2)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_umount2
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(umount2)
diff --git a/libc/arch-arm/syscalls/uname.S b/libc/arch-arm/syscalls/uname.S
index fda05e9..4a6f0f4 100644
--- a/libc/arch-arm/syscalls/uname.S
+++ b/libc/arch-arm/syscalls/uname.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type uname, #function
-    .globl uname
-    .align 4
-    .fnstart
-
-uname:
+ENTRY(uname)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_uname
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(uname)
diff --git a/libc/arch-arm/syscalls/unlink.S b/libc/arch-arm/syscalls/unlink.S
index 77ae9b7..87fa79e 100644
--- a/libc/arch-arm/syscalls/unlink.S
+++ b/libc/arch-arm/syscalls/unlink.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type unlink, #function
-    .globl unlink
-    .align 4
-    .fnstart
-
-unlink:
+ENTRY(unlink)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_unlink
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(unlink)
diff --git a/libc/arch-arm/syscalls/unlinkat.S b/libc/arch-arm/syscalls/unlinkat.S
index eb31e85..3beae6c 100644
--- a/libc/arch-arm/syscalls/unlinkat.S
+++ b/libc/arch-arm/syscalls/unlinkat.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type unlinkat, #function
-    .globl unlinkat
-    .align 4
-    .fnstart
-
-unlinkat:
+ENTRY(unlinkat)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_unlinkat
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(unlinkat)
diff --git a/libc/arch-arm/syscalls/utimensat.S b/libc/arch-arm/syscalls/utimensat.S
new file mode 100644
index 0000000..ceae7fa
--- /dev/null
+++ b/libc/arch-arm/syscalls/utimensat.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(utimensat)
+    .save   {r4, r7}
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =__NR_utimensat
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+    bxpl    lr
+    b       __set_syscall_errno
+END(utimensat)
diff --git a/libc/arch-arm/syscalls/utimes.S b/libc/arch-arm/syscalls/utimes.S
index 19fe8e2..a2d58a3 100644
--- a/libc/arch-arm/syscalls/utimes.S
+++ b/libc/arch-arm/syscalls/utimes.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type utimes, #function
-    .globl utimes
-    .align 4
-    .fnstart
-
-utimes:
+ENTRY(utimes)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_utimes
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(utimes)
diff --git a/libc/arch-arm/syscalls/vfork.S b/libc/arch-arm/syscalls/vfork.S
index e141761..3bd2668 100644
--- a/libc/arch-arm/syscalls/vfork.S
+++ b/libc/arch-arm/syscalls/vfork.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type vfork, #function
-    .globl vfork
-    .align 4
-    .fnstart
-
-vfork:
+ENTRY(vfork)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_vfork
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(vfork)
diff --git a/libc/arch-arm/syscalls/write.S b/libc/arch-arm/syscalls/write.S
index 06df33d..826e82c 100644
--- a/libc/arch-arm/syscalls/write.S
+++ b/libc/arch-arm/syscalls/write.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type write, #function
-    .globl write
-    .align 4
-    .fnstart
-
-write:
+ENTRY(write)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_write
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(write)
diff --git a/libc/arch-arm/syscalls/writev.S b/libc/arch-arm/syscalls/writev.S
index a6b04db..16a6df9 100644
--- a/libc/arch-arm/syscalls/writev.S
+++ b/libc/arch-arm/syscalls/writev.S
@@ -1,13 +1,8 @@
 /* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type writev, #function
-    .globl writev
-    .align 4
-    .fnstart
-
-writev:
+ENTRY(writev)
     .save   {r4, r7}
     stmfd   sp!, {r4, r7}
     ldr     r7, =__NR_writev
@@ -16,4 +11,4 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
+END(writev)
diff --git a/libc/arch-sh/bionic/__get_pc.S b/libc/arch-sh/bionic/__get_pc.S
deleted file mode 100644
index 155b387..0000000
--- a/libc/arch-sh/bionic/__get_pc.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-.text
-.type   __get_pc, @function
-.globl  __get_pc
-.align  4
-
-__get_pc:
-    mova    1f, r0
-    rts
-1:  nop
-
diff --git a/libc/arch-sh/bionic/__get_tls.c b/libc/arch-sh/bionic/__get_tls.c
deleted file mode 100644
index 8a5e4ff..0000000
--- a/libc/arch-sh/bionic/__get_tls.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-/* see the implementation of __set_tls and pthread.c to understand this
- * code. Basically, the content of fs:[0] always is a pointer to the base
- * address of the tls region
- */
-void *__get_tls(void)
-{
-    void *tls;
-    asm volatile("stc gbr, %0" : "=r"(tls));
-    return tls;
-}
diff --git a/libc/arch-sh/bionic/__set_tls.c b/libc/arch-sh/bionic/__set_tls.c
deleted file mode 100644
index 7f863de..0000000
--- a/libc/arch-sh/bionic/__set_tls.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#include <pthread.h>
-
-/*
- * Simply set tls address into GBR.
- */
-int __set_tls(void *ptr)
-{
-    asm volatile("ldc %0, gbr" : /* no output */ : "r" (ptr));
-    return 0;
-}
diff --git a/libc/arch-sh/bionic/_exit_with_stack_teardown.S b/libc/arch-sh/bionic/_exit_with_stack_teardown.S
deleted file mode 100644
index 6356eb6..0000000
--- a/libc/arch-sh/bionic/_exit_with_stack_teardown.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#include <asm/unistd.h>
-
-.text
-.type   _exit_with_stack_teardown, @function
-.globl  _exit_with_stack_teardown
-.align  4
-
-# void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode)
-
-_exit_with_stack_teardown:
-    mov     r6, r8      /* save retCode : breaks r8 value */
-    mov.l   0f, r3      /* system call number */
-    trapa   #(2 + 0x10) /* invoke system call with num of args */
-
-    mov     r8, r4      /* restore retCode */
-    mov.l   1f, r3      /* system call number */
-    trapa   #(1 + 0x10) /* invoke system call with num of args */
-
-    /* exit() should never return, cause a crash if it does */
-    mov     #0, r0
-    mov.l   @r0, r0
-
-    .align  2
-0:  .long   __NR_munmap
-1:  .long   __NR_exit
diff --git a/libc/arch-sh/bionic/_setjmp.S b/libc/arch-sh/bionic/_setjmp.S
deleted file mode 100644
index a04fcb6..0000000
--- a/libc/arch-sh/bionic/_setjmp.S
+++ /dev/null
@@ -1,125 +0,0 @@
-/*	$OpenBSD: _setjmp.S,v 1.2 2007/03/02 06:11:54 miod Exp $	*/
-/*	$NetBSD: _setjmp.S,v 1.7 2006/01/05 02:04:41 uwe Exp $	*/
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	from: @(#)_setjmp.s	5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-#include <machine/setjmp.h>
-
-/*
- * C library -- _setjmp, _longjmp
- *
- *	_longjmp(a,v)
- * will generate a "return(v)" from the last call to
- *	_setjmp(a)
- * by restoring registers from the stack.
- * The previous signal state is NOT restored.
- */
-
-ENTRY(_setjmp)
-	xor	r0,	r0
-#if defined(__SH4__) && !defined(__SH4_NOFPU__)
-	add	#(_JBLEN * 4), r4
-	sts	fpscr,	r1
-	mov.l	r1,	@-r4
-	lds	r0,	fpscr
-	sts.l	fpul,	@-r4
-	fmov.s	fr15,	@-r4
-	fmov.s	fr14,	@-r4
-	fmov.s	fr13,	@-r4
-	fmov.s	fr12,	@-r4
-	frchg
-	fmov.s	fr15,	@-r4
-	fmov.s	fr14,	@-r4
-	fmov.s	fr13,	@-r4
-	fmov.s	fr12,	@-r4
-	lds	r1,	fpscr
-#else
-	add	#((_JBLEN - 10) * 4), r4
-#endif
-	sts.l	mach,	@-r4
-	sts.l	macl,	@-r4
-	mov.l	r15,	@-r4
-	mov.l	r14,	@-r4
-	mov.l	r13,	@-r4
-	mov.l	r12,	@-r4
-	mov.l	r11,	@-r4
-	mov.l	r10,	@-r4
-	mov.l	r9,	@-r4
-	mov.l	r8,	@-r4
-	sts.l	pr,	@-r4
-	mov.l	r0,	@-r4		/* dummy signal mask */
-	rts
-	 mov.l	r0,	@-r4		/* no saved signal mask */
-	SET_ENTRY_SIZE(_setjmp)
-
-ENTRY(_longjmp)
-	add	#8,	r4
-	lds.l	@r4+,	pr
-	mov.l	@r4+,	r8
-	mov.l	@r4+,	r9
-	mov.l	@r4+,	r10
-	mov.l	@r4+,	r11
-	mov.l	@r4+,	r12
-	mov.l	@r4+,	r13
-	mov.l	@r4+,	r14
-	mov.l	@r4+,	r15
-	lds.l	@r4+,	macl
-	lds.l	@r4+,	mach
-#if defined(__SH4__) && !defined(__SH4_NOFPU__)
-	xor	r0, 	r0
-	lds	r0,	fpscr
-	frchg
-	fmov.s	@r4+,	fr12
-	fmov.s	@r4+,	fr13
-	fmov.s	@r4+,	fr14
-	fmov.s	@r4+,	fr15
-	frchg
-	fmov.s	@r4+,	fr12
-	fmov.s	@r4+,	fr13
-	fmov.s	@r4+,	fr14
-	fmov.s	@r4+,	fr15
-	lds.l	@r4+,	fpul
-	lds.l	@r4+,	fpscr
-#endif
-
-	mov	r5,	r0
-	tst	r0,	r0
-	bf	.L0
-	add	#1,	r0
-.L0:
-	rts
-	 nop
-	SET_ENTRY_SIZE(_longjmp)
diff --git a/libc/arch-sh/bionic/atomic_cmpxchg.S b/libc/arch-sh/bionic/atomic_cmpxchg.S
deleted file mode 100644
index 4ccd6cf..0000000
--- a/libc/arch-sh/bionic/atomic_cmpxchg.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-.text
-.type   __atomic_cmpxchg, @function
-.globl  __atomic_cmpxchg
-.align 4
-
-__atomic_cmpxchg:
-    mova    1f, r0
-    nop
-    mov     r15, r1
-    mov     #-8, r15    /* critical region start */
-0:  mov.l   @r6, r2
-    cmp/eq  r2, r4
-    bt      not_yet_modified
-    mov     #1, r0
-    bra     done
-    nop
-not_yet_modified:
-    mov     #0, r0
-    mov.l   r5, @r6
-done:
-1:  mov     r1, r15     /* critical region end */
-    rts
-    nop
diff --git a/libc/arch-sh/bionic/atomics_sh.c b/libc/arch-sh/bionic/atomics_sh.c
deleted file mode 100644
index c7815ff..0000000
--- a/libc/arch-sh/bionic/atomics_sh.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-
-#include <pthread.h>
-#include <linux/futex.h>
-
-#define  SWAP_LOCK_COUNT  32U
-static pthread_mutex_t  _swap_locks[SWAP_LOCK_COUNT];
-
-#define  SWAP_LOCK(addr)   \
-   &_swap_locks[((unsigned)(void *)(addr) >> 3U) % SWAP_LOCK_COUNT]
-
-#if 0
-/*
- * Only this function is moved to atomic_cmpxchg.S, and
- * implemented with gUSA framework.
- */
-int __atomic_cmpxchg(int old, int _new, volatile int *ptr)
-{
-    int result;
-    pthread_mutex_t *lock = SWAP_LOCK(ptr);
-
-    pthread_mutex_lock(lock);
-
-    if (*ptr == old) {
-        *ptr  = _new;
-        result = 0;
-    } else {
-        result = 1;
-    }
-    pthread_mutex_unlock(lock);
-    return result;
-}
-#else
-extern int __atomic_cmpxchg(int old, int _new, volatile int *ptr);
-#endif
-
-int __atomic_swap(int _new, volatile int *ptr)
-{
-    int oldValue;
-    do {
-        oldValue = *ptr;
-    } while (__atomic_cmpxchg(oldValue, _new, ptr));
-    return oldValue;
-}
-
-int __atomic_dec(volatile int *ptr)
-{
-    int oldValue;
-    do {
-        oldValue = *ptr;
-    } while (__atomic_cmpxchg(oldValue, oldValue-1, ptr));
-    return oldValue;
-}
-
-int __atomic_inc(volatile int *ptr)
-{
-    int32_t oldValue;
-    do {
-        oldValue = *ptr;
-    } while (__atomic_cmpxchg(oldValue, oldValue+1, ptr));
-    return oldValue;
-}
-
-extern int futex(volatile void *, int, int, void *, void *, int);
-
-int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
-{
-    return futex(ftx, FUTEX_WAIT, val, (void *)timeout, NULL, 0);
-}
-
-int __futex_wake(volatile void *ftx, int count)
-{
-    return futex(ftx, FUTEX_WAKE, count, NULL, NULL, 0);
-}
-
-int __futex_syscall3(volatile void *ftx, int op, int val)
-{
-    return futex(ftx, op, val, NULL, NULL, 0);
-}
-
-int __futex_syscall4(volative void *ftx, int op, int val, const struct timespec *timeout)
-{
-    return futex(ftx, op, val, (void *)timeout, NULL, 0);
-}
diff --git a/libc/arch-sh/bionic/bzero.S b/libc/arch-sh/bionic/bzero.S
deleted file mode 100644
index ca8bed4..0000000
--- a/libc/arch-sh/bionic/bzero.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#define BZERO
-#include "memset.S"
diff --git a/libc/arch-sh/bionic/clone.S b/libc/arch-sh/bionic/clone.S
deleted file mode 100644
index 9cb19ee..0000000
--- a/libc/arch-sh/bionic/clone.S
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#include <sys/linux-syscalls.h>
-
-.text
-.type   __pthread_clone, @function
-.globl  __pthread_clone
-.align  4
-
-__pthread_clone:
-    /* insert the args onto the new stack */
-    mov     r5, r0
-    mov.l   r4, @-r0    /* func */
-    mov.l   r7, @-r0    /* arg */
-
-    /* do the system call */
-    mov     r6, r4      /* Set clone_flags. new sp is ready in r5. */
-    mov.l   0f, r3
-    trapa   #(4 + 0x10)
-
-    /* check error */
-    cmp/pz  r0
-    bf      __error
-
-    /* check if parent or child */
-    cmp/pl  r0
-    bt      __return
-
-    /* prepare args for __thread_entry */
-    mov     #8, r1
-    sub     r1, r15     /* -8 */
-    mov.l   @r15+, r5   /* +4 */ /* arg */
-    mov.l   @r15+, r4   /* +4 */ /* func */
-    mov     r15, r6              /* tls */
-
-    /* jump to __thread_entry */
-    mov.l   1f, r0
-    jmp @r0
-    nop
-
-__error:
-    mov     #-1, r0
-__return:
-    rts
-    nop
-
-    .align 2
-0:  .long   __NR_clone
-1:  .long   __thread_entry
-
-/* XXX: TODO: Add __bionic_clone here
- *            See bionic/bionic_clone.c and arch-arm/bionic/clone.S
- *            for more details...
- */
\ No newline at end of file
diff --git a/libc/arch-sh/bionic/crtbegin_dynamic.S b/libc/arch-sh/bionic/crtbegin_dynamic.S
deleted file mode 100644
index daf6c8b..0000000
--- a/libc/arch-sh/bionic/crtbegin_dynamic.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2009-2010 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-.text
-.align  4
-.type   _start,#function
-.globl  _start
-
-# this is the small startup code that is first run when
-# any executable that is dynamically-linked with Bionic
-# runs.
-#
-# it's purpose is to call __libc_init with appropriate
-# arguments, which are:
-#
-#    - the address of the raw data block setup by the Linux
-#      kernel ELF loader
-#
-#    - address of an "onexit" function, not used on any
-#      platform supported by Bionic
-#
-#    - address of the "main" function of the program. We
-#      can't hard-code it in the adr pseudo instruction
-#      so we use a tiny trampoline that will get relocated
-#      by the dynamic linker before this code runs
-#
-#    - address of the constructor list
-#
-_start:
-    mov     r15, r4
-    mov     #0, r5
-    mov.l   0f, r6
-    mova    2f, r0
-    mov     r0, r7
-    mov.l   1f, r0
-    jmp     @r0
-    nop
-
-    .balign 4
-0:  .long   main
-1:  .long   __libc_init
-2:  .long   __PREINIT_ARRAY__
-    .long   __INIT_ARRAY__
-    .long   __FINI_ARRAY__
-    .long   __CTOR_LIST__
-
-# the .ctors section contains a list of pointers to "constructor"
-# functions that need to be called in order during C library initialization,
-# just before the program is being run. This is a C++ requirement
-#
-# the last entry shall be 0, and is defined in crtend.S
-#
-    .section .preinit_array, "aw"
-    .globl __PREINIT_ARRAY__
-__PREINIT_ARRAY__:
-    .long -1
-
-    .section .init_array, "aw"
-    .globl __INIT_ARRAY__
-__INIT_ARRAY__:
-    .long -1
-
-    .section .fini_array, "aw"
-    .globl __FINI_ARRAY__
-__FINI_ARRAY__:
-    .long -1
-
-    .section .ctors, "aw"
-    .globl __CTOR_LIST__
-__CTOR_LIST__:
-    .long -1
-
-#include "__dso_handle.S"
diff --git a/libc/arch-sh/bionic/crtbegin_static.S b/libc/arch-sh/bionic/crtbegin_static.S
deleted file mode 100644
index 1d3fdf8..0000000
--- a/libc/arch-sh/bionic/crtbegin_static.S
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2009-2010 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-.text
-.align  4
-.type   _start,#function
-.globl  _start
-
-# this is the small startup code that is first run when
-# any executable that is statically-linked with Bionic
-# runs.
-#
-# it's purpose is to call __libc_init with appropriate
-# arguments, which are:
-#
-#    - the address of the raw data block setup by the Linux
-#      kernel ELF loader
-#
-#    - address of an "onexit" function, not used on any
-#      platform supported by Bionic
-#
-#    - address of the "main" function of the program. We
-#      can't hard-code it in the adr pseudo instruction
-#      so we use a tiny trampoline that will get relocated
-#      by the dynamic linker before this code runs
-#
-#    - address of the constructor list
-#
-_start:
-    mov     r15, r4
-    mov     #0, r5
-    mov.l   0f, r6
-    mova    2f, r0
-    mov     r0, r7
-    mov.l   1f, r0
-    jmp     @r0
-    nop
-
-    .balign 4
-0:  .long   main
-1:  .long   __libc_init
-2:  .long   __PREINIT_ARRAY__
-    .long   __INIT_ARRAY__
-    .long   __FINI_ARRAY__
-    .long   __CTOR_LIST__
-
-    .section .preinit_array, "aw"
-    .globl __PREINIT_ARRAY__
-__PREINIT_ARRAY__:
-    .long -1
-
-    .section .init_array, "aw"
-    .globl __INIT_ARRAY__
-__INIT_ARRAY__:
-    .long -1
-
-    .section .fini_array, "aw"
-    .globl __FINI_ARRAY__
-__FINI_ARRAY__:
-    .long -1
-
-    .section .ctors, "aw"
-    .globl __CTOR_LIST__
-__CTOR_LIST__:
-    .long -1
-
-#include "__dso_handle.S"
diff --git a/libc/arch-sh/bionic/crtend.S b/libc/arch-sh/bionic/crtend.S
deleted file mode 100644
index 4ced3aa..0000000
--- a/libc/arch-sh/bionic/crtend.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-
-    .section .preinit_array, "aw"
-    .long 0
-
-    .section .init_array, "aw"
-    .long 0
-
-    .section .fini_array, "aw"
-    .long 0
-
-    .section .ctors, "aw"
-    .long 0
diff --git a/libc/arch-sh/bionic/ffs.S b/libc/arch-sh/bionic/ffs.S
deleted file mode 100644
index 733694b..0000000
--- a/libc/arch-sh/bionic/ffs.S
+++ /dev/null
@@ -1,103 +0,0 @@
-/*	$NetBSD: ffs.S,v 1.1 2005/12/20 19:28:50 christos Exp $	*/
-
-/*-
- * Copyright (c) 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by ITOH Yasufumi.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the NetBSD
- *	Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
-	RCSID("$NetBSD: ffs.S,v 1.1 2005/12/20 19:28:50 christos Exp $")
-#endif
-
-/*
- * ffs - find first bit set
- *
- * This code makes use of ``test 8bit'' and ``shift 8bit'' instructions.
- * The remaining 8bit is tested in every 2bit.
- */
-
-ENTRY(ffs)
-	mov	r4,r0		! using r0 specific instructions
-	tst	#0xff,r0
-	bf/s	L8bit
-	mov	#0+1,r1		! ret = 1..8
-
-	tst	r0,r0		! ffs(0) is 0
-	bt	Lzero		! testing here to accelerate ret=1..8 cases
-
-	shlr8	r0
-	tst	#0xff,r0
-	bf/s	L8bit
-	mov	#8+1,r1		! ret = 9..16
-
-	shlr8	r0
-	tst	#0xff,r0
-	bf/s	L8bit
-	mov	#16+1,r1	! ret = 17..24
-
-	shlr8	r0
-	mov	#24+1,r1	! ret = 25..32
-
-L8bit:
-	tst	#0x0f,r0
-	bt	4f
-
-	tst	#0x03,r0
-	bt	2f
-	tst	#0x01,r0	! not bit 0 -> T
-	mov	#0,r0
-	rts
-	 addc	r1,r0		! 0 + r1 + T -> r0
-
-2:	tst	#0x04,r0
-	mov	#2,r0
-	rts
-	 addc	r1,r0
-
-4:	tst	#0x30,r0
-	bt	6f
-	tst	#0x10,r0
-	mov	#4,r0
-	rts
-	 addc	r1,r0
-
-6:	tst	#0x40,r0
-	mov	#6,r0
-	rts
-	 addc	r1,r0
-
-Lzero:	rts
-	 nop
diff --git a/libc/arch-sh/bionic/memcpy.S b/libc/arch-sh/bionic/memcpy.S
deleted file mode 100644
index 9d1b897..0000000
--- a/libc/arch-sh/bionic/memcpy.S
+++ /dev/null
@@ -1,268 +0,0 @@
-/*	$OpenBSD: memcpy.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $	*/
-/*	$NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $	*/
-
-/*
- * Copyright (c) 2000 SHIMIZU Ryo <ryo@misakimix.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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-#include <machine/asm.h>
-
-#if !defined(MEMCOPY) && !defined(MEMMOVE) && !defined(BCOPY)
-#define MEMCOPY
-#endif
-
-#if defined(MEMCOPY) || defined(MEMMOVE)
-#define	REG_DST0	r3
-#define	REG_SRC		r5
-#define	REG_DST		r4
-#else
-#define	REG_SRC		r4
-#define	REG_DST		r5
-#endif
-
-#define	REG_LEN		r6
-
-#if defined(MEMCOPY)
-ENTRY(memcpy)
-#elif defined(MEMMOVE)
-ENTRY(memmove)
-#elif defined(BCOPY)
-ENTRY(bcopy)
-#endif
-#ifdef REG_DST0
-	mov	REG_DST,REG_DST0
-#endif
-	cmp/eq	REG_DST,REG_SRC	/* if ( src == dst ) return; */
-	bt/s	bcopy_return
-	cmp/hi	REG_DST,REG_SRC
-	bf/s	bcopy_overlap
-
-	mov	REG_SRC,r0
-	xor	REG_DST,r0
-	and	#3,r0
-	mov	r0,r1
-	tst	r0,r0		/* (src ^ dst) & 3         */
-	bf/s	word_align
-
-longword_align:
-	tst	REG_LEN,REG_LEN	/* if ( len==0 ) return;   */
-	bt/s	bcopy_return
-
-
-	mov	REG_SRC,r0
-	tst	#1,r0		/* if ( src & 1 )          */
-	bt	1f
-	mov.b	@REG_SRC+,r0	/*    *dst++ = *src++;     */
-	add	#-1,REG_LEN
-	mov.b	r0,@REG_DST
-	add	#1,REG_DST
-1:
-
-
-	mov	#1,r0
-	cmp/hi	r0,REG_LEN	/* if ( (len > 1) &&       */
-	bf/s	1f
-	mov	REG_SRC,r0
-	tst	#2,r0		/*      (src & 2) {        */
-	bt	1f
-	mov.w	@REG_SRC+,r0	/*        *((unsigned short*)dst)++ = *((unsigned short*)src)++; */
-	add	#-2,REG_LEN	/*        len -= 2;                                              */
-	mov.w	r0,@REG_DST
-	add	#2,REG_DST	/* }                       */
-1:
-
-
-	mov	#3,r1
-	cmp/hi	r1,REG_LEN	/* while ( len > 3 ) {     */
-	bf/s	no_align_delay
-	tst	REG_LEN,REG_LEN
-2:
-	mov.l	@REG_SRC+,r0	/*   *((unsigned long*)dst)++ = *((unsigned long*)src)++;        */
-	add	#-4,REG_LEN	/*   len -= 4;                                                   */
-	mov.l	r0,@REG_DST
-	cmp/hi	r1,REG_LEN
-	bt/s	2b
-	add	#4,REG_DST	/* }                       */
-
-	bra	no_align_delay
-	tst	REG_LEN,REG_LEN
-
-
-word_align:
-	mov	r1,r0
-	tst	#1,r0
-	bf/s	no_align_delay
-	tst	REG_LEN,REG_LEN	/* if ( len == 0 ) return; */
-	bt	bcopy_return
-
-
-	mov	REG_SRC,r0	/* if ( src & 1 )          */
-	tst	#1,r0
-	bt	1f
-	mov.b	@REG_SRC+,r0	/*    *dst++ = *src++;     */
-	add	#-1,REG_LEN
-	mov.b	r0,@REG_DST
-	add	#1,REG_DST
-1:
-
-
-	mov	#1,r1
-	cmp/hi	r1,REG_LEN	/* while ( len > 1 ) {     */
-	bf/s	no_align_delay
-	tst	REG_LEN,REG_LEN
-2:
-	mov.w	@REG_SRC+,r0	/*   *((unsigned short*)dst)++ = *((unsigned short*)src)++;      */
-	add	#-2,REG_LEN	/*   len -= 2;                                                   */
-	mov.w	r0,@REG_DST
-	cmp/hi	r1,REG_LEN
-	bt/s	2b
-	add	#2,REG_DST	/* }                       */
-
-
-no_align:
-	tst	REG_LEN,REG_LEN	/* while ( len!= ) {       */
-no_align_delay:
-	bt	bcopy_return
-1:
-	mov.b	@REG_SRC+,r0	/*    *dst++ = *src++;     */
-	add	#-1,REG_LEN	/*    len--;               */
-	mov.b	r0,@REG_DST
-	tst	REG_LEN,REG_LEN
-	bf/s	1b
-	add	#1,REG_DST	/* }                       */
-bcopy_return:
-	rts
-#ifdef REG_DST0
-	mov	REG_DST0,r0
-#else
-	nop
-#endif
-
-
-bcopy_overlap:
-	add	REG_LEN,REG_SRC
-	add	REG_LEN,REG_DST
-
-	mov	REG_SRC,r0
-	xor	REG_DST,r0
-	and	#3,r0
-	mov	r0,r1
-	tst	r0,r0		/* (src ^ dst) & 3         */
-	bf/s	ov_word_align
-
-ov_longword_align:
-	tst	REG_LEN,REG_LEN	/* if ( len==0 ) return;   */
-	bt/s	bcopy_return
-
-
-	mov	REG_SRC,r0
-	tst	#1,r0		/* if ( src & 1 )          */
-	bt	1f
-	add	#-1,REG_SRC	/*    *--dst = *--src;     */
-	mov.b	@REG_SRC,r0
-	mov.b	r0,@-REG_DST
-	add	#-1,REG_LEN
-1:
-
-
-	mov	#1,r0
-	cmp/hi	r0,REG_LEN	/* if ( (len > 1) &&       */
-	bf/s	1f
-	mov	REG_SRC,r0
-	tst	#2,r0		/*      (src & 2) {        */
-	bt	1f
-	add	#-2,REG_SRC	/*        *--((unsigned short*)dst) = *--((unsigned short*)src); */
-	mov.w	@REG_SRC,r0
-	add	#-2,REG_LEN	/*        len -= 2;                                              */
-	mov.w	r0,@-REG_DST	/* }                       */
-1:
-
-
-	mov	#3,r1
-	cmp/hi	r1,REG_LEN	/* while ( len > 3 ) {     */
-	bf/s	ov_no_align_delay
-	tst	REG_LEN,REG_LEN
-2:
-	add	#-4,REG_SRC
-	mov.l	@REG_SRC,r0	/*   *((unsigned long*)dst)++ = *((unsigned long*)src)++;        */
-	add	#-4,REG_LEN	/*   len -= 4;                                                   */
-	cmp/hi	r1,REG_LEN
-	bt/s	2b
-	mov.l	r0,@-REG_DST	/* }                       */
-
-	bra	ov_no_align_delay
-	tst	REG_LEN,REG_LEN
-
-
-ov_word_align:
-	mov	r1,r0
-	tst	#1,r0
-	bf/s	ov_no_align_delay
-	tst	REG_LEN,REG_LEN	/* if ( len == 0 ) return; */
-	bt	bcopy_return
-
-
-	mov	REG_SRC,r0	/* if ( src & 1 )          */
-	tst	#1,r0
-	bt	1f
-	add	#-1,REG_SRC
-	mov.b	@REG_SRC,r0	/*    *--dst = *--src;     */
-	add	#-1,REG_LEN
-	mov.b	r0,@-REG_DST
-1:
-
-
-	mov	#1,r1
-	cmp/hi	r1,REG_LEN	/* while ( len > 1 ) {     */
-	bf/s	ov_no_align_delay
-	tst	REG_LEN,REG_LEN
-2:
-	add	#-2,REG_SRC
-	mov.w	@REG_SRC,r0	/*   *--((unsigned short*)dst) = *--((unsigned short*)src);      */
-	add	#-2,REG_LEN	/*   len -= 2;                                                   */
-	cmp/hi	r1,REG_LEN
-	bt/s	2b
-	mov.w	r0,@-REG_DST	/* }                       */
-
-
-ov_no_align:
-	tst	REG_LEN,REG_LEN	/* while ( len!= ) {       */
-ov_no_align_delay:
-	bt	9f
-1:
-	add	#-1,REG_SRC
-	mov.b	@REG_SRC,r0	/*    *--dst = *--src;     */
-	add	#-1,REG_LEN	/*    len--;               */
-	tst	REG_LEN,REG_LEN
-	bf/s	1b
-	mov.b	r0,@-REG_DST	/* }                       */
-9:
-	rts
-#ifdef REG_DST0
-	mov	REG_DST0,r0
-#else
-	nop
-#endif
diff --git a/libc/arch-sh/bionic/memmove.S b/libc/arch-sh/bionic/memmove.S
deleted file mode 100644
index 023fc10..0000000
--- a/libc/arch-sh/bionic/memmove.S
+++ /dev/null
@@ -1,5 +0,0 @@
-/*	$OpenBSD: memmove.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $	*/
-/*	$NetBSD: memmove.S,v 1.2 2006/04/22 23:53:47 uwe Exp $	*/
-
-#define MEMMOVE
-#include "memcpy.S"
diff --git a/libc/arch-sh/bionic/memset.S b/libc/arch-sh/bionic/memset.S
deleted file mode 100644
index 73b0d06..0000000
--- a/libc/arch-sh/bionic/memset.S
+++ /dev/null
@@ -1,295 +0,0 @@
-/*	$OpenBSD: memset.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $	*/
-/*	$NetBSD: memset.S,v 1.1 2005/12/20 19:28:50 christos Exp $	*/
-
-/*-
- * Copyright (c) 2002 SHIMIZU Ryo.  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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- */
-
-#include <machine/asm.h>
-
-#define	REG_PTR				r0
-#define	REG_TMP1			r1
-
-#ifdef BZERO
-# define	REG_C			r2
-# define	REG_DST			r4
-# define	REG_LEN			r5
-#else
-# define	REG_DST0		r3
-# define	REG_DST			r4
-# define	REG_C			r5
-# define	REG_LEN			r6
-#endif
-
-#ifdef BZERO
-ENTRY(bzero)
-#else
-ENTRY(memset)
-	mov	REG_DST,REG_DST0	/* for return value */
-#endif
-	/* small amount to fill ? */
-	mov	#28,REG_TMP1
-	cmp/hs	REG_TMP1,REG_LEN	/* if (len >= 28) goto large; */
-	bt/s	large
-	mov	#12,REG_TMP1		/* if (len >= 12) goto small; */
-	cmp/hs	REG_TMP1,REG_LEN
-	bt/s	small
-#ifdef BZERO
-	mov	#0,REG_C
-#endif
-	/* very little fill (0 ~ 11 bytes) */
-	tst	REG_LEN,REG_LEN
-	add	REG_DST,REG_LEN
-	bt/s	done
-	add	#1,REG_DST
-
-	/* unroll 4 loops */
-	cmp/eq	REG_DST,REG_LEN
-1:	mov.b	REG_C,@-REG_LEN
-	bt/s	done
-	cmp/eq	REG_DST,REG_LEN
-	mov.b	REG_C,@-REG_LEN
-	bt/s	done
-	cmp/eq	REG_DST,REG_LEN
-	mov.b	REG_C,@-REG_LEN
-	bt/s	done
-	cmp/eq	REG_DST,REG_LEN
-	mov.b	REG_C,@-REG_LEN
-	bf/s	1b
-	cmp/eq	REG_DST,REG_LEN
-done:
-#ifdef BZERO
-	rts
-	nop
-#else
-	rts
-	mov	REG_DST0,r0
-#endif
-
-
-small:
-	mov	REG_DST,r0
-	tst	#1,r0
-	bt/s	small_aligned
-	mov	REG_DST,REG_TMP1
-	shll	REG_LEN
-	mova	1f,r0			/* 1f must be 4bytes aligned! */
-	add	#16,REG_TMP1		/* REG_TMP1 = dst+16; */
-	sub	REG_LEN,r0
-	jmp	@r0
-	mov	REG_C,r0
-
-	.align	2
-	mov.b	r0,@(15,REG_TMP1)
-	mov.b	r0,@(14,REG_TMP1)
-	mov.b	r0,@(13,REG_TMP1)
-	mov.b	r0,@(12,REG_TMP1)
-	mov.b	r0,@(11,REG_TMP1)
-	mov.b	r0,@(10,REG_TMP1)
-	mov.b	r0,@(9,REG_TMP1)
-	mov.b	r0,@(8,REG_TMP1)
-	mov.b	r0,@(7,REG_TMP1)
-	mov.b	r0,@(6,REG_TMP1)
-	mov.b	r0,@(5,REG_TMP1)
-	mov.b	r0,@(4,REG_TMP1)
-	mov.b	r0,@(3,REG_TMP1)
-	mov.b	r0,@(2,REG_TMP1)
-	mov.b	r0,@(1,REG_TMP1)
-	mov.b	r0,@REG_TMP1
-	mov.b	r0,@(15,REG_DST)
-	mov.b	r0,@(14,REG_DST)
-	mov.b	r0,@(13,REG_DST)
-	mov.b	r0,@(12,REG_DST)
-	mov.b	r0,@(11,REG_DST)
-	mov.b	r0,@(10,REG_DST)
-	mov.b	r0,@(9,REG_DST)
-	mov.b	r0,@(8,REG_DST)
-	mov.b	r0,@(7,REG_DST)
-	mov.b	r0,@(6,REG_DST)
-	mov.b	r0,@(5,REG_DST)
-	mov.b	r0,@(4,REG_DST)
-	mov.b	r0,@(3,REG_DST)
-	mov.b	r0,@(2,REG_DST)
-	mov.b	r0,@(1,REG_DST)
-#ifdef BZERO
-	rts
-1:	mov.b	r0,@REG_DST
-#else
-	mov.b	r0,@REG_DST
-1:	rts
-	mov	REG_DST0,r0
-#endif
-
-
-/* 2 bytes aligned small fill */
-small_aligned:
-#ifndef BZERO
-	extu.b	REG_C,REG_TMP1		/* REG_C = ??????xx, REG_TMP1 = ????00xx */
-	shll8	REG_C			/* REG_C = ????xx00, REG_TMP1 = ????00xx */
-	or	REG_TMP1,REG_C		/* REG_C = ????xxxx */
-#endif
-
-	mov	REG_LEN,r0
-	tst	#1,r0			/* len is aligned? */
-	bt/s	1f
-	add	#-1,r0
-	mov.b	REG_C,@(r0,REG_DST)	/* fill last a byte */
-	mov	r0,REG_LEN
-1:
-
-	mova	1f,r0			/* 1f must be 4bytes aligned! */
-	sub	REG_LEN,r0
-	jmp	@r0
-	mov	REG_C,r0
-
-	.align	2
-	mov.w	r0,@(30,REG_DST)
-	mov.w	r0,@(28,REG_DST)
-	mov.w	r0,@(26,REG_DST)
-	mov.w	r0,@(24,REG_DST)
-	mov.w	r0,@(22,REG_DST)
-	mov.w	r0,@(20,REG_DST)
-	mov.w	r0,@(18,REG_DST)
-	mov.w	r0,@(16,REG_DST)
-	mov.w	r0,@(14,REG_DST)
-	mov.w	r0,@(12,REG_DST)
-	mov.w	r0,@(10,REG_DST)
-	mov.w	r0,@(8,REG_DST)
-	mov.w	r0,@(6,REG_DST)
-	mov.w	r0,@(4,REG_DST)
-	mov.w	r0,@(2,REG_DST)
-#ifdef BZERO
-	rts
-1:	mov.w	r0,@REG_DST
-#else
-	mov.w	r0,@REG_DST
-1:	rts
-	mov	REG_DST0,r0
-#endif
-
-
-
-	.align	2
-large:
-#ifdef BZERO
-	mov	#0,REG_C
-#else
-	extu.b	REG_C,REG_TMP1		/* REG_C = ??????xx, REG_TMP1 = ????00xx */
-	shll8	REG_C			/* REG_C = ????xx00, REG_TMP1 = ????00xx */
-	or	REG_C,REG_TMP1		/* REG_C = ????xx00, REG_TMP1 = ????xxxx */
-	swap.w	REG_TMP1,REG_C		/* REG_C = xxxx????, REG_TMP1 = ????xxxx */
-	xtrct	REG_TMP1,REG_C		/* REG_C = xxxxxxxx */
-#endif
-
-	mov	#3,REG_TMP1
-	tst	REG_TMP1,REG_DST
-	mov	REG_DST,REG_PTR
-	bf/s	unaligned_dst
-	add	REG_LEN,REG_PTR		/* REG_PTR = dst + len; */
-	tst	REG_TMP1,REG_LEN
-	bf/s	unaligned_len
-
-aligned:
-	/* fill 32*n bytes */
-	mov	#32,REG_TMP1
-	cmp/hi	REG_LEN,REG_TMP1
-	bt	9f
-	.align	2
-1:	sub	REG_TMP1,REG_PTR
-	mov.l	REG_C,@REG_PTR
-	sub	REG_TMP1,REG_LEN
-	mov.l	REG_C,@(4,REG_PTR)
-	cmp/hi	REG_LEN,REG_TMP1
-	mov.l	REG_C,@(8,REG_PTR)
-	mov.l	REG_C,@(12,REG_PTR)
-	mov.l	REG_C,@(16,REG_PTR)
-	mov.l	REG_C,@(20,REG_PTR)
-	mov.l	REG_C,@(24,REG_PTR)
-	bf/s	1b
-	mov.l	REG_C,@(28,REG_PTR)
-9:
-
-	/* fill left 4*n bytes */
-	cmp/eq	REG_DST,REG_PTR
-	bt	9f
-	add	#4,REG_DST
-	cmp/eq	REG_DST,REG_PTR
-1:	mov.l	REG_C,@-REG_PTR
-	bt/s	9f
-	cmp/eq	REG_DST,REG_PTR
-	mov.l	REG_C,@-REG_PTR
-	bt/s	9f
-	cmp/eq	REG_DST,REG_PTR
-	mov.l	REG_C,@-REG_PTR
-	bt/s	9f
-	cmp/eq	REG_DST,REG_PTR
-	mov.l	REG_C,@-REG_PTR
-	bf/s	1b
-	cmp/eq	REG_DST,REG_PTR
-9:
-#ifdef BZERO
-	rts
-	nop
-#else
-	rts
-	mov	REG_DST0,r0
-#endif
-
-
-unaligned_dst:
-	mov	#1,REG_TMP1
-	tst	REG_TMP1,REG_DST	/* if (dst & 1) {               */
-	add	#1,REG_TMP1
-	bt/s	2f
-	tst	REG_TMP1,REG_DST
-	mov.b	REG_C,@REG_DST		/*   *dst++ = c;                */
-	add	#1,REG_DST
-	tst	REG_TMP1,REG_DST
-2:					/* }                            */
-					/* if (dst & 2) {               */
-	bt	4f
-	mov.w	REG_C,@REG_DST		/*   *(u_int16_t*)dst++ = c;    */
-	add	#2,REG_DST
-4:					/* }                            */
-
-
-	tst	#3,REG_PTR		/* if (ptr & 3) {               */
-	bt/s	4f			/*                              */
-unaligned_len:
-	tst	#1,REG_PTR		/*   if (ptr & 1) {             */
-	bt/s	2f
-	tst	#2,REG_PTR
-	mov.b	REG_C,@-REG_PTR		/*     --ptr = c;               */
-2:					/*   }                          */
-					/*   if (ptr & 2) {             */
-	bt	4f
-	mov.w	REG_C,@-REG_PTR		/*     *--(u_int16_t*)ptr = c;  */
-4:					/*   }                          */
-					/* }                            */
-
-	mov	REG_PTR,REG_LEN
-	bra	aligned
-	sub	REG_DST,REG_LEN
-
diff --git a/libc/arch-sh/bionic/pipe.S b/libc/arch-sh/bionic/pipe.S
deleted file mode 100644
index 936da2d..0000000
--- a/libc/arch-sh/bionic/pipe.S
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#include <sys/linux-syscalls.h>
-
-.text
-.type   pipe, @function
-.globl  pipe
-.align  4
-
-pipe:
-    /* invoke trap */
-    mov.l   0f, r3          /* trap num */
-    trapa   #(0 + 0x10)
-
-
-    /* check return value */
-    cmp/pz  r0
-    bt      setfds
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-    bra     end
-    nop
-setfds:
-    mov.l   r0, @r4
-    add     #4, r4
-    mov.l   r1, @r4
-end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_pipe
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/bionic/setjmp.S b/libc/arch-sh/bionic/setjmp.S
deleted file mode 100644
index 67f3397..0000000
--- a/libc/arch-sh/bionic/setjmp.S
+++ /dev/null
@@ -1,167 +0,0 @@
-/*	$OpenBSD: setjmp.S,v 1.2 2007/03/02 06:11:54 miod Exp $	*/
-/*	$NetBSD: setjmp.S,v 1.10 2006/01/05 19:21:37 uwe Exp $	*/
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	from: @(#)setjmp.s	5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-#include <machine/setjmp.h>
-
-/*
- * C library -- setjmp, longjmp
- *
- *	longjmp(a,v)
- * will generate a "return(v)" from the last call to
- *	setjmp(a)
- * by restoring registers from the stack.
- * The previous signal state is restored.
- */
-
-ENTRY(setjmp)
-	PIC_PROLOGUE(.L_got_1)
-	sts.l	pr,	@-sp
-	mov.l	r4,	@-sp
-
-	mov.l	.L_sigprocmask_1, r0
-	mov	r4,	r6
-	mov	#1,	r4		/* how = SIG_BLOCK */
-	mov	#0,	r5		/* new = NULL */
-1:	CALL	r0
-	 add	#4,	r6		/* old = &sigmask */
-
-	mov.l	@sp+,	r4
-	lds.l	@sp+,	pr
-	PIC_EPILOGUE
-
-	/* identical to _setjmp except that the first word is non-zero */
-#if defined(__SH4__) && !defined(__SH4_NOFPU__)
-	add	#(_JBLEN * 4), r4
-	sts	fpscr,	r1
-	xor	r0,	r0
-	mov.l	r1,	@-r4
-	lds	r0,	fpscr
-	sts.l	fpul,	@-r4
-	fmov.s	fr15,	@-r4
-	fmov.s	fr14,	@-r4
-	fmov.s	fr13,	@-r4
-	fmov.s	fr12,	@-r4
-	frchg
-	fmov.s	fr15,	@-r4
-	fmov.s	fr14,	@-r4
-	fmov.s	fr13,	@-r4
-	fmov.s	fr12,	@-r4
-	lds	r1,	fpscr
-#else
-	add	#((_JBLEN - 10) * 4), r4
-#endif
-	sts.l	mach,	@-r4
-	sts.l	macl,	@-r4
-	mov.l	r15,	@-r4
-	mov.l	r14,	@-r4
-	mov.l	r13,	@-r4
-	mov.l	r12,	@-r4
-	mov.l	r11,	@-r4
-	mov.l	r10,	@-r4
-	mov.l	r9,	@-r4
-	mov.l	r8,	@-r4
-	sts.l	pr,	@-r4
-	add	#-4,	r4		/* skip signal mask */
-	mov	#1,	r0
-	mov.l	r0,	@-r4		/* has signal mask */
-	rts
-	 xor	r0,	r0
-
-	.align	2
-.L_got_1:		PIC_GOT_DATUM
-.L_sigprocmask_1:	CALL_DATUM(_C_LABEL(sigprocmask), 1b)
-	SET_ENTRY_SIZE(setjmp)
-
-ENTRY(longjmp)
-	/* we won't return here, so we don't need to save pr and r12 */
-	PIC_PROLOGUE_NOSAVE(.L_got_2)
-	mov.l	r5,	@-sp
-	mov.l	r4,	@-sp
-
-	mov.l	.L_sigprocmask_2, r0
-	mov	r4,	r5
-	mov	#3,	r4		/* how = SIG_SETMASK */
-	add	#4,	r5		/* new = &sigmask */
-1:	CALL	r0
-	 mov	#0,	r6		/* old = NULL */
-
-	mov.l	@sp+,	r4
-	mov.l	@sp+,	r5
-
-	/* identical to _longjmp */
-	add	#8,	r4
-	lds.l	@r4+,	pr
-	mov.l	@r4+,	r8
-	mov.l	@r4+,	r9
-	mov.l	@r4+,	r10
-	mov.l	@r4+,	r11
-	mov.l	@r4+,	r12
-	mov.l	@r4+,	r13
-	mov.l	@r4+,	r14
-	mov.l	@r4+,	r15
-	lds.l	@r4+,	macl
-	lds.l	@r4+,	mach
-#if defined(__SH4__) && !defined(__SH4_NOFPU__)
-	xor	r0, 	r0
-	lds	r0,	fpscr
-	frchg
-	fmov.s	@r4+,	fr12
-	fmov.s	@r4+,	fr13
-	fmov.s	@r4+,	fr14
-	fmov.s	@r4+,	fr15
-	frchg
-	fmov.s	@r4+,	fr12
-	fmov.s	@r4+,	fr13
-	fmov.s	@r4+,	fr14
-	fmov.s	@r4+,	fr15
-	lds.l	@r4+,	fpul
-	lds.l	@r4+,	fpscr
-#endif
-
-	mov	r5,	r0
-	tst	r0,	r0	/* make sure return value is non-zero */
-	bf	.L0
-	add	#1,	r0
-.L0:
-	rts
-	 nop
-
-	.align	2
-.L_got_2:		PIC_GOT_DATUM
-.L_sigprocmask_2:	CALL_DATUM(_C_LABEL(sigprocmask), 1b)
-	SET_ENTRY_SIZE(longjmp)
diff --git a/libc/arch-sh/bionic/sigsetjmp.S b/libc/arch-sh/bionic/sigsetjmp.S
deleted file mode 100644
index f88913a..0000000
--- a/libc/arch-sh/bionic/sigsetjmp.S
+++ /dev/null
@@ -1,166 +0,0 @@
-/*	$OpenBSD: sigsetjmp.S,v 1.2 2007/03/02 06:11:54 miod Exp $	*/
-/*	$NetBSD: sigsetjmp.S,v 1.9 2006/01/05 19:21:37 uwe Exp $	*/
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	from: @(#)setjmp.s	5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-#include <machine/setjmp.h>
-
-ENTRY(sigsetjmp)
-	tst	r5,	r5		/* if (savemask == 0) */
-	bt	2f
-
-	/* identical to setjmp */
-	PIC_PROLOGUE(.L_got_1)
-	sts.l	pr,	@-sp
-	mov.l	r4,	@-sp
-	mov.l	r5,	@-sp
-
-	mov.l	.L_sigprocmask_1, r0
-	mov	r4,	r6
-	mov	#1,	r4		/* how = SIG_BLOCK */
-	mov	#0,	r5		/* new = NULL */
-1:	CALL	r0
-	 add	#4,	r6		/* old = &sigmask */
-
-	mov.l	@sp+,	r5
-	mov.l	@sp+,	r4
-	lds.l	@sp+,	pr
-	PIC_EPILOGUE
-
-2:	/* identical to _setjmp except that first word is in r5 */
-#if defined(__SH4__) && !defined(__SH4_NOFPU__)
-	add	#(_JBLEN * 4), r4
-	sts	fpscr,	r1
-	xor	r0,	r0
-	mov.l	r1,	@-r4
-	lds	r0,	fpscr
-	sts.l	fpul,	@-r4
-	fmov.s	fr15,	@-r4
-	fmov.s	fr14,	@-r4
-	fmov.s	fr13,	@-r4
-	fmov.s	fr12,	@-r4
-	frchg
-	fmov.s	fr15,	@-r4
-	fmov.s	fr14,	@-r4
-	fmov.s	fr13,	@-r4
-	fmov.s	fr12,	@-r4
-	lds	r1,	fpscr
-#else
-	add	#((_JBLEN - 10) * 4), r4
-#endif
-	sts.l	mach,	@-r4
-	sts.l	macl,	@-r4
-	mov.l	r15,	@-r4
-	mov.l	r14,	@-r4
-	mov.l	r13,	@-r4
-	mov.l	r12,	@-r4
-	mov.l	r11,	@-r4
-	mov.l	r10,	@-r4
-	mov.l	r9,	@-r4
-	mov.l	r8,	@-r4
-	sts.l	pr,	@-r4
-	add	#-4,	r4		/* skip signal mask */
-	mov.l	r5,	@-r4		/* has signal mask? */
-	rts
-	 xor	r0,	r0
-
-	.align	2
-.L_got_1:		PIC_GOT_DATUM
-.L_sigprocmask_1:	CALL_DATUM(_C_LABEL(sigprocmask), 1b)
-	SET_ENTRY_SIZE(sigsetjmp)
-
-ENTRY(siglongjmp)
-	mov.l	@r4+,	r0
-	tst	r0,	r0
-	bt	2f			/* if no mask */
-
-	/* identical to longjmp */
-	/* we won't return here, so we don't need to save pr and r12 */
-	PIC_PROLOGUE_NOSAVE(.L_got_2)
-	mov.l	r5,	@-sp
-	mov.l	r4,	@-sp
-
-	mov.l	.L_sigprocmask_2, r0
-	mov	r4,	r5		/* new = &sigmask */
-	mov	#3,	r4		/* how = SIG_SETMASK */
-1:	CALL	r0
-	 mov	#0,	r6		/* old = NULL */
-
-	mov.l	@sp+,	r4
-	mov.l	@sp+,	r5
-
-2:	/* identical to _longjmp */
-	add	#4,	r4
-	lds.l	@r4+,	pr
-	mov.l	@r4+,	r8
-	mov.l	@r4+,	r9
-	mov.l	@r4+,	r10
-	mov.l	@r4+,	r11
-	mov.l	@r4+,	r12
-	mov.l	@r4+,	r13
-	mov.l	@r4+,	r14
-	mov.l	@r4+,	r15
-	lds.l	@r4+,	macl
-	lds.l	@r4+,	mach
-#if defined(__SH4__) && !defined(__SH4_NOFPU__)
-	xor	r0, 	r0
-	lds	r0,	fpscr
-	frchg
-	fmov.s	@r4+,	fr12
-	fmov.s	@r4+,	fr13
-	fmov.s	@r4+,	fr14
-	fmov.s	@r4+,	fr15
-	frchg
-	fmov.s	@r4+,	fr12
-	fmov.s	@r4+,	fr13
-	fmov.s	@r4+,	fr14
-	fmov.s	@r4+,	fr15
-	lds.l	@r4+,	fpul
-	lds.l	@r4+,	fpscr
-#endif
-
-	mov	r5,	r0
-	tst	r0,	r0	/* make sure return value is non-zero */
-	bf	.L0
-	add	#1,	r0
-.L0:
-	rts
-	 nop
-
-	.align	2
-.L_got_2:		PIC_GOT_DATUM
-.L_sigprocmask_2:	CALL_DATUM(_C_LABEL(sigprocmask), 1b)
-	SET_ENTRY_SIZE(siglongjmp)
diff --git a/libc/arch-sh/bionic/syscall.S b/libc/arch-sh/bionic/syscall.S
deleted file mode 100644
index 7e9f307..0000000
--- a/libc/arch-sh/bionic/syscall.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#include <sys/linux-syscalls.h>
-
-.text
-.type syscall, @function
-.globl syscall
-.align 4
-
-/*
- * Current implementation assumes that the all syscall
- * has maximum 7 arguments.
- */
-syscall:
-    /* get args */
-    mov     r4, r3      /* system call number */
-    mov     r5, r4
-    mov     r6, r5
-    mov     r7, r6
-    mov.l   @r15, r7
-    mov.l   @(4, r15), r0
-    mov.l   @(8, r15), r1
-    mov.l   @(12, r15), r2
-
-    /* invoke trap */
-    trapa   #(7 + 0x10) /* assuming 7 arguments */
-
-    /* check return value */
-    cmp/pz  r0
-    bt      end
-
-    /* keep error number */
-    mov.l   r0, @-r15
-    mov.l   0f, r1
-    jsr     @r1
-    mov     r0, r4
-    mov.l   @r15+, r0
-
-end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __set_errno
diff --git a/libc/arch-sh/bionic/unwind.c b/libc/arch-sh/bionic/unwind.c
deleted file mode 100644
index 33ec58c..0000000
--- a/libc/arch-sh/bionic/unwind.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-
-typedef long unsigned int *_Unwind_Ptr;
-
diff --git a/libc/arch-sh/include/endian.h b/libc/arch-sh/include/endian.h
deleted file mode 100644
index ad10164..0000000
--- a/libc/arch-sh/include/endian.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*	$OpenBSD: endian.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $	*/
-/*	$NetBSD: endian.h,v 1.4 2000/03/17 00:09:25 mycroft Exp $	*/
-
-/* Written by Manuel Bouyer. Public domain */
-
-#ifndef _SH_ENDIAN_H_
-#define	_SH_ENDIAN_H_
-
-#ifdef  __GNUC__
-
-#define	__swap64md	__swap64gen
-
-#define __swap16md(x) ({						\
-	uint16_t rval;							\
-									\
-	__asm volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x));		\
-									\
-	rval;								\
-})
-
-#define __swap32md(x) ({						\
-	uint32_t rval;							\
-									\
-	__asm volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0"	\
-			  : "=r"(rval) : "r"(x));			\
-									\
-	rval;								\
-})
-
-#define MD_SWAP
-
-#endif /* __GNUC_ */
-
-#define	_BYTE_ORDER _LITTLE_ENDIAN
-#include <sys/endian.h>
-
-#define	__STRICT_ALIGNMENT
-
-#endif /* !_SH_ENDIAN_H_ */
diff --git a/libc/arch-sh/include/machine/_types.h b/libc/arch-sh/include/machine/_types.h
deleted file mode 100644
index 6f59e21..0000000
--- a/libc/arch-sh/include/machine/_types.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*	$OpenBSD: _types.h,v 1.6 2008/07/21 20:50:55 martynas Exp $	*/
-
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	@(#)types.h	8.3 (Berkeley) 1/5/94
- *	@(#)ansi.h	8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _SH__TYPES_H_
-#define _SH__TYPES_H_
-
-#if defined(_KERNEL)
-typedef struct label_t {
-	int val[9];
-} label_t;
-#endif
-
-/* 7.18.1.1 Exact-width integer types */
-typedef	__signed char		__int8_t;
-typedef	unsigned char		__uint8_t;
-typedef	short			__int16_t;
-typedef	unsigned short		__uint16_t;
-typedef	int			__int32_t;
-typedef	unsigned int		__uint32_t;
-/* LONGLONG */
-typedef	long long		__int64_t;
-/* LONGLONG */
-typedef	unsigned long long	__uint64_t;
-
-/* 7.18.1.2 Minimum-width integer types */
-typedef	__int8_t		__int_least8_t;
-typedef	__uint8_t		__uint_least8_t;
-typedef	__int16_t		__int_least16_t;
-typedef	__uint16_t		__uint_least16_t;
-typedef	__int32_t		__int_least32_t;
-typedef	__uint32_t		__uint_least32_t;
-typedef	__int64_t		__int_least64_t;
-typedef	__uint64_t		__uint_least64_t;
-
-/* 7.18.1.3 Fastest minimum-width integer types */
-typedef	__int32_t		__int_fast8_t;
-typedef	__uint32_t		__uint_fast8_t;
-typedef	__int32_t		__int_fast16_t;
-typedef	__uint32_t		__uint_fast16_t;
-typedef	__int32_t		__int_fast32_t;
-typedef	__uint32_t		__uint_fast32_t;
-typedef	__int64_t		__int_fast64_t;
-typedef	__uint64_t		__uint_fast64_t;
-
-/* 7.18.1.4 Integer types capable of holding object pointers */
-typedef	long			__intptr_t;
-typedef	unsigned long		__uintptr_t;
-
-/* 7.18.1.5 Greatest-width integer types */
-typedef	__int64_t		__intmax_t;
-typedef	__uint64_t		__uintmax_t;
-
-/* Register size */
-typedef __uint32_t		__register_t;
-
-/* VM system types */
-typedef unsigned long		__vaddr_t;
-typedef unsigned long		__paddr_t;
-typedef unsigned long		__vsize_t;
-typedef unsigned long		__psize_t;
-
-/* Standard system types */
-typedef int			__clock_t;
-typedef int			__clockid_t;
-typedef double			__double_t;
-typedef float			__float_t;
-typedef long long		__off_t;
-typedef long			__ptrdiff_t;
-#if 0
-/* cut it off for Android-SH */
-typedef	unsigned long		__size_t;
-#endif
-typedef	long			__ssize_t;
-typedef	int			__time_t;
-typedef int			__timer_t;
-#if defined(__GNUC__) && __GNUC__ >= 3
-typedef	__builtin_va_list	__va_list;
-#else
-struct __va_list_tag;
-typedef	struct __va_list_tag *	__va_list;
-#endif
-
-/* Wide character support types */
-#ifndef __cplusplus
-typedef	int			__wchar_t;
-#endif
-typedef int			__wint_t;
-typedef	int			__rune_t;
-typedef	void *			__wctrans_t;
-typedef	void *			__wctype_t;
-
-/* Feature test macros */
-#define	__HAVE_GENERIC_SOFT_INTERRUPTS
-
-#endif	/* _SH__TYPES_H_ */
diff --git a/libc/arch-sh/include/machine/asm.h b/libc/arch-sh/include/machine/asm.h
deleted file mode 100644
index c659a9d..0000000
--- a/libc/arch-sh/include/machine/asm.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/*	$OpenBSD: asm.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $	*/
-/*	$NetBSD: asm.h,v 1.25 2006/01/20 22:02:40 christos Exp $	*/
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	@(#)asm.h	5.5 (Berkeley) 5/7/91
- */
-
-#ifndef _SH_ASM_H_
-#define	_SH_ASM_H_
-
-#ifdef __ELF__
-# define _C_LABEL(x)	x
-#else
-#ifdef __STDC__
-# define _C_LABEL(x)	_ ## x
-#else
-# define _C_LABEL(x)	_/**/x
-#endif
-#endif
-#define	_ASM_LABEL(x)	x
-
-#ifdef __STDC__
-# define __CONCAT(x,y)	x ## y
-# define __STRING(x)	#x
-#else
-# define __CONCAT(x,y)	x/**/y
-# define __STRING(x)	"x"
-#endif
-
-/* let kernels and others override entrypoint alignment */
-#ifndef _ALIGN_TEXT
-# define _ALIGN_TEXT .align 2
-#endif
-
-#ifdef __ELF__
-#define	_ENTRY(x)							\
-	.text								;\
-	_ALIGN_TEXT							;\
-	.globl x							;\
-	.type x,@function						;\
-	x:
-#else /* !__ELF__ */
-#define	_ENTRY(x)							\
-	.text								;\
-	_ALIGN_TEXT							;\
-	.globl x							;\
-	x:
-#endif /* !__ELF__ */
-
-#ifdef GPROF
-#define	_PROF_PROLOGUE				  \
-	mov.l	1f,r1				; \
-	mova	2f,r0				; \
-	jmp	@r1				; \
-	 nop					; \
-	.align	2				; \
-1:	.long	__mcount			; \
-2:
-#else  /* !GPROF */
-#define	_PROF_PROLOGUE
-#endif /* !GPROF */
-
-#define	ENTRY(y)	_ENTRY(_C_LABEL(y)) _PROF_PROLOGUE
-#define	NENTRY(y)	_ENTRY(_C_LABEL(y))
-#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)) _PROF_PROLOGUE
-
-#define SET_ENTRY_SIZE(y) \
-	.size	_C_LABEL(y), . - _C_LABEL(y)
-
-#define SET_ASENTRY_SIZE(y) \
-	.size	_ASM_LABEL(y), . - _ASM_LABEL(y)
-
-#ifdef __ELF__
-#define	ALTENTRY(name)				 \
-	.globl _C_LABEL(name)			;\
-	.type _C_LABEL(name),@function		;\
-	_C_LABEL(name):
-#else
-#define	ALTENTRY(name)				 \
-	.globl _C_LABEL(name)			;\
-	_C_LABEL(name):
-#endif
-
-
-/*
- * Hide the gory details of PIC calls vs. normal calls.  Use as in the
- * following example:
- *
- *	sts.l	pr, @-sp
- *	PIC_PROLOGUE(.L_got, r0)	! saves old r12 on stack
- *	...
- *	mov.l	.L_function_1, r0
- * 1:	CALL	r0			! each call site needs a label
- *	 nop
- *      ...
- *	mov.l	.L_function_2, r0
- * 2:	CALL	r0
- *	 nop
- *	...
- *	PIC_EPILOGUE			! restores r12 from stack
- *	lds.l	@sp+, pr		!  so call in right order 
- *	rts
- *	 nop
- *
- *	.align 2
- * .L_got:
- *	PIC_GOT_DATUM
- * .L_function_1:			! if you call the same function twice
- *	CALL_DATUM(function, 1b)	!  provide call datum for each call
- * .L_function_2:
- * 	CALL_DATUM(function, 2b)
- */
-
-#ifdef PIC
-
-#define	PIC_PLT(x)	x@PLT
-#define	PIC_GOT(x)	x@GOT
-#define	PIC_GOTOFF(x)	x@GOTOFF
-
-#define	PIC_PROLOGUE(got)			\
-        	mov.l	r12, @-sp;		\
-		PIC_PROLOGUE_NOSAVE(got)
-
-/*
- * Functions that do non local jumps don't need to preserve r12,
- * so we can shave off two instructions to save/restore it.
- */
-#define	PIC_PROLOGUE_NOSAVE(got)		\
-        	mov.l	got, r12;		\
-        	mova	got, r0;		\
-        	add	r0, r12
-
-#define	PIC_EPILOGUE				\
-		mov.l	@sp+, r12
-
-#define PIC_EPILOGUE_SLOT 			\
-		PIC_EPILOGUE
-
-#define PIC_GOT_DATUM \
-		.long	_GLOBAL_OFFSET_TABLE_
-
-#define CALL	bsrf
-#define JUMP	braf
-
-#define CALL_DATUM(function, lpcs) \
-		.long	PIC_PLT(function) - ((lpcs) + 4 - (.))
-
-/*
- * This will result in text relocations in the shared library,
- * unless the function is local or has hidden or protected visibility.
- * Does not require PIC prologue.
- */
-#define CALL_DATUM_LOCAL(function, lpcs) \
-		.long	function - ((lpcs) + 4)
-
-#else  /* !PIC */
-
-#define	PIC_PROLOGUE(label)
-#define	PIC_PROLOGUE_NOSAVE(label)
-#define	PIC_EPILOGUE
-#define	PIC_EPILOGUE_SLOT	nop
-#define PIC_GOT_DATUM
-
-#define CALL	jsr @
-#define JUMP	jmp @
-
-#define CALL_DATUM(function, lpcs) \
-		.long	function
-
-#define CALL_DATUM_LOCAL(function, lpcs) \
-		.long	function
-
-#endif /* !PIC */
-
-
-#define	ASMSTR		.asciz
-
-#ifdef __ELF__
-#define	WEAK_ALIAS(alias,sym)						\
-	.weak _C_LABEL(alias);						\
-	_C_LABEL(alias) = _C_LABEL(sym)
-#endif
-
-#define	WARN_REFERENCES(_sym,_msg)				\
-	.section .gnu.warning._sym; .ascii _msg; .previous
-
-#endif /* !_SH_ASM_H_ */
diff --git a/libc/arch-sh/include/machine/exec.h b/libc/arch-sh/include/machine/exec.h
deleted file mode 100644
index 48a9680..0000000
--- a/libc/arch-sh/include/machine/exec.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*	$OpenBSD: exec.h,v 1.2 2006/11/10 20:34:06 drahn Exp $	*/
-/*	$NetBSD: elf_machdep.h,v 1.8 2002/04/28 17:10:34 uch Exp $	*/
-
-#define __LDPGSZ	4096
-
-#define	NATIVE_EXEC_ELF
-
-#define	ARCH_ELFSIZE		32	/* MD native binary size */
-#define	ELF_TARG_CLASS		ELFCLASS32
-#ifdef __LITTLE_ENDIAN__
-#define	ELF_TARG_DATA		ELFDATA2LSB
-#else
-#define	ELF_TARG_DATA		ELFDATA2MSB
-#endif
-#define	ELF_TARG_MACH		EM_SH
-
-#define	_KERN_DO_ELF
-#define	_NLIST_DO_ELF
-
-/*
- * SuperH ELF header flags.
- */
-#define	EF_SH_MACH_MASK		0x1f
-
-#define	EF_SH_UNKNOWN		0x00
-#define	EF_SH_SH1		0x01
-#define	EF_SH_SH2		0x02
-#define	EF_SH_SH3		0x03
-#define	EF_SH_DSP		0x04
-#define	EF_SH_SH3_DSP		0x05
-#define	EF_SH_SH3E		0x08
-#define	EF_SH_SH4		0x09
-
-#define	EF_SH_HAS_DSP(x)	((x) & EF_SH_DSP)
-#define	EF_SH_HAS_FP(x)		((x) & EF_SH_SH3E)
diff --git a/libc/arch-sh/include/machine/ieee.h b/libc/arch-sh/include/machine/ieee.h
deleted file mode 100644
index 7646f85..0000000
--- a/libc/arch-sh/include/machine/ieee.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*	$OpenBSD: ieee.h,v 1.2 2006/11/10 20:29:36 otto Exp $	*/
-
-/*
- * Copyright (c) 1992, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Lawrence Berkeley Laboratory.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
- */
-
-/*
- * ieee.h defines the machine-dependent layout of the machine's IEEE
- * floating point.  It does *not* define (yet?) any of the rounding
- * mode bits, exceptions, and so forth.
- */
-
-/*
- * Define the number of bits in each fraction and exponent.
- *
- *		     k	         k+1
- * Note that  1.0 x 2  == 0.1 x 2      and that denorms are represented
- *
- *					  (-exp_bias+1)
- * as fractions that look like 0.fffff x 2             .  This means that
- *
- *			 -126
- * the number 0.10000 x 2    , for instance, is the same as the normalized
- *
- *		-127			   -128
- * float 1.0 x 2    .  Thus, to represent 2    , we need one leading zero
- *
- *				  -129
- * in the fraction; to represent 2    , we need two, and so on.  This
- *
- *						     (-exp_bias-fracbits+1)
- * implies that the smallest denormalized number is 2
- *
- * for whichever format we are talking about: for single precision, for
- *
- *						-126		-149
- * instance, we get .00000000000000000000001 x 2    , or 1.0 x 2    , and
- *
- * -149 == -127 - 23 + 1.
- */
-#define	SNG_EXPBITS	8
-#define	SNG_FRACBITS	23
-
-#define	DBL_EXPBITS	11
-#define	DBL_FRACBITS	52
-
-#define	EXT_EXPBITS	15
-#define	EXT_FRACBITS	112
-
-struct ieee_single {
-	u_int	sng_frac:23;
-	u_int	sng_exp:8;
-	u_int	sng_sign:1;
-};
-
-struct ieee_double {
-	u_int	dbl_fracl;
-	u_int	dbl_frach:20;
-	u_int	dbl_exp:11;
-	u_int	dbl_sign:1;
-};
-
-struct ieee_ext {
-	u_int	ext_sign:1;
-	u_int	ext_exp:15;
-	u_int	ext_frach:16;
-	u_int	ext_frachm;
-	u_int	ext_fraclm;
-	u_int	ext_fracl;
-};
-
-/*
- * Floats whose exponent is in [1..INFNAN) (of whatever type) are
- * `normal'.  Floats whose exponent is INFNAN are either Inf or NaN.
- * Floats whose exponent is zero are either zero (iff all fraction
- * bits are zero) or subnormal values.
- *
- * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
- * high fraction; if the bit is set, it is a `quiet NaN'.
- */
-#define	SNG_EXP_INFNAN	255
-#define	DBL_EXP_INFNAN	2047
-#define	EXT_EXP_INFNAN	32767
-
-#if 0
-#define	SNG_QUIETNAN	(1 << 22)
-#define	DBL_QUIETNAN	(1 << 19)
-#define	EXT_QUIETNAN	(1 << 15)
-#endif
-
-/*
- * Exponent biases.
- */
-#define	SNG_EXP_BIAS	127
-#define	DBL_EXP_BIAS	1023
-#define	EXT_EXP_BIAS	16383
diff --git a/libc/arch-sh/include/machine/internal_types.h b/libc/arch-sh/include/machine/internal_types.h
deleted file mode 100644
index ea9b7c4..0000000
--- a/libc/arch-sh/include/machine/internal_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $OpenBSD: internal_types.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
-/* Public domain */
-#ifndef _SH_INTERNAL_TYPES_H_
-#define _SH_INTERNAL_TYPES_H_
-
-#endif
diff --git a/libc/arch-sh/include/machine/kernel.h b/libc/arch-sh/include/machine/kernel.h
deleted file mode 100644
index 948021a..0000000
--- a/libc/arch-sh/include/machine/kernel.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-#ifndef _ARCH_SH_KERNEL_H
-#define _ARCH_SH_KERNEL_H
-
-/* this file contains kernel-specific definitions that were optimized out of
-   our processed kernel headers, but still useful nonetheless... */
-
-typedef unsigned long   __kernel_blkcnt_t;
-typedef unsigned long   __kernel_blksize_t;
-
-/* these aren't really defined by the kernel headers though... */
-typedef unsigned long   __kernel_fsblkcnt_t;
-typedef unsigned long   __kernel_fsfilcnt_t;
-typedef unsigned int    __kernel_id_t;
-
-#endif /* _ARCH_SH_KERNEL_H */
diff --git a/libc/arch-sh/include/machine/limits.h b/libc/arch-sh/include/machine/limits.h
deleted file mode 100644
index d602138..0000000
--- a/libc/arch-sh/include/machine/limits.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*	$OpenBSD: limits.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $	*/
-/*	$NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $	*/
-
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 TooLs GmbH.
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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.
- */
-
-#ifndef _SH_LIMITS_H_
-#define _SH_LIMITS_H_
-
-#include <sys/cdefs.h>
-
-#define	MB_LEN_MAX	1		/* no multibyte characters	*/
-
-#ifndef	SIZE_MAX
-#define	SIZE_MAX	UINT_MAX	/* max value for a size_t */
-#endif
-#define SSIZE_MAX	INT_MAX		/* max value for a ssize_t */  
-
-#if __BSD_VISIBLE
-#define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t (historic) */
-
-#define	UQUAD_MAX	0xffffffffffffffffULL		/* max unsigned quad */
-#define	QUAD_MAX	0x7fffffffffffffffLL		/* max signed quad */
-#define	QUAD_MIN	(-0x7fffffffffffffffLL-1)	/* min signed quad */
-#endif	/* __BSD_VISIBLE */
-
-#define LONGLONG_BIT    64
-#define LONGLONG_MIN    (-9223372036854775807LL-1)
-#define LONGLONG_MAX    9223372036854775807LL
-#define ULONGLONG_MAX   18446744073709551615ULL
-
-#endif /* _SH_LIMITS_H_ */
diff --git a/libc/arch-sh/include/machine/setjmp.h b/libc/arch-sh/include/machine/setjmp.h
deleted file mode 100644
index 014ad3e..0000000
--- a/libc/arch-sh/include/machine/setjmp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*	$OpenBSD: setjmp.h,v 1.2 2007/03/02 06:11:54 miod Exp $	*/
-/*	$NetBSD: setjmp.h,v 1.3 2006/01/05 00:50:23 uwe Exp $	*/
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
diff --git a/libc/arch-sh/syscalls.mk b/libc/arch-sh/syscalls.mk
deleted file mode 100644
index 9575905..0000000
--- a/libc/arch-sh/syscalls.mk
+++ /dev/null
@@ -1,168 +0,0 @@
-# auto-generated by gensyscalls.py, do not touch
-syscall_src := 
-syscall_src += arch-sh/syscalls/_exit.S
-syscall_src += arch-sh/syscalls/_exit_thread.S
-syscall_src += arch-sh/syscalls/__fork.S
-syscall_src += arch-sh/syscalls/_waitpid.S
-syscall_src += arch-sh/syscalls/__waitid.S
-syscall_src += arch-sh/syscalls/__sys_clone.S
-syscall_src += arch-sh/syscalls/execve.S
-syscall_src += arch-sh/syscalls/__setuid.S
-syscall_src += arch-sh/syscalls/getuid.S
-syscall_src += arch-sh/syscalls/getgid.S
-syscall_src += arch-sh/syscalls/geteuid.S
-syscall_src += arch-sh/syscalls/getegid.S
-syscall_src += arch-sh/syscalls/getresuid.S
-syscall_src += arch-sh/syscalls/getresgid.S
-syscall_src += arch-sh/syscalls/gettid.S
-syscall_src += arch-sh/syscalls/getgroups.S
-syscall_src += arch-sh/syscalls/getpgid.S
-syscall_src += arch-sh/syscalls/getppid.S
-syscall_src += arch-sh/syscalls/setsid.S
-syscall_src += arch-sh/syscalls/setgid.S
-syscall_src += arch-sh/syscalls/__setreuid.S
-syscall_src += arch-sh/syscalls/__setresuid.S
-syscall_src += arch-sh/syscalls/setresgid.S
-syscall_src += arch-sh/syscalls/__brk.S
-syscall_src += arch-sh/syscalls/kill.S
-syscall_src += arch-sh/syscalls/tkill.S
-syscall_src += arch-sh/syscalls/__ptrace.S
-syscall_src += arch-sh/syscalls/__set_thread_area.S
-syscall_src += arch-sh/syscalls/__getpriority.S
-syscall_src += arch-sh/syscalls/setpriority.S
-syscall_src += arch-sh/syscalls/setrlimit.S
-syscall_src += arch-sh/syscalls/getrlimit.S
-syscall_src += arch-sh/syscalls/getrusage.S
-syscall_src += arch-sh/syscalls/setgroups.S
-syscall_src += arch-sh/syscalls/setpgid.S
-syscall_src += arch-sh/syscalls/vfork.S
-syscall_src += arch-sh/syscalls/setregid.S
-syscall_src += arch-sh/syscalls/chroot.S
-syscall_src += arch-sh/syscalls/prctl.S
-syscall_src += arch-sh/syscalls/capget.S
-syscall_src += arch-sh/syscalls/capset.S
-syscall_src += arch-sh/syscalls/sigaltstack.S
-syscall_src += arch-sh/syscalls/acct.S
-syscall_src += arch-sh/syscalls/read.S
-syscall_src += arch-sh/syscalls/write.S
-syscall_src += arch-sh/syscalls/pread64.S
-syscall_src += arch-sh/syscalls/pwrite64.S
-syscall_src += arch-sh/syscalls/__open.S
-syscall_src += arch-sh/syscalls/__openat.S
-syscall_src += arch-sh/syscalls/close.S
-syscall_src += arch-sh/syscalls/lseek.S
-syscall_src += arch-sh/syscalls/__llseek.S
-syscall_src += arch-sh/syscalls/getpid.S
-syscall_src += arch-sh/syscalls/__mmap2.S
-syscall_src += arch-sh/syscalls/munmap.S
-syscall_src += arch-sh/syscalls/mremap.S
-syscall_src += arch-sh/syscalls/msync.S
-syscall_src += arch-sh/syscalls/mprotect.S
-syscall_src += arch-sh/syscalls/madvise.S
-syscall_src += arch-sh/syscalls/mlock.S
-syscall_src += arch-sh/syscalls/munlock.S
-syscall_src += arch-sh/syscalls/mincore.S
-syscall_src += arch-sh/syscalls/__ioctl.S
-syscall_src += arch-sh/syscalls/readv.S
-syscall_src += arch-sh/syscalls/writev.S
-syscall_src += arch-sh/syscalls/__fcntl.S
-syscall_src += arch-sh/syscalls/flock.S
-syscall_src += arch-sh/syscalls/fchmod.S
-syscall_src += arch-sh/syscalls/dup.S
-syscall_src += arch-sh/syscalls/pipe2.S
-syscall_src += arch-sh/syscalls/dup2.S
-syscall_src += arch-sh/syscalls/select.S
-syscall_src += arch-sh/syscalls/ftruncate.S
-syscall_src += arch-sh/syscalls/ftruncate64.S
-syscall_src += arch-sh/syscalls/getdents.S
-syscall_src += arch-sh/syscalls/fsync.S
-syscall_src += arch-sh/syscalls/fdatasync.S
-syscall_src += arch-sh/syscalls/fchown.S
-syscall_src += arch-sh/syscalls/sync.S
-syscall_src += arch-sh/syscalls/__fcntl64.S
-syscall_src += arch-sh/syscalls/__fstatfs64.S
-syscall_src += arch-sh/syscalls/sendfile.S
-syscall_src += arch-sh/syscalls/fstatat.S
-syscall_src += arch-sh/syscalls/mkdirat.S
-syscall_src += arch-sh/syscalls/fchownat.S
-syscall_src += arch-sh/syscalls/fchmodat.S
-syscall_src += arch-sh/syscalls/renameat.S
-syscall_src += arch-sh/syscalls/link.S
-syscall_src += arch-sh/syscalls/unlink.S
-syscall_src += arch-sh/syscalls/unlinkat.S
-syscall_src += arch-sh/syscalls/chdir.S
-syscall_src += arch-sh/syscalls/mknod.S
-syscall_src += arch-sh/syscalls/chmod.S
-syscall_src += arch-sh/syscalls/chown.S
-syscall_src += arch-sh/syscalls/lchown.S
-syscall_src += arch-sh/syscalls/mount.S
-syscall_src += arch-sh/syscalls/umount2.S
-syscall_src += arch-sh/syscalls/fstat.S
-syscall_src += arch-sh/syscalls/stat.S
-syscall_src += arch-sh/syscalls/lstat.S
-syscall_src += arch-sh/syscalls/mkdir.S
-syscall_src += arch-sh/syscalls/readlink.S
-syscall_src += arch-sh/syscalls/rmdir.S
-syscall_src += arch-sh/syscalls/rename.S
-syscall_src += arch-sh/syscalls/__getcwd.S
-syscall_src += arch-sh/syscalls/access.S
-syscall_src += arch-sh/syscalls/symlink.S
-syscall_src += arch-sh/syscalls/fchdir.S
-syscall_src += arch-sh/syscalls/truncate.S
-syscall_src += arch-sh/syscalls/__statfs64.S
-syscall_src += arch-sh/syscalls/pause.S
-syscall_src += arch-sh/syscalls/gettimeofday.S
-syscall_src += arch-sh/syscalls/settimeofday.S
-syscall_src += arch-sh/syscalls/times.S
-syscall_src += arch-sh/syscalls/nanosleep.S
-syscall_src += arch-sh/syscalls/clock_gettime.S
-syscall_src += arch-sh/syscalls/clock_settime.S
-syscall_src += arch-sh/syscalls/clock_getres.S
-syscall_src += arch-sh/syscalls/clock_nanosleep.S
-syscall_src += arch-sh/syscalls/getitimer.S
-syscall_src += arch-sh/syscalls/setitimer.S
-syscall_src += arch-sh/syscalls/__timer_create.S
-syscall_src += arch-sh/syscalls/__timer_settime.S
-syscall_src += arch-sh/syscalls/__timer_gettime.S
-syscall_src += arch-sh/syscalls/__timer_getoverrun.S
-syscall_src += arch-sh/syscalls/__timer_delete.S
-syscall_src += arch-sh/syscalls/utimes.S
-syscall_src += arch-sh/syscalls/sigaction.S
-syscall_src += arch-sh/syscalls/sigprocmask.S
-syscall_src += arch-sh/syscalls/__sigsuspend.S
-syscall_src += arch-sh/syscalls/__rt_sigaction.S
-syscall_src += arch-sh/syscalls/__rt_sigprocmask.S
-syscall_src += arch-sh/syscalls/__rt_sigtimedwait.S
-syscall_src += arch-sh/syscalls/sigpending.S
-syscall_src += arch-sh/syscalls/__socketcall.S
-syscall_src += arch-sh/syscalls/sched_setscheduler.S
-syscall_src += arch-sh/syscalls/sched_getscheduler.S
-syscall_src += arch-sh/syscalls/sched_yield.S
-syscall_src += arch-sh/syscalls/sched_setparam.S
-syscall_src += arch-sh/syscalls/sched_getparam.S
-syscall_src += arch-sh/syscalls/sched_get_priority_max.S
-syscall_src += arch-sh/syscalls/sched_get_priority_min.S
-syscall_src += arch-sh/syscalls/sched_rr_get_interval.S
-syscall_src += arch-sh/syscalls/sched_setaffinity.S
-syscall_src += arch-sh/syscalls/__sched_getaffinity.S
-syscall_src += arch-sh/syscalls/__getcpu.S
-syscall_src += arch-sh/syscalls/ioprio_set.S
-syscall_src += arch-sh/syscalls/ioprio_get.S
-syscall_src += arch-sh/syscalls/uname.S
-syscall_src += arch-sh/syscalls/__wait4.S
-syscall_src += arch-sh/syscalls/umask.S
-syscall_src += arch-sh/syscalls/__reboot.S
-syscall_src += arch-sh/syscalls/__syslog.S
-syscall_src += arch-sh/syscalls/init_module.S
-syscall_src += arch-sh/syscalls/delete_module.S
-syscall_src += arch-sh/syscalls/klogctl.S
-syscall_src += arch-sh/syscalls/sysinfo.S
-syscall_src += arch-sh/syscalls/futex.S
-syscall_src += arch-sh/syscalls/epoll_create.S
-syscall_src += arch-sh/syscalls/epoll_ctl.S
-syscall_src += arch-sh/syscalls/epoll_wait.S
-syscall_src += arch-sh/syscalls/inotify_init.S
-syscall_src += arch-sh/syscalls/inotify_add_watch.S
-syscall_src += arch-sh/syscalls/inotify_rm_watch.S
-syscall_src += arch-sh/syscalls/poll.S
-syscall_src += arch-sh/syscalls/eventfd.S
diff --git a/libc/arch-sh/syscalls/__brk.S b/libc/arch-sh/syscalls/__brk.S
deleted file mode 100644
index 465389d..0000000
--- a/libc/arch-sh/syscalls/__brk.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __brk, @function
-    .globl __brk
-    .align 4
-
-__brk:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_brk_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_brk_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_brk
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__fcntl.S b/libc/arch-sh/syscalls/__fcntl.S
deleted file mode 100644
index 654ee84..0000000
--- a/libc/arch-sh/syscalls/__fcntl.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __fcntl, @function
-    .globl __fcntl
-    .align 4
-
-__fcntl:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fcntl_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fcntl_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fcntl
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__fcntl64.S b/libc/arch-sh/syscalls/__fcntl64.S
deleted file mode 100644
index 8a2f73f..0000000
--- a/libc/arch-sh/syscalls/__fcntl64.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __fcntl64, @function
-    .globl __fcntl64
-    .align 4
-
-__fcntl64:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fcntl64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fcntl64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fcntl64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__fork.S b/libc/arch-sh/syscalls/__fork.S
deleted file mode 100644
index 5a00daf..0000000
--- a/libc/arch-sh/syscalls/__fork.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __fork, @function
-    .globl __fork
-    .align 4
-
-__fork:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fork_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fork_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fork
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__fstatfs64.S b/libc/arch-sh/syscalls/__fstatfs64.S
deleted file mode 100644
index dcf1d80..0000000
--- a/libc/arch-sh/syscalls/__fstatfs64.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __fstatfs64, @function
-    .globl __fstatfs64
-    .align 4
-
-__fstatfs64:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fstatfs64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fstatfs64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fstatfs64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__getcpu.S b/libc/arch-sh/syscalls/__getcpu.S
deleted file mode 100644
index 125387b..0000000
--- a/libc/arch-sh/syscalls/__getcpu.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __getcpu, @function
-    .globl __getcpu
-    .align 4
-
-__getcpu:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getcpu_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getcpu_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getcpu
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__getcwd.S b/libc/arch-sh/syscalls/__getcwd.S
deleted file mode 100644
index 9ce1f14..0000000
--- a/libc/arch-sh/syscalls/__getcwd.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __getcwd, @function
-    .globl __getcwd
-    .align 4
-
-__getcwd:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getcwd_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getcwd_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getcwd
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__getpriority.S b/libc/arch-sh/syscalls/__getpriority.S
deleted file mode 100644
index aa9f4f3..0000000
--- a/libc/arch-sh/syscalls/__getpriority.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __getpriority, @function
-    .globl __getpriority
-    .align 4
-
-__getpriority:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getpriority_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getpriority_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getpriority
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__ioctl.S b/libc/arch-sh/syscalls/__ioctl.S
deleted file mode 100644
index ec447cf..0000000
--- a/libc/arch-sh/syscalls/__ioctl.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __ioctl, @function
-    .globl __ioctl
-    .align 4
-
-__ioctl:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ioctl_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ioctl_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ioctl
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__llseek.S b/libc/arch-sh/syscalls/__llseek.S
deleted file mode 100644
index e43b3ed..0000000
--- a/libc/arch-sh/syscalls/__llseek.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __llseek, @function
-    .globl __llseek
-    .align 4
-
-__llseek:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR__llseek_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR__llseek_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR__llseek
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__mmap2.S b/libc/arch-sh/syscalls/__mmap2.S
deleted file mode 100644
index 6f70d46..0000000
--- a/libc/arch-sh/syscalls/__mmap2.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __mmap2, @function
-    .globl __mmap2
-    .align 4
-
-__mmap2:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-    mov.l   @(4, r15), r1
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(6 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mmap2_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mmap2_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mmap2
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__open.S b/libc/arch-sh/syscalls/__open.S
deleted file mode 100644
index f57b5b9..0000000
--- a/libc/arch-sh/syscalls/__open.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __open, @function
-    .globl __open
-    .align 4
-
-__open:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_open_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_open_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_open
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__openat.S b/libc/arch-sh/syscalls/__openat.S
deleted file mode 100644
index 08cf096..0000000
--- a/libc/arch-sh/syscalls/__openat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __openat, @function
-    .globl __openat
-    .align 4
-
-__openat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_openat_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_openat_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_openat
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__ptrace.S b/libc/arch-sh/syscalls/__ptrace.S
deleted file mode 100644
index 89bbc98..0000000
--- a/libc/arch-sh/syscalls/__ptrace.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __ptrace, @function
-    .globl __ptrace
-    .align 4
-
-__ptrace:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ptrace_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ptrace_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ptrace
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__reboot.S b/libc/arch-sh/syscalls/__reboot.S
deleted file mode 100644
index 07cff36..0000000
--- a/libc/arch-sh/syscalls/__reboot.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __reboot, @function
-    .globl __reboot
-    .align 4
-
-__reboot:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_reboot_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_reboot_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_reboot
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__rt_sigaction.S b/libc/arch-sh/syscalls/__rt_sigaction.S
deleted file mode 100644
index 693cb76..0000000
--- a/libc/arch-sh/syscalls/__rt_sigaction.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __rt_sigaction, @function
-    .globl __rt_sigaction
-    .align 4
-
-__rt_sigaction:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_rt_sigaction_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_rt_sigaction_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_rt_sigaction
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__rt_sigprocmask.S b/libc/arch-sh/syscalls/__rt_sigprocmask.S
deleted file mode 100644
index 7822d4f..0000000
--- a/libc/arch-sh/syscalls/__rt_sigprocmask.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __rt_sigprocmask, @function
-    .globl __rt_sigprocmask
-    .align 4
-
-__rt_sigprocmask:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_rt_sigprocmask_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_rt_sigprocmask_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_rt_sigprocmask
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__rt_sigtimedwait.S b/libc/arch-sh/syscalls/__rt_sigtimedwait.S
deleted file mode 100644
index 2804169..0000000
--- a/libc/arch-sh/syscalls/__rt_sigtimedwait.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __rt_sigtimedwait, @function
-    .globl __rt_sigtimedwait
-    .align 4
-
-__rt_sigtimedwait:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_rt_sigtimedwait_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_rt_sigtimedwait_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_rt_sigtimedwait
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__sched_getaffinity.S b/libc/arch-sh/syscalls/__sched_getaffinity.S
deleted file mode 100644
index 7e8be6a..0000000
--- a/libc/arch-sh/syscalls/__sched_getaffinity.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __sched_getaffinity, @function
-    .globl __sched_getaffinity
-    .align 4
-
-__sched_getaffinity:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_getaffinity_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_getaffinity_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_getaffinity
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__set_thread_area.S b/libc/arch-sh/syscalls/__set_thread_area.S
deleted file mode 100644
index 7d5aea6..0000000
--- a/libc/arch-sh/syscalls/__set_thread_area.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __set_thread_area, @function
-    .globl __set_thread_area
-    .align 4
-
-__set_thread_area:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_set_thread_area_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_set_thread_area_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_set_thread_area
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__setresuid.S b/libc/arch-sh/syscalls/__setresuid.S
deleted file mode 100644
index 424100e..0000000
--- a/libc/arch-sh/syscalls/__setresuid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __setresuid, @function
-    .globl __setresuid
-    .align 4
-
-__setresuid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setresuid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setresuid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setresuid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__setreuid.S b/libc/arch-sh/syscalls/__setreuid.S
deleted file mode 100644
index 6990748..0000000
--- a/libc/arch-sh/syscalls/__setreuid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __setreuid, @function
-    .globl __setreuid
-    .align 4
-
-__setreuid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setreuid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setreuid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setreuid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__setuid.S b/libc/arch-sh/syscalls/__setuid.S
deleted file mode 100644
index f563de7..0000000
--- a/libc/arch-sh/syscalls/__setuid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __setuid, @function
-    .globl __setuid
-    .align 4
-
-__setuid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setuid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setuid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setuid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__sigsuspend.S b/libc/arch-sh/syscalls/__sigsuspend.S
deleted file mode 100644
index 9643940..0000000
--- a/libc/arch-sh/syscalls/__sigsuspend.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __sigsuspend, @function
-    .globl __sigsuspend
-    .align 4
-
-__sigsuspend:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sigsuspend_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sigsuspend_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sigsuspend
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__socketcall.S b/libc/arch-sh/syscalls/__socketcall.S
deleted file mode 100644
index 864e9aa..0000000
--- a/libc/arch-sh/syscalls/__socketcall.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __socketcall, @function
-    .globl __socketcall
-    .align 4
-
-__socketcall:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR___socketcall_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR___socketcall_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR___socketcall
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__statfs64.S b/libc/arch-sh/syscalls/__statfs64.S
deleted file mode 100644
index ccd137b..0000000
--- a/libc/arch-sh/syscalls/__statfs64.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __statfs64, @function
-    .globl __statfs64
-    .align 4
-
-__statfs64:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_statfs64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_statfs64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_statfs64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__sys_clone.S b/libc/arch-sh/syscalls/__sys_clone.S
deleted file mode 100644
index c2e7dd2..0000000
--- a/libc/arch-sh/syscalls/__sys_clone.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __sys_clone, @function
-    .globl __sys_clone
-    .align 4
-
-__sys_clone:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_clone_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_clone_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_clone
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__syslog.S b/libc/arch-sh/syscalls/__syslog.S
deleted file mode 100644
index ea1ac38..0000000
--- a/libc/arch-sh/syscalls/__syslog.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __syslog, @function
-    .globl __syslog
-    .align 4
-
-__syslog:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_syslog_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_syslog_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_syslog
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__timer_create.S b/libc/arch-sh/syscalls/__timer_create.S
deleted file mode 100644
index f2e2e5c..0000000
--- a/libc/arch-sh/syscalls/__timer_create.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __timer_create, @function
-    .globl __timer_create
-    .align 4
-
-__timer_create:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_timer_create_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_timer_create_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_timer_create
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__timer_delete.S b/libc/arch-sh/syscalls/__timer_delete.S
deleted file mode 100644
index d655d3d..0000000
--- a/libc/arch-sh/syscalls/__timer_delete.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __timer_delete, @function
-    .globl __timer_delete
-    .align 4
-
-__timer_delete:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_timer_delete_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_timer_delete_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_timer_delete
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__timer_getoverrun.S b/libc/arch-sh/syscalls/__timer_getoverrun.S
deleted file mode 100644
index 64fa92f..0000000
--- a/libc/arch-sh/syscalls/__timer_getoverrun.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __timer_getoverrun, @function
-    .globl __timer_getoverrun
-    .align 4
-
-__timer_getoverrun:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_timer_getoverrun_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_timer_getoverrun_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_timer_getoverrun
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__timer_gettime.S b/libc/arch-sh/syscalls/__timer_gettime.S
deleted file mode 100644
index f1c63ed..0000000
--- a/libc/arch-sh/syscalls/__timer_gettime.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __timer_gettime, @function
-    .globl __timer_gettime
-    .align 4
-
-__timer_gettime:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_timer_gettime_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_timer_gettime_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_timer_gettime
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__timer_settime.S b/libc/arch-sh/syscalls/__timer_settime.S
deleted file mode 100644
index ea438a6..0000000
--- a/libc/arch-sh/syscalls/__timer_settime.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __timer_settime, @function
-    .globl __timer_settime
-    .align 4
-
-__timer_settime:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_timer_settime_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_timer_settime_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_timer_settime
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__wait4.S b/libc/arch-sh/syscalls/__wait4.S
deleted file mode 100644
index a145e34..0000000
--- a/libc/arch-sh/syscalls/__wait4.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __wait4, @function
-    .globl __wait4
-    .align 4
-
-__wait4:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_wait4_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_wait4_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_wait4
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/__waitid.S b/libc/arch-sh/syscalls/__waitid.S
deleted file mode 100644
index 1f58de0..0000000
--- a/libc/arch-sh/syscalls/__waitid.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type __waitid, @function
-    .globl __waitid
-    .align 4
-
-__waitid:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_waitid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_waitid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_waitid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/_exit.S b/libc/arch-sh/syscalls/_exit.S
deleted file mode 100644
index 377a98a..0000000
--- a/libc/arch-sh/syscalls/_exit.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type _exit, @function
-    .globl _exit
-    .align 4
-
-_exit:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_exit_group_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_exit_group_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_exit_group
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/_exit_thread.S b/libc/arch-sh/syscalls/_exit_thread.S
deleted file mode 100644
index 536d000..0000000
--- a/libc/arch-sh/syscalls/_exit_thread.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type _exit_thread, @function
-    .globl _exit_thread
-    .align 4
-
-_exit_thread:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_exit_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_exit_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_exit
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/_waitpid.S b/libc/arch-sh/syscalls/_waitpid.S
deleted file mode 100644
index db2cf61..0000000
--- a/libc/arch-sh/syscalls/_waitpid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type _waitpid, @function
-    .globl _waitpid
-    .align 4
-
-_waitpid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_waitpid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_waitpid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_waitpid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/access.S b/libc/arch-sh/syscalls/access.S
deleted file mode 100644
index dea8dfb..0000000
--- a/libc/arch-sh/syscalls/access.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type access, @function
-    .globl access
-    .align 4
-
-access:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_access_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_access_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_access
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/acct.S b/libc/arch-sh/syscalls/acct.S
deleted file mode 100644
index 22d939e..0000000
--- a/libc/arch-sh/syscalls/acct.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type acct, @function
-    .globl acct
-    .align 4
-
-acct:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_acct_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_acct_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_acct
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/capget.S b/libc/arch-sh/syscalls/capget.S
deleted file mode 100644
index 77f6c54..0000000
--- a/libc/arch-sh/syscalls/capget.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type capget, @function
-    .globl capget
-    .align 4
-
-capget:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_capget_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_capget_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_capget
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/capset.S b/libc/arch-sh/syscalls/capset.S
deleted file mode 100644
index c35b48e..0000000
--- a/libc/arch-sh/syscalls/capset.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type capset, @function
-    .globl capset
-    .align 4
-
-capset:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_capset_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_capset_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_capset
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/chdir.S b/libc/arch-sh/syscalls/chdir.S
deleted file mode 100644
index 32b4a92..0000000
--- a/libc/arch-sh/syscalls/chdir.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type chdir, @function
-    .globl chdir
-    .align 4
-
-chdir:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_chdir_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_chdir_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_chdir
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/chmod.S b/libc/arch-sh/syscalls/chmod.S
deleted file mode 100644
index f145e4b..0000000
--- a/libc/arch-sh/syscalls/chmod.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type chmod, @function
-    .globl chmod
-    .align 4
-
-chmod:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_chmod_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_chmod_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_chmod
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/chown.S b/libc/arch-sh/syscalls/chown.S
deleted file mode 100644
index 4938a2a..0000000
--- a/libc/arch-sh/syscalls/chown.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type chown, @function
-    .globl chown
-    .align 4
-
-chown:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_chown32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_chown32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_chown32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/chroot.S b/libc/arch-sh/syscalls/chroot.S
deleted file mode 100644
index a60b59d..0000000
--- a/libc/arch-sh/syscalls/chroot.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type chroot, @function
-    .globl chroot
-    .align 4
-
-chroot:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_chroot_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_chroot_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_chroot
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/clock_getres.S b/libc/arch-sh/syscalls/clock_getres.S
deleted file mode 100644
index 0b38f22..0000000
--- a/libc/arch-sh/syscalls/clock_getres.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type clock_getres, @function
-    .globl clock_getres
-    .align 4
-
-clock_getres:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_clock_getres_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_clock_getres_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_clock_getres
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/clock_gettime.S b/libc/arch-sh/syscalls/clock_gettime.S
deleted file mode 100644
index 67952a6..0000000
--- a/libc/arch-sh/syscalls/clock_gettime.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type clock_gettime, @function
-    .globl clock_gettime
-    .align 4
-
-clock_gettime:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_clock_gettime_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_clock_gettime_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_clock_gettime
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/clock_nanosleep.S b/libc/arch-sh/syscalls/clock_nanosleep.S
deleted file mode 100644
index 7ef8d5e..0000000
--- a/libc/arch-sh/syscalls/clock_nanosleep.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type clock_nanosleep, @function
-    .globl clock_nanosleep
-    .align 4
-
-clock_nanosleep:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_clock_nanosleep_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_clock_nanosleep_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_clock_nanosleep
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/clock_settime.S b/libc/arch-sh/syscalls/clock_settime.S
deleted file mode 100644
index fd48ac6..0000000
--- a/libc/arch-sh/syscalls/clock_settime.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type clock_settime, @function
-    .globl clock_settime
-    .align 4
-
-clock_settime:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_clock_settime_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_clock_settime_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_clock_settime
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/close.S b/libc/arch-sh/syscalls/close.S
deleted file mode 100644
index b59002d..0000000
--- a/libc/arch-sh/syscalls/close.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type close, @function
-    .globl close
-    .align 4
-
-close:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_close_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_close_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_close
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/delete_module.S b/libc/arch-sh/syscalls/delete_module.S
deleted file mode 100644
index 73410a9..0000000
--- a/libc/arch-sh/syscalls/delete_module.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type delete_module, @function
-    .globl delete_module
-    .align 4
-
-delete_module:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_delete_module_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_delete_module_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_delete_module
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/dup.S b/libc/arch-sh/syscalls/dup.S
deleted file mode 100644
index 1c87dd7..0000000
--- a/libc/arch-sh/syscalls/dup.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type dup, @function
-    .globl dup
-    .align 4
-
-dup:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_dup_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_dup_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_dup
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/dup2.S b/libc/arch-sh/syscalls/dup2.S
deleted file mode 100644
index da2b7bd..0000000
--- a/libc/arch-sh/syscalls/dup2.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type dup2, @function
-    .globl dup2
-    .align 4
-
-dup2:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_dup2_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_dup2_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_dup2
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/epoll_create.S b/libc/arch-sh/syscalls/epoll_create.S
deleted file mode 100644
index 64ca8a0..0000000
--- a/libc/arch-sh/syscalls/epoll_create.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type epoll_create, @function
-    .globl epoll_create
-    .align 4
-
-epoll_create:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_epoll_create_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_epoll_create_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_epoll_create
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/epoll_ctl.S b/libc/arch-sh/syscalls/epoll_ctl.S
deleted file mode 100644
index 0293e73..0000000
--- a/libc/arch-sh/syscalls/epoll_ctl.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type epoll_ctl, @function
-    .globl epoll_ctl
-    .align 4
-
-epoll_ctl:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_epoll_ctl_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_epoll_ctl_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_epoll_ctl
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/epoll_wait.S b/libc/arch-sh/syscalls/epoll_wait.S
deleted file mode 100644
index acea8b5..0000000
--- a/libc/arch-sh/syscalls/epoll_wait.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type epoll_wait, @function
-    .globl epoll_wait
-    .align 4
-
-epoll_wait:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_epoll_wait_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_epoll_wait_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_epoll_wait
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/eventfd.S b/libc/arch-sh/syscalls/eventfd.S
deleted file mode 100644
index c73bf23..0000000
--- a/libc/arch-sh/syscalls/eventfd.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type eventfd, @function
-    .globl eventfd
-    .align 4
-
-eventfd:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_eventfd2_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_eventfd2_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_eventfd2
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/execve.S b/libc/arch-sh/syscalls/execve.S
deleted file mode 100644
index e4c451a..0000000
--- a/libc/arch-sh/syscalls/execve.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type execve, @function
-    .globl execve
-    .align 4
-
-execve:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_execve_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_execve_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_execve
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fchmod.S b/libc/arch-sh/syscalls/fchmod.S
deleted file mode 100644
index 07b8156..0000000
--- a/libc/arch-sh/syscalls/fchmod.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fchmod, @function
-    .globl fchmod
-    .align 4
-
-fchmod:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fchmod_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fchmod_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fchmod
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fchmodat.S b/libc/arch-sh/syscalls/fchmodat.S
deleted file mode 100644
index 2532d12..0000000
--- a/libc/arch-sh/syscalls/fchmodat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fchmodat, @function
-    .globl fchmodat
-    .align 4
-
-fchmodat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fchmodat_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fchmodat_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fchmodat
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fchown.S b/libc/arch-sh/syscalls/fchown.S
deleted file mode 100644
index a49f7d7..0000000
--- a/libc/arch-sh/syscalls/fchown.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fchown, @function
-    .globl fchown
-    .align 4
-
-fchown:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fchown32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fchown32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fchown32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fchownat.S b/libc/arch-sh/syscalls/fchownat.S
deleted file mode 100644
index 3e82637..0000000
--- a/libc/arch-sh/syscalls/fchownat.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fchownat, @function
-    .globl fchownat
-    .align 4
-
-fchownat:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fchownat_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fchownat_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fchownat
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fdatasync.S b/libc/arch-sh/syscalls/fdatasync.S
deleted file mode 100644
index d81c33a..0000000
--- a/libc/arch-sh/syscalls/fdatasync.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fdatasync, @function
-    .globl fdatasync
-    .align 4
-
-fdatasync:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fdatasync_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fdatasync_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fdatasync
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/flock.S b/libc/arch-sh/syscalls/flock.S
deleted file mode 100644
index d4274ea..0000000
--- a/libc/arch-sh/syscalls/flock.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type flock, @function
-    .globl flock
-    .align 4
-
-flock:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_flock_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_flock_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_flock
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fstat.S b/libc/arch-sh/syscalls/fstat.S
deleted file mode 100644
index bdb4952..0000000
--- a/libc/arch-sh/syscalls/fstat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fstat, @function
-    .globl fstat
-    .align 4
-
-fstat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fstat64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fstat64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fstat64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fstatat.S b/libc/arch-sh/syscalls/fstatat.S
deleted file mode 100644
index a5b18d1..0000000
--- a/libc/arch-sh/syscalls/fstatat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fstatat, @function
-    .globl fstatat
-    .align 4
-
-fstatat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fstatat64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fstatat64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fstatat64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fsync.S b/libc/arch-sh/syscalls/fsync.S
deleted file mode 100644
index 7904f53..0000000
--- a/libc/arch-sh/syscalls/fsync.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type fsync, @function
-    .globl fsync
-    .align 4
-
-fsync:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_fsync_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_fsync_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_fsync
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/ftruncate.S b/libc/arch-sh/syscalls/ftruncate.S
deleted file mode 100644
index 8c34333..0000000
--- a/libc/arch-sh/syscalls/ftruncate.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type ftruncate, @function
-    .globl ftruncate
-    .align 4
-
-ftruncate:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ftruncate_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ftruncate_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ftruncate
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/ftruncate64.S b/libc/arch-sh/syscalls/ftruncate64.S
deleted file mode 100644
index f4c7c1e..0000000
--- a/libc/arch-sh/syscalls/ftruncate64.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type ftruncate64, @function
-    .globl ftruncate64
-    .align 4
-
-ftruncate64:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ftruncate64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ftruncate64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ftruncate64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/futex.S b/libc/arch-sh/syscalls/futex.S
deleted file mode 100644
index 2aabd92..0000000
--- a/libc/arch-sh/syscalls/futex.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type futex, @function
-    .globl futex
-    .align 4
-
-futex:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-    mov.l   @(4, r15), r1
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(6 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_futex_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_futex_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_futex
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getdents.S b/libc/arch-sh/syscalls/getdents.S
deleted file mode 100644
index 66aedf3..0000000
--- a/libc/arch-sh/syscalls/getdents.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getdents, @function
-    .globl getdents
-    .align 4
-
-getdents:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getdents64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getdents64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getdents64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getegid.S b/libc/arch-sh/syscalls/getegid.S
deleted file mode 100644
index b3b91ca..0000000
--- a/libc/arch-sh/syscalls/getegid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getegid, @function
-    .globl getegid
-    .align 4
-
-getegid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getegid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getegid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getegid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/geteuid.S b/libc/arch-sh/syscalls/geteuid.S
deleted file mode 100644
index 50f3549..0000000
--- a/libc/arch-sh/syscalls/geteuid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type geteuid, @function
-    .globl geteuid
-    .align 4
-
-geteuid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_geteuid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_geteuid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_geteuid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getgid.S b/libc/arch-sh/syscalls/getgid.S
deleted file mode 100644
index 54480b7..0000000
--- a/libc/arch-sh/syscalls/getgid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getgid, @function
-    .globl getgid
-    .align 4
-
-getgid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getgid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getgid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getgid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getgroups.S b/libc/arch-sh/syscalls/getgroups.S
deleted file mode 100644
index 854477e..0000000
--- a/libc/arch-sh/syscalls/getgroups.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getgroups, @function
-    .globl getgroups
-    .align 4
-
-getgroups:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getgroups32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getgroups32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getgroups32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getitimer.S b/libc/arch-sh/syscalls/getitimer.S
deleted file mode 100644
index aa444a6..0000000
--- a/libc/arch-sh/syscalls/getitimer.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getitimer, @function
-    .globl getitimer
-    .align 4
-
-getitimer:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getitimer_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getitimer_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getitimer
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getpgid.S b/libc/arch-sh/syscalls/getpgid.S
deleted file mode 100644
index 0ff101d..0000000
--- a/libc/arch-sh/syscalls/getpgid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getpgid, @function
-    .globl getpgid
-    .align 4
-
-getpgid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getpgid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getpgid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getpgid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getpid.S b/libc/arch-sh/syscalls/getpid.S
deleted file mode 100644
index 5606694..0000000
--- a/libc/arch-sh/syscalls/getpid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getpid, @function
-    .globl getpid
-    .align 4
-
-getpid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getpid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getpid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getpid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getppid.S b/libc/arch-sh/syscalls/getppid.S
deleted file mode 100644
index bf12372..0000000
--- a/libc/arch-sh/syscalls/getppid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getppid, @function
-    .globl getppid
-    .align 4
-
-getppid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getppid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getppid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getppid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getresgid.S b/libc/arch-sh/syscalls/getresgid.S
deleted file mode 100644
index 3677211..0000000
--- a/libc/arch-sh/syscalls/getresgid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getresgid, @function
-    .globl getresgid
-    .align 4
-
-getresgid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getresgid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getresgid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getresgid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getresuid.S b/libc/arch-sh/syscalls/getresuid.S
deleted file mode 100644
index 857495e..0000000
--- a/libc/arch-sh/syscalls/getresuid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getresuid, @function
-    .globl getresuid
-    .align 4
-
-getresuid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getresuid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getresuid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getresuid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getrlimit.S b/libc/arch-sh/syscalls/getrlimit.S
deleted file mode 100644
index 78135d4..0000000
--- a/libc/arch-sh/syscalls/getrlimit.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getrlimit, @function
-    .globl getrlimit
-    .align 4
-
-getrlimit:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ugetrlimit_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ugetrlimit_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ugetrlimit
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getrusage.S b/libc/arch-sh/syscalls/getrusage.S
deleted file mode 100644
index ccd9094..0000000
--- a/libc/arch-sh/syscalls/getrusage.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getrusage, @function
-    .globl getrusage
-    .align 4
-
-getrusage:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getrusage_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getrusage_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getrusage
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/gettid.S b/libc/arch-sh/syscalls/gettid.S
deleted file mode 100644
index bc25405..0000000
--- a/libc/arch-sh/syscalls/gettid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type gettid, @function
-    .globl gettid
-    .align 4
-
-gettid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_gettid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_gettid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_gettid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/gettimeofday.S b/libc/arch-sh/syscalls/gettimeofday.S
deleted file mode 100644
index 50aba80..0000000
--- a/libc/arch-sh/syscalls/gettimeofday.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type gettimeofday, @function
-    .globl gettimeofday
-    .align 4
-
-gettimeofday:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_gettimeofday_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_gettimeofday_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_gettimeofday
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/getuid.S b/libc/arch-sh/syscalls/getuid.S
deleted file mode 100644
index 9f9740d..0000000
--- a/libc/arch-sh/syscalls/getuid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type getuid, @function
-    .globl getuid
-    .align 4
-
-getuid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_getuid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_getuid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_getuid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/init_module.S b/libc/arch-sh/syscalls/init_module.S
deleted file mode 100644
index bd3be14..0000000
--- a/libc/arch-sh/syscalls/init_module.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type init_module, @function
-    .globl init_module
-    .align 4
-
-init_module:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_init_module_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_init_module_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_init_module
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/inotify_add_watch.S b/libc/arch-sh/syscalls/inotify_add_watch.S
deleted file mode 100644
index 84d373e..0000000
--- a/libc/arch-sh/syscalls/inotify_add_watch.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type inotify_add_watch, @function
-    .globl inotify_add_watch
-    .align 4
-
-inotify_add_watch:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_inotify_add_watch_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_inotify_add_watch_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_inotify_add_watch
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/inotify_init.S b/libc/arch-sh/syscalls/inotify_init.S
deleted file mode 100644
index 4030f69..0000000
--- a/libc/arch-sh/syscalls/inotify_init.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type inotify_init, @function
-    .globl inotify_init
-    .align 4
-
-inotify_init:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_inotify_init_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_inotify_init_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_inotify_init
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/inotify_rm_watch.S b/libc/arch-sh/syscalls/inotify_rm_watch.S
deleted file mode 100644
index 7a03447..0000000
--- a/libc/arch-sh/syscalls/inotify_rm_watch.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type inotify_rm_watch, @function
-    .globl inotify_rm_watch
-    .align 4
-
-inotify_rm_watch:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_inotify_rm_watch_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_inotify_rm_watch_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_inotify_rm_watch
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/ioprio_get.S b/libc/arch-sh/syscalls/ioprio_get.S
deleted file mode 100644
index 802eb91..0000000
--- a/libc/arch-sh/syscalls/ioprio_get.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type ioprio_get, @function
-    .globl ioprio_get
-    .align 4
-
-ioprio_get:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ioprio_get_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ioprio_get_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ioprio_get
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/ioprio_set.S b/libc/arch-sh/syscalls/ioprio_set.S
deleted file mode 100644
index 209d756..0000000
--- a/libc/arch-sh/syscalls/ioprio_set.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type ioprio_set, @function
-    .globl ioprio_set
-    .align 4
-
-ioprio_set:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_ioprio_set_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_ioprio_set_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_ioprio_set
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/kill.S b/libc/arch-sh/syscalls/kill.S
deleted file mode 100644
index d331cde..0000000
--- a/libc/arch-sh/syscalls/kill.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type kill, @function
-    .globl kill
-    .align 4
-
-kill:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_kill_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_kill_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_kill
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/klogctl.S b/libc/arch-sh/syscalls/klogctl.S
deleted file mode 100644
index 925875f..0000000
--- a/libc/arch-sh/syscalls/klogctl.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type klogctl, @function
-    .globl klogctl
-    .align 4
-
-klogctl:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_syslog_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_syslog_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_syslog
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/lchown.S b/libc/arch-sh/syscalls/lchown.S
deleted file mode 100644
index 0d94631..0000000
--- a/libc/arch-sh/syscalls/lchown.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type lchown, @function
-    .globl lchown
-    .align 4
-
-lchown:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_lchown32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_lchown32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_lchown32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/link.S b/libc/arch-sh/syscalls/link.S
deleted file mode 100644
index f1716a7..0000000
--- a/libc/arch-sh/syscalls/link.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type link, @function
-    .globl link
-    .align 4
-
-link:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_link_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_link_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_link
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/lseek.S b/libc/arch-sh/syscalls/lseek.S
deleted file mode 100644
index df476ff..0000000
--- a/libc/arch-sh/syscalls/lseek.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type lseek, @function
-    .globl lseek
-    .align 4
-
-lseek:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_lseek_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_lseek_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_lseek
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/lstat.S b/libc/arch-sh/syscalls/lstat.S
deleted file mode 100644
index 249c92e..0000000
--- a/libc/arch-sh/syscalls/lstat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type lstat, @function
-    .globl lstat
-    .align 4
-
-lstat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_lstat64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_lstat64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_lstat64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/madvise.S b/libc/arch-sh/syscalls/madvise.S
deleted file mode 100644
index e47eb3d..0000000
--- a/libc/arch-sh/syscalls/madvise.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type madvise, @function
-    .globl madvise
-    .align 4
-
-madvise:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_madvise_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_madvise_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_madvise
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mincore.S b/libc/arch-sh/syscalls/mincore.S
deleted file mode 100644
index 3803358..0000000
--- a/libc/arch-sh/syscalls/mincore.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mincore, @function
-    .globl mincore
-    .align 4
-
-mincore:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mincore_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mincore_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mincore
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mkdir.S b/libc/arch-sh/syscalls/mkdir.S
deleted file mode 100644
index f40068a..0000000
--- a/libc/arch-sh/syscalls/mkdir.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mkdir, @function
-    .globl mkdir
-    .align 4
-
-mkdir:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mkdir_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mkdir_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mkdir
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mkdirat.S b/libc/arch-sh/syscalls/mkdirat.S
deleted file mode 100644
index e3506f8..0000000
--- a/libc/arch-sh/syscalls/mkdirat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mkdirat, @function
-    .globl mkdirat
-    .align 4
-
-mkdirat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mkdirat_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mkdirat_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mkdirat
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mknod.S b/libc/arch-sh/syscalls/mknod.S
deleted file mode 100644
index a2ab1ed..0000000
--- a/libc/arch-sh/syscalls/mknod.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mknod, @function
-    .globl mknod
-    .align 4
-
-mknod:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mknod_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mknod_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mknod
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mlock.S b/libc/arch-sh/syscalls/mlock.S
deleted file mode 100644
index 2965d75..0000000
--- a/libc/arch-sh/syscalls/mlock.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mlock, @function
-    .globl mlock
-    .align 4
-
-mlock:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mlock_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mlock_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mlock
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mount.S b/libc/arch-sh/syscalls/mount.S
deleted file mode 100644
index d8c7c4b..0000000
--- a/libc/arch-sh/syscalls/mount.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mount, @function
-    .globl mount
-    .align 4
-
-mount:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mount_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mount_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mount
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mprotect.S b/libc/arch-sh/syscalls/mprotect.S
deleted file mode 100644
index d8fc96d..0000000
--- a/libc/arch-sh/syscalls/mprotect.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mprotect, @function
-    .globl mprotect
-    .align 4
-
-mprotect:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mprotect_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mprotect_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mprotect
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/mremap.S b/libc/arch-sh/syscalls/mremap.S
deleted file mode 100644
index d68fffb..0000000
--- a/libc/arch-sh/syscalls/mremap.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type mremap, @function
-    .globl mremap
-    .align 4
-
-mremap:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_mremap_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_mremap_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_mremap
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/msync.S b/libc/arch-sh/syscalls/msync.S
deleted file mode 100644
index 2b84bdb..0000000
--- a/libc/arch-sh/syscalls/msync.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type msync, @function
-    .globl msync
-    .align 4
-
-msync:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_msync_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_msync_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_msync
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/munlock.S b/libc/arch-sh/syscalls/munlock.S
deleted file mode 100644
index c84c130..0000000
--- a/libc/arch-sh/syscalls/munlock.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type munlock, @function
-    .globl munlock
-    .align 4
-
-munlock:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_munlock_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_munlock_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_munlock
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/munmap.S b/libc/arch-sh/syscalls/munmap.S
deleted file mode 100644
index e338540..0000000
--- a/libc/arch-sh/syscalls/munmap.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type munmap, @function
-    .globl munmap
-    .align 4
-
-munmap:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_munmap_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_munmap_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_munmap
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/nanosleep.S b/libc/arch-sh/syscalls/nanosleep.S
deleted file mode 100644
index 5aec582..0000000
--- a/libc/arch-sh/syscalls/nanosleep.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type nanosleep, @function
-    .globl nanosleep
-    .align 4
-
-nanosleep:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_nanosleep_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_nanosleep_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_nanosleep
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/pause.S b/libc/arch-sh/syscalls/pause.S
deleted file mode 100644
index 23952d5..0000000
--- a/libc/arch-sh/syscalls/pause.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type pause, @function
-    .globl pause
-    .align 4
-
-pause:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_pause_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_pause_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_pause
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/fchdir.S b/libc/arch-sh/syscalls/personality.S
similarity index 72%
rename from libc/arch-sh/syscalls/fchdir.S
rename to libc/arch-sh/syscalls/personality.S
index 9743935..efc2ea3 100644
--- a/libc/arch-sh/syscalls/fchdir.S
+++ b/libc/arch-sh/syscalls/personality.S
@@ -2,11 +2,11 @@
 #include <sys/linux-syscalls.h>
 
     .text
-    .type fchdir, @function
-    .globl fchdir
+    .type personality, @function
+    .globl personality
     .align 4
 
-fchdir:
+personality:
 
     /* invoke trap */
     mov.l   0f, r3  /* trap num */
@@ -14,7 +14,7 @@
 
     /* check return value */
     cmp/pz  r0
-    bt      __NR_fchdir_end
+    bt      __NR_personality_end
 
     /* keep error number */
     sts.l   pr, @-r15
@@ -23,10 +23,10 @@
     mov     r0, r4
     lds.l   @r15+, pr
 
-__NR_fchdir_end:
+__NR_personality_end:
     rts
     nop
 
     .align  2
-0:  .long   __NR_fchdir
+0:  .long   __NR_personality
 1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/pipe2.S b/libc/arch-sh/syscalls/pipe2.S
deleted file mode 100644
index f6d9964..0000000
--- a/libc/arch-sh/syscalls/pipe2.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type pipe2, @function
-    .globl pipe2
-    .align 4
-
-pipe2:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_pipe2_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_pipe2_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_pipe2
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/poll.S b/libc/arch-sh/syscalls/poll.S
deleted file mode 100644
index 7080298..0000000
--- a/libc/arch-sh/syscalls/poll.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type poll, @function
-    .globl poll
-    .align 4
-
-poll:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_poll_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_poll_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_poll
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/prctl.S b/libc/arch-sh/syscalls/prctl.S
deleted file mode 100644
index 8c244d4..0000000
--- a/libc/arch-sh/syscalls/prctl.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type prctl, @function
-    .globl prctl
-    .align 4
-
-prctl:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_prctl_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_prctl_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_prctl
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/pread64.S b/libc/arch-sh/syscalls/pread64.S
deleted file mode 100644
index 702a402..0000000
--- a/libc/arch-sh/syscalls/pread64.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type pread64, @function
-    .globl pread64
-    .align 4
-
-pread64:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_pread64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_pread64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_pread64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/pwrite64.S b/libc/arch-sh/syscalls/pwrite64.S
deleted file mode 100644
index 3f6c192..0000000
--- a/libc/arch-sh/syscalls/pwrite64.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type pwrite64, @function
-    .globl pwrite64
-    .align 4
-
-pwrite64:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_pwrite64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_pwrite64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_pwrite64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/read.S b/libc/arch-sh/syscalls/read.S
deleted file mode 100644
index ac9faa1..0000000
--- a/libc/arch-sh/syscalls/read.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type read, @function
-    .globl read
-    .align 4
-
-read:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_read_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_read_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_read
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/readlink.S b/libc/arch-sh/syscalls/readlink.S
deleted file mode 100644
index e27cec7..0000000
--- a/libc/arch-sh/syscalls/readlink.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type readlink, @function
-    .globl readlink
-    .align 4
-
-readlink:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_readlink_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_readlink_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_readlink
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/readv.S b/libc/arch-sh/syscalls/readv.S
deleted file mode 100644
index 2a95ea1..0000000
--- a/libc/arch-sh/syscalls/readv.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type readv, @function
-    .globl readv
-    .align 4
-
-readv:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_readv_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_readv_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_readv
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/rename.S b/libc/arch-sh/syscalls/rename.S
deleted file mode 100644
index 692f40e..0000000
--- a/libc/arch-sh/syscalls/rename.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type rename, @function
-    .globl rename
-    .align 4
-
-rename:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_rename_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_rename_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_rename
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/renameat.S b/libc/arch-sh/syscalls/renameat.S
deleted file mode 100644
index 0c9360f..0000000
--- a/libc/arch-sh/syscalls/renameat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type renameat, @function
-    .globl renameat
-    .align 4
-
-renameat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_renameat_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_renameat_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_renameat
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/rmdir.S b/libc/arch-sh/syscalls/rmdir.S
deleted file mode 100644
index 124892e..0000000
--- a/libc/arch-sh/syscalls/rmdir.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type rmdir, @function
-    .globl rmdir
-    .align 4
-
-rmdir:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_rmdir_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_rmdir_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_rmdir
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_get_priority_max.S b/libc/arch-sh/syscalls/sched_get_priority_max.S
deleted file mode 100644
index dd642bf..0000000
--- a/libc/arch-sh/syscalls/sched_get_priority_max.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_get_priority_max, @function
-    .globl sched_get_priority_max
-    .align 4
-
-sched_get_priority_max:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_get_priority_max_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_get_priority_max_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_get_priority_max
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_get_priority_min.S b/libc/arch-sh/syscalls/sched_get_priority_min.S
deleted file mode 100644
index 069b116..0000000
--- a/libc/arch-sh/syscalls/sched_get_priority_min.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_get_priority_min, @function
-    .globl sched_get_priority_min
-    .align 4
-
-sched_get_priority_min:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_get_priority_min_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_get_priority_min_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_get_priority_min
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_getparam.S b/libc/arch-sh/syscalls/sched_getparam.S
deleted file mode 100644
index c8417b2..0000000
--- a/libc/arch-sh/syscalls/sched_getparam.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_getparam, @function
-    .globl sched_getparam
-    .align 4
-
-sched_getparam:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_getparam_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_getparam_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_getparam
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_getscheduler.S b/libc/arch-sh/syscalls/sched_getscheduler.S
deleted file mode 100644
index ecd9a6a..0000000
--- a/libc/arch-sh/syscalls/sched_getscheduler.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_getscheduler, @function
-    .globl sched_getscheduler
-    .align 4
-
-sched_getscheduler:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_getscheduler_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_getscheduler_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_getscheduler
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_rr_get_interval.S b/libc/arch-sh/syscalls/sched_rr_get_interval.S
deleted file mode 100644
index 64d5f69..0000000
--- a/libc/arch-sh/syscalls/sched_rr_get_interval.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_rr_get_interval, @function
-    .globl sched_rr_get_interval
-    .align 4
-
-sched_rr_get_interval:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_rr_get_interval_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_rr_get_interval_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_rr_get_interval
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_setaffinity.S b/libc/arch-sh/syscalls/sched_setaffinity.S
deleted file mode 100644
index 9dda3b4..0000000
--- a/libc/arch-sh/syscalls/sched_setaffinity.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_setaffinity, @function
-    .globl sched_setaffinity
-    .align 4
-
-sched_setaffinity:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_setaffinity_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_setaffinity_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_setaffinity
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_setparam.S b/libc/arch-sh/syscalls/sched_setparam.S
deleted file mode 100644
index f1687ee..0000000
--- a/libc/arch-sh/syscalls/sched_setparam.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_setparam, @function
-    .globl sched_setparam
-    .align 4
-
-sched_setparam:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_setparam_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_setparam_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_setparam
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_setscheduler.S b/libc/arch-sh/syscalls/sched_setscheduler.S
deleted file mode 100644
index 7a6becf..0000000
--- a/libc/arch-sh/syscalls/sched_setscheduler.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_setscheduler, @function
-    .globl sched_setscheduler
-    .align 4
-
-sched_setscheduler:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_setscheduler_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_setscheduler_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_setscheduler
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sched_yield.S b/libc/arch-sh/syscalls/sched_yield.S
deleted file mode 100644
index 538f487..0000000
--- a/libc/arch-sh/syscalls/sched_yield.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sched_yield, @function
-    .globl sched_yield
-    .align 4
-
-sched_yield:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sched_yield_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sched_yield_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sched_yield
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/select.S b/libc/arch-sh/syscalls/select.S
deleted file mode 100644
index b68f46a..0000000
--- a/libc/arch-sh/syscalls/select.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type select, @function
-    .globl select
-    .align 4
-
-select:
-
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(5 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR__newselect_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR__newselect_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR__newselect
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sendfile.S b/libc/arch-sh/syscalls/sendfile.S
deleted file mode 100644
index 015e433..0000000
--- a/libc/arch-sh/syscalls/sendfile.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sendfile, @function
-    .globl sendfile
-    .align 4
-
-sendfile:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(4 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sendfile_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sendfile_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sendfile
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setgid.S b/libc/arch-sh/syscalls/setgid.S
deleted file mode 100644
index 2941fc1..0000000
--- a/libc/arch-sh/syscalls/setgid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setgid, @function
-    .globl setgid
-    .align 4
-
-setgid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setgid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setgid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setgid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setgroups.S b/libc/arch-sh/syscalls/setgroups.S
deleted file mode 100644
index 723535d..0000000
--- a/libc/arch-sh/syscalls/setgroups.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setgroups, @function
-    .globl setgroups
-    .align 4
-
-setgroups:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setgroups32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setgroups32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setgroups32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setitimer.S b/libc/arch-sh/syscalls/setitimer.S
deleted file mode 100644
index 84f0590..0000000
--- a/libc/arch-sh/syscalls/setitimer.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setitimer, @function
-    .globl setitimer
-    .align 4
-
-setitimer:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setitimer_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setitimer_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setitimer
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setpgid.S b/libc/arch-sh/syscalls/setpgid.S
deleted file mode 100644
index 1dd8b33..0000000
--- a/libc/arch-sh/syscalls/setpgid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setpgid, @function
-    .globl setpgid
-    .align 4
-
-setpgid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setpgid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setpgid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setpgid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setpriority.S b/libc/arch-sh/syscalls/setpriority.S
deleted file mode 100644
index 4f5091f..0000000
--- a/libc/arch-sh/syscalls/setpriority.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setpriority, @function
-    .globl setpriority
-    .align 4
-
-setpriority:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setpriority_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setpriority_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setpriority
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setregid.S b/libc/arch-sh/syscalls/setregid.S
deleted file mode 100644
index 695f231..0000000
--- a/libc/arch-sh/syscalls/setregid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setregid, @function
-    .globl setregid
-    .align 4
-
-setregid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setregid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setregid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setregid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setresgid.S b/libc/arch-sh/syscalls/setresgid.S
deleted file mode 100644
index 867cbc1..0000000
--- a/libc/arch-sh/syscalls/setresgid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setresgid, @function
-    .globl setresgid
-    .align 4
-
-setresgid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setresgid32_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setresgid32_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setresgid32
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setrlimit.S b/libc/arch-sh/syscalls/setrlimit.S
deleted file mode 100644
index 73fe89f..0000000
--- a/libc/arch-sh/syscalls/setrlimit.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setrlimit, @function
-    .globl setrlimit
-    .align 4
-
-setrlimit:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setrlimit_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setrlimit_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setrlimit
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/setsid.S b/libc/arch-sh/syscalls/setsid.S
deleted file mode 100644
index fa7fc66..0000000
--- a/libc/arch-sh/syscalls/setsid.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type setsid, @function
-    .globl setsid
-    .align 4
-
-setsid:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(0 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_setsid_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_setsid_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_setsid
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/settimeofday.S b/libc/arch-sh/syscalls/settimeofday.S
deleted file mode 100644
index 0a38b60..0000000
--- a/libc/arch-sh/syscalls/settimeofday.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type settimeofday, @function
-    .globl settimeofday
-    .align 4
-
-settimeofday:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_settimeofday_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_settimeofday_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_settimeofday
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sigaction.S b/libc/arch-sh/syscalls/sigaction.S
deleted file mode 100644
index f1dd824..0000000
--- a/libc/arch-sh/syscalls/sigaction.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sigaction, @function
-    .globl sigaction
-    .align 4
-
-sigaction:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sigaction_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sigaction_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sigaction
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sigaltstack.S b/libc/arch-sh/syscalls/sigaltstack.S
deleted file mode 100644
index 8b03e27..0000000
--- a/libc/arch-sh/syscalls/sigaltstack.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sigaltstack, @function
-    .globl sigaltstack
-    .align 4
-
-sigaltstack:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sigaltstack_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sigaltstack_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sigaltstack
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sigpending.S b/libc/arch-sh/syscalls/sigpending.S
deleted file mode 100644
index 75e479c..0000000
--- a/libc/arch-sh/syscalls/sigpending.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sigpending, @function
-    .globl sigpending
-    .align 4
-
-sigpending:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sigpending_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sigpending_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sigpending
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sigprocmask.S b/libc/arch-sh/syscalls/sigprocmask.S
deleted file mode 100644
index efa40ea..0000000
--- a/libc/arch-sh/syscalls/sigprocmask.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sigprocmask, @function
-    .globl sigprocmask
-    .align 4
-
-sigprocmask:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sigprocmask_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sigprocmask_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sigprocmask
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/stat.S b/libc/arch-sh/syscalls/stat.S
deleted file mode 100644
index aedd57d..0000000
--- a/libc/arch-sh/syscalls/stat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type stat, @function
-    .globl stat
-    .align 4
-
-stat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_stat64_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_stat64_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_stat64
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/symlink.S b/libc/arch-sh/syscalls/symlink.S
deleted file mode 100644
index d5ccc46..0000000
--- a/libc/arch-sh/syscalls/symlink.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type symlink, @function
-    .globl symlink
-    .align 4
-
-symlink:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_symlink_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_symlink_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_symlink
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sync.S b/libc/arch-sh/syscalls/sync.S
deleted file mode 100644
index a8c0646..0000000
--- a/libc/arch-sh/syscalls/sync.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sync, @function
-    .globl sync
-    .align 4
-
-sync:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sync_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sync_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sync
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/sysinfo.S b/libc/arch-sh/syscalls/sysinfo.S
deleted file mode 100644
index ae042ab..0000000
--- a/libc/arch-sh/syscalls/sysinfo.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type sysinfo, @function
-    .globl sysinfo
-    .align 4
-
-sysinfo:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_sysinfo_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_sysinfo_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_sysinfo
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/times.S b/libc/arch-sh/syscalls/times.S
deleted file mode 100644
index 079e098..0000000
--- a/libc/arch-sh/syscalls/times.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type times, @function
-    .globl times
-    .align 4
-
-times:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_times_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_times_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_times
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/tkill.S b/libc/arch-sh/syscalls/tkill.S
deleted file mode 100644
index b6fe2a3..0000000
--- a/libc/arch-sh/syscalls/tkill.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type tkill, @function
-    .globl tkill
-    .align 4
-
-tkill:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_tkill_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_tkill_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_tkill
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/truncate.S b/libc/arch-sh/syscalls/truncate.S
deleted file mode 100644
index dc08fcc..0000000
--- a/libc/arch-sh/syscalls/truncate.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type truncate, @function
-    .globl truncate
-    .align 4
-
-truncate:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_truncate_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_truncate_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_truncate
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/umask.S b/libc/arch-sh/syscalls/umask.S
deleted file mode 100644
index 7575a1c..0000000
--- a/libc/arch-sh/syscalls/umask.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type umask, @function
-    .globl umask
-    .align 4
-
-umask:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_umask_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_umask_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_umask
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/umount2.S b/libc/arch-sh/syscalls/umount2.S
deleted file mode 100644
index 06a11da..0000000
--- a/libc/arch-sh/syscalls/umount2.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type umount2, @function
-    .globl umount2
-    .align 4
-
-umount2:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_umount2_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_umount2_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_umount2
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/uname.S b/libc/arch-sh/syscalls/uname.S
deleted file mode 100644
index 755c9de..0000000
--- a/libc/arch-sh/syscalls/uname.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type uname, @function
-    .globl uname
-    .align 4
-
-uname:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_uname_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_uname_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_uname
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/unlink.S b/libc/arch-sh/syscalls/unlink.S
deleted file mode 100644
index 453d58a..0000000
--- a/libc/arch-sh/syscalls/unlink.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type unlink, @function
-    .globl unlink
-    .align 4
-
-unlink:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_unlink_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_unlink_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_unlink
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/unlinkat.S b/libc/arch-sh/syscalls/unlinkat.S
deleted file mode 100644
index 7a448a3..0000000
--- a/libc/arch-sh/syscalls/unlinkat.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type unlinkat, @function
-    .globl unlinkat
-    .align 4
-
-unlinkat:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_unlinkat_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_unlinkat_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_unlinkat
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/utimes.S b/libc/arch-sh/syscalls/utimes.S
deleted file mode 100644
index fecaa66..0000000
--- a/libc/arch-sh/syscalls/utimes.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type utimes, @function
-    .globl utimes
-    .align 4
-
-utimes:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(2 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_utimes_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_utimes_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_utimes
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/vfork.S b/libc/arch-sh/syscalls/vfork.S
deleted file mode 100644
index 2a2c78b..0000000
--- a/libc/arch-sh/syscalls/vfork.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type vfork, @function
-    .globl vfork
-    .align 4
-
-vfork:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(1 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_vfork_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_vfork_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_vfork
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/write.S b/libc/arch-sh/syscalls/write.S
deleted file mode 100644
index 71c6ea8..0000000
--- a/libc/arch-sh/syscalls/write.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type write, @function
-    .globl write
-    .align 4
-
-write:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_write_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_write_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_write
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-sh/syscalls/writev.S b/libc/arch-sh/syscalls/writev.S
deleted file mode 100644
index 518ae28..0000000
--- a/libc/arch-sh/syscalls/writev.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type writev, @function
-    .globl writev
-    .align 4
-
-writev:
-
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(3 + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      __NR_writev_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-__NR_writev_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   __NR_writev
-1:  .long   __set_syscall_errno
diff --git a/libc/arch-x86/bionic/__set_tls.c b/libc/arch-x86/bionic/__set_tls.c
index 48b55f0..7ed4b01 100755
--- a/libc/arch-x86/bionic/__set_tls.c
+++ b/libc/arch-x86/bionic/__set_tls.c
@@ -60,6 +60,8 @@
     0
 };
 
+static pthread_mutex_t  _tls_desc_lock = PTHREAD_MUTEX_INITIALIZER;
+
 struct _thread_area_head {
     void *self;
 };
@@ -71,6 +73,7 @@
 {
     int   rc, segment;
 
+    pthread_mutex_lock(&_tls_desc_lock);
     _tls_desc.base_addr = (unsigned long)ptr;
 
     /* We also need to write the location of the tls to ptr[0] */
@@ -80,6 +83,7 @@
     if (rc != 0)
     {
         /* could not set thread local area */
+        pthread_mutex_unlock(&_tls_desc_lock);
         return -1;
     }
 
@@ -88,6 +92,8 @@
     asm __volatile__ (
         "   movw %w0, %%gs" :: "q"(segment)
     );
+    pthread_mutex_unlock(&_tls_desc_lock);
+
     return 0;
 }
 
diff --git a/libc/arch-sh/bionic/__get_sp.S b/libc/arch-x86/bionic/__stack_chk_fail_local.S
similarity index 73%
copy from libc/arch-sh/bionic/__get_sp.S
copy to libc/arch-x86/bionic/__stack_chk_fail_local.S
index 0e34a01..59fe86e 100644
--- a/libc/arch-sh/bionic/__get_sp.S
+++ b/libc/arch-x86/bionic/__stack_chk_fail_local.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2011 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,24 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-.text
-.type   __get_sp, @function
-.globl  __get_sp
-.align  4
+/*
+ * Contributed by: Intel Corporation
+ */
 
-__get_sp:
-    rts
-    mov     r15, r0
+	.text
+	.p2align 4,,15
+	.globl	__stack_chk_fail_local
+	.hidden	__stack_chk_fail_local
+	.type	__stack_chk_fail_local, @function
 
+__stack_chk_fail_local:
+#ifdef __PIC__
+	pushl	%ebx
+	call	__x86.get_pc_thunk.bx
+	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
+	call	__stack_chk_fail@PLT
+#else /* PIC */
+	jmp   __stack_chk_fail
+#endif /* not PIC */
+
+	.size	__stack_chk_fail_local, .-__stack_chk_fail_local
diff --git a/libc/arch-sh/bionic/__get_sp.S b/libc/arch-x86/bionic/atexit.S
similarity index 64%
copy from libc/arch-sh/bionic/__get_sp.S
copy to libc/arch-x86/bionic/atexit.S
index 0e34a01..b28f40b 100644
--- a/libc/arch-sh/bionic/__get_sp.S
+++ b/libc/arch-x86/bionic/atexit.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2008 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,42 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-.text
-.type   __get_sp, @function
-.globl  __get_sp
-.align  4
+	.text
+	.p2align 4,,15
+	.globl	atexit
+	.hidden	atexit
+	.type	atexit, @function
+atexit:
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	%ebx
+	call	__x86.get_pc_thunk.bx
+	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
+	subl	$20, %esp
+	movl	$0, 4(%esp)
+	movl	__dso_handle@GOTOFF(%ebx), %eax
+	movl	%eax, 8(%esp)
+	movl	8(%ebp), %eax
+	movl	%eax, (%esp)
+	call	__cxa_atexit@PLT
+	addl	$20, %esp
+	popl	%ebx
+	popl	%ebp
+	ret
+	.size	atexit, .-atexit
 
-__get_sp:
-    rts
-    mov     r15, r0
-
+	.section	.text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+	.globl	__x86.get_pc_thunk.bx
+	.hidden	__x86.get_pc_thunk.bx
+	.type	__x86.get_pc_thunk.bx, @function
+__x86.get_pc_thunk.bx:
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	movl	(%esp), %ebx
+	ret
diff --git a/libc/arch-x86/bionic/clone.S b/libc/arch-x86/bionic/clone.S
index b9b0957..352d23c 100644
--- a/libc/arch-x86/bionic/clone.S
+++ b/libc/arch-x86/bionic/clone.S
@@ -13,15 +13,21 @@
         pushl   %ebx
         pushl   %ecx
         movl    16(%esp), %ecx
-        movl    20(%esp), %ebx
+
+        # save tls
+        movl    %ecx, %ebx
+        # 16-byte alignment on child stack
+        andl    $~15, %ecx
 
         # insert arguments onto the child stack
         movl    12(%esp), %eax
-        movl    %eax, -12(%ecx)
+        movl    %eax, -16(%ecx)
         movl    24(%esp), %eax
-        movl    %eax, -8(%ecx)
-        movl    %ecx, -4(%ecx)
+        movl    %eax, -12(%ecx)
+        movl    %ebx, -8(%ecx)
 
+        subl    $16, %ecx
+        movl    20(%esp), %ebx
         movl    $__NR_clone, %eax
         int     $0x80
         test    %eax, %eax
@@ -39,8 +45,7 @@
         # we're in the child thread now, call __thread_entry
         # with the appropriate arguments on the child stack
         # we already placed most of them
-        subl    $16, %esp
-        jmp     __thread_entry
+        call    __thread_entry
         hlt
 
 2:
diff --git a/libc/arch-x86/bionic/crtbegin_dynamic.S b/libc/arch-x86/bionic/crtbegin_dynamic.S
index 0a7bc62..177244b 100644
--- a/libc/arch-x86/bionic/crtbegin_dynamic.S
+++ b/libc/arch-x86/bionic/crtbegin_dynamic.S
@@ -51,6 +51,8 @@
 #
 _start:	
         mov     %esp, %eax
+        # before push arguments, align the stack to a 16 byte boundary
+        andl    $~15, %esp
         mov     $1f, %edx
         pushl   %edx
         mov     $0f, %edx
@@ -76,10 +78,62 @@
 	.globl __INIT_ARRAY__
 __INIT_ARRAY__:
 	.long -1
+	.long	frame_dummy
 
 	.section .fini_array, "aw"
 	.globl __FINI_ARRAY__
 __FINI_ARRAY__:
 	.long -1
+	.long	__do_global_dtors_aux
+
+	.section	.eh_frame,"a",@progbits
+	.align 4
+	.type	__EH_FRAME_BEGIN__, @object
+__EH_FRAME_BEGIN__:
+	.text
+	.p2align 4,,15
+	.type	__do_global_dtors_aux, @function
+__do_global_dtors_aux:
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$24, %esp
+	cmpb	$0, completed.4454
+	jne	.L4
+	movl	$__deregister_frame_info_bases, %eax
+	testl	%eax, %eax
+	je	.L3
+	movl	$__EH_FRAME_BEGIN__, (%esp)
+	call	__deregister_frame_info_bases
+.L3:
+	movb	$1, completed.4454
+.L4:
+	leave
+	ret
+	.text
+	.p2align 4,,15
+	.type	frame_dummy, @function
+frame_dummy:
+	pushl	%ebp
+	movl	$__register_frame_info_bases, %eax
+	movl	%esp, %ebp
+	subl	$24, %esp
+	testl	%eax, %eax
+	je	.L7
+	movl	%ebx, 12(%esp)
+	movl	$0, 8(%esp)
+	movl	$object.4466, 4(%esp)
+	movl	$__EH_FRAME_BEGIN__, (%esp)
+	call	__register_frame_info_bases
+.L7:
+	leave
+	ret
+	.local	completed.4454
+	.comm	completed.4454,1,1
+	.local	object.4466
+	.comm	object.4466,24,4
+	.weak	__register_frame_info_bases
+	.weak	__deregister_frame_info_bases
 
 #include "__dso_handle.S"
+#include "atexit.S"
+#include "__stack_chk_fail_local.S"
diff --git a/libc/arch-x86/bionic/crtbegin_so.S b/libc/arch-x86/bionic/crtbegin_so.S
index b3a01b5..99662fe 100644
--- a/libc/arch-x86/bionic/crtbegin_so.S
+++ b/libc/arch-x86/bionic/crtbegin_so.S
@@ -1,9 +1,30 @@
-# This function is to be called when the shared library
-# is unloaded through dlclose()
-_on_dlclose:
-    lea __dso_handle, %eax
-    call __cxa_finalize
-    ret
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT OWNER 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.
+ */
 
 .section .init_array, "aw"
 .align 4
@@ -11,6 +32,7 @@
 .globl __INIT_ARRAY__
 __INIT_ARRAY__:
     .long -1
+    .long frame_dummy
 
 .section .fini_array, "aw"
 .align 4
@@ -18,6 +40,72 @@
 .globl __FINI_ARRAY__
 __FINI_ARRAY__:
     .long -1
-    .long _on_dlclose
+    .long __do_global_dtors_aux
 
-#include "__dso_handle.S"
+	.section	.eh_frame,"a",@progbits
+	.align 4
+	.type	__EH_FRAME_BEGIN__, @object
+__EH_FRAME_BEGIN__:
+	.text
+	.p2align 4,,15
+	.type	__do_global_dtors_aux, @function
+__do_global_dtors_aux:
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	%ebx
+	call	__x86.get_pc_thunk.bx
+	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
+	subl	$20, %esp
+	cmpb	$0, completed.4454@GOTOFF(%ebx)
+	jne	.L5
+	movl	__dso_handle@GOTOFF(%ebx), %eax
+	movl	%eax, (%esp)
+	call	__cxa_finalize@PLT
+	movl	__deregister_frame_info_bases@GOT(%ebx), %eax
+	testl	%eax, %eax
+	je	.L4
+	leal	__EH_FRAME_BEGIN__@GOTOFF(%ebx), %eax
+	movl	%eax, (%esp)
+	call	__deregister_frame_info_bases@PLT
+.L4:
+	movb	$1, completed.4454@GOTOFF(%ebx)
+.L5:
+	addl	$20, %esp
+	popl	%ebx
+	popl	%ebp
+	ret
+	.text
+	.p2align 4,,15
+	.type	frame_dummy, @function
+frame_dummy:
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	%ebx
+	call	__x86.get_pc_thunk.bx
+	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
+	subl	$20, %esp
+	movl	__register_frame_info_bases@GOT(%ebx), %eax
+	testl	%eax, %eax
+	je	.L8
+	leal	object.4469@GOTOFF(%ebx), %eax
+	movl	%eax, 4(%esp)
+	leal	__EH_FRAME_BEGIN__@GOTOFF(%ebx), %eax
+	movl	%ebx, 12(%esp)
+	movl	$0, 8(%esp)
+	movl	%eax, (%esp)
+	call	__register_frame_info_bases@PLT
+.L8:
+	addl	$20, %esp
+	popl	%ebx
+	popl	%ebp
+	ret
+	.local	completed.4454
+	.comm	completed.4454,1,1
+	.local	object.4469
+	.comm	object.4469,24,4
+	.weak	__register_frame_info_bases
+	.weak	__deregister_frame_info_bases
+
+#include "__dso_handle_so.S"
+#include "atexit.S"
+#include "__stack_chk_fail_local.S"
diff --git a/libc/arch-x86/bionic/crtbegin_static.S b/libc/arch-x86/bionic/crtbegin_static.S
index d5c2430..4fffecd 100644
--- a/libc/arch-x86/bionic/crtbegin_static.S
+++ b/libc/arch-x86/bionic/crtbegin_static.S
@@ -51,6 +51,8 @@
 #
 _start:	
         mov     %esp, %eax
+        # before push arguments, align the stack to a 16 byte boundary
+        andl    $~15, %esp
         mov     $1f, %edx
         pushl   %edx
         mov     $0f, %edx
@@ -75,10 +77,62 @@
 	.globl __INIT_ARRAY__
 __INIT_ARRAY__:
 	.long -1
+	.long	frame_dummy
 
 	.section .fini_array, "aw"
 	.globl __FINI_ARRAY__
 __FINI_ARRAY__:
 	.long -1
+	.long	__do_global_dtors_aux
+
+	.section	.eh_frame,"a",@progbits
+	.align 4
+	.type	__EH_FRAME_BEGIN__, @object
+__EH_FRAME_BEGIN__:
+	.text
+	.p2align 4,,15
+	.type	__do_global_dtors_aux, @function
+__do_global_dtors_aux:
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$24, %esp
+	cmpb	$0, completed.4454
+	jne	.L4
+	movl	$__deregister_frame_info_bases, %eax
+	testl	%eax, %eax
+	je	.L3
+	movl	$__EH_FRAME_BEGIN__, (%esp)
+	call	__deregister_frame_info_bases
+.L3:
+	movb	$1, completed.4454
+.L4:
+	leave
+	ret
+	.text
+	.p2align 4,,15
+	.type	frame_dummy, @function
+frame_dummy:
+	pushl	%ebp
+	movl	$__register_frame_info_bases, %eax
+	movl	%esp, %ebp
+	subl	$24, %esp
+	testl	%eax, %eax
+	je	.L7
+	movl	%ebx, 12(%esp)
+	movl	$0, 8(%esp)
+	movl	$object.4466, 4(%esp)
+	movl	$__EH_FRAME_BEGIN__, (%esp)
+	call	__register_frame_info_bases
+.L7:
+	leave
+	ret
+	.local	completed.4454
+	.comm	completed.4454,1,1
+	.local	object.4466
+	.comm	object.4466,24,4
+	.weak	__register_frame_info_bases
+	.weak	__deregister_frame_info_bases
 
 #include "__dso_handle.S"
+#include "atexit.S"
+#include "__stack_chk_fail_local.S"
diff --git a/libc/arch-x86/bionic/crtend.S b/libc/arch-x86/bionic/crtend.S
index 884ba8b..68447e7 100644
--- a/libc/arch-x86/bionic/crtend.S
+++ b/libc/arch-x86/bionic/crtend.S
@@ -6,3 +6,10 @@
 
 	.section .fini_array, "aw"
 	.long 0
+
+	.section	.eh_frame,"a",@progbits
+	.align 4
+	.type	__FRAME_END__, @object
+	.size	__FRAME_END__, 4
+__FRAME_END__:
+	.zero	4
diff --git a/libc/arch-x86/bionic/crtend_so.S b/libc/arch-x86/bionic/crtend_so.S
index 8c9d419..63e58b9 100644
--- a/libc/arch-x86/bionic/crtend_so.S
+++ b/libc/arch-x86/bionic/crtend_so.S
@@ -1,6 +1,12 @@
-
 .section .init_array, "aw"
     .long 0
 
 .section .fini_array, "aw"
     .long 0
+
+	.section	.eh_frame,"a",@progbits
+	.align 4
+	.type	__FRAME_END__, @object
+	.size	__FRAME_END__, 4
+__FRAME_END__:
+	.zero	4
diff --git a/libc/arch-x86/bionic/syscall.S b/libc/arch-x86/bionic/syscall.S
index 3cca85c..8370f0b 100644
--- a/libc/arch-x86/bionic/syscall.S
+++ b/libc/arch-x86/bionic/syscall.S
@@ -32,7 +32,7 @@
 
     int     $0x80
 
-    cmpl    $-129, %eax
+    cmpl    $-4095, %eax
     jb      1f
     negl    %eax
     pushl   %eax
diff --git a/libc/arch-x86/include/machine/_types.h b/libc/arch-x86/include/machine/_types.h
index e9280a5..65892a1 100644
--- a/libc/arch-x86/include/machine/_types.h
+++ b/libc/arch-x86/include/machine/_types.h
@@ -38,7 +38,7 @@
 /* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
 #ifndef _SIZE_T_DEFINED_
 #  define _SIZE_T_DEFINED_
-#  ifdef ANDROID
+#  ifdef __ANDROID__
      typedef unsigned int  size_t;
 #  else
      typedef unsigned long  size_t;
@@ -51,7 +51,11 @@
 #endif
 #ifndef _PTRDIFF_T
 #define _PTRDIFF_T
-typedef long           ptrdiff_t;
+#  ifdef __ANDROID__
+     typedef int            ptrdiff_t;
+#  else
+     typedef long           ptrdiff_t;
+#  endif
 #endif
 
 #include <linux/types.h>
diff --git a/libc/arch-x86/include/machine/asm.h b/libc/arch-x86/include/machine/asm.h
index 7a23060..49d3ea8 100644
--- a/libc/arch-x86/include/machine/asm.h
+++ b/libc/arch-x86/include/machine/asm.h
@@ -103,6 +103,12 @@
 #define _ENTRY(x) \
 	.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
 
+#define _ASM_SIZE(x)    .size x, .-x;
+
+#define _END(x) \
+	.fnend; \
+	_ASM_SIZE(x)
+
 #ifdef GPROF
 # define _PROF_PROLOGUE	\
 	pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
@@ -112,8 +118,12 @@
 
 #define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
 #define	NENTRY(y)	_ENTRY(_C_LABEL(y))
+#define	END(y)		_END(_C_LABEL(y))
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 
+#define ENTRY_PRIVATE(y)  ENTRY(y); .hidden _C_LABEL(y)
+
+
 #define	ALTENTRY(name)	.globl _C_LABEL(name); _C_LABEL(name):
 
 #define	ASMSTR		.asciz
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index e8c6a77..7d3d937 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -15,6 +15,7 @@
 syscall_src += arch-x86/syscalls/getresuid.S
 syscall_src += arch-x86/syscalls/getresgid.S
 syscall_src += arch-x86/syscalls/gettid.S
+syscall_src += arch-x86/syscalls/readahead.S
 syscall_src += arch-x86/syscalls/getgroups.S
 syscall_src += arch-x86/syscalls/getpgid.S
 syscall_src += arch-x86/syscalls/getppid.S
@@ -87,6 +88,10 @@
 syscall_src += arch-x86/syscalls/fchownat.S
 syscall_src += arch-x86/syscalls/fchmodat.S
 syscall_src += arch-x86/syscalls/renameat.S
+syscall_src += arch-x86/syscalls/fsetxattr.S
+syscall_src += arch-x86/syscalls/fgetxattr.S
+syscall_src += arch-x86/syscalls/flistxattr.S
+syscall_src += arch-x86/syscalls/fremovexattr.S
 syscall_src += arch-x86/syscalls/link.S
 syscall_src += arch-x86/syscalls/unlink.S
 syscall_src += arch-x86/syscalls/unlinkat.S
@@ -109,6 +114,14 @@
 syscall_src += arch-x86/syscalls/symlink.S
 syscall_src += arch-x86/syscalls/fchdir.S
 syscall_src += arch-x86/syscalls/truncate.S
+syscall_src += arch-x86/syscalls/setxattr.S
+syscall_src += arch-x86/syscalls/lsetxattr.S
+syscall_src += arch-x86/syscalls/getxattr.S
+syscall_src += arch-x86/syscalls/lgetxattr.S
+syscall_src += arch-x86/syscalls/listxattr.S
+syscall_src += arch-x86/syscalls/llistxattr.S
+syscall_src += arch-x86/syscalls/removexattr.S
+syscall_src += arch-x86/syscalls/lremovexattr.S
 syscall_src += arch-x86/syscalls/__statfs64.S
 syscall_src += arch-x86/syscalls/pause.S
 syscall_src += arch-x86/syscalls/gettimeofday.S
@@ -127,6 +140,7 @@
 syscall_src += arch-x86/syscalls/__timer_getoverrun.S
 syscall_src += arch-x86/syscalls/__timer_delete.S
 syscall_src += arch-x86/syscalls/utimes.S
+syscall_src += arch-x86/syscalls/utimensat.S
 syscall_src += arch-x86/syscalls/sigaction.S
 syscall_src += arch-x86/syscalls/sigprocmask.S
 syscall_src += arch-x86/syscalls/__sigsuspend.S
@@ -171,6 +185,7 @@
 syscall_src += arch-x86/syscalls/delete_module.S
 syscall_src += arch-x86/syscalls/klogctl.S
 syscall_src += arch-x86/syscalls/sysinfo.S
+syscall_src += arch-x86/syscalls/personality.S
 syscall_src += arch-x86/syscalls/futex.S
 syscall_src += arch-x86/syscalls/epoll_create.S
 syscall_src += arch-x86/syscalls/epoll_ctl.S
diff --git a/libc/arch-x86/syscalls/clock_nanosleep.S b/libc/arch-x86/syscalls/clock_nanosleep.S
index c400e3f..23e1e6f 100644
--- a/libc/arch-x86/syscalls/clock_nanosleep.S
+++ b/libc/arch-x86/syscalls/clock_nanosleep.S
@@ -9,8 +9,12 @@
 clock_nanosleep:
     pushl   %ebx
     pushl   %ecx
-    mov     12(%esp), %ebx
-    mov     16(%esp), %ecx
+    pushl   %edx
+    pushl   %esi
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    mov     32(%esp), %esi
     movl    $__NR_clock_nanosleep, %eax
     int     $0x80
     cmpl    $-129, %eax
@@ -21,6 +25,8 @@
     addl    $4, %esp
     orl     $-1, %eax
 1:
+    popl    %esi
+    popl    %edx
     popl    %ecx
     popl    %ebx
     ret
diff --git a/libc/arch-x86/syscalls/fgetxattr.S b/libc/arch-x86/syscalls/fgetxattr.S
new file mode 100644
index 0000000..d9f582f
--- /dev/null
+++ b/libc/arch-x86/syscalls/fgetxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type fgetxattr, @function
+    .globl fgetxattr
+    .align 4
+
+fgetxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    mov     32(%esp), %esi
+    movl    $__NR_fgetxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/flistxattr.S b/libc/arch-x86/syscalls/flistxattr.S
new file mode 100644
index 0000000..43ff73d
--- /dev/null
+++ b/libc/arch-x86/syscalls/flistxattr.S
@@ -0,0 +1,29 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type flistxattr, @function
+    .globl flistxattr
+    .align 4
+
+flistxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    mov     24(%esp), %edx
+    movl    $__NR_flistxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/fremovexattr.S b/libc/arch-x86/syscalls/fremovexattr.S
new file mode 100644
index 0000000..eeed57f
--- /dev/null
+++ b/libc/arch-x86/syscalls/fremovexattr.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type fremovexattr, @function
+    .globl fremovexattr
+    .align 4
+
+fremovexattr:
+    pushl   %ebx
+    pushl   %ecx
+    mov     12(%esp), %ebx
+    mov     16(%esp), %ecx
+    movl    $__NR_fremovexattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/fsetxattr.S b/libc/arch-x86/syscalls/fsetxattr.S
new file mode 100644
index 0000000..a70ca4f
--- /dev/null
+++ b/libc/arch-x86/syscalls/fsetxattr.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type fsetxattr, @function
+    .globl fsetxattr
+    .align 4
+
+fsetxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    pushl   %edi
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    mov     40(%esp), %edi
+    movl    $__NR_fsetxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/getresgid.S b/libc/arch-x86/syscalls/getresgid.S
index 454d32b..d43aec4 100644
--- a/libc/arch-x86/syscalls/getresgid.S
+++ b/libc/arch-x86/syscalls/getresgid.S
@@ -7,6 +7,12 @@
     .align 4
 
 getresgid:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    mov     24(%esp), %edx
     movl    $__NR_getresgid32, %eax
     int     $0x80
     cmpl    $-129, %eax
@@ -17,4 +23,7 @@
     addl    $4, %esp
     orl     $-1, %eax
 1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
     ret
diff --git a/libc/arch-x86/syscalls/getresuid.S b/libc/arch-x86/syscalls/getresuid.S
index f07b5c5..f489d40 100644
--- a/libc/arch-x86/syscalls/getresuid.S
+++ b/libc/arch-x86/syscalls/getresuid.S
@@ -7,6 +7,12 @@
     .align 4
 
 getresuid:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    mov     24(%esp), %edx
     movl    $__NR_getresuid32, %eax
     int     $0x80
     cmpl    $-129, %eax
@@ -17,4 +23,7 @@
     addl    $4, %esp
     orl     $-1, %eax
 1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
     ret
diff --git a/libc/arch-x86/syscalls/getxattr.S b/libc/arch-x86/syscalls/getxattr.S
new file mode 100644
index 0000000..80d2fc4
--- /dev/null
+++ b/libc/arch-x86/syscalls/getxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type getxattr, @function
+    .globl getxattr
+    .align 4
+
+getxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    mov     32(%esp), %esi
+    movl    $__NR_getxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/lgetxattr.S b/libc/arch-x86/syscalls/lgetxattr.S
new file mode 100644
index 0000000..3f5b63e
--- /dev/null
+++ b/libc/arch-x86/syscalls/lgetxattr.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type lgetxattr, @function
+    .globl lgetxattr
+    .align 4
+
+lgetxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    mov     32(%esp), %esi
+    movl    $__NR_lgetxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/listxattr.S b/libc/arch-x86/syscalls/listxattr.S
new file mode 100644
index 0000000..88109bb
--- /dev/null
+++ b/libc/arch-x86/syscalls/listxattr.S
@@ -0,0 +1,29 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type listxattr, @function
+    .globl listxattr
+    .align 4
+
+listxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    mov     24(%esp), %edx
+    movl    $__NR_listxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/llistxattr.S b/libc/arch-x86/syscalls/llistxattr.S
new file mode 100644
index 0000000..fa8505c
--- /dev/null
+++ b/libc/arch-x86/syscalls/llistxattr.S
@@ -0,0 +1,29 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type llistxattr, @function
+    .globl llistxattr
+    .align 4
+
+llistxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    mov     16(%esp), %ebx
+    mov     20(%esp), %ecx
+    mov     24(%esp), %edx
+    movl    $__NR_llistxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/lremovexattr.S b/libc/arch-x86/syscalls/lremovexattr.S
new file mode 100644
index 0000000..f6c7afe
--- /dev/null
+++ b/libc/arch-x86/syscalls/lremovexattr.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type lremovexattr, @function
+    .globl lremovexattr
+    .align 4
+
+lremovexattr:
+    pushl   %ebx
+    pushl   %ecx
+    mov     12(%esp), %ebx
+    mov     16(%esp), %ecx
+    movl    $__NR_lremovexattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/lsetxattr.S b/libc/arch-x86/syscalls/lsetxattr.S
new file mode 100644
index 0000000..56c8cf8
--- /dev/null
+++ b/libc/arch-x86/syscalls/lsetxattr.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type lsetxattr, @function
+    .globl lsetxattr
+    .align 4
+
+lsetxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    pushl   %edi
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    mov     40(%esp), %edi
+    movl    $__NR_lsetxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/personality.S b/libc/arch-x86/syscalls/personality.S
new file mode 100644
index 0000000..af4f912
--- /dev/null
+++ b/libc/arch-x86/syscalls/personality.S
@@ -0,0 +1,23 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type personality, @function
+    .globl personality
+    .align 4
+
+personality:
+    pushl   %ebx
+    mov     8(%esp), %ebx
+    movl    $__NR_personality, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/readahead.S b/libc/arch-x86/syscalls/readahead.S
new file mode 100644
index 0000000..b89314f
--- /dev/null
+++ b/libc/arch-x86/syscalls/readahead.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type readahead, @function
+    .globl readahead
+    .align 4
+
+readahead:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    mov     32(%esp), %esi
+    movl    $__NR_readahead, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/removexattr.S b/libc/arch-x86/syscalls/removexattr.S
new file mode 100644
index 0000000..2350865
--- /dev/null
+++ b/libc/arch-x86/syscalls/removexattr.S
@@ -0,0 +1,26 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type removexattr, @function
+    .globl removexattr
+    .align 4
+
+removexattr:
+    pushl   %ebx
+    pushl   %ecx
+    mov     12(%esp), %ebx
+    mov     16(%esp), %ecx
+    movl    $__NR_removexattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/setxattr.S b/libc/arch-x86/syscalls/setxattr.S
new file mode 100644
index 0000000..38be736
--- /dev/null
+++ b/libc/arch-x86/syscalls/setxattr.S
@@ -0,0 +1,35 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type setxattr, @function
+    .globl setxattr
+    .align 4
+
+setxattr:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    pushl   %edi
+    mov     24(%esp), %ebx
+    mov     28(%esp), %ecx
+    mov     32(%esp), %edx
+    mov     36(%esp), %esi
+    mov     40(%esp), %edi
+    movl    $__NR_setxattr, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %edi
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/arch-x86/syscalls/utimensat.S b/libc/arch-x86/syscalls/utimensat.S
new file mode 100644
index 0000000..e2032b5
--- /dev/null
+++ b/libc/arch-x86/syscalls/utimensat.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+    .text
+    .type utimensat, @function
+    .globl utimensat
+    .align 4
+
+utimensat:
+    pushl   %ebx
+    pushl   %ecx
+    pushl   %edx
+    pushl   %esi
+    mov     20(%esp), %ebx
+    mov     24(%esp), %ecx
+    mov     28(%esp), %edx
+    mov     32(%esp), %esi
+    movl    $__NR_utimensat, %eax
+    int     $0x80
+    cmpl    $-129, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %esi
+    popl    %edx
+    popl    %ecx
+    popl    %ebx
+    ret
diff --git a/libc/bionic/cpuacct.c b/libc/bionic/cpuacct.c
index 7317073..1321d0e 100644
--- a/libc/bionic/cpuacct.c
+++ b/libc/bionic/cpuacct.c
@@ -30,16 +30,19 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include "cpuacct.h"
+#include <fcntl.h>
 
 int cpuacct_add(uid_t uid)
 {
     int count;
-    FILE *fp;
+    int fd;
     char buf[80];
+    ssize_t n;
+    int ret = 0;
 
     count = snprintf(buf, sizeof(buf), "/acct/uid/%d/tasks", uid);
-    fp = fopen(buf, "w+");
-    if (!fp) {
+    fd = open(buf, O_RDWR | O_CREAT, 0666);
+    if (fd == -1) {
         /* Note: sizeof("tasks") returns 6, which includes the NULL char */
         buf[count - sizeof("tasks")] = 0;
         if (mkdir(buf, 0775) < 0)
@@ -47,14 +50,19 @@
 
         /* Note: sizeof("tasks") returns 6, which includes the NULL char */
         buf[count - sizeof("tasks")] = '/';
-        fp = fopen(buf, "w+");
+        fd = open(buf, O_RDWR | O_CREAT, 0666);
     }
-    if (!fp)
+    if (fd == -1)
         return -errno;
 
-    fprintf(fp, "0");
-    if (fclose(fp))
+    n = TEMP_FAILURE_RETRY(write(fd, "0", 1));
+    if (n < 0)
+        ret = -errno;
+    else if (n == 0)
+        ret = -EIO;
+
+    if (TEMP_FAILURE_RETRY(close(fd)) == -1)
         return -errno;
 
-    return 0;
+    return ret;
 }
diff --git a/libc/bionic/dlmalloc.c b/libc/bionic/dlmalloc.c
index 19fbb75..496cd1c 100644
--- a/libc/bionic/dlmalloc.c
+++ b/libc/bionic/dlmalloc.c
@@ -774,6 +774,22 @@
 void* dlmemalign(size_t, size_t);
 
 /*
+  int posix_memalign(void **memptr, size_t alignment, size_t size);
+  Places a pointer to a newly allocated chunk of size bytes, aligned
+  in accord with the alignment argument, in *memptr.
+
+  The return value is 0 on success, and ENOMEM on failure.
+
+  The alignment argument should be a power of two. If the argument is
+  not a power of two, the nearest greater power is used.
+  8-byte alignment is guaranteed by normal malloc calls, so don't
+  bother calling memalign with an argument of 8 or less.
+
+  Overreliance on posix_memalign is a sure way to fragment space.
+*/
+int posix_memalign(void **memptr, size_t alignment, size_t size);
+
+/*
   valloc(size_t n);
   Equivalent to memalign(pagesize, n), where pagesize is the page
   size of the system. If the pagesize is unknown, 4096 is used.
@@ -2265,13 +2281,53 @@
 
 #else /* PROCEED_ON_ERROR */
 
-#ifndef CORRUPTION_ERROR_ACTION
-#define CORRUPTION_ERROR_ACTION(m) ABORT
-#endif /* CORRUPTION_ERROR_ACTION */
+/* The following Android-specific code is used to print an informative
+ * fatal error message to the log when we detect that a heap corruption
+ * was detected. We need to be careful about not using a log function
+ * that may require an allocation here!
+ */
+#ifdef LOG_ON_HEAP_ERROR
 
-#ifndef USAGE_ERROR_ACTION
-#define USAGE_ERROR_ACTION(m,p) ABORT
-#endif /* USAGE_ERROR_ACTION */
+#  include <private/logd.h>
+
+static void __bionic_heap_error(const char* msg, const char* function)
+{
+    /* We format the buffer explicitely, i.e. without using snprintf()
+     * which may use malloc() internally. Not something we can trust
+     * if we just detected a corrupted heap.
+     */
+    char buffer[256];
+    strlcpy(buffer, "@@@ ABORTING: ", sizeof(buffer));
+    strlcat(buffer, msg, sizeof(buffer));
+    if (function != NULL) {
+        strlcat(buffer, " IN ", sizeof(buffer));
+        strlcat(buffer, function, sizeof(buffer));
+    }
+    __libc_android_log_write(ANDROID_LOG_FATAL,"libc",buffer);
+    abort();
+}
+
+#  ifndef CORRUPTION_ERROR_ACTION
+#    define CORRUPTION_ERROR_ACTION(m)  \
+    __bionic_heap_error("HEAP MEMORY CORRUPTION", __FUNCTION__)
+#  endif
+#  ifndef USAGE_ERROR_ACTION
+#    define USAGE_ERROR_ACTION(m,p)   \
+    __bionic_heap_error("INVALID HEAP ADDRESS", __FUNCTION__)
+#  endif
+
+#else /* !LOG_ON_HEAP_ERROR */
+
+#  ifndef CORRUPTION_ERROR_ACTION
+#    define CORRUPTION_ERROR_ACTION(m) ABORT
+#  endif /* CORRUPTION_ERROR_ACTION */
+
+#  ifndef USAGE_ERROR_ACTION
+#    define USAGE_ERROR_ACTION(m,p) ABORT
+#  endif /* USAGE_ERROR_ACTION */
+
+#endif /* !LOG_ON_HEAP_ERROR */
+
 
 #endif /* PROCEED_ON_ERROR */
 
@@ -4467,6 +4523,18 @@
   return internal_memalign(gm, alignment, bytes);
 }
 
+int posix_memalign(void **memptr, size_t alignment, size_t size) {
+  int ret = 0;
+
+  *memptr = dlmemalign(alignment, size);
+
+  if (*memptr == 0) {
+    ret = ENOMEM;
+  }
+
+  return ret;
+}
+
 void** dlindependent_calloc(size_t n_elements, size_t elem_size,
                                  void* chunks[]) {
   size_t sz = elem_size; /* serves as 1-element array */
diff --git a/libc/bionic/fork.c b/libc/bionic/fork.c
index 0eedb01..2d5a10a 100644
--- a/libc/bionic/fork.c
+++ b/libc/bionic/fork.c
@@ -27,6 +27,7 @@
  */
 #include <unistd.h>
 #include "pthread_internal.h"
+#include "bionic_pthread.h"
 #include "cpuacct.h"
 
 extern int  __fork(void);
@@ -48,6 +49,9 @@
         __timer_table_start_stop(0);
         __bionic_atfork_run_parent();
     } else {
+        /* Adjusting the kernel id after a fork */
+        (void)__pthread_settid(pthread_self(), gettid());
+
         /*
          * Newly created process must update cpu accounting.
          * Call cpuacct_add passing in our uid, which will take
diff --git a/libc/bionic/logd_write.c b/libc/bionic/logd_write.c
index 63dfd59..2bc39fa 100644
--- a/libc/bionic/logd_write.c
+++ b/libc/bionic/logd_write.c
@@ -48,6 +48,16 @@
 
 #include <pthread.h>
 
+/* IMPORTANT IMPORTANT IMPORTANT: TECHNICAL NOTE
+ *
+ * Some of the functions below can be called when our malloc() implementation
+ * has detected that the heap is corrupted, or even from a signal handler.
+ *
+ * These functions should *not* use a function that allocates heap memory
+ * or is not signal-safe. Using direct system calls is acceptable, and we
+ * also assume that pthread_mutex_lock/unlock can be used too.
+ */
+
 #define LOG_BUF_SIZE    1024
 
 typedef enum {
@@ -77,9 +87,10 @@
     { __write_to_log_init, -1, "/dev/"LOGGER_LOG_RADIO }
 };
 
+/* Important: see technical note at start of source file */
 static int __write_to_log_null(log_id_t log_id, struct iovec *vec)
 {
-    /* 
+    /*
      * ALTERED behaviour from previous version
      * always returns successful result
      */
@@ -97,23 +108,21 @@
  *  it's supposed, that log_id contains valid id always.
  *  this check must be performed in higher level functions
  */
+/* Important: see technical note at start of source file */
 static int __write_to_log_kernel(log_id_t log_id, struct iovec *vec)
 {
-    ssize_t ret;
-
-    do {
-        ret = writev(log_channels[log_id].fd, vec, 3);
-    } while ((ret < 0) && (errno == EINTR));
-
-    return ret;
+    return TEMP_FAILURE_RETRY( writev(log_channels[log_id].fd, vec, 3) );
 }
 
+/* Important: see technical note at start of source file */
 static int __write_to_log_init(log_id_t log_id, struct iovec *vec)
 {
     if ((LOG_ID_NONE < log_id) && (log_id < LOG_ID_MAX)) {
+        int fd;
+
         pthread_mutex_lock(&log_init_lock);
 
-        int fd = open(log_channels[log_id].path, O_WRONLY);
+        fd = TEMP_FAILURE_RETRY(open(log_channels[log_id].path, O_WRONLY));
 
         log_channels[log_id].logger =
             (fd < 0) ? __write_to_log_null : __write_to_log_kernel;
@@ -130,7 +139,9 @@
     return -1;
 }
 
-static int __android_log_write(int prio, const char *tag, const char *msg)
+/* Important: see technical note at start of source file */
+__LIBC_HIDDEN__
+int __libc_android_log_write(int prio, const char *tag, const char *msg)
 {
     struct iovec vec[3];
     log_id_t log_id = LOG_ID_MAIN;
@@ -151,7 +162,11 @@
     return log_channels[log_id].logger(log_id, vec);
 }
 
-
+/* The functions below are not designed to be called from a heap panic
+ * function or from a signal handler. As such, they are free to use complex
+ * C library functions like vsnprintf()
+ */
+__LIBC_HIDDEN__
 int __libc_android_log_vprint(int prio, const char *tag, const char *fmt,
                               va_list ap)
 {
@@ -159,9 +174,10 @@
 
     vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
 
-    return __android_log_write(prio, tag, buf);
+    return __libc_android_log_write(prio, tag, buf);
 }
 
+__LIBC_HIDDEN__
 int __libc_android_log_print(int prio, const char *tag, const char *fmt, ...)
 {
     va_list ap;
@@ -171,20 +187,21 @@
     vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
     va_end(ap);
 
-    return __android_log_write(prio, tag, buf);
+    return __libc_android_log_write(prio, tag, buf);
 }
 
+__LIBC_HIDDEN__
 int __libc_android_log_assert(const char *cond, const char *tag,
 			      const char *fmt, ...)
 {
     va_list ap;
-    char buf[LOG_BUF_SIZE];    
+    char buf[LOG_BUF_SIZE];
 
     va_start(ap, fmt);
     vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
     va_end(ap);
 
-    __android_log_write(ANDROID_LOG_FATAL, tag, buf);
+    __libc_android_log_write(ANDROID_LOG_FATAL, tag, buf);
 
     exit(1);
 
diff --git a/libc/bionic/malloc_debug_leak.c b/libc/bionic/malloc_debug_leak.c
index 0a3a68d..e0bcee9 100644
--- a/libc/bionic/malloc_debug_leak.c
+++ b/libc/bionic/malloc_debug_leak.c
@@ -263,7 +263,7 @@
 // =============================================================================
 
 #define CHK_FILL_FREE           0xef
-#define CHK_SENTINEL_VALUE      0xeb
+#define CHK_SENTINEL_VALUE      (char)0xeb
 #define CHK_SENTINEL_HEAD_SIZE  16
 #define CHK_SENTINEL_TAIL_SIZE  16
 #define CHK_OVERHEAD_SIZE       (   CHK_SENTINEL_HEAD_SIZE +    \
diff --git a/libc/bionic/md5.c b/libc/bionic/md5.c
index 16674f1..ba4aaed 100644
--- a/libc/bionic/md5.c
+++ b/libc/bionic/md5.c
@@ -241,7 +241,7 @@
 void
 MD5_Final (void *res, struct md5 *m)
 {
-  static unsigned char zeros[72];
+  unsigned char zeros[72];
   unsigned offset = (m->sz[0] / 8) % 64;
   unsigned int dstart = (120 - offset - 1) % 64 + 1;
 
diff --git a/libc/bionic/memmove_words.c b/libc/bionic/memmove_words.c
new file mode 100644
index 0000000..26df7fa
--- /dev/null
+++ b/libc/bionic/memmove_words.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <assert.h>
+
+/*
+ * Works like memmove(), except:
+ * - if all arguments are at least 32-bit aligned, we guarantee that we
+ *   will use operations that preserve atomicity of 32-bit values
+ * - if not, we guarantee atomicity of 16-bit values
+ *
+ * If all three arguments are not at least 16-bit aligned, the behavior
+ * of this function is undefined.  (We could remove this restriction by
+ * testing for unaligned values and punting to memmove(), but that's
+ * not currently useful.)
+ *
+ * TODO: add loop for 64-bit alignment
+ * TODO: use __builtin_prefetch
+ * TODO: write an ARM-optimized version
+ */
+void _memmove_words(void* dest, const void* src, size_t n)
+{
+    assert((((uintptr_t) dest | (uintptr_t) src | n) & 0x01) == 0);
+
+    char* d = (char*) dest;
+    const char* s = (const char*) src;
+    size_t copyCount;
+
+    /*
+     * If the source and destination pointers are the same, this is
+     * an expensive no-op.  Testing for an empty move now allows us
+     * to skip a check later.
+     */
+    if (n == 0 || d == s)
+        return;
+
+    /*
+     * Determine if the source and destination buffers will overlap if
+     * we copy data forward (i.e. *dest++ = *src++).
+     *
+     * It's okay if the destination buffer starts before the source and
+     * there is some overlap, because the reader is always ahead of the
+     * writer.
+     */
+    if (__builtin_expect((d < s) || ((size_t)(d - s) >= n), 1)) {
+        /*
+         * Copy forward.  We prefer 32-bit loads and stores even for 16-bit
+         * data, so sort that out.
+         */
+        if ((((uintptr_t) d | (uintptr_t) s) & 0x03) != 0) {
+            /*
+             * Not 32-bit aligned.  Two possibilities:
+             * (1) Congruent, we can align to 32-bit by copying one 16-bit val
+             * (2) Non-congruent, we can do one of:
+             *   a. copy whole buffer as a series of 16-bit values
+             *   b. load/store 32 bits, using shifts to ensure alignment
+             *   c. just copy the as 32-bit values and assume the CPU
+             *      will do a reasonable job
+             *
+             * We're currently using (a), which is suboptimal.
+             */
+            if ((((uintptr_t) d ^ (uintptr_t) s) & 0x03) != 0) {
+                copyCount = n;
+            } else {
+                copyCount = 2;
+            }
+            n -= copyCount;
+            copyCount /= sizeof(uint16_t);
+
+            while (copyCount--) {
+                *(uint16_t*)d = *(uint16_t*)s;
+                d += sizeof(uint16_t);
+                s += sizeof(uint16_t);
+            }
+        }
+
+        /*
+         * Copy 32-bit aligned words.
+         */
+        copyCount = n / sizeof(uint32_t);
+        while (copyCount--) {
+            *(uint32_t*)d = *(uint32_t*)s;
+            d += sizeof(uint32_t);
+            s += sizeof(uint32_t);
+        }
+
+        /*
+         * Check for leftovers.  Either we finished exactly, or we have
+         * one remaining 16-bit chunk.
+         */
+        if ((n & 0x02) != 0) {
+            *(uint16_t*)d = *(uint16_t*)s;
+        }
+    } else {
+        /*
+         * Copy backward, starting at the end.
+         */
+        d += n;
+        s += n;
+
+        if ((((uintptr_t) d | (uintptr_t) s) & 0x03) != 0) {
+            /* try for 32-bit alignment */
+            if ((((uintptr_t) d ^ (uintptr_t) s) & 0x03) != 0) {
+                copyCount = n;
+            } else {
+                copyCount = 2;
+            }
+            n -= copyCount;
+            copyCount /= sizeof(uint16_t);
+
+            while (copyCount--) {
+                d -= sizeof(uint16_t);
+                s -= sizeof(uint16_t);
+                *(uint16_t*)d = *(uint16_t*)s;
+            }
+        }
+
+        /* copy 32-bit aligned words */
+        copyCount = n / sizeof(uint32_t);
+        while (copyCount--) {
+            d -= sizeof(uint32_t);
+            s -= sizeof(uint32_t);
+            *(uint32_t*)d = *(uint32_t*)s;
+        }
+
+        /* copy leftovers */
+        if ((n & 0x02) != 0) {
+            d -= sizeof(uint16_t);
+            s -= sizeof(uint16_t);
+            *(uint16_t*)d = *(uint16_t*)s;
+        }
+    }
+}
diff --git a/libc/bionic/pthread-atfork.c b/libc/bionic/pthread-atfork.c
index 3a5189d..42420dc 100644
--- a/libc/bionic/pthread-atfork.c
+++ b/libc/bionic/pthread-atfork.c
@@ -74,6 +74,7 @@
 void __bionic_atfork_run_child()
 {
     struct atfork_t *cursor;
+    pthread_mutexattr_t  attr;
 
     /* Call pthread_atfork() child handlers */
     for (cursor = atfork_head.cqh_first;
@@ -84,7 +85,9 @@
         }
     }
 
-    pthread_mutex_unlock(&handler_mutex);
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+    pthread_mutex_init(&handler_mutex, &attr);
 }
 
 void __bionic_atfork_run_parent()
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 0a0854d..885adcc 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -49,6 +49,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <bionic_pthread.h>
 
 extern int  __pthread_clone(int (*fn)(void*), void *child_stack, int flags, void *arg);
 extern void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode);
@@ -570,6 +571,7 @@
     void*                stack_base = thread->attr.stack_base;
     int                  stack_size = thread->attr.stack_size;
     int                  user_stack = (thread->attr.flags & PTHREAD_ATTR_FLAG_USER_STACK) != 0;
+    sigset_t mask;
 
     // call the cleanup handlers first
     while (thread->cleanup_stack) {
@@ -612,6 +614,10 @@
         pthread_mutex_unlock(&gThreadListLock);
     }
 
+    sigfillset(&mask);
+    sigdelset(&mask, SIGSEGV);
+    (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
+
     // destroy the thread stack
     if (user_stack)
         _exit_thread((int)retval);
@@ -1855,7 +1861,21 @@
     return ret;
 }
 
-extern int __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
+/* Despite the fact that our kernel headers define sigset_t explicitly
+ * as a 32-bit integer, the kernel system call really expects a 64-bit
+ * bitmap for the signal set, or more exactly an array of two-32-bit
+ * values (see $KERNEL/arch/$ARCH/include/asm/signal.h for details).
+ *
+ * Unfortunately, we cannot fix the sigset_t definition without breaking
+ * the C library ABI, so perform a little runtime translation here.
+ */
+typedef union {
+    sigset_t   bionic;
+    uint32_t   kernel[2];
+} kernel_sigset_t;
+
+/* this is a private syscall stub */
+extern int __rt_sigprocmask(int, const kernel_sigset_t *, kernel_sigset_t *, size_t);
 
 int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
 {
@@ -1864,16 +1884,31 @@
      */
     int ret, old_errno = errno;
 
-    /* Use NSIG which corresponds to the number of signals in
-     * our 32-bit sigset_t implementation. As such, this function, or
-     * anything that deals with sigset_t cannot manage real-time signals
-     * (signo >= 32). We might want to introduce sigset_rt_t as an
-     * extension to do so in the future.
-     */
-    ret = __rt_sigprocmask(how, set, oset, NSIG / 8);
+    /* We must convert *set into a kernel_sigset_t */
+    kernel_sigset_t  in_set, *in_set_ptr;
+    kernel_sigset_t  out_set;
+
+    in_set.kernel[0] = in_set.kernel[1] = 0;
+    out_set.kernel[0] = out_set.kernel[1] = 0;
+
+    /* 'in_set_ptr' is the second parameter to __rt_sigprocmask. It must be NULL
+     * if 'set' is NULL to ensure correct semantics (which in this case would
+     * be to ignore 'how' and return the current signal set into 'oset'.
+      */
+    if (set == NULL) {
+        in_set_ptr = NULL;
+    } else {
+        in_set.bionic = *set;
+        in_set_ptr = &in_set;
+    }
+
+    ret = __rt_sigprocmask(how, in_set_ptr, &out_set, sizeof(kernel_sigset_t));
     if (ret < 0)
         ret = errno;
 
+    if (oset)
+        *oset = out_set.bionic;
+
     errno = old_errno;
     return ret;
 }
@@ -1964,3 +1999,26 @@
     errno = saved_errno;
     return ret;
 }
+
+/* Return the kernel thread ID for a pthread.
+ * This is only defined for implementations where pthread <-> kernel is 1:1, which this is.
+ * Not the same as pthread_getthreadid_np, which is commonly defined to be opaque.
+ * Internal, not an NDK API.
+ */
+
+pid_t __pthread_gettid(pthread_t thid)
+{
+    pthread_internal_t* thread = (pthread_internal_t*)thid;
+    return thread->kernel_id;
+}
+
+int __pthread_settid(pthread_t thid, pid_t tid)
+{
+    if (thid == 0)
+        return EINVAL;
+
+    pthread_internal_t* thread = (pthread_internal_t*)thid;
+    thread->kernel_id = tid;
+
+    return 0;
+}
diff --git a/libc/bionic/ptrace.c b/libc/bionic/ptrace.c
index 463c068..0bb1acd 100644
--- a/libc/bionic/ptrace.c
+++ b/libc/bionic/ptrace.c
@@ -1,62 +1,62 @@
-/*

- * Copyright (C) 2008 The Android Open Source Project

- * All rights reserved.

- *

- * Redistribution and use in source and binary forms, with or without

- * modification, are permitted provided that the following conditions

- * are met:

- *  * Redistributions of source code must retain the above copyright

- *    notice, this list of conditions and the following disclaimer.

- *  * 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 COPYRIGHT HOLDERS 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

- * COPYRIGHT OWNER 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.

- */

-#include <sys/types.h>

-#include <sys/ptrace.h>

-

-extern long __ptrace(int request, pid_t pid, void *addr, void *data);

-

-long ptrace(int request, pid_t pid, void * addr, void * data)

-{

-    switch (request) {

-        case PTRACE_PEEKUSR:

-        case PTRACE_PEEKTEXT:

-        case PTRACE_PEEKDATA:

-        {

-            long word;

-            long ret;

-            

-            ret = __ptrace(request, pid, addr, &word);

-            if (ret == 0) {

-                return word;

-            } else {

-                // __ptrace will set errno for us

-                return -1;

-            }

-        }

-

-        default:

-             return __ptrace(request, pid, addr, data);

-    }

-}

-

-/*

- * Hook for gdb to get notified when a thread is created

- */

+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT OWNER 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.
+ */
+#include <sys/types.h>
+#include <sys/ptrace.h>
+
+extern long __ptrace(int request, pid_t pid, void *addr, void *data);
+
+long ptrace(int request, pid_t pid, void * addr, void * data)
+{
+    switch (request) {
+        case PTRACE_PEEKUSR:
+        case PTRACE_PEEKTEXT:
+        case PTRACE_PEEKDATA:
+        {
+            long word;
+            long ret;
+
+            ret = __ptrace(request, pid, addr, &word);
+            if (ret == 0) {
+                return word;
+            } else {
+                // __ptrace will set errno for us
+                return -1;
+            }
+        }
+
+        default:
+             return __ptrace(request, pid, addr, data);
+    }
+}
+
+/*
+ * Hook for gdb to get notified when a thread is created
+ */
 #ifdef __i386__
 #define ATTRIBUTES __attribute__((noinline)) __attribute__((fastcall))
 #else
@@ -64,5 +64,5 @@
 #endif
 
 void ATTRIBUTES _thread_created_hook(pid_t thread_id)
-{

-}

+{
+}
diff --git a/libc/bionic/stubs.c b/libc/bionic/stubs.c
index a01d64c..5f63427 100644
--- a/libc/bionic/stubs.c
+++ b/libc/bionic/stubs.c
@@ -37,6 +37,78 @@
 #include <errno.h>
 #include <ctype.h>
 
+static int do_getpw_r(int by_name, const char* name, uid_t uid,
+        struct passwd* dst, char* buf, size_t byte_count, struct passwd** result)
+{
+    /*
+     * getpwnam_r and getpwuid_r don't modify errno, but library calls we
+     *  make might.
+     */
+    int old_errno = errno;
+    int rc = 0;
+    *result = NULL;
+
+    const struct passwd* src = by_name ? getpwnam(name) : getpwuid(uid);
+
+    /*
+     * POSIX allows failure to find a match to be considered a non-error.
+     * Reporting success (0) but with *result NULL is glibc's behavior.
+     */
+    if (src == NULL) {
+        rc = (errno == ENOENT) ? 0 : errno;
+        goto failure;
+    }
+
+    /*
+     * Work out where our strings will go in 'buf', and whether we've got
+     * enough space.
+     */
+    size_t required_byte_count = 0;
+    dst->pw_name = buf;
+    required_byte_count += strlen(src->pw_name) + 1;
+    dst->pw_dir = buf + required_byte_count;
+    required_byte_count += strlen(src->pw_dir) + 1;
+    dst->pw_shell = buf + required_byte_count;
+    required_byte_count += strlen(src->pw_shell) + 1;
+    if (byte_count < required_byte_count) {
+        rc = ERANGE;
+        goto failure;
+    }
+
+    /* Copy the strings. */
+    snprintf(buf, byte_count, "%s%c%s%c%s",
+            src->pw_name, 0, src->pw_dir, 0, src->pw_shell);
+
+    /*
+     * pw_passwd is non-POSIX and unused (always NULL) in bionic.
+     * pw_gecos is non-POSIX and missing in bionic.
+     */
+    dst->pw_passwd = NULL;
+
+    /* Copy the integral fields. */
+    dst->pw_gid = src->pw_gid;
+    dst->pw_uid = src->pw_uid;
+
+success:
+    rc = 0;
+    *result = dst;
+failure:
+    errno = old_errno;
+    return rc;
+}
+
+int getpwnam_r(const char* name, struct passwd* pwd,
+        char* buf, size_t byte_count, struct passwd** result)
+{
+    return do_getpw_r(1, name, -1, pwd, buf, byte_count, result);
+}
+
+int getpwuid_r(uid_t uid, struct passwd* pwd,
+        char* buf, size_t byte_count, struct passwd** result)
+{
+    return do_getpw_r(0, NULL, uid, pwd, buf, byte_count, result);
+}
+
 /** Thread-specific state for the stubs functions
  **/
 
@@ -400,4 +472,3 @@
 {
     fprintf(stderr, "FIX ME! implement %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
 }
-
diff --git a/libc/bionic/system_properties.c b/libc/bionic/system_properties.c
index 767baa3..0f4e70c 100644
--- a/libc/bionic/system_properties.c
+++ b/libc/bionic/system_properties.c
@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include <stddef.h>
 #include <errno.h>
+#include <poll.h>
 
 #include <sys/mman.h>
 
@@ -38,13 +39,14 @@
 #include <sys/select.h>
 #include <sys/types.h>
 #include <netinet/in.h>
+#include <unistd.h>
 
 #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
 #include <sys/_system_properties.h>
 
 #include <sys/atomics.h>
 
-static const char property_service_name[] = PROP_SERVICE_NAME;
+static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
 
 static unsigned dummy_props = 0;
 
@@ -152,6 +154,92 @@
     }
 }
 
+
+static int send_prop_msg(prop_msg *msg)
+{
+    struct pollfd pollfds[1];
+    struct sockaddr_un addr;
+    socklen_t alen;
+    size_t namelen;
+    int s;
+    int r;
+    int result = -1;
+
+    s = socket(AF_LOCAL, SOCK_STREAM, 0);
+    if(s < 0) {
+        return result;
+    }
+
+    memset(&addr, 0, sizeof(addr));
+    namelen = strlen(property_service_socket);
+    strlcpy(addr.sun_path, property_service_socket, sizeof addr.sun_path);
+    addr.sun_family = AF_LOCAL;
+    alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1;
+
+    if(TEMP_FAILURE_RETRY(connect(s, (struct sockaddr *) &addr, alen) < 0)) {
+        close(s);
+        return result;
+    }
+
+    r = TEMP_FAILURE_RETRY(send(s, msg, sizeof(prop_msg), 0));
+
+    if(r == sizeof(prop_msg)) {
+        // We successfully wrote to the property server but now we
+        // wait for the property server to finish its work.  It
+        // acknowledges its completion by closing the socket so we
+        // poll here (on nothing), waiting for the socket to close.
+        // If you 'adb shell setprop foo bar' you'll see the POLLHUP
+        // once the socket closes.  Out of paranoia we cap our poll
+        // at 250 ms.
+        pollfds[0].fd = s;
+        pollfds[0].events = 0;
+        r = TEMP_FAILURE_RETRY(poll(pollfds, 1, 250 /* ms */));
+        if (r == 1 && (pollfds[0].revents & POLLHUP) != 0) {
+            result = 0;
+        } else {
+            // Ignore the timeout and treat it like a success anyway.
+            // The init process is single-threaded and its property
+            // service is sometimes slow to respond (perhaps it's off
+            // starting a child process or something) and thus this
+            // times out and the caller thinks it failed, even though
+            // it's still getting around to it.  So we fake it here,
+            // mostly for ctl.* properties, but we do try and wait 250
+            // ms so callers who do read-after-write can reliably see
+            // what they've written.  Most of the time.
+            // TODO: fix the system properties design.
+            result = 0;
+        }
+    }
+
+    close(s);
+    return result;
+}
+
+int __system_property_set(const char *key, const char *value)
+{
+    int err;
+    int tries = 0;
+    int update_seen = 0;
+    prop_msg msg;
+
+    if(key == 0) return -1;
+    if(value == 0) value = "";
+    if(strlen(key) >= PROP_NAME_MAX) return -1;
+    if(strlen(value) >= PROP_VALUE_MAX) return -1;
+
+    memset(&msg, 0, sizeof msg);
+    msg.cmd = PROP_MSG_SETPROP;
+    strlcpy(msg.name, key, sizeof msg.name);
+    strlcpy(msg.value, value, sizeof msg.value);
+
+    err = send_prop_msg(&msg);
+    if(err < 0) {
+        return err;
+    }
+
+    return 0;
+}
+
 int __system_property_wait(const prop_info *pi)
 {
     unsigned n;
diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h
index f84d1d1..7daa8f7 100644
--- a/libc/include/dlfcn.h
+++ b/libc/include/dlfcn.h
@@ -47,7 +47,7 @@
 extern int          dlclose(void*  handle);
 extern const char*  dlerror(void);
 extern void*        dlsym(void*  handle, const char*  symbol);
-extern int          dladdr(void* addr, Dl_info *info);
+extern int          dladdr(const void* addr, Dl_info *info);
 
 enum {
   RTLD_NOW  = 0,
diff --git a/libc/include/elf.h b/libc/include/elf.h
index 8a86a63..c3e3226 100644
--- a/libc/include/elf.h
+++ b/libc/include/elf.h
@@ -28,30 +28,7 @@
 #ifndef _ELF_H
 #define _ELF_H
 
-/* these definitions are missing from the BSD sources */
-enum {
-    AT_NULL = 0,
-    AT_IGNORE,
-    AT_EXECFD,
-    AT_PHDR,
-    AT_PHENT,
-    AT_PHNUM,
-    AT_PAGESZ,
-    AT_BASE,
-    AT_FLAGS,
-    AT_ENTRY,
-    AT_NOTELF,
-    AT_UID,
-    AT_EUID,
-    AT_GID,
-    AT_EGID,
-    AT_PLATFORM,
-    AT_HWCAP,
-    AT_CLKTCK,
-
-    AT_SECURE = 23
-};
-
+#include <linux/auxvec.h>
 #include <sys/exec_elf.h>
 
 #endif /* _ELF_H */
diff --git a/libc/arch-sh/bionic/__get_sp.S b/libc/include/net/ethernet.h
similarity index 86%
rename from libc/arch-sh/bionic/__get_sp.S
rename to libc/include/net/ethernet.h
index 0e34a01..b1b88dd 100644
--- a/libc/arch-sh/bionic/__get_sp.S
+++ b/libc/include/net/ethernet.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2011 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,8 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-.text
-.type   __get_sp, @function
-.globl  __get_sp
-.align  4
-
-__get_sp:
-    rts
-    mov     r15, r0
-
+#ifndef _NET_ETHERNET_H_
+#define _NET_IF_ETHERNET_H_
+#include <linux/if_ether.h>
+#include <net/if_ether.h>
+#endif /* !_NET_ETHERNET_H_ */
diff --git a/libc/include/netdb.h b/libc/include/netdb.h
index c2e08ea..5ad7b4a 100644
--- a/libc/include/netdb.h
+++ b/libc/include/netdb.h
@@ -137,10 +137,7 @@
 /*
  * Error return codes from getaddrinfo()
  */
-#if 0
-/* obsoleted */
 #define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
-#endif
 #define	EAI_AGAIN	 2	/* temporary failure in name resolution */
 #define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
 #define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
@@ -209,8 +206,8 @@
 void endprotoent(void);
 void endservent(void);
 void freehostent(struct hostent *);
-struct hostent	*gethostbyaddr(const char *, int, int);
-int gethostbyaddr_r(const char *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent	*gethostbyaddr(const void *, int, int);
+int gethostbyaddr_r(const void *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent	*gethostbyname(const char *);
 int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent	*gethostbyname2(const char *, int);
diff --git a/libc/include/netinet/icmp6.h b/libc/include/netinet/icmp6.h
new file mode 100644
index 0000000..fbc8234
--- /dev/null
+++ b/libc/include/netinet/icmp6.h
@@ -0,0 +1,730 @@
+/*	$NetBSD: icmp6.h,v 1.40 2009/10/31 22:32:17 christos Exp $	*/
+/*	$KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $	*/
+
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_ICMP6_H_
+#define _NETINET_ICMP6_H_
+
+#define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr)
+					   - sizeof(struct icmp6_hdr) */
+
+struct icmp6_hdr {
+	u_int8_t	icmp6_type;	/* type field */
+	u_int8_t	icmp6_code;	/* code field */
+	u_int16_t	icmp6_cksum;	/* checksum field */
+	union {
+		u_int32_t	icmp6_un_data32[1]; /* type-specific field */
+		u_int16_t	icmp6_un_data16[2]; /* type-specific field */
+		u_int8_t	icmp6_un_data8[4];  /* type-specific field */
+	} icmp6_dataun;
+} __packed;
+
+#define icmp6_data32	icmp6_dataun.icmp6_un_data32
+#define icmp6_data16	icmp6_dataun.icmp6_un_data16
+#define icmp6_data8	icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr	icmp6_data32[0]		/* parameter prob */
+#define icmp6_mtu	icmp6_data32[0]		/* packet too big */
+#define icmp6_id	icmp6_data16[0]		/* echo request/reply */
+#define icmp6_seq	icmp6_data16[1]		/* echo request/reply */
+#define icmp6_maxdelay	icmp6_data16[0]		/* mcast group membership */
+
+#define ICMP6_DST_UNREACH		1	/* dest unreachable, codes: */
+#define ICMP6_PACKET_TOO_BIG		2	/* packet too big */
+#define ICMP6_TIME_EXCEEDED		3	/* time exceeded, code: */
+#define ICMP6_PARAM_PROB		4	/* ip6 header bad */
+
+#define ICMP6_ECHO_REQUEST		128	/* echo service */
+#define ICMP6_ECHO_REPLY		129	/* echo reply */
+#define MLD_LISTENER_QUERY		130 	/* multicast listener query */
+#define MLD_LISTENER_REPORT		131	/* multicast listener report */
+#define MLD_LISTENER_DONE		132	/* multicast listener done */
+
+/* RFC2292 decls */
+#define ICMP6_MEMBERSHIP_QUERY		130	/* group membership query */
+#define ICMP6_MEMBERSHIP_REPORT		131	/* group membership report */
+#define ICMP6_MEMBERSHIP_REDUCTION	132	/* group membership termination */
+
+#ifndef _KERNEL
+/* the followings are for backward compatibility to old KAME apps. */
+#define MLD6_LISTENER_QUERY	MLD_LISTENER_QUERY
+#define MLD6_LISTENER_REPORT	MLD_LISTENER_REPORT
+#define MLD6_LISTENER_DONE	MLD_LISTENER_DONE
+#endif
+
+#define ND_ROUTER_SOLICIT		133	/* router solicitation */
+#define ND_ROUTER_ADVERT		134	/* router advertisement */
+#define ND_NEIGHBOR_SOLICIT		135	/* neighbor solicitation */
+#define ND_NEIGHBOR_ADVERT		136	/* neighbor advertisement */
+#define ND_REDIRECT			137	/* redirect */
+
+#define ICMP6_ROUTER_RENUMBERING	138	/* router renumbering */
+
+#define ICMP6_WRUREQUEST		139	/* who are you request */
+#define ICMP6_WRUREPLY			140	/* who are you reply */
+#define ICMP6_FQDN_QUERY		139	/* FQDN query */
+#define ICMP6_FQDN_REPLY		140	/* FQDN reply */
+#define ICMP6_NI_QUERY			139	/* node information request */
+#define ICMP6_NI_REPLY			140	/* node information reply */
+
+/* The definitions below are experimental. TBA */
+#define MLD_MTRACE_RESP			200	/* mtrace response(to sender) */
+#define MLD_MTRACE			201	/* mtrace messages */
+
+#ifndef _KERNEL
+/* the followings are for backward compatibility to old KAME apps. */
+#define MLD6_MTRACE_RESP	MLD_MTRACE_RESP
+#define MLD6_MTRACE		MLD_MTRACE
+#endif
+
+#define ICMP6_MAXTYPE			201
+
+#define ICMP6_DST_UNREACH_NOROUTE	0	/* no route to destination */
+#define ICMP6_DST_UNREACH_ADMIN	 	1	/* administratively prohibited */
+#define ICMP6_DST_UNREACH_NOTNEIGHBOR	2	/* not a neighbor(obsolete) */
+#define ICMP6_DST_UNREACH_BEYONDSCOPE	2	/* beyond scope of source address */
+#define ICMP6_DST_UNREACH_ADDR		3	/* address unreachable */
+#define ICMP6_DST_UNREACH_NOPORT	4	/* port unreachable */
+
+#define ICMP6_TIME_EXCEED_TRANSIT 	0	/* ttl==0 in transit */
+#define ICMP6_TIME_EXCEED_REASSEMBLY	1	/* ttl==0 in reass */
+
+#define ICMP6_PARAMPROB_HEADER 	 	0	/* erroneous header field */
+#define ICMP6_PARAMPROB_NEXTHEADER	1	/* unrecognized next header */
+#define ICMP6_PARAMPROB_OPTION		2	/* unrecognized option */
+
+#define ICMP6_INFOMSG_MASK		0x80	/* all informational messages */
+
+#define ICMP6_NI_SUBJ_IPV6	0	/* Query Subject is an IPv6 address */
+#define ICMP6_NI_SUBJ_FQDN	1	/* Query Subject is a Domain name */
+#define ICMP6_NI_SUBJ_IPV4	2	/* Query Subject is an IPv4 address */
+
+#define ICMP6_NI_SUCCESS	0	/* node information successful reply */
+#define ICMP6_NI_REFUSED	1	/* node information request is refused */
+#define ICMP6_NI_UNKNOWN	2	/* unknown Qtype */
+
+#define ICMP6_ROUTER_RENUMBERING_COMMAND  0	/* rr command */
+#define ICMP6_ROUTER_RENUMBERING_RESULT   1	/* rr result */
+#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255	/* rr seq num reset */
+
+/* Used in kernel only */
+#define ND_REDIRECT_ONLINK	0	/* redirect to an on-link node */
+#define ND_REDIRECT_ROUTER	1	/* redirect to a better router */
+
+/*
+ * Multicast Listener Discovery
+ */
+struct mld_hdr {
+	struct icmp6_hdr	mld_icmp6_hdr;
+	struct in6_addr		mld_addr; /* multicast address */
+} __packed;
+
+/* definitions to provide backward compatibility to old KAME applications */
+#ifndef _KERNEL
+#define mld6_hdr	mld_hdr
+#define mld6_type	mld_type
+#define mld6_code	mld_code
+#define mld6_cksum	mld_cksum
+#define mld6_maxdelay	mld_maxdelay
+#define mld6_reserved	mld_reserved
+#define mld6_addr	mld_addr
+#endif
+
+/* shortcut macro definitions */
+#define mld_type	mld_icmp6_hdr.icmp6_type
+#define mld_code	mld_icmp6_hdr.icmp6_code
+#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
+
+#define MLD_MINLEN			24
+
+/*
+ * Neighbor Discovery
+ */
+
+struct nd_router_solicit {	/* router solicitation */
+	struct icmp6_hdr 	nd_rs_hdr;
+	/* could be followed by options */
+} __packed;
+
+#define nd_rs_type	nd_rs_hdr.icmp6_type
+#define nd_rs_code	nd_rs_hdr.icmp6_code
+#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert {	/* router advertisement */
+	struct icmp6_hdr	nd_ra_hdr;
+	u_int32_t		nd_ra_reachable;	/* reachable time */
+	u_int32_t		nd_ra_retransmit;	/* retransmit timer */
+	/* could be followed by options */
+} __packed;
+
+#define nd_ra_type		nd_ra_hdr.icmp6_type
+#define nd_ra_code		nd_ra_hdr.icmp6_code
+#define nd_ra_cksum		nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED	0x80
+#define ND_RA_FLAG_OTHER	0x40
+#define ND_RA_FLAG_HOME_AGENT	0x20
+
+/*
+ * Router preference values based on RFC4199.
+ */
+#define ND_RA_FLAG_RTPREF_MASK	0x18 /* 00011000 */
+
+#define ND_RA_FLAG_RTPREF_HIGH	0x08 /* 00001000 */
+#define ND_RA_FLAG_RTPREF_MEDIUM	0x00 /* 00000000 */
+#define ND_RA_FLAG_RTPREF_LOW	0x18 /* 00011000 */
+#define ND_RA_FLAG_RTPREF_RSV	0x10 /* 00010000 */
+
+#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit {	/* neighbor solicitation */
+	struct icmp6_hdr	nd_ns_hdr;
+	struct in6_addr		nd_ns_target;	/*target address */
+	/* could be followed by options */
+} __packed;
+
+#define nd_ns_type		nd_ns_hdr.icmp6_type
+#define nd_ns_code		nd_ns_hdr.icmp6_code
+#define nd_ns_cksum		nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved		nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert {	/* neighbor advertisement */
+	struct icmp6_hdr	nd_na_hdr;
+	struct in6_addr		nd_na_target;	/* target address */
+	/* could be followed by options */
+} __packed;
+
+#define nd_na_type		nd_na_hdr.icmp6_type
+#define nd_na_code		nd_na_hdr.icmp6_code
+#define nd_na_cksum		nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
+#if BYTE_ORDER == BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER		0x80000000
+#define ND_NA_FLAG_SOLICITED		0x40000000
+#define ND_NA_FLAG_OVERRIDE		0x20000000
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define ND_NA_FLAG_ROUTER		0x80
+#define ND_NA_FLAG_SOLICITED		0x40
+#define ND_NA_FLAG_OVERRIDE		0x20
+#endif
+#endif
+
+struct nd_redirect {		/* redirect */
+	struct icmp6_hdr	nd_rd_hdr;
+	struct in6_addr		nd_rd_target;	/* target address */
+	struct in6_addr		nd_rd_dst;	/* destination address */
+	/* could be followed by options */
+} __packed;
+
+#define nd_rd_type		nd_rd_hdr.icmp6_type
+#define nd_rd_code		nd_rd_hdr.icmp6_code
+#define nd_rd_cksum		nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved		nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr {		/* Neighbor discovery option header */
+	u_int8_t	nd_opt_type;
+	u_int8_t	nd_opt_len;
+	/* followed by option specific data*/
+} __packed;
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_ADVINTERVAL		7
+#define ND_OPT_HOMEAGENT_INFO		8
+#define ND_OPT_SOURCE_ADDRLIST		9
+#define ND_OPT_TARGET_ADDRLIST		10
+#define ND_OPT_RDNSS			25
+/* draft-ietf-ipngwg-router-preference, not officially assigned yet */
+#define ND_OPT_ROUTE_INFO		200
+/* draft-ietf-mobileip-hmipv6, not officially assigned yet */
+#define ND_OPT_MAP			201
+
+struct nd_opt_route_info {	/* route info */
+	u_int8_t	nd_opt_rti_type;
+	u_int8_t	nd_opt_rti_len;
+	u_int8_t	nd_opt_rti_prefixlen;
+	u_int8_t	nd_opt_rti_flags;
+	u_int32_t	nd_opt_rti_lifetime;
+	/* prefix follows */
+};
+
+struct nd_opt_prefix_info {	/* prefix information */
+	u_int8_t	nd_opt_pi_type;
+	u_int8_t	nd_opt_pi_len;
+	u_int8_t	nd_opt_pi_prefix_len;
+	u_int8_t	nd_opt_pi_flags_reserved;
+	u_int32_t	nd_opt_pi_valid_time;
+	u_int32_t	nd_opt_pi_preferred_time;
+	u_int32_t	nd_opt_pi_reserved2;
+	struct in6_addr	nd_opt_pi_prefix;
+} __packed;
+
+#define ND_OPT_PI_FLAG_ONLINK		0x80
+#define ND_OPT_PI_FLAG_AUTO		0x40
+
+struct nd_opt_rd_hdr {		/* redirected header */
+	u_int8_t	nd_opt_rh_type;
+	u_int8_t	nd_opt_rh_len;
+	u_int16_t	nd_opt_rh_reserved1;
+	u_int32_t	nd_opt_rh_reserved2;
+	/* followed by IP header and data */
+} __packed;
+
+struct nd_opt_mtu {		/* MTU option */
+	u_int8_t	nd_opt_mtu_type;
+	u_int8_t	nd_opt_mtu_len;
+	u_int16_t	nd_opt_mtu_reserved;
+	u_int32_t	nd_opt_mtu_mtu;
+} __packed;
+
+struct nd_opt_rdnss {		/* RDNSS option RFC 5006 */
+	u_int8_t	nd_opt_rdnss_type;
+	u_int8_t	nd_opt_rdnss_len;
+	u_int16_t	nd_opt_rdnss_reserved;
+	u_int32_t	nd_opt_rdnss_lifetime;
+	/* followed by list of IP prefixes */
+} __packed;
+
+/*
+ * icmp6 namelookup
+ */
+
+struct icmp6_namelookup {
+	struct icmp6_hdr 	icmp6_nl_hdr;
+	u_int8_t	icmp6_nl_nonce[8];
+	int32_t		icmp6_nl_ttl;
+#if 0
+	u_int8_t	icmp6_nl_len;
+	u_int8_t	icmp6_nl_name[3];
+#endif
+	/* could be followed by options */
+} __packed;
+
+/*
+ * icmp6 node information
+ */
+struct icmp6_nodeinfo {
+	struct icmp6_hdr icmp6_ni_hdr;
+	u_int8_t icmp6_ni_nonce[8];
+	/* could be followed by reply data */
+} __packed;
+
+#define ni_type		icmp6_ni_hdr.icmp6_type
+#define ni_code		icmp6_ni_hdr.icmp6_code
+#define ni_cksum	icmp6_ni_hdr.icmp6_cksum
+#define ni_qtype	icmp6_ni_hdr.icmp6_data16[0]
+#define ni_flags	icmp6_ni_hdr.icmp6_data16[1]
+
+#define NI_QTYPE_NOOP		0 /* NOOP  */
+#define NI_QTYPE_SUPTYPES	1 /* Supported Qtypes */
+#define NI_QTYPE_FQDN		2 /* FQDN (draft 04) */
+#define NI_QTYPE_DNSNAME	2 /* DNS Name */
+#define NI_QTYPE_NODEADDR	3 /* Node Addresses */
+#define NI_QTYPE_IPV4ADDR	4 /* IPv4 Addresses */
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_SUPTYPE_FLAG_COMPRESS	0x1
+#define NI_FQDN_FLAG_VALIDTTL		0x1
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_SUPTYPE_FLAG_COMPRESS	0x0100
+#define NI_FQDN_FLAG_VALIDTTL		0x0100
+#endif
+
+#ifdef NAME_LOOKUPS_04
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x1
+#define NI_NODEADDR_FLAG_SITELOCAL	0x2
+#define NI_NODEADDR_FLAG_GLOBAL		0x4
+#define NI_NODEADDR_FLAG_ALL		0x8
+#define NI_NODEADDR_FLAG_TRUNCATE	0x10
+#define NI_NODEADDR_FLAG_ANYCAST	0x20 /* just experimental. not in spec */
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x0100
+#define NI_NODEADDR_FLAG_SITELOCAL	0x0200
+#define NI_NODEADDR_FLAG_GLOBAL		0x0400
+#define NI_NODEADDR_FLAG_ALL		0x0800
+#define NI_NODEADDR_FLAG_TRUNCATE	0x1000
+#define NI_NODEADDR_FLAG_ANYCAST	0x2000 /* just experimental. not in spec */
+#endif
+#else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_NODEADDR_FLAG_TRUNCATE	0x1
+#define NI_NODEADDR_FLAG_ALL		0x2
+#define NI_NODEADDR_FLAG_COMPAT		0x4
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x8
+#define NI_NODEADDR_FLAG_SITELOCAL	0x10
+#define NI_NODEADDR_FLAG_GLOBAL		0x20
+#define NI_NODEADDR_FLAG_ANYCAST	0x40 /* just experimental. not in spec */
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_NODEADDR_FLAG_TRUNCATE	0x0100
+#define NI_NODEADDR_FLAG_ALL		0x0200
+#define NI_NODEADDR_FLAG_COMPAT		0x0400
+#define NI_NODEADDR_FLAG_LINKLOCAL	0x0800
+#define NI_NODEADDR_FLAG_SITELOCAL	0x1000
+#define NI_NODEADDR_FLAG_GLOBAL		0x2000
+#define NI_NODEADDR_FLAG_ANYCAST	0x4000 /* just experimental. not in spec */
+#endif
+#endif
+
+struct ni_reply_fqdn {
+	u_int32_t ni_fqdn_ttl;	/* TTL */
+	u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
+	u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
+} __packed;
+
+/*
+ * Router Renumbering. as router-renum-08.txt
+ */
+struct icmp6_router_renum {	/* router renumbering header */
+	struct icmp6_hdr	rr_hdr;
+	u_int8_t	rr_segnum;
+	u_int8_t	rr_flags;
+	u_int16_t	rr_maxdelay;
+	u_int32_t	rr_reserved;
+} __packed;
+
+#define ICMP6_RR_FLAGS_TEST		0x80
+#define ICMP6_RR_FLAGS_REQRESULT	0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
+#define ICMP6_RR_FLAGS_SPECSITE		0x10
+#define ICMP6_RR_FLAGS_PREVDONE		0x08
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code		rr_hdr.icmp6_code
+#define rr_cksum	rr_hdr.icmp6_cksum
+#define rr_seqnum 	rr_hdr.icmp6_data32[0]
+
+struct rr_pco_match {		/* match prefix part */
+	u_int8_t	rpm_code;
+	u_int8_t	rpm_len;
+	u_int8_t	rpm_ordinal;
+	u_int8_t	rpm_matchlen;
+	u_int8_t	rpm_minlen;
+	u_int8_t	rpm_maxlen;
+	u_int16_t	rpm_reserved;
+	struct	in6_addr	rpm_prefix;
+} __packed;
+
+#define RPM_PCO_ADD		1
+#define RPM_PCO_CHANGE		2
+#define RPM_PCO_SETGLOBAL	3
+#define RPM_PCO_MAX		4
+
+struct rr_pco_use {		/* use prefix part */
+	u_int8_t	rpu_uselen;
+	u_int8_t	rpu_keeplen;
+	u_int8_t	rpu_ramask;
+	u_int8_t	rpu_raflags;
+	u_int32_t	rpu_vltime;
+	u_int32_t	rpu_pltime;
+	u_int32_t	rpu_flags;
+	struct	in6_addr rpu_prefix;
+} __packed;
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x80
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x40
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40
+#endif
+
+struct rr_result {		/* router renumbering result message */
+	u_int16_t	rrr_flags;
+	u_int8_t	rrr_ordinal;
+	u_int8_t	rrr_matchedlen;
+	u_int32_t	rrr_ifid;
+	struct	in6_addr rrr_prefix;
+} __packed;
+#if BYTE_ORDER == BIG_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB		0x0002
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0001
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB		0x0200
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN		0x0100
+#endif
+
+/*
+ * icmp6 filter structures.
+ */
+
+struct icmp6_filter {
+	u_int32_t icmp6_filt[8];
+};
+
+#define	ICMP6_FILTER_SETPASSALL(filterp) \
+	(void)memset(filterp, 0xff, sizeof(struct icmp6_filter))
+#define	ICMP6_FILTER_SETBLOCKALL(filterp) \
+	(void)memset(filterp, 0x00, sizeof(struct icmp6_filter))
+#define	ICMP6_FILTER_SETPASS(type, filterp) \
+	(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))
+#define	ICMP6_FILTER_SETBLOCK(type, filterp) \
+	(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))
+#define	ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+#define	ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+/*
+ * Variables related to this implementation
+ * of the internet control message protocol version 6.
+ */
+
+/*
+ * IPv6 ICMP statistics.
+ * Each counter is an unsigned 64-bit value.
+ */
+#define	ICMP6_STAT_ERROR	0	/* # of calls to icmp6_error */
+#define	ICMP6_STAT_CANTERROR	1	/* no error (old was icmp) */
+#define	ICMP6_STAT_TOOFREQ	2	/* no error (rate limitation) */
+#define	ICMP6_STAT_OUTHIST	3	/* # of output messages */
+		/* space for 256 counters */
+#define	ICMP6_STAT_BADCODE	259	/* icmp6_code out of range */
+#define	ICMP6_STAT_TOOSHORT	260	/* packet < sizeof(struct icmp6_hdr) */
+#define	ICMP6_STAT_CHECKSUM	261	/* bad checksum */
+#define	ICMP6_STAT_BADLEN	262	/* calculated bound mismatch */
+	/*
+	 * number of responses; this member is inherited from the netinet code,
+	 * but for netinet6 code, it is already available in outhist[].
+	 */
+#define	ICMP6_STAT_REFLECT	263
+#define	ICMP6_STAT_INHIST	264	/* # of input messages */
+		/* space for 256 counters */
+#define	ICMP6_STAT_ND_TOOMANYOPT 520	/* too many ND options */
+#define	ICMP6_STAT_OUTERRHIST	521
+		/* space for 13 counters */
+#define	ICMP6_STAT_PMTUCHG	534	/* path MTU changes */
+#define	ICMP6_STAT_ND_BADOPT	535	/* bad ND options */
+#define	ICMP6_STAT_BADNS	536	/* bad neighbor solicititation */
+#define	ICMP6_STAT_BADNA	537	/* bad neighbor advertisement */
+#define	ICMP6_STAT_BADRS	538	/* bad router solicitiation */
+#define	ICMP6_STAT_BADRA	539	/* bad router advertisement */
+#define	ICMP6_STAT_BADREDIRECT	540	/* bad redirect message */
+
+#define	ICMP6_NSTATS		541
+
+#define	ICMP6_ERRSTAT_DST_UNREACH_NOROUTE	0
+#define	ICMP6_ERRSTAT_DST_UNREACH_ADMIN		1
+#define	ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE	2
+#define	ICMP6_ERRSTAT_DST_UNREACH_ADDR		3
+#define	ICMP6_ERRSTAT_DST_UNREACH_NOPORT	4
+#define	ICMP6_ERRSTAT_PACKET_TOO_BIG		5
+#define	ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT	6
+#define	ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY	7
+#define	ICMP6_ERRSTAT_PARAMPROB_HEADER		8
+#define	ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER	9
+#define	ICMP6_ERRSTAT_PARAMPROB_OPTION		10
+#define	ICMP6_ERRSTAT_REDIRECT			11
+#define	ICMP6_ERRSTAT_UNKNOWN			12
+
+/*
+ * Names for ICMP sysctl objects
+ */
+#define ICMPV6CTL_STATS		1
+#define ICMPV6CTL_REDIRACCEPT	2	/* accept/process redirects */
+#define ICMPV6CTL_REDIRTIMEOUT	3	/* redirect cache time */
+#if 0	/*obsoleted*/
+#define ICMPV6CTL_ERRRATELIMIT	5	/* ICMPv6 error rate limitation */
+#endif
+#define ICMPV6CTL_ND6_PRUNE	6
+#define ICMPV6CTL_ND6_DELAY	8
+#define ICMPV6CTL_ND6_UMAXTRIES	9
+#define ICMPV6CTL_ND6_MMAXTRIES		10
+#define ICMPV6CTL_ND6_USELOOPBACK	11
+/*#define ICMPV6CTL_ND6_PROXYALL	12	obsoleted, do not reuse here */
+#define ICMPV6CTL_NODEINFO	13
+#define ICMPV6CTL_ERRPPSLIMIT	14	/* ICMPv6 error pps limitation */
+#define ICMPV6CTL_ND6_MAXNUDHINT	15
+#define ICMPV6CTL_MTUDISC_HIWAT	16
+#define ICMPV6CTL_MTUDISC_LOWAT	17
+#define ICMPV6CTL_ND6_DEBUG	18
+#define ICMPV6CTL_ND6_DRLIST	19
+#define ICMPV6CTL_ND6_PRLIST	20
+#define	ICMPV6CTL_ND6_MAXQLEN	24
+#define ICMPV6CTL_MAXID		25
+
+#define ICMPV6CTL_NAMES { \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "rediraccept", CTLTYPE_INT }, \
+	{ "redirtimeout", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "nd6_prune", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "nd6_delay", CTLTYPE_INT }, \
+	{ "nd6_umaxtries", CTLTYPE_INT }, \
+	{ "nd6_mmaxtries", CTLTYPE_INT }, \
+	{ "nd6_useloopback", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ "nodeinfo", CTLTYPE_INT }, \
+	{ "errppslimit", CTLTYPE_INT }, \
+	{ "nd6_maxnudhint", CTLTYPE_INT }, \
+	{ "mtudisc_hiwat", CTLTYPE_INT }, \
+	{ "mtudisc_lowat", CTLTYPE_INT }, \
+	{ "nd6_debug", CTLTYPE_INT }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ 0, 0 }, \
+	{ "nd6_maxqueuelen", CTLTYPE_INT }, \
+}
+
+#define RTF_PROBEMTU	RTF_PROTO1
+
+#ifdef _KERNEL
+struct	rtentry;
+struct	rttimer;
+struct	in6_multi;
+
+void	icmp6_init(void);
+void	icmp6_paramerror(struct mbuf *, int);
+void	icmp6_error(struct mbuf *, int, int, int);
+void	icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
+int	icmp6_input(struct mbuf **, int *, int);
+void	icmp6_fasttimo(void);
+void	icmp6_reflect(struct mbuf *, size_t);
+void	icmp6_prepare(struct mbuf *);
+void	icmp6_redirect_input(struct mbuf *, int);
+void	icmp6_redirect_output(struct mbuf *, struct rtentry *);
+int	icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+
+void	icmp6_statinc(u_int);
+
+struct	ip6ctlparam;
+void	icmp6_mtudisc_update(struct ip6ctlparam *, int);
+void	icmp6_mtudisc_callback_register(void (*)(struct in6_addr *));
+
+/* XXX: is this the right place for these macros? */
+#define icmp6_ifstat_inc(ifp, tag) \
+do {								\
+	if (ifp)						\
+		((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
+} while (/*CONSTCOND*/ 0)
+
+#define icmp6_ifoutstat_inc(ifp, type, code) \
+do { \
+		icmp6_ifstat_inc(ifp, ifs6_out_msg); \
+		switch(type) { \
+		 case ICMP6_DST_UNREACH: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
+			 if (code == ICMP6_DST_UNREACH_ADMIN) \
+				 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
+			 break; \
+		 case ICMP6_PACKET_TOO_BIG: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
+			 break; \
+		 case ICMP6_TIME_EXCEEDED: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
+			 break; \
+		 case ICMP6_PARAM_PROB: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
+			 break; \
+		 case ICMP6_ECHO_REQUEST: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_echo); \
+			 break; \
+		 case ICMP6_ECHO_REPLY: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
+			 break; \
+		 case MLD_LISTENER_QUERY: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
+			 break; \
+		 case MLD_LISTENER_REPORT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
+			 break; \
+		 case MLD_LISTENER_DONE: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
+			 break; \
+		 case ND_ROUTER_SOLICIT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
+			 break; \
+		 case ND_ROUTER_ADVERT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
+			 break; \
+		 case ND_NEIGHBOR_SOLICIT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
+			 break; \
+		 case ND_NEIGHBOR_ADVERT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
+			 break; \
+		 case ND_REDIRECT: \
+			 icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
+			 break; \
+		} \
+} while (/*CONSTCOND*/ 0)
+
+extern int	icmp6_rediraccept;	/* accept/process redirects */
+extern int	icmp6_redirtimeout;	/* cache time for redirect routes */
+#endif /* _KERNEL */
+
+#endif /* !_NETINET_ICMP6_H_ */
diff --git a/libc/include/netinet/in.h b/libc/include/netinet/in.h
index 7a4b6c7..01bf58e 100644
--- a/libc/include/netinet/in.h
+++ b/libc/include/netinet/in.h
@@ -32,6 +32,7 @@
 #include <linux/socket.h>
 #include <linux/in.h>
 #include <linux/in6.h>
+#include <linux/ipv6.h>
 #include <netinet/in6.h>
 
 __BEGIN_DECLS
diff --git a/libc/include/netinet/in6.h b/libc/include/netinet/in6.h
index 580a510..7f3286a 100644
--- a/libc/include/netinet/in6.h
+++ b/libc/include/netinet/in6.h
@@ -103,6 +103,7 @@
 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
 
 #define IN6ADDR_ANY_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}
+#define IN6ADDR_LOOPBACK_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}}
 
 #define ipv6mr_interface ipv6mr_ifindex
 
diff --git a/libc/include/netinet/ip.h b/libc/include/netinet/ip.h
index 541905c..629ed77 100644
--- a/libc/include/netinet/ip.h
+++ b/libc/include/netinet/ip.h
@@ -83,7 +83,7 @@
 #define	IPTOS_LOWDELAY		0x10
 #define	IPTOS_THROUGHPUT	0x08
 #define	IPTOS_RELIABILITY	0x04
-/*	IPTOS_LOWCOST		0x02 XXX */
+#define	IPTOS_MINCOST		0x02
 #if 1
 /* ECN RFC3168 obsoletes RFC2481, and these will be deprecated soon. */
 #define IPTOS_CE		0x01	/* congestion experienced */
diff --git a/libc/include/netinet/ip6.h b/libc/include/netinet/ip6.h
new file mode 100644
index 0000000..aa816c2
--- /dev/null
+++ b/libc/include/netinet/ip6.h
@@ -0,0 +1,319 @@
+/*	$NetBSD: ip6.h,v 1.23 2007/12/25 18:33:46 perry Exp $	*/
+/*	$KAME: ip6.h,v 1.45 2003/06/05 04:46:38 keiichi Exp $	*/
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *	@(#)ip.h	8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IP6_H_
+#define _NETINET_IP6_H_
+
+/*
+ * Definition for internet protocol version 6.
+ * RFC 2460
+ */
+
+struct ip6_hdr {
+	union {
+		struct ip6_hdrctl {
+			u_int32_t ip6_un1_flow;	/* 20 bits of flow-ID */
+			u_int16_t ip6_un1_plen;	/* payload length */
+			u_int8_t  ip6_un1_nxt;	/* next header */
+			u_int8_t  ip6_un1_hlim;	/* hop limit */
+		} ip6_un1;
+		u_int8_t ip6_un2_vfc;	/* 4 bits version, top 4 bits class */
+	} ip6_ctlun;
+	struct in6_addr ip6_src;	/* source address */
+	struct in6_addr ip6_dst;	/* destination address */
+} __packed;
+
+#define ip6_vfc		ip6_ctlun.ip6_un2_vfc
+#define ip6_flow	ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen	ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt		ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim	ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops	ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+#define IPV6_VERSION		0x60
+#define IPV6_VERSION_MASK	0xf0
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IPV6_FLOWINFO_MASK	0x0fffffff	/* flow info (28 bits) */
+#define IPV6_FLOWLABEL_MASK	0x000fffff	/* flow label (20 bits) */
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define IPV6_FLOWINFO_MASK	0xffffff0f	/* flow info (28 bits) */
+#define IPV6_FLOWLABEL_MASK	0xffff0f00	/* flow label (20 bits) */
+#endif /* LITTLE_ENDIAN */
+#endif
+#if 1
+/* ECN bits proposed by Sally Floyd */
+#define IP6TOS_CE		0x01	/* congestion experienced */
+#define IP6TOS_ECT		0x02	/* ECN-capable transport */
+#endif
+
+#ifdef _KERNEL
+/*
+ * for IPv6 pseudo header checksum
+ * XXX nonstandard
+ */
+struct ip6_hdr_pseudo {
+	struct in6_addr ip6ph_src;
+	struct in6_addr ip6ph_dst;
+	u_int32_t	ip6ph_len;
+	u_int8_t	ip6ph_zero[3];
+	u_int8_t	ip6ph_nxt;
+} __packed;
+#endif
+
+/*
+ * Extension Headers
+ */
+
+struct	ip6_ext {
+	u_int8_t ip6e_nxt;
+	u_int8_t ip6e_len;
+} __packed;
+
+/* Hop-by-Hop options header */
+/* XXX should we pad it to force alignment on an 8-byte boundary? */
+struct ip6_hbh {
+	u_int8_t ip6h_nxt;	/* next header */
+	u_int8_t ip6h_len;	/* length in units of 8 octets */
+	/* followed by options */
+} __packed;
+
+/* Destination options header */
+/* XXX should we pad it to force alignment on an 8-byte boundary? */
+struct ip6_dest {
+	u_int8_t ip6d_nxt;	/* next header */
+	u_int8_t ip6d_len;	/* length in units of 8 octets */
+	/* followed by options */
+} __packed;
+
+/* Option types and related macros */
+#define IP6OPT_PAD1		0x00	/* 00 0 00000 */
+#define IP6OPT_PADN		0x01	/* 00 0 00001 */
+#define IP6OPT_JUMBO		0xC2	/* 11 0 00010 = 194 */
+#define IP6OPT_NSAP_ADDR	0xC3	/* 11 0 00011 */
+#define IP6OPT_TUNNEL_LIMIT	0x04	/* 00 0 00100 */
+#define IP6OPT_RTALERT		0x05	/* 00 0 00101 (KAME definition) */
+#define IP6OPT_ROUTER_ALERT	0x05	/* (RFC3542 def, recommended) */
+
+#define IP6OPT_RTALERT_LEN	4
+#define IP6OPT_RTALERT_MLD	0	/* Datagram contains an MLD message */
+#define IP6OPT_RTALERT_RSVP	1	/* Datagram contains an RSVP message */
+#define IP6OPT_RTALERT_ACTNET	2 	/* contains an Active Networks msg */
+#define IP6OPT_MINLEN		2
+
+#define IP6OPT_TYPE(o)		((o) & 0xC0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xC0
+
+#define IP6OPT_MUTABLE		0x20
+
+/* IPv6 options: common part */
+struct ip6_opt {
+	u_int8_t ip6o_type;
+	u_int8_t ip6o_len;
+} __packed;
+
+/* Jumbo Payload Option */
+struct ip6_opt_jumbo {
+	u_int8_t ip6oj_type;
+	u_int8_t ip6oj_len;
+	u_int8_t ip6oj_jumbo_len[4];
+} __packed;
+#define IP6OPT_JUMBO_LEN 6
+
+/* NSAP Address Option */
+struct ip6_opt_nsap {
+	u_int8_t ip6on_type;
+	u_int8_t ip6on_len;
+	u_int8_t ip6on_src_nsap_len;
+	u_int8_t ip6on_dst_nsap_len;
+	/* followed by source NSAP */
+	/* followed by destination NSAP */
+} __packed;
+
+/* Tunnel Limit Option */
+struct ip6_opt_tunnel {
+	u_int8_t ip6ot_type;
+	u_int8_t ip6ot_len;
+	u_int8_t ip6ot_encap_limit;
+} __packed;
+
+/* Router Alert Option */
+struct ip6_opt_router {
+	u_int8_t ip6or_type;
+	u_int8_t ip6or_len;
+	u_int8_t ip6or_value[2];
+} __packed;
+/* Router alert values (in network byte order) */
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0001
+#define IP6_ALERT_AN	0x0002
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0100
+#define IP6_ALERT_AN	0x0200
+#endif /* LITTLE_ENDIAN */
+#endif
+
+/* Routing header */
+struct ip6_rthdr {
+	u_int8_t  ip6r_nxt;	/* next header */
+	u_int8_t  ip6r_len;	/* length in units of 8 octets */
+	u_int8_t  ip6r_type;	/* routing type */
+	u_int8_t  ip6r_segleft;	/* segments left */
+	/* followed by routing type specific data */
+} __packed;
+
+/* Type 0 Routing header */
+struct ip6_rthdr0 {
+	u_int8_t  ip6r0_nxt;		/* next header */
+	u_int8_t  ip6r0_len;		/* length in units of 8 octets */
+	u_int8_t  ip6r0_type;		/* always zero */
+	u_int8_t  ip6r0_segleft;	/* segments left */
+	u_int32_t ip6r0_reserved;	/* reserved field */
+} __packed;
+
+/* Fragment header */
+struct ip6_frag {
+	u_int8_t  ip6f_nxt;		/* next header */
+	u_int8_t  ip6f_reserved;	/* reserved field */
+	u_int16_t ip6f_offlg;		/* offset, reserved, and flag */
+	u_int32_t ip6f_ident;		/* identification */
+} __packed;
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6F_OFF_MASK		0xfff8	/* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK	0x0006	/* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG		0x0001	/* more-fragments flag */
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define IP6F_OFF_MASK		0xf8ff	/* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK	0x0600	/* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG		0x0100	/* more-fragments flag */
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+/*
+ * Internet implementation parameters.
+ */
+#define IPV6_MAXHLIM	255	/* maximum hoplimit */
+#define IPV6_DEFHLIM	64	/* default hlim */
+#define IPV6_FRAGTTL	120	/* ttl for fragment packets, in slowtimo tick */
+#define IPV6_HLIMDEC	1	/* subtracted when forwarding */
+
+#define IPV6_MMTU	1280	/* minimal MTU and reassembly. 1024 + 256 */
+#define IPV6_MAXPACKET	65535	/* ip6 max packet size without Jumbo payload*/
+
+#ifdef _KERNEL
+/*
+ * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
+ * "len") is located in single mbuf, on contiguous memory region.
+ * The pointer to the region will be returned to pointer variable "val",
+ * with type "typ".
+ * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
+ * very top of mbuf.  GET0 is likely to make memory copy than GET.
+ *
+ * XXX we're now testing this, needs m_pulldown()
+ */
+#define IP6_EXTHDR_GET(val, typ, m, off, len) \
+do {									\
+	struct mbuf *_t;						\
+	int _tmp;							\
+	if ((m)->m_len >= (off) + (len))				\
+		(val) = (typ)(mtod((m), char *) + (off));		\
+	else {								\
+		_t = m_pulldown((m), (off), (len), &_tmp);		\
+		if (_t) {						\
+			if (_t->m_len < _tmp + (len))			\
+				panic("m_pulldown malfunction");	\
+			(val) = (typ)(mtod(_t, char *) + _tmp);	\
+		} else {						\
+			(val) = (typ)NULL;				\
+			(m) = NULL;					\
+		}							\
+	}								\
+} while (/*CONSTCOND*/ 0)
+
+#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
+do {									\
+	struct mbuf *_t;						\
+	if ((off) == 0 && (m)->m_len >= len)				\
+		(val) = (typ)mtod((m), void *);			\
+	else {								\
+		_t = m_pulldown((m), (off), (len), NULL);		\
+		if (_t) {						\
+			if (_t->m_len < (len))				\
+				panic("m_pulldown malfunction");	\
+			(val) = (typ)mtod(_t, void *);			\
+		} else {						\
+			(val) = (typ)NULL;				\
+			(m) = NULL;					\
+		}							\
+	}								\
+} while (/*CONSTCOND*/ 0)
+#endif /*_KERNEL*/
+
+#endif /* !_NETINET_IP6_H_ */
diff --git a/libc/include/resolv.h b/libc/include/resolv.h
index 4247d68..bb21c23 100644
--- a/libc/include/resolv.h
+++ b/libc/include/resolv.h
@@ -34,6 +34,7 @@
 #include <sys/socket.h>
 #include <stdio.h>
 #include <arpa/nameser.h>
+#include <netinet/in.h>
 
 __BEGIN_DECLS
 
@@ -49,6 +50,21 @@
 extern int   b64_ntop(u_char const *, size_t, char *, size_t);
 extern int   b64_pton(char const *, u_char *, size_t);
 
+/* Set name of default interface */
+extern void _resolv_set_default_iface(const char* ifname);
+
+/* set name servers for an interface */
+extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers);
+
+/* tell resolver of the address of an interface */
+extern void _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr);
+
+/* flush the cache associated with the default interface */
+extern void _resolv_flush_cache_for_default_iface();
+
+/* flush the cache associated with a certain interface */
+extern void _resolv_flush_cache_for_iface(const char* ifname);
+
 __END_DECLS
 
 #endif /* _RESOLV_H_ */
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index c38ed5a..4006882 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -170,6 +170,7 @@
 #define	__SOFF	0x1000		/* set iff _offset is in fact correct */
 #define	__SMOD	0x2000		/* true => fgetln modified _p text */
 #define	__SALC	0x4000		/* allocate string space dynamically */
+#define	__SIGN	0x8000		/* ignore this file in _fwalk */
 
 /*
  * The following three definitions are for ANSI C, which took them
@@ -406,38 +407,43 @@
 #define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
 #define	__sfileno(p)	((p)->_file)
 
-#define	feof(p)		__sfeof(p)
-#define	ferror(p)	__sferror(p)
+extern	int __isthreaded;
 
-#ifndef _POSIX_THREADS
-#define	clearerr(p)	__sclearerr(p)
-#endif
+#define	feof(p)		(!__isthreaded ? __sfeof(p) : (feof)(p))
+#define	ferror(p)	(!__isthreaded ? __sferror(p) : (ferror)(p))
+#define	clearerr(p)	(!__isthreaded ? __sclearerr(p) : (clearerr)(p))
 
 #if __POSIX_VISIBLE
-#define	fileno(p)	__sfileno(p)
+#define	fileno(p)	(!__isthreaded ? __sfileno(p) : (fileno)(p))
 #endif
 
+#define	getc(fp)	(!__isthreaded ? __sgetc(fp) : (getc)(fp))
+
+#if __BSD_VISIBLE
+/*
+ * The macro implementations of putc and putc_unlocked are not
+ * fully POSIX compliant; they do not set errno on failure
+ */
+#define putc(x, fp)	(!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
+#endif /* __BSD_VISIBLE */
+
 #ifndef lint
-#ifndef _POSIX_THREADS
-#define	getc(fp)	__sgetc(fp)
-#endif /* _POSIX_THREADS */
+#if __POSIX_VISIBLE >= 199506
 #define	getc_unlocked(fp)	__sgetc(fp)
 /*
  * The macro implementations of putc and putc_unlocked are not
  * fully POSIX compliant; they do not set errno on failure
  */
 #if __BSD_VISIBLE
-#ifndef _POSIX_THREADS
-#define putc(x, fp)	__sputc(x, fp)
-#endif /* _POSIX_THREADS */
 #define putc_unlocked(x, fp)	__sputc(x, fp)
 #endif /* __BSD_VISIBLE */
+#endif /* __POSIX_VISIBLE >= 199506 */
 #endif /* lint */
 
 #define	getchar()	getc(stdin)
 #define	putchar(x)	putc(x, stdout)
-#define getchar_unlocked()	getc_unlocked(stdin)
-#define putchar_unlocked(c)	putc_unlocked(c, stdout)
+#define	getchar_unlocked()	getc_unlocked(stdin)
+#define	putchar_unlocked(c)	putc_unlocked(c, stdout)
 
 #ifdef _GNU_SOURCE
 /*
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 5dc8a87..e5caadd 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -67,6 +67,8 @@
 extern unsigned long long strtoull(const char *, char **, int);
 extern double strtod(const char *nptr, char **endptr);
 
+extern int posix_memalign(void **memptr, size_t alignment, size_t size);
+
 static __inline__ float strtof(const char *nptr, char **endptr)
 {
     return (float)strtod(nptr, endptr);
diff --git a/libc/include/sys/_errdefs.h b/libc/include/sys/_errdefs.h
index e27ab7a..51d921b 100644
--- a/libc/include/sys/_errdefs.h
+++ b/libc/include/sys/_errdefs.h
@@ -36,6 +36,7 @@
 #ifndef __BIONIC_ERRDEF
 #error "__BIONIC_ERRDEF must be defined before including this file"
 #endif
+__BIONIC_ERRDEF( 0              ,   0, "Success" )
 __BIONIC_ERRDEF( EPERM          ,   1, "Operation not permitted" )
 __BIONIC_ERRDEF( ENOENT         ,   2, "No such file or directory" )
 __BIONIC_ERRDEF( ESRCH          ,   3, "No such process" )
diff --git a/libc/include/sys/cdefs_elf.h b/libc/include/sys/cdefs_elf.h
index 1e57470..0887fa5 100644
--- a/libc/include/sys/cdefs_elf.h
+++ b/libc/include/sys/cdefs_elf.h
@@ -96,9 +96,24 @@
 #endif
 
 /* GCC visibility helper macro */
+/* This must be used to tag non-static functions that are private, i.e.
+ * never exposed by the shared library. */
 #define __LIBC_HIDDEN__							\
 	__attribute__ ((visibility ("hidden")))
 
+/* This must be used to tag non-static functions that are public, i.e.
+ * exposed by the shared library, and part of the stable NDK ABI */
+#define __LIBC_ABI_PUBLIC__ \
+        __attribute__ ((visibility ("default")))
+
+/* This must be used to tag non-static functions that must be exported
+ * by the shared library, but whose implementation is private to the
+ * platform. For now this is equivalent to __LIBC_ABI_PUBLIC__, but we
+ * may want to change this later.
+ */
+#define __LIBC_ABI_PRIVATE__ \
+        __attribute__ ((visibility ("default")))
+
 #define	__IDSTRING(_n,_s)		__SECTIONSTRING(.ident,_s)
 
 #define	__RCSID(_s)			__IDSTRING(rcsid,_s)
diff --git a/libc/include/sys/exec_elf.h b/libc/include/sys/exec_elf.h
index f72f81e..03bbdac 100644
--- a/libc/include/sys/exec_elf.h
+++ b/libc/include/sys/exec_elf.h
@@ -35,68 +35,7 @@
 
 #include <machine/_types.h>
 #include <machine/exec.h>
-
-typedef __uint8_t	Elf_Byte;
-
-typedef __uint32_t	Elf32_Addr;	/* Unsigned program address */
-typedef __uint32_t	Elf32_Off;	/* Unsigned file offset */
-typedef __int32_t	Elf32_Sword;	/* Signed large integer */
-typedef __uint32_t	Elf32_Word;	/* Unsigned large integer */
-typedef __uint16_t	Elf32_Half;	/* Unsigned medium integer */
-
-typedef __uint64_t	Elf64_Addr;
-typedef __uint64_t	Elf64_Off;
-typedef __int32_t	Elf64_Shalf;
-
-#ifdef __alpha__
-typedef __int64_t	Elf64_Sword;
-typedef __uint64_t	Elf64_Word;
-#else
-typedef __int32_t	Elf64_Sword;
-typedef __uint32_t	Elf64_Word;
-#endif
-
-typedef __int64_t	Elf64_Sxword;
-typedef __uint64_t	Elf64_Xword;
-
-typedef __uint32_t	Elf64_Half;
-typedef __uint16_t	Elf64_Quarter;
-
-/*
- * e_ident[] identification indexes 
- * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html
- */
-#define EI_MAG0		0		/* file ID */
-#define EI_MAG1		1		/* file ID */
-#define EI_MAG2		2		/* file ID */
-#define EI_MAG3		3		/* file ID */
-#define EI_CLASS	4		/* file class */
-#define EI_DATA		5		/* data encoding */
-#define EI_VERSION	6		/* ELF header version */
-#define EI_OSABI	7		/* OS/ABI ID */
-#define EI_ABIVERSION	8		/* ABI version */ 
-#define EI_PAD		9		/* start of pad bytes */
-#define EI_NIDENT	16		/* Size of e_ident[] */
-
-/* e_ident[] magic number */
-#define	ELFMAG0		0x7f		/* e_ident[EI_MAG0] */
-#define	ELFMAG1		'E'		/* e_ident[EI_MAG1] */
-#define	ELFMAG2		'L'		/* e_ident[EI_MAG2] */
-#define	ELFMAG3		'F'		/* e_ident[EI_MAG3] */
-#define	ELFMAG		"\177ELF"	/* magic */
-#define	SELFMAG		4		/* size of magic */
-
-/* e_ident[] file class */
-#define	ELFCLASSNONE	0		/* invalid */
-#define	ELFCLASS32	1		/* 32-bit objs */
-#define	ELFCLASS64	2		/* 64-bit objs */
-#define	ELFCLASSNUM	3		/* number of classes */
-
-/* e_ident[] data encoding */
-#define ELFDATANONE	0		/* invalid */
-#define ELFDATA2LSB	1		/* Little-Endian */
-#define ELFDATA2MSB	2		/* Big-Endian */
-#define ELFDATANUM	3		/* number of data encode defines */
+#include <linux/elf.h>
 
 /* e_ident[] Operating System/ABI */
 #define ELFOSABI_SYSV		0	/* UNIX System V ABI */
@@ -121,52 +60,6 @@
                       (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
                       (ehdr).e_ident[EI_MAG3] == ELFMAG3)
 
-/* ELF Header */
-typedef struct elfhdr {
-	unsigned char	e_ident[EI_NIDENT]; /* ELF Identification */
-	Elf32_Half	e_type;		/* object file type */
-	Elf32_Half	e_machine;	/* machine */
-	Elf32_Word	e_version;	/* object file version */
-	Elf32_Addr	e_entry;	/* virtual entry point */
-	Elf32_Off	e_phoff;	/* program header table offset */
-	Elf32_Off	e_shoff;	/* section header table offset */
-	Elf32_Word	e_flags;	/* processor-specific flags */
-	Elf32_Half	e_ehsize;	/* ELF header size */
-	Elf32_Half	e_phentsize;	/* program header entry size */
-	Elf32_Half	e_phnum;	/* number of program header entries */
-	Elf32_Half	e_shentsize;	/* section header entry size */
-	Elf32_Half	e_shnum;	/* number of section header entries */
-	Elf32_Half	e_shstrndx;	/* section header table's "section 
-					   header string table" entry offset */
-} Elf32_Ehdr;
-
-typedef struct {
-	unsigned char	e_ident[EI_NIDENT];	/* Id bytes */
-	Elf64_Quarter	e_type;			/* file type */
-	Elf64_Quarter	e_machine;		/* machine type */
-	Elf64_Half	e_version;		/* version number */
-	Elf64_Addr	e_entry;		/* entry point */
-	Elf64_Off	e_phoff;		/* Program hdr offset */
-	Elf64_Off	e_shoff;		/* Section hdr offset */
-	Elf64_Half	e_flags;		/* Processor flags */
-	Elf64_Quarter	e_ehsize;		/* sizeof ehdr */
-	Elf64_Quarter	e_phentsize;		/* Program header entry size */
-	Elf64_Quarter	e_phnum;		/* Number of program headers */
-	Elf64_Quarter	e_shentsize;		/* Section header entry size */
-	Elf64_Quarter	e_shnum;		/* Number of section headers */
-	Elf64_Quarter	e_shstrndx;		/* String table index */
-} Elf64_Ehdr;
-
-/* e_type */
-#define ET_NONE		0		/* No file type */
-#define ET_REL		1		/* relocatable file */
-#define ET_EXEC		2		/* executable file */
-#define ET_DYN		3		/* shared object file */
-#define ET_CORE		4		/* core file */
-#define ET_NUM		5		/* number of types */
-#define ET_LOPROC	0xff00		/* reserved range for processor */
-#define ET_HIPROC	0xffff		/*  specific e_type */
-
 /* e_machine */
 #define EM_NONE		0		/* No Machine */
 #define EM_M32		1		/* AT&T WE 32100 */
@@ -195,66 +88,6 @@
 #define EM_VAX		75		/* DEC VAX */
 #define EM_NUM		15		/* number of machine types */
 
-/* Version */
-#define EV_NONE		0		/* Invalid */
-#define EV_CURRENT	1		/* Current */
-#define EV_NUM		2		/* number of versions */
-
-/* Section Header */
-typedef struct {
-	Elf32_Word	sh_name;	/* name - index into section header
-					   string table section */
-	Elf32_Word	sh_type;	/* type */
-	Elf32_Word	sh_flags;	/* flags */
-	Elf32_Addr	sh_addr;	/* address */
-	Elf32_Off	sh_offset;	/* file offset */
-	Elf32_Word	sh_size;	/* section size */
-	Elf32_Word	sh_link;	/* section header table index link */
-	Elf32_Word	sh_info;	/* extra information */
-	Elf32_Word	sh_addralign;	/* address alignment */
-	Elf32_Word	sh_entsize;	/* section entry size */
-} Elf32_Shdr;
-
-typedef struct {
-	Elf64_Half	sh_name;	/* section name */
-	Elf64_Half	sh_type;	/* section type */
-	Elf64_Xword	sh_flags;	/* section flags */
-	Elf64_Addr	sh_addr;	/* virtual address */
-	Elf64_Off	sh_offset;	/* file offset */
-	Elf64_Xword	sh_size;	/* section size */
-	Elf64_Half	sh_link;	/* link to another */
-	Elf64_Half	sh_info;	/* misc info */
-	Elf64_Xword	sh_addralign;	/* memory alignment */
-	Elf64_Xword	sh_entsize;	/* table entry size */
-} Elf64_Shdr;
-
-/* Special Section Indexes */
-#define SHN_UNDEF	0		/* undefined */
-#define SHN_LORESERVE	0xff00		/* lower bounds of reserved indexes */
-#define SHN_LOPROC	0xff00		/* reserved range for processor */
-#define SHN_HIPROC	0xff1f		/*   specific section indexes */
-#define SHN_ABS		0xfff1		/* absolute value */
-#define SHN_COMMON	0xfff2		/* common symbol */
-#define SHN_HIRESERVE	0xffff		/* upper bounds of reserved indexes */
-
-/* sh_type */
-#define SHT_NULL	0		/* inactive */
-#define SHT_PROGBITS	1		/* program defined information */
-#define SHT_SYMTAB	2		/* symbol table section */
-#define SHT_STRTAB	3		/* string table section */
-#define SHT_RELA	4		/* relocation section with addends*/
-#define SHT_HASH	5		/* symbol hash table section */
-#define SHT_DYNAMIC	6		/* dynamic section */
-#define SHT_NOTE	7		/* note section */
-#define SHT_NOBITS	8		/* no space section */
-#define SHT_REL		9		/* relation section without addends */
-#define SHT_SHLIB	10		/* reserved - purpose unknown */
-#define SHT_DYNSYM	11		/* dynamic symbol table section */
-#define SHT_NUM		12		/* number of section types */
-#define SHT_LOPROC	0x70000000	/* reserved range for processor */
-#define SHT_HIPROC	0x7fffffff	/*  specific section header types */
-#define SHT_LOUSER	0x80000000	/* reserved range for application */
-#define SHT_HIUSER	0xffffffff	/*  specific indexes */
 
 /* Section names */
 #define ELF_BSS         ".bss"		/* uninitialized data */
@@ -279,45 +112,6 @@
 #define ELF_SYMTAB      ".symtab"	/* symbol table */
 #define ELF_TEXT        ".text"		/* code */
 
-
-/* Section Attribute Flags - sh_flags */
-#define SHF_WRITE	0x1		/* Writable */
-#define SHF_ALLOC	0x2		/* occupies memory */
-#define SHF_EXECINSTR	0x4		/* executable */
-#define SHF_MASKPROC	0xf0000000	/* reserved bits for processor */
-					/*  specific section attributes */
-
-/* Symbol Table Entry */
-typedef struct elf32_sym {
-	Elf32_Word	st_name;	/* name - index into string table */
-	Elf32_Addr	st_value;	/* symbol value */
-	Elf32_Word	st_size;	/* symbol size */
-	unsigned char	st_info;	/* type and binding */
-	unsigned char	st_other;	/* 0 - no defined meaning */
-	Elf32_Half	st_shndx;	/* section header index */
-} Elf32_Sym;
-
-typedef struct {
-	Elf64_Half	st_name;	/* Symbol name index in str table */
-	Elf_Byte	st_info;	/* type / binding attrs */
-	Elf_Byte	st_other;	/* unused */
-	Elf64_Quarter	st_shndx;	/* section index of symbol */
-	Elf64_Xword	st_value;	/* value of symbol */
-	Elf64_Xword	st_size;	/* size of symbol */
-} Elf64_Sym;
-
-/* Symbol table index */
-#define STN_UNDEF	0		/* undefined */
-
-/* Extract symbol info - st_info */
-#define ELF32_ST_BIND(x)	((x) >> 4)
-#define ELF32_ST_TYPE(x)	(((unsigned int) x) & 0xf)
-#define ELF32_ST_INFO(b,t)	(((b) << 4) + ((t) & 0xf))
-
-#define ELF64_ST_BIND(x)	((x) >> 4)
-#define ELF64_ST_TYPE(x)	(((unsigned int) x) & 0xf)
-#define ELF64_ST_INFO(b,t)	(((b) << 4) + ((t) & 0xf))
-
 /* Symbol Binding - ELF32_ST_BIND - st_info */
 #define STB_LOCAL	0		/* Local symbol */
 #define STB_GLOBAL	1		/* Global symbol */
@@ -336,290 +130,4 @@
 #define STT_LOPROC	13		/* reserved range for processor */
 #define STT_HIPROC	15		/*  specific symbol types */
 
-/* Relocation entry with implicit addend */
-typedef struct {
-	Elf32_Addr	r_offset;	/* offset of relocation */
-	Elf32_Word	r_info;		/* symbol table index and type */
-} Elf32_Rel;
-
-/* Relocation entry with explicit addend */
-typedef struct {
-	Elf32_Addr	r_offset;	/* offset of relocation */
-	Elf32_Word	r_info;		/* symbol table index and type */
-	Elf32_Sword	r_addend;
-} Elf32_Rela;
-
-/* Extract relocation info - r_info */
-#define ELF32_R_SYM(i)		((i) >> 8)
-#define ELF32_R_TYPE(i)		((unsigned char) (i))
-#define ELF32_R_INFO(s,t) 	(((s) << 8) + (unsigned char)(t))
-
-typedef struct {
-	Elf64_Xword	r_offset;	/* where to do it */
-	Elf64_Xword	r_info;		/* index & type of relocation */
-} Elf64_Rel;
-
-typedef struct {
-	Elf64_Xword	r_offset;	/* where to do it */
-	Elf64_Xword	r_info;		/* index & type of relocation */
-	Elf64_Sxword	r_addend;	/* adjustment value */
-} Elf64_Rela;
-
-#define	ELF64_R_SYM(info)	((info) >> 32)
-#define	ELF64_R_TYPE(info)	((info) & 0xFFFFFFFF)
-#define ELF64_R_INFO(s,t) 	(((s) << 32) + (__uint32_t)(t))
-
-/* Program Header */
-typedef struct {
-	Elf32_Word	p_type;		/* segment type */
-	Elf32_Off	p_offset;	/* segment offset */
-	Elf32_Addr	p_vaddr;	/* virtual address of segment */
-	Elf32_Addr	p_paddr;	/* physical address - ignored? */
-	Elf32_Word	p_filesz;	/* number of bytes in file for seg. */
-	Elf32_Word	p_memsz;	/* number of bytes in mem. for seg. */
-	Elf32_Word	p_flags;	/* flags */
-	Elf32_Word	p_align;	/* memory alignment */
-} Elf32_Phdr;
-
-typedef struct {
-	Elf64_Half	p_type;		/* entry type */
-	Elf64_Half	p_flags;	/* flags */
-	Elf64_Off	p_offset;	/* offset */
-	Elf64_Addr	p_vaddr;	/* virtual address */
-	Elf64_Addr	p_paddr;	/* physical address */
-	Elf64_Xword	p_filesz;	/* file size */
-	Elf64_Xword	p_memsz;	/* memory size */
-	Elf64_Xword	p_align;	/* memory & file alignment */
-} Elf64_Phdr;
-
-/* Segment types - p_type */
-#define PT_NULL		0		/* unused */
-#define PT_LOAD		1		/* loadable segment */
-#define PT_DYNAMIC	2		/* dynamic linking section */
-#define PT_INTERP	3		/* the RTLD */
-#define PT_NOTE		4		/* auxiliary information */
-#define PT_SHLIB	5		/* reserved - purpose undefined */
-#define PT_PHDR		6		/* program header */
-#define PT_NUM		7		/* Number of segment types */
-#define PT_LOOS		0x60000000	/* reserved range for OS */
-#define PT_HIOS		0x6fffffff	/*  specific segment types */
-#define PT_LOPROC	0x70000000	/* reserved range for processor */
-#define PT_HIPROC	0x7fffffff	/*  specific segment types */
-
-/* Segment flags - p_flags */
-#define PF_X		0x1		/* Executable */
-#define PF_W		0x2		/* Writable */
-#define PF_R		0x4		/* Readable */
-#define PF_MASKPROC	0xf0000000	/* reserved bits for processor */
-					/*  specific segment flags */
-
-/* Dynamic structure */
-typedef struct {
-	Elf32_Sword	d_tag;		/* controls meaning of d_val */
-	union {
-		Elf32_Word	d_val;	/* Multiple meanings - see d_tag */
-		Elf32_Addr	d_ptr;	/* program virtual address */
-	} d_un;
-} Elf32_Dyn;
-
-typedef struct {
-	Elf64_Xword	d_tag;		/* controls meaning of d_val */
-	union {
-		Elf64_Addr	d_ptr;
-		Elf64_Xword	d_val;
-	} d_un;
-} Elf64_Dyn;
-
-/* Dynamic Array Tags - d_tag */
-#define DT_NULL		0		/* marks end of _DYNAMIC array */
-#define DT_NEEDED	1		/* string table offset of needed lib */
-#define DT_PLTRELSZ	2		/* size of relocation entries in PLT */
-#define DT_PLTGOT	3		/* address PLT/GOT */
-#define DT_HASH		4		/* address of symbol hash table */
-#define DT_STRTAB	5		/* address of string table */
-#define DT_SYMTAB	6		/* address of symbol table */
-#define DT_RELA		7		/* address of relocation table */
-#define DT_RELASZ	8		/* size of relocation table */
-#define DT_RELAENT	9		/* size of relocation entry */
-#define DT_STRSZ	10		/* size of string table */
-#define DT_SYMENT	11		/* size of symbol table entry */
-#define DT_INIT		12		/* address of initialization func. */
-#define DT_FINI		13		/* address of termination function */
-#define DT_SONAME	14		/* string table offset of shared obj */
-#define DT_RPATH	15		/* string table offset of library
-					   search path */
-#define DT_SYMBOLIC	16		/* start sym search in shared obj. */
-#define DT_REL		17		/* address of rel. tbl. w addends */
-#define DT_RELSZ	18		/* size of DT_REL relocation table */
-#define DT_RELENT	19		/* size of DT_REL relocation entry */
-#define DT_PLTREL	20		/* PLT referenced relocation entry */
-#define DT_DEBUG	21		/* bugger */
-#define DT_TEXTREL	22		/* Allow rel. mod. to unwritable seg */
-#define DT_JMPREL	23		/* add. of PLT's relocation entries */
-#define DT_BIND_NOW	24		/* Bind now regardless of env setting */
-#define DT_NUM		25		/* Number used. */
-#define DT_LOPROC	0x70000000	/* reserved range for processor */
-#define DT_HIPROC	0x7fffffff	/*  specific dynamic array tags */
-	
-/* Standard ELF hashing function */
-unsigned int elf_hash(const unsigned char *name);
-
-/*
- * Note Definitions
- */
-typedef struct {
-	Elf32_Word namesz;
-	Elf32_Word descsz;
-	Elf32_Word type;
-} Elf32_Note;
-
-typedef struct {
-	Elf64_Half namesz;
-	Elf64_Half descsz;
-	Elf64_Half type;
-} Elf64_Note;
-
-/*
- * XXX - these _KERNEL items aren't part of the ABI!
- */
-#if defined(_KERNEL) || defined(_DYN_LOADER)
-
-#define ELF32_NO_ADDR	((u_long) ~0)	/* Indicates addr. not yet filled in */
-#define ELF_AUX_ENTRIES	8		/* Size of aux array passed to loader */
-
-typedef struct {
-	Elf32_Sword	au_id;				/* 32-bit id */
-	Elf32_Word	au_v;				/* 32-bit value */
-} Aux32Info;
-
-#define ELF64_NO_ADDR	((__uint64_t) ~0)/* Indicates addr. not yet filled in */
-#define ELF64_AUX_ENTRIES	8	/* Size of aux array passed to loader */
-
-typedef struct {
-	Elf64_Shalf	au_id;				/* 32-bit id */
-	Elf64_Xword	au_v;				/* 64-bit id */
-} Aux64Info;
-
-enum AuxID {
-	AUX_null = 0,
-	AUX_ignore = 1,
-	AUX_execfd = 2,
-	AUX_phdr = 3,			/* &phdr[0] */
-	AUX_phent = 4,			/* sizeof(phdr[0]) */
-	AUX_phnum = 5,			/* # phdr entries */
-	AUX_pagesz = 6,			/* PAGESIZE */
-	AUX_base = 7,			/* ld.so base addr */
-	AUX_flags = 8,			/* processor flags */
-	AUX_entry = 9,			/* a.out entry */
-	AUX_sun_uid = 2000,		/* euid */
-	AUX_sun_ruid = 2001,		/* ruid */
-	AUX_sun_gid = 2002,		/* egid */
-	AUX_sun_rgid = 2003		/* rgid */
-};
-
-struct elf_args {
-        u_long  arg_entry;		/* program entry point */
-        u_long  arg_interp;		/* Interpreter load address */
-        u_long  arg_phaddr;		/* program header address */
-        u_long  arg_phentsize;		/* Size of program header */
-        u_long  arg_phnum;		/* Number of program headers */
-        u_long  arg_os;			/* OS tag */
-};
-
-#endif
-
-#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
-#define ELFSIZE ARCH_ELFSIZE
-#endif
-
-#if defined(ELFSIZE)
-#define CONCAT(x,y)	__CONCAT(x,y)
-#define ELFNAME(x)	CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
-#define ELFNAME2(x,y)	CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
-#define ELFNAMEEND(x)	CONCAT(x,CONCAT(_elf,ELFSIZE))
-#define ELFDEFNNAME(x)	CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
-#endif
-
-#if defined(ELFSIZE) && (ELFSIZE == 32)
-#define Elf_Ehdr	Elf32_Ehdr
-#define Elf_Phdr	Elf32_Phdr
-#define Elf_Shdr	Elf32_Shdr
-#define Elf_Sym		Elf32_Sym
-#define Elf_Rel		Elf32_Rel
-#define Elf_RelA	Elf32_Rela
-#define Elf_Dyn		Elf32_Dyn
-#define Elf_Half	Elf32_Half
-#define Elf_Word	Elf32_Word
-#define Elf_Sword	Elf32_Sword
-#define Elf_Addr	Elf32_Addr
-#define Elf_Off		Elf32_Off
-#define Elf_Nhdr	Elf32_Nhdr
-#define Elf_Note	Elf32_Note
-
-#define ELF_R_SYM	ELF32_R_SYM
-#define ELF_R_TYPE	ELF32_R_TYPE
-#define ELF_R_INFO	ELF32_R_INFO
-#define ELFCLASS	ELFCLASS32
-
-#define ELF_ST_BIND	ELF32_ST_BIND
-#define ELF_ST_TYPE	ELF32_ST_TYPE
-#define ELF_ST_INFO	ELF32_ST_INFO
-
-#define AuxInfo		Aux32Info
-#elif defined(ELFSIZE) && (ELFSIZE == 64)
-#define Elf_Ehdr	Elf64_Ehdr
-#define Elf_Phdr	Elf64_Phdr
-#define Elf_Shdr	Elf64_Shdr
-#define Elf_Sym		Elf64_Sym
-#define Elf_Rel		Elf64_Rel
-#define Elf_RelA	Elf64_Rela
-#define Elf_Dyn		Elf64_Dyn
-#define Elf_Half	Elf64_Half
-#define Elf_Word	Elf64_Word
-#define Elf_Sword	Elf64_Sword
-#define Elf_Addr	Elf64_Addr
-#define Elf_Off		Elf64_Off
-#define Elf_Nhdr	Elf64_Nhdr
-#define Elf_Note	Elf64_Note
-
-#define ELF_R_SYM	ELF64_R_SYM
-#define ELF_R_TYPE	ELF64_R_TYPE
-#define ELF_R_INFO	ELF64_R_INFO
-#define ELFCLASS	ELFCLASS64
-
-#define ELF_ST_BIND	ELF64_ST_BIND
-#define ELF_ST_TYPE	ELF64_ST_TYPE
-#define ELF_ST_INFO	ELF64_ST_INFO
-
-#define AuxInfo		Aux64Info
-#endif
-
-#ifndef _KERNEL
-extern Elf_Dyn		_DYNAMIC[];
-#endif
-
-#ifdef	_KERNEL
-#ifdef _KERN_DO_ELF64
-int exec_elf64_makecmds(struct proc *, struct exec_package *);
-void *elf64_copyargs(struct exec_package *, struct ps_strings *,
-        void *, void *);
-int exec_elf64_fixup(struct proc *, struct exec_package *);
-char *elf64_check_brand(Elf64_Ehdr *);
-int elf64_os_pt_note(struct proc *, struct exec_package *, Elf64_Ehdr *,
-	char *, size_t, size_t);
-#endif
-#ifdef _KERN_DO_ELF
-int exec_elf32_makecmds(struct proc *, struct exec_package *);
-void *elf32_copyargs(struct exec_package *, struct ps_strings *,
-        void *, void *);
-int exec_elf32_fixup(struct proc *, struct exec_package *);
-char *elf32_check_brand(Elf32_Ehdr *);
-int elf32_os_pt_note(struct proc *, struct exec_package *, Elf32_Ehdr *,
-	char *, size_t, size_t);
-#endif
-
-#endif /* _KERNEL */
-
-#define ELF_TARG_VER	1	/* The ver for which this code is intended */
-
 #endif /* _SYS_EXEC_ELF_H_ */
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index cb4d5e5..0cb3100 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -20,6 +20,7 @@
 #define __NR_getresuid32                  (__NR_SYSCALL_BASE + 209)
 #define __NR_getresgid32                  (__NR_SYSCALL_BASE + 211)
 #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)
@@ -78,6 +79,10 @@
 #define __NR_sync                         (__NR_SYSCALL_BASE + 36)
 #define __NR_fcntl64                      (__NR_SYSCALL_BASE + 221)
 #define __NR_sendfile                     (__NR_SYSCALL_BASE + 187)
+#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)
@@ -99,6 +104,14 @@
 #define __NR_symlink                      (__NR_SYSCALL_BASE + 83)
 #define __NR_fchdir                       (__NR_SYSCALL_BASE + 133)
 #define __NR_truncate                     (__NR_SYSCALL_BASE + 92)
+#define __NR_setxattr                     (__NR_SYSCALL_BASE + 226)
+#define __NR_lsetxattr                    (__NR_SYSCALL_BASE + 227)
+#define __NR_getxattr                     (__NR_SYSCALL_BASE + 229)
+#define __NR_lgetxattr                    (__NR_SYSCALL_BASE + 230)
+#define __NR_listxattr                    (__NR_SYSCALL_BASE + 232)
+#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)
@@ -132,6 +145,7 @@
 #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_futex                        (__NR_SYSCALL_BASE + 240)
 #define __NR_poll                         (__NR_SYSCALL_BASE + 168)
 
@@ -162,6 +176,7 @@
 #define __NR_timer_getoverrun             (__NR_SYSCALL_BASE + 260)
 #define __NR_timer_delete                 (__NR_SYSCALL_BASE + 261)
 #define __NR_utimes                       (__NR_SYSCALL_BASE + 269)
+#define __NR_utimensat                    (__NR_SYSCALL_BASE + 348)
 #define __NR_socket                       (__NR_SYSCALL_BASE + 281)
 #define __NR_socketpair                   (__NR_SYSCALL_BASE + 288)
 #define __NR_bind                         (__NR_SYSCALL_BASE + 282)
@@ -221,6 +236,7 @@
 #define __NR_timer_getoverrun             (__NR_SYSCALL_BASE + 262)
 #define __NR_timer_delete                 (__NR_SYSCALL_BASE + 263)
 #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_ioprio_set                   (__NR_SYSCALL_BASE + 289)
@@ -234,65 +250,6 @@
 #define __NR_eventfd2                     (__NR_SYSCALL_BASE + 328)
 #endif
 
-#if defined(__SH3__) || defined(__SH4__) 
-#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_set_thread_area              (__NR_SYSCALL_BASE + 243)
-#define __NR_vfork                        (__NR_SYSCALL_BASE + 190)
-#define __NR_openat                       (__NR_SYSCALL_BASE + 295)
-#define __NR_madvise                      (__NR_SYSCALL_BASE + 219)
-#define __NR_mincore                      (__NR_SYSCALL_BASE + 218)
-#define __NR_pipe2                        (__NR_SYSCALL_BASE + 331)
-#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_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_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_utimes                       (__NR_SYSCALL_BASE + 271)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
-#define __NR___socketcall                 (__NR_SYSCALL_BASE + 102)
-#define __NR_getcpu                       (__NR_SYSCALL_BASE + 318)
-#define __NR_ioprio_set                   (__NR_SYSCALL_BASE + 288)
-#define __NR_ioprio_get                   (__NR_SYSCALL_BASE + 289)
-#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 + 290)
-#define __NR_inotify_add_watch            (__NR_SYSCALL_BASE + 291)
-#define __NR_inotify_rm_watch             (__NR_SYSCALL_BASE + 292)
-#define __NR_eventfd2                     (__NR_SYSCALL_BASE + 328)
-#endif
-
 #endif
 
 #endif /* _BIONIC_LINUX_SYSCALLS_H_ */
diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h
index f706d00..12a7ac4 100644
--- a/libc/include/sys/linux-unistd.h
+++ b/libc/include/sys/linux-unistd.h
@@ -17,9 +17,10 @@
 gid_t            getgid (void);
 uid_t            geteuid (void);
 gid_t            getegid (void);
-uid_t            getresuid (void);
-gid_t            getresgid (void);
+uid_t            getresuid (uid_t *ruid, uid_t *euid, uid_t *suid);
+gid_t            getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid);
 pid_t            gettid (void);
+ssize_t          readahead (int, off64_t, size_t);
 int              getgroups (int, gid_t *);
 pid_t            getpgid (pid_t);
 pid_t            getppid (void);
@@ -97,6 +98,10 @@
 int              fchownat (int dirfd, const char *path, uid_t owner, gid_t group, int flags);
 int              fchmodat (int dirfd, const char *path, mode_t mode, int flags);
 int              renameat (int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+int              fsetxattr (int, const char *, const void *, size_t, int);
+ssize_t          fgetxattr (int, const char *, void *, size_t);
+ssize_t          flistxattr (int, char *, size_t);
+int              fremovexattr (int, const char *);
 int              link (const char*, const char*);
 int              unlink (const char*);
 int              unlinkat (int, const char *, int);
@@ -120,6 +125,14 @@
 int              symlink (const char *, const char *);
 int              fchdir (int);
 int              truncate (const char*, off_t);
+int              setxattr (const char *, const char *, const void *, size_t, int);
+int              lsetxattr (const char *, const char *, const void *, size_t, int);
+ssize_t          getxattr (const char *, const char *, void *, size_t);
+ssize_t          lgetxattr (const char *, const char *, void *, size_t);
+ssize_t          listxattr (const char *, char *, size_t);
+ssize_t          llistxattr (const char *, char *, size_t);
+int              removexattr (const char *, const char *);
+int              lremovexattr (const char *, const char *);
 int              __statfs64 (const char *, size_t, struct statfs *);
 int              pause (void);
 int              gettimeofday (struct timeval*, struct timezone*);
@@ -129,7 +142,7 @@
 int              clock_gettime (clockid_t clk_id, struct timespec *tp);
 int              clock_settime (clockid_t clk_id, const struct timespec *tp);
 int              clock_getres (clockid_t clk_id, struct timespec *res);
-int              clock_nanosleep (const struct timespec *req, struct timespec *rem);
+int              clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem);
 int              getitimer (int, const struct itimerval *);
 int              setitimer (int, const struct itimerval *, struct itimerval *);
 int              __timer_create (clockid_t clockid, struct sigevent *evp, timer_t *timerid);
@@ -138,6 +151,7 @@
 int              __timer_getoverrun (timer_t);
 int              __timer_delete (timer_t);
 int              utimes (const char*, const struct timeval tvp[2]);
+int              utimensat (int, const char *, const struct timespec times[2], int);
 int              sigaction (int, const struct sigaction *, struct sigaction *);
 int              sigprocmask (int, const sigset_t *, sigset_t *);
 int              __sigsuspend (int unused1, int unused2, unsigned mask);
@@ -175,7 +189,6 @@
 int              getsockopt (int, int, int, void *, socklen_t *);
 int              sendmsg (int, const struct msghdr *, unsigned int);
 int              recvmsg (int, struct msghdr *, unsigned int);
-int              __socketcall (int, unsigned long*);
 int              sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
 int              sched_getscheduler (pid_t pid);
 int              sched_yield (void);
@@ -198,6 +211,7 @@
 int              delete_module (const char*, unsigned int);
 int              klogctl (int, char *, int);
 int              sysinfo (struct sysinfo *);
+int              personality (unsigned long);
 int              futex (void *, int, int, void *, void *, int);
 int              epoll_create (int size);
 int              epoll_ctl (int epfd, int op, int fd, struct epoll_event *event);
diff --git a/libc/include/sys/personality.h b/libc/include/sys/personality.h
new file mode 100644
index 0000000..2199fa7
--- /dev/null
+++ b/libc/include/sys/personality.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT OWNER 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.
+ */
+
+#ifndef _SYS_PERSONALITY_H_
+#define _SYS_PERSONALITY_H_
+
+__BEGIN_DECLS
+
+/* constants taken from linux-3.0.4/include/linux/personality.h */
+
+enum {
+        UNAME26 =               0x0020000,
+        ADDR_NO_RANDOMIZE =     0x0040000,
+        FDPIC_FUNCPTRS =        0x0080000,
+        MMAP_PAGE_ZERO =        0x0100000,
+        ADDR_COMPAT_LAYOUT =    0x0200000,
+        READ_IMPLIES_EXEC =     0x0400000,
+        ADDR_LIMIT_32BIT =      0x0800000,
+        SHORT_INODE =           0x1000000,
+        WHOLE_SECONDS =         0x2000000,
+        STICKY_TIMEOUTS =       0x4000000,
+        ADDR_LIMIT_3GB =        0x8000000,
+};
+
+#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC  | \
+                            ADDR_NO_RANDOMIZE  | \
+                            ADDR_COMPAT_LAYOUT | \
+                            MMAP_PAGE_ZERO)
+
+enum {
+        PER_LINUX =             0x0000,
+        PER_LINUX_32BIT =       0x0000 | ADDR_LIMIT_32BIT,
+        PER_LINUX_FDPIC =       0x0000 | FDPIC_FUNCPTRS,
+        PER_SVR4 =              0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
+        PER_SVR3 =              0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
+        PER_SCOSVR3 =           0x0003 | STICKY_TIMEOUTS |
+                                         WHOLE_SECONDS | SHORT_INODE,
+        PER_OSR5 =              0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
+        PER_WYSEV386 =          0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
+        PER_ISCR4 =             0x0005 | STICKY_TIMEOUTS,
+        PER_BSD =               0x0006,
+        PER_SUNOS =             0x0006 | STICKY_TIMEOUTS,
+        PER_XENIX =             0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
+        PER_LINUX32 =           0x0008,
+        PER_LINUX32_3GB =       0x0008 | ADDR_LIMIT_3GB,
+        PER_IRIX32 =            0x0009 | STICKY_TIMEOUTS,
+        PER_IRIXN32 =           0x000a | STICKY_TIMEOUTS,
+        PER_IRIX64 =            0x000b | STICKY_TIMEOUTS,
+        PER_RISCOS =            0x000c,
+        PER_SOLARIS =           0x000d | STICKY_TIMEOUTS,
+        PER_UW7 =               0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
+        PER_OSF4 =              0x000f,
+        PER_HPUX =              0x0010,
+        PER_MASK =              0x00ff,
+};
+
+extern int personality (unsigned long persona);
+
+__END_DECLS
+
+#endif /* _SYS_PERSONALITY_H_ */
diff --git a/libc/include/sys/prctl.h b/libc/include/sys/prctl.h
index ce85bf7..359d684 100644
--- a/libc/include/sys/prctl.h
+++ b/libc/include/sys/prctl.h
@@ -32,8 +32,13 @@
 
 __BEGIN_DECLS
 
-extern int prctl(int option, unsigned long arg2, unsigned long arg3 , unsigned
-               long arg4, unsigned long arg5);
+/* IMPORTANT NOTE: This function is declared as taking a variable number
+ *                 of arguments to match the GLibc definition. However
+ *                 its declaration inside SYSCALLS.TXT *must* make it
+ *                 take 6 arguments to ensure consistency with the kernel
+ *                 implementation.
+ */
+extern int prctl(int option, ...);
 
 __END_DECLS
 
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 091ee6d..87fcfd0 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -103,6 +103,10 @@
 extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
 extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
 
+# define UTIME_NOW      ((1l << 30) - 1l)
+# define UTIME_OMIT     ((1l << 30) - 2l)
+extern int utimensat (int fd, const char *path, const struct timespec times[2], int flags);
+
 __END_DECLS
 
 #endif /* _SYS_STAT_H_ */
diff --git a/libc/include/sys/system_properties.h b/libc/include/sys/system_properties.h
index 4fdc944..85915b2 100644
--- a/libc/include/sys/system_properties.h
+++ b/libc/include/sys/system_properties.h
@@ -46,6 +46,10 @@
 */
 int __system_property_get(const char *name, char *value);
 
+/* Set a system property by name.
+**/
+int __system_property_set(const char *key, const char *value);
+
 /* Return a pointer to the system property named name, if it
 ** exists, or NULL if there is no such property.  Use 
 ** __system_property_read() to obtain the string value from
diff --git a/libc/include/sys/xattr.h b/libc/include/sys/xattr.h
new file mode 100644
index 0000000..39b25b1
--- /dev/null
+++ b/libc/include/sys/xattr.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT OWNER 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.
+ */
+#ifndef _SYS_XATTR_H_
+#define _SYS_XATTR_H_
+
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+extern int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
+extern int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+extern int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+
+extern ssize_t fgetxattr(int fd, const char *name, void *value, size_t size);
+extern ssize_t getxattr(const char *path, const char *name, void *value, size_t size);
+extern ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size);
+
+extern ssize_t listxattr(const char *path, char *list, size_t size);
+extern ssize_t llistxattr(const char *path, char *list, size_t size);
+extern ssize_t flistxattr(int fd, char *list, size_t size);
+
+extern int removexattr(const char *path, const char *name);
+extern int lremovexattr(const char *path, const char *name);
+extern int fremovexattr(int fd, const char *name);
+
+__END_DECLS
+
+#endif /* _SYS_XATTR_H_ */
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 4534fb9..d92549f 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -70,8 +70,9 @@
 extern int execle(const char *, const char *, ...);
 extern int capget(cap_user_header_t hdrp, cap_user_data_t datap);
 extern int capset(cap_user_header_t hdrp, const cap_user_data_t datap);
-extern int prctl(int  option,  unsigned long arg2, unsigned long arg3,
-                 unsigned long arg4, unsigned long arg5);
+
+/* IMPORTANT: See comment under <sys/prctl.h> about this declaration */
+extern int prctl(int  option, ...);
 
 extern int nice(int);
 
diff --git a/libc/inet/inet_pton.c b/libc/inet/inet_pton.c
index 4caf981..6e74e6a 100644
--- a/libc/inet/inet_pton.c
+++ b/libc/inet/inet_pton.c
@@ -1,36 +1,64 @@
-/*	$OpenBSD: inet_pton.c,v 1.7 2006/12/30 23:37:37 itojun Exp $	*/
+/*	$NetBSD: inet_pton.c,v 1.6.10.1 2011/01/10 00:42:17 riz Exp $	*/
 
-/* Copyright (c) 1996 by Internet Software Consortium.
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static const char rcsid[] = "Id: inet_pton.c,v 1.5 2005/07/28 06:51:47 marka Exp";
+#else
+__RCSID("$NetBSD: inet_pton.c,v 1.6.10.1 2011/01/10 00:42:17 riz Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+// BEGIN android-added
+#define _DIAGASSERT(exp) assert(exp)
+#include "../private/arpa_nameser.h"
+// END android-added
+
+// android-removed: #include "port_before.h"
+
+// android-removed: #include "namespace.h"
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include "arpa_nameser.h"
+#include <arpa/nameser.h>
 #include <string.h>
+#include <assert.h>
+#include <ctype.h>
 #include <errno.h>
 
-/*
+// android-removed: #include "port_after.h"
+
+// BEGIN android-removed
+// #ifdef __weak_alias
+// __weak_alias(inet_pton,_inet_pton)
+// #endif
+// END android-removed
+
+/*%
  * WARNING: Don't even consider trying to compile this on a system where
  * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
  */
 
-static int	inet_pton4(const char *src, u_char *dst);
+static int	inet_pton4(const char *src, u_char *dst, int pton);
 static int	inet_pton6(const char *src, u_char *dst);
 
 /* int
@@ -47,9 +75,13 @@
 int
 inet_pton(int af, const char *src, void *dst)
 {
+
+	_DIAGASSERT(src != NULL);
+	_DIAGASSERT(dst != NULL);
+
 	switch (af) {
 	case AF_INET:
-		return (inet_pton4(src, dst));
+		return (inet_pton4(src, dst, 1));
 	case AF_INET6:
 		return (inet_pton6(src, dst));
 	default:
@@ -60,51 +92,123 @@
 }
 
 /* int
- * inet_pton4(src, dst)
- *	like inet_aton() but without all the hexadecimal and shorthand.
+ * inet_pton4(src, dst, pton)
+ *	when last arg is 0: inet_aton(). with hexadecimal, octal and shorthand.
+ *	when last arg is 1: inet_pton(). decimal dotted-quad only.
  * return:
- *	1 if `src' is a valid dotted quad, else 0.
+ *	1 if `src' is a valid input, else 0.
  * notice:
  *	does not touch `dst' unless it's returning 1.
  * author:
  *	Paul Vixie, 1996.
  */
 static int
-inet_pton4(const char *src, u_char *dst)
+inet_pton4(const char *src, u_char *dst, int pton)
 {
-	static const char digits[] = "0123456789";
-	int saw_digit, octets, ch;
-	u_char tmp[INADDRSZ], *tp;
+	u_int32_t val;
+	u_int digit, base;
+	int n;
+	unsigned char c;
+	u_int parts[4];
+	register u_int *pp = parts;
 
-	saw_digit = 0;
-	octets = 0;
-	*(tp = tmp) = 0;
-	while ((ch = *src++) != '\0') {
-		const char *pch;
+	_DIAGASSERT(src != NULL);
+	_DIAGASSERT(dst != NULL);
 
-		if ((pch = strchr(digits, ch)) != NULL) {
-			u_int new = *tp * 10 + (pch - digits);
-
-			if (new > 255)
-				return (0);
-			if (! saw_digit) {
-				if (++octets > 4)
-					return (0);
-				saw_digit = 1;
-			}
-			*tp = new;
-		} else if (ch == '.' && saw_digit) {
-			if (octets == 4)
-				return (0);
-			*++tp = 0;
-			saw_digit = 0;
-		} else
+	c = *src;
+	for (;;) {
+		/*
+		 * Collect number up to ``.''.
+		 * Values are specified as for C:
+		 * 0x=hex, 0=octal, isdigit=decimal.
+		 */
+		if (!isdigit(c))
 			return (0);
+		val = 0; base = 10;
+		if (c == '0') {
+			c = *++src;
+			if (c == 'x' || c == 'X')
+				base = 16, c = *++src;
+			else if (isdigit(c) && c != '9')
+				base = 8;
+		}
+		/* inet_pton() takes decimal only */
+		if (pton && base != 10)
+			return (0);
+		for (;;) {
+			if (isdigit(c)) {
+				digit = c - '0';
+				if (digit >= base)
+					break;
+				val = (val * base) + digit;
+				c = *++src;
+			} else if (base == 16 && isxdigit(c)) {
+				digit = c + 10 - (islower(c) ? 'a' : 'A');
+				if (digit >= 16)
+					break;
+				val = (val << 4) | digit;
+				c = *++src;
+			} else
+				break;
+		}
+		if (c == '.') {
+			/*
+			 * Internet format:
+			 *	a.b.c.d
+			 *	a.b.c	(with c treated as 16 bits)
+			 *	a.b	(with b treated as 24 bits)
+			 *	a	(with a treated as 32 bits)
+			 */
+			if (pp >= parts + 3)
+				return (0);
+			*pp++ = val;
+			c = *++src;
+		} else
+			break;
 	}
-	if (octets < 4)
+	/*
+	 * Check for trailing characters.
+	 */
+	if (c != '\0' && !isspace(c))
 		return (0);
+	/*
+	 * Concoct the address according to
+	 * the number of parts specified.
+	 */
+	n = pp - parts + 1;
+	/* inet_pton() takes dotted-quad only.  it does not take shorthand. */
+	if (pton && n != 4)
+		return (0);
+	switch (n) {
 
-	memcpy(dst, tmp, INADDRSZ);
+	case 0:
+		return (0);		/* initial nondigit */
+
+	case 1:				/* a -- 32 bits */
+		break;
+
+	case 2:				/* a.b -- 8.24 bits */
+		if (parts[0] > 0xff || val > 0xffffff)
+			return (0);
+		val |= parts[0] << 24;
+		break;
+
+	case 3:				/* a.b.c -- 8.8.16 bits */
+		if ((parts[0] | parts[1]) > 0xff || val > 0xffff)
+			return (0);
+		val |= (parts[0] << 24) | (parts[1] << 16);
+		break;
+
+	case 4:				/* a.b.c.d -- 8.8.8.8 bits */
+		if ((parts[0] | parts[1] | parts[2] | val) > 0xff)
+			return (0);
+		val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+		break;
+	}
+	if (dst) {
+		val = htonl(val);
+		memcpy(dst, &val, NS_INADDRSZ);
+	}
 	return (1);
 }
 
@@ -126,20 +230,23 @@
 {
 	static const char xdigits_l[] = "0123456789abcdef",
 			  xdigits_u[] = "0123456789ABCDEF";
-	u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
+	u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
 	const char *xdigits, *curtok;
-	int ch, saw_xdigit, count_xdigit;
+	int ch, seen_xdigits;
 	u_int val;
 
-	memset((tp = tmp), '\0', IN6ADDRSZ);
-	endp = tp + IN6ADDRSZ;
+	_DIAGASSERT(src != NULL);
+	_DIAGASSERT(dst != NULL);
+
+	memset((tp = tmp), '\0', NS_IN6ADDRSZ);
+	endp = tp + NS_IN6ADDRSZ;
 	colonp = NULL;
 	/* Leading :: requires some special handling. */
 	if (*src == ':')
 		if (*++src != ':')
 			return (0);
 	curtok = src;
-	saw_xdigit = count_xdigit = 0;
+	seen_xdigits = 0;
 	val = 0;
 	while ((ch = *src++) != '\0') {
 		const char *pch;
@@ -147,46 +254,39 @@
 		if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
 			pch = strchr((xdigits = xdigits_u), ch);
 		if (pch != NULL) {
-			if (count_xdigit >= 4)
-				return (0);
 			val <<= 4;
 			val |= (pch - xdigits);
-			if (val > 0xffff)
+			if (++seen_xdigits > 4)
 				return (0);
-			saw_xdigit = 1;
-			count_xdigit++;
 			continue;
 		}
 		if (ch == ':') {
 			curtok = src;
-			if (!saw_xdigit) {
+			if (!seen_xdigits) {
 				if (colonp)
 					return (0);
 				colonp = tp;
 				continue;
-			} else if (*src == '\0') {
+			} else if (*src == '\0')
 				return (0);
-			}
-			if (tp + INT16SZ > endp)
+			if (tp + NS_INT16SZ > endp)
 				return (0);
 			*tp++ = (u_char) (val >> 8) & 0xff;
 			*tp++ = (u_char) val & 0xff;
-			saw_xdigit = 0;
-			count_xdigit = 0;
+			seen_xdigits = 0;
 			val = 0;
 			continue;
 		}
-		if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
-		    inet_pton4(curtok, tp) > 0) {
-			tp += INADDRSZ;
-			saw_xdigit = 0;
-			count_xdigit = 0;
-			break;	/* '\0' was seen by inet_pton4(). */
+		if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+		    inet_pton4(curtok, tp, 1) > 0) {
+			tp += NS_INADDRSZ;
+			seen_xdigits = 0;
+			break;	/*%< '\\0' was seen by inet_pton4(). */
 		}
 		return (0);
 	}
-	if (saw_xdigit) {
-		if (tp + INT16SZ > endp)
+	if (seen_xdigits) {
+		if (tp + NS_INT16SZ > endp)
 			return (0);
 		*tp++ = (u_char) (val >> 8) & 0xff;
 		*tp++ = (u_char) val & 0xff;
@@ -199,6 +299,8 @@
 		const int n = tp - colonp;
 		int i;
 
+		if (tp == endp)
+			return (0);
 		for (i = 1; i <= n; i++) {
 			endp[- i] = colonp[n - i];
 			colonp[n - i] = 0;
@@ -207,6 +309,8 @@
 	}
 	if (tp != endp)
 		return (0);
-	memcpy(dst, tmp, IN6ADDRSZ);
+	memcpy(dst, tmp, NS_IN6ADDRSZ);
 	return (1);
 }
+
+/*! \file */
diff --git a/libc/kernel/arch-arm/asm/ptrace.h b/libc/kernel/arch-arm/asm/ptrace.h
index 3faf738..a04eec3 100644
--- a/libc/kernel/arch-arm/asm/ptrace.h
+++ b/libc/kernel/arch-arm/asm/ptrace.h
@@ -64,12 +64,7 @@
 #ifndef __ASSEMBLY__
 
 struct pt_regs {
-  long uregs[18];
-};
-
-struct user_vfp {
-  unsigned long long fpregs[32];
-  unsigned long fpscr;
+ long uregs[18];
 };
 
 #define ARM_cpsr uregs[16]
diff --git a/libc/kernel/arch-arm/asm/types.h b/libc/kernel/arch-arm/asm/types.h
index ec60f10..80cea8d 100644
--- a/libc/kernel/arch-arm/asm/types.h
+++ b/libc/kernel/arch-arm/asm/types.h
@@ -25,7 +25,7 @@
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#ifdef __GNUC__
 typedef __signed__ long long __s64;
 typedef unsigned long long __u64;
 #endif
diff --git a/libc/kernel/arch-arm/asm/user.h b/libc/kernel/arch-arm/asm/user.h
index 5f25850..d0baecd 100644
--- a/libc/kernel/arch-arm/asm/user.h
+++ b/libc/kernel/arch-arm/asm/user.h
@@ -58,4 +58,15 @@
 #define HOST_TEXT_START_ADDR (u.start_code)
 #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
 
+struct user_vfp {
+ unsigned long long fpregs[32];
+ unsigned long fpscr;
+};
+
+struct user_vfp_exc {
+ unsigned long fpexc;
+ unsigned long fpinst;
+ unsigned long fpinst2;
+};
+
 #endif
diff --git a/libc/kernel/arch-mips/asm/a.out.h b/libc/kernel/arch-mips/asm/a.out.h
new file mode 100644
index 0000000..33c075c
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/a.out.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_A_OUT_H
+#define _ASM_A_OUT_H
+struct exec
+{
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long a_info;
+ unsigned a_text;
+ unsigned a_data;
+ unsigned a_bss;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned a_syms;
+ unsigned a_entry;
+ unsigned a_trsize;
+ unsigned a_drsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define N_TRSIZE(a) ((a).a_trsize)
+#define N_DRSIZE(a) ((a).a_drsize)
+#define N_SYMSIZE(a) ((a).a_syms)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/addrspace.h b/libc/kernel/arch-mips/asm/addrspace.h
new file mode 100644
index 0000000..69abbd4
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/addrspace.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ADDRSPACE_H
+#define _ASM_ADDRSPACE_H
+#include <spaces.h>
+#ifdef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _ATYPE_
+#define _ATYPE32_
+#define _ATYPE64_
+#define _CONST64_(x) x
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define _ATYPE_ __PTRDIFF_TYPE__
+#define _ATYPE32_ int
+#define _ATYPE64_ __s64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _CONST64_(x) x ## LL
+#endif
+#ifdef __ASSEMBLY__
+#define _ACAST32_
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _ACAST64_
+#else
+#define _ACAST32_ (_ATYPE_)(_ATYPE32_)  
+#define _ACAST64_ (_ATYPE64_)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define KSEGX(a) ((_ACAST32_ (a)) & 0xe0000000)
+#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
+#define XPHYSADDR(a) ((_ACAST64_(a)) &   _CONST64_(0x000000ffffffffff))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
+#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
+#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
+#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
+#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
+#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
+#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KUSEG 0x00000000
+#define KSEG0 0x80000000
+#define KSEG1 0xa0000000
+#define KSEG2 0xc0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KSEG3 0xe0000000
+#define CKUSEG 0x00000000
+#define CKSEG0 0x80000000
+#define CKSEG1 0xa0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CKSEG2 0xc0000000
+#define CKSEG3 0xe0000000
+#define K_CALG_COH_EXCL1_NOL2 0
+#define K_CALG_COH_SHRL1_NOL2 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_CALG_UNCACHED 2
+#define K_CALG_NONCOHERENT 3
+#define K_CALG_COH_EXCL 4
+#define K_CALG_COH_SHAREABLE 5
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_CALG_NOTUSED 6
+#define K_CALG_UNCACHED_ACCEL 7
+#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
+#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
+#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) |   (_CONST64_(cm) << 59) | (a))
+#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff)  
+#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32)  
+#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK)
+#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/asm.h b/libc/kernel/arch-mips/asm/asm.h
new file mode 100644
index 0000000..dd80aef
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/asm.h
@@ -0,0 +1,263 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ASM_H
+#define __ASM_ASM_H
+#include <asm/sgidefs.h>
+#ifndef CAT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __STDC__
+#define __CAT(str1, str2) str1##str2
+#else
+#define __CAT(str1, str2) str1 str2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define CAT(str1, str2) __CAT(str1, str2)
+#endif
+#ifdef __PIC__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CPRESTORE(register)   .cprestore register
+#define CPADD(register)   .cpadd register
+#define CPLOAD(register)   .cpload register
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CPRESTORE(register)
+#define CPADD(register)
+#define CPLOAD(register)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LEAF(symbol)   .globl symbol;   .align 2;   .type symbol, @function;   .ent symbol, 0;  symbol: .frame sp, 0, ra
+#define NESTED(symbol, framesize, rpc)   .globl symbol;   .align 2;   .type symbol, @function;   .ent symbol, 0;  symbol: .frame sp, framesize, rpc
+#define END(function)   .end function;   .size function, .-function
+#define EXPORT(symbol)   .globl symbol;  symbol:
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FEXPORT(symbol)   .globl symbol;   .type symbol, @function;  symbol:
+#define ABS(symbol,value)   .globl symbol;  symbol = value
+#define PANIC(msg)   .set push;   .set reorder;   PTR_LA a0, 8f;   jal panic;  9: b 9b;   .set pop;   TEXT(msg)
+#define PRINT(string)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEXT(msg)   .pushsection .data;  8: .asciiz msg;   .popsection;
+#define TTABLE(string)   .pushsection .text;   .word 1f;   .popsection   .pushsection .data;  1: .asciiz string;   .popsection
+#define PREF(hint, addr)
+#define PREFX(hint, addr)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_ISA == _MIPS_ISA_MIPS1
+#define MOVN(rd, rs, rt)   .set push;   .set reorder;   beqz rt, 9f;   move rd, rs;   .set pop;  9:
+#define MOVZ(rd, rs, rt)   .set push;   .set reorder;   bnez rt, 9f;   move rd, rs;   .set pop;  9:
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_ISA == _MIPS_ISA_MIPS2 || _MIPS_ISA == _MIPS_ISA_MIPS3
+#define MOVN(rd, rs, rt)   .set push;   .set noreorder;   bnezl rt, 9f;   move rd, rs;   .set pop;  9:
+#define MOVZ(rd, rs, rt)   .set push;   .set noreorder;   beqzl rt, 9f;   move rd, rs;   .set pop;  9:
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_ISA == _MIPS_ISA_MIPS4 || _MIPS_ISA == _MIPS_ISA_MIPS5 || _MIPS_ISA == _MIPS_ISA_MIPS32 || _MIPS_ISA == _MIPS_ISA_MIPS64
+#define MOVN(rd, rs, rt)   movn rd, rs, rt
+#define MOVZ(rd, rs, rt)   movz rd, rs, rt
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+#define ALSZ 7
+#define ALMASK ~7
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#define ALSZ 15
+#define ALMASK ~15
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __mips64
+#define SZREG 8
+#else
+#define SZREG 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+#define REG_S sw
+#define REG_L lw
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define REG_SUBU subu
+#define REG_ADDU addu
+#endif
+#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define REG_S sd
+#define REG_L ld
+#define REG_SUBU dsubu
+#define REG_ADDU daddu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SZINT == 32
+#define INT_ADD add
+#define INT_ADDU addu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_ADDI addi
+#define INT_ADDIU addiu
+#define INT_SUB sub
+#define INT_SUBU subu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_L lw
+#define INT_S sw
+#define INT_SLL sll
+#define INT_SLLV sllv
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_SRL srl
+#define INT_SRLV srlv
+#define INT_SRA sra
+#define INT_SRAV srav
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SZINT == 64
+#define INT_ADD dadd
+#define INT_ADDU daddu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_ADDI daddi
+#define INT_ADDIU daddiu
+#define INT_SUB dsub
+#define INT_SUBU dsubu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_L ld
+#define INT_S sd
+#define INT_SLL dsll
+#define INT_SLLV dsllv
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_SRL dsrl
+#define INT_SRLV dsrlv
+#define INT_SRA dsra
+#define INT_SRAV dsrav
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SZLONG == 32
+#define LONG_ADD add
+#define LONG_ADDU addu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG_ADDI addi
+#define LONG_ADDIU addiu
+#define LONG_SUB sub
+#define LONG_SUBU subu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG_L lw
+#define LONG_S sw
+#define LONG_SLL sll
+#define LONG_SLLV sllv
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG_SRL srl
+#define LONG_SRLV srlv
+#define LONG_SRA sra
+#define LONG_SRAV srav
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG .word
+#define LONGSIZE 4
+#define LONGMASK 3
+#define LONGLOG 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SZLONG == 64
+#define LONG_ADD dadd
+#define LONG_ADDU daddu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG_ADDI daddi
+#define LONG_ADDIU daddiu
+#define LONG_SUB dsub
+#define LONG_SUBU dsubu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG_L ld
+#define LONG_S sd
+#define LONG_SLL dsll
+#define LONG_SLLV dsllv
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG_SRL dsrl
+#define LONG_SRLV dsrlv
+#define LONG_SRA dsra
+#define LONG_SRAV dsrav
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LONG .dword
+#define LONGSIZE 8
+#define LONGMASK 7
+#define LONGLOG 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SZPTR == 32
+#define PTR_ADD add
+#define PTR_ADDU addu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_ADDI addi
+#define PTR_ADDIU addiu
+#define PTR_SUB sub
+#define PTR_SUBU subu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_L lw
+#define PTR_S sw
+#define PTR_LA la
+#define PTR_LI li
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_SLL sll
+#define PTR_SLLV sllv
+#define PTR_SRL srl
+#define PTR_SRLV srlv
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_SRA sra
+#define PTR_SRAV srav
+#define PTR_SCALESHIFT 2
+#define PTR .word
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRSIZE 4
+#define PTRLOG 2
+#endif
+#if _MIPS_SZPTR == 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_ADD dadd
+#define PTR_ADDU daddu
+#define PTR_ADDI daddi
+#define PTR_ADDIU daddiu
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_SUB dsub
+#define PTR_SUBU dsubu
+#define PTR_L ld
+#define PTR_S sd
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_LA dla
+#define PTR_LI dli
+#define PTR_SLL dsll
+#define PTR_SLLV dsllv
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_SRL dsrl
+#define PTR_SRLV dsrlv
+#define PTR_SRA dsra
+#define PTR_SRAV dsrav
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTR_SCALESHIFT 3
+#define PTR .dword
+#define PTRSIZE 8
+#define PTRLOG 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+#define MFC0 mfc0
+#define MTC0 mtc0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
+#define MFC0 dmfc0
+#define MTC0 dmtc0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define SSNOP sll zero, zero, 1
+#define R10KCBARRIER(addr)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/asmmacro.h b/libc/kernel/arch-mips/asm/asmmacro.h
new file mode 100644
index 0000000..e1e9804
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/asmmacro.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ASMMACRO_H
+#define _ASM_ASMMACRO_H
+#include <asm/hazards.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/atomic.h b/libc/kernel/arch-mips/asm/atomic.h
new file mode 100644
index 0000000..eea1e59
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/atomic.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ATOMIC_H
+#define _ASM_ATOMIC_H
+#include <linux/irqflags.h>
+#include <asm/barrier.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/cpu-features.h>
+#include <asm/war.h>
+#include <asm/system.h>
+typedef struct { volatile int counter; } atomic_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ATOMIC_INIT(i) { (i) }
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v, i) ((v)->counter = (i))
+#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
+#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
+#define atomic_dec_return(v) atomic_sub_return(1, (v))
+#define atomic_inc_return(v) atomic_add_return(1, (v))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define atomic_inc(v) atomic_add(1, (v))
+#define atomic_dec(v) atomic_sub(1, (v))
+#define atomic_add_negative(i, v) (atomic_add_return(i, (v)) < 0)
+#define smp_mb__before_atomic_dec() smp_llsc_mb()
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define smp_mb__after_atomic_dec() smp_llsc_mb()
+#define smp_mb__before_atomic_inc() smp_llsc_mb()
+#define smp_mb__after_atomic_inc() smp_llsc_mb()
+#include <asm-generic/atomic.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-sh/asm/atomic-irq.h b/libc/kernel/arch-mips/asm/auxvec.h
similarity index 65%
rename from libc/kernel/arch-sh/asm/atomic-irq.h
rename to libc/kernel/arch-mips/asm/auxvec.h
index b8f5eaf..0c04901 100644
--- a/libc/kernel/arch-sh/asm/atomic-irq.h
+++ b/libc/kernel/arch-mips/asm/auxvec.h
@@ -7,9 +7,15 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_IRQ_H
-#define __ASM_SH_ATOMIC_IRQ_H
-
+#ifndef _ASM_AUXVEC_H
+#define _ASM_AUXVEC_H
 #endif
diff --git a/libc/kernel/arch-mips/asm/barrier.h b/libc/kernel/arch-mips/asm/barrier.h
new file mode 100644
index 0000000..4aed9a7
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/barrier.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_BARRIER_H
+#define __ASM_BARRIER_H
+#define read_barrier_depends() do { } while(0)
+#define smp_read_barrier_depends() do { } while(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __sync() do { } while(0)
+#define __fast_iob()   __asm__ __volatile__(   ".set	push\n\t"   ".set	noreorder\n\t"   "lw	$0,%0\n\t"   "nop\n\t"   ".set	pop"   :     : "m" (*(int *)CKSEG1)   : "memory")
+#define fast_wmb() __sync()
+#define fast_rmb() __sync()
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fast_mb() __sync()
+#define fast_iob()   do {   __sync();   __fast_iob();   } while (0)
+#define wmb() fast_wmb()
+#define rmb() fast_rmb()
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mb() fast_mb()
+#define iob() fast_iob()
+#define __WEAK_ORDERING_MB "		\n"
+#define __WEAK_LLSC_MB "		\n"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define smp_mb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
+#define smp_rmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
+#define smp_wmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
+#define set_mb(var, value)   do { var = value; smp_mb(); } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
+#define smp_llsc_rmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
+#define smp_llsc_wmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/bitops.h b/libc/kernel/arch-mips/asm/bitops.h
new file mode 100644
index 0000000..749caaa
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/bitops.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_BITOPS_H
+#define _ASM_BITOPS_H
+#ifndef _LINUX_BITOPS_H
+#error only <linux/bitops.h> can be included directly
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#include <linux/compiler.h>
+#include <linux/irqflags.h>
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/barrier.h>
+#include <asm/bug.h>
+#include <asm/byteorder.h>  
+#include <asm/cpu-features.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/sgidefs.h>
+#include <asm/war.h>
+#if _MIPS_SZLONG == 32
+#define SZLONG_LOG 5
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SZLONG_MASK 31UL
+#define __LL "ll	"
+#define __SC "sc	"
+#define __INS "ins    "
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __EXT "ext    "
+#elif _MIPS_SZLONG == 64
+#define SZLONG_LOG 6
+#define SZLONG_MASK 63UL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __LL "lld	"
+#define __SC "scd	"
+#define __INS "dins    "
+#define __EXT "dext    "
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define smp_mb__before_clear_bit() smp_llsc_mb()
+#define smp_mb__after_clear_bit() smp_llsc_mb()
+#include <asm-generic/bitops/non-atomic.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/bitops/fls64.h>
+#include <asm-generic/bitops/ffz.h>
+#include <asm-generic/bitops/find.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/bootinfo.h b/libc/kernel/arch-mips/asm/bootinfo.h
new file mode 100644
index 0000000..97368ea
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/bootinfo.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_BOOTINFO_H
+#define _ASM_BOOTINFO_H
+#include <linux/types.h>
+#include <asm/setup.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACH_UNKNOWN 0  
+#define MACH_DSUNKNOWN 0
+#define MACH_DS23100 1  
+#define MACH_DS5100 2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACH_DS5000_200 3  
+#define MACH_DS5000_1XX 4  
+#define MACH_DS5000_XX 5  
+#define MACH_DS5000_2X0 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACH_DS5400 7  
+#define MACH_DS5500 8  
+#define MACH_DS5800 9  
+#define MACH_DS5900 10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACH_MSP4200_EVAL 0  
+#define MACH_MSP4200_GW 1  
+#define MACH_MSP4200_FPGA 2  
+#define MACH_MSP7120_EVAL 3  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACH_MSP7120_GW 4  
+#define MACH_MSP7120_FPGA 5  
+#define MACH_MSP_OTHER 255  
+#define MACH_MIKROTIK_RB532 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACH_MIKROTIK_RB532A 1  
+#define CL_SIZE COMMAND_LINE_SIZE
+#define BOOT_MEM_MAP_MAX 32
+#define BOOT_MEM_RAM 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BOOT_MEM_ROM_DATA 2
+#define BOOT_MEM_RESERVED 3
+struct boot_mem_map {
+ int nr_map;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct boot_mem_map_entry {
+ phys_t addr;
+ phys_t size;
+ long type;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } map[BOOT_MEM_MAP_MAX];
+};
+#endif
diff --git a/libc/kernel/arch-mips/asm/bug.h b/libc/kernel/arch-mips/asm/bug.h
new file mode 100644
index 0000000..eac3da4
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/bug.h
@@ -0,0 +1,24 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_BUG_H
+#define __ASM_BUG_H
+#include <asm/sgidefs.h>
+#include <asm-generic/bug.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/byteorder.h b/libc/kernel/arch-mips/asm/byteorder.h
new file mode 100644
index 0000000..bb964d8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/byteorder.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_BYTEORDER_H
+#define _ASM_BYTEORDER_H
+#include <linux/compiler.h>
+#include <asm/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __GNUC__
+#ifndef __STRICT_ANSI__
+#define __BYTEORDER_HAS_U64__
+#define __SWAB_64_THRU_32__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
+#ifdef __MIPSEB__
+#include <linux/byteorder/big_endian.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#elif defined(__MIPSEL__)
+#include <linux/byteorder/little_endian.h>
+#else
+#error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/cache.h b/libc/kernel/arch-mips/asm/cache.h
new file mode 100644
index 0000000..64f1982
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cache.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_CACHE_H
+#define _ASM_CACHE_H
+#include <kmalloc.h>
+#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
+#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
+#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/cachectl.h b/libc/kernel/arch-mips/asm/cachectl.h
new file mode 100644
index 0000000..458c00d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cachectl.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_CACHECTL
+#define _ASM_CACHECTL
+#define ICACHE (1<<0)  
+#define DCACHE (1<<1)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BCACHE (ICACHE|DCACHE)  
+#define CACHEABLE 0  
+#define UNCACHEABLE 1  
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/cacheflush.h b/libc/kernel/arch-mips/asm/cacheflush.h
new file mode 100644
index 0000000..00b2220
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cacheflush.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_CACHEFLUSH_H
+#define _ASM_CACHEFLUSH_H
+#include <linux/mm.h>
+#include <asm/cpu-features.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define flush_cache_dup_mm(mm) do { (void) (mm); } while (0)
+#define flush_dcache_mmap_lock(mapping) do { } while (0)
+#define flush_dcache_mmap_unlock(mapping) do { } while (0)
+#define ARCH_HAS_FLUSH_ANON_PAGE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PG_dcache_dirty PG_arch_1
+#define Page_dcache_dirty(page)   test_bit(PG_dcache_dirty, &(page)->flags)
+#define SetPageDcacheDirty(page)   set_bit(PG_dcache_dirty, &(page)->flags)
+#define ClearPageDcacheDirty(page)   clear_bit(PG_dcache_dirty, &(page)->flags)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/cacheops.h b/libc/kernel/arch-mips/asm/cacheops.h
new file mode 100644
index 0000000..4484774
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cacheops.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_CACHEOPS_H
+#define __ASM_CACHEOPS_H
+#define Index_Invalidate_I 0x00
+#define Index_Writeback_Inv_D 0x01
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Index_Load_Tag_I 0x04
+#define Index_Load_Tag_D 0x05
+#define Index_Store_Tag_I 0x08
+#define Index_Store_Tag_D 0x09
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Hit_Invalidate_I 0x10
+#define Hit_Invalidate_D 0x11
+#define Hit_Writeback_Inv_D 0x15
+#define Create_Dirty_Excl_D 0x0d
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Fill 0x14
+#define Hit_Writeback_I 0x18
+#define Hit_Writeback_D 0x19
+#define Index_Invalidate_SI 0x02
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Index_Writeback_Inv_SD 0x03
+#define Index_Load_Tag_SI 0x06
+#define Index_Load_Tag_SD 0x07
+#define Index_Store_Tag_SI 0x0A
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Index_Store_Tag_SD 0x0B
+#define Create_Dirty_Excl_SD 0x0f
+#define Hit_Invalidate_SI 0x12
+#define Hit_Invalidate_SD 0x13
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Hit_Writeback_Inv_SD 0x17
+#define Hit_Writeback_SD 0x1b
+#define Hit_Set_Virtual_SI 0x1e
+#define Hit_Set_Virtual_SD 0x1f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R5K_Page_Invalidate_S 0x17
+#define Page_Invalidate_T 0x16
+#define Index_Writeback_Inv_S 0x03
+#define Index_Load_Tag_S 0x07
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Index_Store_Tag_S 0x0B
+#define Hit_Invalidate_S 0x13
+#define Cache_Barrier 0x14
+#define Hit_Writeback_Inv_S 0x17
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Index_Load_Data_I 0x18
+#define Index_Load_Data_D 0x19
+#define Index_Load_Data_S 0x1b
+#define Index_Store_Data_I 0x1c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Index_Store_Data_D 0x1d
+#define Index_Store_Data_S 0x1f
+#endif
diff --git a/libc/kernel/arch-mips/asm/checksum.h b/libc/kernel/arch-mips/asm/checksum.h
new file mode 100644
index 0000000..df48b2a
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/checksum.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_CHECKSUM_H
+#define _ASM_CHECKSUM_H
+#include <linux/in6.h>
+#include <asm/uaccess.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HAVE_CSUM_COPY_USER
+#ifdef __MIPSEL__
+#else
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _HAVE_ARCH_IPV6_CSUM
+#endif
diff --git a/libc/kernel/arch-mips/asm/cmpxchg.h b/libc/kernel/arch-mips/asm/cmpxchg.h
new file mode 100644
index 0000000..16ba605
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cmpxchg.h
@@ -0,0 +1,33 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_CMPXCHG_H
+#define __ASM_CMPXCHG_H
+#include <linux/irqflags.h>
+#define __HAVE_ARCH_CMPXCHG 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __cmpxchg_asm(ld, st, m, old, new)  ({   __typeof(*(m)) __ret;     if (cpu_has_llsc && R10000_LLSC_WAR) {   __asm__ __volatile__(   "	.set	push				\n"   "	.set	noat				\n"   "	.set	mips3				\n"   "1:	" ld "	%0, %2		# __cmpxchg_asm	\n"   "	bne	%0, %z3, 2f			\n"   "	.set	mips0				\n"   "	move	$1, %z4				\n"   "	.set	mips3				\n"   "	" st "	$1, %1				\n"   "	beqzl	$1, 1b				\n"   "2:						\n"   "	.set	pop				\n"   : "=&r" (__ret), "=R" (*m)   : "R" (*m), "Jr" (old), "Jr" (new)   : "memory");   } else if (cpu_has_llsc) {   __asm__ __volatile__(   "	.set	push				\n"   "	.set	noat				\n"   "	.set	mips3				\n"   "1:	" ld "	%0, %2		# __cmpxchg_asm	\n"   "	bne	%0, %z3, 2f			\n"   "	.set	mips0				\n"   "	move	$1, %z4				\n"   "	.set	mips3				\n"   "	" st "	$1, %1				\n"   "	beqz	$1, 3f				\n"   "2:						\n"   "	.subsection 2				\n"   "3:	b	1b				\n"   "	.previous				\n"   "	.set	pop				\n"   : "=&r" (__ret), "=R" (*m)   : "R" (*m), "Jr" (old), "Jr" (new)   : "memory");   } else {   unsigned long __flags;     raw_local_irq_save(__flags);   __ret = *m;   if (__ret == old)   *m = new;   raw_local_irq_restore(__flags);   }     __ret;  })
+#define __cmpxchg(ptr, old, new, barrier)  ({   __typeof__(ptr) __ptr = (ptr);   __typeof__(*(ptr)) __old = (old);   __typeof__(*(ptr)) __new = (new);   __typeof__(*(ptr)) __res = 0;     barrier;     switch (sizeof(*(__ptr))) {   case 4:   __res = __cmpxchg_asm("ll", "sc", __ptr, __old, __new);   break;   case 8:   if (sizeof(long) == 8) {   __res = __cmpxchg_asm("lld", "scd", __ptr,   __old, __new);   break;   }   default:   __cmpxchg_called_with_bad_pointer();   break;   }     barrier;     __res;  })
+#define cmpxchg(ptr, old, new) __cmpxchg(ptr, old, new, smp_llsc_mb())
+#define cmpxchg_local(ptr, old, new) __cmpxchg(ptr, old, new, )
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cmpxchg64(ptr, o, n)   ({   BUILD_BUG_ON(sizeof(*(ptr)) != 8);   cmpxchg((ptr), (o), (n));   })
+#include <asm-generic/cmpxchg-local.h>
+#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/compiler.h b/libc/kernel/arch-mips/asm/compiler.h
new file mode 100644
index 0000000..e31f272
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/compiler.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_COMPILER_H
+#define _ASM_COMPILER_H
+#if __GNUC__ > (3 || __GNUC__ == (3 && __GNUC_MINOR__ >= 4))
+#define GCC_IMM_ASM() "n"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GCC_REG_ACCUM "$0"
+#else
+#define GCC_IMM_ASM() "rn"
+#define GCC_REG_ACCUM "accum"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/cpu-features.h b/libc/kernel/arch-mips/asm/cpu-features.h
new file mode 100644
index 0000000..b3642c2
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cpu-features.h
@@ -0,0 +1,186 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_CPU_FEATURES_H
+#define __ASM_CPU_FEATURES_H
+#include <asm/cpu.h>
+#include <asm/cpu-info.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <cpu-feature-overrides.h>
+#ifndef current_cpu_type
+#define current_cpu_type() current_cpu_data.cputype
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_tlb
+#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)
+#endif
+#ifndef cpu_has_4kex
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
+#endif
+#ifndef cpu_has_3k_cache
+#define cpu_has_3k_cache (cpu_data[0].options & MIPS_CPU_3K_CACHE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define cpu_has_6k_cache 0
+#define cpu_has_8k_cache 0
+#ifndef cpu_has_4k_cache
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_4k_cache (cpu_data[0].options & MIPS_CPU_4K_CACHE)
+#endif
+#ifndef cpu_has_tx39_cache
+#define cpu_has_tx39_cache (cpu_data[0].options & MIPS_CPU_TX39_CACHE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_fpu
+#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
+#define raw_cpu_has_fpu (raw_current_cpu_data.options & MIPS_CPU_FPU)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define raw_cpu_has_fpu cpu_has_fpu
+#endif
+#ifndef cpu_has_32fpr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
+#endif
+#ifndef cpu_has_counter
+#define cpu_has_counter (cpu_data[0].options & MIPS_CPU_COUNTER)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_watch
+#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_divec
+#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC)
+#endif
+#ifndef cpu_has_vce
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_vce (cpu_data[0].options & MIPS_CPU_VCE)
+#endif
+#ifndef cpu_has_cache_cdex_p
+#define cpu_has_cache_cdex_p (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_P)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_cache_cdex_s
+#define cpu_has_cache_cdex_s (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_S)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_prefetch
+#define cpu_has_prefetch (cpu_data[0].options & MIPS_CPU_PREFETCH)
+#endif
+#ifndef cpu_has_mcheck
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_mcheck (cpu_data[0].options & MIPS_CPU_MCHECK)
+#endif
+#ifndef cpu_has_ejtag
+#define cpu_has_ejtag (cpu_data[0].options & MIPS_CPU_EJTAG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_llsc
+#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_mips16
+#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16)
+#endif
+#ifndef cpu_has_mdmx
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX)
+#endif
+#ifndef cpu_has_mips3d
+#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_smartmips
+#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_vtag_icache
+#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
+#endif
+#ifndef cpu_has_dc_aliases
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_dc_aliases (cpu_data[0].dcache.flags & MIPS_CACHE_ALIASES)
+#endif
+#ifndef cpu_has_ic_fills_f_dc
+#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_pindexed_dcache
+#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_icache_snoops_remote_store
+#define cpu_icache_snoops_remote_store 1
+#endif
+#ifndef cpu_has_mips32r1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_mips32r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R1)
+#endif
+#ifndef cpu_has_mips32r2
+#define cpu_has_mips32r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_mips64r1
+#define cpu_has_mips64r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R1)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_mips64r2
+#define cpu_has_mips64r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R2)
+#endif
+#define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2)
+#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1)
+#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2)
+#ifndef cpu_has_dsp
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
+#endif
+#ifndef cpu_has_mipsmt
+#define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_userlocal
+#define cpu_has_userlocal (cpu_data[0].options & MIPS_CPU_ULRI)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_vint
+#define cpu_has_vint 0
+#endif
+#ifndef cpu_has_veic
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_veic 0
+#endif
+#ifndef cpu_has_inclusive_pcaches
+#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_dcache_line_size
+#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_icache_line_size
+#define cpu_icache_line_size() cpu_data[0].icache.linesz
+#endif
+#ifndef cpu_scache_line_size
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_scache_line_size() cpu_data[0].scache.linesz
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/cpu-info.h b/libc/kernel/arch-mips/asm/cpu-info.h
new file mode 100644
index 0000000..d8bd122
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cpu-info.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_CPU_INFO_H
+#define __ASM_CPU_INFO_H
+#include <asm/cache.h>
+struct cache_desc {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int waysize;
+ unsigned short sets;
+ unsigned char ways;
+ unsigned char linesz;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char waybit;
+ unsigned char flags;
+};
+#define MIPS_CACHE_NOT_PRESENT 0x00000001
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CACHE_VTAG 0x00000002  
+#define MIPS_CACHE_ALIASES 0x00000004  
+#define MIPS_CACHE_IC_F_DC 0x00000008  
+#define MIPS_IC_SNOOPS_REMOTE 0x00000010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CACHE_PINDEX 0x00000020  
+struct cpuinfo_mips {
+ unsigned long udelay_val;
+ unsigned long asid_cache;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long options;
+ unsigned long ases;
+ unsigned int processor_id;
+ unsigned int fpu_id;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int cputype;
+ int isa_level;
+ int tlbsize;
+ struct cache_desc icache;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct cache_desc dcache;
+ struct cache_desc scache;
+ struct cache_desc tcache;
+ int srsets;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int core;
+ void *data;
+} __attribute__((aligned(SMP_CACHE_BYTES)));
+#define current_cpu_data cpu_data[smp_processor_id()]
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
+#define cpu_name_string() __cpu_name[smp_processor_id()]
+#endif
diff --git a/libc/kernel/arch-mips/asm/cpu.h b/libc/kernel/arch-mips/asm/cpu.h
new file mode 100644
index 0000000..7b4b2d3
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/cpu.h
@@ -0,0 +1,195 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_CPU_H
+#define _ASM_CPU_H
+#define PRID_COMP_LEGACY 0x000000
+#define PRID_COMP_MIPS 0x010000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_COMP_BROADCOM 0x020000
+#define PRID_COMP_ALCHEMY 0x030000
+#define PRID_COMP_SIBYTE 0x040000
+#define PRID_COMP_SANDCRAFT 0x050000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_COMP_NXP 0x060000
+#define PRID_COMP_TOSHIBA 0x070000
+#define PRID_COMP_LSI 0x080000
+#define PRID_COMP_LEXRA 0x0b0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_R2000 0x0100
+#define PRID_IMP_AU1_REV1 0x0100
+#define PRID_IMP_AU1_REV2 0x0200
+#define PRID_IMP_R3000 0x0200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_R6000 0x0300  
+#define PRID_IMP_R4000 0x0400
+#define PRID_IMP_R6000A 0x0600
+#define PRID_IMP_R10000 0x0900
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_R4300 0x0b00
+#define PRID_IMP_VR41XX 0x0c00
+#define PRID_IMP_R12000 0x0e00
+#define PRID_IMP_R14000 0x0f00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_R8000 0x1000
+#define PRID_IMP_PR4450 0x1200
+#define PRID_IMP_R4600 0x2000
+#define PRID_IMP_R4700 0x2100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_TX39 0x2200
+#define PRID_IMP_R4640 0x2200
+#define PRID_IMP_R4650 0x2200  
+#define PRID_IMP_R5000 0x2300
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_TX49 0x2d00
+#define PRID_IMP_SONIC 0x2400
+#define PRID_IMP_MAGIC 0x2500
+#define PRID_IMP_RM7000 0x2700
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_NEVADA 0x2800  
+#define PRID_IMP_RM9000 0x3400
+#define PRID_IMP_LOONGSON1 0x4200
+#define PRID_IMP_R5432 0x5400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_R5500 0x5500
+#define PRID_IMP_LOONGSON2 0x6300
+#define PRID_IMP_UNKNOWN 0xff00
+#define PRID_IMP_4KC 0x8000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_5KC 0x8100
+#define PRID_IMP_20KC 0x8200
+#define PRID_IMP_4KEC 0x8400
+#define PRID_IMP_4KSC 0x8600
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_25KF 0x8800
+#define PRID_IMP_5KE 0x8900
+#define PRID_IMP_4KECR2 0x9000
+#define PRID_IMP_4KEMPR2 0x9100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_4KSD 0x9200
+#define PRID_IMP_24K 0x9300
+#define PRID_IMP_34K 0x9500
+#define PRID_IMP_24KE 0x9600
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_74K 0x9700
+#define PRID_IMP_1004K 0x9900
+#define PRID_IMP_SB1 0x0100
+#define PRID_IMP_SB1A 0x1100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_IMP_SR71000 0x0400
+#define PRID_IMP_BCM4710 0x4000
+#define PRID_IMP_BCM3302 0x9000
+#define PRID_REV_MASK 0x00ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_REV_TX4927 0x0022
+#define PRID_REV_TX4937 0x0030
+#define PRID_REV_R4400 0x0040
+#define PRID_REV_R3000A 0x0030
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_REV_R3000 0x0020
+#define PRID_REV_R2000A 0x0010
+#define PRID_REV_TX3912 0x0010
+#define PRID_REV_TX3922 0x0030
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_REV_TX3927 0x0040
+#define PRID_REV_VR4111 0x0050
+#define PRID_REV_VR4181 0x0050  
+#define PRID_REV_VR4121 0x0060
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_REV_VR4122 0x0070
+#define PRID_REV_VR4181A 0x0070  
+#define PRID_REV_VR4130 0x0080
+#define PRID_REV_34K_V1_0_2 0x0022
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRID_REV_ENCODE_44(ver, rev)   ((ver) << 4 | (rev))
+#define PRID_REV_ENCODE_332(ver, rev, patch)   ((ver) << 5 | (rev) << 2 | (patch))
+#define FPIR_IMP_NONE 0x0000
+enum cpu_type_enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CPU_UNKNOWN,
+ CPU_R2000, CPU_R3000, CPU_R3000A, CPU_R3041, CPU_R3051, CPU_R3052,
+ CPU_R3081, CPU_R3081E,
+ CPU_R6000, CPU_R6000A,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CPU_R4000PC, CPU_R4000SC, CPU_R4000MC, CPU_R4200, CPU_R4300, CPU_R4310,
+ CPU_R4400PC, CPU_R4400SC, CPU_R4400MC, CPU_R4600, CPU_R4640, CPU_R4650,
+ CPU_R4700, CPU_R5000, CPU_R5000A, CPU_R5500, CPU_NEVADA, CPU_R5432,
+ CPU_R10000, CPU_R12000, CPU_R14000, CPU_VR41XX, CPU_VR4111, CPU_VR4121,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CPU_VR4122, CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000,
+ CPU_SR71000, CPU_RM9000, CPU_TX49XX,
+ CPU_R8000,
+ CPU_TX3912, CPU_TX3922, CPU_TX3927,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
+ CPU_AU1000, CPU_AU1100, CPU_AU1200, CPU_AU1210, CPU_AU1250, CPU_AU1500,
+ CPU_AU1550, CPU_PR4450, CPU_BCM3302, CPU_BCM4710,
+ CPU_5KC, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CPU_LAST
+};
+#define MIPS_CPU_ISA_I 0x00000001
+#define MIPS_CPU_ISA_II 0x00000002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_ISA_III 0x00000004
+#define MIPS_CPU_ISA_IV 0x00000008
+#define MIPS_CPU_ISA_V 0x00000010
+#define MIPS_CPU_ISA_M32R1 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_ISA_M32R2 0x00000040
+#define MIPS_CPU_ISA_M64R1 0x00000080
+#define MIPS_CPU_ISA_M64R2 0x00000100
+#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II |   MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 )
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV |   MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)
+#define MIPS_CPU_TLB 0x00000001  
+#define MIPS_CPU_4KEX 0x00000002  
+#define MIPS_CPU_3K_CACHE 0x00000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_4K_CACHE 0x00000008  
+#define MIPS_CPU_TX39_CACHE 0x00000010  
+#define MIPS_CPU_FPU 0x00000020  
+#define MIPS_CPU_32FPR 0x00000040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_COUNTER 0x00000080  
+#define MIPS_CPU_WATCH 0x00000100  
+#define MIPS_CPU_DIVEC 0x00000200  
+#define MIPS_CPU_VCE 0x00000400  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_CACHE_CDEX_P 0x00000800  
+#define MIPS_CPU_CACHE_CDEX_S 0x00001000  
+#define MIPS_CPU_MCHECK 0x00002000  
+#define MIPS_CPU_EJTAG 0x00004000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_NOFPUEX 0x00008000  
+#define MIPS_CPU_LLSC 0x00010000  
+#define MIPS_CPU_INCLUSIVE_CACHES 0x00020000  
+#define MIPS_CPU_PREFETCH 0x00040000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CPU_VINT 0x00080000  
+#define MIPS_CPU_VEIC 0x00100000  
+#define MIPS_CPU_ULRI 0x00200000  
+#define MIPS_ASE_MIPS16 0x00000001  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_ASE_MDMX 0x00000002  
+#define MIPS_ASE_MIPS3D 0x00000004  
+#define MIPS_ASE_SMARTMIPS 0x00000008  
+#define MIPS_ASE_DSP 0x00000010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_ASE_MIPSMT 0x00000020  
+#endif
diff --git a/libc/kernel/arch-sh/asm/cputime.h b/libc/kernel/arch-mips/asm/cputime.h
similarity index 62%
rename from libc/kernel/arch-sh/asm/cputime.h
rename to libc/kernel/arch-mips/asm/cputime.h
index 8a85d30..5a71223 100644
--- a/libc/kernel/arch-sh/asm/cputime.h
+++ b/libc/kernel/arch-mips/asm/cputime.h
@@ -7,11 +7,17 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __SH_CPUTIME_H
-#define __SH_CPUTIME_H
-
+#ifndef __MIPS_CPUTIME_H
+#define __MIPS_CPUTIME_H
 #include <asm-generic/cputime.h>
-
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/current.h b/libc/kernel/arch-mips/asm/current.h
similarity index 63%
rename from libc/kernel/arch-sh/asm/current.h
rename to libc/kernel/arch-mips/asm/current.h
index e2ce122..439b61e 100644
--- a/libc/kernel/arch-sh/asm/current.h
+++ b/libc/kernel/arch-mips/asm/current.h
@@ -7,14 +7,19 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_CURRENT_H
-#define __ASM_SH_CURRENT_H
-
+#ifndef _ASM_CURRENT_H
+#define _ASM_CURRENT_H
 #include <linux/thread_info.h>
-
 struct task_struct;
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define current get_current()
 #endif
diff --git a/libc/kernel/arch-mips/asm/debug.h b/libc/kernel/arch-mips/asm/debug.h
new file mode 100644
index 0000000..1345bdf
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/debug.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DEBUG_H
+#define _ASM_DEBUG_H
+#define db_assert(x)
+#define db_warn(x)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define db_verify(x, y) x
+#define db_verify_warn(x, y) x
+#define db_run(x)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/dec/ecc.h b/libc/kernel/arch-mips/asm/dec/ecc.h
new file mode 100644
index 0000000..51342a5
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/dec/ecc.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_DEC_ECC_H
+#define __ASM_MIPS_DEC_ECC_H
+#define KN0X_EAR_VALID (1<<31)  
+#define KN0X_EAR_CPU (1<<30)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN0X_EAR_WRITE (1<<29)  
+#define KN0X_EAR_ECCERR (1<<28)  
+#define KN0X_EAR_RES_27 (1<<27)  
+#define KN0X_EAR_ADDRESS (0x7ffffff<<0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN0X_ESR_VLDHI (1<<31)  
+#define KN0X_ESR_CHKHI (0x7f<<24)  
+#define KN0X_ESR_SNGHI (1<<23)  
+#define KN0X_ESR_SYNHI (0x7f<<16)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN0X_ESR_VLDLO (1<<15)  
+#define KN0X_ESR_CHKLO (0x7f<<8)  
+#define KN0X_ESR_SNGLO (1<<7)  
+#define KN0X_ESR_SYNLO (0x7f<<0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+#include <linux/interrupt.h>
+struct pt_regs;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/dec/ioasic_addrs.h b/libc/kernel/arch-mips/asm/dec/ioasic_addrs.h
new file mode 100644
index 0000000..99774a1
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/dec/ioasic_addrs.h
@@ -0,0 +1,124 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_DEC_IOASIC_ADDRS_H
+#define __ASM_MIPS_DEC_IOASIC_ADDRS_H
+#define IOASIC_SLOT_SIZE 0x00040000
+#define IOASIC_SYS_ROM (0*IOASIC_SLOT_SIZE)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOASIC_IOCTL (1*IOASIC_SLOT_SIZE)  
+#define IOASIC_ESAR (2*IOASIC_SLOT_SIZE)  
+#define IOASIC_LANCE (3*IOASIC_SLOT_SIZE)  
+#define IOASIC_SCC0 (4*IOASIC_SLOT_SIZE)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOASIC_VDAC_HI (5*IOASIC_SLOT_SIZE)  
+#define IOASIC_SCC1 (6*IOASIC_SLOT_SIZE)  
+#define IOASIC_VDAC_LO (7*IOASIC_SLOT_SIZE)  
+#define IOASIC_TOY (8*IOASIC_SLOT_SIZE)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOASIC_ISDN (9*IOASIC_SLOT_SIZE)  
+#define IOASIC_ERRADDR (9*IOASIC_SLOT_SIZE)  
+#define IOASIC_CHKSYN (10*IOASIC_SLOT_SIZE)  
+#define IOASIC_ACC_BUS (10*IOASIC_SLOT_SIZE)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOASIC_MCR (11*IOASIC_SLOT_SIZE)  
+#define IOASIC_FLOPPY (11*IOASIC_SLOT_SIZE)  
+#define IOASIC_SCSI (12*IOASIC_SLOT_SIZE)  
+#define IOASIC_FDC_DMA (13*IOASIC_SLOT_SIZE)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOASIC_SCSI_DMA (14*IOASIC_SLOT_SIZE)  
+#define IOASIC_RES_15 (15*IOASIC_SLOT_SIZE)  
+#define IO_REG_SCSI_DMA_P 0x00  
+#define IO_REG_SCSI_DMA_BP 0x10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_LANCE_DMA_P 0x20  
+#define IO_REG_SCC0A_T_DMA_P 0x30  
+#define IO_REG_SCC0A_R_DMA_P 0x40  
+#define IO_REG_SCC1A_T_DMA_P 0x50  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_SCC1A_R_DMA_P 0x60  
+#define IO_REG_AB_T_DMA_P 0x50  
+#define IO_REG_AB_R_DMA_P 0x60  
+#define IO_REG_FLOPPY_DMA_P 0x70  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_ISDN_T_DMA_P 0x80  
+#define IO_REG_ISDN_T_DMA_BP 0x90  
+#define IO_REG_ISDN_R_DMA_P 0xa0  
+#define IO_REG_ISDN_R_DMA_BP 0xb0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_DATA_0 0xc0  
+#define IO_REG_DATA_1 0xd0  
+#define IO_REG_DATA_2 0xe0  
+#define IO_REG_DATA_3 0xf0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_SSR 0x100  
+#define IO_REG_SIR 0x110  
+#define IO_REG_SIMR 0x120  
+#define IO_REG_SAR 0x130  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_ISDN_T_DATA 0x140  
+#define IO_REG_ISDN_R_DATA 0x150  
+#define IO_REG_LANCE_SLOT 0x160  
+#define IO_REG_SCSI_SLOT 0x170  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_SCC0A_SLOT 0x180  
+#define IO_REG_SCC1A_SLOT 0x190  
+#define IO_REG_AB_SLOT 0x190  
+#define IO_REG_FLOPPY_SLOT 0x1a0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_SCSI_SCR 0x1b0  
+#define IO_REG_SCSI_SDR0 0x1c0  
+#define IO_REG_SCSI_SDR1 0x1d0  
+#define IO_REG_FCTR 0x1e0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_REG_RES_31 0x1f0  
+#define IO_SSR_SCC0A_TX_DMA_EN (1<<31)  
+#define IO_SSR_SCC0A_RX_DMA_EN (1<<30)  
+#define IO_SSR_RES_27 (1<<27)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_SSR_RES_26 (1<<26)  
+#define IO_SSR_RES_25 (1<<25)  
+#define IO_SSR_RES_24 (1<<24)  
+#define IO_SSR_RES_23 (1<<23)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_SSR_SCSI_DMA_DIR (1<<18)  
+#define IO_SSR_SCSI_DMA_EN (1<<17)  
+#define IO_SSR_LANCE_DMA_EN (1<<16)  
+#define IO_SSR_SCC1A_TX_DMA_EN (1<<29)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_SSR_SCC1A_RX_DMA_EN (1<<28)  
+#define IO_SSR_RES_22 (1<<22)  
+#define IO_SSR_RES_21 (1<<21)  
+#define IO_SSR_RES_20 (1<<20)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_SSR_RES_19 (1<<19)  
+#define IO_SSR_AB_TX_DMA_EN (1<<29)  
+#define IO_SSR_AB_RX_DMA_EN (1<<28)  
+#define IO_SSR_FLOPPY_DMA_DIR (1<<22)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_SSR_FLOPPY_DMA_EN (1<<21)  
+#define IO_SSR_ISDN_TX_DMA_EN (1<<20)  
+#define IO_SSR_ISDN_RX_DMA_EN (1<<19)  
+#define KN0X_IO_SSR_DIAGDN (1<<15)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN0X_IO_SSR_SCC_RST (1<<11)  
+#define KN0X_IO_SSR_RTC_RST (1<<10)  
+#define KN0X_IO_SSR_ASC_RST (1<<9)  
+#define KN0X_IO_SSR_LANCE_RST (1<<8)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/dec/kn02xa.h b/libc/kernel/arch-mips/asm/dec/kn02xa.h
new file mode 100644
index 0000000..6078c8b
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/dec/kn02xa.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_DEC_KN02XA_H
+#define __ASM_MIPS_DEC_KN02XA_H
+#include <asm/dec/ioasic_addrs.h>
+#define KN02XA_SLOT_BASE 0x1c000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_MER 0x0c400000  
+#define KN02XA_MSR 0x0c800000  
+#define KN02XA_MEM_CONF 0x0e000000  
+#define KN02XA_EAR 0x0e000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_BOOT0 0x0e000008  
+#define KN02XA_MEM_INTR 0x0e00000c  
+#define KN02XA_MER_RES_28 (0xf<<28)  
+#define KN02XA_MER_RES_17 (0x3ff<<17)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_MER_PAGERR (1<<16)  
+#define KN02XA_MER_TRANSERR (1<<15)  
+#define KN02XA_MER_PARDIS (1<<14)  
+#define KN02XA_MER_SIZE (1<<13)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_MER_RES_12 (1<<12)  
+#define KN02XA_MER_BYTERR (0xf<<8)  
+#define KN02XA_MER_BYTERR_3 (0x8<<8)  
+#define KN02XA_MER_BYTERR_2 (0x4<<8)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_MER_BYTERR_1 (0x2<<8)  
+#define KN02XA_MER_BYTERR_0 (0x1<<8)  
+#define KN02XA_MER_RES_0 (0xff<<0)  
+#define KN02XA_MSR_RES_27 (0x1f<<27)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_MSR_RES_14 (0x7<<14)  
+#define KN02XA_MSR_SIZE (1<<13)  
+#define KN02XA_MSR_RES_0 (0x1fff<<0)  
+#define KN02XA_EAR_RES_29 (0x7<<29)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KN02XA_EAR_ADDRESS (0x7ffffff<<2)  
+#define KN02XA_EAR_RES_0 (0x3<<0)  
+#ifndef __ASSEMBLY__
+#include <linux/interrupt.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct pt_regs;
+#endif
+#endif
diff --git a/libc/kernel/arch-sh/asm/atomic-irq.h b/libc/kernel/arch-mips/asm/dec/system.h
similarity index 64%
copy from libc/kernel/arch-sh/asm/atomic-irq.h
copy to libc/kernel/arch-mips/asm/dec/system.h
index b8f5eaf..94cf431 100644
--- a/libc/kernel/arch-sh/asm/atomic-irq.h
+++ b/libc/kernel/arch-mips/asm/dec/system.h
@@ -7,9 +7,15 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_IRQ_H
-#define __ASM_SH_ATOMIC_IRQ_H
-
+#ifndef __ASM_DEC_SYSTEM_H
+#define __ASM_DEC_SYSTEM_H
 #endif
diff --git a/libc/kernel/arch-mips/asm/delay.h b/libc/kernel/arch-mips/asm/delay.h
new file mode 100644
index 0000000..a184a93
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/delay.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DELAY_H
+#define _ASM_DELAY_H
+#include <linux/param.h>
+#include <linux/smp.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/compiler.h>
+#include <asm/war.h>
+#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
+#define udelay(usecs) __udelay((usecs), __udelay_val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if HZ >= 1000
+#define MAX_UDELAY_MS 1
+#elif HZ <= 200
+#define MAX_UDELAY_MS 5
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define MAX_UDELAY_MS (1000 / HZ)
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/device.h b/libc/kernel/arch-mips/asm/device.h
similarity index 69%
rename from libc/kernel/arch-sh/asm/device.h
rename to libc/kernel/arch-mips/asm/device.h
index a46d06f..535031e 100644
--- a/libc/kernel/arch-sh/asm/device.h
+++ b/libc/kernel/arch-mips/asm/device.h
@@ -7,9 +7,13 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #include <asm-generic/device.h>
-
-struct platform_device;
-
diff --git a/libc/kernel/arch-mips/asm/div64.h b/libc/kernel/arch-mips/asm/div64.h
new file mode 100644
index 0000000..a542b46
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/div64.h
@@ -0,0 +1,33 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DIV64_H
+#define _ASM_DIV64_H
+#include <linux/types.h>
+#if _MIPS_SZLONG == 32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/compiler.h>
+#define do_div64_32(res, high, low, base) ({   unsigned long __quot32, __mod32;   unsigned long __cf, __tmp, __tmp2, __i;     __asm__(".set	push\n\t"   ".set	noat\n\t"   ".set	noreorder\n\t"   "move	%2, $0\n\t"   "move	%3, $0\n\t"   "b	1f\n\t"   " li	%4, 0x21\n"   "0:\n\t"   "sll	$1, %0, 0x1\n\t"   "srl	%3, %0, 0x1f\n\t"   "or	%0, $1, %5\n\t"   "sll	%1, %1, 0x1\n\t"   "sll	%2, %2, 0x1\n"   "1:\n\t"   "bnez	%3, 2f\n\t"   " sltu	%5, %0, %z6\n\t"   "bnez	%5, 3f\n"   "2:\n\t"   " addiu	%4, %4, -1\n\t"   "subu	%0, %0, %z6\n\t"   "addiu	%2, %2, 1\n"   "3:\n\t"   "bnez	%4, 0b\n\t"   " srl	%5, %1, 0x1f\n\t"   ".set	pop"   : "=&r" (__mod32), "=&r" (__tmp),   "=&r" (__quot32), "=&r" (__cf),   "=&r" (__i), "=&r" (__tmp2)   : "Jr" (base), "0" (high), "1" (low));     (res) = __quot32;   __mod32; })
+#define do_div(n, base) ({   unsigned long long __quot;   unsigned long __mod;   unsigned long long __div;   unsigned long __upper, __low, __high, __base;     __div = (n);   __base = (base);     __high = __div >> 32;   __low = __div;   __upper = __high;     if (__high)   __asm__("divu	$0, %z2, %z3"   : "=h" (__upper), "=l" (__high)   : "Jr" (__high), "Jr" (__base)   : GCC_REG_ACCUM);     __mod = do_div64_32(__low, __upper, __low, __base);     __quot = __high;   __quot = __quot << 32 | __low;   (n) = __quot;   __mod; })
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SZLONG == 64
+#define do_div(n, base) ({   unsigned long __quot;   unsigned int __mod;   unsigned long __div;   unsigned int __base;     __div = (n);   __base = (base);     __mod = __div % __base;   __quot = __div / __base;     (n) = __quot;   __mod; })
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/dma-mapping.h b/libc/kernel/arch-mips/asm/dma-mapping.h
new file mode 100644
index 0000000..e521fd7
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/dma-mapping.h
@@ -0,0 +1,24 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DMA_MAPPING_H
+#define _ASM_DMA_MAPPING_H
+#include <asm/scatterlist.h>
+#include <asm/cache.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/dma.h b/libc/kernel/arch-mips/asm/dma.h
new file mode 100644
index 0000000..aedb5dd
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/dma.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DMA_H
+#define _ASM_DMA_H
+#include <asm/io.h>  
+#include <linux/spinlock.h>  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/delay.h>
+#include <asm/system.h>
+#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
+#define dma_outb outb_p
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define dma_outb outb
+#endif
+#define dma_inb inb
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAX_DMA_CHANNELS 8
+#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
+#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
+#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO_DMA1_BASE 0x00  
+#define IO_DMA2_BASE 0xC0  
+#define DMA1_CMD_REG 0x08  
+#define DMA1_STAT_REG 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA1_REQ_REG 0x09  
+#define DMA1_MASK_REG 0x0A  
+#define DMA1_MODE_REG 0x0B  
+#define DMA1_CLEAR_FF_REG 0x0C  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA1_TEMP_REG 0x0D  
+#define DMA1_RESET_REG 0x0D  
+#define DMA1_CLR_MASK_REG 0x0E  
+#define DMA1_MASK_ALL_REG 0x0F  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA2_CMD_REG 0xD0  
+#define DMA2_STAT_REG 0xD0  
+#define DMA2_REQ_REG 0xD2  
+#define DMA2_MASK_REG 0xD4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA2_MODE_REG 0xD6  
+#define DMA2_CLEAR_FF_REG 0xD8  
+#define DMA2_TEMP_REG 0xDA  
+#define DMA2_RESET_REG 0xDA  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA2_CLR_MASK_REG 0xDC  
+#define DMA2_MASK_ALL_REG 0xDE  
+#define DMA_ADDR_0 0x00  
+#define DMA_ADDR_1 0x02
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_ADDR_2 0x04
+#define DMA_ADDR_3 0x06
+#define DMA_ADDR_4 0xC0
+#define DMA_ADDR_5 0xC4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_ADDR_6 0xC8
+#define DMA_ADDR_7 0xCC
+#define DMA_CNT_0 0x01  
+#define DMA_CNT_1 0x03
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_CNT_2 0x05
+#define DMA_CNT_3 0x07
+#define DMA_CNT_4 0xC2
+#define DMA_CNT_5 0xC6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_CNT_6 0xCA
+#define DMA_CNT_7 0xCE
+#define DMA_PAGE_0 0x87  
+#define DMA_PAGE_1 0x83
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_PAGE_2 0x81
+#define DMA_PAGE_3 0x82
+#define DMA_PAGE_5 0x8B
+#define DMA_PAGE_6 0x89
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_PAGE_7 0x8A
+#define DMA_MODE_READ 0x44  
+#define DMA_MODE_WRITE 0x48  
+#define DMA_MODE_CASCADE 0xC0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DMA_AUTOINIT 0x10
+#define isa_dma_bridge_buggy (0)
+#endif
diff --git a/libc/kernel/arch-mips/asm/ds1286.h b/libc/kernel/arch-mips/asm/ds1286.h
new file mode 100644
index 0000000..319f219
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ds1286.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DS1286_H
+#define _ASM_DS1286_H
+#include <ds1286.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/dsp.h b/libc/kernel/arch-mips/asm/dsp.h
new file mode 100644
index 0000000..3d60be5
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/dsp.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_DSP_H
+#define _ASM_DSP_H
+#include <asm/cpu.h>
+#include <asm/cpu-features.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/hazards.h>
+#include <asm/mipsregs.h>
+#define DSP_DEFAULT 0x00000000
+#define DSP_MASK 0x3ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __enable_dsp_hazard()  do {   asm("_ehb");  } while (0)
+#define __save_dsp(tsk)  do {   tsk->thread.dsp.dspr[0] = mfhi1();   tsk->thread.dsp.dspr[1] = mflo1();   tsk->thread.dsp.dspr[2] = mfhi2();   tsk->thread.dsp.dspr[3] = mflo2();   tsk->thread.dsp.dspr[4] = mfhi3();   tsk->thread.dsp.dspr[5] = mflo3();   tsk->thread.dsp.dspcontrol = rddsp(DSP_MASK);  } while (0)
+#define save_dsp(tsk)  do {   if (cpu_has_dsp)   __save_dsp(tsk);  } while (0)
+#define __restore_dsp(tsk)  do {   mthi1(tsk->thread.dsp.dspr[0]);   mtlo1(tsk->thread.dsp.dspr[1]);   mthi2(tsk->thread.dsp.dspr[2]);   mtlo2(tsk->thread.dsp.dspr[3]);   mthi3(tsk->thread.dsp.dspr[4]);   mtlo3(tsk->thread.dsp.dspr[5]);   wrdsp(tsk->thread.dsp.dspcontrol, DSP_MASK);  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define restore_dsp(tsk)  do {   if (cpu_has_dsp)   __restore_dsp(tsk);  } while (0)
+#define __get_dsp_regs(tsk)  ({   if (tsk == current)   __save_dsp(current);     tsk->thread.dsp.dspr;  })
+#endif
diff --git a/libc/kernel/arch-mips/asm/elf.h b/libc/kernel/arch-mips/asm/elf.h
new file mode 100644
index 0000000..6ccb622
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/elf.h
@@ -0,0 +1,214 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ELF_H
+#define _ASM_ELF_H
+#define EF_MIPS_ARCH_1 0x00000000  
+#define EF_MIPS_ARCH_2 0x10000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_MIPS_ARCH_3 0x20000000  
+#define EF_MIPS_ARCH_4 0x30000000  
+#define EF_MIPS_ARCH_5 0x40000000  
+#define EF_MIPS_ARCH_32 0x50000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_MIPS_ARCH_64 0x60000000  
+#define EF_MIPS_ARCH_32R2 0x70000000  
+#define EF_MIPS_ARCH_64R2 0x80000000  
+#define EF_MIPS_ABI_O32 0x00001000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_MIPS_ABI_O64 0x00002000  
+#define PT_MIPS_REGINFO 0x70000000
+#define PT_MIPS_RTPROC 0x70000001
+#define PT_MIPS_OPTIONS 0x70000002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_MIPS_NOREORDER 0x00000001
+#define EF_MIPS_PIC 0x00000002
+#define EF_MIPS_CPIC 0x00000004
+#define EF_MIPS_ABI2 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_MIPS_OPTIONS_FIRST 0x00000080
+#define EF_MIPS_32BITMODE 0x00000100
+#define EF_MIPS_ABI 0x0000f000
+#define EF_MIPS_ARCH 0xf0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DT_MIPS_RLD_VERSION 0x70000001
+#define DT_MIPS_TIME_STAMP 0x70000002
+#define DT_MIPS_ICHECKSUM 0x70000003
+#define DT_MIPS_IVERSION 0x70000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DT_MIPS_FLAGS 0x70000005
+#define RHF_NONE 0x00000000
+#define RHF_HARDWAY 0x00000001
+#define RHF_NOTPOT 0x00000002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RHF_SGI_ONLY 0x00000010
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_CONFLICT 0x70000008
+#define DT_MIPS_LIBLIST 0x70000009
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DT_MIPS_LOCAL_GOTNO 0x7000000a
+#define DT_MIPS_CONFLICTNO 0x7000000b
+#define DT_MIPS_LIBLISTNO 0x70000010
+#define DT_MIPS_SYMTABNO 0x70000011
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DT_MIPS_UNREFEXTNO 0x70000012
+#define DT_MIPS_GOTSYM 0x70000013
+#define DT_MIPS_HIPAGENO 0x70000014
+#define DT_MIPS_RLD_MAP 0x70000016
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_NONE 0
+#define R_MIPS_16 1
+#define R_MIPS_32 2
+#define R_MIPS_REL32 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_26 4
+#define R_MIPS_HI16 5
+#define R_MIPS_LO16 6
+#define R_MIPS_GPREL16 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_LITERAL 8
+#define R_MIPS_GOT16 9
+#define R_MIPS_PC16 10
+#define R_MIPS_CALL16 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_GPREL32 12
+#define R_MIPS_UNUSED1 13
+#define R_MIPS_UNUSED2 14
+#define R_MIPS_UNUSED3 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
+#define R_MIPS_64 18
+#define R_MIPS_GOT_DISP 19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+#define R_MIPS_GOTHI16 22
+#define R_MIPS_GOTLO16 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_SUB 24
+#define R_MIPS_INSERT_A 25
+#define R_MIPS_INSERT_B 26
+#define R_MIPS_DELETE 27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_HIGHER 28
+#define R_MIPS_HIGHEST 29
+#define R_MIPS_CALLHI16 30
+#define R_MIPS_CALLLO16 31
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R_MIPS_LOVENDOR 100
+#define R_MIPS_HIVENDOR 127
+#define SHN_MIPS_ACCOMON 0xff00  
+#define SHN_MIPS_TEXT 0xff01  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHN_MIPS_DATA 0xff02  
+#define SHN_MIPS_SCOMMON 0xff03  
+#define SHN_MIPS_SUNDEFINED 0xff04  
+#define SHT_MIPS_LIST 0x70000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_CONFLICT 0x70000002
+#define SHT_MIPS_GPTAB 0x70000003
+#define SHT_MIPS_UCODE 0x70000004
+#define SHT_MIPS_DEBUG 0x70000005
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_REGINFO 0x70000006
+#define SHT_MIPS_PACKAGE 0x70000007
+#define SHT_MIPS_PACKSYM 0x70000008
+#define SHT_MIPS_RELD 0x70000009
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_IFACE 0x7000000b
+#define SHT_MIPS_CONTENT 0x7000000c
+#define SHT_MIPS_OPTIONS 0x7000000d
+#define SHT_MIPS_SHDR 0x70000010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_FDESC 0x70000011
+#define SHT_MIPS_EXTSYM 0x70000012
+#define SHT_MIPS_DENSE 0x70000013
+#define SHT_MIPS_PDESC 0x70000014
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_LOCSYM 0x70000015
+#define SHT_MIPS_AUXSYM 0x70000016
+#define SHT_MIPS_OPTSYM 0x70000017
+#define SHT_MIPS_LOCSTR 0x70000018
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_LINE 0x70000019
+#define SHT_MIPS_RFDESC 0x7000001a
+#define SHT_MIPS_DELTASYM 0x7000001b
+#define SHT_MIPS_DELTAINST 0x7000001c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_DELTACLASS 0x7000001d
+#define SHT_MIPS_DWARF 0x7000001e
+#define SHT_MIPS_DELTADECL 0x7000001f
+#define SHT_MIPS_SYMBOL_LIB 0x70000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_EVENTS 0x70000021
+#define SHT_MIPS_TRANSLATE 0x70000022
+#define SHT_MIPS_PIXIE 0x70000023
+#define SHT_MIPS_XLATE 0x70000024
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_XLATE_DEBUG 0x70000025
+#define SHT_MIPS_WHIRL 0x70000026
+#define SHT_MIPS_EH_REGION 0x70000027
+#define SHT_MIPS_XLATE_OLD 0x70000028
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+#define SHF_MIPS_GPREL 0x10000000
+#define SHF_MIPS_MERGE 0x20000000
+#define SHF_MIPS_ADDR 0x40000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHF_MIPS_STRING 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL 0x04000000
+#define SHF_MIPS_NAMES 0x02000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHF_MIPS_NODUPES 0x01000000
+#ifndef ELF_ARCH
+#define ELF_NGREG 45
+#define ELF_NFPREG 33
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __MIPSEB__
+#define ELF_DATA ELFDATA2MSB
+#elif __MIPSEL__
+#define ELF_DATA ELFDATA2LSB
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define ELF_ARCH EM_MIPS
+#endif
+struct mips_abi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct task_struct;
+#define ELF_CORE_COPY_REGS(elf_regs, regs)   elf_dump_regs((elf_greg_t *)&(elf_regs), regs);
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs)   dump_task_fpu(tsk, elf_fpregs)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE PAGE_SIZE
+#define ELF_HWCAP (0)
+#define ELF_PLATFORM (NULL)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ELF_PLAT_INIT(_r, load_addr) do {   _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0;   _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0;   _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0;   _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0;   _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0;   _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0;   _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0;   _r->regs[30] = _r->regs[31] = 0;  } while (0)
+#ifndef ELF_ET_DYN_BASE
+#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/errno.h b/libc/kernel/arch-mips/asm/errno.h
new file mode 100644
index 0000000..f8ba438
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/errno.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ERRNO_H
+#define _ASM_ERRNO_H
+#include <asm-generic/errno-base.h>
+#define ENOMSG 35  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EIDRM 36  
+#define ECHRNG 37  
+#define EL2NSYNC 38  
+#define EL3HLT 39  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EL3RST 40  
+#define ELNRNG 41  
+#define EUNATCH 42  
+#define ENOCSI 43  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EL2HLT 44  
+#define EDEADLK 45  
+#define ENOLCK 46  
+#define EBADE 50  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EBADR 51  
+#define EXFULL 52  
+#define ENOANO 53  
+#define EBADRQC 54  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EBADSLT 55  
+#define EDEADLOCK 56  
+#define EBFONT 59  
+#define ENOSTR 60  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENODATA 61  
+#define ETIME 62  
+#define ENOSR 63  
+#define ENONET 64  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENOPKG 65  
+#define EREMOTE 66  
+#define ENOLINK 67  
+#define EADV 68  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ESRMNT 69  
+#define ECOMM 70  
+#define EPROTO 71  
+#define EDOTDOT 73  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EMULTIHOP 74  
+#define EBADMSG 77  
+#define ENAMETOOLONG 78  
+#define EOVERFLOW 79  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENOTUNIQ 80  
+#define EBADFD 81  
+#define EREMCHG 82  
+#define ELIBACC 83  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ELIBBAD 84  
+#define ELIBSCN 85  
+#define ELIBMAX 86  
+#define ELIBEXEC 87  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EILSEQ 88  
+#define ENOSYS 89  
+#define ELOOP 90  
+#define ERESTART 91  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ESTRPIPE 92  
+#define ENOTEMPTY 93  
+#define EUSERS 94  
+#define ENOTSOCK 95  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EDESTADDRREQ 96  
+#define EMSGSIZE 97  
+#define EPROTOTYPE 98  
+#define ENOPROTOOPT 99  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EPROTONOSUPPORT 120  
+#define ESOCKTNOSUPPORT 121  
+#define EOPNOTSUPP 122  
+#define EPFNOSUPPORT 123  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EAFNOSUPPORT 124  
+#define EADDRINUSE 125  
+#define EADDRNOTAVAIL 126  
+#define ENETDOWN 127  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENETUNREACH 128  
+#define ENETRESET 129  
+#define ECONNABORTED 130  
+#define ECONNRESET 131  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENOBUFS 132  
+#define EISCONN 133  
+#define ENOTCONN 134  
+#define EUCLEAN 135  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENOTNAM 137  
+#define ENAVAIL 138  
+#define EISNAM 139  
+#define EREMOTEIO 140  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EINIT 141  
+#define EREMDEV 142  
+#define ESHUTDOWN 143  
+#define ETOOMANYREFS 144  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETIMEDOUT 145  
+#define ECONNREFUSED 146  
+#define EHOSTDOWN 147  
+#define EHOSTUNREACH 148  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EWOULDBLOCK EAGAIN  
+#define EALREADY 149  
+#define EINPROGRESS 150  
+#define ESTALE 151  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ECANCELED 158  
+#define ENOMEDIUM 159  
+#define EMEDIUMTYPE 160  
+#define ENOKEY 161  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EKEYEXPIRED 162  
+#define EKEYREVOKED 163  
+#define EKEYREJECTED 164  
+#define EOWNERDEAD 165  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ENOTRECOVERABLE 166  
+#define EDQUOT 1133  
+#endif
diff --git a/libc/kernel/arch-mips/asm/fcntl.h b/libc/kernel/arch-mips/asm/fcntl.h
new file mode 100644
index 0000000..2686340
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/fcntl.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_FCNTL_H
+#define _ASM_FCNTL_H
+#define O_APPEND 0x0008
+#define O_SYNC 0x0010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define O_NONBLOCK 0x0080
+#define O_CREAT 0x0100  
+#define O_TRUNC 0x0200  
+#define O_EXCL 0x0400  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define O_NOCTTY 0x0800  
+#define FASYNC 0x1000  
+#define O_LARGEFILE 0x2000  
+#define O_DIRECT 0x8000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define F_GETLK 14
+#define F_SETLK 6
+#define F_SETLKW 7
+#define F_SETOWN 24  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define F_GETOWN 23  
+#ifndef __mips64
+#define F_GETLK64 33  
+#define F_SETLK64 34
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define F_SETLKW64 35
+#endif
+#include <asm-generic/fcntl.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/fixmap.h b/libc/kernel/arch-mips/asm/fixmap.h
similarity index 64%
rename from libc/kernel/arch-sh/asm/fixmap.h
rename to libc/kernel/arch-mips/asm/fixmap.h
index 3f7b948..659d51d 100644
--- a/libc/kernel/arch-sh/asm/fixmap.h
+++ b/libc/kernel/arch-mips/asm/fixmap.h
@@ -7,31 +7,30 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _ASM_FIXMAP_H
 #define _ASM_FIXMAP_H
-
-#include <linux/kernel.h>
 #include <asm/page.h>
-
 enum fixed_addresses {
-#define FIX_N_COLOURS 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FIX_N_COLOURS 8
  FIX_CMAP_BEGIN,
  FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
- FIX_UNCACHED,
  __end_of_fixed_addresses
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
-
-#define set_fixmap(idx, phys)   __set_fixmap(idx, phys, PAGE_KERNEL)
-
-#define set_fixmap_nocache(idx, phys)   __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
-
-#define FIXADDR_TOP (P4SEG - PAGE_SIZE)
+#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
-
 #endif
diff --git a/libc/kernel/arch-mips/asm/floppy.h b/libc/kernel/arch-mips/asm/floppy.h
new file mode 100644
index 0000000..769b3f9
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/floppy.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_FLOPPY_H
+#define _ASM_FLOPPY_H
+#include <linux/dma-mapping.h>
+#define MAX_BUFFER_SECTORS 24
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FLOPPY0_TYPE fd_drive_type(0)
+#define FLOPPY1_TYPE fd_drive_type(1)
+#define FDC1 fd_getfdaddr1();
+#define N_FDC 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define N_DRIVE 8
+#define CROSS_64KB(a, s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
+#define EXTRA_FLOPPY_PARAMS
+#include <floppy.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/fpregdef.h b/libc/kernel/arch-mips/asm/fpregdef.h
new file mode 100644
index 0000000..046f750
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/fpregdef.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_FPREGDEF_H
+#define _ASM_FPREGDEF_H
+#include <asm/sgidefs.h>
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fv0 $f0  
+#define fv0f $f1
+#define fv1 $f2
+#define fv1f $f3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fa0 $f12  
+#define fa0f $f13
+#define fa1 $f14
+#define fa1f $f15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ft0 $f4  
+#define ft0f $f5
+#define ft1 $f6
+#define ft1f $f7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ft2 $f8
+#define ft2f $f9
+#define ft3 $f10
+#define ft3f $f11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ft4 $f16
+#define ft4f $f17
+#define ft5 $f18
+#define ft5f $f19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fs0 $f20  
+#define fs0f $f21
+#define fs1 $f22
+#define fs1f $f23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fs2 $f24
+#define fs2f $f25
+#define fs3 $f26
+#define fs3f $f27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fs4 $f28
+#define fs4f $f29
+#define fs5 $f30
+#define fs5f $f31
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fcr31 $31  
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#define fv0 $f0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fv1 $f2
+#define fa0 $f12  
+#define fa1 $f13
+#define fa2 $f14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fa3 $f15
+#define fa4 $f16
+#define fa5 $f17
+#define fa6 $f18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fa7 $f19
+#define ft0 $f4  
+#define ft1 $f5
+#define ft2 $f6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ft3 $f7
+#define ft4 $f8
+#define ft5 $f9
+#define ft6 $f10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ft7 $f11
+#define ft8 $f20
+#define ft9 $f21
+#define ft10 $f22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ft11 $f23
+#define ft12 $f1
+#define ft13 $f3
+#define fs0 $f24  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fs1 $f25
+#define fs2 $f26
+#define fs3 $f27
+#define fs4 $f28
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define fs5 $f29
+#define fs6 $f30
+#define fs7 $f31
+#define fcr31 $31
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/fw/arc/types.h b/libc/kernel/arch-mips/asm/fw/arc/types.h
new file mode 100644
index 0000000..62f89f8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/fw/arc/types.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ARC_TYPES_H
+#define _ASM_ARC_TYPES_H
+typedef CHAR *PCHAR;
+typedef SHORT *PSHORT;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef LARGE_INTEGER *PLARGE_INTEGER;
+typedef LONG *PLONG;
+typedef UCHAR *PUCHAR;
+typedef USHORT *PUSHORT;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef ULONG *PULONG;
+typedef VOID *PVOID;
+typedef struct {
+ USHORT CursorXPosition;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ USHORT CursorYPosition;
+ USHORT CursorMaxXPosition;
+ USHORT CursorMaxYPosition;
+ USHORT ForegroundColor;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ USHORT BackgroundColor;
+ UCHAR HighIntensity;
+ UCHAR Underscored;
+ UCHAR ReverseVideo;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} DISPLAY_STATUS;
+#endif
diff --git a/libc/kernel/arch-mips/asm/gt64120.h b/libc/kernel/arch-mips/asm/gt64120.h
new file mode 100644
index 0000000..d4cda0d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/gt64120.h
@@ -0,0 +1,530 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_GT64120_H
+#define _ASM_GT64120_H
+#include <linux/clocksource.h>
+#include <asm/addrspace.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/byteorder.h>
+#define MSK(n) ((1 << (n)) - 1)
+#define GT_CPU_OFS 0x000
+#define GT_MULTI_OFS 0x120
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SCS10LD_OFS 0x008
+#define GT_SCS10HD_OFS 0x010
+#define GT_SCS32LD_OFS 0x018
+#define GT_SCS32HD_OFS 0x020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CS20LD_OFS 0x028
+#define GT_CS20HD_OFS 0x030
+#define GT_CS3BOOTLD_OFS 0x038
+#define GT_CS3BOOTHD_OFS 0x040
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0IOLD_OFS 0x048
+#define GT_PCI0IOHD_OFS 0x050
+#define GT_PCI0M0LD_OFS 0x058
+#define GT_PCI0M0HD_OFS 0x060
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_ISD_OFS 0x068
+#define GT_PCI0M1LD_OFS 0x080
+#define GT_PCI0M1HD_OFS 0x088
+#define GT_PCI1IOLD_OFS 0x090
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1IOHD_OFS 0x098
+#define GT_PCI1M0LD_OFS 0x0a0
+#define GT_PCI1M0HD_OFS 0x0a8
+#define GT_PCI1M1LD_OFS 0x0b0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1M1HD_OFS 0x0b8
+#define GT_PCI1M1LD_OFS 0x0b0
+#define GT_PCI1M1HD_OFS 0x0b8
+#define GT_SCS10AR_OFS 0x0d0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SCS32AR_OFS 0x0d8
+#define GT_CS20R_OFS 0x0e0
+#define GT_CS3BOOTR_OFS 0x0e8
+#define GT_PCI0IOREMAP_OFS 0x0f0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0M0REMAP_OFS 0x0f8
+#define GT_PCI0M1REMAP_OFS 0x100
+#define GT_PCI1IOREMAP_OFS 0x108
+#define GT_PCI1M0REMAP_OFS 0x110
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1M1REMAP_OFS 0x118
+#define GT_CPUERR_ADDRLO_OFS 0x070
+#define GT_CPUERR_ADDRHI_OFS 0x078
+#define GT_CPUERR_DATALO_OFS 0x128  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CPUERR_DATAHI_OFS 0x130  
+#define GT_CPUERR_PARITY_OFS 0x138  
+#define GT_PCI0SYNC_OFS 0x0c0
+#define GT_PCI1SYNC_OFS 0x0c8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SCS0LD_OFS 0x400
+#define GT_SCS0HD_OFS 0x404
+#define GT_SCS1LD_OFS 0x408
+#define GT_SCS1HD_OFS 0x40c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SCS2LD_OFS 0x410
+#define GT_SCS2HD_OFS 0x414
+#define GT_SCS3LD_OFS 0x418
+#define GT_SCS3HD_OFS 0x41c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CS0LD_OFS 0x420
+#define GT_CS0HD_OFS 0x424
+#define GT_CS1LD_OFS 0x428
+#define GT_CS1HD_OFS 0x42c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CS2LD_OFS 0x430
+#define GT_CS2HD_OFS 0x434
+#define GT_CS3LD_OFS 0x438
+#define GT_CS3HD_OFS 0x43c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_BOOTLD_OFS 0x440
+#define GT_BOOTHD_OFS 0x444
+#define GT_ADERR_OFS 0x470
+#define GT_SDRAM_CFG_OFS 0x448
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_OPMODE_OFS 0x474
+#define GT_SDRAM_BM_OFS 0x478
+#define GT_SDRAM_ADDRDECODE_OFS 0x47c
+#define GT_SDRAM_B0_OFS 0x44c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B1_OFS 0x450
+#define GT_SDRAM_B2_OFS 0x454
+#define GT_SDRAM_B3_OFS 0x458
+#define GT_DEV_B0_OFS 0x45c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DEV_B1_OFS 0x460
+#define GT_DEV_B2_OFS 0x464
+#define GT_DEV_B3_OFS 0x468
+#define GT_DEV_BOOT_OFS 0x46c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_ECC_ERRDATALO 0x480  
+#define GT_ECC_ERRDATAHI 0x484  
+#define GT_ECC_MEM 0x488  
+#define GT_ECC_CALC 0x48c  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_ECC_ERRADDR 0x490  
+#define GT_DMA0_CNT_OFS 0x800
+#define GT_DMA1_CNT_OFS 0x804
+#define GT_DMA2_CNT_OFS 0x808
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DMA3_CNT_OFS 0x80c
+#define GT_DMA0_SA_OFS 0x810
+#define GT_DMA1_SA_OFS 0x814
+#define GT_DMA2_SA_OFS 0x818
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DMA3_SA_OFS 0x81c
+#define GT_DMA0_DA_OFS 0x820
+#define GT_DMA1_DA_OFS 0x824
+#define GT_DMA2_DA_OFS 0x828
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DMA3_DA_OFS 0x82c
+#define GT_DMA0_NEXT_OFS 0x830
+#define GT_DMA1_NEXT_OFS 0x834
+#define GT_DMA2_NEXT_OFS 0x838
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DMA3_NEXT_OFS 0x83c
+#define GT_DMA0_CUR_OFS 0x870
+#define GT_DMA1_CUR_OFS 0x874
+#define GT_DMA2_CUR_OFS 0x878
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DMA3_CUR_OFS 0x87c
+#define GT_DMA0_CTRL_OFS 0x840
+#define GT_DMA1_CTRL_OFS 0x844
+#define GT_DMA2_CTRL_OFS 0x848
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DMA3_CTRL_OFS 0x84c
+#define GT_DMA_ARB_OFS 0x860
+#define GT_TC0_OFS 0x850
+#define GT_TC1_OFS 0x854
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_TC2_OFS 0x858
+#define GT_TC3_OFS 0x85c
+#define GT_TC_CONTROL_OFS 0x864
+#define GT_PCI0_CMD_OFS 0xc00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_TOR_OFS 0xc04
+#define GT_PCI0_BS_SCS10_OFS 0xc08
+#define GT_PCI0_BS_SCS32_OFS 0xc0c
+#define GT_PCI0_BS_CS20_OFS 0xc10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BS_CS3BT_OFS 0xc14
+#define GT_PCI1_IACK_OFS 0xc30
+#define GT_PCI0_IACK_OFS 0xc34
+#define GT_PCI0_BARE_OFS 0xc3c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_PREFMBR_OFS 0xc40
+#define GT_PCI0_SCS10_BAR_OFS 0xc48
+#define GT_PCI0_SCS32_BAR_OFS 0xc4c
+#define GT_PCI0_CS20_BAR_OFS 0xc50
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CS3BT_BAR_OFS 0xc54
+#define GT_PCI0_SSCS10_BAR_OFS 0xc58
+#define GT_PCI0_SSCS32_BAR_OFS 0xc5c
+#define GT_PCI0_SCS3BT_BAR_OFS 0xc64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1_CMD_OFS 0xc80
+#define GT_PCI1_TOR_OFS 0xc84
+#define GT_PCI1_BS_SCS10_OFS 0xc88
+#define GT_PCI1_BS_SCS32_OFS 0xc8c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1_BS_CS20_OFS 0xc90
+#define GT_PCI1_BS_CS3BT_OFS 0xc94
+#define GT_PCI1_BARE_OFS 0xcbc
+#define GT_PCI1_PREFMBR_OFS 0xcc0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1_SCS10_BAR_OFS 0xcc8
+#define GT_PCI1_SCS32_BAR_OFS 0xccc
+#define GT_PCI1_CS20_BAR_OFS 0xcd0
+#define GT_PCI1_CS3BT_BAR_OFS 0xcd4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1_SSCS10_BAR_OFS 0xcd8
+#define GT_PCI1_SSCS32_BAR_OFS 0xcdc
+#define GT_PCI1_SCS3BT_BAR_OFS 0xce4
+#define GT_PCI1_CFGADDR_OFS 0xcf0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1_CFGDATA_OFS 0xcf4
+#define GT_PCI0_CFGADDR_OFS 0xcf8
+#define GT_PCI0_CFGDATA_OFS 0xcfc
+#define GT_INTRCAUSE_OFS 0xc18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_INTRMASK_OFS 0xc1c
+#define GT_PCI0_ICMASK_OFS 0xc24
+#define GT_PCI0_SERR0MASK_OFS 0xc28
+#define GT_CPU_INTSEL_OFS 0xc70
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_INTSEL_OFS 0xc74
+#define GT_HINTRCAUSE_OFS 0xc98
+#define GT_HINTRMASK_OFS 0xc9c
+#define GT_PCI0_HICMASK_OFS 0xca4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI1_SERR1MASK_OFS 0xca8
+#define INBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x010
+#define INBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x014
+#define OUTBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x018
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OUTBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x01c
+#define INBOUND_DOORBELL_REGISTER_PCI_SIDE 0x020
+#define INBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x024
+#define INBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x028
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OUTBOUND_DOORBELL_REGISTER_PCI_SIDE 0x02c
+#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x030
+#define OUTBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x034
+#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x040
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x044
+#define QUEUE_CONTROL_REGISTER_PCI_SIDE 0x050
+#define QUEUE_BASE_ADDRESS_REGISTER_PCI_SIDE 0x054
+#define INBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x060
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x064
+#define INBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x068
+#define INBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x06c
+#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x070
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x074
+#define OUTBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x078
+#define OUTBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x07c
+#define INBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c14
+#define OUTBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c18
+#define OUTBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c1c
+#define INBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c24
+#define INBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c28
+#define OUTBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c2c
+#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OUTBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c34
+#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c40
+#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c44
+#define QUEUE_CONTROL_REGISTER_CPU_SIDE 0x1c50
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define QUEUE_BASE_ADDRESS_REGISTER_CPU_SIDE 0x1c54
+#define INBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c60
+#define INBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c64
+#define INBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c68
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c6c
+#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c70
+#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c74
+#define OUTBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c78
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OUTBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c7c
+#define GT_CPU_ENDIAN_SHF 12
+#define GT_CPU_ENDIAN_MSK (MSK(1) << GT_CPU_ENDIAN_SHF)
+#define GT_CPU_ENDIAN_BIT GT_CPU_ENDIAN_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CPU_WR_SHF 16
+#define GT_CPU_WR_MSK (MSK(1) << GT_CPU_WR_SHF)
+#define GT_CPU_WR_BIT GT_CPU_WR_MSK
+#define GT_CPU_WR_DXDXDXDX 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CPU_WR_DDDD 1
+#define GT_PCI_DCRM_SHF 21
+#define GT_PCI_LD_SHF 0
+#define GT_PCI_LD_MSK (MSK(15) << GT_PCI_LD_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI_HD_SHF 0
+#define GT_PCI_HD_MSK (MSK(7) << GT_PCI_HD_SHF)
+#define GT_PCI_REMAP_SHF 0
+#define GT_PCI_REMAP_MSK (MSK(11) << GT_PCI_REMAP_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CFGADDR_CFGEN_SHF 31
+#define GT_CFGADDR_CFGEN_MSK (MSK(1) << GT_CFGADDR_CFGEN_SHF)
+#define GT_CFGADDR_CFGEN_BIT GT_CFGADDR_CFGEN_MSK
+#define GT_CFGADDR_BUSNUM_SHF 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CFGADDR_BUSNUM_MSK (MSK(8) << GT_CFGADDR_BUSNUM_SHF)
+#define GT_CFGADDR_DEVNUM_SHF 11
+#define GT_CFGADDR_DEVNUM_MSK (MSK(5) << GT_CFGADDR_DEVNUM_SHF)
+#define GT_CFGADDR_FUNCNUM_SHF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_CFGADDR_FUNCNUM_MSK (MSK(3) << GT_CFGADDR_FUNCNUM_SHF)
+#define GT_CFGADDR_REGNUM_SHF 2
+#define GT_CFGADDR_REGNUM_MSK (MSK(6) << GT_CFGADDR_REGNUM_SHF)
+#define GT_SDRAM_BM_ORDER_SHF 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_BM_ORDER_MSK (MSK(1) << GT_SDRAM_BM_ORDER_SHF)
+#define GT_SDRAM_BM_ORDER_BIT GT_SDRAM_BM_ORDER_MSK
+#define GT_SDRAM_BM_ORDER_SUB 1
+#define GT_SDRAM_BM_ORDER_LIN 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_BM_RSVD_ALL1 0xffb
+#define GT_SDRAM_ADDRDECODE_ADDR_SHF 0
+#define GT_SDRAM_ADDRDECODE_ADDR_MSK (MSK(3) << GT_SDRAM_ADDRDECODE_ADDR_SHF)
+#define GT_SDRAM_ADDRDECODE_ADDR_0 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_ADDRDECODE_ADDR_1 1
+#define GT_SDRAM_ADDRDECODE_ADDR_2 2
+#define GT_SDRAM_ADDRDECODE_ADDR_3 3
+#define GT_SDRAM_ADDRDECODE_ADDR_4 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_ADDRDECODE_ADDR_5 5
+#define GT_SDRAM_ADDRDECODE_ADDR_6 6
+#define GT_SDRAM_ADDRDECODE_ADDR_7 7
+#define GT_SDRAM_B0_CASLAT_SHF 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_CASLAT_MSK (MSK(2) << GT_SDRAM_B0__SHF)
+#define GT_SDRAM_B0_CASLAT_2 1
+#define GT_SDRAM_B0_CASLAT_3 2
+#define GT_SDRAM_B0_FTDIS_SHF 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_FTDIS_MSK (MSK(1) << GT_SDRAM_B0_FTDIS_SHF)
+#define GT_SDRAM_B0_FTDIS_BIT GT_SDRAM_B0_FTDIS_MSK
+#define GT_SDRAM_B0_SRASPRCHG_SHF 3
+#define GT_SDRAM_B0_SRASPRCHG_MSK (MSK(1) << GT_SDRAM_B0_SRASPRCHG_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_SRASPRCHG_BIT GT_SDRAM_B0_SRASPRCHG_MSK
+#define GT_SDRAM_B0_SRASPRCHG_2 0
+#define GT_SDRAM_B0_SRASPRCHG_3 1
+#define GT_SDRAM_B0_B0COMPAB_SHF 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_B0COMPAB_MSK (MSK(1) << GT_SDRAM_B0_B0COMPAB_SHF)
+#define GT_SDRAM_B0_B0COMPAB_BIT GT_SDRAM_B0_B0COMPAB_MSK
+#define GT_SDRAM_B0_64BITINT_SHF 5
+#define GT_SDRAM_B0_64BITINT_MSK (MSK(1) << GT_SDRAM_B0_64BITINT_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_64BITINT_BIT GT_SDRAM_B0_64BITINT_MSK
+#define GT_SDRAM_B0_64BITINT_2 0
+#define GT_SDRAM_B0_64BITINT_4 1
+#define GT_SDRAM_B0_BW_SHF 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_BW_MSK (MSK(1) << GT_SDRAM_B0_BW_SHF)
+#define GT_SDRAM_B0_BW_BIT GT_SDRAM_B0_BW_MSK
+#define GT_SDRAM_B0_BW_32 0
+#define GT_SDRAM_B0_BW_64 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_BLODD_SHF 7
+#define GT_SDRAM_B0_BLODD_MSK (MSK(1) << GT_SDRAM_B0_BLODD_SHF)
+#define GT_SDRAM_B0_BLODD_BIT GT_SDRAM_B0_BLODD_MSK
+#define GT_SDRAM_B0_PAR_SHF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_PAR_MSK (MSK(1) << GT_SDRAM_B0_PAR_SHF)
+#define GT_SDRAM_B0_PAR_BIT GT_SDRAM_B0_PAR_MSK
+#define GT_SDRAM_B0_BYPASS_SHF 9
+#define GT_SDRAM_B0_BYPASS_MSK (MSK(1) << GT_SDRAM_B0_BYPASS_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_BYPASS_BIT GT_SDRAM_B0_BYPASS_MSK
+#define GT_SDRAM_B0_SRAS2SCAS_SHF 10
+#define GT_SDRAM_B0_SRAS2SCAS_MSK (MSK(1) << GT_SDRAM_B0_SRAS2SCAS_SHF)
+#define GT_SDRAM_B0_SRAS2SCAS_BIT GT_SDRAM_B0_SRAS2SCAS_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_SRAS2SCAS_2 0
+#define GT_SDRAM_B0_SRAS2SCAS_3 1
+#define GT_SDRAM_B0_SIZE_SHF 11
+#define GT_SDRAM_B0_SIZE_MSK (MSK(1) << GT_SDRAM_B0_SIZE_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_SIZE_BIT GT_SDRAM_B0_SIZE_MSK
+#define GT_SDRAM_B0_SIZE_16M 0
+#define GT_SDRAM_B0_SIZE_64M 1
+#define GT_SDRAM_B0_EXTPAR_SHF 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_EXTPAR_MSK (MSK(1) << GT_SDRAM_B0_EXTPAR_SHF)
+#define GT_SDRAM_B0_EXTPAR_BIT GT_SDRAM_B0_EXTPAR_MSK
+#define GT_SDRAM_B0_BLEN_SHF 13
+#define GT_SDRAM_B0_BLEN_MSK (MSK(1) << GT_SDRAM_B0_BLEN_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_B0_BLEN_BIT GT_SDRAM_B0_BLEN_MSK
+#define GT_SDRAM_B0_BLEN_8 0
+#define GT_SDRAM_B0_BLEN_4 1
+#define GT_SDRAM_CFG_REFINT_SHF 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_CFG_REFINT_MSK (MSK(14) << GT_SDRAM_CFG_REFINT_SHF)
+#define GT_SDRAM_CFG_NINTERLEAVE_SHF 14
+#define GT_SDRAM_CFG_NINTERLEAVE_MSK (MSK(1) << GT_SDRAM_CFG_NINTERLEAVE_SHF)
+#define GT_SDRAM_CFG_NINTERLEAVE_BIT GT_SDRAM_CFG_NINTERLEAVE_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_CFG_RMW_SHF 15
+#define GT_SDRAM_CFG_RMW_MSK (MSK(1) << GT_SDRAM_CFG_RMW_SHF)
+#define GT_SDRAM_CFG_RMW_BIT GT_SDRAM_CFG_RMW_MSK
+#define GT_SDRAM_CFG_NONSTAGREF_SHF 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_CFG_NONSTAGREF_MSK (MSK(1) << GT_SDRAM_CFG_NONSTAGREF_SHF)
+#define GT_SDRAM_CFG_NONSTAGREF_BIT GT_SDRAM_CFG_NONSTAGREF_MSK
+#define GT_SDRAM_CFG_DUPCNTL_SHF 19
+#define GT_SDRAM_CFG_DUPCNTL_MSK (MSK(1) << GT_SDRAM_CFG_DUPCNTL_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_CFG_DUPCNTL_BIT GT_SDRAM_CFG_DUPCNTL_MSK
+#define GT_SDRAM_CFG_DUPBA_SHF 20
+#define GT_SDRAM_CFG_DUPBA_MSK (MSK(1) << GT_SDRAM_CFG_DUPBA_SHF)
+#define GT_SDRAM_CFG_DUPBA_BIT GT_SDRAM_CFG_DUPBA_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_CFG_DUPEOT0_SHF 21
+#define GT_SDRAM_CFG_DUPEOT0_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT0_SHF)
+#define GT_SDRAM_CFG_DUPEOT0_BIT GT_SDRAM_CFG_DUPEOT0_MSK
+#define GT_SDRAM_CFG_DUPEOT1_SHF 22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_CFG_DUPEOT1_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT1_SHF)
+#define GT_SDRAM_CFG_DUPEOT1_BIT GT_SDRAM_CFG_DUPEOT1_MSK
+#define GT_SDRAM_OPMODE_OP_SHF 0
+#define GT_SDRAM_OPMODE_OP_MSK (MSK(3) << GT_SDRAM_OPMODE_OP_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_OPMODE_OP_NORMAL 0
+#define GT_SDRAM_OPMODE_OP_NOP 1
+#define GT_SDRAM_OPMODE_OP_PRCHG 2
+#define GT_SDRAM_OPMODE_OP_MODE 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_SDRAM_OPMODE_OP_CBR 4
+#define GT_TC_CONTROL_ENTC0_SHF 0
+#define GT_TC_CONTROL_ENTC0_MSK (MSK(1) << GT_TC_CONTROL_ENTC0_SHF)
+#define GT_TC_CONTROL_ENTC0_BIT GT_TC_CONTROL_ENTC0_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_TC_CONTROL_SELTC0_SHF 1
+#define GT_TC_CONTROL_SELTC0_MSK (MSK(1) << GT_TC_CONTROL_SELTC0_SHF)
+#define GT_TC_CONTROL_SELTC0_BIT GT_TC_CONTROL_SELTC0_MSK
+#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF)
+#define GT_PCI0_BARE_SWSCS3BOOTDIS_BIT GT_PCI0_BARE_SWSCS3BOOTDIS_MSK
+#define GT_PCI0_BARE_SWSCS32DIS_SHF 1
+#define GT_PCI0_BARE_SWSCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS32DIS_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_SWSCS32DIS_BIT GT_PCI0_BARE_SWSCS32DIS_MSK
+#define GT_PCI0_BARE_SWSCS10DIS_SHF 2
+#define GT_PCI0_BARE_SWSCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS10DIS_SHF)
+#define GT_PCI0_BARE_SWSCS10DIS_BIT GT_PCI0_BARE_SWSCS10DIS_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_INTIODIS_SHF 3
+#define GT_PCI0_BARE_INTIODIS_MSK (MSK(1) << GT_PCI0_BARE_INTIODIS_SHF)
+#define GT_PCI0_BARE_INTIODIS_BIT GT_PCI0_BARE_INTIODIS_MSK
+#define GT_PCI0_BARE_INTMEMDIS_SHF 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_INTMEMDIS_MSK (MSK(1) << GT_PCI0_BARE_INTMEMDIS_SHF)
+#define GT_PCI0_BARE_INTMEMDIS_BIT GT_PCI0_BARE_INTMEMDIS_MSK
+#define GT_PCI0_BARE_CS3BOOTDIS_SHF 5
+#define GT_PCI0_BARE_CS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_CS3BOOTDIS_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_CS3BOOTDIS_BIT GT_PCI0_BARE_CS3BOOTDIS_MSK
+#define GT_PCI0_BARE_CS20DIS_SHF 6
+#define GT_PCI0_BARE_CS20DIS_MSK (MSK(1) << GT_PCI0_BARE_CS20DIS_SHF)
+#define GT_PCI0_BARE_CS20DIS_BIT GT_PCI0_BARE_CS20DIS_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_SCS32DIS_SHF 7
+#define GT_PCI0_BARE_SCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS32DIS_SHF)
+#define GT_PCI0_BARE_SCS32DIS_BIT GT_PCI0_BARE_SCS32DIS_MSK
+#define GT_PCI0_BARE_SCS10DIS_SHF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_BARE_SCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS10DIS_SHF)
+#define GT_PCI0_BARE_SCS10DIS_BIT GT_PCI0_BARE_SCS10DIS_MSK
+#define GT_INTRCAUSE_MASABORT0_SHF 18
+#define GT_INTRCAUSE_MASABORT0_MSK (MSK(1) << GT_INTRCAUSE_MASABORT0_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_INTRCAUSE_MASABORT0_BIT GT_INTRCAUSE_MASABORT0_MSK
+#define GT_INTRCAUSE_TARABORT0_SHF 19
+#define GT_INTRCAUSE_TARABORT0_MSK (MSK(1) << GT_INTRCAUSE_TARABORT0_SHF)
+#define GT_INTRCAUSE_TARABORT0_BIT GT_INTRCAUSE_TARABORT0_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CFGADDR_REGNUM_SHF 2
+#define GT_PCI0_CFGADDR_REGNUM_MSK (MSK(6) << GT_PCI0_CFGADDR_REGNUM_SHF)
+#define GT_PCI0_CFGADDR_FUNCTNUM_SHF 8
+#define GT_PCI0_CFGADDR_FUNCTNUM_MSK (MSK(3) << GT_PCI0_CFGADDR_FUNCTNUM_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CFGADDR_DEVNUM_SHF 11
+#define GT_PCI0_CFGADDR_DEVNUM_MSK (MSK(5) << GT_PCI0_CFGADDR_DEVNUM_SHF)
+#define GT_PCI0_CFGADDR_BUSNUM_SHF 16
+#define GT_PCI0_CFGADDR_BUSNUM_MSK (MSK(8) << GT_PCI0_CFGADDR_BUSNUM_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CFGADDR_CONFIGEN_SHF 31
+#define GT_PCI0_CFGADDR_CONFIGEN_MSK (MSK(1) << GT_PCI0_CFGADDR_CONFIGEN_SHF)
+#define GT_PCI0_CFGADDR_CONFIGEN_BIT GT_PCI0_CFGADDR_CONFIGEN_MSK
+#define GT_PCI0_CMD_MBYTESWAP_SHF 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CMD_MBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_MBYTESWAP_SHF)
+#define GT_PCI0_CMD_MBYTESWAP_BIT GT_PCI0_CMD_MBYTESWAP_MSK
+#define GT_PCI0_CMD_MWORDSWAP_SHF 10
+#define GT_PCI0_CMD_MWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_MWORDSWAP_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CMD_MWORDSWAP_BIT GT_PCI0_CMD_MWORDSWAP_MSK
+#define GT_PCI0_CMD_SBYTESWAP_SHF 16
+#define GT_PCI0_CMD_SBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_SBYTESWAP_SHF)
+#define GT_PCI0_CMD_SBYTESWAP_BIT GT_PCI0_CMD_SBYTESWAP_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_PCI0_CMD_SWORDSWAP_SHF 11
+#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF)
+#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK
+#define GT_INTR_T0EXP_SHF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_INTR_T0EXP_MSK (MSK(1) << GT_INTR_T0EXP_SHF)
+#define GT_INTR_T0EXP_BIT GT_INTR_T0EXP_MSK
+#define GT_INTR_RETRYCTR0_SHF 20
+#define GT_INTR_RETRYCTR0_MSK (MSK(1) << GT_INTR_RETRYCTR0_SHF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_INTR_RETRYCTR0_BIT GT_INTR_RETRYCTR0_MSK
+#define GT_DEF_PCI0_IO_BASE 0x10000000UL
+#define GT_DEF_PCI0_IO_SIZE 0x02000000UL
+#define GT_DEF_PCI0_MEM0_BASE 0x12000000UL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_DEF_PCI0_MEM0_SIZE 0x02000000UL
+#define GT_DEF_BASE 0x14000000UL
+#define GT_MAX_BANKSIZE (256 * 1024 * 1024)  
+#define GT_LATTIM_MIN 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <mach-gt64120.h>
+#define __GT_READ(ofs)   (*(volatile u32 *)(GT64120_BASE+(ofs)))
+#define __GT_WRITE(ofs, data)   do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
+#define GT_READ(ofs) le32_to_cpu(__GT_READ(ofs))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT_WRITE(ofs, data) __GT_WRITE(ofs, cpu_to_le32(data))
+#endif
diff --git a/libc/kernel/arch-sh/asm/hardirq.h b/libc/kernel/arch-mips/asm/hardirq.h
similarity index 62%
rename from libc/kernel/arch-sh/asm/hardirq.h
rename to libc/kernel/arch-mips/asm/hardirq.h
index 6d80d02..f3a05b4 100644
--- a/libc/kernel/arch-sh/asm/hardirq.h
+++ b/libc/kernel/arch-mips/asm/hardirq.h
@@ -7,18 +7,23 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_HARDIRQ_H
-#define __ASM_SH_HARDIRQ_H
-
+#ifndef _ASM_HARDIRQ_H
+#define _ASM_HARDIRQ_H
 #include <linux/threads.h>
 #include <linux/irq.h>
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 typedef struct {
  unsigned int __softirq_pending;
 } ____cacheline_aligned irq_cpustat_t;
-
 #include <linux/irq_cpustat.h>  
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/arch-mips/asm/hazards.h b/libc/kernel/arch-mips/asm/hazards.h
new file mode 100644
index 0000000..dc6b205
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/hazards.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_HAZARDS_H
+#define _ASM_HAZARDS_H
+#ifdef __ASSEMBLY__
+#define ASMMACRO(name, code...) .macro name; code; .endm
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#include <asm/cpu-features.h>
+#define ASMMACRO(name, code...)  __asm__(".macro " #name "; " #code "; .endm");    static inline void name(void)  {   __asm__ __volatile__ (#name);  }
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define instruction_hazard() do { } while (0)
+#endif
diff --git a/libc/kernel/arch-mips/asm/hw_irq.h b/libc/kernel/arch-mips/asm/hw_irq.h
new file mode 100644
index 0000000..60f0e7b
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/hw_irq.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_HW_IRQ_H
+#define __ASM_HW_IRQ_H
+#include <asm/atomic.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/i8253.h b/libc/kernel/arch-mips/asm/i8253.h
new file mode 100644
index 0000000..735d79f
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/i8253.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_I8253_H
+#define __ASM_I8253_H
+#include <linux/spinlock.h>
+#define PIT_MODE 0x43
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PIT_CH0 0x40
+#define PIT_CH2 0x42
+#define PIT_TICK_RATE 1193182UL
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/i8259.h b/libc/kernel/arch-mips/asm/i8259.h
new file mode 100644
index 0000000..a78521b
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/i8259.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_I8259_H
+#define _ASM_I8259_H
+#include <linux/compiler.h>
+#include <linux/spinlock.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/io.h>
+#include <irq.h>
+#define PIC_MASTER_CMD 0x20
+#define PIC_MASTER_IMR 0x21
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PIC_MASTER_ISR PIC_MASTER_CMD
+#define PIC_MASTER_POLL PIC_MASTER_ISR
+#define PIC_MASTER_OCW3 PIC_MASTER_ISR
+#define PIC_SLAVE_CMD 0xa0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PIC_SLAVE_IMR 0xa1
+#define PIC_CASCADE_IR 2
+#define MASTER_ICW4_DEFAULT 0x01
+#define SLAVE_ICW4_DEFAULT 0x01
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PIC_ICW4_AEOI 2
+#endif
diff --git a/libc/kernel/arch-sh/asm/atomic-irq.h b/libc/kernel/arch-mips/asm/ide.h
similarity index 60%
copy from libc/kernel/arch-sh/asm/atomic-irq.h
copy to libc/kernel/arch-mips/asm/ide.h
index b8f5eaf..aa45292 100644
--- a/libc/kernel/arch-sh/asm/atomic-irq.h
+++ b/libc/kernel/arch-mips/asm/ide.h
@@ -7,9 +7,17 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_IRQ_H
-#define __ASM_SH_ATOMIC_IRQ_H
-
+#ifndef __ASM_IDE_H
+#define __ASM_IDE_H
+#include <ide.h>
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/io.h b/libc/kernel/arch-mips/asm/io.h
new file mode 100644
index 0000000..b30e51a
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/io.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_IO_H
+#define _ASM_IO_H
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/types.h>
+#include <asm/addrspace.h>
+#include <asm/byteorder.h>
+#include <asm/cpu.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/cpu-features.h>
+#include <asm-generic/iomap.h>
+#include <asm/page.h>
+#include <asm/pgtable-bits.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/processor.h>
+#include <asm/string.h>
+#include <ioremap.h>
+#include <mangle-port.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#undef CONF_SLOWDOWN_IO
+#define __raw_ioswabb(a, x) (x)
+#define __raw_ioswabw(a, x) (x)
+#define __raw_ioswabl(a, x) (x)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __raw_ioswabq(a, x) (x)
+#define ____raw_ioswabq(a, x) (x)
+#define IO_SPACE_LIMIT 0xffff
+#define __SLOW_DOWN_IO   __asm__ __volatile__(   "sb\t$0,0x80(%0)"   : : "r" (mips_io_port_base));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef CONF_SLOWDOWN_IO
+#ifdef REALLY_SLOW_IO
+#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SLOW_DOWN_IO __SLOW_DOWN_IO
+#endif
+#else
+#define SLOW_DOWN_IO
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define isa_page_to_bus page_to_phys
+#define virt_to_bus virt_to_phys
+#define bus_to_virt phys_to_virt
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
+#define __IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
+#undef __IS_LOW512
+#define ioremap(offset, size)   __ioremap_mode((offset), (size), _CACHE_UNCACHED)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ioremap_nocache(offset, size)   __ioremap_mode((offset), (size), _CACHE_UNCACHED)
+#define ioremap_cachable(offset, size)   __ioremap_mode((offset), (size), _page_cachable_default)
+#define ioremap_cacheable_cow(offset, size)   __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW)
+#define ioremap_uncached_accelerated(offset, size)   __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)
+#undef __IS_KSEG1
+#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq)    static inline void pfx##write##bwlq(type val,   volatile void __iomem *mem)  {   volatile type *__mem;   type __val;     __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));     __val = pfx##ioswab##bwlq(__mem, val);     if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long))   *__mem = __val;   else if (cpu_has_64bits) {   unsigned long __flags;   type __tmp;     if (irq)   local_irq_save(__flags);   __asm__ __volatile__(   ".set	mips3" "\t\t# __writeq""\n\t"   "dsll32	%L0, %L0, 0" "\n\t"   "dsrl32	%L0, %L0, 0" "\n\t"   "dsll32	%M0, %M0, 0" "\n\t"   "or	%L0, %L0, %M0" "\n\t"   "sd	%L0, %2" "\n\t"   ".set	mips0" "\n"   : "=r" (__tmp)   : "0" (__val), "m" (*__mem));   if (irq)   local_irq_restore(__flags);   } else   BUG();  }    static inline type pfx##read##bwlq(const volatile void __iomem *mem)  {   volatile type *__mem;   type __val;     __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));     if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long))   __val = *__mem;   else if (cpu_has_64bits) {   unsigned long __flags;     if (irq)   local_irq_save(__flags);   __asm__ __volatile__(   ".set	mips3" "\t\t# __readq" "\n\t"   "ld	%L0, %1" "\n\t"   "dsra32	%M0, %L0, 0" "\n\t"   "sll	%L0, %L0, 0" "\n\t"   ".set	mips0" "\n"   : "=r" (__val)   : "m" (*__mem));   if (irq)   local_irq_restore(__flags);   } else {   __val = 0;   BUG();   }     return pfx##ioswab##bwlq(__mem, __val);  }
+#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow)    static inline void pfx##out##bwlq##p(type val, unsigned long port)  {   volatile type *__addr;   type __val;     __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port);     __val = pfx##ioswab##bwlq(__addr, val);         BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));     *__addr = __val;   slow;  }    static inline type pfx##in##bwlq##p(unsigned long port)  {   volatile type *__addr;   type __val;     __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port);     BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));     __val = *__addr;   slow;     return pfx##ioswab##bwlq(__addr, __val);  }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __BUILD_MEMORY_PFX(bus, bwlq, type)    __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
+#define BUILDIO_MEM(bwlq, type)    __BUILD_MEMORY_PFX(__raw_, bwlq, type)  __BUILD_MEMORY_PFX(, bwlq, type)  __BUILD_MEMORY_PFX(__mem_, bwlq, type)  
+#define __BUILD_IOPORT_PFX(bus, bwlq, type)   __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
+#define BUILDIO_IOPORT(bwlq, type)   __BUILD_IOPORT_PFX(, bwlq, type)   __BUILD_IOPORT_PFX(__mem_, bwlq, type)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __BUILDIO(bwlq, type)    __BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0)
+#define readb_relaxed readb
+#define readw_relaxed readw
+#define readl_relaxed readl
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define readq_relaxed readq
+#define readq readq
+#define writeq writeq
+#define __BUILD_MEMORY_STRING(bwlq, type)    static inline void writes##bwlq(volatile void __iomem *mem,   const void *addr, unsigned int count)  {   const volatile type *__addr = addr;     while (count--) {   __mem_write##bwlq(*__addr, mem);   __addr++;   }  }    static inline void reads##bwlq(volatile void __iomem *mem, void *addr,   unsigned int count)  {   volatile type *__addr = addr;     while (count--) {   *__addr = __mem_read##bwlq(mem);   __addr++;   }  }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __BUILD_IOPORT_STRING(bwlq, type)    static inline void outs##bwlq(unsigned long port, const void *addr,   unsigned int count)  {   const volatile type *__addr = addr;     while (count--) {   __mem_out##bwlq(*__addr, port);   __addr++;   }  }    static inline void ins##bwlq(unsigned long port, void *addr,   unsigned int count)  {   volatile type *__addr = addr;     while (count--) {   *__addr = __mem_in##bwlq(port);   __addr++;   }  }
+#define BUILDSTRING(bwlq, type)    __BUILD_MEMORY_STRING(bwlq, type)  __BUILD_IOPORT_STRING(bwlq, type)
+#define mmiowb() asm volatile ("sync" ::: "memory")
+#define dma_cache_wback_inv(start,size)   do { (void) (start); (void) (size); } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define dma_cache_wback(start,size)   do { (void) (start); (void) (size); } while (0)
+#define dma_cache_inv(start,size)   do { (void) (start); (void) (size); } while (0)
+#ifdef __MIPSEB__
+#define __CSR_32_ADJUST 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define __CSR_32_ADJUST 0
+#endif
+#define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST))
+#define xlate_dev_mem_ptr(p) __va(p)
+#define xlate_dev_kmem_ptr(p) p
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/ioctl.h b/libc/kernel/arch-mips/asm/ioctl.h
new file mode 100644
index 0000000..09dd951
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ioctl.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_IOCTL_H
+#define _ASM_IOCTL_H
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOC_SIZEBITS 13
+#define _IOC_DIRBITS 3
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOC_WRITE 4U
+#define _IOC_VOID 0x20000000
+#define _IOC_OUT 0x40000000
+#define _IOC_IN 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOC_INOUT (IOC_IN|IOC_OUT)
+#define _IOC(dir, type, nr, size)   (((dir) << _IOC_DIRSHIFT) |   ((type) << _IOC_TYPESHIFT) |   ((nr) << _IOC_NRSHIFT) |   ((size) << _IOC_SIZESHIFT))
+extern unsigned int __invalid_size_argument_for_IOC;
+#define _IOC_TYPECHECK(t)   ((sizeof(t) == sizeof(t[1]) &&   sizeof(t) < (1 << _IOC_SIZEBITS)) ?   sizeof(t) : __invalid_size_argument_for_IOC)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0)
+#define _IOR(type, nr, size) _IOC(_IOC_READ, (type), (nr), (_IOC_TYPECHECK(size)))
+#define _IOW(type, nr, size) _IOC(_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
+#define _IOWR(type, nr, size) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOR_BAD(type, nr, size) _IOC(_IOC_READ, (type), (nr), sizeof(size))
+#define _IOW_BAD(type, nr, size) _IOC(_IOC_WRITE, (type), (nr), sizeof(size))
+#define _IOWR_BAD(type, nr, size) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), sizeof(size))
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/ioctls.h b/libc/kernel/arch-mips/asm/ioctls.h
new file mode 100644
index 0000000..20a02e8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ioctls.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_IOCTLS_H
+#define __ASM_IOCTLS_H
+#include <asm/ioctl.h>
+#define TCGETA 0x5401
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSETA 0x5402  
+#define TCSETAW 0x5403
+#define TCSETAF 0x5404
+#define TCSBRK 0x5405
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCXONC 0x5406
+#define TCFLSH 0x5407
+#define TCGETS 0x540d
+#define TCSETS 0x540e
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSETSW 0x540f
+#define TCSETSF 0x5410
+#define TIOCEXCL 0x740d  
+#define TIOCNXCL 0x740e  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCOUTQ 0x7472  
+#define TIOCSTI 0x5472  
+#define TIOCMGET 0x741d  
+#define TIOCMBIS 0x741b  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCMBIC 0x741c  
+#define TIOCMSET 0x741a  
+#define TIOCPKT 0x5470  
+#define TIOCPKT_DATA 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCPKT_FLUSHREAD 0x01  
+#define TIOCPKT_FLUSHWRITE 0x02  
+#define TIOCPKT_STOP 0x04  
+#define TIOCPKT_START 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCPKT_NOSTOP 0x10  
+#define TIOCPKT_DOSTOP 0x20  
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)  
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCNOTTY 0x5471  
+#define TIOCSETD 0x7401
+#define TIOCGETD 0x7400
+#define FIOCLEX 0x6601
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FIONCLEX 0x6602
+#define FIOASYNC 0x667d
+#define FIONBIO 0x667e
+#define FIOQSIZE 0x667f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCGLTC 0x7474  
+#define TIOCSLTC 0x7475  
+#define TIOCSPGRP _IOW('t', 118, int)  
+#define TIOCGPGRP _IOR('t', 119, int)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCCONS _IOW('t', 120, int)  
+#define FIONREAD 0x467f
+#define TIOCINQ FIONREAD
+#define TIOCGETP 0x7408
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCSETP 0x7409
+#define TIOCSETN 0x740a  
+#define TIOCSBRK 0x5427  
+#define TIOCCBRK 0x5428  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCGSID 0x7416  
+#define TCGETS2 _IOR('T', 0x2A, struct termios2)
+#define TCSETS2 _IOW('T', 0x2B, struct termios2)
+#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
+#define TIOCGPTN _IOR('T', 0x30, unsigned int)  
+#define TIOCSPTLCK _IOW('T', 0x31, int)  
+#define TIOCSCTTY 0x5480  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCGSOFTCAR 0x5481
+#define TIOCSSOFTCAR 0x5482
+#define TIOCLINUX 0x5483
+#define TIOCGSERIAL 0x5484
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCSSERIAL 0x5485
+#define TCSBRKP 0x5486  
+#define TIOCSERCONFIG 0x5488
+#define TIOCSERGWILD 0x5489
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCSERSWILD 0x548a
+#define TIOCGLCKTRMIOS 0x548b
+#define TIOCSLCKTRMIOS 0x548c
+#define TIOCSERGSTRUCT 0x548d  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCSERGETLSR 0x548e  
+#define TIOCSERGETMULTI 0x548f  
+#define TIOCSERSETMULTI 0x5490  
+#define TIOCMIWAIT 0x5491  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCGICOUNT 0x5492  
+#define TIOCGHAYESESP 0x5493  
+#define TIOCSHAYESESP 0x5494  
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/ip32/crime.h b/libc/kernel/arch-mips/asm/ip32/crime.h
new file mode 100644
index 0000000..a979708
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ip32/crime.h
@@ -0,0 +1,171 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_CRIME_H__
+#define __ASM_CRIME_H__
+#define CRIME_BASE 0x14000000  
+struct sgi_crime {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long id;
+#define CRIME_ID_MASK 0xff
+#define CRIME_ID_IDBITS 0xf0
+#define CRIME_ID_IDVALUE 0xa0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_ID_REV 0x0f
+#define CRIME_REV_PETTY 0x00
+#define CRIME_REV_11 0x11
+#define CRIME_REV_13 0x13
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_REV_14 0x14
+ volatile unsigned long control;
+#define CRIME_CONTROL_MASK 0x3fff
+#define CRIME_CONTROL_TRITON_SYSADC 0x2000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_CONTROL_CRIME_SYSADC 0x1000
+#define CRIME_CONTROL_HARD_RESET 0x0800
+#define CRIME_CONTROL_SOFT_RESET 0x0400
+#define CRIME_CONTROL_DOG_ENA 0x0200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_CONTROL_ENDIANESS 0x0100
+#define CRIME_CONTROL_ENDIAN_BIG 0x0100
+#define CRIME_CONTROL_ENDIAN_LITTLE 0x0000
+#define CRIME_CONTROL_CQUEUE_HWM 0x000f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_CONTROL_CQUEUE_SHFT 0
+#define CRIME_CONTROL_WBUF_HWM 0x00f0
+#define CRIME_CONTROL_WBUF_SHFT 8
+ volatile unsigned long istat;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long imask;
+ volatile unsigned long soft_int;
+ volatile unsigned long hard_int;
+#define MACE_VID_IN1_INT BIT(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACE_VID_IN2_INT BIT(1)
+#define MACE_VID_OUT_INT BIT(2)
+#define MACE_ETHERNET_INT BIT(3)
+#define MACE_SUPERIO_INT BIT(4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACE_MISC_INT BIT(5)
+#define MACE_AUDIO_INT BIT(6)
+#define MACE_PCI_BRIDGE_INT BIT(7)
+#define MACEPCI_SCSI0_INT BIT(8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_SCSI1_INT BIT(9)
+#define MACEPCI_SLOT0_INT BIT(10)
+#define MACEPCI_SLOT1_INT BIT(11)
+#define MACEPCI_SLOT2_INT BIT(12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_SHARED0_INT BIT(13)
+#define MACEPCI_SHARED1_INT BIT(14)
+#define MACEPCI_SHARED2_INT BIT(15)
+#define CRIME_GBE0_INT BIT(16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_GBE1_INT BIT(17)
+#define CRIME_GBE2_INT BIT(18)
+#define CRIME_GBE3_INT BIT(19)
+#define CRIME_CPUERR_INT BIT(20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MEMERR_INT BIT(21)
+#define CRIME_RE_EMPTY_E_INT BIT(22)
+#define CRIME_RE_FULL_E_INT BIT(23)
+#define CRIME_RE_IDLE_E_INT BIT(24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_RE_EMPTY_L_INT BIT(25)
+#define CRIME_RE_FULL_L_INT BIT(26)
+#define CRIME_RE_IDLE_L_INT BIT(27)
+#define CRIME_SOFT0_INT BIT(28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_SOFT1_INT BIT(29)
+#define CRIME_SOFT2_INT BIT(30)
+#define CRIME_SYSCORERR_INT CRIME_SOFT2_INT
+#define CRIME_VICE_INT BIT(31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MACE_INT_MASK 0x8f
+#define CRIME_MACEISA_INT_MASK 0x70
+#define CRIME_MACEPCI_INT_MASK 0xff00
+#define CRIME_CRIME_INT_MASK 0xffff0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long watchdog;
+#define CRIME_DOG_POWER_ON_RESET 0x00010000
+#define CRIME_DOG_WARM_RESET 0x00080000
+#define CRIME_DOG_TIMEOUT (CRIME_DOG_POWER_ON_RESET|CRIME_DOG_WARM_RESET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_DOG_VALUE 0x00007fff
+ volatile unsigned long timer;
+#define CRIME_MASTER_FREQ 66666500  
+#define CRIME_NS_PER_TICK 15  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long cpu_error_addr;
+#define CRIME_CPU_ERROR_ADDR_MASK 0x3ffffffff
+ volatile unsigned long cpu_error_stat;
+#define CRIME_CPU_ERROR_MASK 0x7  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_CPU_ERROR_CPU_ILL_ADDR 0x4
+#define CRIME_CPU_ERROR_VICE_WRT_PRTY 0x2
+#define CRIME_CPU_ERROR_CPU_WRT_PRTY 0x1
+ unsigned long _pad0[54];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long mc_ctrl;
+ volatile unsigned long bank_ctrl[8];
+#define CRIME_MEM_BANK_CONTROL_MASK 0x11f  
+#define CRIME_MEM_BANK_CONTROL_ADDR 0x01f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MEM_BANK_CONTROL_SDRAM_SIZE 0x100
+#define CRIME_MAXBANKS 8
+ volatile unsigned long mem_ref_counter;
+#define CRIME_MEM_REF_COUNTER_MASK 0x3ff  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long mem_error_stat;
+#define CRIME_MEM_ERROR_STAT_MASK 0x0ff7ffff  
+#define CRIME_MEM_ERROR_MACE_ID 0x0000007f
+#define CRIME_MEM_ERROR_MACE_ACCESS 0x00000080
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MEM_ERROR_RE_ID 0x00007f00
+#define CRIME_MEM_ERROR_RE_ACCESS 0x00008000
+#define CRIME_MEM_ERROR_GBE_ACCESS 0x00010000
+#define CRIME_MEM_ERROR_VICE_ACCESS 0x00020000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MEM_ERROR_CPU_ACCESS 0x00040000
+#define CRIME_MEM_ERROR_RESERVED 0x00080000
+#define CRIME_MEM_ERROR_SOFT_ERR 0x00100000
+#define CRIME_MEM_ERROR_HARD_ERR 0x00200000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MEM_ERROR_MULTIPLE 0x00400000
+#define CRIME_MEM_ERROR_ECC 0x01800000
+#define CRIME_MEM_ERROR_MEM_ECC_RD 0x00800000
+#define CRIME_MEM_ERROR_MEM_ECC_RMW 0x01000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRIME_MEM_ERROR_INV 0x0e000000
+#define CRIME_MEM_ERROR_INV_MEM_ADDR_RD 0x02000000
+#define CRIME_MEM_ERROR_INV_MEM_ADDR_WR 0x04000000
+#define CRIME_MEM_ERROR_INV_MEM_ADDR_RMW 0x08000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long mem_error_addr;
+#define CRIME_MEM_ERROR_ADDR_MASK 0x3fffffff
+ volatile unsigned long mem_ecc_syn;
+#define CRIME_MEM_ERROR_ECC_SYN_MASK 0xffffffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long mem_ecc_chk;
+#define CRIME_MEM_ERROR_ECC_CHK_MASK 0xffffffff
+ volatile unsigned long mem_ecc_repl;
+#define CRIME_MEM_ERROR_ECC_REPL_MASK 0xffffffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define CRIME_HI_MEM_BASE 0x40000000  
+#endif
diff --git a/libc/kernel/arch-mips/asm/ip32/mace.h b/libc/kernel/arch-mips/asm/ip32/mace.h
new file mode 100644
index 0000000..c2c149d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ip32/mace.h
@@ -0,0 +1,351 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MACE_H__
+#define __ASM_MACE_H__
+#define MACE_BASE 0x1f000000  
+struct mace_pci {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned int error_addr;
+ volatile unsigned int error;
+#define MACEPCI_ERROR_MASTER_ABORT BIT(31)
+#define MACEPCI_ERROR_TARGET_ABORT BIT(30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_ERROR_DATA_PARITY_ERR BIT(29)
+#define MACEPCI_ERROR_RETRY_ERR BIT(28)
+#define MACEPCI_ERROR_ILLEGAL_CMD BIT(27)
+#define MACEPCI_ERROR_SYSTEM_ERR BIT(26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_ERROR_INTERRUPT_TEST BIT(25)
+#define MACEPCI_ERROR_PARITY_ERR BIT(24)
+#define MACEPCI_ERROR_OVERRUN BIT(23)
+#define MACEPCI_ERROR_RSVD BIT(22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_ERROR_MEMORY_ADDR BIT(21)
+#define MACEPCI_ERROR_CONFIG_ADDR BIT(20)
+#define MACEPCI_ERROR_MASTER_ABORT_ADDR_VALID BIT(19)
+#define MACEPCI_ERROR_TARGET_ABORT_ADDR_VALID BIT(18)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_ERROR_DATA_PARITY_ADDR_VALID BIT(17)
+#define MACEPCI_ERROR_RETRY_ADDR_VALID BIT(16)
+#define MACEPCI_ERROR_SIG_TABORT BIT(4)
+#define MACEPCI_ERROR_DEVSEL_MASK 0xc0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_ERROR_DEVSEL_FAST 0
+#define MACEPCI_ERROR_DEVSEL_MED 0x40
+#define MACEPCI_ERROR_DEVSEL_SLOW 0x80
+#define MACEPCI_ERROR_FBB BIT(1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_ERROR_66MHZ BIT(0)
+ volatile unsigned int control;
+#define MACEPCI_CONTROL_INT(x) BIT(x)
+#define MACEPCI_CONTROL_INT_MASK 0xff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_CONTROL_SERR_ENA BIT(8)
+#define MACEPCI_CONTROL_ARB_N6 BIT(9)
+#define MACEPCI_CONTROL_PARITY_ERR BIT(10)
+#define MACEPCI_CONTROL_MRMRA_ENA BIT(11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_CONTROL_ARB_N3 BIT(12)
+#define MACEPCI_CONTROL_ARB_N4 BIT(13)
+#define MACEPCI_CONTROL_ARB_N5 BIT(14)
+#define MACEPCI_CONTROL_PARK_LIU BIT(15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_CONTROL_INV_INT(x) BIT(16+x)
+#define MACEPCI_CONTROL_INV_INT_MASK 0x00ff0000
+#define MACEPCI_CONTROL_OVERRUN_INT BIT(24)
+#define MACEPCI_CONTROL_PARITY_INT BIT(25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_CONTROL_SERR_INT BIT(26)
+#define MACEPCI_CONTROL_IT_INT BIT(27)
+#define MACEPCI_CONTROL_RE_INT BIT(28)
+#define MACEPCI_CONTROL_DPED_INT BIT(29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_CONTROL_TAR_INT BIT(30)
+#define MACEPCI_CONTROL_MAR_INT BIT(31)
+ volatile unsigned int rev;
+ unsigned int _pad[0xcf8/4 - 4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned int config_addr;
+ union {
+ volatile unsigned char b[4];
+ volatile unsigned short w[2];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned int l;
+ } config_data;
+};
+#define MACEPCI_LOW_MEMORY 0x1a000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_LOW_IO 0x18000000
+#define MACEPCI_SWAPPED_VIEW 0
+#define MACEPCI_NATIVE_VIEW 0x40000000
+#define MACEPCI_IO 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPCI_HI_MEMORY 0x280000000
+#define MACEPCI_HI_IO 0x100000000
+struct mace_video {
+ unsigned long xxx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct mace_ethernet {
+ volatile unsigned long mac_ctrl;
+ volatile unsigned long int_stat;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long dma_ctrl;
+ volatile unsigned long timer;
+ volatile unsigned long tx_int_al;
+ volatile unsigned long rx_int_al;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long tx_info;
+ volatile unsigned long tx_info_al;
+ volatile unsigned long rx_buff;
+ volatile unsigned long rx_buff_al1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long rx_buff_al2;
+ volatile unsigned long diag;
+ volatile unsigned long phy_data;
+ volatile unsigned long phy_regs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long phy_trans_go;
+ volatile unsigned long backoff_seed;
+ volatile unsigned long imq_reserved[4];
+ volatile unsigned long mac_addr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long mac_addr2;
+ volatile unsigned long mcast_filter;
+ volatile unsigned long tx_ring_base;
+ volatile unsigned long tx_pkt1_hdr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long tx_pkt1_ptr[3];
+ volatile unsigned long tx_pkt2_hdr;
+ volatile unsigned long tx_pkt2_ptr[3];
+ volatile unsigned long rx_fifo;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct mace_audio {
+ volatile unsigned long control;
+ volatile unsigned long codec_control;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long codec_mask;
+ volatile unsigned long codec_read;
+ struct {
+ volatile unsigned long control;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long read_ptr;
+ volatile unsigned long write_ptr;
+ volatile unsigned long depth;
+ } chan[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct mace_parport {
+#define MACEPAR_CONTEXT_LASTFLAG BIT(63)
+#define MACEPAR_CONTEXT_DATA_BOUND 0x0000000000001000UL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPAR_CONTEXT_DATALEN_MASK 0x00000fff00000000UL
+#define MACEPAR_CONTEXT_DATALEN_SHIFT 32
+#define MACEPAR_CONTEXT_BASEADDR_MASK 0x00000000ffffffffUL
+ volatile u64 context_a;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u64 context_b;
+#define MACEPAR_CTLSTAT_DIRECTION BIT(0)
+#define MACEPAR_CTLSTAT_ENABLE BIT(1)
+#define MACEPAR_CTLSTAT_RESET BIT(2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPAR_CTLSTAT_CTXB_VALID BIT(3)
+#define MACEPAR_CTLSTAT_CTXA_VALID BIT(4)
+ volatile u64 cntlstat;
+#define MACEPAR_DIAG_CTXINUSE BIT(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEPAR_DIAG_DMACTIVE BIT(1)
+#define MACEPAR_DIAG_CTRMASK 0x0000000000003ffcUL
+#define MACEPAR_DIAG_CTRSHIFT 2
+ volatile u64 diagnostic;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct mace_isactrl {
+ volatile unsigned long ringbase;
+#define MACEISA_RINGBUFFERS_SIZE (8 * 4096)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long misc;
+#define MACEISA_FLASH_WE BIT(0)  
+#define MACEISA_PWD_CLEAR BIT(1)  
+#define MACEISA_NIC_DEASSERT BIT(2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_NIC_DATA BIT(3)
+#define MACEISA_LED_RED BIT(4)  
+#define MACEISA_LED_GREEN BIT(5)  
+#define MACEISA_DP_RAM_ENABLE BIT(6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long istat;
+ volatile unsigned long imask;
+#define MACEISA_AUDIO_SW_INT BIT(0)
+#define MACEISA_AUDIO_SC_INT BIT(1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_AUDIO1_DMAT_INT BIT(2)
+#define MACEISA_AUDIO1_OF_INT BIT(3)
+#define MACEISA_AUDIO2_DMAT_INT BIT(4)
+#define MACEISA_AUDIO2_MERR_INT BIT(5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_AUDIO3_DMAT_INT BIT(6)
+#define MACEISA_AUDIO3_MERR_INT BIT(7)
+#define MACEISA_RTC_INT BIT(8)
+#define MACEISA_KEYB_INT BIT(9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_KEYB_POLL_INT BIT(10)
+#define MACEISA_MOUSE_INT BIT(11)
+#define MACEISA_MOUSE_POLL_INT BIT(12)
+#define MACEISA_TIMER0_INT BIT(13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_TIMER1_INT BIT(14)
+#define MACEISA_TIMER2_INT BIT(15)
+#define MACEISA_PARALLEL_INT BIT(16)
+#define MACEISA_PAR_CTXA_INT BIT(17)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_PAR_CTXB_INT BIT(18)
+#define MACEISA_PAR_MERR_INT BIT(19)
+#define MACEISA_SERIAL1_INT BIT(20)
+#define MACEISA_SERIAL1_TDMAT_INT BIT(21)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_SERIAL1_TDMAPR_INT BIT(22)
+#define MACEISA_SERIAL1_TDMAME_INT BIT(23)
+#define MACEISA_SERIAL1_RDMAT_INT BIT(24)
+#define MACEISA_SERIAL1_RDMAOR_INT BIT(25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_SERIAL2_INT BIT(26)
+#define MACEISA_SERIAL2_TDMAT_INT BIT(27)
+#define MACEISA_SERIAL2_TDMAPR_INT BIT(28)
+#define MACEISA_SERIAL2_TDMAME_INT BIT(29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEISA_SERIAL2_RDMAT_INT BIT(30)
+#define MACEISA_SERIAL2_RDMAOR_INT BIT(31)
+ volatile unsigned long _pad[0x2000/8 - 4];
+ volatile unsigned long dp_ram[0x400];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct mace_parport parport;
+};
+struct mace_ps2port {
+ volatile unsigned long tx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long rx;
+ volatile unsigned long control;
+ volatile unsigned long status;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mace_ps2 {
+ struct mace_ps2port keyb;
+ struct mace_ps2port mouse;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mace_i2c {
+ volatile unsigned long config;
+#define MACEI2C_RESET BIT(0)
+#define MACEI2C_FAST BIT(1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACEI2C_DATA_OVERRIDE BIT(2)
+#define MACEI2C_CLOCK_OVERRIDE BIT(3)
+#define MACEI2C_DATA_STATUS BIT(4)
+#define MACEI2C_CLOCK_STATUS BIT(5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long control;
+ volatile unsigned long data;
+};
+typedef union {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long ust_msc;
+ struct reg {
+ volatile unsigned int ust;
+ volatile unsigned int msc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } reg;
+} timer_reg;
+struct mace_timers {
+ volatile unsigned long ust;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MACE_UST_PERIOD_NS 960
+ volatile unsigned long compare1;
+ volatile unsigned long compare2;
+ volatile unsigned long compare3;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ timer_reg audio_in;
+ timer_reg audio_out1;
+ timer_reg audio_out2;
+ timer_reg video_in1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ timer_reg video_in2;
+ timer_reg video_out;
+};
+struct mace_perif {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct mace_audio audio;
+ char _pad0[0x10000 - sizeof(struct mace_audio)];
+ struct mace_isactrl ctrl;
+ char _pad1[0x10000 - sizeof(struct mace_isactrl)];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct mace_ps2 ps2;
+ char _pad2[0x10000 - sizeof(struct mace_ps2)];
+ struct mace_i2c i2c;
+ char _pad3[0x10000 - sizeof(struct mace_i2c)];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct mace_timers timers;
+ char _pad4[0x10000 - sizeof(struct mace_timers)];
+};
+struct mace_parallel {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct mace_ecp1284 {
+};
+struct mace_serial {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile unsigned long xxx;
+};
+struct mace_isa {
+ struct mace_parallel parallel;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char _pad1[0x8000 - sizeof(struct mace_parallel)];
+ struct mace_ecp1284 ecp1284;
+ char _pad2[0x8000 - sizeof(struct mace_ecp1284)];
+ struct mace_serial serial1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char _pad3[0x8000 - sizeof(struct mace_serial)];
+ struct mace_serial serial2;
+ char _pad4[0x8000 - sizeof(struct mace_serial)];
+ volatile unsigned char rtc[0x10000];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct sgi_mace {
+ char _reserved[0x80000];
+ struct mace_pci pci;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char _pad0[0x80000 - sizeof(struct mace_pci)];
+ struct mace_video video_in1;
+ char _pad1[0x80000 - sizeof(struct mace_video)];
+ struct mace_video video_in2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char _pad2[0x80000 - sizeof(struct mace_video)];
+ struct mace_video video_out;
+ char _pad3[0x80000 - sizeof(struct mace_video)];
+ struct mace_ethernet eth;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char _pad4[0x80000 - sizeof(struct mace_ethernet)];
+ struct mace_perif perif;
+ char _pad5[0x80000 - sizeof(struct mace_perif)];
+ struct mace_isa isa;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char _pad6[0x80000 - sizeof(struct mace_isa)];
+};
+#endif
diff --git a/libc/kernel/arch-mips/asm/ipcbuf.h b/libc/kernel/arch-mips/asm/ipcbuf.h
new file mode 100644
index 0000000..9be3da8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ipcbuf.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_IPCBUF_H
+#define _ASM_IPCBUF_H
+struct ipc64_perm
+{
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_key_t key;
+ __kernel_uid_t uid;
+ __kernel_gid_t gid;
+ __kernel_uid_t cuid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_gid_t cgid;
+ __kernel_mode_t mode;
+ unsigned short seq;
+ unsigned short __pad1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused1;
+ unsigned long __unused2;
+};
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/irq.h b/libc/kernel/arch-mips/asm/irq.h
new file mode 100644
index 0000000..042c951
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/irq.h
@@ -0,0 +1,33 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_IRQ_H
+#define _ASM_IRQ_H
+#include <linux/linkage.h>
+#include <asm/mipsmtregs.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <irq.h>
+#define irq_canonicalize(irq) (irq)  
+#define IRQ_AFFINITY_HOOK(irq) do { } while (0)
+#define __DO_IRQ_SMTC_HOOK(irq)  do {   IRQ_AFFINITY_HOOK(irq);  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NO_AFFINITY_IRQ_SMTC_HOOK(irq) do { } while (0)
+#define do_IRQ(irq)  do {   irq_enter();   __DO_IRQ_SMTC_HOOK(irq);   generic_handle_irq(irq);   irq_exit();  } while (0)
+#define CP0_LEGACY_COMPARE_IRQ 7
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/irq_gt641xx.h b/libc/kernel/arch-mips/asm/irq_gt641xx.h
new file mode 100644
index 0000000..2a341d8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/irq_gt641xx.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_IRQ_GT641XX_H
+#define _ASM_IRQ_GT641XX_H
+#ifndef GT641XX_IRQ_BASE
+#define GT641XX_IRQ_BASE 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define GT641XX_MEMORY_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 1)
+#define GT641XX_DMA_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 2)
+#define GT641XX_CPU_ACCESS_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_DMA0_IRQ (GT641XX_IRQ_BASE + 4)
+#define GT641XX_DMA1_IRQ (GT641XX_IRQ_BASE + 5)
+#define GT641XX_DMA2_IRQ (GT641XX_IRQ_BASE + 6)
+#define GT641XX_DMA3_IRQ (GT641XX_IRQ_BASE + 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_TIMER0_IRQ (GT641XX_IRQ_BASE + 8)
+#define GT641XX_TIMER1_IRQ (GT641XX_IRQ_BASE + 9)
+#define GT641XX_TIMER2_IRQ (GT641XX_IRQ_BASE + 10)
+#define GT641XX_TIMER3_IRQ (GT641XX_IRQ_BASE + 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_PCI_0_MASTER_READ_ERROR_IRQ (GT641XX_IRQ_BASE + 12)
+#define GT641XX_PCI_0_SLAVE_WRITE_ERROR_IRQ (GT641XX_IRQ_BASE + 13)
+#define GT641XX_PCI_0_MASTER_WRITE_ERROR_IRQ (GT641XX_IRQ_BASE + 14)
+#define GT641XX_PCI_0_SLAVE_READ_ERROR_IRQ (GT641XX_IRQ_BASE + 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_PCI_0_ADDRESS_ERROR_IRQ (GT641XX_IRQ_BASE + 16)
+#define GT641XX_MEMORY_ERROR_IRQ (GT641XX_IRQ_BASE + 17)
+#define GT641XX_PCI_0_MASTER_ABORT_IRQ (GT641XX_IRQ_BASE + 18)
+#define GT641XX_PCI_0_TARGET_ABORT_IRQ (GT641XX_IRQ_BASE + 19)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_PCI_0_RETRY_TIMEOUT_IRQ (GT641XX_IRQ_BASE + 20)
+#define GT641XX_CPU_INT0_IRQ (GT641XX_IRQ_BASE + 21)
+#define GT641XX_CPU_INT1_IRQ (GT641XX_IRQ_BASE + 22)
+#define GT641XX_CPU_INT2_IRQ (GT641XX_IRQ_BASE + 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_CPU_INT3_IRQ (GT641XX_IRQ_BASE + 24)
+#define GT641XX_CPU_INT4_IRQ (GT641XX_IRQ_BASE + 25)
+#define GT641XX_PCI_INT0_IRQ (GT641XX_IRQ_BASE + 26)
+#define GT641XX_PCI_INT1_IRQ (GT641XX_IRQ_BASE + 27)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GT641XX_PCI_INT2_IRQ (GT641XX_IRQ_BASE + 28)
+#define GT641XX_PCI_INT3_IRQ (GT641XX_IRQ_BASE + 29)
+#endif
diff --git a/libc/kernel/arch-sh/asm/current.h b/libc/kernel/arch-mips/asm/irq_regs.h
similarity index 60%
copy from libc/kernel/arch-sh/asm/current.h
copy to libc/kernel/arch-mips/asm/irq_regs.h
index e2ce122..5745c5f 100644
--- a/libc/kernel/arch-sh/asm/current.h
+++ b/libc/kernel/arch-mips/asm/irq_regs.h
@@ -7,14 +7,18 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_CURRENT_H
-#define __ASM_SH_CURRENT_H
-
+#ifndef __ASM_IRQ_REGS_H
+#define __ASM_IRQ_REGS_H
+#define ARCH_HAS_OWN_IRQ_REGS
 #include <linux/thread_info.h>
-
-struct task_struct;
-
-#define current get_current()
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/arch-mips/asm/jazz.h b/libc/kernel/arch-mips/asm/jazz.h
new file mode 100644
index 0000000..5e6ea8f
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/jazz.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_JAZZ_H
+#define __ASM_JAZZ_H
+#define JAZZ_LOCAL_IO_SPACE 0xe0000000
+#define PICA_ASIC_REVISION 0xe0000008
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PICA_LED 0xe000f000
+#define LED_DOT 0x01
+#define LED_SPACE 0x00
+#define LED_0 0xfc
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LED_1 0x60
+#define LED_2 0xda
+#define LED_3 0xf2
+#define LED_4 0x66
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LED_5 0xb6
+#define LED_6 0xbe
+#define LED_7 0xe0
+#define LED_8 0xfe
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LED_9 0xf6
+#define LED_A 0xee
+#define LED_b 0x3e
+#define LED_C 0x9c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LED_d 0x7a
+#define LED_E 0x9e
+#define LED_F 0x8e
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define JAZZ_ETHERNET_BASE 0xe0001000
+#define JAZZ_SCSI_BASE 0xe0002000
+#define JAZZ_KEYBOARD_ADDRESS 0xe0005000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_KEYBOARD_DATA 0xe0005000
+#define JAZZ_KEYBOARD_COMMAND 0xe0005001
+#ifndef __ASSEMBLY__
+typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char data;
+ unsigned char command;
+} jazz_keyboard_hardware;
+#define jazz_kh ((keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct {
+ unsigned char pad0[3];
+ unsigned char data;
+ unsigned char pad1[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char command;
+} mips_keyboard_hardware;
+#define keyboard_hardware jazz_keyboard_hardware
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_KEYBOARD_ADDRESS 0xb9005000
+#define MIPS_KEYBOARD_DATA 0xb9005003
+#define MIPS_KEYBOARD_COMMAND 0xb9005007
+#define JAZZ_SERIAL1_BASE (unsigned int)0xe0006000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_SERIAL2_BASE (unsigned int)0xe0007000
+#define JAZZ_PARALLEL_BASE (unsigned int)0xe0008000
+#define JAZZ_DUMMY_DEVICE 0xe000d000
+#define JAZZ_TIMER_INTERVAL 0xe0000228
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_TIMER_REGISTER 0xe0000230
+#ifndef __ASSEMBLY__
+#ifdef __MIPSEL__
+typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int bank2 : 3;
+ unsigned int bank1 : 3;
+ unsigned int mem_bus_width : 1;
+ unsigned int reserved2 : 1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int page_mode : 1;
+ unsigned int reserved1 : 23;
+} dram_configuration;
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct {
+ unsigned int reserved1 : 23;
+ unsigned int page_mode : 1;
+ unsigned int reserved2 : 1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int mem_bus_width : 1;
+ unsigned int bank1 : 3;
+ unsigned int bank2 : 3;
+} dram_configuration;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
+#define PICA_DRAM_CONFIG 0xe00fffe0
+#define JAZZ_IO_IRQ_SOURCE 0xe0010000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_IO_IRQ_ENABLE 0xe0010002
+#define JAZZ_IRQ_START 24
+#define JAZZ_IRQ_END (24 + 9)
+#define JAZZ_PARALLEL_IRQ (JAZZ_IRQ_START + 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_FLOPPY_IRQ (JAZZ_IRQ_START + 1)
+#define JAZZ_SOUND_IRQ (JAZZ_IRQ_START + 2)
+#define JAZZ_VIDEO_IRQ (JAZZ_IRQ_START + 3)
+#define JAZZ_ETHERNET_IRQ (JAZZ_IRQ_START + 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_SCSI_IRQ (JAZZ_IRQ_START + 5)
+#define JAZZ_KEYBOARD_IRQ (JAZZ_IRQ_START + 6)
+#define JAZZ_MOUSE_IRQ (JAZZ_IRQ_START + 7)
+#define JAZZ_SERIAL1_IRQ (JAZZ_IRQ_START + 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_SERIAL2_IRQ (JAZZ_IRQ_START + 9)
+#define JAZZ_TIMER_IRQ (MIPS_CPU_IRQ_BASE+6)
+#define JAZZ_SCSI_DMA 0  
+#define JAZZ_FLOPPY_DMA 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_AUDIOL_DMA 2  
+#define JAZZ_AUDIOR_DMA 3  
+#define JAZZ_R4030_CONFIG 0xE0000000  
+#define JAZZ_R4030_REVISION 0xE0000008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_R4030_INV_ADDR 0xE0000010  
+#define JAZZ_R4030_TRSTBL_BASE 0xE0000018  
+#define JAZZ_R4030_TRSTBL_LIM 0xE0000020  
+#define JAZZ_R4030_TRSTBL_INV 0xE0000028  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_R4030_CACHE_MTNC 0xE0000030  
+#define JAZZ_R4030_R_FAIL_ADDR 0xE0000038  
+#define JAZZ_R4030_M_FAIL_ADDR 0xE0000040  
+#define JAZZ_R4030_CACHE_PTAG 0xE0000048  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_R4030_CACHE_LTAG 0xE0000050  
+#define JAZZ_R4030_CACHE_BMASK 0xE0000058  
+#define JAZZ_R4030_CACHE_BWIN 0xE0000060  
+#define JAZZ_R4030_REM_SPEED 0xE0000070  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_R4030_IRQ_ENABLE 0xE00000E8  
+#define JAZZ_R4030_INVAL_ADDR 0xE0000010  
+#define JAZZ_R4030_IRQ_SOURCE 0xE0000200  
+#define JAZZ_R4030_I386_ERROR 0xE0000208  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_EISA_IRQ_ACK 0xE0000238  
+#ifndef __ASSEMBLY__
+#endif
+#define JAZZ_FDC_BASE 0xe0003000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_RTC_BASE 0xe0004000
+#define JAZZ_PORT_BASE 0xe2000000
+#define JAZZ_EISA_BASE 0xe3000000
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/jazzdma.h b/libc/kernel/arch-mips/asm/jazzdma.h
new file mode 100644
index 0000000..7426807
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/jazzdma.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_JAZZDMA_H
+#define _ASM_JAZZDMA_H
+#define VDMA_PAGESIZE 4096
+#define VDMA_PGTBL_ENTRIES 4096
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VDMA_PGTBL_SIZE (sizeof(VDMA_PGTBL_ENTRY) * VDMA_PGTBL_ENTRIES)
+#define VDMA_PAGE_EMPTY 0xff000000
+#define VDMA_PAGE(a) ((unsigned int)(a) >> 12)
+#define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VDMA_ERROR 0xffffffff
+typedef volatile struct VDMA_PGTBL_ENTRY {
+ unsigned int frame;
+ unsigned int owner;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} VDMA_PGTBL_ENTRY;
+#define JAZZ_R4030_CHNL_MODE 0xE0000100  
+#define JAZZ_R4030_CHNL_ENABLE 0xE0000108  
+#define JAZZ_R4030_CHNL_COUNT 0xE0000110  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define JAZZ_R4030_CHNL_ADDR 0xE0000118  
+#define R4030_CHNL_ENABLE (1<<0)
+#define R4030_CHNL_WRITE (1<<1)
+#define R4030_TC_INTR (1<<8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R4030_MEM_INTR (1<<9)
+#define R4030_ADDR_INTR (1<<10)
+#define R4030_MODE_ATIME_40 (0)  
+#define R4030_MODE_ATIME_80 (1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R4030_MODE_ATIME_120 (2)
+#define R4030_MODE_ATIME_160 (3)
+#define R4030_MODE_ATIME_200 (4)
+#define R4030_MODE_ATIME_240 (5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R4030_MODE_ATIME_280 (6)
+#define R4030_MODE_ATIME_320 (7)
+#define R4030_MODE_WIDTH_8 (1<<3)  
+#define R4030_MODE_WIDTH_16 (2<<3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R4030_MODE_WIDTH_32 (3<<3)
+#define R4030_MODE_INTR_EN (1<<5)
+#define R4030_MODE_BURST (1<<6)  
+#define R4030_MODE_FAST_ACK (1<<7)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/kdebug.h b/libc/kernel/arch-mips/asm/kdebug.h
new file mode 100644
index 0000000..695346d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/kdebug.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MIPS_KDEBUG_H
+#define _ASM_MIPS_KDEBUG_H
+#include <linux/notifier.h>
+enum die_val {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ DIE_OOPS = 1,
+ DIE_FP,
+ DIE_TRAP,
+ DIE_RI,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#endif
diff --git a/libc/kernel/arch-mips/asm/kmap_types.h b/libc/kernel/arch-mips/asm/kmap_types.h
new file mode 100644
index 0000000..e8b888d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/kmap_types.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_KMAP_TYPES_H
+#define _ASM_KMAP_TYPES_H
+#define D(n)
+enum km_type {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+D(0) KM_BOUNCE_READ,
+D(1) KM_SKB_SUNRPC_DATA,
+D(2) KM_SKB_DATA_SOFTIRQ,
+D(3) KM_USER0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+D(4) KM_USER1,
+D(5) KM_BIO_SRC_IRQ,
+D(6) KM_BIO_DST_IRQ,
+D(7) KM_PTE0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+D(8) KM_PTE1,
+D(9) KM_IRQ0,
+D(10) KM_IRQ1,
+D(11) KM_SOFTIRQ0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+D(12) KM_SOFTIRQ1,
+D(13) KM_TYPE_NR
+};
+#undef D
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/lasat/lasat.h b/libc/kernel/arch-mips/asm/lasat/lasat.h
new file mode 100644
index 0000000..aa255f6
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/lasat/lasat.h
@@ -0,0 +1,209 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LASAT_H
+#define _LASAT_H
+#ifndef _LANGUAGE_ASSEMBLY
+enum lasat_mtdparts {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LASAT_MTD_BOOTLOADER,
+ LASAT_MTD_SERVICE,
+ LASAT_MTD_NORMAL,
+ LASAT_MTD_CONFIG,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LASAT_MTD_FS,
+ LASAT_MTD_LAST
+};
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_EEPROM_VERSION 7
+struct lasat_eeprom_struct {
+ unsigned int version;
+ unsigned int cfg[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char hwaddr[6];
+ unsigned char print_partno[12];
+ unsigned char term0;
+ unsigned char print_serial[14];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char term1;
+ unsigned char prod_partno[12];
+ unsigned char term2;
+ unsigned char prod_serial[14];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char term3;
+ unsigned char passwd_hash[16];
+ unsigned char pwdnull;
+ unsigned char vendid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char ts_ref;
+ unsigned char ts_signoff;
+ unsigned char reserved[11];
+ unsigned char debugaccess;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short prid;
+ unsigned int serviceflag;
+ unsigned int ipaddr;
+ unsigned int netmask;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int crc32;
+};
+struct lasat_eeprom_struct_pre7 {
+ unsigned int version;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int flags[3];
+ unsigned char hwaddr0[6];
+ unsigned char hwaddr1[6];
+ unsigned char print_partno[9];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char term0;
+ unsigned char print_serial[14];
+ unsigned char term1;
+ unsigned char prod_partno[9];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char term2;
+ unsigned char prod_serial[14];
+ unsigned char term3;
+ unsigned char passwd_hash[24];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char pwdnull;
+ unsigned char vendor;
+ unsigned char ts_ref;
+ unsigned char ts_signoff;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char reserved[6];
+ unsigned int writecount;
+ unsigned int ipaddr;
+ unsigned int netmask;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int crc32;
+};
+#define LASAT_W0_DSCTYPE(v) (((v)) & 0xf)
+#define LASAT_W0_BMID(v) (((v) >> 0x04) & 0xf)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_W0_CPUTYPE(v) (((v) >> 0x08) & 0xf)
+#define LASAT_W0_BUSSPEED(v) (((v) >> 0x0c) & 0xf)
+#define LASAT_W0_CPUCLK(v) (((v) >> 0x10) & 0xf)
+#define LASAT_W0_SDRAMBANKSZ(v) (((v) >> 0x14) & 0xf)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_W0_SDRAMBANKS(v) (((v) >> 0x18) & 0xf)
+#define LASAT_W0_L2CACHE(v) (((v) >> 0x1c) & 0xf)
+#define LASAT_W1_EDHAC(v) (((v)) & 0xf)
+#define LASAT_W1_HIFN(v) (((v) >> 0x04) & 0x1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_W1_ISDN(v) (((v) >> 0x05) & 0x1)
+#define LASAT_W1_IDE(v) (((v) >> 0x06) & 0x1)
+#define LASAT_W1_HDLC(v) (((v) >> 0x07) & 0x1)
+#define LASAT_W1_USVERSION(v) (((v) >> 0x08) & 0x1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_W1_4MACS(v) (((v) >> 0x09) & 0x1)
+#define LASAT_W1_EXTSERIAL(v) (((v) >> 0x0a) & 0x1)
+#define LASAT_W1_FLASHSIZE(v) (((v) >> 0x0c) & 0xf)
+#define LASAT_W1_PCISLOTS(v) (((v) >> 0x10) & 0xf)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_W1_PCI1OPT(v) (((v) >> 0x14) & 0xf)
+#define LASAT_W1_PCI2OPT(v) (((v) >> 0x18) & 0xf)
+#define LASAT_W1_PCI3OPT(v) (((v) >> 0x1c) & 0xf)
+#define LASAT_BMID_MASQUERADE2 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_BMID_MASQUERADEPRO 1
+#define LASAT_BMID_SAFEPIPE25 2
+#define LASAT_BMID_SAFEPIPE50 3
+#define LASAT_BMID_SAFEPIPE100 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_BMID_SAFEPIPE5000 5
+#define LASAT_BMID_SAFEPIPE7000 6
+#define LASAT_BMID_SAFEPIPE1000 7
+#define LASAT_BMID_UNKNOWN 0xf
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_MAX_BMID_NAMES 9  
+#define LASAT_HAS_EDHAC (1 << 0)
+#define LASAT_EDHAC_FAST (1 << 1)
+#define LASAT_HAS_EADI (1 << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_HAS_HIFN (1 << 3)
+#define LASAT_HAS_ISDN (1 << 4)
+#define LASAT_HAS_LEASEDLINE_IF (1 << 5)
+#define LASAT_HAS_HDC (1 << 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_PRID_MASQUERADE2 0
+#define LASAT_PRID_MASQUERADEPRO 1
+#define LASAT_PRID_SAFEPIPE25 2
+#define LASAT_PRID_SAFEPIPE50 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_PRID_SAFEPIPE100 4
+#define LASAT_PRID_SAFEPIPE5000 5
+#define LASAT_PRID_SAFEPIPE7000 6
+#define LASAT_PRID_SAFEPIPE30 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_PRID_SAFEPIPE5100 8
+#define LASAT_PRID_SAFEPIPE7100 9
+#define LASAT_PRID_SAFEPIPE1110 10
+#define LASAT_PRID_SAFEPIPE3020 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_PRID_SAFEPIPE3030 12
+#define LASAT_PRID_SAFEPIPE5020 13
+#define LASAT_PRID_SAFEPIPE5030 14
+#define LASAT_PRID_SAFEPIPE1120 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_PRID_SAFEPIPE1130 16
+#define LASAT_PRID_SAFEPIPE6010 17
+#define LASAT_PRID_SAFEPIPE6110 18
+#define LASAT_PRID_SAFEPIPE6210 19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_PRID_SAFEPIPE1020 20
+#define LASAT_PRID_SAFEPIPE1040 21
+#define LASAT_PRID_SAFEPIPE1060 22
+struct lasat_info {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int li_cpu_hz;
+ unsigned int li_bus_hz;
+ unsigned int li_bmid;
+ unsigned int li_memsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int li_flash_size;
+ unsigned int li_prid;
+ unsigned char li_bmstr[16];
+ unsigned char li_namestr[32];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char li_typestr[16];
+ unsigned int li_flash_base;
+ unsigned long li_flashpart_base[LASAT_MTD_LAST];
+ unsigned long li_flashpart_size[LASAT_MTD_LAST];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct lasat_eeprom_struct li_eeprom_info;
+ unsigned int li_eeprom_upgrade_version;
+ unsigned int li_debugaccess;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define N_MACHTYPES 2
+#include <linux/delay.h>
+#define LASAT_100_DIVIDER 20
+#define LASAT_200_DIVIDER 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IS_LASAT_200() (current_cpu_data.cputype == CPU_R5000)
+#endif
+#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef
+#define LASAT_SERVICEMODE_MAGIC_2 0xfedeabba
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LASAT_GT_BASE (KSEG1ADDR(0x14000000))
+#define Vrc5074_PHYS_BASE 0x1fa00000
+#define Vrc5074_BASE (KSEG1ADDR(Vrc5074_PHYS_BASE))
+#define PCI_WINDOW1 0x1a000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-sh/asm/linkage.h b/libc/kernel/arch-mips/asm/linkage.h
similarity index 60%
rename from libc/kernel/arch-sh/asm/linkage.h
rename to libc/kernel/arch-mips/asm/linkage.h
index 1921dd3..0c77e27 100644
--- a/libc/kernel/arch-sh/asm/linkage.h
+++ b/libc/kernel/arch-mips/asm/linkage.h
@@ -7,12 +7,20 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef __ASM_LINKAGE_H
 #define __ASM_LINKAGE_H
-
-#define __ALIGN .balign 4
-#define __ALIGN_STR ".balign 4"
-
+#ifdef __ASSEMBLY__
+#include <asm/asm.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define __weak __attribute__((weak))
 #endif
diff --git a/libc/kernel/arch-mips/asm/local.h b/libc/kernel/arch-mips/asm/local.h
new file mode 100644
index 0000000..9d2172b
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/local.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ARCH_MIPS_LOCAL_H
+#define _ARCH_MIPS_LOCAL_H
+#include <linux/percpu.h>
+#include <linux/bitops.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/atomic.h>
+#include <asm/cmpxchg.h>
+#include <asm/war.h>
+typedef struct
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+{
+ atomic_long_t a;
+} local_t;
+#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define local_read(l) atomic_long_read(&(l)->a)
+#define local_set(l, i) atomic_long_set(&(l)->a, (i))
+#define local_add(i, l) atomic_long_add((i), (&(l)->a))
+#define local_sub(i, l) atomic_long_sub((i), (&(l)->a))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define local_inc(l) atomic_long_inc(&(l)->a)
+#define local_dec(l) atomic_long_dec(&(l)->a)
+#define local_cmpxchg(l, o, n)   ((long)cmpxchg_local(&((l)->a.counter), (o), (n)))
+#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define local_add_unless(l, a, u)  ({   long c, old;   c = local_read(l);   while (c != (u) && (old = local_cmpxchg((l), c, c + (a))) != c)   c = old;   c != (u);  })
+#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
+#define local_dec_return(l) local_sub_return(1, (l))
+#define local_inc_return(l) local_add_return(1, (l))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
+#define local_inc_and_test(l) (local_inc_return(l) == 0)
+#define local_dec_and_test(l) (local_sub_return(1, (l)) == 0)
+#define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __local_inc(l) ((l)->a.counter++)
+#define __local_dec(l) ((l)->a.counter++)
+#define __local_add(i, l) ((l)->a.counter+=(i))
+#define __local_sub(i, l) ((l)->a.counter-=(i))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_local_wrap_v(l)   ({ local_t res__;   preempt_disable();   res__ = (l);   preempt_enable();   res__; })
+#define cpu_local_wrap(l)   ({ preempt_disable();   l;   preempt_enable(); })  
+#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
+#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
+#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
+#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
+#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __cpu_local_inc(l) cpu_local_inc(l)
+#define __cpu_local_dec(l) cpu_local_dec(l)
+#define __cpu_local_add(i, l) cpu_local_add((i), (l))
+#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/mach-au1x00/au1000.h b/libc/kernel/arch-mips/asm/mach-au1x00/au1000.h
new file mode 100644
index 0000000..c331879
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mach-au1x00/au1000.h
@@ -0,0 +1,898 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _AU1000_H_
+#define _AU1000_H_
+#ifndef _LANGUAGE_ASSEMBLY
+#include <linux/delay.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/types.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+struct au1xxx_irqmap {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int im_irq;
+ int im_type;
+ int im_request;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define MEM_STCFG0 0xB4001000
+#define MEM_STTIME0 0xB4001004
+#define MEM_STADDR0 0xB4001008
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEM_STCFG1 0xB4001010
+#define MEM_STTIME1 0xB4001014
+#define MEM_STADDR1 0xB4001018
+#define MEM_STCFG2 0xB4001020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEM_STTIME2 0xB4001024
+#define MEM_STADDR2 0xB4001028
+#define MEM_STCFG3 0xB4001030
+#define MEM_STTIME3 0xB4001034
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEM_STADDR3 0xB4001038
+#define IC0_CFG0RD 0xB0400040
+#define IC0_CFG0SET 0xB0400040
+#define IC0_CFG0CLR 0xB0400044
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_CFG1RD 0xB0400048
+#define IC0_CFG1SET 0xB0400048
+#define IC0_CFG1CLR 0xB040004C
+#define IC0_CFG2RD 0xB0400050
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_CFG2SET 0xB0400050
+#define IC0_CFG2CLR 0xB0400054
+#define IC0_REQ0INT 0xB0400054
+#define IC0_SRCRD 0xB0400058
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_SRCSET 0xB0400058
+#define IC0_SRCCLR 0xB040005C
+#define IC0_REQ1INT 0xB040005C
+#define IC0_ASSIGNRD 0xB0400060
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_ASSIGNSET 0xB0400060
+#define IC0_ASSIGNCLR 0xB0400064
+#define IC0_WAKERD 0xB0400068
+#define IC0_WAKESET 0xB0400068
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_WAKECLR 0xB040006C
+#define IC0_MASKRD 0xB0400070
+#define IC0_MASKSET 0xB0400070
+#define IC0_MASKCLR 0xB0400074
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_RISINGRD 0xB0400078
+#define IC0_RISINGCLR 0xB0400078
+#define IC0_FALLINGRD 0xB040007C
+#define IC0_FALLINGCLR 0xB040007C
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC0_TESTBIT 0xB0400080
+#define IC1_CFG0RD 0xB1800040
+#define IC1_CFG0SET 0xB1800040
+#define IC1_CFG0CLR 0xB1800044
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_CFG1RD 0xB1800048
+#define IC1_CFG1SET 0xB1800048
+#define IC1_CFG1CLR 0xB180004C
+#define IC1_CFG2RD 0xB1800050
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_CFG2SET 0xB1800050
+#define IC1_CFG2CLR 0xB1800054
+#define IC1_REQ0INT 0xB1800054
+#define IC1_SRCRD 0xB1800058
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_SRCSET 0xB1800058
+#define IC1_SRCCLR 0xB180005C
+#define IC1_REQ1INT 0xB180005C
+#define IC1_ASSIGNRD 0xB1800060
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_ASSIGNSET 0xB1800060
+#define IC1_ASSIGNCLR 0xB1800064
+#define IC1_WAKERD 0xB1800068
+#define IC1_WAKESET 0xB1800068
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_WAKECLR 0xB180006C
+#define IC1_MASKRD 0xB1800070
+#define IC1_MASKSET 0xB1800070
+#define IC1_MASKCLR 0xB1800074
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_RISINGRD 0xB1800078
+#define IC1_RISINGCLR 0xB1800078
+#define IC1_FALLINGRD 0xB180007C
+#define IC1_FALLINGCLR 0xB180007C
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IC1_TESTBIT 0xB1800080
+#define INTC_INT_DISABLED 0x0
+#define INTC_INT_RISE_EDGE 0x1
+#define INTC_INT_FALL_EDGE 0x2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INTC_INT_RISE_AND_FALL_EDGE 0x3
+#define INTC_INT_HIGH_LEVEL 0x5
+#define INTC_INT_LOW_LEVEL 0x6
+#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
+#define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
+#define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_BASE + 32)
+#define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
+#define INTX 0xFF  
+#define SYS_BASE 0xB1900000
+#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CNTRL_E1S (1 << 23)
+#define SYS_CNTRL_T1S (1 << 20)
+#define SYS_CNTRL_M21 (1 << 19)
+#define SYS_CNTRL_M11 (1 << 18)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CNTRL_M01 (1 << 17)
+#define SYS_CNTRL_C1S (1 << 16)
+#define SYS_CNTRL_BP (1 << 14)
+#define SYS_CNTRL_EN1 (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CNTRL_BT1 (1 << 12)
+#define SYS_CNTRL_EN0 (1 << 11)
+#define SYS_CNTRL_BT0 (1 << 10)
+#define SYS_CNTRL_E0 (1 << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CNTRL_E0S (1 << 7)
+#define SYS_CNTRL_32S (1 << 5)
+#define SYS_CNTRL_T0S (1 << 4)
+#define SYS_CNTRL_M20 (1 << 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CNTRL_M10 (1 << 2)
+#define SYS_CNTRL_M00 (1 << 1)
+#define SYS_CNTRL_C0S (1 << 0)
+#define SYS_TOYTRIM (SYS_BASE + 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_TOYWRITE (SYS_BASE + 4)
+#define SYS_TOYMATCH0 (SYS_BASE + 8)
+#define SYS_TOYMATCH1 (SYS_BASE + 0xC)
+#define SYS_TOYMATCH2 (SYS_BASE + 0x10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_TOYREAD (SYS_BASE + 0x40)
+#define SYS_RTCTRIM (SYS_BASE + 0x44)
+#define SYS_RTCWRITE (SYS_BASE + 0x48)
+#define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_RTCMATCH1 (SYS_BASE + 0x50)
+#define SYS_RTCMATCH2 (SYS_BASE + 0x54)
+#define SYS_RTCREAD (SYS_BASE + 0x58)
+#define I2S_DATA 0xB1000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_DATA_MASK 0xffffff
+#define I2S_CONFIG 0xB1000004
+#define I2S_CONFIG_XU (1 << 25)
+#define I2S_CONFIG_XO (1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_CONFIG_RU (1 << 23)
+#define I2S_CONFIG_RO (1 << 22)
+#define I2S_CONFIG_TR (1 << 21)
+#define I2S_CONFIG_TE (1 << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_CONFIG_TF (1 << 19)
+#define I2S_CONFIG_RR (1 << 18)
+#define I2S_CONFIG_RE (1 << 17)
+#define I2S_CONFIG_RF (1 << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_CONFIG_PD (1 << 11)
+#define I2S_CONFIG_LB (1 << 10)
+#define I2S_CONFIG_IC (1 << 9)
+#define I2S_CONFIG_FM_BIT 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
+#define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
+#define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
+#define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_CONFIG_TN (1 << 6)
+#define I2S_CONFIG_RN (1 << 5)
+#define I2S_CONFIG_SZ_BIT 0
+#define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define I2S_CONTROL 0xB1000008
+#define I2S_CONTROL_D (1 << 1)
+#define I2S_CONTROL_CE (1 << 0)
+#ifndef USB_OHCI_LEN
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USB_OHCI_LEN 0x00100000
+#endif
+#define USBD_EP0RD 0xB0200000
+#define USBD_EP0WR 0xB0200004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBD_EP2WR 0xB0200008
+#define USBD_EP3WR 0xB020000C
+#define USBD_EP4RD 0xB0200010
+#define USBD_EP5RD 0xB0200014
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBD_INTEN 0xB0200018
+#define USBD_INTSTAT 0xB020001C
+#define USBDEV_INT_SOF (1 << 12)
+#define USBDEV_INT_HF_BIT 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
+#define USBDEV_INT_CMPLT_BIT 0
+#define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
+#define USBD_CONFIG 0xB0200020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBD_EP0CS 0xB0200024
+#define USBD_EP2CS 0xB0200028
+#define USBD_EP3CS 0xB020002C
+#define USBD_EP4CS 0xB0200030
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBD_EP5CS 0xB0200034
+#define USBDEV_CS_SU (1 << 14)
+#define USBDEV_CS_NAK (1 << 13)
+#define USBDEV_CS_ACK (1 << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBDEV_CS_BUSY (1 << 11)
+#define USBDEV_CS_TSIZE_BIT 1
+#define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
+#define USBDEV_CS_STALL (1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBD_EP0RDSTAT 0xB0200040
+#define USBD_EP0WRSTAT 0xB0200044
+#define USBD_EP2WRSTAT 0xB0200048
+#define USBD_EP3WRSTAT 0xB020004C
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBD_EP4RDSTAT 0xB0200050
+#define USBD_EP5RDSTAT 0xB0200054
+#define USBDEV_FSTAT_FLUSH (1 << 6)
+#define USBDEV_FSTAT_UF (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBDEV_FSTAT_OF (1 << 4)
+#define USBDEV_FSTAT_FCNT_BIT 0
+#define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
+#define USBD_ENABLE 0xB0200058
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USBDEV_ENABLE (1 << 1)
+#define USBDEV_CE (1 << 0)
+#define MAC_CONTROL 0x0
+#define MAC_RX_ENABLE (1 << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_TX_ENABLE (1 << 3)
+#define MAC_DEF_CHECK (1 << 5)
+#define MAC_SET_BL(X) (((X) & 0x3) << 6)
+#define MAC_AUTO_PAD (1 << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_DISABLE_RETRY (1 << 10)
+#define MAC_DISABLE_BCAST (1 << 11)
+#define MAC_LATE_COL (1 << 12)
+#define MAC_HASH_MODE (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_HASH_ONLY (1 << 15)
+#define MAC_PASS_ALL (1 << 16)
+#define MAC_INVERSE_FILTER (1 << 17)
+#define MAC_PROMISCUOUS (1 << 18)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_PASS_ALL_MULTI (1 << 19)
+#define MAC_FULL_DUPLEX (1 << 20)
+#define MAC_NORMAL_MODE 0
+#define MAC_INT_LOOPBACK (1 << 21)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_EXT_LOOPBACK (1 << 22)
+#define MAC_DISABLE_RX_OWN (1 << 23)
+#define MAC_BIG_ENDIAN (1 << 30)
+#define MAC_RX_ALL (1 << 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_ADDRESS_HIGH 0x4
+#define MAC_ADDRESS_LOW 0x8
+#define MAC_MCAST_HIGH 0xC
+#define MAC_MCAST_LOW 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_MII_CNTRL 0x14
+#define MAC_MII_BUSY (1 << 0)
+#define MAC_MII_READ 0
+#define MAC_MII_WRITE (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
+#define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
+#define MAC_MII_DATA 0x18
+#define MAC_FLOW_CNTRL 0x1C
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_FLOW_CNTRL_BUSY (1 << 0)
+#define MAC_FLOW_CNTRL_ENABLE (1 << 1)
+#define MAC_PASS_CONTROL (1 << 2)
+#define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_VLAN1_TAG 0x20
+#define MAC_VLAN2_TAG 0x24
+#define MAC_EN_CLOCK_ENABLE (1 << 0)
+#define MAC_EN_RESET0 (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_EN_TOSS (0 << 2)
+#define MAC_EN_CACHEABLE (1 << 3)
+#define MAC_EN_RESET1 (1 << 4)
+#define MAC_EN_RESET2 (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_DMA_RESET (1 << 6)
+#define MAC0_TX_DMA_ADDR 0xB4004000
+#define MAC1_TX_DMA_ADDR 0xB4004200
+#define MAC_TX_BUFF0_STATUS 0x0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX_FRAME_ABORTED (1 << 0)
+#define TX_JAB_TIMEOUT (1 << 1)
+#define TX_NO_CARRIER (1 << 2)
+#define TX_LOSS_CARRIER (1 << 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX_EXC_DEF (1 << 4)
+#define TX_LATE_COLL_ABORT (1 << 5)
+#define TX_EXC_COLL (1 << 6)
+#define TX_UNDERRUN (1 << 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX_DEFERRED (1 << 8)
+#define TX_LATE_COLL (1 << 9)
+#define TX_COLL_CNT_MASK (0xF << 10)
+#define TX_PKT_RETRY (1 << 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_TX_BUFF0_ADDR 0x4
+#define TX_DMA_ENABLE (1 << 0)
+#define TX_T_DONE (1 << 1)
+#define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_TX_BUFF0_LEN 0x8
+#define MAC_TX_BUFF1_STATUS 0x10
+#define MAC_TX_BUFF1_ADDR 0x14
+#define MAC_TX_BUFF1_LEN 0x18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_TX_BUFF2_STATUS 0x20
+#define MAC_TX_BUFF2_ADDR 0x24
+#define MAC_TX_BUFF2_LEN 0x28
+#define MAC_TX_BUFF3_STATUS 0x30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_TX_BUFF3_ADDR 0x34
+#define MAC_TX_BUFF3_LEN 0x38
+#define MAC0_RX_DMA_ADDR 0xB4004100
+#define MAC1_RX_DMA_ADDR 0xB4004300
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_RX_BUFF0_STATUS 0x0
+#define RX_FRAME_LEN_MASK 0x3fff
+#define RX_WDOG_TIMER (1 << 14)
+#define RX_RUNT (1 << 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_OVERLEN (1 << 16)
+#define RX_COLL (1 << 17)
+#define RX_ETHER (1 << 18)
+#define RX_MII_ERROR (1 << 19)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_DRIBBLING (1 << 20)
+#define RX_CRC_ERROR (1 << 21)
+#define RX_VLAN1 (1 << 22)
+#define RX_VLAN2 (1 << 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_LEN_ERROR (1 << 24)
+#define RX_CNTRL_FRAME (1 << 25)
+#define RX_U_CNTRL_FRAME (1 << 26)
+#define RX_MCAST_FRAME (1 << 27)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_BCAST_FRAME (1 << 28)
+#define RX_FILTER_FAIL (1 << 29)
+#define RX_PACKET_FILTER (1 << 30)
+#define RX_MISSED_FRAME (1 << 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN |   RX_COLL | RX_MII_ERROR | RX_CRC_ERROR |   RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
+#define MAC_RX_BUFF0_ADDR 0x4
+#define RX_DMA_ENABLE (1 << 0)
+#define RX_T_DONE (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
+#define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
+#define MAC_RX_BUFF1_STATUS 0x10
+#define MAC_RX_BUFF1_ADDR 0x14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAC_RX_BUFF2_STATUS 0x20
+#define MAC_RX_BUFF2_ADDR 0x24
+#define MAC_RX_BUFF3_STATUS 0x30
+#define MAC_RX_BUFF3_ADDR 0x34
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_BASE UART0_ADDR
+#define UART_DEBUG_BASE UART3_ADDR
+#define UART_RX 0  
+#define UART_TX 4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_IER 8  
+#define UART_IIR 0xC  
+#define UART_FCR 0x10  
+#define UART_LCR 0x14  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_MCR 0x18  
+#define UART_LSR 0x1C  
+#define UART_MSR 0x20  
+#define UART_CLK 0x28  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_MOD_CNTRL 0x100  
+#define UART_FCR_ENABLE_FIFO 0x01  
+#define UART_FCR_CLEAR_RCVR 0x02  
+#define UART_FCR_CLEAR_XMIT 0x04  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_FCR_DMA_SELECT 0x08  
+#define UART_FCR_TRIGGER_MASK 0xF0  
+#define UART_FCR_R_TRIGGER_1 0x00  
+#define UART_FCR_R_TRIGGER_4 0x40  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_FCR_R_TRIGGER_8 0x80  
+#define UART_FCR_R_TRIGGER_14 0xA0  
+#define UART_FCR_T_TRIGGER_0 0x00  
+#define UART_FCR_T_TRIGGER_4 0x10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_FCR_T_TRIGGER_8 0x20  
+#define UART_FCR_T_TRIGGER_12 0x30  
+#define UART_LCR_SBC 0x40  
+#define UART_LCR_SPAR 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_LCR_EPAR 0x10  
+#define UART_LCR_PARITY 0x08  
+#define UART_LCR_STOP 0x04  
+#define UART_LCR_WLEN5 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_LCR_WLEN6 0x01  
+#define UART_LCR_WLEN7 0x02  
+#define UART_LCR_WLEN8 0x03  
+#define UART_LSR_TEMT 0x40  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_LSR_THRE 0x20  
+#define UART_LSR_BI 0x10  
+#define UART_LSR_FE 0x08  
+#define UART_LSR_PE 0x04  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_LSR_OE 0x02  
+#define UART_LSR_DR 0x01  
+#define UART_IIR_NO_INT 0x01  
+#define UART_IIR_ID 0x06  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_IIR_MSI 0x00  
+#define UART_IIR_THRI 0x02  
+#define UART_IIR_RDI 0x04  
+#define UART_IIR_RLSI 0x06  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_IER_MSI 0x08  
+#define UART_IER_RLSI 0x04  
+#define UART_IER_THRI 0x02  
+#define UART_IER_RDI 0x01  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_MCR_LOOP 0x10  
+#define UART_MCR_OUT2 0x08  
+#define UART_MCR_OUT1 0x04  
+#define UART_MCR_RTS 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_MCR_DTR 0x01  
+#define UART_MSR_DCD 0x80  
+#define UART_MSR_RI 0x40  
+#define UART_MSR_DSR 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_MSR_CTS 0x10  
+#define UART_MSR_DDCD 0x08  
+#define UART_MSR_TERI 0x04  
+#define UART_MSR_DDSR 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UART_MSR_DCTS 0x01  
+#define UART_MSR_ANY_DELTA 0x0F  
+#define SSI0_STATUS 0xB1600000
+#define SSI_STATUS_BF (1 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_STATUS_OF (1 << 3)
+#define SSI_STATUS_UF (1 << 2)
+#define SSI_STATUS_D (1 << 1)
+#define SSI_STATUS_B (1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI0_INT 0xB1600004
+#define SSI_INT_OI (1 << 3)
+#define SSI_INT_UI (1 << 2)
+#define SSI_INT_DI (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI0_INT_ENABLE 0xB1600008
+#define SSI_INTE_OIE (1 << 3)
+#define SSI_INTE_UIE (1 << 2)
+#define SSI_INTE_DIE (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI0_CONFIG 0xB1600020
+#define SSI_CONFIG_AO (1 << 24)
+#define SSI_CONFIG_DO (1 << 23)
+#define SSI_CONFIG_ALEN_BIT 20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_ALEN_MASK (0x7 << 20)
+#define SSI_CONFIG_DLEN_BIT 16
+#define SSI_CONFIG_DLEN_MASK (0x7 << 16)
+#define SSI_CONFIG_DD (1 << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_AD (1 << 10)
+#define SSI_CONFIG_BM_BIT 8
+#define SSI_CONFIG_BM_MASK (0x3 << 8)
+#define SSI_CONFIG_CE (1 << 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_DP (1 << 6)
+#define SSI_CONFIG_DL (1 << 5)
+#define SSI_CONFIG_EP (1 << 4)
+#define SSI0_ADATA 0xB1600024
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_AD_D (1 << 24)
+#define SSI_AD_ADDR_BIT 16
+#define SSI_AD_ADDR_MASK (0xff << 16)
+#define SSI_AD_DATA_BIT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_AD_DATA_MASK (0xfff << 0)
+#define SSI0_CLKDIV 0xB1600028
+#define SSI0_CONTROL 0xB1600100
+#define SSI_CONTROL_CD (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONTROL_E (1 << 0)
+#define SSI1_STATUS 0xB1680000
+#define SSI1_INT 0xB1680004
+#define SSI1_INT_ENABLE 0xB1680008
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI1_CONFIG 0xB1680020
+#define SSI1_ADATA 0xB1680024
+#define SSI1_CLKDIV 0xB1680028
+#define SSI1_ENABLE 0xB1680100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_STATUS_BF (1 << 4)
+#define SSI_STATUS_OF (1 << 3)
+#define SSI_STATUS_UF (1 << 2)
+#define SSI_STATUS_D (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_STATUS_B (1 << 0)
+#define SSI_INT_OI (1 << 3)
+#define SSI_INT_UI (1 << 2)
+#define SSI_INT_DI (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_INTEN_OIE (1 << 3)
+#define SSI_INTEN_UIE (1 << 2)
+#define SSI_INTEN_DIE (1 << 1)
+#define SSI_CONFIG_AO (1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_DO (1 << 23)
+#define SSI_CONFIG_ALEN (7 << 20)
+#define SSI_CONFIG_DLEN (15 << 16)
+#define SSI_CONFIG_DD (1 << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_AD (1 << 10)
+#define SSI_CONFIG_BM (3 << 8)
+#define SSI_CONFIG_CE (1 << 7)
+#define SSI_CONFIG_DP (1 << 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_DL (1 << 5)
+#define SSI_CONFIG_EP (1 << 4)
+#define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
+#define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_CONFIG_BM_HI (0 << 8)
+#define SSI_CONFIG_BM_LO (1 << 8)
+#define SSI_CONFIG_BM_CY (2 << 8)
+#define SSI_ADATA_D (1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_ADATA_ADDR (0xFF << 16)
+#define SSI_ADATA_DATA 0x0FFF
+#define SSI_ADATA_ADDR_N(N) (N << 16)
+#define SSI_ENABLE_CD (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSI_ENABLE_E (1 << 0)
+#define IRDA_BASE 0xB0300000
+#define IR_RING_PTR_STATUS (IRDA_BASE + 0x00)
+#define IR_RING_BASE_ADDR_H (IRDA_BASE + 0x04)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_RING_BASE_ADDR_L (IRDA_BASE + 0x08)
+#define IR_RING_SIZE (IRDA_BASE + 0x0C)
+#define IR_RING_PROMPT (IRDA_BASE + 0x10)
+#define IR_RING_ADDR_CMPR (IRDA_BASE + 0x14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_INT_CLEAR (IRDA_BASE + 0x18)
+#define IR_CONFIG_1 (IRDA_BASE + 0x20)
+#define IR_RX_INVERT_LED (1 << 0)
+#define IR_TX_INVERT_LED (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_ST (1 << 2)
+#define IR_SF (1 << 3)
+#define IR_SIR (1 << 4)
+#define IR_MIR (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_FIR (1 << 6)
+#define IR_16CRC (1 << 7)
+#define IR_TD (1 << 8)
+#define IR_RX_ALL (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_DMA_ENABLE (1 << 10)
+#define IR_RX_ENABLE (1 << 11)
+#define IR_TX_ENABLE (1 << 12)
+#define IR_LOOPBACK (1 << 14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE |   IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
+#define IR_SIR_FLAGS (IRDA_BASE + 0x24)
+#define IR_ENABLE (IRDA_BASE + 0x28)
+#define IR_RX_STATUS (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_TX_STATUS (1 << 10)
+#define IR_READ_PHY_CONFIG (IRDA_BASE + 0x2C)
+#define IR_WRITE_PHY_CONFIG (IRDA_BASE + 0x30)
+#define IR_MAX_PKT_LEN (IRDA_BASE + 0x34)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_RX_BYTE_CNT (IRDA_BASE + 0x38)
+#define IR_CONFIG_2 (IRDA_BASE + 0x3C)
+#define IR_MODE_INV (1 << 0)
+#define IR_ONE_PIN (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IR_INTERFACE_CONFIG (IRDA_BASE + 0x40)
+#define SYS_PINFUNC 0xB190002C
+#define SYS_PF_USB (1 << 15)  
+#define SYS_PF_U3 (1 << 14)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_U2 (1 << 13)  
+#define SYS_PF_U1 (1 << 12)  
+#define SYS_PF_SRC (1 << 11)  
+#define SYS_PF_CK5 (1 << 10)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_CK4 (1 << 9)  
+#define SYS_PF_IRF (1 << 8)  
+#define SYS_PF_UR3 (1 << 7)  
+#define SYS_PF_I2D (1 << 6)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_I2S (1 << 5)  
+#define SYS_PF_NI2 (1 << 4)  
+#define SYS_PF_U0 (1 << 3)  
+#define SYS_PF_RD (1 << 2)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_A97 (1 << 1)  
+#define SYS_PF_S0 (1 << 0)  
+#define SYS_PF_PC (1 << 18)  
+#define SYS_PF_LCD (1 << 17)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_CS (1 << 16)  
+#define SYS_PF_EX0 (1 << 9)  
+#define SYS_PF_PSC2_MASK (7 << 17)
+#define SYS_PF_PSC2_AC97 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_PSC2_SPI 0
+#define SYS_PF_PSC2_I2S (1 << 17)
+#define SYS_PF_PSC2_SMBUS (3 << 17)
+#define SYS_PF_PSC2_GPIO (7 << 17)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_PSC3_MASK (7 << 20)
+#define SYS_PF_PSC3_AC97 0
+#define SYS_PF_PSC3_SPI 0
+#define SYS_PF_PSC3_I2S (1 << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_PF_PSC3_SMBUS (3 << 20)
+#define SYS_PF_PSC3_GPIO (7 << 20)
+#define SYS_PF_PSC1_S1 (1 << 1)
+#define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_TRIOUTRD 0xB1900100
+#define SYS_TRIOUTCLR 0xB1900100
+#define SYS_OUTPUTRD 0xB1900108
+#define SYS_OUTPUTSET 0xB1900108
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_OUTPUTCLR 0xB190010C
+#define SYS_PINSTATERD 0xB1900110
+#define SYS_PININPUTEN 0xB1900110
+#define GPIO2_BASE 0xB1700000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GPIO2_DIR (GPIO2_BASE + 0)
+#define GPIO2_OUTPUT (GPIO2_BASE + 8)
+#define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
+#define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GPIO2_ENABLE (GPIO2_BASE + 0x14)
+#define SYS_SCRATCH0 0xB1900018
+#define SYS_SCRATCH1 0xB190001C
+#define SYS_WAKEMSK 0xB1900034
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_ENDIAN 0xB1900038
+#define SYS_POWERCTRL 0xB190003C
+#define SYS_WAKESRC 0xB190005C
+#define SYS_SLPPWR 0xB1900078
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_SLEEP 0xB190007C
+#define SYS_FREQCTRL0 0xB1900020
+#define SYS_FC_FRDIV2_BIT 22
+#define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_FC_FE2 (1 << 21)
+#define SYS_FC_FS2 (1 << 20)
+#define SYS_FC_FRDIV1_BIT 12
+#define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_FC_FE1 (1 << 11)
+#define SYS_FC_FS1 (1 << 10)
+#define SYS_FC_FRDIV0_BIT 2
+#define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_FC_FE0 (1 << 1)
+#define SYS_FC_FS0 (1 << 0)
+#define SYS_FREQCTRL1 0xB1900024
+#define SYS_FC_FRDIV5_BIT 22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
+#define SYS_FC_FE5 (1 << 21)
+#define SYS_FC_FS5 (1 << 20)
+#define SYS_FC_FRDIV4_BIT 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
+#define SYS_FC_FE4 (1 << 11)
+#define SYS_FC_FS4 (1 << 10)
+#define SYS_FC_FRDIV3_BIT 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
+#define SYS_FC_FE3 (1 << 1)
+#define SYS_FC_FS3 (1 << 0)
+#define SYS_CLKSRC 0xB1900028
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_ME1_BIT 27
+#define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
+#define SYS_CS_DE1 (1 << 26)
+#define SYS_CS_CE1 (1 << 25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_ME0_BIT 22
+#define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
+#define SYS_CS_DE0 (1 << 21)
+#define SYS_CS_CE0 (1 << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_MI2_BIT 17
+#define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
+#define SYS_CS_DI2 (1 << 16)
+#define SYS_CS_CI2 (1 << 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_MUH_BIT 12
+#define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
+#define SYS_CS_DUH (1 << 11)
+#define SYS_CS_CUH (1 << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_MUD_BIT 7
+#define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
+#define SYS_CS_DUD (1 << 6)
+#define SYS_CS_CUD (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_MIR_BIT 2
+#define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
+#define SYS_CS_DIR (1 << 1)
+#define SYS_CS_CIR (1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_MUX_AUX 0x1
+#define SYS_CS_MUX_FQ0 0x2
+#define SYS_CS_MUX_FQ1 0x3
+#define SYS_CS_MUX_FQ2 0x4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_CS_MUX_FQ3 0x5
+#define SYS_CS_MUX_FQ4 0x6
+#define SYS_CS_MUX_FQ5 0x7
+#define SYS_CPUPLL 0xB1900060
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_AUXPLL 0xB1900064
+#define AC97C_CONFIG 0xB0000000
+#define AC97C_RECV_SLOTS_BIT 13
+#define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_XMIT_SLOTS_BIT 3
+#define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
+#define AC97C_SG (1 << 2)
+#define AC97C_SYNC (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_RESET (1 << 0)
+#define AC97C_STATUS 0xB0000004
+#define AC97C_XU (1 << 11)
+#define AC97C_XO (1 << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_RU (1 << 9)
+#define AC97C_RO (1 << 8)
+#define AC97C_READY (1 << 7)
+#define AC97C_CP (1 << 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_TR (1 << 5)
+#define AC97C_TE (1 << 4)
+#define AC97C_TF (1 << 3)
+#define AC97C_RR (1 << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_RE (1 << 1)
+#define AC97C_RF (1 << 0)
+#define AC97C_DATA 0xB0000008
+#define AC97C_CMD 0xB000000C
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_WD_BIT 16
+#define AC97C_READ (1 << 7)
+#define AC97C_INDEX_MASK 0x7f
+#define AC97C_CNTRL 0xB0000010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97C_RS (1 << 1)
+#define AC97C_CE (1 << 0)
+#define SD0_XMIT_FIFO 0xB0600000
+#define SD0_RECV_FIFO 0xB0600004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SD1_XMIT_FIFO 0xB0680000
+#define SD1_RECV_FIFO 0xB0680004
+#define IOPORT_RESOURCE_START 0x10000000
+#define IOPORT_RESOURCE_END 0xffffffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOMEM_RESOURCE_START 0x10000000
+#define IOMEM_RESOURCE_END 0xffffffff
+#define PCI_IO_START 0
+#define PCI_IO_END 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI_MEM_START 0
+#define PCI_MEM_END 0
+#define PCI_FIRST_DEVFN 0
+#define PCI_LAST_DEVFN 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef _LANGUAGE_ASSEMBLY
+typedef volatile struct {
+   u32 toytrim;
+   u32 toywrite;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 toymatch0;
+   u32 toymatch1;
+   u32 toymatch2;
+   u32 cntrctrl;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 scratch0;
+   u32 scratch1;
+   u32 freqctrl0;
+   u32 freqctrl1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 clksrc;
+   u32 pinfunc;
+   u32 reserved0;
+   u32 wakemsk;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 endian;
+   u32 powerctrl;
+   u32 toyread;
+   u32 rtctrim;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 rtcwrite;
+   u32 rtcmatch0;
+   u32 rtcmatch1;
+   u32 rtcmatch2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 rtcread;
+   u32 wakesrc;
+   u32 cpupll;
+   u32 auxpll;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 reserved1;
+   u32 reserved2;
+   u32 reserved3;
+   u32 reserved4;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 slppwr;
+   u32 sleep;
+   u32 reserved5[32];
+   u32 trioutrd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define trioutclr trioutrd
+   u32 reserved6;
+   u32 outputrd;
+#define outputset outputrd
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+   u32 outputclr;
+   u32 pinstaterd;
+#define pininputen pinstaterd
+} AU1X00_SYS;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef _LANGUAGE_ASSEMBLY
+struct cpu_spec {
+ unsigned int prid_mask;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int prid_value;
+ char *cpu_name;
+ unsigned char cpu_od;
+ unsigned char cpu_bclk;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char cpu_pll_wo;
+};
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/mach-au1x00/au1xxx_psc.h b/libc/kernel/arch-mips/asm/mach-au1x00/au1xxx_psc.h
new file mode 100644
index 0000000..2f01be0
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mach-au1x00/au1xxx_psc.h
@@ -0,0 +1,449 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _AU1000_PSC_H_
+#define _AU1000_PSC_H_
+#define PSC_SEL_OFFSET 0x00000000
+#define PSC_CTRL_OFFSET 0x00000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SEL_CLK_MASK (3 << 4)
+#define PSC_SEL_CLK_INTCLK (0 << 4)
+#define PSC_SEL_CLK_EXTCLK (1 << 4)
+#define PSC_SEL_CLK_SERCLK (2 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SEL_PS_MASK 0x00000007
+#define PSC_SEL_PS_DISABLED 0
+#define PSC_SEL_PS_SPIMODE 2
+#define PSC_SEL_PS_I2SMODE 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SEL_PS_AC97MODE 4
+#define PSC_SEL_PS_SMBUSMODE 5
+#define PSC_CTRL_DISABLE 0
+#define PSC_CTRL_SUSPEND 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_CTRL_ENABLE 3
+#define PSC_AC97CFG_OFFSET 0x00000008
+#define PSC_AC97MSK_OFFSET 0x0000000c
+#define PSC_AC97PCR_OFFSET 0x00000010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97STAT_OFFSET 0x00000014
+#define PSC_AC97EVNT_OFFSET 0x00000018
+#define PSC_AC97TXRX_OFFSET 0x0000001c
+#define PSC_AC97CDC_OFFSET 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97RST_OFFSET 0x00000024
+#define PSC_AC97GPO_OFFSET 0x00000028
+#define PSC_AC97GPI_OFFSET 0x0000002c
+#define AC97_PSC_SEL (AC97_PSC_BASE + PSC_SEL_OFFSET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AC97_PSC_CTRL (AC97_PSC_BASE + PSC_CTRL_OFFSET)
+#define PSC_AC97CFG (AC97_PSC_BASE + PSC_AC97CFG_OFFSET)
+#define PSC_AC97MSK (AC97_PSC_BASE + PSC_AC97MSK_OFFSET)
+#define PSC_AC97PCR (AC97_PSC_BASE + PSC_AC97PCR_OFFSET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97STAT (AC97_PSC_BASE + PSC_AC97STAT_OFFSET)
+#define PSC_AC97EVNT (AC97_PSC_BASE + PSC_AC97EVNT_OFFSET)
+#define PSC_AC97TXRX (AC97_PSC_BASE + PSC_AC97TXRX_OFFSET)
+#define PSC_AC97CDC (AC97_PSC_BASE + PSC_AC97CDC_OFFSET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97RST (AC97_PSC_BASE + PSC_AC97RST_OFFSET)
+#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET)
+#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET)
+#define PSC_AC97CFG_RT_MASK (3 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97CFG_RT_FIFO1 (0 << 30)
+#define PSC_AC97CFG_RT_FIFO2 (1 << 30)
+#define PSC_AC97CFG_RT_FIFO4 (2 << 30)
+#define PSC_AC97CFG_RT_FIFO8 (3 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97CFG_TT_MASK (3 << 28)
+#define PSC_AC97CFG_TT_FIFO1 (0 << 28)
+#define PSC_AC97CFG_TT_FIFO2 (1 << 28)
+#define PSC_AC97CFG_TT_FIFO4 (2 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97CFG_TT_FIFO8 (3 << 28)
+#define PSC_AC97CFG_DD_DISABLE (1 << 27)
+#define PSC_AC97CFG_DE_ENABLE (1 << 26)
+#define PSC_AC97CFG_SE_ENABLE (1 << 25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97CFG_LEN_MASK (0xf << 21)
+#define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11)
+#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
+#define PSC_AC97CFG_GE_ENABLE (1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
+#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
+#define PSC_AC97CFG_SET_LEN(x) (((((x) - 2) / 2) & 0xf) << 21)
+#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97MSK_GR (1 << 25)
+#define PSC_AC97MSK_CD (1 << 24)
+#define PSC_AC97MSK_RR (1 << 13)
+#define PSC_AC97MSK_RO (1 << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97MSK_RU (1 << 11)
+#define PSC_AC97MSK_TR (1 << 10)
+#define PSC_AC97MSK_TO (1 << 9)
+#define PSC_AC97MSK_TU (1 << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97MSK_RD (1 << 5)
+#define PSC_AC97MSK_TD (1 << 4)
+#define PSC_AC97MSK_ALLMASK (PSC_AC97MSK_GR | PSC_AC97MSK_CD |   PSC_AC97MSK_RR | PSC_AC97MSK_RO |   PSC_AC97MSK_RU | PSC_AC97MSK_TR |   PSC_AC97MSK_TO | PSC_AC97MSK_TU |   PSC_AC97MSK_RD | PSC_AC97MSK_TD)
+#define PSC_AC97PCR_RC (1 << 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97PCR_RP (1 << 5)
+#define PSC_AC97PCR_RS (1 << 4)
+#define PSC_AC97PCR_TC (1 << 2)
+#define PSC_AC97PCR_TP (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97PCR_TS (1 << 0)
+#define PSC_AC97STAT_CB (1 << 26)
+#define PSC_AC97STAT_CP (1 << 25)
+#define PSC_AC97STAT_CR (1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97STAT_RF (1 << 13)
+#define PSC_AC97STAT_RE (1 << 12)
+#define PSC_AC97STAT_RR (1 << 11)
+#define PSC_AC97STAT_TF (1 << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97STAT_TE (1 << 9)
+#define PSC_AC97STAT_TR (1 << 8)
+#define PSC_AC97STAT_RB (1 << 5)
+#define PSC_AC97STAT_TB (1 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97STAT_DI (1 << 2)
+#define PSC_AC97STAT_DR (1 << 1)
+#define PSC_AC97STAT_SR (1 << 0)
+#define PSC_AC97EVNT_GR (1 << 25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97EVNT_CD (1 << 24)
+#define PSC_AC97EVNT_RR (1 << 13)
+#define PSC_AC97EVNT_RO (1 << 12)
+#define PSC_AC97EVNT_RU (1 << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97EVNT_TR (1 << 10)
+#define PSC_AC97EVNT_TO (1 << 9)
+#define PSC_AC97EVNT_TU (1 << 8)
+#define PSC_AC97EVNT_RD (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97EVNT_TD (1 << 4)
+#define PSC_AC97CDC_RD (1 << 25)
+#define PSC_AC97CDC_ID_MASK (3 << 23)
+#define PSC_AC97CDC_INDX_MASK (0x7f << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_AC97CDC_ID(x) (((x) & 0x03) << 23)
+#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
+#define PSC_AC97RST_RST (1 << 1)
+#define PSC_AC97RST_SNC (1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct psc_i2s {
+ u32 psc_sel;
+ u32 psc_ctrl;
+ u32 psc_i2scfg;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 psc_i2smsk;
+ u32 psc_i2spcr;
+ u32 psc_i2sstat;
+ u32 psc_i2sevent;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 psc_i2stxrx;
+ u32 psc_i2sudf;
+} psc_i2s_t;
+#define PSC_I2SCFG_OFFSET 0x08
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SMASK_OFFSET 0x0C
+#define PSC_I2SPCR_OFFSET 0x10
+#define PSC_I2SSTAT_OFFSET 0x14
+#define PSC_I2SEVENT_OFFSET 0x18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SRXTX_OFFSET 0x1C
+#define PSC_I2SUDF_OFFSET 0x20
+#define PSC_I2SCFG_RT_MASK (3 << 30)
+#define PSC_I2SCFG_RT_FIFO1 (0 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_RT_FIFO2 (1 << 30)
+#define PSC_I2SCFG_RT_FIFO4 (2 << 30)
+#define PSC_I2SCFG_RT_FIFO8 (3 << 30)
+#define PSC_I2SCFG_TT_MASK (3 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_TT_FIFO1 (0 << 28)
+#define PSC_I2SCFG_TT_FIFO2 (1 << 28)
+#define PSC_I2SCFG_TT_FIFO4 (2 << 28)
+#define PSC_I2SCFG_TT_FIFO8 (3 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_DD_DISABLE (1 << 27)
+#define PSC_I2SCFG_DE_ENABLE (1 << 26)
+#define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16)
+#define PSC_I2SCFG_WS(n) ((n & 0xFF) << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_WS_MASK (PSC_I2SCFG_WS(0x3F))
+#define PSC_I2SCFG_WI (1 << 15)
+#define PSC_I2SCFG_DIV_MASK (3 << 13)
+#define PSC_I2SCFG_DIV2 (0 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_DIV4 (1 << 13)
+#define PSC_I2SCFG_DIV8 (2 << 13)
+#define PSC_I2SCFG_DIV16 (3 << 13)
+#define PSC_I2SCFG_BI (1 << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_BUF (1 << 11)
+#define PSC_I2SCFG_MLJ (1 << 10)
+#define PSC_I2SCFG_XM (1 << 9)
+#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
+#define PSC_I2SCFG_LB (1 << 2)
+#define PSC_I2SCFG_MLF (1 << 1)
+#define PSC_I2SCFG_MS (1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SMSK_RR (1 << 13)
+#define PSC_I2SMSK_RO (1 << 12)
+#define PSC_I2SMSK_RU (1 << 11)
+#define PSC_I2SMSK_TR (1 << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SMSK_TO (1 << 9)
+#define PSC_I2SMSK_TU (1 << 8)
+#define PSC_I2SMSK_RD (1 << 5)
+#define PSC_I2SMSK_TD (1 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SMSK_ALLMASK (PSC_I2SMSK_RR | PSC_I2SMSK_RO |   PSC_I2SMSK_RU | PSC_I2SMSK_TR |   PSC_I2SMSK_TO | PSC_I2SMSK_TU |   PSC_I2SMSK_RD | PSC_I2SMSK_TD)
+#define PSC_I2SPCR_RC (1 << 6)
+#define PSC_I2SPCR_RP (1 << 5)
+#define PSC_I2SPCR_RS (1 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SPCR_TC (1 << 2)
+#define PSC_I2SPCR_TP (1 << 1)
+#define PSC_I2SPCR_TS (1 << 0)
+#define PSC_I2SSTAT_RF (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SSTAT_RE (1 << 12)
+#define PSC_I2SSTAT_RR (1 << 11)
+#define PSC_I2SSTAT_TF (1 << 10)
+#define PSC_I2SSTAT_TE (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SSTAT_TR (1 << 8)
+#define PSC_I2SSTAT_RB (1 << 5)
+#define PSC_I2SSTAT_TB (1 << 4)
+#define PSC_I2SSTAT_DI (1 << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SSTAT_DR (1 << 1)
+#define PSC_I2SSTAT_SR (1 << 0)
+#define PSC_I2SEVNT_RR (1 << 13)
+#define PSC_I2SEVNT_RO (1 << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SEVNT_RU (1 << 11)
+#define PSC_I2SEVNT_TR (1 << 10)
+#define PSC_I2SEVNT_TO (1 << 9)
+#define PSC_I2SEVNT_TU (1 << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_I2SEVNT_RD (1 << 5)
+#define PSC_I2SEVNT_TD (1 << 4)
+typedef struct psc_spi {
+ u32 psc_sel;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 psc_ctrl;
+ u32 psc_spicfg;
+ u32 psc_spimsk;
+ u32 psc_spipcr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 psc_spistat;
+ u32 psc_spievent;
+ u32 psc_spitxrx;
+} psc_spi_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_RT_MASK (3 << 30)
+#define PSC_SPICFG_RT_FIFO1 (0 << 30)
+#define PSC_SPICFG_RT_FIFO2 (1 << 30)
+#define PSC_SPICFG_RT_FIFO4 (2 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_RT_FIFO8 (3 << 30)
+#define PSC_SPICFG_TT_MASK (3 << 28)
+#define PSC_SPICFG_TT_FIFO1 (0 << 28)
+#define PSC_SPICFG_TT_FIFO2 (1 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_TT_FIFO4 (2 << 28)
+#define PSC_SPICFG_TT_FIFO8 (3 << 28)
+#define PSC_SPICFG_DD_DISABLE (1 << 27)
+#define PSC_SPICFG_DE_ENABLE (1 << 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_CLR_BAUD(x) ((x) & ~((0x3f) << 15))
+#define PSC_SPICFG_SET_BAUD(x) (((x) & 0x3f) << 15)
+#define PSC_SPICFG_SET_DIV(x) (((x) & 0x03) << 13)
+#define PSC_SPICFG_DIV2 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_DIV4 1
+#define PSC_SPICFG_DIV8 2
+#define PSC_SPICFG_DIV16 3
+#define PSC_SPICFG_BI (1 << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_PSE (1 << 11)
+#define PSC_SPICFG_CGE (1 << 10)
+#define PSC_SPICFG_CDE (1 << 9)
+#define PSC_SPICFG_CLR_LEN(x) ((x) & ~((0x1f) << 4))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPICFG_SET_LEN(x) (((x-1) & 0x1f) << 4)
+#define PSC_SPICFG_LB (1 << 3)
+#define PSC_SPICFG_MLF (1 << 1)
+#define PSC_SPICFG_MO (1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPIMSK_MM (1 << 16)
+#define PSC_SPIMSK_RR (1 << 13)
+#define PSC_SPIMSK_RO (1 << 12)
+#define PSC_SPIMSK_RU (1 << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPIMSK_TR (1 << 10)
+#define PSC_SPIMSK_TO (1 << 9)
+#define PSC_SPIMSK_TU (1 << 8)
+#define PSC_SPIMSK_SD (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPIMSK_MD (1 << 4)
+#define PSC_SPIMSK_ALLMASK (PSC_SPIMSK_MM | PSC_SPIMSK_RR |   PSC_SPIMSK_RO | PSC_SPIMSK_TO |   PSC_SPIMSK_TU | PSC_SPIMSK_SD |   PSC_SPIMSK_MD)
+#define PSC_SPIPCR_RC (1 << 6)
+#define PSC_SPIPCR_SP (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPIPCR_SS (1 << 4)
+#define PSC_SPIPCR_TC (1 << 2)
+#define PSC_SPIPCR_MS (1 << 0)
+#define PSC_SPISTAT_RF (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPISTAT_RE (1 << 12)
+#define PSC_SPISTAT_RR (1 << 11)
+#define PSC_SPISTAT_TF (1 << 10)
+#define PSC_SPISTAT_TE (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPISTAT_TR (1 << 8)
+#define PSC_SPISTAT_SB (1 << 5)
+#define PSC_SPISTAT_MB (1 << 4)
+#define PSC_SPISTAT_DI (1 << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPISTAT_DR (1 << 1)
+#define PSC_SPISTAT_SR (1 << 0)
+#define PSC_SPIEVNT_MM (1 << 16)
+#define PSC_SPIEVNT_RR (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPIEVNT_RO (1 << 12)
+#define PSC_SPIEVNT_RU (1 << 11)
+#define PSC_SPIEVNT_TR (1 << 10)
+#define PSC_SPIEVNT_TO (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPIEVNT_TU (1 << 8)
+#define PSC_SPIEVNT_SD (1 << 5)
+#define PSC_SPIEVNT_MD (1 << 4)
+#define PSC_SPITXRX_LC (1 << 29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SPITXRX_SR (1 << 28)
+typedef struct psc_smb {
+ u32 psc_sel;
+ u32 psc_ctrl;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 psc_smbcfg;
+ u32 psc_smbmsk;
+ u32 psc_smbpcr;
+ u32 psc_smbstat;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 psc_smbevnt;
+ u32 psc_smbtxrx;
+ u32 psc_smbtmr;
+} psc_smb_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBCFG_RT_MASK (3 << 30)
+#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
+#define PSC_SMBCFG_RT_FIFO2 (1 << 30)
+#define PSC_SMBCFG_RT_FIFO4 (2 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBCFG_RT_FIFO8 (3 << 30)
+#define PSC_SMBCFG_TT_MASK (3 << 28)
+#define PSC_SMBCFG_TT_FIFO1 (0 << 28)
+#define PSC_SMBCFG_TT_FIFO2 (1 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBCFG_TT_FIFO4 (2 << 28)
+#define PSC_SMBCFG_TT_FIFO8 (3 << 28)
+#define PSC_SMBCFG_DD_DISABLE (1 << 27)
+#define PSC_SMBCFG_DE_ENABLE (1 << 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBCFG_SET_DIV(x) (((x) & 0x03) << 13)
+#define PSC_SMBCFG_DIV2 0
+#define PSC_SMBCFG_DIV4 1
+#define PSC_SMBCFG_DIV8 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBCFG_DIV16 3
+#define PSC_SMBCFG_GCE (1 << 9)
+#define PSC_SMBCFG_SFM (1 << 8)
+#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBMSK_DN (1 << 30)
+#define PSC_SMBMSK_AN (1 << 29)
+#define PSC_SMBMSK_AL (1 << 28)
+#define PSC_SMBMSK_RR (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBMSK_RO (1 << 12)
+#define PSC_SMBMSK_RU (1 << 11)
+#define PSC_SMBMSK_TR (1 << 10)
+#define PSC_SMBMSK_TO (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBMSK_TU (1 << 8)
+#define PSC_SMBMSK_SD (1 << 5)
+#define PSC_SMBMSK_MD (1 << 4)
+#define PSC_SMBMSK_ALLMASK (PSC_SMBMSK_DN | PSC_SMBMSK_AN |   PSC_SMBMSK_AL | PSC_SMBMSK_RR |   PSC_SMBMSK_RO | PSC_SMBMSK_TO |   PSC_SMBMSK_TU | PSC_SMBMSK_SD |   PSC_SMBMSK_MD)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBPCR_DC (1 << 2)
+#define PSC_SMBPCR_MS (1 << 0)
+#define PSC_SMBSTAT_BB (1 << 28)
+#define PSC_SMBSTAT_RF (1 << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBSTAT_RE (1 << 12)
+#define PSC_SMBSTAT_RR (1 << 11)
+#define PSC_SMBSTAT_TF (1 << 10)
+#define PSC_SMBSTAT_TE (1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBSTAT_TR (1 << 8)
+#define PSC_SMBSTAT_SB (1 << 5)
+#define PSC_SMBSTAT_MB (1 << 4)
+#define PSC_SMBSTAT_DI (1 << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBSTAT_DR (1 << 1)
+#define PSC_SMBSTAT_SR (1 << 0)
+#define PSC_SMBEVNT_DN (1 << 30)
+#define PSC_SMBEVNT_AN (1 << 29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBEVNT_AL (1 << 28)
+#define PSC_SMBEVNT_RR (1 << 13)
+#define PSC_SMBEVNT_RO (1 << 12)
+#define PSC_SMBEVNT_RU (1 << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBEVNT_TR (1 << 10)
+#define PSC_SMBEVNT_TO (1 << 9)
+#define PSC_SMBEVNT_TU (1 << 8)
+#define PSC_SMBEVNT_SD (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBEVNT_MD (1 << 4)
+#define PSC_SMBEVNT_ALLCLR (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN |   PSC_SMBEVNT_AL | PSC_SMBEVNT_RR |   PSC_SMBEVNT_RO | PSC_SMBEVNT_TO |   PSC_SMBEVNT_TU | PSC_SMBEVNT_SD |   PSC_SMBEVNT_MD)
+#define PSC_SMBTXRX_RSR (1 << 28)
+#define PSC_SMBTXRX_STP (1 << 29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBTXRX_DATAMASK 0xff
+#define PSC_SMBTMR_SET_TH(x) (((x) & 0x03) << 30)
+#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
+#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
+#define PSC_SMBTMR_SET_SU(x) (((x) & 0x1f) << 10)
+#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
+#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/mach-generic/spaces.h b/libc/kernel/arch-mips/asm/mach-generic/spaces.h
new file mode 100644
index 0000000..cbda237
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mach-generic/spaces.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MACH_GENERIC_SPACES_H
+#define _ASM_MACH_GENERIC_SPACES_H
+#include <linux/const.h>
+#ifndef PHYS_OFFSET
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PHYS_OFFSET _AC(0, UL)
+#endif
+#ifndef PAGE_OFFSET
+#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/mach-ip22/ds1286.h b/libc/kernel/arch-mips/asm/mach-ip22/ds1286.h
new file mode 100644
index 0000000..1ea8a7d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mach-ip22/ds1286.h
@@ -0,0 +1,25 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MACH_IP22_DS1286_H
+#define __ASM_MACH_IP22_DS1286_H
+#include <asm/sgi/hpc3.h>
+#define rtc_read(reg) (hpc3c0->rtcregs[(reg)] & 0xff)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define rtc_write(data, reg) do { hpc3c0->rtcregs[(reg)] = (data); } while(0)
+#endif
diff --git a/libc/kernel/arch-sh/asm/mc146818rtc.h b/libc/kernel/arch-mips/asm/mc146818rtc.h
similarity index 64%
rename from libc/kernel/arch-sh/asm/mc146818rtc.h
rename to libc/kernel/arch-mips/asm/mc146818rtc.h
index fe5300a..6887ef4 100644
--- a/libc/kernel/arch-sh/asm/mc146818rtc.h
+++ b/libc/kernel/arch-mips/asm/mc146818rtc.h
@@ -7,9 +7,17 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _ASM_MC146818RTC_H
 #define _ASM_MC146818RTC_H
-
+#include <mc146818rtc.h>
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/mips-boards/bonito64.h b/libc/kernel/arch-mips/asm/mips-boards/bonito64.h
new file mode 100644
index 0000000..7561bbb
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mips-boards/bonito64.h
@@ -0,0 +1,363 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MIPS_BOARDS_BONITO64_H
+#define _ASM_MIPS_BOARDS_BONITO64_H
+#ifdef __ASSEMBLY__
+#define BONITO(x) (x)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO(x) *(volatile u32 *)(_pcictrl_bonito + (x))
+#define BONITO_BOOT_BASE 0x1fc00000
+#define BONITO_BOOT_SIZE 0x00100000
+#define BONITO_BOOT_TOP (BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_FLASH_BASE 0x1c000000
+#define BONITO_FLASH_SIZE 0x03000000
+#define BONITO_FLASH_TOP (BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1)
+#define BONITO_SOCKET_BASE 0x1f800000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SOCKET_SIZE 0x00400000
+#define BONITO_SOCKET_TOP (BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1)
+#define BONITO_REG_BASE 0x1fe00000
+#define BONITO_REG_SIZE 0x00040000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_REG_TOP (BONITO_REG_BASE+BONITO_REG_SIZE-1)
+#define BONITO_DEV_BASE 0x1ff00000
+#define BONITO_DEV_SIZE 0x00100000
+#define BONITO_DEV_TOP (BONITO_DEV_BASE+BONITO_DEV_SIZE-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCILO_BASE 0x10000000
+#define BONITO_PCILO_SIZE 0x0c000000
+#define BONITO_PCILO_TOP (BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1)
+#define BONITO_PCILO0_BASE 0x10000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCILO1_BASE 0x14000000
+#define BONITO_PCILO2_BASE 0x18000000
+#define BONITO_PCIHI_BASE 0x20000000
+#define BONITO_PCIHI_SIZE 0x20000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1)
+#define BONITO_PCIIO_BASE 0x1fd00000
+#define BONITO_PCIIO_SIZE 0x00100000
+#define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICFG_BASE 0x1fe80000
+#define BONITO_PCICFG_SIZE 0x00080000
+#define BONITO_PCICFG_TOP (BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1)
+#define BONITO_PCICONFIGBASE 0x00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_REGBASE 0x100
+#define BONITO_PCI_REG(x) BONITO(BONITO_PCICONFIGBASE + (x))
+#define BONITO_PCIDID BONITO_PCI_REG(0x00)
+#define BONITO_PCICMD BONITO_PCI_REG(0x04)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICLASS BONITO_PCI_REG(0x08)
+#define BONITO_PCILTIMER BONITO_PCI_REG(0x0c)
+#define BONITO_PCIBASE0 BONITO_PCI_REG(0x10)
+#define BONITO_PCIBASE1 BONITO_PCI_REG(0x14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIBASE2 BONITO_PCI_REG(0x18)
+#define BONITO_PCIEXPRBASE BONITO_PCI_REG(0x30)
+#define BONITO_PCIINT BONITO_PCI_REG(0x3c)
+#define BONITO_PCICMD_PERR_CLR 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICMD_SERR_CLR 0x40000000
+#define BONITO_PCICMD_MABORT_CLR 0x20000000
+#define BONITO_PCICMD_MTABORT_CLR 0x10000000
+#define BONITO_PCICMD_TABORT_CLR 0x08000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICMD_MPERR_CLR 0x01000000
+#define BONITO_PCICMD_PERRRESPEN 0x00000040
+#define BONITO_PCICMD_ASTEPEN 0x00000080
+#define BONITO_PCICMD_SERREN 0x00000100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCILTIMER_BUSLATENCY 0x0000ff00
+#define BONITO_PCILTIMER_BUSLATENCY_SHIFT 8
+#define BONITO_BONPONCFG BONITO(BONITO_REGBASE + 0x00)
+#define BONITO_BONPONCFG_SYSCONTROLLERRD 0x00040000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONPONCFG_ROMCS1SAMP 0x00020000
+#define BONITO_BONPONCFG_ROMCS0SAMP 0x00010000
+#define BONITO_BONPONCFG_CPUBIGEND 0x00004000
+#define BONITO_BONPONCFG_BURSTORDER 0x00001000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONPONCFG_CPUPARITY 0x00002000
+#define BONITO_BONPONCFG_CPUTYPE 0x00000007
+#define BONITO_BONPONCFG_CPUTYPE_SHIFT 0
+#define BONITO_BONPONCFG_PCIRESET_OUT 0x00000008
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONPONCFG_IS_ARBITER 0x00000010
+#define BONITO_BONPONCFG_ROMBOOT 0x000000c0
+#define BONITO_BONPONCFG_ROMBOOT_SHIFT 6
+#define BONITO_BONPONCFG_ROMBOOT_FLASH (0x0<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONPONCFG_ROMBOOT_SOCKET (0x1<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
+#define BONITO_BONPONCFG_ROMBOOT_SDRAM (0x2<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
+#define BONITO_BONPONCFG_ROMBOOT_CPURESET (0x3<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
+#define BONITO_BONPONCFG_ROMCS0WIDTH 0x00000100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONPONCFG_ROMCS1WIDTH 0x00000200
+#define BONITO_BONPONCFG_ROMCS0FAST 0x00000400
+#define BONITO_BONPONCFG_ROMCS1FAST 0x00000800
+#define BONITO_BONPONCFG_CONFIG_DIS 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONGENCFG_OFFSET 0x4
+#define BONITO_BONGENCFG BONITO(BONITO_REGBASE + BONITO_BONGENCFG_OFFSET)
+#define BONITO_BONGENCFG_DEBUGMODE 0x00000001
+#define BONITO_BONGENCFG_SNOOPEN 0x00000002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONGENCFG_CPUSELFRESET 0x00000004
+#define BONITO_BONGENCFG_FORCE_IRQA 0x00000008
+#define BONITO_BONGENCFG_IRQA_ISOUT 0x00000010
+#define BONITO_BONGENCFG_IRQA_FROM_INT1 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONGENCFG_BYTESWAP 0x00000040
+#define BONITO_BONGENCFG_UNCACHED 0x00000080
+#define BONITO_BONGENCFG_PREFETCHEN 0x00000100
+#define BONITO_BONGENCFG_WBEHINDEN 0x00000200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONGENCFG_CACHEALG 0x00000c00
+#define BONITO_BONGENCFG_CACHEALG_SHIFT 10
+#define BONITO_BONGENCFG_PCIQUEUE 0x00001000
+#define BONITO_BONGENCFG_CACHESTOP 0x00002000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONGENCFG_MSTRBYTESWAP 0x00004000
+#define BONITO_BONGENCFG_BUSERREN 0x00008000
+#define BONITO_BONGENCFG_NORETRYTIMEOUT 0x00010000
+#define BONITO_BONGENCFG_SHORTCOPYTIMEOUT 0x00020000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IODEVCFG BONITO(BONITO_REGBASE + 0x08)
+#define BONITO_SDCFG BONITO(BONITO_REGBASE + 0x0c)
+#define BONITO_PCIMAP BONITO(BONITO_REGBASE + 0x10)
+#define BONITO_PCIMEMBASECFG BONITO(BONITO_REGBASE + 0x14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMAP_CFG BONITO(BONITO_REGBASE + 0x18)
+#define BONITO_GPIODATA_OFFSET 0x1c
+#define BONITO_GPIODATA BONITO(BONITO_REGBASE + BONITO_GPIODATA_OFFSET)
+#define BONITO_GPIOIE BONITO(BONITO_REGBASE + 0x20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_INTEDGE BONITO(BONITO_REGBASE + 0x24)
+#define BONITO_INTSTEER BONITO(BONITO_REGBASE + 0x28)
+#define BONITO_INTPOL BONITO(BONITO_REGBASE + 0x2c)
+#define BONITO_INTENSET BONITO(BONITO_REGBASE + 0x30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_INTENCLR BONITO(BONITO_REGBASE + 0x34)
+#define BONITO_INTEN BONITO(BONITO_REGBASE + 0x38)
+#define BONITO_INTISR BONITO(BONITO_REGBASE + 0x3c)
+#define BONITO_PCIMAIL0_OFFSET 0x40
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMAIL1_OFFSET 0x44
+#define BONITO_PCIMAIL2_OFFSET 0x48
+#define BONITO_PCIMAIL3_OFFSET 0x4c
+#define BONITO_PCIMAIL0 BONITO(BONITO_REGBASE + 0x40)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMAIL1 BONITO(BONITO_REGBASE + 0x44)
+#define BONITO_PCIMAIL2 BONITO(BONITO_REGBASE + 0x48)
+#define BONITO_PCIMAIL3 BONITO(BONITO_REGBASE + 0x4c)
+#define BONITO_PCICACHECTRL BONITO(BONITO_REGBASE + 0x50)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICACHETAG BONITO(BONITO_REGBASE + 0x54)
+#define BONITO_PCIBADADDR BONITO(BONITO_REGBASE + 0x58)
+#define BONITO_PCIMSTAT BONITO(BONITO_REGBASE + 0x5c)
+#define BONITO_CONFIGBASE 0x000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_BONITOBASE 0x100
+#define BONITO_LDMABASE 0x200
+#define BONITO_COPBASE 0x300
+#define BONITO_REG_BLOCKMASK 0x300
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_LDMACTRL BONITO(BONITO_LDMABASE + 0x0)
+#define BONITO_LDMASTAT BONITO(BONITO_LDMABASE + 0x0)
+#define BONITO_LDMAADDR BONITO(BONITO_LDMABASE + 0x4)
+#define BONITO_LDMAGO BONITO(BONITO_LDMABASE + 0x8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_LDMADATA BONITO(BONITO_LDMABASE + 0xc)
+#define BONITO_COPCTRL BONITO(BONITO_COPBASE + 0x0)
+#define BONITO_COPSTAT BONITO(BONITO_COPBASE + 0x0)
+#define BONITO_COPPADDR BONITO(BONITO_COPBASE + 0x4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_COPDADDR BONITO(BONITO_COPBASE + 0x8)
+#define BONITO_COPGO BONITO(BONITO_COPBASE + 0xc)
+#define BONITO_IDECOPDADDR_DMA_DADDR 0x0ffffffc
+#define BONITO_IDECOPDADDR_DMA_DADDR_SHIFT 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IDECOPPADDR_DMA_PADDR 0xfffffffc
+#define BONITO_IDECOPPADDR_DMA_PADDR_SHIFT 2
+#define BONITO_IDECOPGO_DMA_SIZE 0x0000fffe
+#define BONITO_IDECOPGO_DMA_SIZE_SHIFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IDECOPGO_DMA_WRITE 0x00010000
+#define BONITO_IDECOPGO_DMAWCOUNT 0x000f0000
+#define BONITO_IDECOPGO_DMAWCOUNT_SHIFT 16
+#define BONITO_IDECOPCTRL_DMA_STARTBIT 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IDECOPCTRL_DMA_RSTBIT 0x40000000
+#define BONITO_SDCFG_AROWBITS 0x00000003
+#define BONITO_SDCFG_AROWBITS_SHIFT 0
+#define BONITO_SDCFG_ACOLBITS 0x0000000c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SDCFG_ACOLBITS_SHIFT 2
+#define BONITO_SDCFG_ABANKBIT 0x00000010
+#define BONITO_SDCFG_ASIDES 0x00000020
+#define BONITO_SDCFG_AABSENT 0x00000040
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SDCFG_AWIDTH64 0x00000080
+#define BONITO_SDCFG_BROWBITS 0x00000300
+#define BONITO_SDCFG_BROWBITS_SHIFT 8
+#define BONITO_SDCFG_BCOLBITS 0x00000c00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SDCFG_BCOLBITS_SHIFT 10
+#define BONITO_SDCFG_BBANKBIT 0x00001000
+#define BONITO_SDCFG_BSIDES 0x00002000
+#define BONITO_SDCFG_BABSENT 0x00004000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SDCFG_BWIDTH64 0x00008000
+#define BONITO_SDCFG_EXTRDDATA 0x00010000
+#define BONITO_SDCFG_EXTRASCAS 0x00020000
+#define BONITO_SDCFG_EXTPRECH 0x00040000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SDCFG_EXTRASWIDTH 0x00180000
+#define BONITO_SDCFG_EXTRASWIDTH_SHIFT 19
+#define BONITO_SDCFG_DRAMMODESET 0x00200000
+#define BONITO_SDCFG_DRAMEXTREGS 0x00400000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_SDCFG_DRAMPARITY 0x00800000
+#define BONITO_SDCFG_DRAMBURSTLEN 0x03000000
+#define BONITO_SDCFG_DRAMBURSTLEN_SHIFT 24
+#define BONITO_SDCFG_DRAMMODESET_DONE 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICACHECTRL_CACHECMD 0x00000007
+#define BONITO_PCICACHECTRL_CACHECMD_SHIFT 0
+#define BONITO_PCICACHECTRL_CACHECMDLINE 0x00000018
+#define BONITO_PCICACHECTRL_CACHECMDLINE_SHIFT 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICACHECTRL_CMDEXEC 0x00000020
+#define BONITO_PCICACHECTRL_IOBCCOH_PRES 0x00000100
+#define BONITO_PCICACHECTRL_IOBCCOH_EN 0x00000200
+#define BONITO_PCICACHECTRL_CPUCOH_PRES 0x00000400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCICACHECTRL_CPUCOH_EN 0x00000800
+#define BONITO_IODEVCFG_BUFFBIT_CS0 0x00000001
+#define BONITO_IODEVCFG_SPEEDBIT_CS0 0x00000002
+#define BONITO_IODEVCFG_MOREABITS_CS0 0x00000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IODEVCFG_BUFFBIT_CS1 0x00000008
+#define BONITO_IODEVCFG_SPEEDBIT_CS1 0x00000010
+#define BONITO_IODEVCFG_MOREABITS_CS1 0x00000020
+#define BONITO_IODEVCFG_BUFFBIT_CS2 0x00000040
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IODEVCFG_SPEEDBIT_CS2 0x00000080
+#define BONITO_IODEVCFG_MOREABITS_CS2 0x00000100
+#define BONITO_IODEVCFG_BUFFBIT_CS3 0x00000200
+#define BONITO_IODEVCFG_SPEEDBIT_CS3 0x00000400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IODEVCFG_MOREABITS_CS3 0x00000800
+#define BONITO_IODEVCFG_BUFFBIT_IDE 0x00001000
+#define BONITO_IODEVCFG_SPEEDBIT_IDE 0x00002000
+#define BONITO_IODEVCFG_WORDSWAPBIT_IDE 0x00004000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IODEVCFG_MODEBIT_IDE 0x00008000
+#define BONITO_IODEVCFG_DMAON_IDE 0x001f0000
+#define BONITO_IODEVCFG_DMAON_IDE_SHIFT 16
+#define BONITO_IODEVCFG_DMAOFF_IDE 0x01e00000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_IODEVCFG_DMAOFF_IDE_SHIFT 21
+#define BONITO_IODEVCFG_EPROMSPLIT 0x02000000
+#define BONITO_IODEVCFG_CPUCLOCKPERIOD 0xfc000000
+#define BONITO_IODEVCFG_CPUCLOCKPERIOD_SHIFT 26
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_GPIO_GPIOW 0x000003ff
+#define BONITO_GPIO_GPIOW_SHIFT 0
+#define BONITO_GPIO_GPIOR 0x01ff0000
+#define BONITO_GPIO_GPIOR_SHIFT 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_GPIO_GPINR 0xfe000000
+#define BONITO_GPIO_GPINR_SHIFT 25
+#define BONITO_GPIO_IOW(N) (1<<(BONITO_GPIO_GPIOW_SHIFT+(N)))
+#define BONITO_GPIO_IOR(N) (1<<(BONITO_GPIO_GPIOR_SHIFT+(N)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_GPIO_INR(N) (1<<(BONITO_GPIO_GPINR_SHIFT+(N)))
+#define BONITO_ICU_MBOXES 0x0000000f
+#define BONITO_ICU_MBOXES_SHIFT 0
+#define BONITO_ICU_DMARDY 0x00000010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_ICU_DMAEMPTY 0x00000020
+#define BONITO_ICU_COPYRDY 0x00000040
+#define BONITO_ICU_COPYEMPTY 0x00000080
+#define BONITO_ICU_COPYERR 0x00000100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_ICU_PCIIRQ 0x00000200
+#define BONITO_ICU_MASTERERR 0x00000400
+#define BONITO_ICU_SYSTEMERR 0x00000800
+#define BONITO_ICU_DRAMPERR 0x00001000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_ICU_RETRYERR 0x00002000
+#define BONITO_ICU_GPIOS 0x01ff0000
+#define BONITO_ICU_GPIOS_SHIFT 16
+#define BONITO_ICU_GPINS 0x7e000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_ICU_GPINS_SHIFT 25
+#define BONITO_ICU_MBOX(N) (1<<(BONITO_ICU_MBOXES_SHIFT+(N)))
+#define BONITO_ICU_GPIO(N) (1<<(BONITO_ICU_GPIOS_SHIFT+(N)))
+#define BONITO_ICU_GPIN(N) (1<<(BONITO_ICU_GPINS_SHIFT+(N)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMAP_PCIMAP_LO0 0x0000003f
+#define BONITO_PCIMAP_PCIMAP_LO0_SHIFT 0
+#define BONITO_PCIMAP_PCIMAP_LO1 0x00000fc0
+#define BONITO_PCIMAP_PCIMAP_LO1_SHIFT 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMAP_PCIMAP_LO2 0x0003f000
+#define BONITO_PCIMAP_PCIMAP_LO2_SHIFT 12
+#define BONITO_PCIMAP_PCIMAP_2 0x00040000
+#define BONITO_PCIMAP_WIN(WIN, ADDR) ((((ADDR)>>26) & BONITO_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMAP_WINSIZE (1<<26)
+#define BONITO_PCIMAP_WINOFFSET(ADDR) ((ADDR) & (BONITO_PCIMAP_WINSIZE - 1))
+#define BONITO_PCIMAP_WINBASE(ADDR) ((ADDR) << 26)
+#define BONITO_PCIMEMBASECFG_MASK 0xf0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMEMBASECFG_MEMBASE0_MASK 0x0000001f
+#define BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT 0
+#define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS 0x000003e0
+#define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT 5
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMEMBASECFG_MEMBASE0_CACHED 0x00000400
+#define BONITO_PCIMEMBASECFG_MEMBASE0_IO 0x00000800
+#define BONITO_PCIMEMBASECFG_MEMBASE1_MASK 0x0001f000
+#define BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS 0x003e0000
+#define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT 17
+#define BONITO_PCIMEMBASECFG_MEMBASE1_CACHED 0x00400000
+#define BONITO_PCIMEMBASECFG_MEMBASE1_IO 0x00800000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMEMBASECFG_ASHIFT 23
+#define BONITO_PCIMEMBASECFG_AMASK 0x007fffff
+#define BONITO_PCIMEMBASECFGSIZE(WIN, SIZE) (((~((SIZE)-1))>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)
+#define BONITO_PCIMEMBASECFGBASE(WIN, BASE) (((BASE)>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCIMEMBASECFG_SIZE(WIN, CFG) (((((~(CFG)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)) << (BONITO_PCIMEMBASECFG_ASHIFT - BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) | BONITO_PCIMEMBASECFG_AMASK)
+#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
+#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
+#define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BONITO_PCITOPHYS(WIN, ADDR, CFG) (   (((ADDR) & (~(BONITO_PCIMEMBASECFG_MASK))) & (~(BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG)))) |   (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG))   )
+#define BONITO_PCICMD_MEMEN 0x00000002
+#define BONITO_PCICMD_MSTREN 0x00000004
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/mips-boards/generic.h b/libc/kernel/arch-mips/asm/mips-boards/generic.h
new file mode 100644
index 0000000..fe07137
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mips-boards/generic.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_BOARDS_GENERIC_H
+#define __ASM_MIPS_BOARDS_GENERIC_H
+#include <asm/addrspace.h>
+#include <asm/byteorder.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/mips-boards/bonito64.h>
+#define ASCII_DISPLAY_WORD_BASE 0x1f000410
+#define ASCII_DISPLAY_POS_BASE 0x1f000418
+#define YAMON_PROM_PRINT_ADDR 0x1fc00504
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SOFTRES_REG 0x1f000500
+#define GORESET 0x42
+#define MIPS_REVISION_REG 0x1fc00010
+#define MIPS_REVISION_CORID_QED_RM5261 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_CORID_CORE_LV 1
+#define MIPS_REVISION_CORID_BONITO64 2
+#define MIPS_REVISION_CORID_CORE_20K 3
+#define MIPS_REVISION_CORID_CORE_FPGA 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_CORID_CORE_MSC 5
+#define MIPS_REVISION_CORID_CORE_EMUL 6
+#define MIPS_REVISION_CORID_CORE_FPGA2 7
+#define MIPS_REVISION_CORID_CORE_FPGAR2 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_CORID_CORE_FPGA3 9
+#define MIPS_REVISION_CORID_CORE_24K 10
+#define MIPS_REVISION_CORID_CORE_FPGA4 11
+#define MIPS_REVISION_CORID_CORE_FPGA5 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_CORID_CORE_EMUL_BON -1
+#define MIPS_REVISION_CORID_CORE_EMUL_MSC -2
+#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
+#define MIPS_REVISION_SCON_OTHER 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_SCON_SOCITSC 1
+#define MIPS_REVISION_SCON_SOCITSCP 2
+#define MIPS_REVISION_SCON_UNKNOWN -1
+#define MIPS_REVISION_SCON_GT64120 -2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_SCON_BONITO -3
+#define MIPS_REVISION_SCON_BRTL -4
+#define MIPS_REVISION_SCON_SOCIT -5
+#define MIPS_REVISION_SCON_ROCIT -6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_REVISION_SCONID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 24) & 0xff)
+#define mips_pcibios_init() do { } while (0)
+#endif
diff --git a/libc/kernel/arch-mips/asm/mips-boards/malta.h b/libc/kernel/arch-mips/asm/mips-boards/malta.h
new file mode 100644
index 0000000..7cef7e0
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mips-boards/malta.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_BOARDS_MALTA_H
+#define __ASM_MIPS_BOARDS_MALTA_H
+#include <asm/addrspace.h>
+#include <asm/io.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/mips-boards/msc01_pci.h>
+#include <asm/gt64120.h>
+#define MIPS_MSC01_IC_REG_BASE 0x1bc40000
+#define MIPS_SOCITSC_IC_REG_BASE 0x1ffa0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MALTA_GT_PORT_BASE get_gt_port_base(GT_PCI0IOLD_OFS)
+#define MALTA_BONITO_PORT_BASE ((unsigned long)ioremap (0x1fd00000, 0x10000))
+#define MALTA_MSC_PORT_BASE get_msc_port_base(MSC01_PCI_SC2PIOBASL)
+#define GCMP_BASE_ADDR 0x1fbf8000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GCMP_ADDRSPACE_SZ (256 * 1024)
+#define GIC_BASE_ADDR 0x1bdc0000
+#define GIC_ADDRSPACE_SZ (128 * 1024)
+#define MSC01_BIU_REG_BASE 0x1bc80000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_BIU_ADDRSPACE_SZ (256 * 1024)
+#define MSC01_SC_CFG_OFS 0x0110
+#define MSC01_SC_CFG_GICPRES_MSK 0x00000004
+#define MSC01_SC_CFG_GICPRES_SHF 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_SC_CFG_GICENA_SHF 3
+#define MALTA_RTC_ADR_REG 0x70
+#define MALTA_RTC_DAT_REG 0x71
+#define SMSC_CONFIG_REG 0x3f0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SMSC_DATA_REG 0x3f1
+#define SMSC_CONFIG_DEVNUM 0x7
+#define SMSC_CONFIG_ACTIVATE 0x30
+#define SMSC_CONFIG_ENTER 0x55
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SMSC_CONFIG_EXIT 0xaa
+#define SMSC_CONFIG_DEVNUM_FLOPPY 0
+#define SMSC_CONFIG_ACTIVATE_ENABLE 1
+#define SMSC_WRITE(x, a) outb(x, a)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MALTA_JMPRS_REG 0x1f000210
+#endif
diff --git a/libc/kernel/arch-mips/asm/mips-boards/msc01_pci.h b/libc/kernel/arch-mips/asm/mips-boards/msc01_pci.h
new file mode 100644
index 0000000..6235847
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mips-boards/msc01_pci.h
@@ -0,0 +1,270 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_BOARDS_MSC01_PCI_H
+#define __ASM_MIPS_BOARDS_MSC01_PCI_H
+#define MSC01_PCI_ID_OFS 0x0000
+#define MSC01_PCI_SC2PMBASL_OFS 0x0208
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SC2PMMSKL_OFS 0x0218
+#define MSC01_PCI_SC2PMMAPL_OFS 0x0228
+#define MSC01_PCI_SC2PIOBASL_OFS 0x0248
+#define MSC01_PCI_SC2PIOMSKL_OFS 0x0258
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SC2PIOMAPL_OFS 0x0268
+#define MSC01_PCI_P2SCMSKL_OFS 0x0308
+#define MSC01_PCI_P2SCMAPL_OFS 0x0318
+#define MSC01_PCI_INTCFG_OFS 0x0600
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_OFS 0x0608
+#define MSC01_PCI_CFGADDR_OFS 0x0610
+#define MSC01_PCI_CFGDATA_OFS 0x0618
+#define MSC01_PCI_IACK_OFS 0x0620
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD0_OFS 0x2000  
+#define MSC01_PCI_HEAD1_OFS 0x2008  
+#define MSC01_PCI_HEAD2_OFS 0x2010  
+#define MSC01_PCI_HEAD3_OFS 0x2018  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD4_OFS 0x2020  
+#define MSC01_PCI_HEAD5_OFS 0x2028  
+#define MSC01_PCI_HEAD6_OFS 0x2030  
+#define MSC01_PCI_HEAD7_OFS 0x2038  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD8_OFS 0x2040  
+#define MSC01_PCI_HEAD9_OFS 0x2048  
+#define MSC01_PCI_HEAD10_OFS 0x2050  
+#define MSC01_PCI_HEAD11_OFS 0x2058  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD12_OFS 0x2060  
+#define MSC01_PCI_HEAD13_OFS 0x2068  
+#define MSC01_PCI_HEAD14_OFS 0x2070  
+#define MSC01_PCI_HEAD15_OFS 0x2078  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_BAR0_OFS 0x2220
+#define MSC01_PCI_CFG_OFS 0x2380
+#define MSC01_PCI_SWAP_OFS 0x2388
+#define MSC01_PCI_ID_ID_SHF 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_ID_ID_MSK 0x00ff0000
+#define MSC01_PCI_ID_ID_HOSTBRIDGE 82
+#define MSC01_PCI_ID_MAR_SHF 8
+#define MSC01_PCI_ID_MAR_MSK 0x0000ff00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_ID_MIR_SHF 0
+#define MSC01_PCI_ID_MIR_MSK 0x000000ff
+#define MSC01_PCI_SC2PMBASL_BAS_SHF 24
+#define MSC01_PCI_SC2PMBASL_BAS_MSK 0xff000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SC2PMMSKL_MSK_SHF 24
+#define MSC01_PCI_SC2PMMSKL_MSK_MSK 0xff000000
+#define MSC01_PCI_SC2PMMAPL_MAP_SHF 24
+#define MSC01_PCI_SC2PMMAPL_MAP_MSK 0xff000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SC2PIOBASL_BAS_SHF 24
+#define MSC01_PCI_SC2PIOBASL_BAS_MSK 0xff000000
+#define MSC01_PCI_SC2PIOMSKL_MSK_SHF 24
+#define MSC01_PCI_SC2PIOMSKL_MSK_MSK 0xff000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SC2PIOMAPL_MAP_SHF 24
+#define MSC01_PCI_SC2PIOMAPL_MAP_MSK 0xff000000
+#define MSC01_PCI_P2SCMSKL_MSK_SHF 24
+#define MSC01_PCI_P2SCMSKL_MSK_MSK 0xff000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_P2SCMAPL_MAP_SHF 24
+#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xff000000
+#define MSC01_PCI_INTCFG_RST_SHF 10
+#define MSC01_PCI_INTCFG_RST_MSK 0x00000400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_RST_BIT 0x00000400
+#define MSC01_PCI_INTCFG_MWE_SHF 9
+#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200
+#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_DTO_SHF 8
+#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100
+#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100
+#define MSC01_PCI_INTCFG_MA_SHF 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_MA_MSK 0x00000080
+#define MSC01_PCI_INTCFG_MA_BIT 0x00000080
+#define MSC01_PCI_INTCFG_TA_SHF 6
+#define MSC01_PCI_INTCFG_TA_MSK 0x00000040
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_TA_BIT 0x00000040
+#define MSC01_PCI_INTCFG_RTY_SHF 5
+#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020
+#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_MWP_SHF 4
+#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010
+#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010
+#define MSC01_PCI_INTCFG_MRP_SHF 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008
+#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008
+#define MSC01_PCI_INTCFG_SWP_SHF 2
+#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004
+#define MSC01_PCI_INTCFG_SRP_SHF 1
+#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002
+#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTCFG_SE_SHF 0
+#define MSC01_PCI_INTCFG_SE_MSK 0x00000001
+#define MSC01_PCI_INTCFG_SE_BIT 0x00000001
+#define MSC01_PCI_INTSTAT_RST_SHF 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400
+#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400
+#define MSC01_PCI_INTSTAT_MWE_SHF 9
+#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200
+#define MSC01_PCI_INTSTAT_DTO_SHF 8
+#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100
+#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_MA_SHF 7
+#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080
+#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080
+#define MSC01_PCI_INTSTAT_TA_SHF 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040
+#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040
+#define MSC01_PCI_INTSTAT_RTY_SHF 5
+#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020
+#define MSC01_PCI_INTSTAT_MWP_SHF 4
+#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010
+#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_MRP_SHF 3
+#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008
+#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008
+#define MSC01_PCI_INTSTAT_SWP_SHF 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004
+#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004
+#define MSC01_PCI_INTSTAT_SRP_SHF 1
+#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002
+#define MSC01_PCI_INTSTAT_SE_SHF 0
+#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001
+#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFGADDR_BNUM_SHF 16
+#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000
+#define MSC01_PCI_CFGADDR_DNUM_SHF 11
+#define MSC01_PCI_CFGADDR_DNUM_MSK 0x0000f800
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFGADDR_FNUM_SHF 8
+#define MSC01_PCI_CFGADDR_FNUM_MSK 0x00000700
+#define MSC01_PCI_CFGADDR_RNUM_SHF 2
+#define MSC01_PCI_CFGADDR_RNUM_MSK 0x000000fc
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFGDATA_DATA_SHF 0
+#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff
+#define MSC01_PCI_BAR0_SIZE_SHF 4
+#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_BAR0_P_SHF 3
+#define MSC01_PCI_BAR0_P_MSK 0x00000008
+#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK
+#define MSC01_PCI_BAR0_D_SHF 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_BAR0_D_MSK 0x00000006
+#define MSC01_PCI_BAR0_T_SHF 0
+#define MSC01_PCI_BAR0_T_MSK 0x00000001
+#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFG_RA_SHF 17
+#define MSC01_PCI_CFG_RA_MSK 0x00020000
+#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK
+#define MSC01_PCI_CFG_G_SHF 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFG_G_MSK 0x00010000
+#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK
+#define MSC01_PCI_CFG_EN_SHF 15
+#define MSC01_PCI_CFG_EN_MSK 0x00008000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK
+#define MSC01_PCI_CFG_MAXRTRY_SHF 0
+#define MSC01_PCI_CFG_MAXRTRY_MSK 0x00000fff
+#define MSC01_PCI_SWAP_IO_SHF 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SWAP_IO_MSK 0x000c0000
+#define MSC01_PCI_SWAP_MEM_SHF 16
+#define MSC01_PCI_SWAP_MEM_MSK 0x00030000
+#define MSC01_PCI_SWAP_BAR0_SHF 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SWAP_BAR0_MSK 0x00000003
+#define MSC01_PCI_SWAP_NOSWAP 0
+#define MSC01_PCI_SWAP_BYTESWAP 1
+#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_SOCITSC_PCI_REG_BASE 0x1ff10000
+#define MSC01_PCI_REG_BASE _pcictrl_msc
+#define MSC_WRITE(reg, data) do { *(volatile u32 *)(reg) = data; } while (0)
+#define MSC_READ(reg, data) do { data = *(volatile u32 *)(reg); } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS)
+#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS)
+#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS)
+#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS)
+#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS)
+#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS)
+#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS)
+#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS)
+#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS)
+#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS)
+#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS)
+#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS)
+#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD2 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD2_OFS)
+#define MSC01_PCI_HEAD3 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD3_OFS)
+#define MSC01_PCI_HEAD4 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD4_OFS)
+#define MSC01_PCI_HEAD5 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD5_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD6 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD6_OFS)
+#define MSC01_PCI_HEAD7 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD7_OFS)
+#define MSC01_PCI_HEAD8 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD8_OFS)
+#define MSC01_PCI_HEAD9 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD9_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD10 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD10_OFS)
+#define MSC01_PCI_HEAD11 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
+#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
+#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
+#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
+#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS)
+#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS)
+#endif
diff --git a/libc/kernel/arch-sh/asm/smp.h b/libc/kernel/arch-mips/asm/mips_mt.h
similarity index 60%
rename from libc/kernel/arch-sh/asm/smp.h
rename to libc/kernel/arch-mips/asm/mips_mt.h
index e377a6b..90f726a 100644
--- a/libc/kernel/arch-sh/asm/smp.h
+++ b/libc/kernel/arch-mips/asm/mips_mt.h
@@ -7,14 +7,18 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_SMP_H
-#define __ASM_SH_SMP_H
-
-#include <linux/bitops.h>
+#ifndef __ASM_MIPS_MT_H
+#define __ASM_MIPS_MT_H
 #include <linux/cpumask.h>
-
-#define hard_smp_processor_id() (0)
-
+struct class;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/arch-mips/asm/mipsmtregs.h b/libc/kernel/arch-mips/asm/mipsmtregs.h
new file mode 100644
index 0000000..1d4f342
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mipsmtregs.h
@@ -0,0 +1,214 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MIPSMTREGS_H
+#define _ASM_MIPSMTREGS_H
+#include <asm/mipsregs.h>
+#include <asm/war.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+#define read_c0_mvpcontrol() __read_32bit_c0_register($0, 1)
+#define write_c0_mvpcontrol(val) __write_32bit_c0_register($0, 1, val)
+#define read_c0_mvpconf0() __read_32bit_c0_register($0, 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_mvpconf1() __read_32bit_c0_register($0, 3)
+#define read_c0_vpecontrol() __read_32bit_c0_register($1, 1)
+#define write_c0_vpecontrol(val) __write_32bit_c0_register($1, 1, val)
+#define read_c0_vpeconf0() __read_32bit_c0_register($1, 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_vpeconf0(val) __write_32bit_c0_register($1, 2, val)
+#define read_c0_tcstatus() __read_32bit_c0_register($2, 1)
+#define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val)
+#define read_c0_tcbind() __read_32bit_c0_register($2, 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_tccontext() __read_32bit_c0_register($2, 5)
+#define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val)
+#else
+#define CP0_MVPCONTROL $0, 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_MVPCONF0 $0, 2
+#define CP0_MVPCONF1 $0, 3
+#define CP0_VPECONTROL $1, 1
+#define CP0_VPECONF0 $1, 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_VPECONF1 $1, 3
+#define CP0_YQMASK $1, 4
+#define CP0_VPESCHEDULE $1, 5
+#define CP0_VPESCHEFBK $1, 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_TCSTATUS $2, 1
+#define CP0_TCBIND $2, 2
+#define CP0_TCRESTART $2, 3
+#define CP0_TCHALT $2, 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_TCCONTEXT $2, 5
+#define CP0_TCSCHEDULE $2, 6
+#define CP0_TCSCHEFBK $2, 7
+#define CP0_SRSCONF0 $6, 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_SRSCONF1 $6, 2
+#define CP0_SRSCONF2 $6, 3
+#define CP0_SRSCONF3 $6, 4
+#define CP0_SRSCONF4 $6, 5
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define MVPCONTROL_EVP (_ULCAST_(1))
+#define MVPCONTROL_VPC_SHIFT 1
+#define MVPCONTROL_VPC (_ULCAST_(1) << MVPCONTROL_VPC_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MVPCONTROL_STLB_SHIFT 2
+#define MVPCONTROL_STLB (_ULCAST_(1) << MVPCONTROL_STLB_SHIFT)
+#define MVPCONF0_PTC_SHIFT 0
+#define MVPCONF0_PTC ( _ULCAST_(0xff))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MVPCONF0_PVPE_SHIFT 10
+#define MVPCONF0_PVPE ( _ULCAST_(0xf) << MVPCONF0_PVPE_SHIFT)
+#define MVPCONF0_TCA_SHIFT 15
+#define MVPCONF0_TCA ( _ULCAST_(1) << MVPCONF0_TCA_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MVPCONF0_PTLBE_SHIFT 16
+#define MVPCONF0_PTLBE (_ULCAST_(0x3ff) << MVPCONF0_PTLBE_SHIFT)
+#define MVPCONF0_TLBS_SHIFT 29
+#define MVPCONF0_TLBS (_ULCAST_(1) << MVPCONF0_TLBS_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MVPCONF0_M_SHIFT 31
+#define MVPCONF0_M (_ULCAST_(0x1) << MVPCONF0_M_SHIFT)
+#define CONFIG3_MT_SHIFT 2
+#define CONFIG3_MT (_ULCAST_(1) << CONFIG3_MT_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VPECONTROL_TARGTC (_ULCAST_(0xff))
+#define VPECONTROL_TE_SHIFT 15
+#define VPECONTROL_TE (_ULCAST_(1) << VPECONTROL_TE_SHIFT)
+#define VPECONTROL_EXCPT_SHIFT 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VPECONTROL_EXCPT (_ULCAST_(0x7) << VPECONTROL_EXCPT_SHIFT)
+#define THREX_TU 0
+#define THREX_TO 1
+#define THREX_IYQ 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define THREX_GSX 3
+#define THREX_YSCH 4
+#define THREX_GSSCH 5
+#define VPECONTROL_GSI_SHIFT 20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VPECONTROL_GSI (_ULCAST_(1) << VPECONTROL_GSI_SHIFT)
+#define VPECONTROL_YSI_SHIFT 21
+#define VPECONTROL_YSI (_ULCAST_(1) << VPECONTROL_YSI_SHIFT)
+#define VPECONF0_VPA_SHIFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VPECONF0_VPA (_ULCAST_(1) << VPECONF0_VPA_SHIFT)
+#define VPECONF0_MVP_SHIFT 1
+#define VPECONF0_MVP (_ULCAST_(1) << VPECONF0_MVP_SHIFT)
+#define VPECONF0_XTC_SHIFT 21
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT)
+#define TCSTATUS_TASID (_ULCAST_(0xff))
+#define TCSTATUS_IXMT_SHIFT 10
+#define TCSTATUS_IXMT (_ULCAST_(1) << TCSTATUS_IXMT_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSTATUS_TKSU_SHIFT 11
+#define TCSTATUS_TKSU (_ULCAST_(3) << TCSTATUS_TKSU_SHIFT)
+#define TCSTATUS_A_SHIFT 13
+#define TCSTATUS_A (_ULCAST_(1) << TCSTATUS_A_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSTATUS_DA_SHIFT 15
+#define TCSTATUS_DA (_ULCAST_(1) << TCSTATUS_DA_SHIFT)
+#define TCSTATUS_DT_SHIFT 20
+#define TCSTATUS_DT (_ULCAST_(1) << TCSTATUS_DT_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSTATUS_TDS_SHIFT 21
+#define TCSTATUS_TDS (_ULCAST_(1) << TCSTATUS_TDS_SHIFT)
+#define TCSTATUS_TSST_SHIFT 22
+#define TCSTATUS_TSST (_ULCAST_(1) << TCSTATUS_TSST_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSTATUS_RNST_SHIFT 23
+#define TCSTATUS_RNST (_ULCAST_(3) << TCSTATUS_RNST_SHIFT)
+#define TC_RUNNING 0
+#define TC_WAITING 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TC_YIELDING 2
+#define TC_GATED 3
+#define TCSTATUS_TMX_SHIFT 27
+#define TCSTATUS_TMX (_ULCAST_(1) << TCSTATUS_TMX_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCBIND_CURVPE_SHIFT 0
+#define TCBIND_CURVPE (_ULCAST_(0xf))
+#define TCBIND_CURTC_SHIFT 21
+#define TCBIND_CURTC (_ULCAST_(0xff) << TCBIND_CURTC_SHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCHALT_H (_ULCAST_(1))
+#ifndef __ASSEMBLY__
+#define EVPE_ENABLE MVPCONTROL_EVP
+#define EMT_ENABLE VPECONTROL_TE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mftc0(rt,sel)  ({   unsigned long __res;     __asm__ __volatile__(   "	.set	push					\n"   "	.set	mips32r2				\n"   "	.set	noat					\n"   "	# mftc0	$1, $" #rt ", " #sel "			\n"   "	.word	0x41000800 | (" #rt " << 16) | " #sel "	\n"   "	move	%0, $1					\n"   "	.set	pop					\n"   : "=r" (__res));     __res;  })
+#define mftgpr(rt)  ({   unsigned long __res;     __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	.set	mips32r2				\n"   "	# mftgpr $1," #rt "				\n"   "	.word	0x41000820 | (" #rt " << 16)		\n"   "	move	%0, $1					\n"   "	.set	pop					\n"   : "=r" (__res));     __res;  })
+#define mftr(rt, u, sel)  ({   unsigned long __res;     __asm__ __volatile__(   "	mftr	%0, " #rt ", " #u ", " #sel "		\n"   : "=r" (__res));     __res;  })
+#define mttgpr(rd,v)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	mips32r2				\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mttgpr $1, " #rd "				\n"   "	.word	0x41810020 | (" #rd " << 11)		\n"   "	.set	pop					\n"   : : "r" (v));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mttc0(rd, sel, v)  ({   __asm__ __volatile__(   "	.set	push					\n"   "	.set	mips32r2				\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mttc0 %0," #rd ", " #sel "			\n"   "	.word	0x41810000 | (" #rd " << 11) | " #sel "	\n"   "	.set	pop					\n"   :   : "r" (v));  })
+#define mttr(rd, u, sel, v)  ({   __asm__ __volatile__(   "mttr	%0," #rd ", " #u ", " #sel   : : "r" (v));  })
+#define settc(tc)  do {   write_c0_vpecontrol((read_c0_vpecontrol()&~VPECONTROL_TARGTC) | (tc));   ehb();  } while (0)
+#define read_vpe_c0_vpecontrol() mftc0(1, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val)
+#define read_vpe_c0_vpeconf0() mftc0(1, 2)
+#define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val)
+#define read_vpe_c0_count() mftc0(9, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_vpe_c0_count(val) mttc0(9, 0, val)
+#define read_vpe_c0_status() mftc0(12, 0)
+#define write_vpe_c0_status(val) mttc0(12, 0, val)
+#define read_vpe_c0_cause() mftc0(13, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_vpe_c0_cause(val) mttc0(13, 0, val)
+#define read_vpe_c0_config() mftc0(16, 0)
+#define write_vpe_c0_config(val) mttc0(16, 0, val)
+#define read_vpe_c0_config1() mftc0(16, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_vpe_c0_config1(val) mttc0(16, 1, val)
+#define read_vpe_c0_config7() mftc0(16, 7)
+#define write_vpe_c0_config7(val) mttc0(16, 7, val)
+#define read_vpe_c0_ebase() mftc0(15, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_vpe_c0_ebase(val) mttc0(15, 1, val)
+#define write_vpe_c0_compare(val) mttc0(11, 0, val)
+#define read_vpe_c0_badvaddr() mftc0(8, 0)
+#define read_vpe_c0_epc() mftc0(14, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_vpe_c0_epc(val) mttc0(14, 0, val)
+#define read_tc_c0_tcstatus() mftc0(2, 1)
+#define write_tc_c0_tcstatus(val) mttc0(2, 1, val)
+#define read_tc_c0_tcbind() mftc0(2, 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_tc_c0_tcbind(val) mttc0(2, 2, val)
+#define read_tc_c0_tcrestart() mftc0(2, 3)
+#define write_tc_c0_tcrestart(val) mttc0(2, 3, val)
+#define read_tc_c0_tchalt() mftc0(2, 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_tc_c0_tchalt(val) mttc0(2, 4, val)
+#define read_tc_c0_tccontext() mftc0(2, 5)
+#define write_tc_c0_tccontext(val) mttc0(2, 5, val)
+#define read_tc_gpr_sp() mftgpr(29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_tc_gpr_sp(val) mttgpr(29, val)
+#define read_tc_gpr_gp() mftgpr(28)
+#define write_tc_gpr_gp(val) mttgpr(28, val)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/mipsregs.h b/libc/kernel/arch-mips/asm/mipsregs.h
new file mode 100644
index 0000000..0976939
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mipsregs.h
@@ -0,0 +1,721 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MIPSREGS_H
+#define _ASM_MIPSREGS_H
+#include <linux/linkage.h>
+#include <asm/hazards.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/war.h>
+#ifndef __STR
+#define __STR(x) #x
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef STR
+#define STR(x) __STR(x)
+#endif
+#ifdef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _ULCAST_
+#else
+#define _ULCAST_ (unsigned long)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_INDEX $0
+#define CP0_RANDOM $1
+#define CP0_ENTRYLO0 $2
+#define CP0_ENTRYLO1 $3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_CONF $3
+#define CP0_CONTEXT $4
+#define CP0_PAGEMASK $5
+#define CP0_WIRED $6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_INFO $7
+#define CP0_BADVADDR $8
+#define CP0_COUNT $9
+#define CP0_ENTRYHI $10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_COMPARE $11
+#define CP0_STATUS $12
+#define CP0_CAUSE $13
+#define CP0_EPC $14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_PRID $15
+#define CP0_CONFIG $16
+#define CP0_LLADDR $17
+#define CP0_WATCHLO $18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_WATCHHI $19
+#define CP0_XCONTEXT $20
+#define CP0_FRAMEMASK $21
+#define CP0_DIAGNOSTIC $22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_DEBUG $23
+#define CP0_DEPC $24
+#define CP0_PERFORMANCE $25
+#define CP0_ECC $26
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_CACHEERR $27
+#define CP0_TAGLO $28
+#define CP0_TAGHI $29
+#define CP0_ERROREPC $30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_DESAVE $31
+#define CP0_IBASE $0
+#define CP0_IBOUND $1
+#define CP0_DBASE $2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_DBOUND $3
+#define CP0_CALG $17
+#define CP0_IWATCH $18
+#define CP0_DWATCH $19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_S1_DERRADDR0 $26
+#define CP0_S1_DERRADDR1 $27
+#define CP0_S1_INTCONTROL $20
+#define CP0_S2_SRSCTL $12  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CP0_S3_SRSMAP $12  
+#define CP0_TX39_CACHE $7
+#define CP1_REVISION $0
+#define CP1_STATUS $31
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_FLUSH 0x01000000  
+#define FPU_CSR_COND 0x00800000  
+#define FPU_CSR_COND0 0x00800000  
+#define FPU_CSR_COND1 0x02000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_COND2 0x04000000  
+#define FPU_CSR_COND3 0x08000000  
+#define FPU_CSR_COND4 0x10000000  
+#define FPU_CSR_COND5 0x20000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_COND6 0x40000000  
+#define FPU_CSR_COND7 0x80000000  
+#define FPU_CSR_ALL_X 0x0003f000
+#define FPU_CSR_UNI_X 0x00020000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_INV_X 0x00010000
+#define FPU_CSR_DIV_X 0x00008000
+#define FPU_CSR_OVF_X 0x00004000
+#define FPU_CSR_UDF_X 0x00002000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_INE_X 0x00001000
+#define FPU_CSR_ALL_E 0x00000f80
+#define FPU_CSR_INV_E 0x00000800
+#define FPU_CSR_DIV_E 0x00000400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_OVF_E 0x00000200
+#define FPU_CSR_UDF_E 0x00000100
+#define FPU_CSR_INE_E 0x00000080
+#define FPU_CSR_ALL_S 0x0000007c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_INV_S 0x00000040
+#define FPU_CSR_DIV_S 0x00000020
+#define FPU_CSR_OVF_S 0x00000010
+#define FPU_CSR_UDF_S 0x00000008
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_INE_S 0x00000004
+#define FPU_CSR_RN 0x0  
+#define FPU_CSR_RZ 0x1  
+#define FPU_CSR_RU 0x2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPU_CSR_RD 0x3  
+#define PM_4K 0x00000000
+#define PM_16K 0x00006000
+#define PM_64K 0x0001e000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PM_256K 0x0007e000
+#define PM_1M 0x001fe000
+#define PM_4M 0x007fe000
+#define PM_16M 0x01ffe000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PM_64M 0x07ffe000
+#define PM_256M 0x1fffe000
+#error Bad page size configuration!
+#define PL_4K 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PL_16K 14
+#define PL_64K 16
+#define PL_256K 18
+#define PL_1M 20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PL_4M 22
+#define PL_16M 24
+#define PL_64M 26
+#define PL_256M 28
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IE_SW0 (_ULCAST_(1) << 8)
+#define IE_SW1 (_ULCAST_(1) << 9)
+#define IE_IRQ0 (_ULCAST_(1) << 10)
+#define IE_IRQ1 (_ULCAST_(1) << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IE_IRQ2 (_ULCAST_(1) << 12)
+#define IE_IRQ3 (_ULCAST_(1) << 13)
+#define IE_IRQ4 (_ULCAST_(1) << 14)
+#define IE_IRQ5 (_ULCAST_(1) << 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define C_SW0 (_ULCAST_(1) << 8)
+#define C_SW1 (_ULCAST_(1) << 9)
+#define C_IRQ0 (_ULCAST_(1) << 10)
+#define C_IRQ1 (_ULCAST_(1) << 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define C_IRQ2 (_ULCAST_(1) << 12)
+#define C_IRQ3 (_ULCAST_(1) << 13)
+#define C_IRQ4 (_ULCAST_(1) << 14)
+#define C_IRQ5 (_ULCAST_(1) << 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_IE 0x00000001
+#define ST0_EXL 0x00000002
+#define ST0_ERL 0x00000004
+#define ST0_KSU 0x00000018
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KSU_USER 0x00000010
+#define KSU_SUPERVISOR 0x00000008
+#define KSU_KERNEL 0x00000000
+#define ST0_UX 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_SX 0x00000040
+#define ST0_KX 0x00000080
+#define ST0_DE 0x00010000
+#define ST0_CE 0x00020000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_CO 0x08000000
+#define ST0_IEC 0x00000001
+#define ST0_KUC 0x00000002
+#define ST0_IEP 0x00000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_KUP 0x00000008
+#define ST0_IEO 0x00000010
+#define ST0_KUO 0x00000020
+#define ST0_ISC 0x00010000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_SWC 0x00020000
+#define ST0_CM 0x00080000
+#define ST0_UM (_ULCAST_(1) << 4)
+#define ST0_IL (_ULCAST_(1) << 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_DL (_ULCAST_(1) << 24)
+#define ST0_MX 0x01000000
+#define TX39_CONF_ICS_SHIFT 19
+#define TX39_CONF_ICS_MASK 0x00380000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_ICS_1KB 0x00000000
+#define TX39_CONF_ICS_2KB 0x00080000
+#define TX39_CONF_ICS_4KB 0x00100000
+#define TX39_CONF_ICS_8KB 0x00180000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_ICS_16KB 0x00200000
+#define TX39_CONF_DCS_SHIFT 16
+#define TX39_CONF_DCS_MASK 0x00070000
+#define TX39_CONF_DCS_1KB 0x00000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_DCS_2KB 0x00010000
+#define TX39_CONF_DCS_4KB 0x00020000
+#define TX39_CONF_DCS_8KB 0x00030000
+#define TX39_CONF_DCS_16KB 0x00040000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_CWFON 0x00004000
+#define TX39_CONF_WBON 0x00002000
+#define TX39_CONF_RF_SHIFT 10
+#define TX39_CONF_RF_MASK 0x00000c00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_DOZE 0x00000200
+#define TX39_CONF_HALT 0x00000100
+#define TX39_CONF_LOCK 0x00000080
+#define TX39_CONF_ICE 0x00000020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_DCE 0x00000010
+#define TX39_CONF_IRSIZE_SHIFT 2
+#define TX39_CONF_IRSIZE_MASK 0x0000000c
+#define TX39_CONF_DRSIZE_SHIFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX39_CONF_DRSIZE_MASK 0x00000003
+#define ST0_IM 0x0000ff00
+#define STATUSB_IP0 8
+#define STATUSF_IP0 (_ULCAST_(1) << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP1 9
+#define STATUSF_IP1 (_ULCAST_(1) << 9)
+#define STATUSB_IP2 10
+#define STATUSF_IP2 (_ULCAST_(1) << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP3 11
+#define STATUSF_IP3 (_ULCAST_(1) << 11)
+#define STATUSB_IP4 12
+#define STATUSF_IP4 (_ULCAST_(1) << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP5 13
+#define STATUSF_IP5 (_ULCAST_(1) << 13)
+#define STATUSB_IP6 14
+#define STATUSF_IP6 (_ULCAST_(1) << 14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP7 15
+#define STATUSF_IP7 (_ULCAST_(1) << 15)
+#define STATUSB_IP8 0
+#define STATUSF_IP8 (_ULCAST_(1) << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP9 1
+#define STATUSF_IP9 (_ULCAST_(1) << 1)
+#define STATUSB_IP10 2
+#define STATUSF_IP10 (_ULCAST_(1) << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP11 3
+#define STATUSF_IP11 (_ULCAST_(1) << 3)
+#define STATUSB_IP12 4
+#define STATUSF_IP12 (_ULCAST_(1) << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP13 5
+#define STATUSF_IP13 (_ULCAST_(1) << 5)
+#define STATUSB_IP14 6
+#define STATUSF_IP14 (_ULCAST_(1) << 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STATUSB_IP15 7
+#define STATUSF_IP15 (_ULCAST_(1) << 7)
+#define ST0_CH 0x00040000
+#define ST0_SR 0x00100000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_TS 0x00200000
+#define ST0_BEV 0x00400000
+#define ST0_RE 0x02000000
+#define ST0_FR 0x04000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_CU 0xf0000000
+#define ST0_CU0 0x10000000
+#define ST0_CU1 0x20000000
+#define ST0_CU2 0x40000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ST0_CU3 0x80000000
+#define ST0_XX 0x80000000  
+#define CAUSEB_EXCCODE 2
+#define CAUSEF_EXCCODE (_ULCAST_(31) << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSEB_IP 8
+#define CAUSEF_IP (_ULCAST_(255) << 8)
+#define CAUSEB_IP0 8
+#define CAUSEF_IP0 (_ULCAST_(1) << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSEB_IP1 9
+#define CAUSEF_IP1 (_ULCAST_(1) << 9)
+#define CAUSEB_IP2 10
+#define CAUSEF_IP2 (_ULCAST_(1) << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSEB_IP3 11
+#define CAUSEF_IP3 (_ULCAST_(1) << 11)
+#define CAUSEB_IP4 12
+#define CAUSEF_IP4 (_ULCAST_(1) << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSEB_IP5 13
+#define CAUSEF_IP5 (_ULCAST_(1) << 13)
+#define CAUSEB_IP6 14
+#define CAUSEF_IP6 (_ULCAST_(1) << 14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSEB_IP7 15
+#define CAUSEF_IP7 (_ULCAST_(1) << 15)
+#define CAUSEB_IV 23
+#define CAUSEF_IV (_ULCAST_(1) << 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSEB_CE 28
+#define CAUSEF_CE (_ULCAST_(3) << 28)
+#define CAUSEB_BD 31
+#define CAUSEF_BD (_ULCAST_(1) << 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CONF_CM_CACHABLE_NO_WA 0
+#define CONF_CM_CACHABLE_WA 1
+#define CONF_CM_UNCACHED 2
+#define CONF_CM_CACHABLE_NONCOHERENT 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CONF_CM_CACHABLE_CE 4
+#define CONF_CM_CACHABLE_COW 5
+#define CONF_CM_CACHABLE_CUW 6
+#define CONF_CM_CACHABLE_ACCELERATED 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CONF_CM_CMASK 7
+#define CONF_BE (_ULCAST_(1) << 15)
+#define CONF_CU (_ULCAST_(1) << 3)
+#define CONF_DB (_ULCAST_(1) << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CONF_IB (_ULCAST_(1) << 5)
+#define CONF_DC (_ULCAST_(7) << 6)
+#define CONF_IC (_ULCAST_(7) << 9)
+#define CONF_EB (_ULCAST_(1) << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CONF_EM (_ULCAST_(1) << 14)
+#define CONF_SM (_ULCAST_(1) << 16)
+#define CONF_SC (_ULCAST_(1) << 17)
+#define CONF_EW (_ULCAST_(3) << 18)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CONF_EP (_ULCAST_(15)<< 24)
+#define CONF_EC (_ULCAST_(7) << 28)
+#define CONF_CM (_ULCAST_(1) << 31)
+#define R4K_CONF_SW (_ULCAST_(1) << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R4K_CONF_SS (_ULCAST_(1) << 21)
+#define R4K_CONF_SB (_ULCAST_(3) << 22)
+#define R5K_CONF_SE (_ULCAST_(1) << 12)
+#define R5K_CONF_SS (_ULCAST_(3) << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RM7K_CONF_SE (_ULCAST_(1) << 3)
+#define RM7K_CONF_TE (_ULCAST_(1) << 12)
+#define RM7K_CONF_CLK (_ULCAST_(1) << 16)
+#define RM7K_CONF_TC (_ULCAST_(1) << 17)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RM7K_CONF_SI (_ULCAST_(3) << 20)
+#define RM7K_CONF_SC (_ULCAST_(1) << 31)
+#define R10K_CONF_DN (_ULCAST_(3) << 3)
+#define R10K_CONF_CT (_ULCAST_(1) << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R10K_CONF_PE (_ULCAST_(1) << 6)
+#define R10K_CONF_PM (_ULCAST_(3) << 7)
+#define R10K_CONF_EC (_ULCAST_(15)<< 9)
+#define R10K_CONF_SB (_ULCAST_(1) << 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R10K_CONF_SK (_ULCAST_(1) << 14)
+#define R10K_CONF_SS (_ULCAST_(7) << 16)
+#define R10K_CONF_SC (_ULCAST_(7) << 19)
+#define R10K_CONF_DC (_ULCAST_(7) << 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R10K_CONF_IC (_ULCAST_(7) << 29)
+#define VR41_CONF_CS (_ULCAST_(1) << 12)
+#define VR41_CONF_P4K (_ULCAST_(1) << 13)
+#define VR41_CONF_BP (_ULCAST_(1) << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VR41_CONF_M16 (_ULCAST_(1) << 20)
+#define VR41_CONF_AD (_ULCAST_(1) << 23)
+#define R30XX_CONF_FDM (_ULCAST_(1) << 19)
+#define R30XX_CONF_REV (_ULCAST_(1) << 22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R30XX_CONF_AC (_ULCAST_(1) << 23)
+#define R30XX_CONF_RF (_ULCAST_(1) << 24)
+#define R30XX_CONF_HALT (_ULCAST_(1) << 25)
+#define R30XX_CONF_FPINT (_ULCAST_(7) << 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R30XX_CONF_DBR (_ULCAST_(1) << 29)
+#define R30XX_CONF_SB (_ULCAST_(1) << 30)
+#define R30XX_CONF_LOCK (_ULCAST_(1) << 31)
+#define TX49_CONF_DC (_ULCAST_(1) << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX49_CONF_IC (_ULCAST_(1) << 17)  
+#define TX49_CONF_HALT (_ULCAST_(1) << 18)
+#define TX49_CONF_CWFON (_ULCAST_(1) << 27)
+#define MIPS_CONF_MT (_ULCAST_(7) << 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF_AR (_ULCAST_(7) << 10)
+#define MIPS_CONF_AT (_ULCAST_(3) << 13)
+#define MIPS_CONF_M (_ULCAST_(1) << 31)
+#define MIPS_CONF1_FP (_ULCAST_(1) << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF1_EP (_ULCAST_(1) << 1)
+#define MIPS_CONF1_CA (_ULCAST_(1) << 2)
+#define MIPS_CONF1_WR (_ULCAST_(1) << 3)
+#define MIPS_CONF1_PC (_ULCAST_(1) << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF1_MD (_ULCAST_(1) << 5)
+#define MIPS_CONF1_C2 (_ULCAST_(1) << 6)
+#define MIPS_CONF1_DA (_ULCAST_(7) << 7)
+#define MIPS_CONF1_DL (_ULCAST_(7) << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF1_DS (_ULCAST_(7) << 13)
+#define MIPS_CONF1_IA (_ULCAST_(7) << 16)
+#define MIPS_CONF1_IL (_ULCAST_(7) << 19)
+#define MIPS_CONF1_IS (_ULCAST_(7) << 22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF1_TLBS (_ULCAST_(63)<< 25)
+#define MIPS_CONF2_SA (_ULCAST_(15)<< 0)
+#define MIPS_CONF2_SL (_ULCAST_(15)<< 4)
+#define MIPS_CONF2_SS (_ULCAST_(15)<< 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF2_SU (_ULCAST_(15)<< 12)
+#define MIPS_CONF2_TA (_ULCAST_(15)<< 16)
+#define MIPS_CONF2_TL (_ULCAST_(15)<< 20)
+#define MIPS_CONF2_TS (_ULCAST_(15)<< 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF2_TU (_ULCAST_(7) << 28)
+#define MIPS_CONF3_TL (_ULCAST_(1) << 0)
+#define MIPS_CONF3_SM (_ULCAST_(1) << 1)
+#define MIPS_CONF3_MT (_ULCAST_(1) << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF3_SP (_ULCAST_(1) << 4)
+#define MIPS_CONF3_VINT (_ULCAST_(1) << 5)
+#define MIPS_CONF3_VEIC (_ULCAST_(1) << 6)
+#define MIPS_CONF3_LPA (_ULCAST_(1) << 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_CONF3_DSP (_ULCAST_(1) << 10)
+#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13)
+#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
+#define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_FPIR_S (_ULCAST_(1) << 16)
+#define MIPS_FPIR_D (_ULCAST_(1) << 17)
+#define MIPS_FPIR_PS (_ULCAST_(1) << 18)
+#define MIPS_FPIR_3D (_ULCAST_(1) << 19)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_FPIR_W (_ULCAST_(1) << 20)
+#define MIPS_FPIR_L (_ULCAST_(1) << 21)
+#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_r10k_perf_cntr(counter)  ({   unsigned int __res;   __asm__ __volatile__(   "mfpc\t%0, %1"   : "=r" (__res)   : "i" (counter));     __res;  })
+#define write_r10k_perf_cntr(counter,val)  do {   __asm__ __volatile__(   "mtpc\t%0, %1"   :   : "r" (val), "i" (counter));  } while (0)
+#define read_r10k_perf_event(counter)  ({   unsigned int __res;   __asm__ __volatile__(   "mfps\t%0, %1"   : "=r" (__res)   : "i" (counter));     __res;  })
+#define write_r10k_perf_cntl(counter,val)  do {   __asm__ __volatile__(   "mtps\t%0, %1"   :   : "r" (val), "i" (counter));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __read_32bit_c0_register(source, sel)  ({ int __res;   if (sel == 0)   __asm__ __volatile__(   "mfc0\t%0, " #source "\n\t"   : "=r" (__res));   else   __asm__ __volatile__(   ".set\tmips32\n\t"   "mfc0\t%0, " #source ", " #sel "\n\t"   ".set\tmips0\n\t"   : "=r" (__res));   __res;  })
+#define __read_64bit_c0_register(source, sel)  ({ unsigned long long __res;   if (sizeof(unsigned long) == 4)   __res = __read_64bit_c0_split(source, sel);   else if (sel == 0)   __asm__ __volatile__(   ".set\tmips3\n\t"   "dmfc0\t%0, " #source "\n\t"   ".set\tmips0"   : "=r" (__res));   else   __asm__ __volatile__(   ".set\tmips64\n\t"   "dmfc0\t%0, " #source ", " #sel "\n\t"   ".set\tmips0"   : "=r" (__res));   __res;  })
+#define __write_32bit_c0_register(register, sel, value)  do {   if (sel == 0)   __asm__ __volatile__(   "mtc0\t%z0, " #register "\n\t"   : : "Jr" ((unsigned int)(value)));   else   __asm__ __volatile__(   ".set\tmips32\n\t"   "mtc0\t%z0, " #register ", " #sel "\n\t"   ".set\tmips0"   : : "Jr" ((unsigned int)(value)));  } while (0)
+#define __write_64bit_c0_register(register, sel, value)  do {   if (sizeof(unsigned long) == 4)   __write_64bit_c0_split(register, sel, value);   else if (sel == 0)   __asm__ __volatile__(   ".set\tmips3\n\t"   "dmtc0\t%z0, " #register "\n\t"   ".set\tmips0"   : : "Jr" (value));   else   __asm__ __volatile__(   ".set\tmips64\n\t"   "dmtc0\t%z0, " #register ", " #sel "\n\t"   ".set\tmips0"   : : "Jr" (value));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __read_ulong_c0_register(reg, sel)   ((sizeof(unsigned long) == 4) ?   (unsigned long) __read_32bit_c0_register(reg, sel) :   (unsigned long) __read_64bit_c0_register(reg, sel))
+#define __write_ulong_c0_register(reg, sel, val)  do {   if (sizeof(unsigned long) == 4)   __write_32bit_c0_register(reg, sel, val);   else   __write_64bit_c0_register(reg, sel, val);  } while (0)
+#define __read_32bit_c0_ctrl_register(source)  ({ int __res;   __asm__ __volatile__(   "cfc0\t%0, " #source "\n\t"   : "=r" (__res));   __res;  })
+#define __write_32bit_c0_ctrl_register(register, value)  do {   __asm__ __volatile__(   "ctc0\t%z0, " #register "\n\t"   : : "Jr" ((unsigned int)(value)));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __read_64bit_c0_split(source, sel)  ({   unsigned long long __val;   unsigned long __flags;     local_irq_save(__flags);   if (sel == 0)   __asm__ __volatile__(   ".set\tmips64\n\t"   "dmfc0\t%M0, " #source "\n\t"   "dsll\t%L0, %M0, 32\n\t"   "dsrl\t%M0, %M0, 32\n\t"   "dsrl\t%L0, %L0, 32\n\t"   ".set\tmips0"   : "=r" (__val));   else   __asm__ __volatile__(   ".set\tmips64\n\t"   "dmfc0\t%M0, " #source ", " #sel "\n\t"   "dsll\t%L0, %M0, 32\n\t"   "dsrl\t%M0, %M0, 32\n\t"   "dsrl\t%L0, %L0, 32\n\t"   ".set\tmips0"   : "=r" (__val));   local_irq_restore(__flags);     __val;  })
+#define __write_64bit_c0_split(source, sel, val)  do {   unsigned long __flags;     local_irq_save(__flags);   if (sel == 0)   __asm__ __volatile__(   ".set\tmips64\n\t"   "dsll\t%L0, %L0, 32\n\t"   "dsrl\t%L0, %L0, 32\n\t"   "dsll\t%M0, %M0, 32\n\t"   "or\t%L0, %L0, %M0\n\t"   "dmtc0\t%L0, " #source "\n\t"   ".set\tmips0"   : : "r" (val));   else   __asm__ __volatile__(   ".set\tmips64\n\t"   "dsll\t%L0, %L0, 32\n\t"   "dsrl\t%L0, %L0, 32\n\t"   "dsll\t%M0, %M0, 32\n\t"   "or\t%L0, %L0, %M0\n\t"   "dmtc0\t%L0, " #source ", " #sel "\n\t"   ".set\tmips0"   : : "r" (val));   local_irq_restore(__flags);  } while (0)
+#define read_c0_index() __read_32bit_c0_register($0, 0)
+#define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_random() __read_32bit_c0_register($1, 0)
+#define write_c0_random(val) __write_32bit_c0_register($1, 0, val)
+#define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
+#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_entrylo1() __read_ulong_c0_register($3, 0)
+#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
+#define read_c0_conf() __read_32bit_c0_register($3, 0)
+#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_context() __read_ulong_c0_register($4, 0)
+#define write_c0_context(val) __write_ulong_c0_register($4, 0, val)
+#define read_c0_userlocal() __read_ulong_c0_register($4, 2)
+#define write_c0_userlocal(val) __write_ulong_c0_register($4, 2, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_pagemask() __read_32bit_c0_register($5, 0)
+#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
+#define read_c0_wired() __read_32bit_c0_register($6, 0)
+#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_info() __read_32bit_c0_register($7, 0)
+#define read_c0_cache() __read_32bit_c0_register($7, 0)  
+#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
+#define read_c0_badvaddr() __read_ulong_c0_register($8, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_badvaddr(val) __write_ulong_c0_register($8, 0, val)
+#define read_c0_count() __read_32bit_c0_register($9, 0)
+#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
+#define read_c0_count2() __read_32bit_c0_register($9, 6)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_count2(val) __write_32bit_c0_register($9, 6, val)
+#define read_c0_count3() __read_32bit_c0_register($9, 7)  
+#define write_c0_count3(val) __write_32bit_c0_register($9, 7, val)
+#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
+#define read_c0_compare() __read_32bit_c0_register($11, 0)
+#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
+#define read_c0_compare2() __read_32bit_c0_register($11, 6)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_compare2(val) __write_32bit_c0_register($11, 6, val)
+#define read_c0_compare3() __read_32bit_c0_register($11, 7)  
+#define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val)
+#define read_c0_status() __read_32bit_c0_register($12, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
+#define read_c0_cause() __read_32bit_c0_register($13, 0)
+#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
+#define read_c0_epc() __read_ulong_c0_register($14, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val)
+#define read_c0_prid() __read_32bit_c0_register($15, 0)
+#define read_c0_config() __read_32bit_c0_register($16, 0)
+#define read_c0_config1() __read_32bit_c0_register($16, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_config2() __read_32bit_c0_register($16, 2)
+#define read_c0_config3() __read_32bit_c0_register($16, 3)
+#define read_c0_config4() __read_32bit_c0_register($16, 4)
+#define read_c0_config5() __read_32bit_c0_register($16, 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_config6() __read_32bit_c0_register($16, 6)
+#define read_c0_config7() __read_32bit_c0_register($16, 7)
+#define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
+#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
+#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
+#define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
+#define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
+#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
+#define read_c0_watchlo0() __read_ulong_c0_register($18, 0)
+#define read_c0_watchlo1() __read_ulong_c0_register($18, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_watchlo2() __read_ulong_c0_register($18, 2)
+#define read_c0_watchlo3() __read_ulong_c0_register($18, 3)
+#define read_c0_watchlo4() __read_ulong_c0_register($18, 4)
+#define read_c0_watchlo5() __read_ulong_c0_register($18, 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_watchlo6() __read_ulong_c0_register($18, 6)
+#define read_c0_watchlo7() __read_ulong_c0_register($18, 7)
+#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
+#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
+#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
+#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
+#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
+#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
+#define read_c0_watchhi0() __read_32bit_c0_register($19, 0)
+#define read_c0_watchhi1() __read_32bit_c0_register($19, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_watchhi2() __read_32bit_c0_register($19, 2)
+#define read_c0_watchhi3() __read_32bit_c0_register($19, 3)
+#define read_c0_watchhi4() __read_32bit_c0_register($19, 4)
+#define read_c0_watchhi5() __read_32bit_c0_register($19, 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_watchhi6() __read_32bit_c0_register($19, 6)
+#define read_c0_watchhi7() __read_32bit_c0_register($19, 7)
+#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
+#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
+#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
+#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
+#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
+#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
+#define read_c0_xcontext() __read_ulong_c0_register($20, 0)
+#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_intcontrol() __read_32bit_c0_ctrl_register($20)
+#define write_c0_intcontrol(val) __write_32bit_c0_ctrl_register($20, val)
+#define read_c0_framemask() __read_32bit_c0_register($21, 0)
+#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_perfcontrol() __read_32bit_c0_register($22, 0)
+#define write_c0_perfcontrol(val) __write_32bit_c0_register($22, 0, val)
+#define read_c0_diag() __read_32bit_c0_register($22, 0)
+#define write_c0_diag(val) __write_32bit_c0_register($22, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_diag1() __read_32bit_c0_register($22, 1)
+#define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val)
+#define read_c0_diag2() __read_32bit_c0_register($22, 2)
+#define write_c0_diag2(val) __write_32bit_c0_register($22, 2, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_diag3() __read_32bit_c0_register($22, 3)
+#define write_c0_diag3(val) __write_32bit_c0_register($22, 3, val)
+#define read_c0_diag4() __read_32bit_c0_register($22, 4)
+#define write_c0_diag4(val) __write_32bit_c0_register($22, 4, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_diag5() __read_32bit_c0_register($22, 5)
+#define write_c0_diag5(val) __write_32bit_c0_register($22, 5, val)
+#define read_c0_debug() __read_32bit_c0_register($23, 0)
+#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_depc() __read_ulong_c0_register($24, 0)
+#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val)
+#define read_c0_perfctrl0() __read_32bit_c0_register($25, 0)
+#define write_c0_perfctrl0(val) __write_32bit_c0_register($25, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_perfcntr0() __read_32bit_c0_register($25, 1)
+#define write_c0_perfcntr0(val) __write_32bit_c0_register($25, 1, val)
+#define read_c0_perfctrl1() __read_32bit_c0_register($25, 2)
+#define write_c0_perfctrl1(val) __write_32bit_c0_register($25, 2, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_perfcntr1() __read_32bit_c0_register($25, 3)
+#define write_c0_perfcntr1(val) __write_32bit_c0_register($25, 3, val)
+#define read_c0_perfctrl2() __read_32bit_c0_register($25, 4)
+#define write_c0_perfctrl2(val) __write_32bit_c0_register($25, 4, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_perfcntr2() __read_32bit_c0_register($25, 5)
+#define write_c0_perfcntr2(val) __write_32bit_c0_register($25, 5, val)
+#define read_c0_perfctrl3() __read_32bit_c0_register($25, 6)
+#define write_c0_perfctrl3(val) __write_32bit_c0_register($25, 6, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_perfcntr3() __read_32bit_c0_register($25, 7)
+#define write_c0_perfcntr3(val) __write_32bit_c0_register($25, 7, val)
+#define read_c0_perfcount() __read_64bit_c0_register($25, 0)
+#define write_c0_perfcount(val) __write_64bit_c0_register($25, 0, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_ecc() __read_32bit_c0_register($26, 0)
+#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
+#define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
+#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define read_c0_cacheerr() __read_32bit_c0_register($27, 0)
+#define read_c0_derraddr1() __read_ulong_c0_register($27, 1)
+#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val)
+#define read_c0_taglo() __read_32bit_c0_register($28, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
+#define read_c0_dtaglo() __read_32bit_c0_register($28, 2)
+#define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val)
+#define read_c0_taghi() __read_32bit_c0_register($29, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
+#define read_c0_errorepc() __read_ulong_c0_register($30, 0)
+#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
+#define read_c0_hwrena() __read_32bit_c0_register($7, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_hwrena(val) __write_32bit_c0_register($7, 0, val)
+#define read_c0_intctl() __read_32bit_c0_register($12, 1)
+#define write_c0_intctl(val) __write_32bit_c0_register($12, 1, val)
+#define read_c0_srsctl() __read_32bit_c0_register($12, 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_srsctl(val) __write_32bit_c0_register($12, 2, val)
+#define read_c0_srsmap() __read_32bit_c0_register($12, 3)
+#define write_c0_srsmap(val) __write_32bit_c0_register($12, 3, val)
+#define read_c0_ebase() __read_32bit_c0_register($15, 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val)
+#define read_32bit_cp1_register(source)  ({ int __res;   __asm__ __volatile__(   ".set\tpush\n\t"   ".set\treorder\n\t"   "cfc1\t%0,"STR(source)"\n\t"   ".set\tpop"   : "=r" (__res));   __res;})
+#define rddsp(mask)  ({   unsigned int __res;     __asm__ __volatile__(   "	.set	push				\n"   "	.set	noat				\n"   "	# rddsp $1, %x1				\n"   "	.word	0x7c000cb8 | (%x1 << 16)	\n"   "	move	%0, $1				\n"   "	.set	pop				\n"   : "=r" (__res)   : "i" (mask));   __res;  })
+#define wrdsp(val, mask)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# wrdsp $1, %x1					\n"   "	.word	0x7c2004f8 | (%x1 << 11)		\n"   "	.set	pop					\n"   :   : "r" (val), "i" (mask));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mfhi0()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mfhi	%0, $ac0		\n"   "	.word	0x00000810		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+#define mfhi1()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mfhi	%0, $ac1		\n"   "	.word	0x00200810		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+#define mfhi2()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mfhi	%0, $ac2		\n"   "	.word	0x00400810		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+#define mfhi3()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mfhi	%0, $ac3		\n"   "	.word	0x00600810		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mflo0()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mflo	%0, $ac0		\n"   "	.word	0x00000812		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+#define mflo1()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mflo	%0, $ac1		\n"   "	.word	0x00200812		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+#define mflo2()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mflo	%0, $ac2		\n"   "	.word	0x00400812		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+#define mflo3()  ({   unsigned long __treg;     __asm__ __volatile__(   "	.set	push			\n"   "	.set	noat			\n"   "	# mflo	%0, $ac3		\n"   "	.word	0x00600812		\n"   "	move	%0, $1			\n"   "	.set	pop			\n"   : "=r" (__treg));   __treg;  })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mthi0(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mthi	$1, $ac0				\n"   "	.word	0x00200011				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+#define mthi1(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mthi	$1, $ac1				\n"   "	.word	0x00200811				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+#define mthi2(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mthi	$1, $ac2				\n"   "	.word	0x00201011				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+#define mthi3(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mthi	$1, $ac3				\n"   "	.word	0x00201811				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mtlo0(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mtlo	$1, $ac0				\n"   "	.word	0x00200013				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+#define mtlo1(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mtlo	$1, $ac1				\n"   "	.word	0x00200813				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+#define mtlo2(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mtlo	$1, $ac2				\n"   "	.word	0x00201013				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+#define mtlo3(x)  do {   __asm__ __volatile__(   "	.set	push					\n"   "	.set	noat					\n"   "	move	$1, %0					\n"   "	# mtlo	$1, $ac3				\n"   "	.word	0x00201813				\n"   "	.set	pop					\n"   :   : "r" (x));  } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if MIPS34K_MISSED_ITLB_WAR
+#endif
+#if MIPS34K_MISSED_ITLB_WAR
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __BUILD_SET_C0(name)  static inline unsigned int  set_c0_##name(unsigned int set)  {   unsigned int res;     res = read_c0_##name();   res |= set;   write_c0_##name(res);     return res;  }    static inline unsigned int  clear_c0_##name(unsigned int clear)  {   unsigned int res;     res = read_c0_##name();   res &= ~clear;   write_c0_##name(res);     return res;  }    static inline unsigned int  change_c0_##name(unsigned int change, unsigned int new)  {   unsigned int res;     res = read_c0_##name();   res &= ~change;   res |= (new & change);   write_c0_##name(res);     return res;  }
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/mman.h b/libc/kernel/arch-mips/asm/mman.h
new file mode 100644
index 0000000..9e51c67
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mman.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MMAN_H
+#define _ASM_MMAN_H
+#define PROT_NONE 0x00  
+#define PROT_READ 0x01  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROT_WRITE 0x02  
+#define PROT_EXEC 0x04  
+#define PROT_SEM 0x10  
+#define PROT_GROWSDOWN 0x01000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROT_GROWSUP 0x02000000  
+#define MAP_SHARED 0x001  
+#define MAP_PRIVATE 0x002  
+#define MAP_TYPE 0x00f  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_FIXED 0x010  
+#define MAP_RENAME 0x020  
+#define MAP_AUTOGROW 0x040  
+#define MAP_LOCAL 0x080  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_AUTORSRV 0x100  
+#define MAP_NORESERVE 0x0400  
+#define MAP_ANONYMOUS 0x0800  
+#define MAP_GROWSDOWN 0x1000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_DENYWRITE 0x2000  
+#define MAP_EXECUTABLE 0x4000  
+#define MAP_LOCKED 0x8000  
+#define MAP_POPULATE 0x10000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MAP_NONBLOCK 0x20000  
+#define MS_ASYNC 0x0001  
+#define MS_INVALIDATE 0x0002  
+#define MS_SYNC 0x0004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MCL_CURRENT 1  
+#define MCL_FUTURE 2  
+#define MADV_NORMAL 0  
+#define MADV_RANDOM 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_SEQUENTIAL 2  
+#define MADV_WILLNEED 3  
+#define MADV_DONTNEED 4  
+#define MADV_REMOVE 9  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MADV_DONTFORK 10  
+#define MADV_DOFORK 11  
+#define MAP_FILE 0
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/mmu.h b/libc/kernel/arch-mips/asm/mmu.h
new file mode 100644
index 0000000..ef62db4
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/mmu.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+typedef unsigned long mm_context_t[NR_CPUS];
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/pgalloc.h b/libc/kernel/arch-mips/asm/mmzone.h
similarity index 60%
rename from libc/kernel/arch-sh/asm/pgalloc.h
rename to libc/kernel/arch-mips/asm/mmzone.h
index 6c15ea5..2f7e1c4 100644
--- a/libc/kernel/arch-sh/asm/pgalloc.h
+++ b/libc/kernel/arch-mips/asm/mmzone.h
@@ -7,19 +7,18 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_PGALLOC_H
-#define __ASM_SH_PGALLOC_H
-
-#include <linux/quicklist.h>
+#ifndef _ASM_MMZONE_H_
+#define _ASM_MMZONE_H_
 #include <asm/page.h>
-
-#define QUICK_PGD 0  
-#define QUICK_PT 1  
-
-#define pmd_pgtable(pmd) pmd_page(pmd)
-#define __pte_free_tlb(tlb,pte)  do {   pgtable_page_dtor(pte);   tlb_remove_page((tlb), (pte));  } while (0)
-#define pmd_free(mm, x) do { } while (0)
-#define __pmd_free_tlb(tlb,x) do { } while (0)
+#include <mmzone.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/arch-mips/asm/module.h b/libc/kernel/arch-mips/asm/module.h
new file mode 100644
index 0000000..45808e9
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/module.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MODULE_H
+#define _ASM_MODULE_H
+#include <linux/list.h>
+#include <asm/uaccess.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mod_arch_specific {
+ struct list_head dbe_list;
+ const struct exception_table_entry *dbe_start;
+ const struct exception_table_entry *dbe_end;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+typedef uint8_t Elf64_Byte;
+typedef struct {
+ Elf64_Addr r_offset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ Elf64_Word r_sym;
+ Elf64_Byte r_ssym;
+ Elf64_Byte r_type3;
+ Elf64_Byte r_type2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ Elf64_Byte r_type;
+} Elf64_Mips_Rel;
+typedef struct {
+ Elf64_Addr r_offset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ Elf64_Word r_sym;
+ Elf64_Byte r_ssym;
+ Elf64_Byte r_type3;
+ Elf64_Byte r_type2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ Elf64_Byte r_type;
+ Elf64_Sxword r_addend;
+} Elf64_Mips_Rela;
+#error MODULE_PROC_FAMILY undefined for your processor configuration
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MODULE_KERNEL_SMTC ""
+#define MODULE_ARCH_VERMAGIC   MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC
+#endif
diff --git a/libc/kernel/arch-sh/asm/msgbuf.h b/libc/kernel/arch-mips/asm/msgbuf.h
similarity index 60%
rename from libc/kernel/arch-sh/asm/msgbuf.h
rename to libc/kernel/arch-mips/asm/msgbuf.h
index ec64905..31a1887 100644
--- a/libc/kernel/arch-sh/asm/msgbuf.h
+++ b/libc/kernel/arch-mips/asm/msgbuf.h
@@ -7,26 +7,32 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_MSGBUF_H
-#define __ASM_SH_MSGBUF_H
-
+#ifndef _ASM_MSGBUF_H
+#define _ASM_MSGBUF_H
 struct msqid64_ds {
  struct ipc64_perm msg_perm;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __kernel_time_t msg_stime;
- unsigned long __unused1;
  __kernel_time_t msg_rtime;
- unsigned long __unused2;
  __kernel_time_t msg_ctime;
- unsigned long __unused3;
  unsigned long msg_cbytes;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  unsigned long msg_qnum;
  unsigned long msg_qbytes;
  __kernel_pid_t msg_lspid;
  __kernel_pid_t msg_lrpid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  unsigned long __unused4;
  unsigned long __unused5;
 };
-
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/mutex.h b/libc/kernel/arch-mips/asm/mutex.h
similarity index 69%
rename from libc/kernel/arch-sh/asm/mutex.h
rename to libc/kernel/arch-mips/asm/mutex.h
index 79054b2..74f7c18 100644
--- a/libc/kernel/arch-sh/asm/mutex.h
+++ b/libc/kernel/arch-mips/asm/mutex.h
@@ -7,6 +7,13 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #include <asm-generic/mutex-dec.h>
diff --git a/libc/kernel/arch-mips/asm/page.h b/libc/kernel/arch-mips/asm/page.h
new file mode 100644
index 0000000..93eb390
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/page.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PAGE_H
+#define _ASM_PAGE_H
+#ifndef PAGE_SHIFT
+#define PAGE_SHIFT 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/param.h b/libc/kernel/arch-mips/asm/param.h
new file mode 100644
index 0000000..9378027
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/param.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PARAM_H
+#define _ASM_PARAM_H
+#ifndef HZ
+#define HZ 100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define EXEC_PAGESIZE 65536
+#ifndef NOGROUP
+#define NOGROUP (-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/pci/bridge.h b/libc/kernel/arch-mips/asm/pci/bridge.h
new file mode 100644
index 0000000..cd2fde4
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/pci/bridge.h
@@ -0,0 +1,676 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PCI_BRIDGE_H
+#define _ASM_PCI_BRIDGE_H
+#include <linux/types.h>
+#include <linux/pci.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/xtalk/xwidget.h>  
+#include <asm/sn/types.h>
+#define IOPFNSHIFT 12  
+#define IOPGSIZE (1 << IOPFNSHIFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOPG(x) ((x) >> IOPFNSHIFT)
+#define IOPGOFF(x) ((x) & (IOPGSIZE-1))
+#define BRIDGE_ATE_RAM_SIZE 0x00000400  
+#define BRIDGE_CONFIG_BASE 0x20000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CONFIG1_BASE 0x28000
+#define BRIDGE_CONFIG_END 0x30000
+#define BRIDGE_CONFIG_SLOT_SIZE 0x1000
+#define BRIDGE_SSRAM_512K 0x00080000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_SSRAM_128K 0x00020000  
+#define BRIDGE_SSRAM_64K 0x00010000  
+#define BRIDGE_SSRAM_0K 0x00000000  
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef u32 bridgereg_t;
+typedef u64 bridge_ate_t;
+typedef volatile bridge_ate_t *bridge_ate_p;
+typedef volatile struct bridge_s {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widget_cfg_t b_widget;
+#define b_wid_id b_widget.w_id
+#define b_wid_stat b_widget.w_status
+#define b_wid_err_upper b_widget.w_err_upper_addr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define b_wid_err_lower b_widget.w_err_lower_addr
+#define b_wid_control b_widget.w_control
+#define b_wid_req_timeout b_widget.w_req_timeout
+#define b_wid_int_upper b_widget.w_intdest_upper_addr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define b_wid_int_lower b_widget.w_intdest_lower_addr
+#define b_wid_err_cmdword b_widget.w_err_cmd_word
+#define b_wid_llp b_widget.w_llp_cfg
+#define b_wid_tflush b_widget.w_tflush
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_000058;
+ bridgereg_t b_wid_aux_err;
+ bridgereg_t _pad_000060;
+ bridgereg_t b_wid_resp_upper;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_000068;
+ bridgereg_t b_wid_resp_lower;
+ bridgereg_t _pad_000070;
+ bridgereg_t b_wid_tst_pin_ctrl;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_000078[2];
+ bridgereg_t _pad_000080;
+ bridgereg_t b_dir_map;
+ bridgereg_t _pad_000088[2];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_000090;
+ bridgereg_t b_ram_perr;
+ bridgereg_t _pad_000098[2];
+ bridgereg_t _pad_0000A0;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t b_arb;
+ bridgereg_t _pad_0000A8[2];
+ bridgereg_t _pad_0000B0;
+ bridgereg_t b_nic;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_0000B8[2];
+ bridgereg_t _pad_0000C0;
+ bridgereg_t b_bus_timeout;
+#define b_pci_bus_timeout b_bus_timeout
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_0000C8;
+ bridgereg_t b_pci_cfg;
+ bridgereg_t _pad_0000D0;
+ bridgereg_t b_pci_err_upper;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_0000D8;
+ bridgereg_t b_pci_err_lower;
+ bridgereg_t _pad_0000E0[8];
+#define b_gio_err_lower b_pci_err_lower
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define b_gio_err_upper b_pci_err_upper
+ bridgereg_t _pad_000100;
+ bridgereg_t b_int_status;
+ bridgereg_t _pad_000108;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t b_int_enable;
+ bridgereg_t _pad_000110;
+ bridgereg_t b_int_rst_stat;
+ bridgereg_t _pad_000118;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t b_int_mode;
+ bridgereg_t _pad_000120;
+ bridgereg_t b_int_device;
+ bridgereg_t _pad_000128;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t b_int_host_err;
+ struct {
+ bridgereg_t __pad;
+ bridgereg_t addr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } b_int_addr[8];
+ bridgereg_t _pad_000170[36];
+ struct {
+ bridgereg_t __pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t reg;
+ } b_device[8];
+ struct {
+ bridgereg_t __pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t reg;
+ } b_wr_req_buf[8];
+ struct {
+ bridgereg_t __pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t reg;
+ } b_rrb_map[2];
+#define b_even_resp b_rrb_map[0].reg  
+#define b_odd_resp b_rrb_map[1].reg  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_000290;
+ bridgereg_t b_resp_status;
+ bridgereg_t _pad_000298;
+ bridgereg_t b_resp_clear;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t _pad_0002A0[24];
+ char _pad_000300[0x10000 - 0x000300];
+ union {
+ bridge_ate_t wr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ bridgereg_t _p_pad;
+ bridgereg_t rd;
+ } hi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } b_int_ate_ram[128];
+ char _pad_010400[0x11000 - 0x010400];
+ struct {
+ bridgereg_t _p_pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bridgereg_t rd;
+ } b_int_ate_ram_lo[128];
+ char _pad_011400[0x20000 - 0x011400];
+ union {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 c[0x1000 / 1];
+ u16 s[0x1000 / 2];
+ u32 l[0x1000 / 4];
+ u64 d[0x1000 / 8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ u8 c[0x100 / 1];
+ u16 s[0x100 / 2];
+ u32 l[0x100 / 4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 d[0x100 / 8];
+ } f[8];
+ } b_type0_cfg_dev[8];
+ union {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 c[0x1000 / 1];
+ u16 s[0x1000 / 2];
+ u32 l[0x1000 / 4];
+ u64 d[0x1000 / 8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } b_type1_cfg;
+ char _pad_029000[0x007000];
+ union {
+ u8 c[8 / 1];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u16 s[8 / 2];
+ u32 l[8 / 4];
+ u64 d[8 / 8];
+ } b_pci_iack;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 _pad_030007[0x04fff8];
+ bridge_ate_t b_ext_ate_ram[0x10000];
+ char _pad_100000[0x200000-0x100000];
+ union {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 c[0x100000 / 1];
+ u16 s[0x100000 / 2];
+ u32 l[0x100000 / 4];
+ u64 d[0x100000 / 8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } b_devio_raw[10];
+#define b_devio(n) b_devio_raw[((n)<2)?(n*2):(n+2)]
+ union {
+ u8 c[0x400000 / 1];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u16 s[0x400000 / 2];
+ u32 l[0x400000 / 4];
+ u64 d[0x400000 / 8];
+ } b_external_flash;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} bridge_t;
+typedef struct bridge_err_cmdword_s {
+ union {
+ u32 cmd_word;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ u32 didn:4,
+ sidn:4,
+ pactyp:4,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ tnum:5,
+ coh:1,
+ ds:2,
+ gbr:1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ vbpm:1,
+ error:1,
+ barr:1,
+ rsvd:8;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } berr_st;
+ } berr_un;
+} bridge_err_cmdword_t;
+#define berr_field berr_un.berr_st
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define BRIDGE_WID_ID WIDGET_ID
+#define BRIDGE_WID_STAT WIDGET_STATUS
+#define BRIDGE_WID_ERR_UPPER WIDGET_ERR_UPPER_ADDR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_WID_ERR_LOWER WIDGET_ERR_LOWER_ADDR
+#define BRIDGE_WID_CONTROL WIDGET_CONTROL
+#define BRIDGE_WID_REQ_TIMEOUT WIDGET_REQ_TIMEOUT
+#define BRIDGE_WID_INT_UPPER WIDGET_INTDEST_UPPER_ADDR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_WID_INT_LOWER WIDGET_INTDEST_LOWER_ADDR
+#define BRIDGE_WID_ERR_CMDWORD WIDGET_ERR_CMD_WORD
+#define BRIDGE_WID_LLP WIDGET_LLP_CFG
+#define BRIDGE_WID_TFLUSH WIDGET_TFLUSH
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_WID_AUX_ERR 0x00005C  
+#define BRIDGE_WID_RESP_UPPER 0x000064  
+#define BRIDGE_WID_RESP_LOWER 0x00006C  
+#define BRIDGE_WID_TST_PIN_CTRL 0x000074  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DIR_MAP 0x000084  
+#define BRIDGE_RAM_PERR 0x000094  
+#define BRIDGE_ARB 0x0000A4  
+#define BRIDGE_NIC 0x0000B4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_BUS_TIMEOUT 0x0000C4  
+#define BRIDGE_PCI_BUS_TIMEOUT BRIDGE_BUS_TIMEOUT
+#define BRIDGE_PCI_CFG 0x0000CC  
+#define BRIDGE_PCI_ERR_UPPER 0x0000D4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_PCI_ERR_LOWER 0x0000DC  
+#define BRIDGE_INT_STATUS 0x000104  
+#define BRIDGE_INT_ENABLE 0x00010C  
+#define BRIDGE_INT_RST_STAT 0x000114  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_INT_MODE 0x00011C  
+#define BRIDGE_INT_DEVICE 0x000124  
+#define BRIDGE_INT_HOST_ERR 0x00012C  
+#define BRIDGE_INT_ADDR0 0x000134  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_INT_ADDR_OFF 0x000008  
+#define BRIDGE_INT_ADDR(x) (BRIDGE_INT_ADDR0+(x)*BRIDGE_INT_ADDR_OFF)
+#define BRIDGE_DEVICE0 0x000204  
+#define BRIDGE_DEVICE_OFF 0x000008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEVICE(x) (BRIDGE_DEVICE0+(x)*BRIDGE_DEVICE_OFF)
+#define BRIDGE_WR_REQ_BUF0 0x000244  
+#define BRIDGE_WR_REQ_BUF_OFF 0x000008  
+#define BRIDGE_WR_REQ_BUF(x) (BRIDGE_WR_REQ_BUF0+(x)*BRIDGE_WR_REQ_BUF_OFF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_EVEN_RESP 0x000284  
+#define BRIDGE_ODD_RESP 0x00028C  
+#define BRIDGE_RESP_STATUS 0x000294  
+#define BRIDGE_RESP_CLEAR 0x00029C  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ATE_RAM 0x00010000  
+#define BRIDGE_TYPE0_CFG_DEV0 0x00020000  
+#define BRIDGE_TYPE0_CFG_SLOT_OFF 0x00001000  
+#define BRIDGE_TYPE0_CFG_FUNC_OFF 0x00000100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_TYPE0_CFG_DEV(s) (BRIDGE_TYPE0_CFG_DEV0+  (s)*BRIDGE_TYPE0_CFG_SLOT_OFF)
+#define BRIDGE_TYPE0_CFG_DEVF(s, f) (BRIDGE_TYPE0_CFG_DEV0+  (s)*BRIDGE_TYPE0_CFG_SLOT_OFF+  (f)*BRIDGE_TYPE0_CFG_FUNC_OFF)
+#define BRIDGE_TYPE1_CFG 0x00028000  
+#define BRIDGE_PCI_IACK 0x00030000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_EXT_SSRAM 0x00080000  
+#define BRIDGE_DEV_CNT 8  
+#define BRIDGE_DEVIO0 0x00200000  
+#define BRIDGE_DEVIO1 0x00400000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEVIO2 0x00600000  
+#define BRIDGE_DEVIO_OFF 0x00100000  
+#define BRIDGE_DEVIO_2MB 0x00200000  
+#define BRIDGE_DEVIO_1MB 0x00100000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEVIO(x) ((x)<=1 ? BRIDGE_DEVIO0+(x)*BRIDGE_DEVIO_2MB : BRIDGE_DEVIO2+((x)-2)*BRIDGE_DEVIO_1MB)
+#define BRIDGE_EXTERNAL_FLASH 0x00C00000  
+#define BRIDGE_WIDGET_PART_NUM 0xc002
+#define XBRIDGE_WIDGET_PART_NUM 0xd002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_WIDGET_MFGR_NUM 0x036
+#define XBRIDGE_WIDGET_MFGR_NUM 0x024
+#define BRIDGE_REV_A 0x1
+#define BRIDGE_REV_B 0x2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_REV_C 0x3
+#define BRIDGE_REV_D 0x4
+#define BRIDGE_STAT_LLP_REC_CNT (0xFFu << 24)
+#define BRIDGE_STAT_LLP_TX_CNT (0xFF << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_STAT_FLASH_SELECT (0x1 << 6)
+#define BRIDGE_STAT_PCI_GIO_N (0x1 << 5)
+#define BRIDGE_STAT_PENDING (0x1F << 0)
+#define BRIDGE_CTRL_FLASH_WR_EN (0x1ul << 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_EN_CLK50 (0x1 << 30)
+#define BRIDGE_CTRL_EN_CLK40 (0x1 << 29)
+#define BRIDGE_CTRL_EN_CLK33 (0x1 << 28)
+#define BRIDGE_CTRL_RST(n) ((n) << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_RST_MASK (BRIDGE_CTRL_RST(0xF))
+#define BRIDGE_CTRL_RST_PIN(x) (BRIDGE_CTRL_RST(0x1 << (x)))
+#define BRIDGE_CTRL_IO_SWAP (0x1 << 23)
+#define BRIDGE_CTRL_MEM_SWAP (0x1 << 22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_PAGE_SIZE (0x1 << 21)
+#define BRIDGE_CTRL_SS_PAR_BAD (0x1 << 20)
+#define BRIDGE_CTRL_SS_PAR_EN (0x1 << 19)
+#define BRIDGE_CTRL_SSRAM_SIZE(n) ((n) << 17)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_SSRAM_SIZE_MASK (BRIDGE_CTRL_SSRAM_SIZE(0x3))
+#define BRIDGE_CTRL_SSRAM_512K (BRIDGE_CTRL_SSRAM_SIZE(0x3))
+#define BRIDGE_CTRL_SSRAM_128K (BRIDGE_CTRL_SSRAM_SIZE(0x2))
+#define BRIDGE_CTRL_SSRAM_64K (BRIDGE_CTRL_SSRAM_SIZE(0x1))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_SSRAM_1K (BRIDGE_CTRL_SSRAM_SIZE(0x0))
+#define BRIDGE_CTRL_F_BAD_PKT (0x1 << 16)
+#define BRIDGE_CTRL_LLP_XBAR_CRD(n) ((n) << 12)
+#define BRIDGE_CTRL_LLP_XBAR_CRD_MASK (BRIDGE_CTRL_LLP_XBAR_CRD(0xf))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_CLR_RLLP_CNT (0x1 << 11)
+#define BRIDGE_CTRL_CLR_TLLP_CNT (0x1 << 10)
+#define BRIDGE_CTRL_SYS_END (0x1 << 9)
+#define BRIDGE_CTRL_MAX_TRANS(n) ((n) << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_CTRL_MAX_TRANS_MASK (BRIDGE_CTRL_MAX_TRANS(0x1f))
+#define BRIDGE_CTRL_WIDGET_ID(n) ((n) << 0)
+#define BRIDGE_CTRL_WIDGET_ID_MASK (BRIDGE_CTRL_WIDGET_ID(0xf))
+#define BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT (20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_RESP_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
+#define BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT (16)
+#define BRIDGE_RESP_ERRUPPR_BUFNUM_MASK (0xF << BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
+#define BRIDGE_RESP_ERRRUPPR_BUFMASK (0xFFFF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_RESP_ERRUPPR_BUFNUM(x)   (((x) & BRIDGE_RESP_ERRUPPR_BUFNUM_MASK) >>   BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
+#define BRIDGE_RESP_ERRUPPR_DEVICE(x)   (((x) & BRIDGE_RESP_ERRUPPR_DEVNUM_MASK) >>   BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
+#define BRIDGE_DIRMAP_W_ID_SHFT 20
+#define BRIDGE_DIRMAP_W_ID (0xf << BRIDGE_DIRMAP_W_ID_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DIRMAP_RMF_64 (0x1 << 18)
+#define BRIDGE_DIRMAP_ADD512 (0x1 << 17)
+#define BRIDGE_DIRMAP_OFF (0x1ffff << 0)
+#define BRIDGE_DIRMAP_OFF_ADDRSHFT (31)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ARB_REQ_WAIT_TICK(x) ((x) << 16)
+#define BRIDGE_ARB_REQ_WAIT_TICK_MASK BRIDGE_ARB_REQ_WAIT_TICK(0x3)
+#define BRIDGE_ARB_REQ_WAIT_EN(x) ((x) << 8)
+#define BRIDGE_ARB_REQ_WAIT_EN_MASK BRIDGE_ARB_REQ_WAIT_EN(0xff)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ARB_FREEZE_GNT (1 << 6)
+#define BRIDGE_ARB_HPRI_RING_B2 (1 << 5)
+#define BRIDGE_ARB_HPRI_RING_B1 (1 << 4)
+#define BRIDGE_ARB_HPRI_RING_B0 (1 << 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ARB_LPRI_RING_B2 (1 << 2)
+#define BRIDGE_ARB_LPRI_RING_B1 (1 << 1)
+#define BRIDGE_ARB_LPRI_RING_B0 (1 << 0)
+#define BRIDGE_BUS_PCI_RETRY_HLD(x) ((x) << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_BUS_PCI_RETRY_HLD_MASK BRIDGE_BUS_PCI_RETRY_HLD(0x1f)
+#define BRIDGE_BUS_GIO_TIMEOUT (1 << 12)
+#define BRIDGE_BUS_PCI_RETRY_CNT(x) ((x) << 0)
+#define BRIDGE_BUS_PCI_RETRY_MASK BRIDGE_BUS_PCI_RETRY_CNT(0x3ff)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_MULTI_ERR (0x1u << 31)
+#define BRIDGE_ISR_PMU_ESIZE_FAULT (0x1 << 30)
+#define BRIDGE_ISR_UNEXP_RESP (0x1 << 29)
+#define BRIDGE_ISR_BAD_XRESP_PKT (0x1 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_BAD_XREQ_PKT (0x1 << 27)
+#define BRIDGE_ISR_RESP_XTLK_ERR (0x1 << 26)
+#define BRIDGE_ISR_REQ_XTLK_ERR (0x1 << 25)
+#define BRIDGE_ISR_INVLD_ADDR (0x1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_UNSUPPORTED_XOP (0x1 << 23)
+#define BRIDGE_ISR_XREQ_FIFO_OFLOW (0x1 << 22)
+#define BRIDGE_ISR_LLP_REC_SNERR (0x1 << 21)
+#define BRIDGE_ISR_LLP_REC_CBERR (0x1 << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_LLP_RCTY (0x1 << 19)
+#define BRIDGE_ISR_LLP_TX_RETRY (0x1 << 18)
+#define BRIDGE_ISR_LLP_TCTY (0x1 << 17)
+#define BRIDGE_ISR_SSRAM_PERR (0x1 << 16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_PCI_ABORT (0x1 << 15)
+#define BRIDGE_ISR_PCI_PARITY (0x1 << 14)
+#define BRIDGE_ISR_PCI_SERR (0x1 << 13)
+#define BRIDGE_ISR_PCI_PERR (0x1 << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_PCI_MST_TIMEOUT (0x1 << 11)
+#define BRIDGE_ISR_GIO_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
+#define BRIDGE_ISR_PCI_RETRY_CNT (0x1 << 10)
+#define BRIDGE_ISR_XREAD_REQ_TIMEOUT (0x1 << 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_GIO_B_ENBL_ERR (0x1 << 8)
+#define BRIDGE_ISR_INT_MSK (0xff << 0)
+#define BRIDGE_ISR_INT(x) (0x1 << (x))
+#define BRIDGE_ISR_LINK_ERROR   (BRIDGE_ISR_LLP_REC_SNERR|BRIDGE_ISR_LLP_REC_CBERR|   BRIDGE_ISR_LLP_RCTY|BRIDGE_ISR_LLP_TX_RETRY|   BRIDGE_ISR_LLP_TCTY)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_PCIBUS_PIOERR   (BRIDGE_ISR_PCI_MST_TIMEOUT|BRIDGE_ISR_PCI_ABORT)
+#define BRIDGE_ISR_PCIBUS_ERROR   (BRIDGE_ISR_PCIBUS_PIOERR|BRIDGE_ISR_PCI_PERR|   BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_RETRY_CNT|   BRIDGE_ISR_PCI_PARITY)
+#define BRIDGE_ISR_XTALK_ERROR   (BRIDGE_ISR_XREAD_REQ_TIMEOUT|BRIDGE_ISR_XREQ_FIFO_OFLOW|  BRIDGE_ISR_UNSUPPORTED_XOP|BRIDGE_ISR_INVLD_ADDR|   BRIDGE_ISR_REQ_XTLK_ERR|BRIDGE_ISR_RESP_XTLK_ERR|   BRIDGE_ISR_BAD_XREQ_PKT|BRIDGE_ISR_BAD_XRESP_PKT|   BRIDGE_ISR_UNEXP_RESP)
+#define BRIDGE_ISR_ERRORS   (BRIDGE_ISR_LINK_ERROR|BRIDGE_ISR_PCIBUS_ERROR|   BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR|   BRIDGE_ISR_PMU_ESIZE_FAULT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ISR_ERROR_FATAL   ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|  BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_PARITY )
+#define BRIDGE_ISR_ERROR_DUMP   (BRIDGE_ISR_PCIBUS_ERROR|BRIDGE_ISR_PMU_ESIZE_FAULT|   BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR)
+#define BRIDGE_IMR_UNEXP_RESP BRIDGE_ISR_UNEXP_RESP
+#define BRIDGE_IMR_PMU_ESIZE_FAULT BRIDGE_ISR_PMU_ESIZE_FAULT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IMR_BAD_XRESP_PKT BRIDGE_ISR_BAD_XRESP_PKT
+#define BRIDGE_IMR_BAD_XREQ_PKT BRIDGE_ISR_BAD_XREQ_PKT
+#define BRIDGE_IMR_RESP_XTLK_ERR BRIDGE_ISR_RESP_XTLK_ERR
+#define BRIDGE_IMR_REQ_XTLK_ERR BRIDGE_ISR_REQ_XTLK_ERR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IMR_INVLD_ADDR BRIDGE_ISR_INVLD_ADDR
+#define BRIDGE_IMR_UNSUPPORTED_XOP BRIDGE_ISR_UNSUPPORTED_XOP
+#define BRIDGE_IMR_XREQ_FIFO_OFLOW BRIDGE_ISR_XREQ_FIFO_OFLOW
+#define BRIDGE_IMR_LLP_REC_SNERR BRIDGE_ISR_LLP_REC_SNERR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IMR_LLP_REC_CBERR BRIDGE_ISR_LLP_REC_CBERR
+#define BRIDGE_IMR_LLP_RCTY BRIDGE_ISR_LLP_RCTY
+#define BRIDGE_IMR_LLP_TX_RETRY BRIDGE_ISR_LLP_TX_RETRY
+#define BRIDGE_IMR_LLP_TCTY BRIDGE_ISR_LLP_TCTY
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IMR_SSRAM_PERR BRIDGE_ISR_SSRAM_PERR
+#define BRIDGE_IMR_PCI_ABORT BRIDGE_ISR_PCI_ABORT
+#define BRIDGE_IMR_PCI_PARITY BRIDGE_ISR_PCI_PARITY
+#define BRIDGE_IMR_PCI_SERR BRIDGE_ISR_PCI_SERR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IMR_PCI_PERR BRIDGE_ISR_PCI_PERR
+#define BRIDGE_IMR_PCI_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
+#define BRIDGE_IMR_GIO_MST_TIMEOUT BRIDGE_ISR_GIO_MST_TIMEOUT
+#define BRIDGE_IMR_PCI_RETRY_CNT BRIDGE_ISR_PCI_RETRY_CNT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IMR_XREAD_REQ_TIMEOUT BRIDGE_ISR_XREAD_REQ_TIMEOUT
+#define BRIDGE_IMR_GIO_B_ENBL_ERR BRIDGE_ISR_GIO_B_ENBL_ERR
+#define BRIDGE_IMR_INT_MSK BRIDGE_ISR_INT_MSK
+#define BRIDGE_IMR_INT(x) BRIDGE_ISR_INT(x)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IRR_MULTI_CLR (0x1 << 6)
+#define BRIDGE_IRR_CRP_GRP_CLR (0x1 << 5)
+#define BRIDGE_IRR_RESP_BUF_GRP_CLR (0x1 << 4)
+#define BRIDGE_IRR_REQ_DSP_GRP_CLR (0x1 << 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IRR_LLP_GRP_CLR (0x1 << 2)
+#define BRIDGE_IRR_SSRAM_GRP_CLR (0x1 << 1)
+#define BRIDGE_IRR_PCI_GRP_CLR (0x1 << 0)
+#define BRIDGE_IRR_GIO_GRP_CLR (0x1 << 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IRR_ALL_CLR 0x7f
+#define BRIDGE_IRR_CRP_GRP (BRIDGE_ISR_UNEXP_RESP |   BRIDGE_ISR_XREQ_FIFO_OFLOW)
+#define BRIDGE_IRR_RESP_BUF_GRP (BRIDGE_ISR_BAD_XRESP_PKT |   BRIDGE_ISR_RESP_XTLK_ERR |   BRIDGE_ISR_XREAD_REQ_TIMEOUT)
+#define BRIDGE_IRR_REQ_DSP_GRP (BRIDGE_ISR_UNSUPPORTED_XOP |   BRIDGE_ISR_BAD_XREQ_PKT |   BRIDGE_ISR_REQ_XTLK_ERR |   BRIDGE_ISR_INVLD_ADDR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_IRR_LLP_GRP (BRIDGE_ISR_LLP_REC_SNERR |   BRIDGE_ISR_LLP_REC_CBERR |   BRIDGE_ISR_LLP_RCTY |   BRIDGE_ISR_LLP_TX_RETRY |   BRIDGE_ISR_LLP_TCTY)
+#define BRIDGE_IRR_SSRAM_GRP (BRIDGE_ISR_SSRAM_PERR |   BRIDGE_ISR_PMU_ESIZE_FAULT)
+#define BRIDGE_IRR_PCI_GRP (BRIDGE_ISR_PCI_ABORT |   BRIDGE_ISR_PCI_PARITY |   BRIDGE_ISR_PCI_SERR |   BRIDGE_ISR_PCI_PERR |   BRIDGE_ISR_PCI_MST_TIMEOUT |   BRIDGE_ISR_PCI_RETRY_CNT)
+#define BRIDGE_IRR_GIO_GRP (BRIDGE_ISR_GIO_B_ENBL_ERR |   BRIDGE_ISR_GIO_MST_TIMEOUT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_INT_DEV_SHFT(n) ((n)*3)
+#define BRIDGE_INT_DEV_MASK(n) (0x7 << BRIDGE_INT_DEV_SHFT(n))
+#define BRIDGE_INT_DEV_SET(_dev, _line) (_dev << BRIDGE_INT_DEV_SHFT(_line))
+#define BRIDGE_INT_ADDR_HOST 0x0003FF00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_INT_ADDR_FLD 0x000000FF
+#define BRIDGE_TMO_PCI_RETRY_HLD_MASK 0x1f0000
+#define BRIDGE_TMO_GIO_TIMEOUT_MASK 0x001000
+#define BRIDGE_TMO_PCI_RETRY_CNT_MASK 0x0003ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_TMO_PCI_RETRY_CNT_MAX 0x3ff
+#define BRIDGE_INT_ADDR_NASID_SHFT 8
+#define BRIDGE_INT_ADDR_DEST_IO (1 << 17)
+#define BRIDGE_INT_ADDR_DEST_MEM 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_INT_ADDR_MASK (1 << 17)
+#define BRIDGE_DEV_ERR_LOCK_EN 0x10000000
+#define BRIDGE_DEV_PAGE_CHK_DIS 0x08000000
+#define BRIDGE_DEV_FORCE_PCI_PAR 0x04000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEV_VIRTUAL_EN 0x02000000
+#define BRIDGE_DEV_PMU_WRGA_EN 0x01000000
+#define BRIDGE_DEV_DIR_WRGA_EN 0x00800000
+#define BRIDGE_DEV_DEV_SIZE 0x00400000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEV_RT 0x00200000
+#define BRIDGE_DEV_SWAP_PMU 0x00100000
+#define BRIDGE_DEV_SWAP_DIR 0x00080000
+#define BRIDGE_DEV_PREF 0x00040000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEV_PRECISE 0x00020000
+#define BRIDGE_DEV_COH 0x00010000
+#define BRIDGE_DEV_BARRIER 0x00008000
+#define BRIDGE_DEV_GBR 0x00004000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEV_DEV_SWAP 0x00002000
+#define BRIDGE_DEV_DEV_IO_MEM 0x00001000
+#define BRIDGE_DEV_OFF_MASK 0x00000fff
+#define BRIDGE_DEV_OFF_ADDR_SHFT 20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DEV_PMU_BITS (BRIDGE_DEV_PMU_WRGA_EN |   BRIDGE_DEV_SWAP_PMU)
+#define BRIDGE_DEV_D32_BITS (BRIDGE_DEV_DIR_WRGA_EN |   BRIDGE_DEV_SWAP_DIR |   BRIDGE_DEV_PREF |   BRIDGE_DEV_PRECISE |   BRIDGE_DEV_COH |   BRIDGE_DEV_BARRIER)
+#define BRIDGE_DEV_D64_BITS (BRIDGE_DEV_DIR_WRGA_EN |   BRIDGE_DEV_SWAP_DIR |   BRIDGE_DEV_COH |   BRIDGE_DEV_BARRIER)
+#define BRIDGE_ERRUPPR_DEVMASTER (0x1 << 20)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ERRUPPR_PCIVDEV (0x1 << 19)  
+#define BRIDGE_ERRUPPR_DEVNUM_SHFT (16)
+#define BRIDGE_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_ERRUPPR_DEVNUM_SHFT)
+#define BRIDGE_ERRUPPR_DEVICE(err) (((err) >> BRIDGE_ERRUPPR_DEVNUM_SHFT) & 0x7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_ERRUPPR_ADDRMASK (0xFFFF)
+#define BRIDGE_INTMODE_CLR_PKT_EN(x) (0x1 << (x))
+#define BRIDGE_CREDIT 3
+#define BRIDGE_RRB_EN 0x8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_RRB_DEV 0x7  
+#define BRIDGE_RRB_VDEV 0x4  
+#define BRIDGE_RRB_PDEV 0x3  
+#define BRIDGE_RRB_VALID(r) (0x00010000<<(r))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_RRB_INUSE(r) (0x00000001<<(r))
+#define BRIDGE_RRB_CLEAR(r) (0x00000001<<(r))
+#define XBOX_BRIDGE_WID 8
+#define FLASH_PROM1_BASE 0xE00000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XBOX_RPS_EXISTS 1 << 6  
+#define XBOX_RPS_FAIL 1 << 4  
+#define BRIDGE_PIO32_XTALK_ALIAS_BASE 0x000040000000L
+#define BRIDGE_PIO32_XTALK_ALIAS_LIMIT 0x00007FFFFFFFL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_PIO64_XTALK_ALIAS_BASE 0x000080000000L
+#define BRIDGE_PIO64_XTALK_ALIAS_LIMIT 0x0000BFFFFFFFL
+#define BRIDGE_PCIIO_XTALK_ALIAS_BASE 0x000100000000L
+#define BRIDGE_PCIIO_XTALK_ALIAS_LIMIT 0x0001FFFFFFFFL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_MIN_PIO_ADDR_MEM 0x00000000  
+#define BRIDGE_MAX_PIO_ADDR_MEM 0x3fffffff
+#define BRIDGE_MIN_PIO_ADDR_IO 0x00000000  
+#define BRIDGE_MAX_PIO_ADDR_IO 0xffffffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_PCI_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
+#define BRIDGE_PCI_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
+#define BRIDGE_PCI_MEM64_BASE BRIDGE_PIO64_XTALK_ALIAS_BASE
+#define BRIDGE_PCI_MEM64_LIMIT BRIDGE_PIO64_XTALK_ALIAS_LIMIT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_PCI_IO_BASE BRIDGE_PCIIO_XTALK_ALIAS_BASE
+#define BRIDGE_PCI_IO_LIMIT BRIDGE_PCIIO_XTALK_ALIAS_LIMIT
+#define BRIDGE_LOCAL_BASE 0
+#define BRIDGE_DMA_MAPPED_BASE 0x40000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BRIDGE_DMA_MAPPED_SIZE 0x40000000  
+#define BRIDGE_DMA_DIRECT_BASE 0x80000000
+#define BRIDGE_DMA_DIRECT_SIZE 0x80000000  
+#define PCI32_LOCAL_BASE BRIDGE_LOCAL_BASE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI32_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
+#define PCI32_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
+#define IS_PCI32_LOCAL(x) ((ulong_t)(x) < PCI32_MAPPED_BASE)
+#define IS_PCI32_MAPPED(x) ((ulong_t)(x) < PCI32_DIRECT_BASE &&   (ulong_t)(x) >= PCI32_MAPPED_BASE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IS_PCI32_DIRECT(x) ((ulong_t)(x) >= PCI32_MAPPED_BASE)
+#define IS_PCI64(x) ((ulong_t)(x) >= PCI64_BASE)
+#define BRIDGE_GIO_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
+#define BRIDGE_GIO_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GIO_LOCAL_BASE BRIDGE_LOCAL_BASE
+#define GIO_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
+#define GIO_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
+#define IS_GIO_LOCAL(x) ((ulong_t)(x) < GIO_MAPPED_BASE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IS_GIO_MAPPED(x) ((ulong_t)(x) < GIO_DIRECT_BASE &&   (ulong_t)(x) >= GIO_MAPPED_BASE)
+#define IS_GIO_DIRECT(x) ((ulong_t)(x) >= GIO_MAPPED_BASE)
+#define BRIDGE_DIRECT_32_SEG_SIZE BRIDGE_DMA_DIRECT_SIZE
+#define BRIDGE_DIRECT_32_TO_XTALK(dir_off,adr)   ((dir_off) * BRIDGE_DIRECT_32_SEG_SIZE +   ((adr) & (BRIDGE_DIRECT_32_SEG_SIZE - 1)) + PHYS_RAMBASE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI64_ATTR_TARG_MASK 0xf000000000000000
+#define PCI64_ATTR_TARG_SHFT 60
+#define PCI64_ATTR_PREF 0x0800000000000000
+#define PCI64_ATTR_PREC 0x0400000000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI64_ATTR_VIRTUAL 0x0200000000000000
+#define PCI64_ATTR_BAR 0x0100000000000000
+#define PCI64_ATTR_RMF_MASK 0x00ff000000000000
+#define PCI64_ATTR_RMF_SHFT 48
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+typedef union ate_u {
+ u64 ent;
+ struct ate_s {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 rmf:16;
+ u64 addr:36;
+ u64 targ:4;
+ u64 reserved:3;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 barrier:1;
+ u64 prefetch:1;
+ u64 precise:1;
+ u64 coherent:1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 valid:1;
+ } field;
+} ate_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ATE_V 0x01
+#define ATE_CO 0x02
+#define ATE_PREC 0x04
+#define ATE_PREF 0x08
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ATE_BAR 0x10
+#define ATE_PFNSHIFT 12
+#define ATE_TIDSHIFT 8
+#define ATE_RMFSHIFT 48
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define mkate(xaddr, xid, attr) ((xaddr) & 0x0000fffffffff000ULL) |   ((xid)<<ATE_TIDSHIFT) |   (attr)
+#define BRIDGE_INTERNAL_ATES 128
+struct bridge_controller {
+ struct pci_controller pc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct resource mem;
+ struct resource io;
+ bridge_t *base;
+ nasid_t nasid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int widget_id;
+ unsigned int irq_cpu;
+ dma64_addr_t baddr;
+ unsigned int pci_int[8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define BRIDGE_CONTROLLER(bus)   ((struct bridge_controller *)((bus)->sysdata))
+#endif
diff --git a/libc/kernel/arch-sh/asm/percpu.h b/libc/kernel/arch-mips/asm/percpu.h
similarity index 62%
rename from libc/kernel/arch-sh/asm/percpu.h
rename to libc/kernel/arch-mips/asm/percpu.h
index 1b3a8cb..3af8904 100644
--- a/libc/kernel/arch-sh/asm/percpu.h
+++ b/libc/kernel/arch-mips/asm/percpu.h
@@ -7,11 +7,17 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ARCH_SH_PERCPU
-#define __ARCH_SH_PERCPU
-
+#ifndef __ASM_PERCPU_H
+#define __ASM_PERCPU_H
 #include <asm-generic/percpu.h>
-
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/pgalloc.h b/libc/kernel/arch-mips/asm/pgalloc.h
new file mode 100644
index 0000000..e3ef3b8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/pgalloc.h
@@ -0,0 +1,29 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PGALLOC_H
+#define _ASM_PGALLOC_H
+#include <linux/highmem.h>
+#include <linux/mm.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/sched.h>
+#define pmd_pgtable(pmd) pmd_page(pmd)
+#define __pte_free_tlb(tlb,pte)  do {   pgtable_page_dtor(pte);   tlb_remove_page((tlb), pte);  } while (0)
+#define check_pgt_cache() do { } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/pgtable-bits.h b/libc/kernel/arch-mips/asm/pgtable-bits.h
new file mode 100644
index 0000000..3df2c3d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/pgtable-bits.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PGTABLE_BITS_H
+#define _ASM_PGTABLE_BITS_H
+#define _PAGE_PRESENT (1<<0)  
+#define _PAGE_READ (1<<1)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _PAGE_WRITE (1<<2)  
+#define _PAGE_ACCESSED (1<<3)  
+#define _PAGE_MODIFIED (1<<4)  
+#define _PAGE_FILE (1<<4)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _PAGE_R4KBUG (1<<5)  
+#define _PAGE_GLOBAL (1<<6)
+#define _PAGE_VALID (1<<7)
+#define _PAGE_SILENT_READ (1<<7)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _PAGE_DIRTY (1<<8)  
+#define _PAGE_SILENT_WRITE (1<<8)
+#define _CACHE_SHIFT 9
+#define _CACHE_MASK (7<<9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT)  
+#define _CACHE_CACHABLE_WA (1<<_CACHE_SHIFT)  
+#define _CACHE_UNCACHED (2<<_CACHE_SHIFT)  
+#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _CACHE_CACHABLE_CE (4<<_CACHE_SHIFT)  
+#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT)  
+#define _CACHE_CACHABLE_COHERENT (5<<_CACHE_SHIFT)  
+#define _CACHE_CACHABLE_CUW (6<<_CACHE_SHIFT)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT)  
+#define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
+#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
+#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/pgtable.h b/libc/kernel/arch-mips/asm/pgtable.h
new file mode 100644
index 0000000..ceb4343
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/pgtable.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PGTABLE_H
+#define _ASM_PGTABLE_H
+#include <asm/io.h>
+#include <asm/pgtable-bits.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mm_struct;
+struct vm_area_struct;
+#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
+#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |   _page_cachable_default)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ |   _page_cachable_default)
+#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ |   _page_cachable_default)
+#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE |   _PAGE_GLOBAL | _page_cachable_default)
+#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |   _page_cachable_default)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE |   __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
+#define __P000 __pgprot(0)
+#define __P001 __pgprot(0)
+#define __P010 __pgprot(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __P011 __pgprot(0)
+#define __P100 __pgprot(0)
+#define __P101 __pgprot(0)
+#define __P110 __pgprot(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __P111 __pgprot(0)
+#define __S000 __pgprot(0)
+#define __S001 __pgprot(0)
+#define __S010 __pgprot(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __S011 __pgprot(0)
+#define __S100 __pgprot(0)
+#define __S101 __pgprot(0)
+#define __S110 __pgprot(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __S111 __pgprot(0)
+#define ZERO_PAGE(vaddr)   (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
+#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
+#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pmd_page_vaddr(pmd) pmd_val(pmd)
+#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
+#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
+#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
+#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
+#define PMD_T_LOG2 (__builtin_ffs(sizeof(pmd_t)) - 1)
+#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pgprot_noncached pgprot_noncached
+#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
+#define kern_addr_valid(addr) (1)
+#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)   remap_pfn_range(vma, vaddr, pfn, size, prot)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/pgtable.h>
+#define HAVE_ARCH_UNMAPPED_AREA
+#define pgtable_cache_init() do { } while (0)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/poll.h b/libc/kernel/arch-mips/asm/poll.h
new file mode 100644
index 0000000..8d6a297
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/poll.h
@@ -0,0 +1,25 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_POLL_H
+#define __ASM_POLL_H
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND 0x0100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/poll.h>
+#endif
diff --git a/libc/kernel/arch-mips/asm/posix_types.h b/libc/kernel/arch-mips/asm/posix_types.h
new file mode 100644
index 0000000..99a2896
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/posix_types.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_POSIX_TYPES_H
+#define _ASM_POSIX_TYPES_H
+#include <asm/sgidefs.h>
+typedef unsigned long __kernel_ino_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned int __kernel_mode_t;
+#if _MIPS_SZLONG == 32
+typedef unsigned long __kernel_nlink_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SZLONG == 64
+typedef unsigned int __kernel_nlink_t;
+#endif
+typedef long __kernel_off_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef int __kernel_pid_t;
+typedef int __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SZLONG == 32
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SZLONG == 64
+typedef unsigned long __kernel_size_t;
+typedef long __kernel_ssize_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef long __kernel_ptrdiff_t;
+#endif
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef long __kernel_clock_t;
+typedef int __kernel_timer_t;
+typedef int __kernel_clockid_t;
+typedef long __kernel_daddr_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned int __kernel_gid32_t;
+typedef __kernel_uid_t __kernel_old_uid_t;
+typedef __kernel_gid_t __kernel_old_gid_t;
+typedef unsigned int __kernel_old_dev_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __GNUC__
+typedef long long __kernel_loff_t;
+#endif
+typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SZLONG == 32
+ long val[2];
+#endif
+#if _MIPS_SZLONG == 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int val[2];
+#endif
+} __kernel_fsid_t;
+#if !defined(__GLIBC__) || __GLIBC__ < 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#undef __FD_SET
+#define __FD_SET(fd, fdsetp) (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31)))
+#undef __FD_CLR
+#define __FD_CLR(fd, fdsetp) (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] &= ~(1<<((fd) & 31)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#undef __FD_ISSET
+#define __FD_ISSET(fd, fdsetp) ((((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] & (1<<((fd) & 31))) != 0)
+#undef __FD_ZERO
+#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp))))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/prefetch.h b/libc/kernel/arch-mips/asm/prefetch.h
new file mode 100644
index 0000000..a4386be
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/prefetch.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_PREFETCH_H
+#define __ASM_PREFETCH_H
+#define Pref_Load 0
+#define Pref_Store 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Pref_LoadStreamed 4
+#define Pref_StoreStreamed 5
+#define Pref_LoadRetained 6
+#define Pref_StoreRetained 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Pref_WriteBackInvalidate 25
+#define Pref_PrepareForStore 30
+#ifdef __ASSEMBLY__
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/processor.h b/libc/kernel/arch-mips/asm/processor.h
new file mode 100644
index 0000000..3563121
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/processor.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PROCESSOR_H
+#define _ASM_PROCESSOR_H
+#include <linux/cpumask.h>
+#include <linux/threads.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/cachectl.h>
+#include <asm/cpu.h>
+#include <asm/cpu-info.h>
+#include <asm/mipsregs.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/prefetch.h>
+#include <asm/system.h>
+#define current_text_addr() ({ __label__ _l; _l: &&_l;})
+#define NUM_FPU_REGS 32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef __u64 fpureg_t;
+struct mips_fpu_struct {
+ fpureg_t fpr[NUM_FPU_REGS];
+ unsigned int fcr31;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define NUM_DSP_REGS 6
+typedef __u32 dspreg_t;
+struct mips_dsp_state {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ dspreg_t dspr[NUM_DSP_REGS];
+ unsigned int dspcontrol;
+};
+#define INIT_CPUMASK {   {0,}  }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct {
+ unsigned long seg;
+} mm_segment_t;
+#define ARCH_MIN_TASKALIGN 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mips_abi;
+struct thread_struct {
+ unsigned long reg16;
+ unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long reg29, reg30, reg31;
+ unsigned long cp0_status;
+ struct mips_fpu_struct fpu;
+ struct mips_dsp_state dsp;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cp0_badvaddr;
+ unsigned long cp0_baduaddr;
+ unsigned long error_code;
+ unsigned long trap_no;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long irix_trampoline;
+ unsigned long irix_oldctx;
+ struct mips_abi *abi;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPAFF_INIT
+#define INIT_THREAD {       .reg16 = 0,   .reg17 = 0,   .reg18 = 0,   .reg19 = 0,   .reg20 = 0,   .reg21 = 0,   .reg22 = 0,   .reg23 = 0,   .reg29 = 0,   .reg30 = 0,   .reg31 = 0,       .cp0_status = 0,       .fpu = {   .fpr = {0,},   .fcr31 = 0,   },       FPAFF_INIT       .dsp = {   .dspr = {0, },   .dspcontrol = 0,   },       .cp0_badvaddr = 0,   .cp0_baduaddr = 0,   .error_code = 0,   .trap_no = 0,   .irix_trampoline = 0,   .irix_oldctx = 0,  }
+struct task_struct;
+#define release_thread(thread) do { } while(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define prepare_to_copy(tsk) do { } while (0)
+#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
+#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
+#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
+#define cpu_relax() barrier()
+#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/ptrace.h b/libc/kernel/arch-mips/asm/ptrace.h
new file mode 100644
index 0000000..2b71e70
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/ptrace.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_PTRACE_H
+#define _ASM_PTRACE_H
+#define FPR_BASE 32
+#define PC 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAUSE 65
+#define BADVADDR 66
+#define MMHI 67
+#define MMLO 68
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FPC_CSR 69
+#define FPC_EIR 70
+#define DSP_BASE 71  
+#define DSP_CONTROL 77
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ACX 78
+struct pt_regs {
+ unsigned long regs[32];
+ unsigned long cp0_status;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long hi;
+ unsigned long lo;
+ unsigned long cp0_badvaddr;
+ unsigned long cp0_cause;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cp0_epc;
+} __attribute__ ((aligned (8)));
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_OLDSETOPTIONS 21
+#define PTRACE_GET_THREAD_AREA 25
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_PEEKTEXT_3264 0xc0
+#define PTRACE_PEEKDATA_3264 0xc1
+#define PTRACE_POKETEXT_3264 0xc2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_POKEDATA_3264 0xc3
+#define PTRACE_GET_THREAD_AREA_3264 0xc4
+#endif
diff --git a/libc/kernel/arch-mips/asm/reg.h b/libc/kernel/arch-mips/asm/reg.h
new file mode 100644
index 0000000..9174e27
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/reg.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_MIPS_REG_H
+#define __ASM_MIPS_REG_H
+#ifdef WANT_COMPAT_REG_H
+#define EF_R0 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R1 7
+#define EF_R2 8
+#define EF_R3 9
+#define EF_R4 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R5 11
+#define EF_R6 12
+#define EF_R7 13
+#define EF_R8 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R9 15
+#define EF_R10 16
+#define EF_R11 17
+#define EF_R12 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R13 19
+#define EF_R14 20
+#define EF_R15 21
+#define EF_R16 22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R17 23
+#define EF_R18 24
+#define EF_R19 25
+#define EF_R20 26
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R21 27
+#define EF_R22 28
+#define EF_R23 29
+#define EF_R24 30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R25 31
+#define EF_R26 32
+#define EF_R27 33
+#define EF_R28 34
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_R29 35
+#define EF_R30 36
+#define EF_R31 37
+#define EF_LO 38
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_HI 39
+#define EF_CP0_EPC 40
+#define EF_CP0_BADVADDR 41
+#define EF_CP0_STATUS 42
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_CP0_CAUSE 43
+#define EF_UNUSED0 44
+#define EF_SIZE 180
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/regdef.h b/libc/kernel/arch-mips/asm/regdef.h
new file mode 100644
index 0000000..12d9c42
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/regdef.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_REGDEF_H
+#define _ASM_REGDEF_H
+#include <asm/sgidefs.h>
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define zero $0  
+#define AT $1  
+#define v0 $2  
+#define v1 $3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define a0 $4  
+#define a1 $5
+#define a2 $6
+#define a3 $7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define t0 $8  
+#define t1 $9
+#define t2 $10
+#define t3 $11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define t4 $12
+#define t5 $13
+#define t6 $14
+#define t7 $15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define s0 $16  
+#define s1 $17
+#define s2 $18
+#define s3 $19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define s4 $20
+#define s5 $21
+#define s6 $22
+#define s7 $23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define t8 $24  
+#define t9 $25
+#define jp $25  
+#define k0 $26  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define k1 $27
+#define gp $28  
+#define sp $29  
+#define fp $30  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define s8 $30  
+#define ra $31  
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define zero $0  
+#define AT $at  
+#define v0 $2  
+#define v1 $3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define a0 $4  
+#define a1 $5
+#define a2 $6
+#define a3 $7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define a4 $8  
+#define ta0 $8
+#define a5 $9
+#define ta1 $9
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define a6 $10
+#define ta2 $10
+#define a7 $11
+#define ta3 $11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define t0 $12  
+#define t1 $13
+#define t2 $14
+#define t3 $15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define s0 $16  
+#define s1 $17
+#define s2 $18
+#define s3 $19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define s4 $20
+#define s5 $21
+#define s6 $22
+#define s7 $23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define t8 $24  
+#define t9 $25  
+#define jp $25  
+#define k0 $26  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define k1 $27
+#define gp $28  
+#define sp $29  
+#define fp $30  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define s8 $30  
+#define ra $31  
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/resource.h b/libc/kernel/arch-mips/asm/resource.h
new file mode 100644
index 0000000..e841072
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/resource.h
@@ -0,0 +1,29 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_RESOURCE_H
+#define _ASM_RESOURCE_H
+#define RLIMIT_NOFILE 5  
+#define RLIMIT_AS 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RLIMIT_RSS 7  
+#define RLIMIT_NPROC 8  
+#define RLIMIT_MEMLOCK 9  
+#include <asm-generic/resource.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/scatterlist.h b/libc/kernel/arch-mips/asm/scatterlist.h
new file mode 100644
index 0000000..fd697b0
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/scatterlist.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SCATTERLIST_H
+#define __ASM_SCATTERLIST_H
+#include <asm/types.h>
+struct scatterlist {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long page_link;
+ unsigned int offset;
+ dma_addr_t dma_address;
+ unsigned int length;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define sg_dma_address(sg) ((sg)->dma_address)
+#define sg_dma_len(sg) ((sg)->length)
+#define ISA_DMA_THRESHOLD (0x00ffffffUL)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-sh/asm/sections.h b/libc/kernel/arch-mips/asm/sections.h
similarity index 62%
rename from libc/kernel/arch-sh/asm/sections.h
rename to libc/kernel/arch-mips/asm/sections.h
index 71c66a6..ee51096 100644
--- a/libc/kernel/arch-sh/asm/sections.h
+++ b/libc/kernel/arch-mips/asm/sections.h
@@ -7,12 +7,17 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_SECTIONS_H
-#define __ASM_SH_SECTIONS_H
-
+#ifndef _ASM_SECTIONS_H
+#define _ASM_SECTIONS_H
 #include <asm-generic/sections.h>
-
 #endif
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/atomic-irq.h b/libc/kernel/arch-mips/asm/segment.h
similarity index 65%
copy from libc/kernel/arch-sh/asm/atomic-irq.h
copy to libc/kernel/arch-mips/asm/segment.h
index b8f5eaf..e417612 100644
--- a/libc/kernel/arch-sh/asm/atomic-irq.h
+++ b/libc/kernel/arch-mips/asm/segment.h
@@ -7,9 +7,15 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_IRQ_H
-#define __ASM_SH_ATOMIC_IRQ_H
-
+#ifndef _ASM_SEGMENT_H
+#define _ASM_SEGMENT_H
 #endif
diff --git a/libc/kernel/arch-sh/asm/sembuf.h b/libc/kernel/arch-mips/asm/sembuf.h
similarity index 63%
rename from libc/kernel/arch-sh/asm/sembuf.h
rename to libc/kernel/arch-mips/asm/sembuf.h
index 7c0bdf9..b524f68 100644
--- a/libc/kernel/arch-sh/asm/sembuf.h
+++ b/libc/kernel/arch-mips/asm/sembuf.h
@@ -7,20 +7,25 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_SEMBUF_H
-#define __ASM_SH_SEMBUF_H
-
+#ifndef _ASM_SEMBUF_H
+#define _ASM_SEMBUF_H
 struct semid64_ds {
  struct ipc64_perm sem_perm;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __kernel_time_t sem_otime;
- unsigned long __unused1;
  __kernel_time_t sem_ctime;
- unsigned long __unused2;
  unsigned long sem_nsems;
- unsigned long __unused3;
- unsigned long __unused4;
+ unsigned long __unused1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused2;
 };
-
 #endif
diff --git a/libc/kernel/arch-sh/asm/setup.h b/libc/kernel/arch-mips/asm/setup.h
similarity index 62%
rename from libc/kernel/arch-sh/asm/setup.h
rename to libc/kernel/arch-mips/asm/setup.h
index f97e133..731e993 100644
--- a/libc/kernel/arch-sh/asm/setup.h
+++ b/libc/kernel/arch-mips/asm/setup.h
@@ -7,11 +7,17 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef _SH_SETUP_H
-#define _SH_SETUP_H
-
+#ifndef _MIPS_SETUP_H
+#define _MIPS_SETUP_H
 #define COMMAND_LINE_SIZE 256
-
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/sgi/hpc3.h b/libc/kernel/arch-mips/asm/sgi/hpc3.h
new file mode 100644
index 0000000..d4f4280
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sgi/hpc3.h
@@ -0,0 +1,290 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _SGI_HPC3_H
+#define _SGI_HPC3_H
+#include <linux/types.h>
+#include <asm/page.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct hpc_dma_desc {
+ u32 pbuf;
+ u32 cntinfo;
+#define HPCDMA_EOX 0x80000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPCDMA_EOR 0x80000000  
+#define HPCDMA_EOXP 0x40000000  
+#define HPCDMA_EORP 0x40000000  
+#define HPCDMA_XIE 0x20000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPCDMA_XIU 0x01000000  
+#define HPCDMA_EIPC 0x00ff0000  
+#define HPCDMA_ETXD 0x00008000  
+#define HPCDMA_OWN 0x00004000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPCDMA_BCNT 0x00003fff  
+ u32 pnext;
+};
+struct hpc3_pbus_dmacregs {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 pbdma_bptr;
+ volatile u32 pbdma_dptr;
+ u32 _unused0[0x1000/4 - 2];
+ volatile u32 pbdma_ctrl;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PDMACTRL_INT 0x00000001  
+#define HPC3_PDMACTRL_ISACT 0x00000002  
+#define HPC3_PDMACTRL_SEL 0x00000002  
+#define HPC3_PDMACTRL_RCV 0x00000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PDMACTRL_FLSH 0x00000008  
+#define HPC3_PDMACTRL_ACT 0x00000010  
+#define HPC3_PDMACTRL_LD 0x00000020  
+#define HPC3_PDMACTRL_RT 0x00000040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PDMACTRL_HW 0x0000ff00  
+#define HPC3_PDMACTRL_FB 0x003f0000  
+#define HPC3_PDMACTRL_FE 0x3f000000  
+ u32 _unused1[0x1000/4 - 1];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct hpc3_scsiregs {
+ volatile u32 cbptr;
+ volatile u32 ndptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused0[0x1000/4 - 2];
+ volatile u32 bcd;
+#define HPC3_SBCD_BCNTMSK 0x00003fff  
+#define HPC3_SBCD_XIE 0x00004000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SBCD_EOX 0x00008000  
+ volatile u32 ctrl;
+#define HPC3_SCTRL_IRQ 0x01  
+#define HPC3_SCTRL_ENDIAN 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SCTRL_DIR 0x04  
+#define HPC3_SCTRL_FLUSH 0x08  
+#define HPC3_SCTRL_ACTIVE 0x10  
+#define HPC3_SCTRL_AMASK 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SCTRL_CRESET 0x40  
+#define HPC3_SCTRL_PERR 0x80  
+ volatile u32 gfptr;
+ volatile u32 dfptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 dconfig;
+#define HPC3_SDCFG_HCLK 0x00001  
+#define HPC3_SDCFG_D1 0x00006  
+#define HPC3_SDCFG_D2 0x00038  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SDCFG_D3 0x001c0  
+#define HPC3_SDCFG_HWAT 0x00e00  
+#define HPC3_SDCFG_HW 0x01000  
+#define HPC3_SDCFG_SWAP 0x02000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SDCFG_EPAR 0x04000  
+#define HPC3_SDCFG_POLL 0x08000  
+#define HPC3_SDCFG_ERLY 0x30000  
+ volatile u32 pconfig;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SPCFG_P3 0x0003  
+#define HPC3_SPCFG_P2W 0x001c  
+#define HPC3_SPCFG_P2R 0x01e0  
+#define HPC3_SPCFG_P1 0x0e00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_SPCFG_HW 0x1000  
+#define HPC3_SPCFG_SWAP 0x2000  
+#define HPC3_SPCFG_EPAR 0x4000  
+#define HPC3_SPCFG_FUJI 0x8000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused1[0x1000/4 - 6];
+};
+struct hpc3_ethregs {
+ volatile u32 rx_cbptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 rx_ndptr;
+ u32 _unused0[0x1000/4 - 2];
+ volatile u32 rx_bcd;
+#define HPC3_ERXBCD_BCNTMSK 0x00003fff  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ERXBCD_XIE 0x20000000  
+#define HPC3_ERXBCD_EOX 0x80000000  
+ volatile u32 rx_ctrl;
+#define HPC3_ERXCTRL_STAT50 0x0000003f  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ERXCTRL_STAT6 0x00000040  
+#define HPC3_ERXCTRL_STAT7 0x00000080  
+#define HPC3_ERXCTRL_ENDIAN 0x00000100  
+#define HPC3_ERXCTRL_ACTIVE 0x00000200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ERXCTRL_AMASK 0x00000400  
+#define HPC3_ERXCTRL_RBO 0x00000800  
+ volatile u32 rx_gfptr;
+ volatile u32 rx_dfptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused1;
+ volatile u32 reset;
+#define HPC3_ERST_CRESET 0x1  
+#define HPC3_ERST_CLRIRQ 0x2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ERST_LBACK 0x4  
+ volatile u32 dconfig;
+#define HPC3_EDCFG_D1 0x0000f  
+#define HPC3_EDCFG_D2 0x000f0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_EDCFG_D3 0x00f00  
+#define HPC3_EDCFG_WCTRL 0x01000  
+#define HPC3_EDCFG_FRXDC 0x02000  
+#define HPC3_EDCFG_FEOP 0x04000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_EDCFG_FIRQ 0x08000  
+#define HPC3_EDCFG_PTO 0x30000  
+ volatile u32 pconfig;
+#define HPC3_EPCFG_P1 0x000f  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_EPCFG_P2 0x00f0  
+#define HPC3_EPCFG_P3 0x0f00  
+#define HPC3_EPCFG_TST 0x1000  
+ u32 _unused2[0x1000/4 - 8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 tx_cbptr;
+ volatile u32 tx_ndptr;
+ u32 _unused3[0x1000/4 - 2];
+ volatile u32 tx_bcd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ETXBCD_BCNTMSK 0x00003fff  
+#define HPC3_ETXBCD_ESAMP 0x10000000  
+#define HPC3_ETXBCD_XIE 0x20000000  
+#define HPC3_ETXBCD_EOP 0x40000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ETXBCD_EOX 0x80000000  
+ volatile u32 tx_ctrl;
+#define HPC3_ETXCTRL_STAT30 0x0000000f  
+#define HPC3_ETXCTRL_STAT4 0x00000010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ETXCTRL_STAT75 0x000000e0  
+#define HPC3_ETXCTRL_ENDIAN 0x00000100  
+#define HPC3_ETXCTRL_ACTIVE 0x00000200  
+#define HPC3_ETXCTRL_AMASK 0x00000400  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 tx_gfptr;
+ volatile u32 tx_dfptr;
+ u32 _unused4[0x1000/4 - 4];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct hpc3_regs {
+ struct hpc3_pbus_dmacregs pbdma[8];
+ struct hpc3_scsiregs scsi_chan0, scsi_chan1;
+ struct hpc3_ethregs ethregs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused0[0x18000/4];
+ volatile u32 istat0;
+#define HPC3_ISTAT_PBIMASK 0x0ff  
+#define HPC3_ISTAT_SC0MASK 0x100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_ISTAT_SC1MASK 0x200  
+ volatile u32 gio_misc;
+#define HPC3_GIOMISC_ERTIME 0x1  
+#define HPC3_GIOMISC_DENDIAN 0x2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 eeprom;
+#define HPC3_EEPROM_EPROT 0x01  
+#define HPC3_EEPROM_CSEL 0x02  
+#define HPC3_EEPROM_ECLK 0x04  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_EEPROM_DATO 0x08  
+#define HPC3_EEPROM_DATI 0x10  
+ volatile u32 istat1;
+ volatile u32 bestat;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_BESTAT_BLMASK 0x000ff  
+#define HPC3_BESTAT_CTYPE 0x00100  
+#define HPC3_BESTAT_PIDSHIFT 9
+#define HPC3_BESTAT_PIDMASK 0x3f700  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused1[0x14000/4 - 5];
+ volatile u32 scsi0_ext[256];
+ u32 _unused2[0x7c00/4];
+ volatile u32 scsi1_ext[256];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused3[0x7c00/4];
+ volatile u32 eth_ext[320];
+ u32 _unused4[0x3b00/4];
+ volatile u32 pbus_extregs[16][256];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 pbus_dmacfg[8][128];
+#define HPC3_DMACFG_D3R_MASK 0x00000001
+#define HPC3_DMACFG_D3R_SHIFT 0
+#define HPC3_DMACFG_D4R_MASK 0x0000001e
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_DMACFG_D4R_SHIFT 1
+#define HPC3_DMACFG_D5R_MASK 0x000001e0
+#define HPC3_DMACFG_D5R_SHIFT 5
+#define HPC3_DMACFG_D3W_MASK 0x00000200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_DMACFG_D3W_SHIFT 9
+#define HPC3_DMACFG_D4W_MASK 0x00003c00
+#define HPC3_DMACFG_D4W_SHIFT 10
+#define HPC3_DMACFG_D5W_MASK 0x0003c000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_DMACFG_D5W_SHIFT 14
+#define HPC3_DMACFG_DS16 0x00040000
+#define HPC3_DMACFG_EVENHI 0x00080000
+#define HPC3_DMACFG_RTIME 0x00200000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_DMACFG_BURST_MASK 0x07c00000
+#define HPC3_DMACFG_BURST_SHIFT 22
+#define HPC3_DMACFG_DRQLIVE 0x08000000
+ volatile u32 pbus_piocfg[16][64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PIOCFG_P2R_MASK 0x00001
+#define HPC3_PIOCFG_P2R_SHIFT 0
+#define HPC3_PIOCFG_P3R_MASK 0x0001e
+#define HPC3_PIOCFG_P3R_SHIFT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PIOCFG_P4R_MASK 0x001e0
+#define HPC3_PIOCFG_P4R_SHIFT 5
+#define HPC3_PIOCFG_P2W_MASK 0x00200
+#define HPC3_PIOCFG_P2W_SHIFT 9
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PIOCFG_P3W_MASK 0x03c00
+#define HPC3_PIOCFG_P3W_SHIFT 10
+#define HPC3_PIOCFG_P4W_MASK 0x3c000
+#define HPC3_PIOCFG_P4W_SHIFT 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_PIOCFG_DS16 0x40000
+#define HPC3_PIOCFG_EVENHI 0x80000
+ volatile u32 pbus_promwe;
+#define HPC3_PROM_WENAB 0x1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused5[0x0800/4 - 1];
+ volatile u32 pbus_promswap;
+#define HPC3_PROM_SWAP 0x1  
+ u32 _unused6[0x0800/4 - 1];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 pbus_gout;
+#define HPC3_PROM_STAT 0x1  
+ u32 _unused7[0x1000/4 - 1];
+ volatile u32 rtcregs[14];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused8[50];
+ volatile u32 bbram[8192-50-14];
+};
+#define HPC3_CHIP0_BASE 0x1fb80000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HPC3_CHIP1_BASE 0x1fb00000  
+#endif
diff --git a/libc/kernel/arch-mips/asm/sgi/ioc.h b/libc/kernel/arch-mips/asm/sgi/ioc.h
new file mode 100644
index 0000000..db75b20
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sgi/ioc.h
@@ -0,0 +1,221 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _SGI_IOC_H
+#define _SGI_IOC_H
+#include <linux/types.h>
+#include <asm/sgi/pi1.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sgioc_uart_regs {
+ u8 _ctrl1[3];
+ volatile u8 ctrl1;
+ u8 _data1[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 data1;
+ u8 _ctrl2[3];
+ volatile u8 ctrl2;
+ u8 _data2[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 data2;
+};
+struct sgioc_keyb_regs {
+ u8 _data[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 data;
+ u8 _command[3];
+ volatile u8 command;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sgint_regs {
+ u8 _istat0[3];
+ volatile u8 istat0;
+#define SGINT_ISTAT0_FFULL 0x01
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_ISTAT0_SCSI0 0x02
+#define SGINT_ISTAT0_SCSI1 0x04
+#define SGINT_ISTAT0_ENET 0x08
+#define SGINT_ISTAT0_GFXDMA 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_ISTAT0_PPORT 0x20
+#define SGINT_ISTAT0_HPC2 0x40
+#define SGINT_ISTAT0_LIO2 0x80
+ u8 _imask0[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 imask0;
+ u8 _istat1[3];
+ volatile u8 istat1;
+#define SGINT_ISTAT1_ISDNI 0x01
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_ISTAT1_PWR 0x02
+#define SGINT_ISTAT1_ISDNH 0x04
+#define SGINT_ISTAT1_LIO3 0x08
+#define SGINT_ISTAT1_HPC3 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_ISTAT1_AFAIL 0x20
+#define SGINT_ISTAT1_VIDEO 0x40
+#define SGINT_ISTAT1_GIO2 0x80
+ u8 _imask1[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 imask1;
+ u8 _vmeistat[3];
+ volatile u8 vmeistat;
+ u8 _cmeimask0[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 cmeimask0;
+ u8 _cmeimask1[3];
+ volatile u8 cmeimask1;
+ u8 _cmepol[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 cmepol;
+ u8 _tclear[3];
+ volatile u8 tclear;
+ u8 _errstat[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 errstat;
+ u32 _unused0[2];
+ u8 _tcnt0[3];
+ volatile u8 tcnt0;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 _tcnt1[3];
+ volatile u8 tcnt1;
+ u8 _tcnt2[3];
+ volatile u8 tcnt2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 _tcword[3];
+ volatile u8 tcword;
+#define SGINT_TCWORD_BCD 0x01  
+#define SGINT_TCWORD_MMASK 0x0e  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_TCWORD_MITC 0x00  
+#define SGINT_TCWORD_MOS 0x02  
+#define SGINT_TCWORD_MRGEN 0x04  
+#define SGINT_TCWORD_MSWGEN 0x06  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_TCWORD_MSWST 0x08  
+#define SGINT_TCWORD_MHWST 0x0a  
+#define SGINT_TCWORD_CMASK 0x30  
+#define SGINT_TCWORD_CLAT 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_TCWORD_CLSB 0x10  
+#define SGINT_TCWORD_CMSB 0x20  
+#define SGINT_TCWORD_CALL 0x30  
+#define SGINT_TCWORD_CNT0 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_TCWORD_CNT1 0x40  
+#define SGINT_TCWORD_CNT2 0x80  
+#define SGINT_TCWORD_CRBCK 0xc0  
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGINT_TIMER_CLOCK 1000000
+#define SGINT_TCSAMP_COUNTER ((SGINT_TIMER_CLOCK / HZ) + 255)
+struct sgioc_regs {
+ struct pi1_regs pport;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused0[2];
+ struct sgioc_uart_regs uart;
+ struct sgioc_keyb_regs kbdmouse;
+ u8 _gcsel[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 gcsel;
+ u8 _genctrl[3];
+ volatile u8 genctrl;
+ u8 _panel[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 panel;
+#define SGIOC_PANEL_POWERON 0x01
+#define SGIOC_PANEL_POWERINTR 0x02
+#define SGIOC_PANEL_VOLDNINTR 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_PANEL_VOLDNHOLD 0x20
+#define SGIOC_PANEL_VOLUPINTR 0x40
+#define SGIOC_PANEL_VOLUPHOLD 0x80
+ u32 _unused1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 _sysid[3];
+ volatile u8 sysid;
+#define SGIOC_SYSID_FULLHOUSE 0x01
+#define SGIOC_SYSID_BOARDREV(x) (((x) & 0x1e) >> 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_SYSID_CHIPREV(x) (((x) & 0xe0) >> 5)
+ u32 _unused2;
+ u8 _read[3];
+ volatile u8 read;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 _unused3;
+ u8 _dmasel[3];
+ volatile u8 dmasel;
+#define SGIOC_DMASEL_SCLK10MHZ 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_DMASEL_ISDNB 0x01  
+#define SGIOC_DMASEL_ISDNA 0x02  
+#define SGIOC_DMASEL_PPORT 0x04  
+#define SGIOC_DMASEL_SCLK667MHZ 0x10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_DMASEL_SCLKEXT 0x20  
+ u32 _unused4;
+ u8 _reset[3];
+ volatile u8 reset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_RESET_PPORT 0x01  
+#define SGIOC_RESET_KBDMOUSE 0x02  
+#define SGIOC_RESET_EISA 0x04  
+#define SGIOC_RESET_ISDN 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_RESET_LC0OFF 0x10  
+#define SGIOC_RESET_LC1OFF 0x20  
+ u32 _unused5;
+ u8 _write[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 write;
+#define SGIOC_WRITE_NTHRESH 0x01  
+#define SGIOC_WRITE_TPSPEED 0x02  
+#define SGIOC_WRITE_EPSEL 0x04  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_WRITE_EASEL 0x08  
+#define SGIOC_WRITE_U1AMODE 0x10  
+#define SGIOC_WRITE_U0AMODE 0x20  
+#define SGIOC_WRITE_MLO 0x40  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIOC_WRITE_MHI 0x80  
+ u32 _unused6;
+ struct sgint_regs int3;
+ u32 _unused7[16];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 extio;
+#define EXTIO_S0_IRQ_3 0x8000  
+#define EXTIO_S0_IRQ_2 0x4000  
+#define EXTIO_S0_IRQ_1 0x2000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EXTIO_S0_RETRACE 0x1000
+#define EXTIO_SG_IRQ_3 0x0800  
+#define EXTIO_SG_IRQ_2 0x0400  
+#define EXTIO_SG_IRQ_1 0x0200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EXTIO_SG_RETRACE 0x0100
+#define EXTIO_GIO_33MHZ 0x0080
+#define EXTIO_EISA_BUSERR 0x0040
+#define EXTIO_MC_BUSERR 0x0020
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EXTIO_HPC3_BUSERR 0x0010
+#define EXTIO_S0_STAT_1 0x0008
+#define EXTIO_S0_STAT_0 0x0004
+#define EXTIO_SG_STAT_1 0x0002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EXTIO_SG_STAT_0 0x0001
+};
+#endif
diff --git a/libc/kernel/arch-mips/asm/sgi/pi1.h b/libc/kernel/arch-mips/asm/sgi/pi1.h
new file mode 100644
index 0000000..1aa0438
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sgi/pi1.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _SGI_PI1_H
+#define _SGI_PI1_H
+struct pi1_regs {
+ u8 _data[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 data;
+ u8 _ctrl[3];
+ volatile u8 ctrl;
+#define PI1_CTRL_STROBE_N 0x01
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_CTRL_AFD_N 0x02
+#define PI1_CTRL_INIT_N 0x04
+#define PI1_CTRL_SLIN_N 0x08
+#define PI1_CTRL_IRQ_ENA 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_CTRL_DIR 0x20
+#define PI1_CTRL_SEL 0x40
+ u8 _status[3];
+ volatile u8 status;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_STAT_DEVID 0x03  
+#define PI1_STAT_NOINK 0x04  
+#define PI1_STAT_ERROR 0x08
+#define PI1_STAT_ONLINE 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_STAT_PE 0x20
+#define PI1_STAT_ACK 0x40
+#define PI1_STAT_BUSY 0x80
+ u8 _dmactrl[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 dmactrl;
+#define PI1_DMACTRL_FIFO_EMPTY 0x01  
+#define PI1_DMACTRL_ABORT 0x02  
+#define PI1_DMACTRL_STDMODE 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_DMACTRL_SGIMODE 0x04  
+#define PI1_DMACTRL_RICOHMODE 0x08  
+#define PI1_DMACTRL_HPMODE 0x0c  
+#define PI1_DMACTRL_BLKMODE 0x10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_DMACTRL_FIFO_CLEAR 0x20  
+#define PI1_DMACTRL_READ 0x40  
+#define PI1_DMACTRL_RUN 0x80  
+ u8 _intstat[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 intstat;
+#define PI1_INTSTAT_ACK 0x04
+#define PI1_INTSTAT_FEMPTY 0x08
+#define PI1_INTSTAT_NOINK 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_INTSTAT_ONLINE 0x20
+#define PI1_INTSTAT_ERR 0x40
+#define PI1_INTSTAT_PE 0x80
+ u8 _intmask[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 intmask;
+#define PI1_INTMASK_ACK 0x04
+#define PI1_INTMASK_FIFO_EMPTY 0x08
+#define PI1_INTMASK_NOINK 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_INTMASK_ONLINE 0x20
+#define PI1_INTMASK_ERR 0x40
+#define PI1_INTMASK_PE 0x80
+ u8 _timer1[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 timer1;
+#define PI1_TIME1 0x27
+ u8 _timer2[3];
+ volatile u8 timer2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI1_TIME2 0x13
+ u8 _timer3[3];
+ volatile u8 timer3;
+#define PI1_TIME3 0x10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 _timer4[3];
+ volatile u8 timer4;
+#define PI1_TIME4 0x00
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sgiarcs.h b/libc/kernel/arch-mips/asm/sgiarcs.h
new file mode 100644
index 0000000..5fe0d47
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sgiarcs.h
@@ -0,0 +1,360 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SGIARCS_H
+#define _ASM_SGIARCS_H
+#include <asm/types.h>
+#include <asm/fw/arc/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_ESUCCESS 0x00
+#define PROM_E2BIG 0x01
+#define PROM_EACCESS 0x02
+#define PROM_EAGAIN 0x03
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_EBADF 0x04
+#define PROM_EBUSY 0x05
+#define PROM_EFAULT 0x06
+#define PROM_EINVAL 0x07
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_EIO 0x08
+#define PROM_EISDIR 0x09
+#define PROM_EMFILE 0x0a
+#define PROM_EMLINK 0x0b
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_ENAMETOOLONG 0x0c
+#define PROM_ENODEV 0x0d
+#define PROM_ENOENT 0x0e
+#define PROM_ENOEXEC 0x0f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_ENOMEM 0x10
+#define PROM_ENOSPC 0x11
+#define PROM_ENOTDIR 0x12
+#define PROM_ENOTTY 0x13
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_ENXIO 0x14
+#define PROM_EROFS 0x15
+#define PROM_EADDRNOTAVAIL 0x1f
+#define PROM_ETIMEDOUT 0x20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROM_ECONNABORTED 0x21
+#define PROM_ENOCONNECT 0x22
+enum linux_devclass {
+ system, processor, cache, adapter, controller, peripheral, memory
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum linux_devtypes {
+ Arc, Cpu, Fpu,
+ picache, pdcache,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sicache, sdcache, sccache,
+ memdev, eisa_adapter, tc_adapter, scsi_adapter, dti_adapter,
+ multifunc_adapter, dsk_controller, tp_controller, cdrom_controller,
+ worm_controller, serial_controller, net_controller, disp_controller,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ parallel_controller, ptr_controller, kbd_controller, audio_controller,
+ misc_controller, disk_peripheral, flpy_peripheral, tp_peripheral,
+ modem_peripheral, monitor_peripheral, printer_peripheral,
+ ptr_peripheral, kbd_peripheral, term_peripheral, line_peripheral,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ net_peripheral, misc_peripheral, anon
+};
+enum linux_identifier {
+ bogus, ronly, removable, consin, consout, input, output
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct linux_component {
+ enum linux_devclass class;
+ enum linux_devtypes type;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum linux_identifier iflags;
+ USHORT vers;
+ USHORT rev;
+ ULONG key;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ULONG amask;
+ ULONG cdsize;
+ ULONG ilen;
+ _PULONG iname;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+typedef struct linux_component pcomponent;
+struct linux_sysid {
+ char vend[8], prod[8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum arcs_memtypes {
+ arcs_eblock,
+ arcs_rvpage,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ arcs_fcontig,
+ arcs_free,
+ arcs_bmem,
+ arcs_prog,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ arcs_atmp,
+ arcs_aperm,
+};
+enum arc_memtypes {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ arc_eblock,
+ arc_rvpage,
+ arc_free,
+ arc_bmem,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ arc_prog,
+ arc_atmp,
+ arc_aperm,
+ arc_fcontig,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+union linux_memtypes {
+ enum arcs_memtypes arcs;
+ enum arc_memtypes arc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct linux_mdesc {
+ union linux_memtypes type;
+ ULONG base;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ULONG pages;
+};
+struct linux_tinfo {
+ unsigned short yr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short mnth;
+ unsigned short day;
+ unsigned short hr;
+ unsigned short min;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short sec;
+ unsigned short msec;
+};
+struct linux_vdirent {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ULONG namelen;
+ unsigned char attr;
+ char fname[32];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum linux_omode {
+ rdonly, wronly, rdwr, wronly_creat, rdwr_creat,
+ wronly_ssede, rdwr_ssede, dirent, dirent_creat
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum linux_seekmode {
+ absolute, relative
+};
+enum linux_mountops {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ media_load, media_unload
+};
+struct linux_bigint {
+#ifdef __MIPSEL__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 lo;
+ s32 hi;
+#else
+ s32 hi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 lo;
+#endif
+};
+struct linux_finfo {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct linux_bigint begin;
+ struct linux_bigint end;
+ struct linux_bigint cur;
+ enum linux_devtypes dtype;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long namelen;
+ unsigned char attr;
+ char name[32];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct linux_romvec {
+ LONG load;
+ LONG invoke;
+ LONG exec;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG halt;
+ LONG pdown;
+ LONG restart;
+ LONG reboot;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG imode;
+ LONG _unused1;
+ LONG next_component;
+ LONG child_component;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG parent_component;
+ LONG component_data;
+ LONG child_add;
+ LONG comp_del;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG component_by_path;
+ LONG cfg_save;
+ LONG get_sysid;
+ LONG get_mdesc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG _unused2;
+ LONG get_tinfo;
+ LONG get_rtime;
+ LONG get_vdirent;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG open;
+ LONG close;
+ LONG read;
+ LONG get_rstatus;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG write;
+ LONG seek;
+ LONG mount;
+ LONG get_evar;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG set_evar;
+ LONG get_finfo;
+ LONG set_finfo;
+ LONG cache_flush;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ LONG TestUnicodeCharacter;
+ LONG GetDisplayStatus;
+};
+typedef struct _SYSTEM_PARAMETER_BLOCK {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ULONG magic;
+#define PROMBLOCK_MAGIC 0x53435241
+ ULONG len;
+ USHORT ver;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ USHORT rev;
+ _PLONG rs_block;
+ _PLONG dbg_block;
+ _PLONG gevect;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ _PLONG utlbvect;
+ ULONG rveclen;
+ _PVOID romvec;
+ ULONG pveclen;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ _PVOID pvector;
+ ULONG adap_cnt;
+ ULONG adap_typ0;
+ ULONG adap_vcnt0;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ _PVOID adap_vector;
+ ULONG adap_typ1;
+ ULONG adap_vcnt1;
+ _PVOID adap_vector1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} SYSTEM_PARAMETER_BLOCK, *PSYSTEM_PARAMETER_BLOCK;
+#define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
+#define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
+union linux_cache_key {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct param {
+#ifdef __MIPSEL__
+ unsigned short size;
+ unsigned char lsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char bsize;
+#else
+ unsigned char bsize;
+ unsigned char lsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short size;
+#endif
+ } info;
+ unsigned long allinfo;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct linux_cdata {
+ char *name;
+ int mlen;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum linux_devtypes type;
+};
+#define SGIPROM_STDIN 0
+#define SGIPROM_STDOUT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIPROM_ROFILE 0x01  
+#define SGIPROM_HFILE 0x02  
+#define SGIPROM_SFILE 0x04  
+#define SGIPROM_AFILE 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIPROM_DFILE 0x10  
+#define SGIPROM_DELFILE 0x20  
+struct sgi_partition {
+ unsigned char flag;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIPART_UNUSED 0x00
+#define SGIPART_ACTIVE 0x80
+ unsigned char shead, ssect, scyl;
+ unsigned char systype;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char ehead, esect, ecyl;
+ unsigned char rsect0, rsect1, rsect2, rsect3;
+ unsigned char tsect0, tsect1, tsect2, tsect3;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SGIBBLOCK_MAGIC 0xaa55
+#define SGIBBLOCK_MAXPART 0x0004
+struct sgi_bootblock {
+ unsigned char _unused[446];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct sgi_partition partitions[SGIBBLOCK_MAXPART];
+ unsigned short magic;
+};
+struct sgi_bparm_block {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short bytes_sect;
+ unsigned char sect_clust;
+ unsigned short sect_resv;
+ unsigned char nfats;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short nroot_dirents;
+ unsigned short sect_volume;
+ unsigned char media_type;
+ unsigned short sect_fat;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short sect_track;
+ unsigned short nheads;
+ unsigned short nhsects;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sgi_bsector {
+ unsigned char jmpinfo[3];
+ unsigned char manuf_name[8];
+ struct sgi_bparm_block info;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define SMB_DEBUG_MAGIC 0xfeeddead
+struct linux_smonblock {
+ unsigned long magic;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ void (*handler)(void);
+ unsigned long dtable_base;
+ int (*printf)(const char *fmt, ...);
+ unsigned long btable_base;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long mpflushreqs;
+ unsigned long ntab;
+ unsigned long stab;
+ int smax;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#endif
diff --git a/libc/kernel/arch-mips/asm/sgidefs.h b/libc/kernel/arch-mips/asm/sgidefs.h
new file mode 100644
index 0000000..d63f15e
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sgidefs.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SGIDEFS_H
+#define __ASM_SGIDEFS_H
+#ifndef __linux__
+#error Use a Linux compiler or give up.
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define _MIPS_ISA_MIPS1 1
+#define _MIPS_ISA_MIPS2 2
+#define _MIPS_ISA_MIPS3 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _MIPS_ISA_MIPS4 4
+#define _MIPS_ISA_MIPS5 5
+#define _MIPS_ISA_MIPS32 6
+#define _MIPS_ISA_MIPS64 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _MIPS_SIM_ABI32 1
+#define _MIPS_SIM_NABI32 2
+#define _MIPS_SIM_ABI64 3
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-sh/asm/shmbuf.h b/libc/kernel/arch-mips/asm/shmbuf.h
similarity index 60%
rename from libc/kernel/arch-sh/asm/shmbuf.h
rename to libc/kernel/arch-mips/asm/shmbuf.h
index 7cbe0c7..3f7d0b1 100644
--- a/libc/kernel/arch-sh/asm/shmbuf.h
+++ b/libc/kernel/arch-mips/asm/shmbuf.h
@@ -7,37 +7,44 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_SHMBUF_H
-#define __ASM_SH_SHMBUF_H
-
+#ifndef _ASM_SHMBUF_H
+#define _ASM_SHMBUF_H
 struct shmid64_ds {
  struct ipc64_perm shm_perm;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  size_t shm_segsz;
  __kernel_time_t shm_atime;
- unsigned long __unused1;
  __kernel_time_t shm_dtime;
- unsigned long __unused2;
  __kernel_time_t shm_ctime;
- unsigned long __unused3;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __kernel_pid_t shm_cpid;
  __kernel_pid_t shm_lpid;
  unsigned long shm_nattch;
- unsigned long __unused4;
- unsigned long __unused5;
+ unsigned long __unused1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused2;
 };
-
 struct shminfo64 {
  unsigned long shmmax;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  unsigned long shmmin;
  unsigned long shmmni;
  unsigned long shmseg;
  unsigned long shmall;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  unsigned long __unused1;
  unsigned long __unused2;
  unsigned long __unused3;
  unsigned long __unused4;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
-
 #endif
diff --git a/libc/kernel/arch-mips/asm/shmparam.h b/libc/kernel/arch-mips/asm/shmparam.h
new file mode 100644
index 0000000..d5ec78f
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/shmparam.h
@@ -0,0 +1,24 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SHMPARAM_H
+#define _ASM_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+#define SHMLBA 0x40000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sibyte/bcm1480_int.h b/libc/kernel/arch-mips/asm/sibyte/bcm1480_int.h
new file mode 100644
index 0000000..b14f1ca
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sibyte/bcm1480_int.h
@@ -0,0 +1,295 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _BCM1480_INT_H
+#define _BCM1480_INT_H
+#include "sb1250_defs.h"
+#define K_BCM1480_INT_SOURCES 128
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _BCM1480_INT_HIGH(k) (k)
+#define _BCM1480_INT_LOW(k) ((k)+64)
+#define K_BCM1480_INT_ADDR_TRAP _BCM1480_INT_HIGH(1)
+#define K_BCM1480_INT_GPIO_0 _BCM1480_INT_HIGH(4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_GPIO_1 _BCM1480_INT_HIGH(5)
+#define K_BCM1480_INT_GPIO_2 _BCM1480_INT_HIGH(6)
+#define K_BCM1480_INT_GPIO_3 _BCM1480_INT_HIGH(7)
+#define K_BCM1480_INT_PCI_INTA _BCM1480_INT_HIGH(8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_PCI_INTB _BCM1480_INT_HIGH(9)
+#define K_BCM1480_INT_PCI_INTC _BCM1480_INT_HIGH(10)
+#define K_BCM1480_INT_PCI_INTD _BCM1480_INT_HIGH(11)
+#define K_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_HIGH(12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_HIGH(13)
+#define K_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_HIGH(14)
+#define K_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_HIGH(15)
+#define K_BCM1480_INT_TIMER_0 _BCM1480_INT_HIGH(20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_TIMER_1 _BCM1480_INT_HIGH(21)
+#define K_BCM1480_INT_TIMER_2 _BCM1480_INT_HIGH(22)
+#define K_BCM1480_INT_TIMER_3 _BCM1480_INT_HIGH(23)
+#define K_BCM1480_INT_DM_CH_0 _BCM1480_INT_HIGH(28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_DM_CH_1 _BCM1480_INT_HIGH(29)
+#define K_BCM1480_INT_DM_CH_2 _BCM1480_INT_HIGH(30)
+#define K_BCM1480_INT_DM_CH_3 _BCM1480_INT_HIGH(31)
+#define K_BCM1480_INT_MAC_0 _BCM1480_INT_HIGH(36)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_HIGH(37)
+#define K_BCM1480_INT_MAC_1 _BCM1480_INT_HIGH(38)
+#define K_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_HIGH(39)
+#define K_BCM1480_INT_MAC_2 _BCM1480_INT_HIGH(40)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_HIGH(41)
+#define K_BCM1480_INT_MAC_3 _BCM1480_INT_HIGH(42)
+#define K_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_HIGH(43)
+#define K_BCM1480_INT_PMI_LOW _BCM1480_INT_HIGH(52)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_PMI_HIGH _BCM1480_INT_HIGH(53)
+#define K_BCM1480_INT_PMO_LOW _BCM1480_INT_HIGH(54)
+#define K_BCM1480_INT_PMO_HIGH _BCM1480_INT_HIGH(55)
+#define K_BCM1480_INT_MBOX_0_0 _BCM1480_INT_HIGH(56)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_MBOX_0_1 _BCM1480_INT_HIGH(57)
+#define K_BCM1480_INT_MBOX_0_2 _BCM1480_INT_HIGH(58)
+#define K_BCM1480_INT_MBOX_0_3 _BCM1480_INT_HIGH(59)
+#define K_BCM1480_INT_MBOX_1_0 _BCM1480_INT_HIGH(60)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_MBOX_1_1 _BCM1480_INT_HIGH(61)
+#define K_BCM1480_INT_MBOX_1_2 _BCM1480_INT_HIGH(62)
+#define K_BCM1480_INT_MBOX_1_3 _BCM1480_INT_HIGH(63)
+#define K_BCM1480_INT_BAD_ECC _BCM1480_INT_LOW(1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_COR_ECC _BCM1480_INT_LOW(2)
+#define K_BCM1480_INT_IO_BUS _BCM1480_INT_LOW(3)
+#define K_BCM1480_INT_PERF_CNT _BCM1480_INT_LOW(4)
+#define K_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_LOW(5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_LOW(6)
+#define K_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_LOW(7)
+#define K_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_LOW(8)
+#define K_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_LOW(9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_LOW(10)
+#define K_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_LOW(11)
+#define K_BCM1480_INT_PCI_ERROR _BCM1480_INT_LOW(16)
+#define K_BCM1480_INT_PCI_RESET _BCM1480_INT_LOW(17)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_LOW(18)
+#define K_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_LOW(19)
+#define K_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_LOW(20)
+#define K_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_LOW(21)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_LOW(22)
+#define K_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_LOW(23)
+#define K_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_LOW(24)
+#define K_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_LOW(25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_LDT_SMI _BCM1480_INT_LOW(32)
+#define K_BCM1480_INT_LDT_NMI _BCM1480_INT_LOW(33)
+#define K_BCM1480_INT_LDT_INIT _BCM1480_INT_LOW(34)
+#define K_BCM1480_INT_LDT_STARTUP _BCM1480_INT_LOW(35)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_LDT_EXT _BCM1480_INT_LOW(36)
+#define K_BCM1480_INT_SMB_0 _BCM1480_INT_LOW(40)
+#define K_BCM1480_INT_SMB_1 _BCM1480_INT_LOW(41)
+#define K_BCM1480_INT_PCMCIA _BCM1480_INT_LOW(42)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_UART_0 _BCM1480_INT_LOW(44)
+#define K_BCM1480_INT_UART_1 _BCM1480_INT_LOW(45)
+#define K_BCM1480_INT_UART_2 _BCM1480_INT_LOW(46)
+#define K_BCM1480_INT_UART_3 _BCM1480_INT_LOW(47)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_GPIO_4 _BCM1480_INT_LOW(52)
+#define K_BCM1480_INT_GPIO_5 _BCM1480_INT_LOW(53)
+#define K_BCM1480_INT_GPIO_6 _BCM1480_INT_LOW(54)
+#define K_BCM1480_INT_GPIO_7 _BCM1480_INT_LOW(55)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_GPIO_8 _BCM1480_INT_LOW(56)
+#define K_BCM1480_INT_GPIO_9 _BCM1480_INT_LOW(57)
+#define K_BCM1480_INT_GPIO_10 _BCM1480_INT_LOW(58)
+#define K_BCM1480_INT_GPIO_11 _BCM1480_INT_LOW(59)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_GPIO_12 _BCM1480_INT_LOW(60)
+#define K_BCM1480_INT_GPIO_13 _BCM1480_INT_LOW(61)
+#define K_BCM1480_INT_GPIO_14 _BCM1480_INT_LOW(62)
+#define K_BCM1480_INT_GPIO_15 _BCM1480_INT_LOW(63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _BCM1480_INT_MASK(w, n) _SB_MAKEMASK(w, ((n) & 0x3F))
+#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
+#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
+#define M_BCM1480_INT_CASCADE _BCM1480_INT_MASK1(_BCM1480_INT_HIGH(0))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_ADDR_TRAP _BCM1480_INT_MASK1(K_BCM1480_INT_ADDR_TRAP)
+#define M_BCM1480_INT_GPIO_0 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_0)
+#define M_BCM1480_INT_GPIO_1 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_1)
+#define M_BCM1480_INT_GPIO_2 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_GPIO_3 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_3)
+#define M_BCM1480_INT_PCI_INTA _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTA)
+#define M_BCM1480_INT_PCI_INTB _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTB)
+#define M_BCM1480_INT_PCI_INTC _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTC)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_PCI_INTD _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTD)
+#define M_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP0)
+#define M_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP1)
+#define M_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP3)
+#define M_BCM1480_INT_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_0)
+#define M_BCM1480_INT_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_1)
+#define M_BCM1480_INT_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_3)
+#define M_BCM1480_INT_DM_CH_0 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_0)
+#define M_BCM1480_INT_DM_CH_1 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_1)
+#define M_BCM1480_INT_DM_CH_2 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_DM_CH_3 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_3)
+#define M_BCM1480_INT_MAC_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0)
+#define M_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0_CH1)
+#define M_BCM1480_INT_MAC_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1_CH1)
+#define M_BCM1480_INT_MAC_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2)
+#define M_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2_CH1)
+#define M_BCM1480_INT_MAC_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3_CH1)
+#define M_BCM1480_INT_PMI_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_LOW)
+#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
+#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH)
+#define M_BCM1480_INT_MBOX_ALL _BCM1480_INT_MASK(8, K_BCM1480_INT_MBOX_0_0)
+#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
+#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
+#define M_BCM1480_INT_MBOX_0_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_3)
+#define M_BCM1480_INT_MBOX_1_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_0)
+#define M_BCM1480_INT_MBOX_1_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_MBOX_1_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_2)
+#define M_BCM1480_INT_MBOX_1_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_3)
+#define M_BCM1480_INT_BAD_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_BAD_ECC)
+#define M_BCM1480_INT_COR_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_COR_ECC)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_IO_BUS _BCM1480_INT_MASK1(K_BCM1480_INT_IO_BUS)
+#define M_BCM1480_INT_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_PERF_CNT)
+#define M_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_SW_PERF_CNT)
+#define M_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_TRACE_FREEZE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_SW_TRACE_FREEZE)
+#define M_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_0)
+#define M_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_1)
+#define M_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_3)
+#define M_BCM1480_INT_PCI_ERROR _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_ERROR)
+#define M_BCM1480_INT_PCI_RESET _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_RESET)
+#define M_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_MASK1(K_BCM1480_INT_NODE_CONTROLLER)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_MASK1(K_BCM1480_INT_HOST_BRIDGE)
+#define M_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_FATAL)
+#define M_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_NONFATAL)
+#define M_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_FATAL)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_NONFATAL)
+#define M_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_FATAL)
+#define M_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_NONFATAL)
+#define M_BCM1480_INT_LDT_SMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_SMI)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_LDT_NMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_NMI)
+#define M_BCM1480_INT_LDT_INIT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_INIT)
+#define M_BCM1480_INT_LDT_STARTUP _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_STARTUP)
+#define M_BCM1480_INT_LDT_EXT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_EXT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_SMB_0 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_0)
+#define M_BCM1480_INT_SMB_1 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_1)
+#define M_BCM1480_INT_PCMCIA _BCM1480_INT_MASK1(K_BCM1480_INT_PCMCIA)
+#define M_BCM1480_INT_UART_0 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_UART_1 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_1)
+#define M_BCM1480_INT_UART_2 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_2)
+#define M_BCM1480_INT_UART_3 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_3)
+#define M_BCM1480_INT_GPIO_4 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_GPIO_5 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_5)
+#define M_BCM1480_INT_GPIO_6 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_6)
+#define M_BCM1480_INT_GPIO_7 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_7)
+#define M_BCM1480_INT_GPIO_8 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_GPIO_9 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_9)
+#define M_BCM1480_INT_GPIO_10 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_10)
+#define M_BCM1480_INT_GPIO_11 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_11)
+#define M_BCM1480_INT_GPIO_12 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_GPIO_13 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_13)
+#define M_BCM1480_INT_GPIO_14 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_14)
+#define M_BCM1480_INT_GPIO_15 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_15)
+#define K_BCM1480_INT_MAP_I0 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_MAP_I1 1
+#define K_BCM1480_INT_MAP_I2 2
+#define K_BCM1480_INT_MAP_I3 3
+#define K_BCM1480_INT_MAP_I4 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_MAP_I5 5
+#define K_BCM1480_INT_MAP_NMI 6  
+#define K_BCM1480_INT_MAP_DINT 7  
+#define S_BCM1480_INT_HT_INTMSG 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_INT_HT_INTMSG _SB_MAKEMASK(3, S_BCM1480_INT_HT_INTMSG)
+#define V_BCM1480_INT_HT_INTMSG(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_INTMSG)
+#define G_BCM1480_INT_HT_INTMSG(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_INTMSG, M_BCM1480_INT_HT_INTMSG)
+#define K_BCM1480_INT_HT_INTMSG_FIXED 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_HT_INTMSG_ARBITRATED 1
+#define K_BCM1480_INT_HT_INTMSG_SMI 2
+#define K_BCM1480_INT_HT_INTMSG_NMI 3
+#define K_BCM1480_INT_HT_INTMSG_INIT 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_INT_HT_INTMSG_STARTUP 5
+#define K_BCM1480_INT_HT_INTMSG_EXTINT 6
+#define K_BCM1480_INT_HT_INTMSG_RESERVED 7
+#define M_BCM1480_INT_HT_TRIGGERMODE _SB_MAKEMASK1(3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V_BCM1480_INT_HT_EDGETRIGGER 0
+#define V_BCM1480_INT_HT_LEVELTRIGGER M_BCM1480_INT_HT_TRIGGERMODE
+#define M_BCM1480_INT_HT_DESTMODE _SB_MAKEMASK1(4)
+#define V_BCM1480_INT_HT_PHYSICALDEST 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V_BCM1480_INT_HT_LOGICALDEST M_BCM1480_INT_HT_DESTMODE
+#define S_BCM1480_INT_HT_INTDEST 5
+#define M_BCM1480_INT_HT_INTDEST _SB_MAKEMASK(8, S_BCM1480_INT_HT_INTDEST)
+#define V_BCM1480_INT_HT_INTDEST(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_INTDEST)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_INT_HT_INTDEST(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_INTDEST, M_BCM1480_INT_HT_INTDEST)
+#define S_BCM1480_INT_HT_VECTOR 13
+#define M_BCM1480_INT_HT_VECTOR _SB_MAKEMASK(8, S_BCM1480_INT_HT_VECTOR)
+#define V_BCM1480_INT_HT_VECTOR(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_VECTOR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_INT_HT_VECTOR(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_VECTOR, M_BCM1480_INT_HT_VECTOR)
+#define M_BCM1480_HTVECT_RAISE_INTLDT_HIGH 0x00
+#define M_BCM1480_HTVECT_RAISE_MBOX_0 0x40
+#define M_BCM1480_HTVECT_RAISE_INTLDT_LO 0x80
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_HTVECT_RAISE_MBOX_1 0xC0
+#endif
diff --git a/libc/kernel/arch-mips/asm/sibyte/bcm1480_scd.h b/libc/kernel/arch-mips/asm/sibyte/bcm1480_scd.h
new file mode 100644
index 0000000..250aca8
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sibyte/bcm1480_scd.h
@@ -0,0 +1,209 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _BCM1480_SCD_H
+#define _BCM1480_SCD_H
+#include "sb1250_defs.h"
+#include "sb1250_scd.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_PART_BCM1480 0x1406
+#define K_SYS_PART_BCM1280 0x1206
+#define K_SYS_PART_BCM1455 0x1407
+#define K_SYS_PART_BCM1255 0x1257
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_PART_BCM1158 0x1156
+#define M_BCM1480_SYS_RESERVED0 _SB_MAKEMASK1(0)
+#define M_BCM1480_SYS_HT_MINRSTCNT _SB_MAKEMASK1(1)
+#define M_BCM1480_SYS_RESERVED2 _SB_MAKEMASK1(2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_RESERVED3 _SB_MAKEMASK1(3)
+#define M_BCM1480_SYS_RESERVED4 _SB_MAKEMASK1(4)
+#define M_BCM1480_SYS_IOB_DIV _SB_MAKEMASK1(5)
+#define S_BCM1480_SYS_PLL_DIV _SB_MAKE64(6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_PLL_DIV _SB_MAKEMASK(5, S_BCM1480_SYS_PLL_DIV)
+#define V_BCM1480_SYS_PLL_DIV(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_PLL_DIV)
+#define G_BCM1480_SYS_PLL_DIV(x) _SB_GETVALUE(x, S_BCM1480_SYS_PLL_DIV, M_BCM1480_SYS_PLL_DIV)
+#define S_BCM1480_SYS_SW_DIV _SB_MAKE64(11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_SW_DIV _SB_MAKEMASK(5, S_BCM1480_SYS_SW_DIV)
+#define V_BCM1480_SYS_SW_DIV(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_SW_DIV)
+#define G_BCM1480_SYS_SW_DIV(x) _SB_GETVALUE(x, S_BCM1480_SYS_SW_DIV, M_BCM1480_SYS_SW_DIV)
+#define M_BCM1480_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_DUART1_ENABLE _SB_MAKEMASK1(17)
+#define S_BCM1480_SYS_BOOT_MODE _SB_MAKE64(18)
+#define M_BCM1480_SYS_BOOT_MODE _SB_MAKEMASK(2, S_BCM1480_SYS_BOOT_MODE)
+#define V_BCM1480_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_BOOT_MODE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_SYS_BOOT_MODE(x) _SB_GETVALUE(x, S_BCM1480_SYS_BOOT_MODE, M_BCM1480_SYS_BOOT_MODE)
+#define K_BCM1480_SYS_BOOT_MODE_ROM32 0
+#define K_BCM1480_SYS_BOOT_MODE_ROM8 1
+#define K_BCM1480_SYS_BOOT_MODE_SMBUS_SMALL 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_SYS_BOOT_MODE_SMBUS_BIG 3
+#define M_BCM1480_SYS_BOOT_MODE_SMBUS _SB_MAKEMASK1(19)
+#define M_BCM1480_SYS_PCI_HOST _SB_MAKEMASK1(20)
+#define M_BCM1480_SYS_PCI_ARBITER _SB_MAKEMASK1(21)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
+#define M_BCM1480_SYS_GENCLK_EN _SB_MAKEMASK1(23)
+#define M_BCM1480_SYS_GEN_PARITY_EN _SB_MAKEMASK1(24)
+#define M_BCM1480_SYS_RESERVED25 _SB_MAKEMASK1(25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_BCM1480_SYS_CONFIG 26
+#define M_BCM1480_SYS_CONFIG _SB_MAKEMASK(6, S_BCM1480_SYS_CONFIG)
+#define V_BCM1480_SYS_CONFIG(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_CONFIG)
+#define G_BCM1480_SYS_CONFIG(x) _SB_GETVALUE(x, S_BCM1480_SYS_CONFIG, M_BCM1480_SYS_CONFIG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_RESERVED32 _SB_MAKEMASK(32, 15)
+#define S_BCM1480_SYS_NODEID 47
+#define M_BCM1480_SYS_NODEID _SB_MAKEMASK(4, S_BCM1480_SYS_NODEID)
+#define V_BCM1480_SYS_NODEID(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_NODEID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_SYS_NODEID(x) _SB_GETVALUE(x, S_BCM1480_SYS_NODEID, M_BCM1480_SYS_NODEID)
+#define M_BCM1480_SYS_CCNUMA_EN _SB_MAKEMASK1(51)
+#define M_BCM1480_SYS_CPU_RESET_0 _SB_MAKEMASK1(52)
+#define M_BCM1480_SYS_CPU_RESET_1 _SB_MAKEMASK1(53)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_CPU_RESET_2 _SB_MAKEMASK1(54)
+#define M_BCM1480_SYS_CPU_RESET_3 _SB_MAKEMASK1(55)
+#define S_BCM1480_SYS_DISABLECPU0 56
+#define M_BCM1480_SYS_DISABLECPU0 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_BCM1480_SYS_DISABLECPU1 57
+#define M_BCM1480_SYS_DISABLECPU1 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU1)
+#define S_BCM1480_SYS_DISABLECPU2 58
+#define M_BCM1480_SYS_DISABLECPU2 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_BCM1480_SYS_DISABLECPU3 59
+#define M_BCM1480_SYS_DISABLECPU3 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU3)
+#define M_BCM1480_SYS_SB_SOFTRES _SB_MAKEMASK1(60)
+#define M_BCM1480_SYS_EXT_RESET _SB_MAKEMASK1(61)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SYS_SYSTEM_RESET _SB_MAKEMASK1(62)
+#define M_BCM1480_SYS_SW_FLAG _SB_MAKEMASK1(63)
+#define M_BCM1480_SCD_WDOG_ENABLE _SB_MAKEMASK1(0)
+#define S_BCM1480_SCD_WDOG_RESET_TYPE 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(5, S_BCM1480_SCD_WDOG_RESET_TYPE)
+#define V_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_WDOG_RESET_TYPE)
+#define G_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x, S_BCM1480_SCD_WDOG_RESET_TYPE, M_BCM1480_SCD_WDOG_RESET_TYPE)
+#define K_BCM1480_SCD_WDOG_RESET_FULL 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_SCD_WDOG_RESET_SOFT 1
+#define K_BCM1480_SCD_WDOG_RESET_CPU0 3
+#define K_BCM1480_SCD_WDOG_RESET_CPU1 5
+#define K_BCM1480_SCD_WDOG_RESET_CPU2 9
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_SCD_WDOG_RESET_CPU3 17
+#define K_BCM1480_SCD_WDOG_RESET_ALL_CPUS 31
+#define M_BCM1480_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(8)
+#define S_SPC_CFG_SRC4 32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC4 _SB_MAKEMASK(8, S_SPC_CFG_SRC4)
+#define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC4)
+#define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x, S_SPC_CFG_SRC4, M_SPC_CFG_SRC4)
+#define S_SPC_CFG_SRC5 40
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC5 _SB_MAKEMASK(8, S_SPC_CFG_SRC5)
+#define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC5)
+#define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x, S_SPC_CFG_SRC5, M_SPC_CFG_SRC5)
+#define S_SPC_CFG_SRC6 48
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC6 _SB_MAKEMASK(8, S_SPC_CFG_SRC6)
+#define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC6)
+#define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x, S_SPC_CFG_SRC6, M_SPC_CFG_SRC6)
+#define S_SPC_CFG_SRC7 56
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC7 _SB_MAKEMASK(8, S_SPC_CFG_SRC7)
+#define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC7)
+#define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x, S_SPC_CFG_SRC7, M_SPC_CFG_SRC7)
+#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1)
+#if ???
+#define M_SPC_CFG_CLEAR M_BCM1480_SPC_CFG_CLEAR
+#define M_SPC_CFG_ENABLE M_BCM1480_SPC_CFG_ENABLE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define S_BCM1480_SPC_CNT_COUNT 0
+#define M_BCM1480_SPC_CNT_COUNT _SB_MAKEMASK(40, S_BCM1480_SPC_CNT_COUNT)
+#define V_BCM1480_SPC_CNT_COUNT(x) _SB_MAKEVALUE(x, S_BCM1480_SPC_CNT_COUNT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_SPC_CNT_COUNT(x) _SB_GETVALUE(x, S_BCM1480_SPC_CNT_COUNT, M_BCM1480_SPC_CNT_COUNT)
+#define M_BCM1480_SPC_CNT_OFLOW _SB_MAKEMASK1(40)
+#define M_BCM1480_ATRAP_INDEX _SB_MAKEMASK(4, 0)
+#define M_BCM1480_ATRAP_ADDRESS _SB_MAKEMASK(40, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_BCM1480_ATRAP_CFG_CNT 0
+#define M_BCM1480_ATRAP_CFG_CNT _SB_MAKEMASK(3, S_BCM1480_ATRAP_CFG_CNT)
+#define V_BCM1480_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_CNT)
+#define G_BCM1480_ATRAP_CFG_CNT(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_CNT, M_BCM1480_ATRAP_CFG_CNT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
+#define M_BCM1480_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
+#define M_BCM1480_ATRAP_CFG_INV _SB_MAKEMASK1(5)
+#define M_BCM1480_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
+#define S_BCM1480_ATRAP_CFG_AGENTID 8
+#define M_BCM1480_ATRAP_CFG_AGENTID _SB_MAKEMASK(4, S_BCM1480_ATRAP_CFG_AGENTID)
+#define V_BCM1480_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_AGENTID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_AGENTID, M_BCM1480_ATRAP_CFG_AGENTID)
+#define K_BCM1480_BUS_AGENT_CPU0 0
+#define K_BCM1480_BUS_AGENT_CPU1 1
+#define K_BCM1480_BUS_AGENT_NC 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_BUS_AGENT_IOB 3
+#define K_BCM1480_BUS_AGENT_SCD 4
+#define K_BCM1480_BUS_AGENT_L2C 6
+#define K_BCM1480_BUS_AGENT_MC 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_BUS_AGENT_CPU2 8
+#define K_BCM1480_BUS_AGENT_CPU3 9
+#define K_BCM1480_BUS_AGENT_PM 10
+#define S_BCM1480_ATRAP_CFG_CATTR 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_ATRAP_CFG_CATTR _SB_MAKEMASK(2, S_BCM1480_ATRAP_CFG_CATTR)
+#define V_BCM1480_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_CATTR)
+#define G_BCM1480_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_CATTR, M_BCM1480_ATRAP_CFG_CATTR)
+#define K_BCM1480_ATRAP_CFG_CATTR_IGNORE 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BCM1480_ATRAP_CFG_CATTR_UNC 1
+#define K_BCM1480_ATRAP_CFG_CATTR_NONCOH 2
+#define K_BCM1480_ATRAP_CFG_CATTR_COHERENT 3
+#define M_BCM1480_ATRAP_CFG_CATTRINV _SB_MAKEMASK1(14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_BCM1480_SCD_TRSEQ_TID_MATCH_EN _SB_MAKEMASK1(25)
+#define S_BCM1480_SCD_TRSEQ_SWFUNC 26
+#define M_BCM1480_SCD_TRSEQ_SWFUNC _SB_MAKEMASK(2, S_BCM1480_SCD_TRSEQ_SWFUNC)
+#define V_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_TRSEQ_SWFUNC)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_GETVALUE(x, S_BCM1480_SCD_TRSEQ_SWFUNC, M_BCM1480_SCD_TRSEQ_SWFUNC)
+#define S_BCM1480_SCD_TRACE_CFG_MODE 16
+#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2, S_BCM1480_SCD_TRACE_CFG_MODE)
+#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_TRACE_CFG_MODE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_GETVALUE(x, S_BCM1480_SCD_TRACE_CFG_MODE, M_BCM1480_SCD_TRACE_CFG_MODE)
+#define K_BCM1480_SCD_TRACE_CFG_MODE_BLOCKERS 0
+#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
+#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sibyte/sb1250.h b/libc/kernel/arch-mips/asm/sibyte/sb1250.h
new file mode 100644
index 0000000..d2738dd
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sibyte/sb1250.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SIBYTE_SB1250_H
+#define _ASM_SIBYTE_SB1250_H
+#define SIBYTE_RELEASE 0x02111403
+#define SB1250_NR_IRQS 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BCM1480_NR_IRQS 128
+#define BCM1480_NR_IRQS_HALF 64
+#define SB1250_DUART_MINOR_BASE 64
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/addrspace.h>
+#include <asm/sibyte/sb1250_scd.h>
+#include <asm/sibyte/bcm1480_scd.h>
+#define AT_spin   __asm__ __volatile__ (   ".set noat\n"   "li $at, 0\n"   "1: beqz $at, 1b\n"   ".set at\n"   )
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
+#endif
diff --git a/libc/kernel/arch-mips/asm/sibyte/sb1250_int.h b/libc/kernel/arch-mips/asm/sibyte/sb1250_int.h
new file mode 100644
index 0000000..0b01b75
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sibyte/sb1250_int.h
@@ -0,0 +1,238 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _SB1250_INT_H
+#define _SB1250_INT_H
+#include "sb1250_defs.h"
+#define K_INT_SOURCES 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_WATCHDOG_TIMER_0 0
+#define K_INT_WATCHDOG_TIMER_1 1
+#define K_INT_TIMER_0 2
+#define K_INT_TIMER_1 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_TIMER_2 4
+#define K_INT_TIMER_3 5
+#define K_INT_SMB_0 6
+#define K_INT_SMB_1 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_UART_0 8
+#define K_INT_UART_1 9
+#define K_INT_SER_0 10
+#define K_INT_SER_1 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_PCMCIA 12
+#define K_INT_ADDR_TRAP 13
+#define K_INT_PERF_CNT 14
+#define K_INT_TRACE_FREEZE 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_BAD_ECC 16
+#define K_INT_COR_ECC 17
+#define K_INT_IO_BUS 18
+#define K_INT_MAC_0 19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_MAC_1 20
+#define K_INT_MAC_2 21
+#define K_INT_DM_CH_0 22
+#define K_INT_DM_CH_1 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_DM_CH_2 24
+#define K_INT_DM_CH_3 25
+#define K_INT_MBOX_0 26
+#define K_INT_MBOX_1 27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_MBOX_2 28
+#define K_INT_MBOX_3 29
+#if ??? || ???
+#define K_INT_CYCLE_CP0_INT 30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_CYCLE_CP1_INT 31
+#endif
+#define K_INT_GPIO_0 32
+#define K_INT_GPIO_1 33
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_GPIO_2 34
+#define K_INT_GPIO_3 35
+#define K_INT_GPIO_4 36
+#define K_INT_GPIO_5 37
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_GPIO_6 38
+#define K_INT_GPIO_7 39
+#define K_INT_GPIO_8 40
+#define K_INT_GPIO_9 41
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_GPIO_10 42
+#define K_INT_GPIO_11 43
+#define K_INT_GPIO_12 44
+#define K_INT_GPIO_13 45
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_GPIO_14 46
+#define K_INT_GPIO_15 47
+#define K_INT_LDT_FATAL 48
+#define K_INT_LDT_NONFATAL 49
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_LDT_SMI 50
+#define K_INT_LDT_NMI 51
+#define K_INT_LDT_INIT 52
+#define K_INT_LDT_STARTUP 53
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_LDT_EXT 54
+#define K_INT_PCI_ERROR 55
+#define K_INT_PCI_INTA 56
+#define K_INT_PCI_INTB 57
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_PCI_INTC 58
+#define K_INT_PCI_INTD 59
+#define K_INT_SPARE_2 60
+#if ??? || ???
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_MAC_0_CH1 61
+#define K_INT_MAC_1_CH1 62
+#define K_INT_MAC_2_CH1 63
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_WATCHDOG_TIMER_0 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_0)
+#define M_INT_WATCHDOG_TIMER_1 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_1)
+#define M_INT_TIMER_0 _SB_MAKEMASK1(K_INT_TIMER_0)
+#define M_INT_TIMER_1 _SB_MAKEMASK1(K_INT_TIMER_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_TIMER_2 _SB_MAKEMASK1(K_INT_TIMER_2)
+#define M_INT_TIMER_3 _SB_MAKEMASK1(K_INT_TIMER_3)
+#define M_INT_SMB_0 _SB_MAKEMASK1(K_INT_SMB_0)
+#define M_INT_SMB_1 _SB_MAKEMASK1(K_INT_SMB_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_UART_0 _SB_MAKEMASK1(K_INT_UART_0)
+#define M_INT_UART_1 _SB_MAKEMASK1(K_INT_UART_1)
+#define M_INT_SER_0 _SB_MAKEMASK1(K_INT_SER_0)
+#define M_INT_SER_1 _SB_MAKEMASK1(K_INT_SER_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_PCMCIA _SB_MAKEMASK1(K_INT_PCMCIA)
+#define M_INT_ADDR_TRAP _SB_MAKEMASK1(K_INT_ADDR_TRAP)
+#define M_INT_PERF_CNT _SB_MAKEMASK1(K_INT_PERF_CNT)
+#define M_INT_TRACE_FREEZE _SB_MAKEMASK1(K_INT_TRACE_FREEZE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_BAD_ECC _SB_MAKEMASK1(K_INT_BAD_ECC)
+#define M_INT_COR_ECC _SB_MAKEMASK1(K_INT_COR_ECC)
+#define M_INT_IO_BUS _SB_MAKEMASK1(K_INT_IO_BUS)
+#define M_INT_MAC_0 _SB_MAKEMASK1(K_INT_MAC_0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_MAC_1 _SB_MAKEMASK1(K_INT_MAC_1)
+#define M_INT_MAC_2 _SB_MAKEMASK1(K_INT_MAC_2)
+#define M_INT_DM_CH_0 _SB_MAKEMASK1(K_INT_DM_CH_0)
+#define M_INT_DM_CH_1 _SB_MAKEMASK1(K_INT_DM_CH_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_DM_CH_2 _SB_MAKEMASK1(K_INT_DM_CH_2)
+#define M_INT_DM_CH_3 _SB_MAKEMASK1(K_INT_DM_CH_3)
+#define M_INT_MBOX_0 _SB_MAKEMASK1(K_INT_MBOX_0)
+#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
+#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3)
+#define M_INT_MBOX_ALL _SB_MAKEMASK(4, K_INT_MBOX_0)
+#if ??? || ???
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
+#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
+#endif
+#define M_INT_GPIO_0 _SB_MAKEMASK1(K_INT_GPIO_0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_GPIO_1 _SB_MAKEMASK1(K_INT_GPIO_1)
+#define M_INT_GPIO_2 _SB_MAKEMASK1(K_INT_GPIO_2)
+#define M_INT_GPIO_3 _SB_MAKEMASK1(K_INT_GPIO_3)
+#define M_INT_GPIO_4 _SB_MAKEMASK1(K_INT_GPIO_4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_GPIO_5 _SB_MAKEMASK1(K_INT_GPIO_5)
+#define M_INT_GPIO_6 _SB_MAKEMASK1(K_INT_GPIO_6)
+#define M_INT_GPIO_7 _SB_MAKEMASK1(K_INT_GPIO_7)
+#define M_INT_GPIO_8 _SB_MAKEMASK1(K_INT_GPIO_8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_GPIO_9 _SB_MAKEMASK1(K_INT_GPIO_9)
+#define M_INT_GPIO_10 _SB_MAKEMASK1(K_INT_GPIO_10)
+#define M_INT_GPIO_11 _SB_MAKEMASK1(K_INT_GPIO_11)
+#define M_INT_GPIO_12 _SB_MAKEMASK1(K_INT_GPIO_12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_GPIO_13 _SB_MAKEMASK1(K_INT_GPIO_13)
+#define M_INT_GPIO_14 _SB_MAKEMASK1(K_INT_GPIO_14)
+#define M_INT_GPIO_15 _SB_MAKEMASK1(K_INT_GPIO_15)
+#define M_INT_LDT_FATAL _SB_MAKEMASK1(K_INT_LDT_FATAL)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_LDT_NONFATAL _SB_MAKEMASK1(K_INT_LDT_NONFATAL)
+#define M_INT_LDT_SMI _SB_MAKEMASK1(K_INT_LDT_SMI)
+#define M_INT_LDT_NMI _SB_MAKEMASK1(K_INT_LDT_NMI)
+#define M_INT_LDT_INIT _SB_MAKEMASK1(K_INT_LDT_INIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_LDT_STARTUP _SB_MAKEMASK1(K_INT_LDT_STARTUP)
+#define M_INT_LDT_EXT _SB_MAKEMASK1(K_INT_LDT_EXT)
+#define M_INT_PCI_ERROR _SB_MAKEMASK1(K_INT_PCI_ERROR)
+#define M_INT_PCI_INTA _SB_MAKEMASK1(K_INT_PCI_INTA)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_PCI_INTB _SB_MAKEMASK1(K_INT_PCI_INTB)
+#define M_INT_PCI_INTC _SB_MAKEMASK1(K_INT_PCI_INTC)
+#define M_INT_PCI_INTD _SB_MAKEMASK1(K_INT_PCI_INTD)
+#define M_INT_SPARE_2 _SB_MAKEMASK1(K_INT_SPARE_2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if ??? || ???
+#define M_INT_MAC_0_CH1 _SB_MAKEMASK1(K_INT_MAC_0_CH1)
+#define M_INT_MAC_1_CH1 _SB_MAKEMASK1(K_INT_MAC_1_CH1)
+#define M_INT_MAC_2_CH1 _SB_MAKEMASK1(K_INT_MAC_2_CH1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define K_INT_MAP_I0 0  
+#define K_INT_MAP_I1 1
+#define K_INT_MAP_I2 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_MAP_I3 3
+#define K_INT_MAP_I4 4
+#define K_INT_MAP_I5 5
+#define K_INT_MAP_NMI 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_MAP_DINT 7  
+#define S_INT_LDT_INTMSG 0
+#define M_INT_LDT_INTMSG _SB_MAKEMASK(3, S_INT_LDT_INTMSG)
+#define V_INT_LDT_INTMSG(x) _SB_MAKEVALUE(x, S_INT_LDT_INTMSG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_INT_LDT_INTMSG(x) _SB_GETVALUE(x, S_INT_LDT_INTMSG, M_INT_LDT_INTMSG)
+#define K_INT_LDT_INTMSG_FIXED 0
+#define K_INT_LDT_INTMSG_ARBITRATED 1
+#define K_INT_LDT_INTMSG_SMI 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_LDT_INTMSG_NMI 3
+#define K_INT_LDT_INTMSG_INIT 4
+#define K_INT_LDT_INTMSG_STARTUP 5
+#define K_INT_LDT_INTMSG_EXTINT 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_INT_LDT_INTMSG_RESERVED 7
+#define M_INT_LDT_EDGETRIGGER 0
+#define M_INT_LDT_LEVELTRIGGER _SB_MAKEMASK1(3)
+#define M_INT_LDT_PHYSICALDEST 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_INT_LDT_LOGICALDEST _SB_MAKEMASK1(4)
+#define S_INT_LDT_INTDEST 5
+#define M_INT_LDT_INTDEST _SB_MAKEMASK(10, S_INT_LDT_INTDEST)
+#define V_INT_LDT_INTDEST(x) _SB_MAKEVALUE(x, S_INT_LDT_INTDEST)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_INT_LDT_INTDEST(x) _SB_GETVALUE(x, S_INT_LDT_INTDEST, M_INT_LDT_INTDEST)
+#define S_INT_LDT_VECTOR 13
+#define M_INT_LDT_VECTOR _SB_MAKEMASK(8, S_INT_LDT_VECTOR)
+#define V_INT_LDT_VECTOR(x) _SB_MAKEVALUE(x, S_INT_LDT_VECTOR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_INT_LDT_VECTOR(x) _SB_GETVALUE(x, S_INT_LDT_VECTOR, M_INT_LDT_VECTOR)
+#define M_LDTVECT_RAISEINT 0x00
+#define M_LDTVECT_RAISEMBOX 0x40
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/sibyte/sb1250_scd.h b/libc/kernel/arch-mips/asm/sibyte/sb1250_scd.h
new file mode 100644
index 0000000..55e4a5a
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sibyte/sb1250_scd.h
@@ -0,0 +1,539 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _SB1250_SCD_H
+#define _SB1250_SCD_H
+#include "sb1250_defs.h"
+#define M_SYS_RESERVED _SB_MAKEMASK(8, 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SYS_REVISION _SB_MAKE64(8)
+#define M_SYS_REVISION _SB_MAKEMASK(8, S_SYS_REVISION)
+#define V_SYS_REVISION(x) _SB_MAKEVALUE(x, S_SYS_REVISION)
+#define G_SYS_REVISION(x) _SB_GETVALUE(x, S_SYS_REVISION, M_SYS_REVISION)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM1250_PASS1 0x01
+#define K_SYS_REVISION_BCM1250_PASS2 0x03
+#define K_SYS_REVISION_BCM1250_A1 0x03  
+#define K_SYS_REVISION_BCM1250_A2 0x04  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM1250_A3 0x05  
+#define K_SYS_REVISION_BCM1250_A4 0x06  
+#define K_SYS_REVISION_BCM1250_A6 0x07  
+#define K_SYS_REVISION_BCM1250_A8 0x0b  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM1250_A9 0x08
+#define K_SYS_REVISION_BCM1250_A10 K_SYS_REVISION_BCM1250_A8
+#define K_SYS_REVISION_BCM1250_PASS2_2 0x10
+#define K_SYS_REVISION_BCM1250_B0 K_SYS_REVISION_BCM1250_B1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM1250_B1 0x10
+#define K_SYS_REVISION_BCM1250_B2 0x11
+#define K_SYS_REVISION_BCM1250_C0 0x20
+#define K_SYS_REVISION_BCM1250_C1 0x21
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM1250_C2 0x22
+#define K_SYS_REVISION_BCM1250_C3 0x23
+#if ???
+#define K_SYS_REVISION_PASS1 K_SYS_REVISION_BCM1250_PASS1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_PASS2 K_SYS_REVISION_BCM1250_PASS2
+#define K_SYS_REVISION_PASS2_2 K_SYS_REVISION_BCM1250_PASS2_2
+#define K_SYS_REVISION_PASS3 K_SYS_REVISION_BCM1250_PASS3
+#define K_SYS_REVISION_BCM1250_PASS3 K_SYS_REVISION_BCM1250_C0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define K_SYS_REVISION_BCM112x_A1 0x20
+#define K_SYS_REVISION_BCM112x_A2 0x21
+#define K_SYS_REVISION_BCM112x_A3 0x22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM112x_A4 0x23
+#define K_SYS_REVISION_BCM112x_B0 0x30
+#define K_SYS_REVISION_BCM1480_S0 0x01
+#define K_SYS_REVISION_BCM1480_A1 0x02
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_REVISION_BCM1480_A2 0x03
+#define K_SYS_REVISION_BCM1480_A3 0x04
+#define K_SYS_REVISION_BCM1480_B0 0x11
+#define S_SYS_L2C_SIZE _SB_MAKE64(20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_L2C_SIZE _SB_MAKEMASK(4, S_SYS_L2C_SIZE)
+#define V_SYS_L2C_SIZE(x) _SB_MAKEVALUE(x, S_SYS_L2C_SIZE)
+#define G_SYS_L2C_SIZE(x) _SB_GETVALUE(x, S_SYS_L2C_SIZE, M_SYS_L2C_SIZE)
+#define K_SYS_L2C_SIZE_1MB 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_L2C_SIZE_512KB 5
+#define K_SYS_L2C_SIZE_256KB 2
+#define K_SYS_L2C_SIZE_128KB 1
+#define K_SYS_L2C_SIZE_BCM1250 K_SYS_L2C_SIZE_512KB
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_L2C_SIZE_BCM1125 K_SYS_L2C_SIZE_256KB
+#define K_SYS_L2C_SIZE_BCM1122 K_SYS_L2C_SIZE_128KB
+#define S_SYS_NUM_CPUS _SB_MAKE64(24)
+#define M_SYS_NUM_CPUS _SB_MAKEMASK(4, S_SYS_NUM_CPUS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V_SYS_NUM_CPUS(x) _SB_MAKEVALUE(x, S_SYS_NUM_CPUS)
+#define G_SYS_NUM_CPUS(x) _SB_GETVALUE(x, S_SYS_NUM_CPUS, M_SYS_NUM_CPUS)
+#define S_SYS_PART _SB_MAKE64(16)
+#define M_SYS_PART _SB_MAKEMASK(16, S_SYS_PART)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V_SYS_PART(x) _SB_MAKEVALUE(x, S_SYS_PART)
+#define G_SYS_PART(x) _SB_GETVALUE(x, S_SYS_PART, M_SYS_PART)
+#define K_SYS_PART_SB1250 0x1250
+#define K_SYS_PART_BCM1120 0x1121
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_PART_BCM1125 0x1123
+#define K_SYS_PART_BCM1125H 0x1124
+#define K_SYS_PART_BCM1122 0x1113
+#define S_SYS_SOC_TYPE _SB_MAKE64(16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_SOC_TYPE _SB_MAKEMASK(4, S_SYS_SOC_TYPE)
+#define V_SYS_SOC_TYPE(x) _SB_MAKEVALUE(x, S_SYS_SOC_TYPE)
+#define G_SYS_SOC_TYPE(x) _SB_GETVALUE(x, S_SYS_SOC_TYPE, M_SYS_SOC_TYPE)
+#define K_SYS_SOC_TYPE_BCM1250 0x0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_SOC_TYPE_BCM1120 0x1
+#define K_SYS_SOC_TYPE_BCM1250_ALT 0x2  
+#define K_SYS_SOC_TYPE_BCM1125 0x3
+#define K_SYS_SOC_TYPE_BCM1125H 0x4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_SOC_TYPE_BCM1250_ALT2 0x5  
+#define K_SYS_SOC_TYPE_BCM1x80 0x6
+#define K_SYS_SOC_TYPE_BCM1x55 0x7
+#ifdef __ASSEMBLER__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYS_SOC_TYPE(dest, sysrev)   .set push ;   .set reorder ;   dsrl dest, sysrev, S_SYS_SOC_TYPE ;   andi dest, dest, (M_SYS_SOC_TYPE >> S_SYS_SOC_TYPE);   beq dest, K_SYS_SOC_TYPE_BCM1250_ALT, 991f ;   beq dest, K_SYS_SOC_TYPE_BCM1250_ALT2, 991f ;   b 992f ;  991: li dest, K_SYS_SOC_TYPE_BCM1250 ;  992:   .set pop
+#else
+#define SYS_SOC_TYPE(sysrev)   ((G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT   || G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT2)   ? K_SYS_SOC_TYPE_BCM1250 : G_SYS_SOC_TYPE(sysrev))
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SYS_WID _SB_MAKE64(32)
+#define M_SYS_WID _SB_MAKEMASK(32, S_SYS_WID)
+#define V_SYS_WID(x) _SB_MAKEVALUE(x, S_SYS_WID)
+#define G_SYS_WID(x) _SB_GETVALUE(x, S_SYS_WID, M_SYS_WID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if SIBYTE_HDR_FEATURE_1250_112x
+#define S_SYS_WAFERID1_200 _SB_MAKE64(0)
+#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32, S_SYS_WAFERID1_200)
+#define V_SYS_WAFERID1_200(x) _SB_MAKEVALUE(x, S_SYS_WAFERID1_200)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_WAFERID1_200(x) _SB_GETVALUE(x, S_SYS_WAFERID1_200, M_SYS_WAFERID1_200)
+#define S_SYS_BIN _SB_MAKE64(32)
+#define M_SYS_BIN _SB_MAKEMASK(4, S_SYS_BIN)
+#define V_SYS_BIN(x) _SB_MAKEVALUE(x, S_SYS_BIN)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_BIN(x) _SB_GETVALUE(x, S_SYS_BIN, M_SYS_BIN)
+#define S_SYS_WAFERID2_200 _SB_MAKE64(36)
+#define M_SYS_WAFERID2_200 _SB_MAKEMASK(4, S_SYS_WAFERID2_200)
+#define V_SYS_WAFERID2_200(x) _SB_MAKEVALUE(x, S_SYS_WAFERID2_200)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_WAFERID2_200(x) _SB_GETVALUE(x, S_SYS_WAFERID2_200, M_SYS_WAFERID2_200)
+#define S_SYS_WAFERID_300 _SB_MAKE64(0)
+#define M_SYS_WAFERID_300 _SB_MAKEMASK(40, S_SYS_WAFERID_300)
+#define V_SYS_WAFERID_300(x) _SB_MAKEVALUE(x, S_SYS_WAFERID_300)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_WAFERID_300(x) _SB_GETVALUE(x, S_SYS_WAFERID_300, M_SYS_WAFERID_300)
+#define S_SYS_XPOS _SB_MAKE64(40)
+#define M_SYS_XPOS _SB_MAKEMASK(6, S_SYS_XPOS)
+#define V_SYS_XPOS(x) _SB_MAKEVALUE(x, S_SYS_XPOS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_XPOS(x) _SB_GETVALUE(x, S_SYS_XPOS, M_SYS_XPOS)
+#define S_SYS_YPOS _SB_MAKE64(46)
+#define M_SYS_YPOS _SB_MAKEMASK(6, S_SYS_YPOS)
+#define V_SYS_YPOS(x) _SB_MAKEVALUE(x, S_SYS_YPOS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_YPOS(x) _SB_GETVALUE(x, S_SYS_YPOS, M_SYS_YPOS)
+#endif
+#if SIBYTE_HDR_FEATURE_1250_112x
+#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4)
+#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5)
+#define M_SYS_IOB1_DIV _SB_MAKEMASK1(6)
+#define S_SYS_PLL_DIV _SB_MAKE64(7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_PLL_DIV _SB_MAKEMASK(5, S_SYS_PLL_DIV)
+#define V_SYS_PLL_DIV(x) _SB_MAKEVALUE(x, S_SYS_PLL_DIV)
+#define G_SYS_PLL_DIV(x) _SB_GETVALUE(x, S_SYS_PLL_DIV, M_SYS_PLL_DIV)
+#define M_SYS_SER0_ENABLE _SB_MAKEMASK1(12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_SER0_RSTB_EN _SB_MAKEMASK1(13)
+#define M_SYS_SER1_ENABLE _SB_MAKEMASK1(14)
+#define M_SYS_SER1_RSTB_EN _SB_MAKEMASK1(15)
+#define M_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SYS_BOOT_MODE _SB_MAKE64(17)
+#define M_SYS_BOOT_MODE _SB_MAKEMASK(2, S_SYS_BOOT_MODE)
+#define V_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x, S_SYS_BOOT_MODE)
+#define G_SYS_BOOT_MODE(x) _SB_GETVALUE(x, S_SYS_BOOT_MODE, M_SYS_BOOT_MODE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SYS_BOOT_MODE_ROM32 0
+#define K_SYS_BOOT_MODE_ROM8 1
+#define K_SYS_BOOT_MODE_SMBUS_SMALL 2
+#define K_SYS_BOOT_MODE_SMBUS_BIG 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_PCI_HOST _SB_MAKEMASK1(19)
+#define M_SYS_PCI_ARBITER _SB_MAKEMASK1(20)
+#define M_SYS_SOUTH_ON_LDT _SB_MAKEMASK1(21)
+#define M_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_GENCLK_EN _SB_MAKEMASK1(23)
+#define M_SYS_LDT_TEST_EN _SB_MAKEMASK1(24)
+#define M_SYS_GEN_PARITY_EN _SB_MAKEMASK1(25)
+#define S_SYS_CONFIG 26
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_CONFIG _SB_MAKEMASK(6, S_SYS_CONFIG)
+#define V_SYS_CONFIG(x) _SB_MAKEVALUE(x, S_SYS_CONFIG)
+#define G_SYS_CONFIG(x) _SB_GETVALUE(x, S_SYS_CONFIG, M_SYS_CONFIG)
+#define M_SYS_CLKSTOP _SB_MAKEMASK1(32)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_CLKSTEP _SB_MAKEMASK1(33)
+#define S_SYS_CLKCOUNT 34
+#define M_SYS_CLKCOUNT _SB_MAKEMASK(8, S_SYS_CLKCOUNT)
+#define V_SYS_CLKCOUNT(x) _SB_MAKEVALUE(x, S_SYS_CLKCOUNT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SYS_CLKCOUNT(x) _SB_GETVALUE(x, S_SYS_CLKCOUNT, M_SYS_CLKCOUNT)
+#define M_SYS_PLL_BYPASS _SB_MAKEMASK1(42)
+#define S_SYS_PLL_IREF 43
+#define M_SYS_PLL_IREF _SB_MAKEMASK(2, S_SYS_PLL_IREF)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SYS_PLL_VCO 45
+#define M_SYS_PLL_VCO _SB_MAKEMASK(2, S_SYS_PLL_VCO)
+#define S_SYS_PLL_VREG 47
+#define M_SYS_PLL_VREG _SB_MAKEMASK(2, S_SYS_PLL_VREG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_MEM_RESET _SB_MAKEMASK1(49)
+#define M_SYS_L2C_RESET _SB_MAKEMASK1(50)
+#define M_SYS_IO_RESET_0 _SB_MAKEMASK1(51)
+#define M_SYS_IO_RESET_1 _SB_MAKEMASK1(52)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_SCD_RESET _SB_MAKEMASK1(53)
+#define M_SYS_CPU_RESET_0 _SB_MAKEMASK1(54)
+#define M_SYS_CPU_RESET_1 _SB_MAKEMASK1(55)
+#define M_SYS_UNICPU0 _SB_MAKEMASK1(56)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_UNICPU1 _SB_MAKEMASK1(57)
+#define M_SYS_SB_SOFTRES _SB_MAKEMASK1(58)
+#define M_SYS_EXT_RESET _SB_MAKEMASK1(59)
+#define M_SYS_SYSTEM_RESET _SB_MAKEMASK1(60)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SYS_MISR_MODE _SB_MAKEMASK1(61)
+#define M_SYS_MISR_RESET _SB_MAKEMASK1(62)
+#if ??? || ???
+#define M_SYS_SW_FLAG _SB_MAKEMASK1(63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
+#define S_MBOX_INT_3 0
+#define M_MBOX_INT_3 _SB_MAKEMASK(16, S_MBOX_INT_3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_MBOX_INT_2 16
+#define M_MBOX_INT_2 _SB_MAKEMASK(16, S_MBOX_INT_2)
+#define S_MBOX_INT_1 32
+#define M_MBOX_INT_1 _SB_MAKEMASK(16, S_MBOX_INT_1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_MBOX_INT_0 48
+#define M_MBOX_INT_0 _SB_MAKEMASK(16, S_MBOX_INT_0)
+#define V_SCD_WDOG_FREQ 1000000
+#define S_SCD_WDOG_INIT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_WDOG_INIT _SB_MAKEMASK(23, S_SCD_WDOG_INIT)
+#define S_SCD_WDOG_CNT 0
+#define M_SCD_WDOG_CNT _SB_MAKEMASK(23, S_SCD_WDOG_CNT)
+#define S_SCD_WDOG_ENABLE 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_WDOG_ENABLE _SB_MAKEMASK1(S_SCD_WDOG_ENABLE)
+#define S_SCD_WDOG_RESET_TYPE 2
+#define M_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(3, S_SCD_WDOG_RESET_TYPE)
+#define V_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x, S_SCD_WDOG_RESET_TYPE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x, S_SCD_WDOG_RESET_TYPE, M_SCD_WDOG_RESET_TYPE)
+#define K_SCD_WDOG_RESET_FULL 0  
+#define K_SCD_WDOG_RESET_SOFT 1
+#define K_SCD_WDOG_RESET_CPU0 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_WDOG_RESET_CPU1 5
+#define K_SCD_WDOG_RESET_BOTH_CPUS 7
+#if ???
+#define S_SCD_WDOG_HAS_RESET 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(S_SCD_WDOG_HAS_RESET)
+#endif
+#define V_SCD_TIMER_FREQ 1000000
+#define S_SCD_TIMER_INIT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_TIMER_INIT _SB_MAKEMASK(23, S_SCD_TIMER_INIT)
+#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x, S_SCD_TIMER_INIT)
+#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x, S_SCD_TIMER_INIT, M_SCD_TIMER_INIT)
+#define V_SCD_TIMER_WIDTH 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TIMER_CNT 0
+#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH, S_SCD_TIMER_CNT)
+#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x, S_SCD_TIMER_CNT)
+#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x, S_SCD_TIMER_CNT, M_SCD_TIMER_CNT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_TIMER_ENABLE _SB_MAKEMASK1(0)
+#define M_SCD_TIMER_MODE _SB_MAKEMASK1(1)
+#define M_SCD_TIMER_MODE_CONTINUOUS M_SCD_TIMER_MODE
+#define S_SPC_CFG_SRC0 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8, S_SPC_CFG_SRC0)
+#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC0)
+#define G_SPC_CFG_SRC0(x) _SB_GETVALUE(x, S_SPC_CFG_SRC0, M_SPC_CFG_SRC0)
+#define S_SPC_CFG_SRC1 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC1 _SB_MAKEMASK(8, S_SPC_CFG_SRC1)
+#define V_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC1)
+#define G_SPC_CFG_SRC1(x) _SB_GETVALUE(x, S_SPC_CFG_SRC1, M_SPC_CFG_SRC1)
+#define S_SPC_CFG_SRC2 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC2 _SB_MAKEMASK(8, S_SPC_CFG_SRC2)
+#define V_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC2)
+#define G_SPC_CFG_SRC2(x) _SB_GETVALUE(x, S_SPC_CFG_SRC2, M_SPC_CFG_SRC2)
+#define S_SPC_CFG_SRC3 24
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_SRC3 _SB_MAKEMASK(8, S_SPC_CFG_SRC3)
+#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC3)
+#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x, S_SPC_CFG_SRC3, M_SPC_CFG_SRC3)
+#if SIBYTE_HDR_FEATURE_1250_112x
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
+#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
+#endif
+#define S_SCD_BERR_TID 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_BERR_TID _SB_MAKEMASK(10, S_SCD_BERR_TID)
+#define V_SCD_BERR_TID(x) _SB_MAKEVALUE(x, S_SCD_BERR_TID)
+#define G_SCD_BERR_TID(x) _SB_GETVALUE(x, S_SCD_BERR_TID, M_SCD_BERR_TID)
+#define S_SCD_BERR_RID 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_BERR_RID _SB_MAKEMASK(4, S_SCD_BERR_RID)
+#define V_SCD_BERR_RID(x) _SB_MAKEVALUE(x, S_SCD_BERR_RID)
+#define G_SCD_BERR_RID(x) _SB_GETVALUE(x, S_SCD_BERR_RID, M_SCD_BERR_RID)
+#define S_SCD_BERR_DCODE 22
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_BERR_DCODE _SB_MAKEMASK(3, S_SCD_BERR_DCODE)
+#define V_SCD_BERR_DCODE(x) _SB_MAKEVALUE(x, S_SCD_BERR_DCODE)
+#define G_SCD_BERR_DCODE(x) _SB_GETVALUE(x, S_SCD_BERR_DCODE, M_SCD_BERR_DCODE)
+#define M_SCD_BERR_MULTERRS _SB_MAKEMASK1(30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_L2ECC_CORR_D 0
+#define M_SCD_L2ECC_CORR_D _SB_MAKEMASK(8, S_SCD_L2ECC_CORR_D)
+#define V_SCD_L2ECC_CORR_D(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_CORR_D)
+#define G_SCD_L2ECC_CORR_D(x) _SB_GETVALUE(x, S_SCD_L2ECC_CORR_D, M_SCD_L2ECC_CORR_D)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_L2ECC_BAD_D 8
+#define M_SCD_L2ECC_BAD_D _SB_MAKEMASK(8, S_SCD_L2ECC_BAD_D)
+#define V_SCD_L2ECC_BAD_D(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_BAD_D)
+#define G_SCD_L2ECC_BAD_D(x) _SB_GETVALUE(x, S_SCD_L2ECC_BAD_D, M_SCD_L2ECC_BAD_D)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_L2ECC_CORR_T 16
+#define M_SCD_L2ECC_CORR_T _SB_MAKEMASK(8, S_SCD_L2ECC_CORR_T)
+#define V_SCD_L2ECC_CORR_T(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_CORR_T)
+#define G_SCD_L2ECC_CORR_T(x) _SB_GETVALUE(x, S_SCD_L2ECC_CORR_T, M_SCD_L2ECC_CORR_T)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_L2ECC_BAD_T 24
+#define M_SCD_L2ECC_BAD_T _SB_MAKEMASK(8, S_SCD_L2ECC_BAD_T)
+#define V_SCD_L2ECC_BAD_T(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_BAD_T)
+#define G_SCD_L2ECC_BAD_T(x) _SB_GETVALUE(x, S_SCD_L2ECC_BAD_T, M_SCD_L2ECC_BAD_T)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_MEM_ECC_CORR 0
+#define M_SCD_MEM_ECC_CORR _SB_MAKEMASK(8, S_SCD_MEM_ECC_CORR)
+#define V_SCD_MEM_ECC_CORR(x) _SB_MAKEVALUE(x, S_SCD_MEM_ECC_CORR)
+#define G_SCD_MEM_ECC_CORR(x) _SB_GETVALUE(x, S_SCD_MEM_ECC_CORR, M_SCD_MEM_ECC_CORR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_MEM_ECC_BAD 8
+#define M_SCD_MEM_ECC_BAD _SB_MAKEMASK(8, S_SCD_MEM_ECC_BAD)
+#define V_SCD_MEM_ECC_BAD(x) _SB_MAKEVALUE(x, S_SCD_MEM_ECC_BAD)
+#define G_SCD_MEM_ECC_BAD(x) _SB_GETVALUE(x, S_SCD_MEM_ECC_BAD, M_SCD_MEM_ECC_BAD)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_MEM_BUSERR 16
+#define M_SCD_MEM_BUSERR _SB_MAKEMASK(8, S_SCD_MEM_BUSERR)
+#define V_SCD_MEM_BUSERR(x) _SB_MAKEVALUE(x, S_SCD_MEM_BUSERR)
+#define G_SCD_MEM_BUSERR(x) _SB_GETVALUE(x, S_SCD_MEM_BUSERR, M_SCD_MEM_BUSERR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if SIBYTE_HDR_FEATURE_1250_112x
+#define M_ATRAP_INDEX _SB_MAKEMASK(4, 0)
+#define M_ATRAP_ADDRESS _SB_MAKEMASK(40, 0)
+#define S_ATRAP_CFG_CNT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_ATRAP_CFG_CNT _SB_MAKEMASK(3, S_ATRAP_CFG_CNT)
+#define V_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_CNT)
+#define G_ATRAP_CFG_CNT(x) _SB_GETVALUE(x, S_ATRAP_CFG_CNT, M_ATRAP_CFG_CNT)
+#define M_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
+#define M_ATRAP_CFG_INV _SB_MAKEMASK1(5)
+#define M_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
+#define M_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_ATRAP_CFG_AGENTID 8
+#define M_ATRAP_CFG_AGENTID _SB_MAKEMASK(4, S_ATRAP_CFG_AGENTID)
+#define V_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_AGENTID)
+#define G_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x, S_ATRAP_CFG_AGENTID, M_ATRAP_CFG_AGENTID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BUS_AGENT_CPU0 0
+#define K_BUS_AGENT_CPU1 1
+#define K_BUS_AGENT_IOB0 2
+#define K_BUS_AGENT_IOB1 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_BUS_AGENT_SCD 4
+#define K_BUS_AGENT_L2C 6
+#define K_BUS_AGENT_MC 7
+#define S_ATRAP_CFG_CATTR 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_ATRAP_CFG_CATTR _SB_MAKEMASK(3, S_ATRAP_CFG_CATTR)
+#define V_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_CATTR)
+#define G_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x, S_ATRAP_CFG_CATTR, M_ATRAP_CFG_CATTR)
+#define K_ATRAP_CFG_CATTR_IGNORE 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_ATRAP_CFG_CATTR_UNC 1
+#define K_ATRAP_CFG_CATTR_CACHEABLE 2
+#define K_ATRAP_CFG_CATTR_NONCOH 3
+#define K_ATRAP_CFG_CATTR_COHERENT 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_ATRAP_CFG_CATTR_NOTUNC 5
+#define K_ATRAP_CFG_CATTR_NOTNONCOH 6
+#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
+#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
+#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
+#define M_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
+#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
+#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
+#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if ??? || ??? || ???
+#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8)
+#endif
+#if SIBYTE_HDR_FEATURE_1250_112x
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TRACE_CFG_CUR_ADDR 10
+#else
+#if ???
+#define S_SCD_TRACE_CFG_CUR_ADDR 24
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
+#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8, S_SCD_TRACE_CFG_CUR_ADDR)
+#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x, S_SCD_TRACE_CFG_CUR_ADDR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x, S_SCD_TRACE_CFG_CUR_ADDR, M_SCD_TRACE_CFG_CUR_ADDR)
+#define S_SCD_TREVT_ADDR_MATCH 0
+#define M_SCD_TREVT_ADDR_MATCH _SB_MAKEMASK(4, S_SCD_TREVT_ADDR_MATCH)
+#define V_SCD_TREVT_ADDR_MATCH(x) _SB_MAKEVALUE(x, S_SCD_TREVT_ADDR_MATCH)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SCD_TREVT_ADDR_MATCH(x) _SB_GETVALUE(x, S_SCD_TREVT_ADDR_MATCH, M_SCD_TREVT_ADDR_MATCH)
+#define M_SCD_TREVT_REQID_MATCH _SB_MAKEMASK1(4)
+#define M_SCD_TREVT_DATAID_MATCH _SB_MAKEMASK1(5)
+#define M_SCD_TREVT_RESPID_MATCH _SB_MAKEMASK1(6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_TREVT_INTERRUPT _SB_MAKEMASK1(7)
+#define M_SCD_TREVT_DEBUG_PIN _SB_MAKEMASK1(9)
+#define M_SCD_TREVT_WRITE _SB_MAKEMASK1(10)
+#define M_SCD_TREVT_READ _SB_MAKEMASK1(11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TREVT_REQID 12
+#define M_SCD_TREVT_REQID _SB_MAKEMASK(4, S_SCD_TREVT_REQID)
+#define V_SCD_TREVT_REQID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_REQID)
+#define G_SCD_TREVT_REQID(x) _SB_GETVALUE(x, S_SCD_TREVT_REQID, M_SCD_TREVT_REQID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TREVT_RESPID 16
+#define M_SCD_TREVT_RESPID _SB_MAKEMASK(4, S_SCD_TREVT_RESPID)
+#define V_SCD_TREVT_RESPID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_RESPID)
+#define G_SCD_TREVT_RESPID(x) _SB_GETVALUE(x, S_SCD_TREVT_RESPID, M_SCD_TREVT_RESPID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TREVT_DATAID 20
+#define M_SCD_TREVT_DATAID _SB_MAKEMASK(4, S_SCD_TREVT_DATAID)
+#define V_SCD_TREVT_DATAID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_DATAID)
+#define G_SCD_TREVT_DATAID(x) _SB_GETVALUE(x, S_SCD_TREVT_DATAID, M_SCD_TREVT_DATID)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TREVT_COUNT 24
+#define M_SCD_TREVT_COUNT _SB_MAKEMASK(8, S_SCD_TREVT_COUNT)
+#define V_SCD_TREVT_COUNT(x) _SB_MAKEVALUE(x, S_SCD_TREVT_COUNT)
+#define G_SCD_TREVT_COUNT(x) _SB_GETVALUE(x, S_SCD_TREVT_COUNT, M_SCD_TREVT_COUNT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TRSEQ_EVENT4 0
+#define M_SCD_TRSEQ_EVENT4 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT4)
+#define V_SCD_TRSEQ_EVENT4(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT4)
+#define G_SCD_TRSEQ_EVENT4(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT4, M_SCD_TRSEQ_EVENT4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TRSEQ_EVENT3 4
+#define M_SCD_TRSEQ_EVENT3 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT3)
+#define V_SCD_TRSEQ_EVENT3(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT3)
+#define G_SCD_TRSEQ_EVENT3(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT3, M_SCD_TRSEQ_EVENT3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TRSEQ_EVENT2 8
+#define M_SCD_TRSEQ_EVENT2 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT2)
+#define V_SCD_TRSEQ_EVENT2(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT2)
+#define G_SCD_TRSEQ_EVENT2(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT2, M_SCD_TRSEQ_EVENT2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define S_SCD_TRSEQ_EVENT1 12
+#define M_SCD_TRSEQ_EVENT1 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT1)
+#define V_SCD_TRSEQ_EVENT1(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT1)
+#define G_SCD_TRSEQ_EVENT1(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT1, M_SCD_TRSEQ_EVENT1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_TRSEQ_E0 0
+#define K_SCD_TRSEQ_E1 1
+#define K_SCD_TRSEQ_E2 2
+#define K_SCD_TRSEQ_E3 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_TRSEQ_E0_E1 4
+#define K_SCD_TRSEQ_E1_E2 5
+#define K_SCD_TRSEQ_E2_E3 6
+#define K_SCD_TRSEQ_E0_E1_E2 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_TRSEQ_E0_E1_E2_E3 8
+#define K_SCD_TRSEQ_E0E1 9
+#define K_SCD_TRSEQ_E0E1E2 10
+#define K_SCD_TRSEQ_E0E1E2E3 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_TRSEQ_E0E1_E2 12
+#define K_SCD_TRSEQ_E0E1_E2E3 13
+#define K_SCD_TRSEQ_E0E1_E2_E3 14
+#define K_SCD_TRSEQ_IGNORED 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_TRSEQ_TRIGGER_ALL (V_SCD_TRSEQ_EVENT1(K_SCD_TRSEQ_IGNORED) |   V_SCD_TRSEQ_EVENT2(K_SCD_TRSEQ_IGNORED) |   V_SCD_TRSEQ_EVENT3(K_SCD_TRSEQ_IGNORED) |   V_SCD_TRSEQ_EVENT4(K_SCD_TRSEQ_IGNORED))
+#define S_SCD_TRSEQ_FUNCTION 16
+#define M_SCD_TRSEQ_FUNCTION _SB_MAKEMASK(4, S_SCD_TRSEQ_FUNCTION)
+#define V_SCD_TRSEQ_FUNCTION(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_FUNCTION)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define G_SCD_TRSEQ_FUNCTION(x) _SB_GETVALUE(x, S_SCD_TRSEQ_FUNCTION, M_SCD_TRSEQ_FUNCTION)
+#define K_SCD_TRSEQ_FUNC_NOP 0
+#define K_SCD_TRSEQ_FUNC_START 1
+#define K_SCD_TRSEQ_FUNC_STOP 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K_SCD_TRSEQ_FUNC_FREEZE 3
+#define V_SCD_TRSEQ_FUNC_NOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_NOP)
+#define V_SCD_TRSEQ_FUNC_START V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_START)
+#define V_SCD_TRSEQ_FUNC_STOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_STOP)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V_SCD_TRSEQ_FUNC_FREEZE V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_FREEZE)
+#define M_SCD_TRSEQ_ASAMPLE _SB_MAKEMASK1(18)
+#define M_SCD_TRSEQ_DSAMPLE _SB_MAKEMASK1(19)
+#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21)
+#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22)
+#define M_SCD_TRSEQ_ALLD_A _SB_MAKEMASK1(23)
+#define M_SCD_TRSEQ_ALL_A _SB_MAKEMASK1(24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sigcontext.h b/libc/kernel/arch-mips/asm/sigcontext.h
new file mode 100644
index 0000000..d3742f3
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sigcontext.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SIGCONTEXT_H
+#define _ASM_SIGCONTEXT_H
+#include <asm/sgidefs.h>
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sigcontext {
+ unsigned int sc_regmask;
+ unsigned int sc_status;
+ unsigned long long sc_pc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned int sc_acx;
+ unsigned int sc_fpc_csr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int sc_fpc_eir;
+ unsigned int sc_used_math;
+ unsigned int sc_dsp;
+ unsigned long long sc_mdhi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long long sc_mdlo;
+ unsigned long sc_hi1;
+ unsigned long sc_lo1;
+ unsigned long sc_hi2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long sc_lo2;
+ unsigned long sc_hi3;
+ unsigned long sc_lo3;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
+#include <linux/posix_types.h>
+struct sigcontext {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 sc_regs[32];
+ __u64 sc_fpregs[32];
+ __u64 sc_mdhi;
+ __u64 sc_hi1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 sc_hi2;
+ __u64 sc_hi3;
+ __u64 sc_mdlo;
+ __u64 sc_lo1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 sc_lo2;
+ __u64 sc_lo3;
+ __u64 sc_pc;
+ __u32 sc_fpc_csr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 sc_used_math;
+ __u32 sc_dsp;
+ __u32 sc_reserved;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/siginfo.h b/libc/kernel/arch-mips/asm/siginfo.h
new file mode 100644
index 0000000..f3e508a
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/siginfo.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SIGINFO_H
+#define _ASM_SIGINFO_H
+#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
+#undef __ARCH_SI_TRAPNO  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HAVE_ARCH_SIGINFO_T
+#define HAVE_ARCH_COPY_SIGINFO
+struct siginfo;
+#include <asm-generic/siginfo.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct siginfo {
+ int si_signo;
+ int si_code;
+ int si_errno;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
+ union {
+ int _pad[SI_PAD_SIZE];
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pid_t _pid;
+ __ARCH_SI_UID_T _uid;
+ } _kill;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ timer_t _tid;
+ int _overrun;
+ char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
+ sigval_t _sigval;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int _sys_private;
+ } _timer;
+ struct {
+ pid_t _pid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __ARCH_SI_UID_T _uid;
+ sigval_t _sigval;
+ } _rt;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pid_t _pid;
+ __ARCH_SI_UID_T _uid;
+ int _status;
+ clock_t _utime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ clock_t _stime;
+ } _sigchld;
+ struct {
+ pid_t _pid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ clock_t _utime;
+ int _status;
+ clock_t _stime;
+ } _irix_sigchld;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ void __user *_addr;
+#ifdef __ARCH_SI_TRAPNO
+ int _trapno;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+ } _sigfault;
+ struct {
+ __ARCH_SI_BAND_T _band;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int _fd;
+ } _sigpoll;
+ } _sifields;
+} siginfo_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#undef SI_ASYNCIO
+#undef SI_TIMER
+#undef SI_MESGQ
+#define SI_ASYNCIO -2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SI_TIMER __SI_CODE(__SI_TIMER, -3)  
+#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4)  
+#endif
diff --git a/libc/kernel/arch-mips/asm/signal.h b/libc/kernel/arch-mips/asm/signal.h
new file mode 100644
index 0000000..5f5ac77
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/signal.h
@@ -0,0 +1,124 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SIGNAL_H
+#define _ASM_SIGNAL_H
+#include <linux/types.h>
+#define _NSIG 128
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NSIG 128
+#define _NSIG_BPW (sizeof(unsigned long) * 8)
+#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
+typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long sig[_NSIG_WORDS];
+} sigset_t;
+typedef unsigned long old_sigset_t;
+#define SIGHUP 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGINT 2  
+#define SIGQUIT 3  
+#define SIGILL 4  
+#define SIGTRAP 5  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGIOT 6  
+#define SIGABRT SIGIOT  
+#define SIGEMT 7
+#define SIGFPE 8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGKILL 9  
+#define SIGBUS 10  
+#define SIGSEGV 11  
+#define SIGSYS 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGPIPE 13  
+#define SIGALRM 14  
+#define SIGTERM 15  
+#define SIGUSR1 16  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGUSR2 17  
+#define SIGCHLD 18  
+#define SIGCLD SIGCHLD  
+#define SIGPWR 19  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGWINCH 20  
+#define SIGURG 21  
+#define SIGIO 22  
+#define SIGPOLL SIGIO  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGSTOP 23  
+#define SIGTSTP 24  
+#define SIGCONT 25  
+#define SIGTTIN 26  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGTTOU 27  
+#define SIGVTALRM 28  
+#define SIGPROF 29  
+#define SIGXCPU 30  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIGXFSZ 31  
+#define SIGRTMIN 32
+#define SIGRTMAX _NSIG
+#define SA_ONSTACK 0x08000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SA_RESETHAND 0x80000000
+#define SA_RESTART 0x10000000
+#define SA_SIGINFO 0x00000008
+#define SA_NODEFER 0x40000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SA_NOCLDWAIT 0x00010000
+#define SA_NOCLDSTOP 0x00000001
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SA_RESTORER 0x04000000  
+#define SS_ONSTACK 1
+#define SS_DISABLE 2
+#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  
+/* 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;
+/* 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;
+/* 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;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct k_sigaction {
+ struct sigaction sa;
+};
+typedef struct sigaltstack {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+} stack_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/smp-ops.h b/libc/kernel/arch-mips/asm/smp-ops.h
new file mode 100644
index 0000000..f80f01c
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/smp-ops.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SMP_OPS_H
+#define __ASM_SMP_OPS_H
+struct plat_smp_ops;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/smp.h b/libc/kernel/arch-mips/asm/smp.h
new file mode 100644
index 0000000..87eea88
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/smp.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SMP_H
+#define __ASM_SMP_H
+#include <linux/bitops.h>
+#include <linux/linkage.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/threads.h>
+#include <linux/cpumask.h>
+#include <asm/atomic.h>
+#include <asm/smp-ops.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define raw_smp_processor_id() (current_thread_info()->cpu)
+#define cpu_number_map(cpu) __cpu_number_map[cpu]
+#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
+#define NO_PROC_ID (-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SMP_RESCHEDULE_YOURSELF 0x1  
+#define SMP_CALL_FUNCTION 0x2
+#define cpu_possible_map phys_cpu_present_map
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/sn/addrs.h b/libc/kernel/arch-mips/asm/sn/addrs.h
new file mode 100644
index 0000000..d243613
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/addrs.h
@@ -0,0 +1,188 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_ADDRS_H
+#define _ASM_SN_ADDRS_H
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#include <asm/addrspace.h>
+#include <asm/sn/kldir.h>
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PS_UINT_CAST (unsigned long)
+#define UINT64_CAST (unsigned long)
+#define HUBREG_CAST (volatile hubreg_t *)
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PS_UINT_CAST
+#define UINT64_CAST
+#define HUBREG_CAST
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
+#define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l))
+#define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1)
+#define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CHANGE_ADDR_NASID(_pa, _nasid)   ((UINT64_CAST(_pa) & ~NASID_MASK) |   (UINT64_CAST(_nasid) << NASID_SHFT))
+#define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS)
+#define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n))
+#define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n))
+#define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n))
+#define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n))
+#define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) ))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
+#define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
+#define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
+#define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RAW_NODE_SWIN_BASE(nasid, widget)   (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
+#define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff))
+#define SWIN_SIZE_BITS 24
+#define SWIN_SIZE (UINT64_CAST 1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SWIN_SIZEMASK (SWIN_SIZE - 1)
+#define SWIN_WIDGET_MASK 0xF
+#define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK)
+#define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NODE_SWIN_ADDR(nasid, addr)   (((addr) >= NODE_SWIN_BASE(nasid, 0)) &&   ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)  ))
+#define UALIAS_BASE HSPEC_BASE
+#define UALIAS_SIZE 0x10000000  
+#define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HUB_REGISTER_WIDGET 1
+#define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET)
+#define IALIAS_SIZE 0x800000  
+#define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) &&   ((_a) < (IALIAS_BASE + IALIAS_SIZE)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2))
+#define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n))
+#define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4))
+#define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) +   0x800000 + (_x)))
+#ifndef __ASSEMBLY__
+#define HUB_L(_a) *(_a)
+#define HUB_S(_a, _d) *(_a) = (_d)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r))
+#define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d))
+#define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r)))
+#define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)))
+#define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d))
+#endif
+#define HUB_REG_PTR(_base, _off)   (HUBREG_CAST((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HUB_REG_PTR_L(_base, _off)   HUB_L(HUB_REG_PTR((_base), (_off)))
+#define HUB_REG_PTR_S(_base, _off, _data)   HUB_S(HUB_REG_PTR((_base), (_off)), (_data))
+#define PHYS_RAMBASE 0x0
+#define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EX_HANDLER_OFFSET(slice) ((slice) << 16)
+#define EX_HANDLER_ADDR(nasid, slice)   PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice))
+#define EX_HANDLER_SIZE 0x0400
+#define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EX_FRAME_ADDR(nasid, slice)   PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice))
+#define EX_FRAME_SIZE 0x0c00
+#define ARCS_SPB_OFFSET 0x1000
+#define ARCS_SPB_ADDR(nasid)   PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ARCS_SPB_SIZE 0x0400
+#define KLDIR_OFFSET 0x2000
+#define KLDIR_ADDR(nasid)   TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
+#define KLDIR_SIZE 0x0400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLI_LAUNCH 0  
+#define KLI_KLCONFIG 1
+#define KLI_NMI 2
+#define KLI_GDA 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLI_FREEMEM 4
+#define KLI_SYMMON_STK 5
+#define KLI_PI_ERROR 6
+#define KLI_KERN_VARS 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLI_KERN_XP 8
+#define KLI_KERN_PARTID 9
+#ifndef __ASSEMBLY__
+#define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH)
+#define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI)
+#define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG)
+#define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA)
+#define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK)
+#define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM)
+#define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP)
+#define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID)
+#define LAUNCH_OFFSET(nasid, slice)   (KLD_LAUNCH(nasid)->offset +   KLD_LAUNCH(nasid)->stride * (slice))
+#define LAUNCH_ADDR(nasid, slice)   TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size
+#define NMI_OFFSET(nasid, slice)   (KLD_NMI(nasid)->offset +   KLD_NMI(nasid)->stride * (slice))
+#define NMI_ADDR(nasid, slice)   TO_NODE_UNCAC((nasid), NMI_OFFSET(nasid, slice))
+#define NMI_SIZE(nasid) KLD_NMI(nasid)->size
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset
+#define KLCONFIG_ADDR(nasid)   TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid))
+#define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size
+#define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GDA_SIZE(nasid) KLD_GDA(nasid)->size
+#define SYMMON_STK_OFFSET(nasid, slice)   (KLD_SYMMON_STK(nasid)->offset +   KLD_SYMMON_STK(nasid)->stride * (slice))
+#define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride
+#define SYMMON_STK_ADDR(nasid, slice)   TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride
+#define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
+#define UNIX_DEBUG_LOADADDR 0x300000
+#define SYMMON_LOADADDR(nasid)   TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset
+#define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid)
+#define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size
+#define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERROR_ADDR(nasid)   TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid))
+#define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size
+#define NODE_OFFSET_TO_K0(_nasid, _off)   PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
+#define NODE_OFFSET_TO_K1(_nasid, _off)   TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define K0_TO_NODE_OFFSET(_k0addr)   ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK)
+#define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
+#define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
+#define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size
+#define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET)
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/sn/arch.h b/libc/kernel/arch-mips/asm/sn/arch.h
new file mode 100644
index 0000000..f6ceb20
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/arch.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_ARCH_H
+#define _ASM_SN_ARCH_H
+#include <linux/types.h>
+#include <asm/sn/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef u64 hubreg_t;
+#define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid)
+#define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
+#define makespnum(_nasid, _slice)   (((_nasid) << CPUS_PER_NODE_SHFT) | (_slice))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INVALID_NASID (nasid_t)-1
+#define INVALID_CNODEID (cnodeid_t)-1
+#define INVALID_PNODEID (pnodeid_t)-1
+#define INVALID_MODULE (moduleid_t)-1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INVALID_PARTID (partid_t)-1
+#define NASID_TO_REGION(nnode)   ((nnode) >>   (is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
+#define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
+#define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/hub.h b/libc/kernel/arch-mips/asm/sn/hub.h
new file mode 100644
index 0000000..cbb1dbd
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/hub.h
@@ -0,0 +1,29 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SN_HUB_H
+#define __ASM_SN_HUB_H
+#include <linux/types.h>
+#include <linux/cpumask.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/sn/types.h>
+#include <asm/sn/io.h>
+#include <asm/sn/klkernvars.h>
+#include <asm/xtalk/xtalk.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/io.h b/libc/kernel/arch-mips/asm/sn/io.h
new file mode 100644
index 0000000..2b8a101
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/io.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_IO_H
+#define _ASM_SN_IO_H
+#define IIO_ITTE_BASE 0x400160  
+#define IIO_ITTE(bigwin) (IIO_ITTE_BASE + 8*(bigwin))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ITTE_OFFSET_BITS 5  
+#define IIO_ITTE_OFFSET_MASK ((1<<IIO_ITTE_OFFSET_BITS)-1)
+#define IIO_ITTE_OFFSET_SHIFT 0
+#define IIO_ITTE_WIDGET_BITS 4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ITTE_WIDGET_MASK ((1<<IIO_ITTE_WIDGET_BITS)-1)
+#define IIO_ITTE_WIDGET_SHIFT 8
+#define IIO_ITTE_IOSP 1  
+#define IIO_ITTE_IOSP_MASK 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ITTE_IOSP_SHIFT 12
+#define HUB_PIO_MAP_TO_MEM 0
+#define HUB_PIO_MAP_TO_IO 1
+#define IIO_ITTE_INVALID_WIDGET 3  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ITTE_PUT(nasid, bigwin, io_or_mem, widget, addr)   REMOTE_HUB_S((nasid), IIO_ITTE(bigwin),   (((((addr) >> BWIN_SIZE_BITS) &   IIO_ITTE_OFFSET_MASK) << IIO_ITTE_OFFSET_SHIFT) |   (io_or_mem << IIO_ITTE_IOSP_SHIFT) |   (((widget) & IIO_ITTE_WIDGET_MASK) << IIO_ITTE_WIDGET_SHIFT)))
+#define IIO_ITTE_DISABLE(nasid, bigwin)   IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM,   (bigwin), IIO_ITTE_INVALID_WIDGET, 0)
+#define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_ADDR((nasid), IIO_ITTE(bigwin))
+#define IIO_IOPRB(_x) (IIO_IOPRB_0 + ( ( (_x) < HUB_WIDGET_ID_MIN ?   (_x) :   (_x) - (HUB_WIDGET_ID_MIN-1)) << 3) )
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/ioc3.h b/libc/kernel/arch-mips/asm/sn/ioc3.h
new file mode 100644
index 0000000..9771304
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/ioc3.h
@@ -0,0 +1,645 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _IOC3_H
+#define _IOC3_H
+#include <linux/types.h>
+typedef volatile struct ioc3_uartregs {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ volatile u8 rbr;
+ volatile u8 thr;
+ volatile u8 dll;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } u1;
+ union {
+ volatile u8 ier;
+ volatile u8 dlm;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } u2;
+ union {
+ volatile u8 iir;
+ volatile u8 fcr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } u3;
+ volatile u8 iu_lcr;
+ volatile u8 iu_mcr;
+ volatile u8 iu_lsr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 iu_msr;
+ volatile u8 iu_scr;
+} ioc3_uregs_t;
+#define iu_rbr u1.rbr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iu_thr u1.thr
+#define iu_dll u1.dll
+#define iu_ier u2.ier
+#define iu_dlm u2.dlm
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iu_iir u3.iir
+#define iu_fcr u3.fcr
+struct ioc3_sioregs {
+ volatile u8 fill[0x141];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 uartc;
+ volatile u8 kbdcg;
+ volatile u8 fill0[0x150 - 0x142 - 1];
+ volatile u8 pp_data;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 pp_dsr;
+ volatile u8 pp_dcr;
+ volatile u8 fill1[0x158 - 0x152 - 1];
+ volatile u8 pp_fifa;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 pp_cfgb;
+ volatile u8 pp_ecr;
+ volatile u8 fill2[0x168 - 0x15a - 1];
+ volatile u8 rtcad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u8 rtcdat;
+ volatile u8 fill3[0x170 - 0x169 - 1];
+ struct ioc3_uartregs uartb;
+ struct ioc3_uartregs uarta;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct ioc3 {
+ volatile u32 pad0[7];
+ volatile u32 sio_ir;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 sio_ies;
+ volatile u32 sio_iec;
+ volatile u32 sio_cr;
+ volatile u32 int_out;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 mcr;
+ volatile u32 gpcr_s;
+ volatile u32 gpcr_c;
+ volatile u32 gpdr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 gppr_0;
+ volatile u32 gppr_1;
+ volatile u32 gppr_2;
+ volatile u32 gppr_3;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 gppr_4;
+ volatile u32 gppr_5;
+ volatile u32 gppr_6;
+ volatile u32 gppr_7;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 gppr_8;
+ volatile u32 gppr_9;
+ volatile u32 gppr_10;
+ volatile u32 gppr_11;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 gppr_12;
+ volatile u32 gppr_13;
+ volatile u32 gppr_14;
+ volatile u32 gppr_15;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 ppbr_h_a;
+ volatile u32 ppbr_l_a;
+ volatile u32 ppcr_a;
+ volatile u32 ppcr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 ppbr_h_b;
+ volatile u32 ppbr_l_b;
+ volatile u32 ppcr_b;
+ volatile u32 km_csr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 k_rd;
+ volatile u32 m_rd;
+ volatile u32 k_wd;
+ volatile u32 m_wd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 sbbr_h;
+ volatile u32 sbbr_l;
+ volatile u32 sscr_a;
+ volatile u32 stpir_a;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 stcir_a;
+ volatile u32 srpir_a;
+ volatile u32 srcir_a;
+ volatile u32 srtr_a;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 shadow_a;
+ volatile u32 sscr_b;
+ volatile u32 stpir_b;
+ volatile u32 stcir_b;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 srpir_b;
+ volatile u32 srcir_b;
+ volatile u32 srtr_b;
+ volatile u32 shadow_b;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 emcr;
+ volatile u32 eisr;
+ volatile u32 eier;
+ volatile u32 ercsr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 erbr_h;
+ volatile u32 erbr_l;
+ volatile u32 erbar;
+ volatile u32 ercir;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 erpir;
+ volatile u32 ertr;
+ volatile u32 etcsr;
+ volatile u32 ersr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 etcdc;
+ volatile u32 ebir;
+ volatile u32 etbr_h;
+ volatile u32 etbr_l;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 etcir;
+ volatile u32 etpir;
+ volatile u32 emar_h;
+ volatile u32 emar_l;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 ehar_h;
+ volatile u32 ehar_l;
+ volatile u32 micr;
+ volatile u32 midr_r;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 midr_w;
+ volatile u32 pad1[(0x20000 - 0x00154) / 4];
+ struct ioc3_sioregs sregs;
+ volatile u32 pad2[(0x40000 - 0x20180) / 4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ volatile u32 ssram[(0x80000 - 0x40000) / 4];
+};
+struct ioc3_erxbuf {
+ u32 w0;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 err;
+};
+#define ERXBUF_IPCKSUM_MASK 0x0000ffff
+#define ERXBUF_BYTECNT_MASK 0x07ff0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_BYTECNT_SHIFT 16
+#define ERXBUF_V 0x80000000
+#define ERXBUF_CRCERR 0x00000001  
+#define ERXBUF_FRAMERR 0x00000002  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_CODERR 0x00000004  
+#define ERXBUF_INVPREAMB 0x00000008  
+#define ERXBUF_LOLEN 0x00007000  
+#define ERXBUF_HILEN 0x03ff0000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_MULTICAST 0x04000000  
+#define ERXBUF_BROADCAST 0x08000000  
+#define ERXBUF_LONGEVENT 0x10000000  
+#define ERXBUF_BADPKT 0x20000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_GOODPKT 0x40000000  
+#define ERXBUF_CARRIER 0x80000000  
+#define ETXD_DATALEN 104
+struct ioc3_etxd {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u32 cmd;
+ u32 bufcnt;
+ u64 p1;
+ u64 p2;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u8 data[ETXD_DATALEN];
+};
+#define ETXD_BYTECNT_MASK 0x000007ff  
+#define ETXD_INTWHENDONE 0x00001000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_D0V 0x00010000  
+#define ETXD_B1V 0x00020000  
+#define ETXD_B2V 0x00040000  
+#define ETXD_DOCHECKSUM 0x00080000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_CHKOFF_MASK 0x07f00000  
+#define ETXD_CHKOFF_SHIFT 20
+#define ETXD_D0CNT_MASK 0x0000007f
+#define ETXD_B1CNT_MASK 0x0007ff00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_B1CNT_SHIFT 8
+#define ETXD_B2CNT_MASK 0x7ff00000
+#define ETXD_B2CNT_SHIFT 20
+#define IOC3_BYTEBUS_DEV0 0x80000L
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_BYTEBUS_DEV1 0xa0000L
+#define IOC3_BYTEBUS_DEV2 0xc0000L
+#define IOC3_BYTEBUS_DEV3 0xe0000L
+#define IOC3_SIO_BASE 0x20000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_SIO_UARTC (IOC3_SIO_BASE+0x141)  
+#define IOC3_SIO_KBDCG (IOC3_SIO_BASE+0x142)  
+#define IOC3_SIO_PP_BASE (IOC3_SIO_BASE+PP_BASE)  
+#define IOC3_SIO_RTC_BASE (IOC3_SIO_BASE+0x168)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_SIO_UB_BASE (IOC3_SIO_BASE+UARTB_BASE)  
+#define IOC3_SIO_UA_BASE (IOC3_SIO_BASE+UARTA_BASE)  
+#define IOC3_SSRAM IOC3_RAM_OFF  
+#define IOC3_SSRAM_LEN 0x40000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_SSRAM_DM 0x0000ffff  
+#define IOC3_SSRAM_PM 0x00010000  
+#define PCI_SCR_PAR_RESP_EN 0x00000040  
+#define PCI_SCR_SERR_EN 0x00000100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI_SCR_DROP_MODE_EN 0x00008000  
+#define PCI_SCR_RX_SERR (0x1 << 16)
+#define PCI_SCR_DROP_MODE (0x1 << 17)
+#define PCI_SCR_SIG_PAR_ERR (0x1 << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI_SCR_SIG_TAR_ABRT (0x1 << 27)
+#define PCI_SCR_RX_TAR_ABRT (0x1 << 28)
+#define PCI_SCR_SIG_MST_ABRT (0x1 << 29)
+#define PCI_SCR_SIG_SERR (0x1 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PCI_SCR_PAR_ERR (0x1 << 31)
+#define KM_CSR_K_WRT_PEND 0x00000001  
+#define KM_CSR_M_WRT_PEND 0x00000002  
+#define KM_CSR_K_LCB 0x00000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_CSR_M_LCB 0x00000008  
+#define KM_CSR_K_DATA 0x00000010  
+#define KM_CSR_K_CLK 0x00000020  
+#define KM_CSR_K_PULL_DATA 0x00000040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_CSR_K_PULL_CLK 0x00000080  
+#define KM_CSR_M_DATA 0x00000100  
+#define KM_CSR_M_CLK 0x00000200  
+#define KM_CSR_M_PULL_DATA 0x00000400  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_CSR_M_PULL_CLK 0x00000800  
+#define KM_CSR_EMM_MODE 0x00001000  
+#define KM_CSR_SIM_MODE 0x00002000  
+#define KM_CSR_K_SM_IDLE 0x00004000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_CSR_M_SM_IDLE 0x00008000  
+#define KM_CSR_K_TO 0x00010000  
+#define KM_CSR_M_TO 0x00020000  
+#define KM_CSR_K_TO_EN 0x00040000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_CSR_M_TO_EN 0x00080000  
+#define KM_CSR_K_CLAMP_ONE 0x00100000  
+#define KM_CSR_M_CLAMP_ONE 0x00200000  
+#define KM_CSR_K_CLAMP_THREE 0x00400000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_CSR_M_CLAMP_THREE 0x00800000  
+#define KM_RD_DATA_2 0x000000ff  
+#define KM_RD_DATA_2_SHIFT 0
+#define KM_RD_DATA_1 0x0000ff00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_RD_DATA_1_SHIFT 8
+#define KM_RD_DATA_0 0x00ff0000  
+#define KM_RD_DATA_0_SHIFT 16
+#define KM_RD_FRAME_ERR_2 0x01000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_RD_FRAME_ERR_1 0x02000000  
+#define KM_RD_FRAME_ERR_0 0x04000000  
+#define KM_RD_KBD_MSE 0x08000000  
+#define KM_RD_OFLO 0x10000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_RD_VALID_2 0x20000000  
+#define KM_RD_VALID_1 0x40000000  
+#define KM_RD_VALID_0 0x80000000  
+#define KM_RD_VALID_ALL (KM_RD_VALID_0|KM_RD_VALID_1|KM_RD_VALID_2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KM_WD_WRT_DATA 0x000000ff  
+#define KM_WD_WRT_DATA_SHIFT 0
+#define RXSB_OVERRUN 0x01  
+#define RXSB_PAR_ERR 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RXSB_FRAME_ERR 0x04  
+#define RXSB_BREAK 0x08  
+#define RXSB_CTS 0x10  
+#define RXSB_DCD 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RXSB_MODEM_VALID 0x40  
+#define RXSB_DATA_VALID 0x80  
+#define TXCB_INT_WHEN_DONE 0x20  
+#define TXCB_INVALID 0x00  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TXCB_VALID 0x40  
+#define TXCB_MCR 0x80  
+#define TXCB_DELAY 0xc0  
+#define SBBR_L_SIZE 0x00000001  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SBBR_L_BASE 0xfffff000  
+#define SSCR_RX_THRESHOLD 0x000001ff  
+#define SSCR_TX_TIMER_BUSY 0x00010000  
+#define SSCR_HFC_EN 0x00020000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSCR_RX_RING_DCD 0x00040000  
+#define SSCR_RX_RING_CTS 0x00080000  
+#define SSCR_HIGH_SPD 0x00100000  
+#define SSCR_DIAG 0x00200000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSCR_RX_DRAIN 0x08000000  
+#define SSCR_DMA_EN 0x10000000  
+#define SSCR_DMA_PAUSE 0x20000000  
+#define SSCR_PAUSE_STATE 0x40000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SSCR_RESET 0x80000000  
+#define PROD_CONS_PTR_4K 0x00000ff8  
+#define PROD_CONS_PTR_1K 0x000003f8  
+#define PROD_CONS_PTR_OFF 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SRCIR_ARM 0x80000000  
+#define SRPIR_BYTE_CNT 0x07000000  
+#define SRPIR_BYTE_CNT_SHIFT 24
+#define STCIR_BYTE_CNT 0x0f000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STCIR_BYTE_CNT_SHIFT 24
+#define SHADOW_DR 0x00000001  
+#define SHADOW_OE 0x00000002  
+#define SHADOW_PE 0x00000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHADOW_FE 0x00000008  
+#define SHADOW_BI 0x00000010  
+#define SHADOW_THRE 0x00000020  
+#define SHADOW_TEMT 0x00000040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHADOW_RFCE 0x00000080  
+#define SHADOW_DCTS 0x00010000  
+#define SHADOW_DDCD 0x00080000  
+#define SHADOW_CTS 0x00100000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHADOW_DCD 0x00800000  
+#define SHADOW_DTR 0x01000000  
+#define SHADOW_RTS 0x02000000  
+#define SHADOW_OUT1 0x04000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SHADOW_OUT2 0x08000000  
+#define SHADOW_LOOP 0x10000000  
+#define SRTR_CNT 0x00000fff  
+#define SRTR_CNT_VAL 0x0fff0000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SRTR_CNT_VAL_SHIFT 16
+#define SRTR_HZ 16000  
+#define SIO_IR_SA_TX_MT 0x00000001  
+#define SIO_IR_SA_RX_FULL 0x00000002  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_SA_RX_HIGH 0x00000004  
+#define SIO_IR_SA_RX_TIMER 0x00000008  
+#define SIO_IR_SA_DELTA_DCD 0x00000010  
+#define SIO_IR_SA_DELTA_CTS 0x00000020  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_SA_INT 0x00000040  
+#define SIO_IR_SA_TX_EXPLICIT 0x00000080  
+#define SIO_IR_SA_MEMERR 0x00000100  
+#define SIO_IR_SB_TX_MT 0x00000200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_SB_RX_FULL 0x00000400  
+#define SIO_IR_SB_RX_HIGH 0x00000800  
+#define SIO_IR_SB_RX_TIMER 0x00001000  
+#define SIO_IR_SB_DELTA_DCD 0x00002000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_SB_DELTA_CTS 0x00004000  
+#define SIO_IR_SB_INT 0x00008000  
+#define SIO_IR_SB_TX_EXPLICIT 0x00010000  
+#define SIO_IR_SB_MEMERR 0x00020000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_PP_INT 0x00040000  
+#define SIO_IR_PP_INTA 0x00080000  
+#define SIO_IR_PP_INTB 0x00100000  
+#define SIO_IR_PP_MEMERR 0x00200000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_KBD_INT 0x00400000  
+#define SIO_IR_RT_INT 0x08000000  
+#define SIO_IR_GEN_INT1 0x10000000  
+#define SIO_IR_GEN_INT_SHIFT 28
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_IR_SA (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL |   SIO_IR_SA_RX_HIGH | SIO_IR_SA_RX_TIMER |   SIO_IR_SA_DELTA_DCD | SIO_IR_SA_DELTA_CTS |   SIO_IR_SA_INT | SIO_IR_SA_TX_EXPLICIT |   SIO_IR_SA_MEMERR)
+#define SIO_IR_SB (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL |   SIO_IR_SB_RX_HIGH | SIO_IR_SB_RX_TIMER |   SIO_IR_SB_DELTA_DCD | SIO_IR_SB_DELTA_CTS |   SIO_IR_SB_INT | SIO_IR_SB_TX_EXPLICIT |   SIO_IR_SB_MEMERR)
+#define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA |   SIO_IR_PP_INTB | SIO_IR_PP_MEMERR)
+#define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_PENDING_INTRS(mem) (PCI_INW(&((mem)->sio_ir)) &   PCI_INW(&((mem)->sio_ies_ro)))
+#define SIO_CR_SIO_RESET 0x00000001  
+#define SIO_CR_SER_A_BASE 0x000000fe  
+#define SIO_CR_SER_A_BASE_SHIFT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_CR_SER_B_BASE 0x00007f00  
+#define SIO_CR_SER_B_BASE_SHIFT 8
+#define SIO_SR_CMD_PULSE 0x00078000  
+#define SIO_CR_CMD_PULSE_SHIFT 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_CR_ARB_DIAG 0x00380000  
+#define SIO_CR_ARB_DIAG_TXA 0x00000000
+#define SIO_CR_ARB_DIAG_RXA 0x00080000
+#define SIO_CR_ARB_DIAG_TXB 0x00100000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIO_CR_ARB_DIAG_RXB 0x00180000
+#define SIO_CR_ARB_DIAG_PP 0x00200000
+#define SIO_CR_ARB_DIAG_IDLE 0x00400000  
+#define INT_OUT_COUNT 0x0000ffff  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_OUT_MODE 0x00070000  
+#define INT_OUT_MODE_0 0x00000000  
+#define INT_OUT_MODE_1 0x00040000  
+#define INT_OUT_MODE_1PULSE 0x00050000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_OUT_MODE_PULSES 0x00060000  
+#define INT_OUT_MODE_SQW 0x00070000  
+#define INT_OUT_DIAG 0x40000000  
+#define INT_OUT_INT_OUT 0x80000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_OUT_NS_PER_TICK (30 * 260)  
+#define INT_OUT_TICKS_PER_PULSE 3  
+#define INT_OUT_US_TO_COUNT(x)     (((x) * 10 + INT_OUT_NS_PER_TICK / 200) *   100 / INT_OUT_NS_PER_TICK - 1)
+#define INT_OUT_COUNT_TO_US(x)     (((x) + 1) * INT_OUT_NS_PER_TICK / 1000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT_OUT_MIN_TICKS 3  
+#define INT_OUT_MAX_TICKS INT_OUT_COUNT  
+#define GPCR_DIR 0x000000ff  
+#define GPCR_DIR_PIN(x) (1<<(x))  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GPCR_EDGE 0x000f0000  
+#define GPCR_EDGE_PIN(x) (1<<((x)+15))  
+#define GPCR_INT_OUT_EN 0x00100000  
+#define GPCR_MLAN_EN 0x00200000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GPCR_DIR_SERA_XCVR 0x00000080  
+#define GPCR_DIR_SERB_XCVR 0x00000040  
+#define GPCR_DIR_PHY_RST 0x00000020  
+#define GPCR_PHY_RESET 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GPCR_UARTB_MODESEL 0x40  
+#define GPCR_UARTA_MODESEL 0x80  
+#define GPPR_PHY_RESET_PIN 5  
+#define GPPR_UARTB_MODESEL_PIN 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GPPR_UARTA_MODESEL_PIN 7  
+#define EMCR_DUPLEX 0x00000001
+#define EMCR_PROMISC 0x00000002
+#define EMCR_PADEN 0x00000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EMCR_RXOFF_MASK 0x000001f8
+#define EMCR_RXOFF_SHIFT 3
+#define EMCR_RAMPAR 0x00000200
+#define EMCR_BADPAR 0x00000800
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EMCR_BUFSIZ 0x00001000
+#define EMCR_TXDMAEN 0x00002000
+#define EMCR_TXEN 0x00004000
+#define EMCR_RXDMAEN 0x00008000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EMCR_RXEN 0x00010000
+#define EMCR_LOOPBACK 0x00020000
+#define EMCR_ARB_DIAG 0x001c0000
+#define EMCR_ARB_DIAG_IDLE 0x00200000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EMCR_RST 0x80000000
+#define EISR_RXTIMERINT 0x00000001
+#define EISR_RXTHRESHINT 0x00000002
+#define EISR_RXOFLO 0x00000004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EISR_RXBUFOFLO 0x00000008
+#define EISR_RXMEMERR 0x00000010
+#define EISR_RXPARERR 0x00000020
+#define EISR_TXEMPTY 0x00010000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EISR_TXRTRY 0x00020000
+#define EISR_TXEXDEF 0x00040000
+#define EISR_TXLCOL 0x00080000
+#define EISR_TXGIANT 0x00100000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EISR_TXBUFUFLO 0x00200000
+#define EISR_TXEXPLICIT 0x00400000
+#define EISR_TXCOLLWRAP 0x00800000
+#define EISR_TXDEFERWRAP 0x01000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EISR_TXMEMERR 0x02000000
+#define EISR_TXPARERR 0x04000000
+#define ERCSR_THRESH_MASK 0x000001ff  
+#define ERCSR_RX_TMR 0x40000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERCSR_DIAG_OFLO 0x80000000  
+#define ERBR_ALIGNMENT 4096
+#define ERBR_L_RXRINGBASE_MASK 0xfffff000
+#define ERBAR_BARRIER_BIT 0x0100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERBAR_RXBARR_MASK 0xffff0000
+#define ERBAR_RXBARR_SHIFT 16
+#define ERCIR_RXCONSUME_MASK 0x00000fff
+#define ERPIR_RXPRODUCE_MASK 0x00000fff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERPIR_ARM 0x80000000
+#define ERTR_CNT_MASK 0x000007ff
+#define ETCSR_IPGT_MASK 0x0000007f
+#define ETCSR_IPGR1_MASK 0x00007f00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETCSR_IPGR1_SHIFT 8
+#define ETCSR_IPGR2_MASK 0x007f0000
+#define ETCSR_IPGR2_SHIFT 16
+#define ETCSR_NOTXCLK 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETCDC_COLLCNT_MASK 0x0000ffff
+#define ETCDC_DEFERCNT_MASK 0xffff0000
+#define ETCDC_DEFERCNT_SHIFT 16
+#define ETBR_ALIGNMENT (64*1024)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETBR_L_RINGSZ_MASK 0x00000001
+#define ETBR_L_RINGSZ128 0
+#define ETBR_L_RINGSZ512 1
+#define ETBR_L_TXRINGBASE_MASK 0xffffc000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETCIR_TXCONSUME_MASK 0x0000ffff
+#define ETCIR_IDLE 0x80000000
+#define ETPIR_TXPRODUCE_MASK 0x0000ffff
+#define EBIR_TXBUFPROD_MASK 0x0000001f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EBIR_TXBUFCONS_MASK 0x00001f00
+#define EBIR_TXBUFCONS_SHIFT 8
+#define EBIR_RXBUFPROD_MASK 0x007fc000
+#define EBIR_RXBUFPROD_SHIFT 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EBIR_RXBUFCONS_MASK 0xff800000
+#define EBIR_RXBUFCONS_SHIFT 23
+#define MICR_REGADDR_MASK 0x0000001f
+#define MICR_PHYADDR_MASK 0x000003e0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MICR_PHYADDR_SHIFT 5
+#define MICR_READTRIG 0x00000400
+#define MICR_BUSY 0x00000800
+#define MIDR_DATA_MASK 0x0000ffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_IPCKSUM_MASK 0x0000ffff
+#define ERXBUF_BYTECNT_MASK 0x07ff0000
+#define ERXBUF_BYTECNT_SHIFT 16
+#define ERXBUF_V 0x80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_CRCERR 0x00000001  
+#define ERXBUF_FRAMERR 0x00000002  
+#define ERXBUF_CODERR 0x00000004  
+#define ERXBUF_INVPREAMB 0x00000008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_LOLEN 0x00007000  
+#define ERXBUF_HILEN 0x03ff0000  
+#define ERXBUF_MULTICAST 0x04000000  
+#define ERXBUF_BROADCAST 0x08000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERXBUF_LONGEVENT 0x10000000  
+#define ERXBUF_BADPKT 0x20000000  
+#define ERXBUF_GOODPKT 0x40000000  
+#define ERXBUF_CARRIER 0x80000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_BYTECNT_MASK 0x000007ff  
+#define ETXD_INTWHENDONE 0x00001000  
+#define ETXD_D0V 0x00010000  
+#define ETXD_B1V 0x00020000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_B2V 0x00040000  
+#define ETXD_DOCHECKSUM 0x00080000  
+#define ETXD_CHKOFF_MASK 0x07f00000  
+#define ETXD_CHKOFF_SHIFT 20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_D0CNT_MASK 0x0000007f
+#define ETXD_B1CNT_MASK 0x0007ff00
+#define ETXD_B1CNT_SHIFT 8
+#define ETXD_B2CNT_MASK 0x7ff00000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ETXD_B2CNT_SHIFT 20
+typedef enum ioc3_subdevs_e {
+ ioc3_subdev_ether,
+ ioc3_subdev_generic,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ioc3_subdev_nic,
+ ioc3_subdev_kbms,
+ ioc3_subdev_ttya,
+ ioc3_subdev_ttyb,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ioc3_subdev_ecpp,
+ ioc3_subdev_rt,
+ ioc3_nsubdevs
+} ioc3_subdev_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_SDB_ETHER (1<<ioc3_subdev_ether)
+#define IOC3_SDB_GENERIC (1<<ioc3_subdev_generic)
+#define IOC3_SDB_NIC (1<<ioc3_subdev_nic)
+#define IOC3_SDB_KBMS (1<<ioc3_subdev_kbms)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_SDB_TTYA (1<<ioc3_subdev_ttya)
+#define IOC3_SDB_TTYB (1<<ioc3_subdev_ttyb)
+#define IOC3_SDB_ECPP (1<<ioc3_subdev_ecpp)
+#define IOC3_SDB_RT (1<<ioc3_subdev_rt)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_ALL_SUBDEVS ((1<<ioc3_nsubdevs)-1)
+#define IOC3_SDB_SERIAL (IOC3_SDB_TTYA|IOC3_SDB_TTYB)
+#define IOC3_STD_SUBDEVS IOC3_ALL_SUBDEVS
+#define IOC3_INTA_SUBDEVS IOC3_SDB_ETHER
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IOC3_INTB_SUBDEVS (IOC3_SDB_GENERIC|IOC3_SDB_KBMS|IOC3_SDB_SERIAL|IOC3_SDB_ECPP|IOC3_SDB_RT)
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/kldir.h b/libc/kernel/arch-mips/asm/sn/kldir.h
new file mode 100644
index 0000000..6c663ca
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/kldir.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_KLDIR_H
+#define _ASM_SN_KLDIR_H
+#define KLDIR_MAGIC 0x434d5f53505f5357
+#ifdef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLDIR_OFF_MAGIC 0x00
+#define KLDIR_OFF_OFFSET 0x08
+#define KLDIR_OFF_POINTER 0x10
+#define KLDIR_OFF_SIZE 0x18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KLDIR_OFF_COUNT 0x20
+#define KLDIR_OFF_STRIDE 0x28
+#endif
+#define SYMMON_STACK_SIZE 0x8000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef PROM
+#define IP27_LAUNCH_OFFSET 0x2400
+#define IP27_LAUNCH_SIZE 0x400
+#define IP27_LAUNCH_COUNT 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_LAUNCH_STRIDE 0x200
+#define IP27_KLCONFIG_OFFSET 0x4000
+#define IP27_KLCONFIG_SIZE 0xc000
+#define IP27_KLCONFIG_COUNT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_KLCONFIG_STRIDE 0
+#define IP27_NMI_OFFSET 0x3000
+#define IP27_NMI_SIZE 0x40
+#define IP27_NMI_COUNT 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_NMI_STRIDE 0x40
+#define IP27_PI_ERROR_OFFSET 0x12000
+#define IP27_PI_ERROR_SIZE 0x4000
+#define IP27_PI_ERROR_COUNT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_PI_ERROR_STRIDE 0
+#define IP27_SYMMON_STK_OFFSET 0x25000
+#define IP27_SYMMON_STK_SIZE 0xe000
+#define IP27_SYMMON_STK_COUNT 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_SYMMON_STK_STRIDE 0x7000
+#define IP27_FREEMEM_OFFSET 0x19000
+#define IP27_FREEMEM_SIZE -1
+#define IP27_FREEMEM_COUNT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_FREEMEM_STRIDE 0
+#endif
+#define IO6_GDA_OFFSET 0x11000
+#define IO6_GDA_SIZE 0x400
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO6_GDA_COUNT 1
+#define IO6_GDA_STRIDE 0
+#define IP27_NMI_KREGS_OFFSET 0x11400
+#define IP27_NMI_KREGS_CPU_SIZE 0x200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27_NMI_EFRAME_OFFSET 0x11800
+#define IP27_NMI_EFRAME_SIZE 0x200
+#define KLDIR_ENT_SIZE 0x40
+#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+typedef struct kldir_ent_s {
+ u64 magic;
+ off_t offset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long pointer;
+ size_t size;
+ u64 count;
+ size_t stride;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char rsvd[16];
+} kldir_ent_t;
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/sn/klkernvars.h b/libc/kernel/arch-mips/asm/sn/klkernvars.h
new file mode 100644
index 0000000..a0c7512
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/klkernvars.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SN_KLKERNVARS_H
+#define __ASM_SN_KLKERNVARS_H
+#define KV_MAGIC_OFFSET 0x0
+#define KV_RO_NASID_OFFSET 0x4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KV_RW_NASID_OFFSET 0x6
+#define KV_MAGIC 0x5f4b565f
+#ifndef __ASSEMBLY__
+#include <asm/sn/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct kern_vars_s {
+ int kv_magic;
+ nasid_t kv_ro_nasid;
+ nasid_t kv_rw_nasid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long kv_ro_baseaddr;
+ unsigned long kv_rw_baseaddr;
+} kern_vars_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/sn0/addrs.h b/libc/kernel/arch-mips/asm/sn/sn0/addrs.h
new file mode 100644
index 0000000..5c056ed
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/sn0/addrs.h
@@ -0,0 +1,174 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_SN0_ADDRS_H
+#define _ASM_SN_SN0_ADDRS_H
+#define NODE_SIZE_BITS 32
+#define BWIN_SIZE_BITS 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NASID_BITMASK (0xffLL)
+#define NASID_BITS 8
+#define NASID_SHFT 32
+#define NASID_META_BITS 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NASID_LOCAL_BITS 4
+#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
+#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
+#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NASID_MASK (UINT64_CAST NASID_BITMASK << NASID_SHFT)
+#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >>   NASID_SHFT) & NASID_BITMASK)
+#ifndef __ASSEMBLY__
+#define NODE_SWIN_BASE(nasid, widget)   ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN)   : RAW_NODE_SWIN_BASE(nasid, widget))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define NODE_SWIN_BASE(nasid, widget)   (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
+#endif
+#define BWIN_INDEX_BITS 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BWIN_SIZE (UINT64_CAST 1 << BWIN_SIZE_BITS)
+#define BWIN_SIZEMASK (BWIN_SIZE - 1)
+#define BWIN_WIDGET_MASK 0x7
+#define NODE_BWIN_BASE0(nasid) (NODE_IO_BASE(nasid) + BWIN_SIZE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NODE_BWIN_BASE(nasid, bigwin) (NODE_BWIN_BASE0(nasid) +   (UINT64_CAST(bigwin) << BWIN_SIZE_BITS))
+#define BWIN_WIDGETADDR(addr) ((addr) & BWIN_SIZEMASK)
+#define BWIN_WINDOWNUM(addr) (((addr) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
+#define NODE_BWIN_ADDR(nasid, addr)   (((addr) >= NODE_BWIN_BASE0(nasid)) &&   ((addr) < (NODE_BWIN_BASE(nasid, HUB_NUM_BIG_WINDOW) +   BWIN_SIZE)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CALIAS_BASE CAC_BASE
+#define BRIDGE_REG_PTR(_base, _off) ((volatile bridgereg_t *)   ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
+#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
+#define SABLE_LOG_TRIGGER(_map)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+#define KERN_NMI_ADDR(nasid, slice)   TO_NODE_UNCAC((nasid), IP27_NMI_KREGS_OFFSET +   (IP27_NMI_KREGS_CPU_SIZE * (slice)))
+#endif
+#ifdef PROM
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MISC_PROM_BASE PHYS_TO_K0(0x01300000)
+#define MISC_PROM_SIZE 0x200000
+#define DIAG_BASE PHYS_TO_K0(0x01500000)
+#define DIAG_SIZE 0x300000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ROUTE_BASE PHYS_TO_K0(0x01800000)
+#define ROUTE_SIZE 0x200000
+#define IP27PROM_FLASH_HDR PHYS_TO_K0(0x01300000)
+#define IP27PROM_FLASH_DATA PHYS_TO_K0(0x01301000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_CORP_MAX 32
+#define IP27PROM_CORP PHYS_TO_K0(0x01800000)
+#define IP27PROM_CORP_SIZE 0x10000
+#define IP27PROM_CORP_STK PHYS_TO_K0(0x01810000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_CORP_STKSIZE 0x2000
+#define IP27PROM_DECOMP_BUF PHYS_TO_K0(0x01900000)
+#define IP27PROM_DECOMP_SIZE 0xfff00
+#define IP27PROM_BASE PHYS_TO_K0(0x01a00000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_BASE_MAPPED (UNCAC_BASE | 0x1fc00000)
+#define IP27PROM_SIZE_MAX 0x100000
+#define IP27PROM_PCFG PHYS_TO_K0(0x01b00000)
+#define IP27PROM_PCFG_SIZE 0xd0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_ERRDMP PHYS_TO_K1(0x01bd0000)
+#define IP27PROM_ERRDMP_SIZE 0xf000
+#define IP27PROM_INIT_START PHYS_TO_K1(0x01bd0000)
+#define IP27PROM_CONSOLE PHYS_TO_K1(0x01bdf000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_CONSOLE_SIZE 0x200
+#define IP27PROM_NETUART PHYS_TO_K1(0x01bdf200)
+#define IP27PROM_NETUART_SIZE 0x100
+#define IP27PROM_UNUSED1 PHYS_TO_K1(0x01bdf300)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_UNUSED1_SIZE 0x500
+#define IP27PROM_ELSC_BASE_A PHYS_TO_K0(0x01bdf800)
+#define IP27PROM_ELSC_BASE_B PHYS_TO_K0(0x01bdfc00)
+#define IP27PROM_STACK_A PHYS_TO_K0(0x01be0000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_STACK_B PHYS_TO_K0(0x01bf0000)
+#define IP27PROM_STACK_SHFT 16
+#define IP27PROM_STACK_SIZE (1 << IP27PROM_STACK_SHFT)
+#define IP27PROM_INIT_END PHYS_TO_K0(0x01c00000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SLAVESTACK_BASE PHYS_TO_K0(0x01580000)
+#define SLAVESTACK_SIZE 0x40000
+#define ENETBUFS_BASE PHYS_TO_K0(0x01f80000)
+#define ENETBUFS_SIZE 0x20000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO6PROM_BASE PHYS_TO_K0(0x01c00000)
+#define IO6PROM_SIZE 0x400000
+#define IO6PROM_BASE_MAPPED (UNCAC_BASE | 0x11c00000)
+#define IO6DPROM_BASE PHYS_TO_K0(0x01c00000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IO6DPROM_SIZE 0x200000
+#define NODEBUGUNIX_ADDR PHYS_TO_K0(0x00019000)
+#define DEBUGUNIX_ADDR PHYS_TO_K0(0x00100000)
+#define IP27PROM_INT_LAUNCH 10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_INT_NETUART 12  
+#endif
+#define IP27PROM_ELSC_SHFT 10
+#define IP27PROM_ELSC_SIZE (1 << IP27PROM_ELSC_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FREEMEM_BASE PHYS_TO_K0(0x2000000)
+#define IO6PROM_STACK_SHFT 14  
+#define IO6PROM_STACK_SIZE (1 << IO6PROM_STACK_SHFT)
+#define IP27PROM_ENTRY PHYS_TO_COMPATK1(0x1fc00000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_RESTART PHYS_TO_COMPATK1(0x1fc00008)
+#define IP27PROM_SLAVELOOP PHYS_TO_COMPATK1(0x1fc00010)
+#define IP27PROM_PODMODE PHYS_TO_COMPATK1(0x1fc00018)
+#define IP27PROM_IOC3UARTPOD PHYS_TO_COMPATK1(0x1fc00020)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_FLASHLEDS PHYS_TO_COMPATK1(0x1fc00028)
+#define IP27PROM_REPOD PHYS_TO_COMPATK1(0x1fc00030)
+#define IP27PROM_LAUNCHSLAVE PHYS_TO_COMPATK1(0x1fc00038)
+#define IP27PROM_WAITSLAVE PHYS_TO_COMPATK1(0x1fc00040)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IP27PROM_POLLSLAVE PHYS_TO_COMPATK1(0x1fc00048)
+#define KL_UART_BASE LOCAL_HUB_ADDR(MD_UREG0_0)  
+#define KL_UART_CMD LOCAL_HUB_ADDR(MD_UREG0_0)  
+#define KL_UART_DATA LOCAL_HUB_ADDR(MD_UREG0_1)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KL_I2C_REG MD_UREG0_0  
+#ifndef __ASSEMBLY__
+#ifdef HUB_ERR_STS_WAR
+#define CACHE_ERR_EFRAME 0x480
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define CACHE_ERR_EFRAME 0x400
+#endif
+#define CACHE_ERR_ECCFRAME (CACHE_ERR_EFRAME + EF_SIZE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CACHE_ERR_SP_PTR (0x1000 - 32)  
+#define CACHE_ERR_IBASE_PTR (0x1000 - 40)
+#define CACHE_ERR_SP (CACHE_ERR_SP_PTR - 16)
+#define CACHE_ERR_AREA_SIZE (ARCS_SPB_OFFSET - CACHE_ERR_EFRAME)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define _ARCSPROM
+#ifdef HUB_ERR_STS_WAR
+#define ERR_STS_WAR_REGISTER IIO_IIBUSERR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERR_STS_WAR_ADDR LOCAL_HUB_ADDR(IIO_IIBUSERR)
+#define ERR_STS_WAR_PHYSADDR TO_PHYS((__psunsigned_t)ERR_STS_WAR_ADDR)
+#define OLD_ERR_STS_WAR_OFFSET ((MD_MEM_BANKS * MD_BANK_SIZE) - 0x100)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/sn0/hubio.h b/libc/kernel/arch-mips/asm/sn/sn0/hubio.h
new file mode 100644
index 0000000..f593233
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/sn0/hubio.h
@@ -0,0 +1,788 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SGI_SN_SN0_HUBIO_H
+#define _ASM_SGI_SN_SN0_HUBIO_H
+#define IIO_WIDGET IIO_WID  
+#define IIO_WIDGET_STAT IIO_WSTAT  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_WIDGET_CTRL IIO_WCR  
+#define IIO_WIDGET_TOUT IIO_WRTO  
+#define IIO_WIDGET_FLUSH IIO_WTFR  
+#define IIO_PROTECT IIO_ILAPR  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_PROTECT_OVRRD IIO_ILAPO  
+#define IIO_OUTWIDGET_ACCESS IIO_IOWA  
+#define IIO_INWIDGET_ACCESS IIO_IIWA  
+#define IIO_INDEV_ERR_MASK IIO_IIDEM  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_LLP_CSR IIO_ILCSR  
+#define IIO_LLP_LOG IIO_ILLR  
+#define IIO_XTALKCC_TOUT IIO_IXCC  
+#define IIO_XTALKTT_TOUT IIO_IXTT  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IO_ERR_CLR IIO_IECLR  
+#define IIO_BTE_CRB_CNT IIO_IBCN  
+#define IIO_LLP_CSR_IS_UP 0x00002000
+#define IIO_LLP_CSR_LLP_STAT_MASK 0x00003000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_LLP_CSR_LLP_STAT_SHFT 12
+#define IIO_PROTECT_OVRRD_KEY 0x53474972756c6573ull  
+#define IIO_BTE_STAT_0 IIO_IBLS_0  
+#define IIO_BTE_SRC_0 IIO_IBSA_0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_BTE_DEST_0 IIO_IBDA_0  
+#define IIO_BTE_CTRL_0 IIO_IBCT_0  
+#define IIO_BTE_NOTIFY_0 IIO_IBNA_0  
+#define IIO_BTE_INT_0 IIO_IBIA_0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_BTE_OFF_0 0  
+#define IIO_BTE_OFF_1 IIO_IBLS_1 - IIO_IBLS_0  
+#define BTEOFF_STAT 0
+#define BTEOFF_SRC (IIO_BTE_SRC_0 - IIO_BTE_STAT_0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BTEOFF_DEST (IIO_BTE_DEST_0 - IIO_BTE_STAT_0)
+#define BTEOFF_CTRL (IIO_BTE_CTRL_0 - IIO_BTE_STAT_0)
+#define BTEOFF_NOTIFY (IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0)
+#define BTEOFF_INT (IIO_BTE_INT_0 - IIO_BTE_STAT_0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_BASE 0x400000
+#define IIO_BASE_BTE0 0x410000
+#define IIO_BASE_BTE1 0x420000
+#define IIO_BASE_PERF 0x430000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_PERF_CNT 0x430008
+#define IO_PERF_SETS 32
+#define IIO_WID 0x400000  
+#define IIO_WSTAT 0x400008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_WCR 0x400020  
+#define IIO_WSTAT_ECRAZY (1ULL << 32)  
+#define IIO_WSTAT_TXRETRY (1ULL << 9)  
+#define IIO_WSTAT_TXRETRY_MASK (0x7F)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_WSTAT_TXRETRY_SHFT (16)
+#define IIO_WSTAT_TXRETRY_CNT(w) (((w) >> IIO_WSTAT_TXRETRY_SHFT) &   IIO_WSTAT_TXRETRY_MASK)
+#define IIO_ILAPR 0x400100  
+#define IIO_ILAPO 0x400108  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IOWA 0x400110  
+#define IIO_IIWA 0x400118  
+#define IIO_IIDEM 0x400120  
+#define IIO_ILCSR 0x400128  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ILLR 0x400130  
+#define IIO_IIDSR 0x400138  
+#define IIO_IIBUSERR 0x1400208  
+#define IIO_IIDSR_SENT_SHIFT 28
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IIDSR_SENT_MASK 0x10000000
+#define IIO_IIDSR_ENB_SHIFT 24
+#define IIO_IIDSR_ENB_MASK 0x01000000
+#define IIO_IIDSR_NODE_SHIFT 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IIDSR_NODE_MASK 0x0000ff00
+#define IIO_IIDSR_LVL_SHIFT 0
+#define IIO_IIDSR_LVL_MASK 0x0000003f
+#define IIO_IGFX_0 0x400140  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IGFX_1 0x400148  
+#define IIO_IGFX_W_NUM_BITS 4  
+#define IIO_IGFX_W_NUM_MASK ((1<<IIO_IGFX_W_NUM_BITS)-1)
+#define IIO_IGFX_W_NUM_SHIFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IGFX_N_NUM_BITS 9  
+#define IIO_IGFX_N_NUM_MASK ((1<<IIO_IGFX_N_NUM_BITS)-1)
+#define IIO_IGFX_N_NUM_SHIFT 4
+#define IIO_IGFX_P_NUM_BITS 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IGFX_P_NUM_MASK ((1<<IIO_IGFX_P_NUM_BITS)-1)
+#define IIO_IGFX_P_NUM_SHIFT 16
+#define IIO_IGFX_VLD_BITS 1  
+#define IIO_IGFX_VLD_MASK ((1<<IIO_IGFX_VLD_BITS)-1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IGFX_VLD_SHIFT 20
+#define IIO_IGFX_INIT(widget, node, cpu, valid) (  (((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) |   (((node) & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) |   (((cpu) & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT) |   (((valid) & IIO_IGFX_VLD_MASK) << IIO_IGFX_VLD_SHIFT) )
+#define IIO_SCRATCH_REG0 0x400150
+#define IIO_SCRATCH_REG1 0x400158
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_SCRATCH_MASK 0x0000000f00f11fff
+#define IIO_SCRATCH_BIT0_0 0x0000000800000000
+#define IIO_SCRATCH_BIT0_1 0x0000000400000000
+#define IIO_SCRATCH_BIT0_2 0x0000000200000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_SCRATCH_BIT0_3 0x0000000100000000
+#define IIO_SCRATCH_BIT0_4 0x0000000000800000
+#define IIO_SCRATCH_BIT0_5 0x0000000000400000
+#define IIO_SCRATCH_BIT0_6 0x0000000000200000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_SCRATCH_BIT0_7 0x0000000000100000
+#define IIO_SCRATCH_BIT0_8 0x0000000000010000
+#define IIO_SCRATCH_BIT0_9 0x0000000000001000
+#define IIO_SCRATCH_BIT0_R 0x0000000000000fff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_NUM_ITTES 7  
+#define HUB_NUM_BIG_WINDOW IIO_NUM_ITTES - 1
+#define SWIN0_BIGWIN HUB_NUM_BIG_WINDOW
+#define ILCSR_WARM_RESET 0x100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+typedef union hubii_wid_u {
+ u64 wid_reg_value;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 wid_rsvd: 32,
+ wid_rev_num: 4,
+ wid_part_num: 16,
+ wid_mfg_num: 11,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ wid_rsvd1: 1;
+ } wid_fields_s;
+} hubii_wid_t;
+typedef union hubii_wcr_u {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 wcr_reg_value;
+ struct {
+ u64 wcr_rsvd: 41,
+ wcr_e_thresh: 5,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ wcr_dir_con: 1,
+ wcr_f_bad_pkt: 1,
+ wcr_xbar_crd: 3,
+ wcr_rsvd1: 8,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ wcr_tag_mode: 1,
+ wcr_widget_id: 4;
+ } wcr_fields_s;
+} hubii_wcr_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iwcr_dir_con wcr_fields_s.wcr_dir_con
+typedef union hubii_wstat_u {
+ u64 reg_value;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 rsvd1: 31,
+ crazy: 1,
+ rsvd2: 8,
+ llp_tx_cnt: 8,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd3: 6,
+ tx_max_rtry: 1,
+ rsvd4: 2,
+ xt_tail_to: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ xt_crd_to: 1,
+ pending: 4;
+ } wstat_fields_s;
+} hubii_wstat_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union hubii_ilcsr_u {
+ u64 icsr_reg_value;
+ struct {
+ u64 icsr_rsvd: 22,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ icsr_max_burst: 10,
+ icsr_rsvd4: 6,
+ icsr_max_retry: 10,
+ icsr_rsvd3: 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ icsr_lnk_stat: 2,
+ icsr_bm8: 1,
+ icsr_llp_en: 1,
+ icsr_rsvd2: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ icsr_wrm_reset: 1,
+ icsr_rsvd1: 2,
+ icsr_null_to: 6;
+ } icsr_fields_s;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} hubii_ilcsr_t;
+typedef union hubii_iowa_u {
+ u64 iowa_reg_value;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 iowa_rsvd: 48,
+ iowa_wxoac: 8,
+ iowa_rsvd1: 7,
+ iowa_w0oac: 1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } iowa_fields_s;
+} hubii_iowa_t;
+typedef union hubii_iiwa_u {
+ u64 iiwa_reg_value;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ u64 iiwa_rsvd: 48,
+ iiwa_wxiac: 8,
+ iiwa_rsvd1: 7,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ iiwa_w0iac: 1;
+ } iiwa_fields_s;
+} hubii_iiwa_t;
+typedef union hubii_illr_u {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 illr_reg_value;
+ struct {
+ u64 illr_rsvd: 32,
+ illr_cb_cnt: 16,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ illr_sn_cnt: 16;
+ } illr_fields_s;
+} hubii_illr_t;
+typedef union io_perf_sel {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 perf_sel_reg;
+ struct {
+ u64 perf_rsvd : 48,
+ perf_icct : 8,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ perf_ippr1 : 4,
+ perf_ippr0 : 4;
+ } perf_sel_bits;
+} io_perf_sel_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union io_perf_cnt {
+ u64 perf_cnt;
+ struct {
+ u64 perf_rsvd1 : 32,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ perf_rsvd2 : 12,
+ perf_cnt : 20;
+ } perf_cnt_bits;
+} io_perf_cnt_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define LNK_STAT_WORKING 0x2
+#define IIO_LLP_CB_MAX 0xffff
+#define IIO_LLP_SN_MAX 0xffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_NUM_IPRBS (9)
+#define IIO_IOPRB_0 0x400198  
+#define IIO_IOPRB_8 0x4001a0  
+#define IIO_IOPRB_9 0x4001a8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IOPRB_A 0x4001b0  
+#define IIO_IOPRB_B 0x4001b8  
+#define IIO_IOPRB_C 0x4001c0  
+#define IIO_IOPRB_D 0x4001c8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IOPRB_E 0x4001d0  
+#define IIO_IOPRB_F 0x4001d8  
+#define IIO_IXCC 0x4001e0  
+#define IIO_IXTCC IIO_IXCC
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IMEM 0x4001e8  
+#define IIO_IXTT 0x4001f0  
+#define IIO_IECLR 0x4001f8  
+#define IIO_IBCN 0x400200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IMEM_W0ESD 0x1  
+#define IIO_IMEM_B0ESD (1 << 4)  
+#define IIO_IMEM_B1ESD (1 << 8)  
+#define IIO_IPCA 0x400300  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_NUM_PRTES 8  
+#define IIO_PRTE_0 0x400308  
+#define IIO_PRTE(_x) (IIO_PRTE_0 + (8 * (_x)))
+#define IIO_WIDPRTE(x) IIO_PRTE(((x) - 8))  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IPDR 0x400388  
+#define IIO_ICDR 0x400390  
+#define IIO_IFDR 0x400398  
+#define IIO_IIAP 0x4003a0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IMMR IIO_IIAP
+#define IIO_ICMR 0x4003a8  
+#define IIO_ICCR 0x4003b0  
+#define IIO_ICTO 0x4003b8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICTP 0x4003c0  
+#define IIO_ICMR_PC_VLD_SHFT 36
+#define IIO_ICMR_PC_VLD_MASK (0x7fffUL << IIO_ICMR_PC_VLD_SHFT)
+#define IIO_ICMR_CRB_VLD_SHFT 20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICMR_CRB_VLD_MASK (0x7fffUL << IIO_ICMR_CRB_VLD_SHFT)
+#define IIO_ICMR_FC_CNT_SHFT 16
+#define IIO_ICMR_FC_CNT_MASK (0xf << IIO_ICMR_FC_CNT_SHFT)
+#define IIO_ICMR_C_CNT_SHFT 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICMR_C_CNT_MASK (0xf << IIO_ICMR_C_CNT_SHFT)
+#define IIO_ICMR_P_CNT_SHFT 0
+#define IIO_ICMR_P_CNT_MASK (0xf << IIO_ICMR_P_CNT_SHFT)
+#define IIO_ICMR_PRECISE (1UL << 52)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICMR_CLR_RPPD (1UL << 13)
+#define IIO_ICMR_CLR_RQPD (1UL << 12)
+#define IIO_IPDR_PND (1 << 4)
+#define IIO_ICDR_PND (1 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICCR_PENDING (0x10000)
+#define IIO_ICCR_CMD_MASK (0xFF)
+#define IIO_ICCR_CMD_SHFT (7)
+#define IIO_ICCR_CMD_NOP (0x0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICCR_CMD_WAKE (0x100)  
+#define IIO_ICCR_CMD_TIMEOUT (0x200)  
+#define IIO_ICCR_CMD_EJECT (0x400)  
+#define IIO_ICCR_CMD_FLUSH (0x800)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_NUM_CRBS 15  
+#define IIO_NUM_NORMAL_CRBS 12  
+#define IIO_NUM_PC_CRBS 4  
+#define IIO_ICRB_OFFSET 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_0 0x400400
+#define IIO_ICRB_A(_x) (IIO_ICRB_0 + (4 * IIO_ICRB_OFFSET * (_x)))
+#define IIO_ICRB_B(_x) (IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET)
+#define IIO_ICRB_C(_x) (IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_D(_x) (IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET)
+#ifndef __ASSEMBLY__
+typedef union icrba_u {
+ u64 reg_value;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ u64 resvd: 6,
+ stall_bte0: 1,
+ stall_bte1: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ error: 1,
+ ecode: 3,
+ lnetuce: 1,
+ mark: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ xerr: 1,
+ sidn: 4,
+ tnum: 5,
+ addr: 38,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ valid: 1,
+ iow: 1;
+ } icrba_fields_s;
+} icrba_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union h1_icrba_u {
+ u64 reg_value;
+ struct {
+ u64 resvd: 6,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unused: 1,
+ error: 1,
+ ecode: 4,
+ lnetuce: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ mark: 1,
+ xerr: 1,
+ sidn: 4,
+ tnum: 5,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ addr: 38,
+ valid: 1,
+ iow: 1;
+ } h1_icrba_fields_s;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} h1_icrba_t;
+#define ICRBN_A_CERR_SHFT 54
+#define ICRBN_A_ERR_MASK 0x3ff
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_ADDR_SHFT 2  
+#define IIO_ICRB_ECODE_DERR 0  
+#define IIO_ICRB_ECODE_PERR 1  
+#define IIO_ICRB_ECODE_WERR 2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_ECODE_AERR 3  
+#define IIO_ICRB_ECODE_PWERR 4  
+#define IIO_ICRB_ECODE_PRERR 5  
+#define IIO_ICRB_ECODE_TOUT 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_ECODE_XTERR 7  
+#ifndef __ASSEMBLY__
+typedef union icrbb_u {
+ u64 reg_value;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ u64 rsvd1: 5,
+ btenum: 1,
+ cohtrans: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ xtsize: 2,
+ srcnode: 9,
+ srcinit: 2,
+ useold: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ imsgtype: 2,
+ imsg: 8,
+ initator: 3,
+ reqtype: 5,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd2: 7,
+ ackcnt: 11,
+ resp: 1,
+ ack: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ hold: 1,
+ wb_pend:1,
+ intvn: 1,
+ stall_ib: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ stall_intr: 1;
+ } icrbb_field_s;
+} icrbb_t;
+typedef union h1_icrbb_u {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 reg_value;
+ struct {
+ u64 rsvd1: 5,
+ btenum: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ cohtrans: 1,
+ xtsize: 2,
+ srcnode: 9,
+ srcinit: 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ useold: 1,
+ imsgtype: 2,
+ imsg: 8,
+ initator: 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd2: 1,
+ pcache: 1,
+ reqtype: 5,
+ stl_ib: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ stl_intr: 1,
+ stl_bte0: 1,
+ stl_bte1: 1,
+ intrvn: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ackcnt: 11,
+ resp: 1,
+ ack: 1,
+ hold: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ wb_pend:1,
+ sleep: 1,
+ pnd_reply: 1,
+ pnd_req: 1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } h1_icrbb_field_s;
+} h1_icrbb_t;
+#define b_imsgtype icrbb_field_s.imsgtype
+#define b_btenum icrbb_field_s.btenum
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define b_cohtrans icrbb_field_s.cohtrans
+#define b_xtsize icrbb_field_s.xtsize
+#define b_srcnode icrbb_field_s.srcnode
+#define b_srcinit icrbb_field_s.srcinit
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define b_imsgtype icrbb_field_s.imsgtype
+#define b_imsg icrbb_field_s.imsg
+#define b_initiator icrbb_field_s.initiator
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_XTSIZE_DW 0  
+#define IIO_ICRB_XTSIZE_32 1  
+#define IIO_ICRB_XTSIZE_128 2  
+#define IIO_ICRB_PROC0 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_PROC1 1  
+#define IIO_ICRB_GB_REQ 2  
+#define IIO_ICRB_IO_REQ 3  
+#define IIO_ICRB_IMSGT_XTALK 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_IMSGT_BTE 1  
+#define IIO_ICRB_IMSGT_SN0NET 2  
+#define IIO_ICRB_IMSGT_CRB 3  
+#define IIO_ICRB_INIT_XTALK 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_INIT_BTE0 0x1  
+#define IIO_ICRB_INIT_SN0NET 0x2  
+#define IIO_ICRB_INIT_CRB 0x3  
+#define IIO_ICRB_INIT_BTE1 0x5  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_REQ_DWRD 0  
+#define IIO_ICRB_REQ_QCLRD 1  
+#define IIO_ICRB_REQ_BLKRD 2  
+#define IIO_ICRB_REQ_RSHU 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_REQ_REXU 7  
+#define IIO_ICRB_REQ_RDEX 8  
+#define IIO_ICRB_REQ_WINC 9  
+#define IIO_ICRB_REQ_BWINV 10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_REQ_PIORD 11  
+#define IIO_ICRB_REQ_PIOWR 12  
+#define IIO_ICRB_REQ_PRDM 13  
+#define IIO_ICRB_REQ_PWRM 14  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_ICRB_REQ_PTPWR 15  
+#define IIO_ICRB_REQ_WB 16  
+#define IIO_ICRB_REQ_DEX 17  
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union icrbc_s {
+ u64 reg_value;
+ struct {
+ u64 rsvd: 6,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sleep: 1,
+ pricnt: 4,
+ pripsc: 4,
+ bteop: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ push_be: 34,
+ suppl: 11,
+ barrop: 1,
+ doresp: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ gbr: 1;
+ } icrbc_field_s;
+} icrbc_t;
+#define c_pricnt icrbc_field_s.pricnt
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define c_pripsc icrbc_field_s.pripsc
+#define c_bteop icrbc_field_s.bteop
+#define c_bteaddr icrbc_field_s.push_be  
+#define c_benable icrbc_field_s.push_be  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define c_suppl icrbc_field_s.suppl
+#define c_barrop icrbc_field_s.barrop
+#define c_doresp icrbc_field_s.doresp
+#define c_gbr icrbc_field_s.gbr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef __ASSEMBLY__
+typedef union icrbd_s {
+ u64 reg_value;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ u64 rsvd: 38,
+ toutvld: 1,
+ ctxtvld: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd2: 1,
+ context: 15,
+ timeout: 8;
+ } icrbd_field_s;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} icrbd_t;
+#define icrbd_toutvld icrbd_field_s.toutvld
+#define icrbd_ctxtvld icrbd_field_s.ctxtvld
+#define icrbd_context icrbd_field_s.context
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union hubii_ifdr_u {
+ u64 hi_ifdr_value;
+ struct {
+ u64 ifdr_rsvd: 49,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ifdr_maxrp: 7,
+ ifdr_rsvd1: 1,
+ ifdr_maxrq: 7;
+ } hi_ifdr_fields;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} hubii_ifdr_t;
+#endif
+#define IIO_IBLS_0 0x410000  
+#define IIO_IBSA_0 0x410008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IBDA_0 0x410010  
+#define IIO_IBCT_0 0x410018  
+#define IIO_IBNA_0 0x410020  
+#define IIO_IBNR_0 IIO_IBNA_0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IBIA_0 0x410028  
+#define IIO_IBLS_1 0x420000  
+#define IIO_IBSA_1 0x420008  
+#define IIO_IBDA_1 0x420010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IBCT_1 0x420018  
+#define IIO_IBNA_1 0x420020  
+#define IIO_IBNR_1 IIO_IBNA_1
+#define IIO_IBIA_1 0x420028  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_IPCR 0x430000  
+#define IIO_IPPR 0x430008  
+#define IECLR_BTE1 (1 << 18)  
+#define IECLR_BTE0 (1 << 17)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IECLR_CRAZY (1 << 16)  
+#define IECLR_PRB_F (1 << 15)  
+#define IECLR_PRB_E (1 << 14)  
+#define IECLR_PRB_D (1 << 13)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IECLR_PRB_C (1 << 12)  
+#define IECLR_PRB_B (1 << 11)  
+#define IECLR_PRB_A (1 << 10)  
+#define IECLR_PRB_9 (1 << 9)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IECLR_PRB_8 (1 << 8)  
+#define IECLR_PRB_0 (1 << 0)  
+#ifndef __ASSEMBLY__
+typedef union iprte_a {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 entry;
+ struct {
+ u64 rsvd1 : 7,
+ valid : 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd2 : 1,
+ srcnode : 9,
+ initiator : 2,
+ rsvd3 : 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ addr : 38,
+ rsvd4 : 3;
+ } iprte_fields;
+} iprte_a_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iprte_valid iprte_fields.valid
+#define iprte_timeout iprte_fields.timeout
+#define iprte_srcnode iprte_fields.srcnode
+#define iprte_init iprte_fields.initiator
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iprte_addr iprte_fields.addr
+#endif
+#define IPRTE_ADDRSHFT 3
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union iprb_u {
+ u64 reg_value;
+ struct {
+ u64 rsvd1: 15,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ error: 1,
+ ovflow: 5,
+ fire_and_forget: 1,
+ mode: 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd2: 2,
+ bnakctr: 14,
+ rsvd3: 2,
+ anakctr: 14,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ xtalkctr: 8;
+ } iprb_fields_s;
+} iprb_t;
+#define iprb_regval reg_value
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iprb_error iprb_fields_s.error
+#define iprb_ovflow iprb_fields_s.ovflow
+#define iprb_ff iprb_fields_s.fire_and_forget
+#define iprb_mode iprb_fields_s.mode
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define iprb_bnakctr iprb_fields_s.bnakctr
+#define iprb_anakctr iprb_fields_s.anakctr
+#define iprb_xtalkctr iprb_fields_s.xtalkctr
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IPRB_MODE_NORMAL (0)
+#define IPRB_MODE_COLLECT_A (1)  
+#define IPRB_MODE_SERVICE_A (2)  
+#define IPRB_MODE_SERVICE_B (3)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+typedef union icrbp_a {
+ u64 ip_reg;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 error: 1,
+ ln_uce: 1,
+ ln_ae: 1,
+ ln_werr:1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ln_aerr:1,
+ ln_perr:1,
+ timeout:1,
+ l_bdpkt:1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ c_bdpkt:1,
+ c_err: 1,
+ rsvd1: 12,
+ valid: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sidn: 4,
+ tnum: 5,
+ bo: 1,
+ resprqd:1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ gbr: 1,
+ size: 2,
+ excl: 4,
+ stall: 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ intvn: 1,
+ resp: 1,
+ ack: 1,
+ hold: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ wb: 1,
+ ack_cnt:11,
+ tscaler:4;
+ } ip_fmt;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} icrbp_a_t;
+#endif
+#define ICRBP_A_CERR_SHFT 54
+#define ICRBP_A_ERR_MASK 0x3ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+typedef union hubii_idsr {
+ u64 iin_reg;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 rsvd1 : 35,
+ isent : 1,
+ rsvd2 : 3,
+ ienable: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd : 7,
+ node : 9,
+ rsvd4 : 1,
+ level : 7;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } iin_fmt;
+} hubii_idsr_t;
+#endif
+#define IBLS_BUSY (0x1 << 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IBLS_ERROR_SHFT 16
+#define IBLS_ERROR (0x1 << IBLS_ERROR_SHFT)
+#define IBLS_LENGTH_MASK 0xffff
+#define IBCT_POISON (0x1 << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IBCT_NOTIFY (0x1 << 4)
+#define IBCT_ZFIL_MODE (0x1 << 0)
+#define IBIA_LEVEL_SHFT 16
+#define IBIA_LEVEL_MASK (0x7f << IBIA_LEVEL_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IBIA_NODE_ID_SHFT 0
+#define IBIA_NODE_ID_MASK (0x1ff)
+#define HUB_NUM_WIDGET 9
+#define HUB_WIDGET_ID_MIN 0x8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HUB_WIDGET_ID_MAX 0xf
+#define HUB_WIDGET_PART_NUM 0xc101
+#define MAX_HUBS_PER_XBOW 2
+#define IIO_WCR_WID_GET(nasid) (REMOTE_HUB_L(nasid, III_WCR) & 0xf)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IIO_WST_ERROR_MASK (UINT64_CAST 1 << 32)  
+#define HUBII_XBOW_CREDIT 3
+#define HUBII_XBOW_REV2_CREDIT 4
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/sn/sn0/hubmd.h b/libc/kernel/arch-mips/asm/sn/sn0/hubmd.h
new file mode 100644
index 0000000..9f0893f
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/sn0/hubmd.h
@@ -0,0 +1,611 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_SN0_HUBMD_H
+#define _ASM_SN_SN0_HUBMD_H
+#define CACHE_SLINE_SIZE 128  
+#define MAX_REGIONS 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PAGE_SIZE 4096  
+#define MD_PAGE_NUM_SHFT 12  
+#define MD_BASE 0x200000
+#define MD_BASE_PERF 0x210000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_BASE_JUNK 0x220000
+#define MD_IO_PROTECT 0x200000  
+#define MD_IO_PROT_OVRRD 0x200008  
+#define MD_HSPEC_PROTECT 0x200010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MEMORY_CONFIG 0x200018  
+#define MD_REFRESH_CONTROL 0x200020  
+#define MD_FANDOP_CAC_STAT 0x200028  
+#define MD_MIG_DIFF_THRESH 0x200030  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_VALUE_THRESH 0x200038  
+#define MD_MIG_CANDIDATE 0x200040  
+#define MD_MIG_CANDIDATE_CLR 0x200048  
+#define MD_DIR_ERROR 0x200050  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_DIR_ERROR_CLR 0x200058  
+#define MD_PROTOCOL_ERROR 0x200060  
+#define MD_PROTOCOL_ERROR_CLR 0x200068  
+#define MD_MEM_ERROR 0x200070  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MEM_ERROR_CLR 0x200078  
+#define MD_MISC_ERROR 0x200080  
+#define MD_MISC_ERROR_CLR 0x200088  
+#define MD_MEM_DIMM_INIT 0x200090  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_DIR_DIMM_INIT 0x200098  
+#define MD_MOQ_SIZE 0x2000a0  
+#define MD_MLAN_CTL 0x2000a8  
+#define MD_PERF_SEL 0x210000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PERF_CNT0 0x210010  
+#define MD_PERF_CNT1 0x210018  
+#define MD_PERF_CNT2 0x210020  
+#define MD_PERF_CNT3 0x210028  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PERF_CNT4 0x210030  
+#define MD_PERF_CNT5 0x210038  
+#define MD_UREG0_0 0x220000  
+#define MD_UREG0_1 0x220008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_UREG0_2 0x220010  
+#define MD_UREG0_3 0x220018  
+#define MD_UREG0_4 0x220020  
+#define MD_UREG0_5 0x220028  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_UREG0_6 0x220030  
+#define MD_UREG0_7 0x220038  
+#define MD_SLOTID_USTAT 0x220048  
+#define MD_LED0 0x220050  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_LED1 0x220058  
+#define MD_UREG1_0 0x220080  
+#define MD_UREG1_1 0x220088  
+#define MD_UREG1_2 0x220090  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_UREG1_3 0x220098  
+#define MD_UREG1_4 0x2200a0  
+#define MD_UREG1_5 0x2200a8  
+#define MD_UREG1_6 0x2200b0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_UREG1_7 0x2200b8  
+#define MD_UREG1_8 0x2200c0  
+#define MD_UREG1_9 0x2200c8  
+#define MD_UREG1_10 0x2200d0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_UREG1_11 0x2200d8  
+#define MD_UREG1_12 0x2200e0  
+#define MD_UREG1_13 0x2200e8  
+#define MD_UREG1_14 0x2200f0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_UREG1_15 0x2200f8  
+#define MD_MEM_BANKS 8  
+#define MD_SIZE_EMPTY 0  
+#define MD_SIZE_8MB 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SIZE_16MB 2
+#define MD_SIZE_32MB 3  
+#define MD_SIZE_64MB 4  
+#define MD_SIZE_128MB 5  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SIZE_256MB 6
+#define MD_SIZE_512MB 7  
+#define MD_SIZE_1GB 8
+#define MD_SIZE_2GB 9
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SIZE_4GB 10
+#define MD_SIZE_BYTES(size) ((size) == 0 ? 0 : 0x400000L << (size))
+#define MD_SIZE_MBYTES(size) ((size) == 0 ? 0 : 4 << (size))
+#define MMC_FPROM_CYC_SHFT 49  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_FPROM_CYC_MASK (UINT64_CAST 31 << 49)  
+#define MMC_FPROM_WR_SHFT 44  
+#define MMC_FPROM_WR_MASK (UINT64_CAST 31 << 44)
+#define MMC_UCTLR_CYC_SHFT 39
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_UCTLR_CYC_MASK (UINT64_CAST 31 << 39)
+#define MMC_UCTLR_WR_SHFT 34
+#define MMC_UCTLR_WR_MASK (UINT64_CAST 31 << 34)
+#define MMC_DIMM0_SEL_SHFT 32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_DIMM0_SEL_MASK (UINT64_CAST 3 << 32)
+#define MMC_IO_PROT_EN_SHFT 31
+#define MMC_IO_PROT_EN_MASK (UINT64_CAST 1 << 31)
+#define MMC_IO_PROT (UINT64_CAST 1 << 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_ARB_MLSS_SHFT 30
+#define MMC_ARB_MLSS_MASK (UINT64_CAST 1 << 30)
+#define MMC_ARB_MLSS (UINT64_CAST 1 << 30)
+#define MMC_IGNORE_ECC_SHFT 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_IGNORE_ECC_MASK (UINT64_CAST 1 << 29)
+#define MMC_IGNORE_ECC (UINT64_CAST 1 << 29)
+#define MMC_DIR_PREMIUM_SHFT 28
+#define MMC_DIR_PREMIUM_MASK (UINT64_CAST 1 << 28)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_DIR_PREMIUM (UINT64_CAST 1 << 28)
+#define MMC_REPLY_GUAR_SHFT 24
+#define MMC_REPLY_GUAR_MASK (UINT64_CAST 15 << 24)
+#define MMC_BANK_SHFT(_b) ((_b) * 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMC_BANK_MASK(_b) (UINT64_CAST 7 << MMC_BANK_SHFT(_b))
+#define MMC_BANK_ALL_MASK 0xffffff
+#define MMC_RESET_DEFAULTS (UINT64_CAST 0x0f << MMC_FPROM_CYC_SHFT |   UINT64_CAST 0x07 << MMC_FPROM_WR_SHFT |   UINT64_CAST 0x1f << MMC_UCTLR_CYC_SHFT |   UINT64_CAST 0x0f << MMC_UCTLR_WR_SHFT |   MMC_IGNORE_ECC | MMC_DIR_PREMIUM |   UINT64_CAST 0x0f << MMC_REPLY_GUAR_SHFT |   MMC_BANK_ALL_MASK)
+#define MRC_ENABLE_SHFT 63
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MRC_ENABLE_MASK (UINT64_CAST 1 << 63)
+#define MRC_ENABLE (UINT64_CAST 1 << 63)
+#define MRC_COUNTER_SHFT 12
+#define MRC_COUNTER_MASK (UINT64_CAST 0xfff << 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MRC_CNT_THRESH_MASK 0xfff
+#define MRC_RESET_DEFAULTS (UINT64_CAST 0x400)
+#define MDI_SELECT_SHFT 32
+#define MDI_SELECT_MASK (UINT64_CAST 0x0f << 32)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MDI_DIMM_MODE_MASK (UINT64_CAST 0xfff)
+#define MMS_RP_SIZE_SHFT 8
+#define MMS_RP_SIZE_MASK (UINT64_CAST 0x3f << 8)
+#define MMS_RQ_SIZE_SHFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMS_RQ_SIZE_MASK (UINT64_CAST 0x1f)
+#define MMS_RESET_DEFAULTS (0x32 << 8 | 0x12)
+#define MFC_VALID_SHFT 63
+#define MFC_VALID_MASK (UINT64_CAST 1 << 63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MFC_VALID (UINT64_CAST 1 << 63)
+#define MFC_ADDR_SHFT 6
+#define MFC_ADDR_MASK (UINT64_CAST 0x3ffffff)
+#define MLAN_PHI1_SHFT 27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MLAN_PHI1_MASK (UINT64_CAST 0x7f << 27)
+#define MLAN_PHI0_SHFT 20
+#define MLAN_PHI0_MASK (UINT64_CAST 0x7f << 27)
+#define MLAN_PULSE_SHFT 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MLAN_PULSE_MASK (UINT64_CAST 0x3ff << 10)
+#define MLAN_SAMPLE_SHFT 2
+#define MLAN_SAMPLE_MASK (UINT64_CAST 0xff << 2)
+#define MLAN_DONE_SHFT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MLAN_DONE_MASK 2
+#define MLAN_DONE (UINT64_CAST 0x02)
+#define MLAN_RD_DATA (UINT64_CAST 0x01)
+#define MLAN_RESET_DEFAULTS (UINT64_CAST 0x31 << MLAN_PHI1_SHFT |   UINT64_CAST 0x31 << MLAN_PHI0_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSU_CORECLK_TST_SHFT 7  
+#define MSU_CORECLK_TST_MASK (UINT64_CAST 1 << 7)
+#define MSU_CORECLK_TST (UINT64_CAST 1 << 7)
+#define MSU_CORECLK_SHFT 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSU_CORECLK_MASK (UINT64_CAST 1 << 6)
+#define MSU_CORECLK (UINT64_CAST 1 << 6)
+#define MSU_NETSYNC_SHFT 5  
+#define MSU_NETSYNC_MASK (UINT64_CAST 1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSU_NETSYNC (UINT64_CAST 1 << 5)
+#define MSU_FPROMRDY_SHFT 4  
+#define MSU_FPROMRDY_MASK (UINT64_CAST 1 << 4)
+#define MSU_FPROMRDY (UINT64_CAST 1 << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSU_I2CINTR_SHFT 3  
+#define MSU_I2CINTR_MASK (UINT64_CAST 1 << 3)
+#define MSU_I2CINTR (UINT64_CAST 1 << 3)
+#define MSU_SLOTID_MASK 0xff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSU_SN0_SLOTID_SHFT 0  
+#define MSU_SN0_SLOTID_MASK (UINT64_CAST 7)
+#define MSU_SN00_SLOTID_SHFT 7
+#define MSU_SN00_SLOTID_MASK (UINT64_CAST 0x80)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MSU_PIMM_PSC_SHFT 4
+#define MSU_PIMM_PSC_MASK (0xf << MSU_PIMM_PSC_SHFT)
+#define MD_MIG_DIFF_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
+#define MD_MIG_DIFF_THRES_VALID_SHFT 63
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_DIFF_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
+#define MD_MIG_VALUE_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
+#define MD_MIG_VALUE_THRES_VALID_SHFT 63
+#define MD_MIG_VALUE_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_CANDIDATE_VALID_MASK (UINT64_CAST 0x1 << 63)
+#define MD_MIG_CANDIDATE_VALID_SHFT 63
+#define MD_MIG_CANDIDATE_TYPE_MASK (UINT64_CAST 0x1 << 30)
+#define MD_MIG_CANDIDATE_TYPE_SHFT 30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_CANDIDATE_OVERRUN_MASK (UINT64_CAST 0x1 << 29)
+#define MD_MIG_CANDIDATE_OVERRUN_SHFT 29
+#define MD_MIG_CANDIDATE_INITIATOR_MASK (UINT64_CAST 0x7ff << 18)
+#define MD_MIG_CANDIDATE_INITIATOR_SHFT 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_CANDIDATE_NODEID_MASK (UINT64_CAST 0x1ff << 20)
+#define MD_MIG_CANDIDATE_NODEID_SHFT 20
+#define MD_MIG_CANDIDATE_ADDR_MASK (UINT64_CAST 0x3ffff)
+#define MD_MIG_CANDIDATE_ADDR_SHFT 14  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_BANK_SHFT 29  
+#define MD_BANK_MASK (UINT64_CAST 7 << 29)
+#define MD_BANK_SIZE (UINT64_CAST 1 << MD_BANK_SHFT)  
+#define MD_BANK_OFFSET(_b) (UINT64_CAST (_b) << MD_BANK_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_DIR_SHARED (UINT64_CAST 0x0)  
+#define MD_DIR_POISONED (UINT64_CAST 0x1)  
+#define MD_DIR_EXCLUSIVE (UINT64_CAST 0x2)  
+#define MD_DIR_BUSY_SHARED (UINT64_CAST 0x3)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_DIR_BUSY_EXCL (UINT64_CAST 0x4)  
+#define MD_DIR_WAIT (UINT64_CAST 0x5)  
+#define MD_DIR_UNOWNED (UINT64_CAST 0x7)  
+#define MD_DIR_FORCE_ECC (UINT64_CAST 1 << 63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_MASK 0xffffffffffff  
+#define MD_PDIR_ECC_SHFT 0  
+#define MD_PDIR_ECC_MASK 0x7f
+#define MD_PDIR_PRIO_SHFT 8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_PRIO_MASK (0xf << 8)
+#define MD_PDIR_AX_SHFT 7  
+#define MD_PDIR_AX_MASK (1 << 7)
+#define MD_PDIR_AX (1 << 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_FINE_SHFT 12  
+#define MD_PDIR_FINE_MASK (1 << 12)
+#define MD_PDIR_FINE (1 << 12)
+#define MD_PDIR_OCT_SHFT 13  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_OCT_MASK (7 << 13)
+#define MD_PDIR_STATE_SHFT 13  
+#define MD_PDIR_STATE_MASK (7 << 13)
+#define MD_PDIR_ONECNT_SHFT 16  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_ONECNT_MASK (0x3f << 16)
+#define MD_PDIR_PTR_SHFT 22  
+#define MD_PDIR_PTR_MASK (UINT64_CAST 0x7ff << 22)
+#define MD_PDIR_VECMSB_SHFT 22  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_VECMSB_BITMASK 0x3ffffff
+#define MD_PDIR_VECMSB_BITSHFT 27
+#define MD_PDIR_VECMSB_MASK (UINT64_CAST MD_PDIR_VECMSB_BITMASK << 22)
+#define MD_PDIR_CWOFF_SHFT 7  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_CWOFF_MASK (7 << 7)
+#define MD_PDIR_VECLSB_SHFT 10  
+#define MD_PDIR_VECLSB_BITMASK (UINT64_CAST 0x3fffffffff)
+#define MD_PDIR_VECLSB_BITSHFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PDIR_VECLSB_MASK (MD_PDIR_VECLSB_BITMASK << 10)
+#define MD_PDIR_INIT_LO (MD_DIR_UNOWNED << MD_PDIR_STATE_SHFT |   MD_PDIR_AX)
+#define MD_PDIR_INIT_HI 0
+#define MD_PDIR_INIT_PROT (MD_PROT_RW << MD_PPROT_IO_SHFT |   MD_PROT_RW << MD_PPROT_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_MASK 0xffff  
+#define MD_SDIR_ECC_SHFT 0  
+#define MD_SDIR_ECC_MASK 0x1f
+#define MD_SDIR_PRIO_SHFT 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_PRIO_MASK (1 << 6)
+#define MD_SDIR_AX_SHFT 5  
+#define MD_SDIR_AX_MASK (1 << 5)
+#define MD_SDIR_AX (1 << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_STATE_SHFT 7  
+#define MD_SDIR_STATE_MASK (7 << 7)
+#define MD_SDIR_PTR_SHFT 10  
+#define MD_SDIR_PTR_MASK (0x3f << 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_CWOFF_SHFT 5  
+#define MD_SDIR_CWOFF_MASK (7 << 5)
+#define MD_SDIR_VECMSB_SHFT 11  
+#define MD_SDIR_VECMSB_BITMASK 0x1f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_VECMSB_BITSHFT 7
+#define MD_SDIR_VECMSB_MASK (MD_SDIR_VECMSB_BITMASK << 11)
+#define MD_SDIR_VECLSB_SHFT 5  
+#define MD_SDIR_VECLSB_BITMASK 0x7ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_VECLSB_BITSHFT 0
+#define MD_SDIR_VECLSB_MASK (MD_SDIR_VECLSB_BITMASK << 5)
+#define MD_SDIR_INIT_LO (MD_DIR_UNOWNED << MD_SDIR_STATE_SHFT |   MD_SDIR_AX)
+#define MD_SDIR_INIT_HI 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SDIR_INIT_PROT (MD_PROT_RW << MD_SPROT_SHFT)
+#define MD_PROT_RW (UINT64_CAST 0x6)
+#define MD_PROT_RO (UINT64_CAST 0x3)
+#define MD_PROT_NO (UINT64_CAST 0x0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PROT_BAD (UINT64_CAST 0x5)
+#define MD_PPROT_SHFT 0  
+#define MD_PPROT_MASK 7
+#define MD_PPROT_MIGMD_SHFT 3  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PPROT_MIGMD_MASK (3 << 3)
+#define MD_PPROT_REFCNT_SHFT 5  
+#define MD_PPROT_REFCNT_WIDTH 0x7ffff
+#define MD_PPROT_REFCNT_MASK (MD_PPROT_REFCNT_WIDTH << 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PPROT_IO_SHFT 45  
+#define MD_PPROT_IO_MASK (UINT64_CAST 7 << 45)
+#define MD_SPROT_SHFT 0  
+#define MD_SPROT_MASK 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SPROT_MIGMD_SHFT 3  
+#define MD_SPROT_MIGMD_MASK (3 << 3)
+#define MD_SPROT_REFCNT_SHFT 5  
+#define MD_SPROT_REFCNT_WIDTH 0x7ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_SPROT_REFCNT_MASK (MD_SPROT_REFCNT_WIDTH << 5)
+#define MD_PROT_MIGMD_IREL (UINT64_CAST 0x3 << 3)
+#define MD_PROT_MIGMD_IABS (UINT64_CAST 0x2 << 3)
+#define MD_PROT_MIGMD_PREL (UINT64_CAST 0x1 << 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PROT_MIGMD_OFF (UINT64_CAST 0x0 << 3)
+#ifndef __ASSEMBLY__
+#define CPU_LED_ADDR(_nasid, _slice)   (private.p_sn00 ?   REMOTE_HUB_ADDR((_nasid), MD_UREG1_0 + ((_slice) << 5)) :   REMOTE_HUB_ADDR((_nasid), MD_LED0 + ((_slice) << 3)))
+#define SET_CPU_LEDS(_nasid, _slice, _val)   (HUB_S(CPU_LED_ADDR(_nasid, _slice), (_val)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SET_MY_LEDS(_v)   SET_CPU_LEDS(get_nasid(), get_slice(), (_v))
+#define DIRTYPE_PREMIUM 1
+#define DIRTYPE_STANDARD 0
+#define MD_MEMORY_CONFIG_DIR_TYPE_GET(region) (  (REMOTE_HUB_L(region, MD_MEMORY_CONFIG) & MMC_DIR_PREMIUM_MASK) >>   MMC_DIR_PREMIUM_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_DIFF_THRESH_GET(region) (   REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) &   MD_MIG_DIFF_THRES_VALUE_MASK)
+#define MD_MIG_DIFF_THRESH_SET(region, value) (   REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH,   MD_MIG_DIFF_THRES_VALID_MASK | (value)))
+#define MD_MIG_DIFF_THRESH_DISABLE(region) (   REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH,   REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH)   & ~MD_MIG_DIFF_THRES_VALID_MASK))
+#define MD_MIG_DIFF_THRESH_ENABLE(region) (   REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH,   REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH)   | MD_MIG_DIFF_THRES_VALID_MASK))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_DIFF_THRESH_IS_ENABLED(region) (   REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) &   MD_MIG_DIFF_THRES_VALID_MASK)
+#define MD_MIG_VALUE_THRESH_GET(region) (   REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) &   MD_MIG_VALUE_THRES_VALUE_MASK)
+#define MD_MIG_VALUE_THRESH_SET(region, value) (   REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH,   MD_MIG_VALUE_THRES_VALID_MASK | (value)))
+#define MD_MIG_VALUE_THRESH_DISABLE(region) (   REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH,   REMOTE_HUB_L(region, MD_MIG_VALUE_THRESH)   & ~MD_MIG_VALUE_THRES_VALID_MASK))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_VALUE_THRESH_ENABLE(region) (   REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH,   REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH)   | MD_MIG_VALUE_THRES_VALID_MASK))
+#define MD_MIG_VALUE_THRESH_IS_ENABLED(region) (   REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) &   MD_MIG_VALUE_THRES_VALID_MASK)
+#define MD_MIG_CANDIDATE_GET(my_region_id) (   REMOTE_HUB_L((my_region_id), MD_MIG_CANDIDATE_CLR))
+#define MD_MIG_CANDIDATE_HWPFN(value) ((value) & MD_MIG_CANDIDATE_ADDR_MASK)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_MIG_CANDIDATE_NODEID(value) (   ((value) & MD_MIG_CANDIDATE_NODEID_MASK) >> MD_MIG_CANDIDATE_NODEID_SHFT)
+#define MD_MIG_CANDIDATE_TYPE(value) (   ((value) & MD_MIG_CANDIDATE_TYPE_MASK) >> MD_MIG_CANDIDATE_TYPE_SHFT)
+#define MD_MIG_CANDIDATE_VALID(value) (   ((value) & MD_MIG_CANDIDATE_VALID_MASK) >> MD_MIG_CANDIDATE_VALID_SHFT)
+#define MD_PPROT_REFCNT_GET(value) (   ((value) & MD_PPROT_REFCNT_MASK) >> MD_PPROT_REFCNT_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MD_PPROT_MIGMD_GET(value) (   ((value) & MD_PPROT_MIGMD_MASK) >> MD_PPROT_MIGMD_SHFT)
+#define MD_SPROT_REFCNT_GET(value) (   ((value) & MD_SPROT_REFCNT_MASK) >> MD_SPROT_REFCNT_SHFT)
+#define MD_SPROT_MIGMD_GET(value) (   ((value) & MD_SPROT_MIGMD_MASK) >> MD_SPROT_MIGMD_SHFT)
+struct dir_error_reg {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 uce_vld: 1,
+ ae_vld: 1,
+ ce_vld: 1,
+ rsvd1: 19,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bad_prot: 3,
+ bad_syn: 7,
+ rsvd2: 2,
+ hspec_addr:27,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uce_ovr: 1,
+ ae_ovr: 1,
+ ce_ovr: 1;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union md_dir_error {
+ u64 derr_reg;
+ struct dir_error_reg derr_fmt;
+} md_dir_error_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct mem_error_reg {
+ u64 uce_vld: 1,
+ ce_vld: 1,
+ rsvd1: 22,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ bad_syn: 8,
+ address: 29,
+ rsvd2: 1,
+ uce_ovr: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ce_ovr: 1;
+};
+typedef union md_mem_error {
+ u64 merr_reg;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct mem_error_reg merr_fmt;
+} md_mem_error_t;
+struct proto_error_reg {
+ u64 valid: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ rsvd1: 2,
+ initiator:11,
+ backoff: 2,
+ msg_type: 8,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ access: 2,
+ priority: 1,
+ dir_state: 4,
+ pointer_me:1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ address: 29,
+ rsvd2: 2,
+ overrun: 1;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union md_proto_error {
+ u64 perr_reg;
+ struct proto_error_reg perr_fmt;
+} md_proto_error_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct md_sdir_high_fmt {
+ unsigned short sd_hi_bvec : 11,
+ sd_hi_ecc : 5;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union md_sdir_high {
+ unsigned short sd_hi_val;
+ struct md_sdir_high_fmt sd_hi_fmt;
+}md_sdir_high_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct md_sdir_low_shared_fmt {
+ unsigned short sds_lo_bvec : 5,
+ sds_lo_unused: 1,
+ sds_lo_state : 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sds_lo_prio : 1,
+ sds_lo_ax : 1,
+ sds_lo_ecc : 5;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct md_sdir_low_exclusive_fmt {
+ unsigned short sde_lo_ptr : 6,
+ sde_lo_state : 3,
+ sde_lo_prio : 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sde_lo_ax : 1,
+ sde_lo_ecc : 5;
+};
+typedef union md_sdir_low {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short sd_lo_val;
+ struct md_sdir_low_exclusive_fmt sde_lo_fmt;
+ struct md_sdir_low_shared_fmt sds_lo_fmt;
+}md_sdir_low_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct md_pdir_high_fmt {
+ u64 pd_hi_unused : 16,
+ pd_hi_bvec : 38,
+ pd_hi_unused1 : 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pd_hi_ecc : 7;
+};
+typedef union md_pdir_high {
+ u64 pd_hi_val;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct md_pdir_high_fmt pd_hi_fmt;
+}md_pdir_high_t;
+struct md_pdir_low_shared_fmt {
+ u64 pds_lo_unused : 16,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pds_lo_bvec : 26,
+ pds_lo_cnt : 6,
+ pds_lo_state : 3,
+ pds_lo_ste : 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pds_lo_prio : 4,
+ pds_lo_ax : 1,
+ pds_lo_ecc : 7;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct md_pdir_low_exclusive_fmt {
+ u64 pde_lo_unused : 31,
+ pde_lo_ptr : 11,
+ pde_lo_unused1 : 6,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pde_lo_state : 3,
+ pde_lo_ste : 1,
+ pde_lo_prio : 4,
+ pde_lo_ax : 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pde_lo_ecc : 7;
+};
+typedef union md_pdir_loent {
+ u64 pd_lo_val;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct md_pdir_low_exclusive_fmt pde_lo_fmt;
+ struct md_pdir_low_shared_fmt pds_lo_fmt;
+}md_pdir_low_t;
+typedef union md_dir_high {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ md_sdir_high_t md_sdir_high;
+ md_pdir_high_t md_pdir_high;
+} md_dir_high_t;
+typedef union md_dir_low {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ md_sdir_low_t md_sdir_low;
+ md_pdir_low_t md_pdir_low;
+} md_dir_low_t;
+typedef struct bddir_entry {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ md_dir_low_t md_dir_low;
+ md_dir_high_t md_dir_high;
+} bddir_entry_t;
+typedef struct dir_mem_entry {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 prcpf[MAX_REGIONS];
+ bddir_entry_t directory_words[MD_PAGE_SIZE/CACHE_SLINE_SIZE];
+} dir_mem_entry_t;
+typedef union md_perf_sel {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 perf_sel_reg;
+ struct {
+ u64 perf_rsvd : 60,
+ perf_en : 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ perf_sel : 3;
+ } perf_sel_bits;
+} md_perf_sel_t;
+typedef union md_perf_cnt {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 perf_cnt;
+ struct {
+ u64 perf_rsvd : 44,
+ perf_cnt : 20;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } perf_cnt_bits;
+} md_perf_cnt_t;
+#endif
+#define DIR_ERROR_VALID_MASK 0xe000000000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DIR_ERROR_VALID_SHFT 61
+#define DIR_ERROR_VALID_UCE 0x8000000000000000
+#define DIR_ERROR_VALID_AE 0x4000000000000000
+#define DIR_ERROR_VALID_CE 0x2000000000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEM_ERROR_VALID_MASK 0xc000000000000000
+#define MEM_ERROR_VALID_SHFT 62
+#define MEM_ERROR_VALID_UCE 0x8000000000000000
+#define MEM_ERROR_VALID_CE 0x4000000000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PROTO_ERROR_VALID_MASK 0x8000000000000000
+#define MISC_ERROR_VALID_MASK 0x3ff
+#define DIR_ERR_HSPEC_MASK 0x3ffffff8
+#define ERROR_HSPEC_MASK 0x3ffffff8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ERROR_HSPEC_SHFT 3
+#define ERROR_ADDR_MASK 0xfffffff8
+#define ERROR_ADDR_SHFT 3
+#define MMCE_VALID_MASK 0x3ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMCE_ILL_MSG_SHFT 8
+#define MMCE_ILL_MSG_MASK (UINT64_CAST 0x03 << MMCE_ILL_MSG_SHFT)
+#define MMCE_ILL_REV_SHFT 6
+#define MMCE_ILL_REV_MASK (UINT64_CAST 0x03 << MMCE_ILL_REV_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMCE_LONG_PACK_SHFT 4
+#define MMCE_LONG_PACK_MASK (UINT64_CAST 0x03 << MMCE_lONG_PACK_SHFT)
+#define MMCE_SHORT_PACK_SHFT 2
+#define MMCE_SHORT_PACK_MASK (UINT64_CAST 0x03 << MMCE_SHORT_PACK_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MMCE_BAD_DATA_SHFT 0
+#define MMCE_BAD_DATA_MASK (UINT64_CAST 0x03 << MMCE_BAD_DATA_SHFT)
+#define MD_PERF_COUNTERS 6
+#define MD_PERF_SETS 6
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEM_DIMM_MASK 0xe0000000
+#define MEM_DIMM_SHFT 29
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/sn0/hubni.h b/libc/kernel/arch-mips/asm/sn/sn0/hubni.h
new file mode 100644
index 0000000..cb3658d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/sn0/hubni.h
@@ -0,0 +1,225 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SGI_SN0_HUBNI_H
+#define _ASM_SGI_SN0_HUBNI_H
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define NI_BASE 0x600000
+#define NI_BASE_TABLES 0x630000
+#define NI_STATUS_REV_ID 0x600000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_PORT_RESET 0x600008  
+#define NI_PROTECTION 0x600010  
+#define NI_GLOBAL_PARMS 0x600018  
+#define NI_SCRATCH_REG0 0x600100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_SCRATCH_REG1 0x600108  
+#define NI_DIAG_PARMS 0x600110  
+#define NI_VECTOR_PARMS 0x600200  
+#define NI_VECTOR 0x600208  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_VECTOR_DATA 0x600210  
+#define NI_VECTOR_STATUS 0x600300  
+#define NI_RETURN_VECTOR 0x600308  
+#define NI_VECTOR_READ_DATA 0x600310  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_VECTOR_CLEAR 0x600380  
+#define NI_IO_PROTECT 0x600400  
+#define NI_IO_PROT_OVRRD 0x600408  
+#define NI_AGE_CPU0_MEMORY 0x600500  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_AGE_CPU0_PIO 0x600508  
+#define NI_AGE_CPU1_MEMORY 0x600510  
+#define NI_AGE_CPU1_PIO 0x600518  
+#define NI_AGE_GBR_MEMORY 0x600520  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_AGE_GBR_PIO 0x600528  
+#define NI_AGE_IO_MEMORY 0x600530  
+#define NI_AGE_IO_PIO 0x600538  
+#define NI_AGE_REG_MIN NI_AGE_CPU0_MEMORY
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_AGE_REG_MAX NI_AGE_IO_PIO
+#define NI_PORT_PARMS 0x608000  
+#define NI_PORT_ERROR 0x608008  
+#define NI_PORT_ERROR_CLEAR 0x608088  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_META_TABLE0 0x638000  
+#define NI_META_TABLE(_x) (NI_META_TABLE0 + (8 * (_x)))
+#define NI_META_ENTRIES 32
+#define NI_LOCAL_TABLE0 0x638100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NI_LOCAL_TABLE(_x) (NI_LOCAL_TABLE0 + (8 * (_x)))
+#define NI_LOCAL_ENTRIES 16
+#define NSRI_8BITMODE_SHFT 30
+#define NSRI_8BITMODE_MASK (UINT64_CAST 0x1 << 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NSRI_LINKUP_SHFT 29
+#define NSRI_LINKUP_MASK (UINT64_CAST 0x1 << 29)
+#define NSRI_DOWNREASON_SHFT 28  
+#define NSRI_DOWNREASON_MASK (UINT64_CAST 0x1 << 28)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NSRI_MORENODES_SHFT 18
+#define NSRI_MORENODES_MASK (UINT64_CAST 1 << 18)  
+#define MORE_MEMORY 0
+#define MORE_NODES 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NSRI_REGIONSIZE_SHFT 17
+#define NSRI_REGIONSIZE_MASK (UINT64_CAST 1 << 17)  
+#define REGIONSIZE_FINE 1
+#define REGIONSIZE_COARSE 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NSRI_NODEID_SHFT 8
+#define NSRI_NODEID_MASK (UINT64_CAST 0x1ff << 8) 
+#define NSRI_REV_SHFT 4
+#define NSRI_REV_MASK (UINT64_CAST 0xf << 4)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NSRI_CHIPID_SHFT 0
+#define NSRI_CHIPID_MASK (UINT64_CAST 0xf)  
+#define NASID_TO_FINEREG_SHFT 0
+#define NASID_TO_COARSEREG_SHFT 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPR_PORTRESET (UINT64_CAST 1 << 7)  
+#define NPR_LINKRESET (UINT64_CAST 1 << 1)  
+#define NPR_LOCALRESET (UINT64_CAST 1)  
+#define NPROT_RESETOK (UINT64_CAST 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NGP_MAXRETRY_SHFT 48  
+#define NGP_MAXRETRY_MASK (UINT64_CAST 0x3ff << 48)
+#define NGP_TAILTOWRAP_SHFT 32  
+#define NGP_TAILTOWRAP_MASK (UINT64_CAST 0xffff << 32)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NGP_CREDITTOVAL_SHFT 16  
+#define NGP_CREDITTOVAL_MASK (UINT64_CAST 0xf << 16)
+#define NGP_TAILTOVAL_SHFT 4  
+#define NGP_TAILTOVAL_MASK (UINT64_CAST 0xf << 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NDP_PORTTORESET (UINT64_CAST 1 << 18)  
+#define NDP_LLP8BITMODE (UINT64_CAST 1 << 12)  
+#define NDP_PORTDISABLE (UINT64_CAST 1 << 6)  
+#define NDP_SENDERROR (UINT64_CAST 1)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NVP_PIOID_SHFT 40
+#define NVP_PIOID_MASK (UINT64_CAST 0x3ff << 40)
+#define NVP_WRITEID_SHFT 32
+#define NVP_WRITEID_MASK (UINT64_CAST 0xff << 32)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NVP_ADDRESS_MASK (UINT64_CAST 0xffff8)  
+#define NVP_TYPE_SHFT 0
+#define NVP_TYPE_MASK (UINT64_CAST 0x3)
+#define NVS_VALID (UINT64_CAST 1 << 63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NVS_OVERRUN (UINT64_CAST 1 << 62)
+#define NVS_TARGET_SHFT 51
+#define NVS_TARGET_MASK (UINT64_CAST 0x3ff << 51)
+#define NVS_PIOID_SHFT 40
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NVS_PIOID_MASK (UINT64_CAST 0x3ff << 40)
+#define NVS_WRITEID_SHFT 32
+#define NVS_WRITEID_MASK (UINT64_CAST 0xff << 32)
+#define NVS_ADDRESS_MASK (UINT64_CAST 0xfffffff8)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NVS_TYPE_SHFT 0
+#define NVS_TYPE_MASK (UINT64_CAST 0x7)
+#define NVS_ERROR_MASK (UINT64_CAST 0x4)  
+#define PIOTYPE_READ 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PIOTYPE_WRITE 1  
+#define PIOTYPE_UNDEFINED 2  
+#define PIOTYPE_EXCHANGE 3  
+#define PIOTYPE_ADDR_ERR 4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PIOTYPE_CMD_ERR 5  
+#define PIOTYPE_PROT_ERR 6  
+#define PIOTYPE_UNKNOWN 7  
+#define NAGE_VCH_SHFT 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NAGE_VCH_MASK (UINT64_CAST 3 << 10)
+#define NAGE_CC_SHFT 8
+#define NAGE_CC_MASK (UINT64_CAST 3 << 8)
+#define NAGE_AGE_SHFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NAGE_AGE_MASK (UINT64_CAST 0xff)
+#define NAGE_MASK (NAGE_VCH_MASK | NAGE_CC_MASK | NAGE_AGE_MASK)
+#define VCHANNEL_A 0
+#define VCHANNEL_B 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VCHANNEL_ANY 2
+#define NPP_NULLTO_SHFT 10
+#define NPP_NULLTO_MASK (UINT64_CAST 0x3f << 16)
+#define NPP_MAXBURST_SHFT 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPP_MAXBURST_MASK (UINT64_CAST 0x3ff)
+#define NPP_RESET_DFLT_HUB20 ((UINT64_CAST 1 << NPP_NULLTO_SHFT) |   (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
+#define NPP_RESET_DEFAULTS ((UINT64_CAST 6 << NPP_NULLTO_SHFT) |   (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
+#define NPE_LINKRESET (UINT64_CAST 1 << 37)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPE_INTERNALERROR (UINT64_CAST 1 << 36)
+#define NPE_BADMESSAGE (UINT64_CAST 1 << 35)
+#define NPE_BADDEST (UINT64_CAST 1 << 34)
+#define NPE_FIFOOVERFLOW (UINT64_CAST 1 << 33)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPE_CREDITTO_SHFT 28
+#define NPE_CREDITTO_MASK (UINT64_CAST 0xf << 28)
+#define NPE_TAILTO_SHFT 24
+#define NPE_TAILTO_MASK (UINT64_CAST 0xf << 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPE_RETRYCOUNT_SHFT 16
+#define NPE_RETRYCOUNT_MASK (UINT64_CAST 0xff << 16)
+#define NPE_CBERRCOUNT_SHFT 8
+#define NPE_CBERRCOUNT_MASK (UINT64_CAST 0xff << 8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPE_SNERRCOUNT_SHFT 0
+#define NPE_SNERRCOUNT_MASK (UINT64_CAST 0xff << 0)
+#define NPE_MASK 0x3effffffff
+#define NPE_COUNT_MAX 0xff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NPE_FATAL_ERRORS (NPE_LINKRESET | NPE_INTERNALERROR |   NPE_BADMESSAGE | NPE_BADDEST |   NPE_FIFOOVERFLOW | NPE_CREDITTO_MASK |   NPE_TAILTO_MASK)
+#define NMT_EXIT_PORT_MASK (UINT64_CAST 0xf)
+#define NLT_EXIT_PORT_MASK (UINT64_CAST 0xf)
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union hubni_port_error_u {
+ u64 nipe_reg_value;
+ struct {
+ u64 nipe_rsvd: 26,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ nipe_lnk_reset: 1,
+ nipe_intl_err: 1,
+ nipe_bad_msg: 1,
+ nipe_bad_dest: 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ nipe_fifo_ovfl: 1,
+ nipe_rsvd1: 1,
+ nipe_credit_to: 4,
+ nipe_tail_to: 4,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ nipe_retry_cnt: 8,
+ nipe_cb_cnt: 8,
+ nipe_sn_cnt: 8;
+ } nipe_fields_s;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} hubni_port_error_t;
+#define NI_LLP_RETRY_MAX 0xff
+#define NI_LLP_CB_MAX 0xff
+#define NI_LLP_SN_MAX 0xff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/sn0/hubpi.h b/libc/kernel/arch-mips/asm/sn/sn0/hubpi.h
new file mode 100644
index 0000000..922c480
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/sn0/hubpi.h
@@ -0,0 +1,364 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_SN0_HUBPI_H
+#define _ASM_SN_SN0_HUBPI_H
+#include <linux/types.h>
+#define PI_BASE 0x000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CPU_PROTECT 0x000000  
+#define PI_PROT_OVERRD 0x000008  
+#define PI_IO_PROTECT 0x000010  
+#define PI_REGION_PRESENT 0x000018  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CPU_NUM 0x000020  
+#define PI_CALIAS_SIZE 0x000028  
+#define PI_MAX_CRB_TIMEOUT 0x000030  
+#define PI_CRB_SFACTOR 0x000038  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CALIAS_SIZE_0 0
+#define PI_CALIAS_SIZE_4K 1
+#define PI_CALIAS_SIZE_8K 2
+#define PI_CALIAS_SIZE_16K 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CALIAS_SIZE_32K 4
+#define PI_CALIAS_SIZE_64K 5
+#define PI_CALIAS_SIZE_128K 6
+#define PI_CALIAS_SIZE_256K 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CALIAS_SIZE_512K 8
+#define PI_CALIAS_SIZE_1M 9
+#define PI_CALIAS_SIZE_2M 10
+#define PI_CALIAS_SIZE_4M 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CALIAS_SIZE_8M 12
+#define PI_CALIAS_SIZE_16M 13
+#define PI_CALIAS_SIZE_32M 14
+#define PI_CALIAS_SIZE_64M 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CPU_PRESENT_A 0x000040  
+#define PI_CPU_PRESENT_B 0x000048  
+#define PI_CPU_ENABLE_A 0x000050  
+#define PI_CPU_ENABLE_B 0x000058  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_REPLY_LEVEL 0x000060  
+#define PI_HARDRESET_BIT 0x020068  
+#define PI_NMI_A 0x000070  
+#define PI_NMI_B 0x000078  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_NMI_OFFSET (PI_NMI_B - PI_NMI_A)
+#define PI_SOFTRESET 0x000080  
+#define PI_INT_PEND_MOD 0x000090  
+#define PI_INT_PEND0 0x000098  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_INT_PEND1 0x0000a0  
+#define PI_INT_MASK0_A 0x0000a8  
+#define PI_INT_MASK1_A 0x0000b0  
+#define PI_INT_MASK0_B 0x0000b8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_INT_MASK1_B 0x0000c0  
+#define PI_INT_MASK_OFFSET 0x10  
+#define PI_CC_PEND_SET_A 0x0000c8  
+#define PI_CC_PEND_SET_B 0x0000d0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_CC_PEND_CLR_A 0x0000d8  
+#define PI_CC_PEND_CLR_B 0x0000e0  
+#define PI_CC_MASK 0x0000e8  
+#define PI_INT_SET_OFFSET 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_RT_COUNT 0x030100  
+#define PI_RT_COMPARE_A 0x000108  
+#define PI_RT_COMPARE_B 0x000110  
+#define PI_PROFILE_COMPARE 0x000118  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_RT_PEND_A 0x000120  
+#define PI_RT_PEND_B 0x000128  
+#define PI_PROF_PEND_A 0x000130  
+#define PI_PROF_PEND_B 0x000138  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_RT_EN_A 0x000140  
+#define PI_RT_EN_B 0x000148  
+#define PI_PROF_EN_A 0x000150  
+#define PI_PROF_EN_B 0x000158  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_RT_LOCAL_CTRL 0x000160  
+#define PI_RT_FILTER_CTRL 0x000168  
+#define PI_COUNT_OFFSET 0x08  
+#define PI_BIST_WRITE_DATA 0x000200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_BIST_READ_DATA 0x000208  
+#define PI_BIST_COUNT_TARG 0x000210  
+#define PI_BIST_READY 0x000218  
+#define PI_BIST_SHIFT_LOAD 0x000220  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_BIST_SHIFT_UNLOAD 0x000228  
+#define PI_BIST_ENTER_RUN 0x000230  
+#define PI_GFX_PAGE_A 0x000300  
+#define PI_GFX_CREDIT_CNTR_A 0x000308  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_GFX_BIAS_A 0x000310  
+#define PI_GFX_INT_CNTR_A 0x000318  
+#define PI_GFX_INT_CMP_A 0x000320  
+#define PI_GFX_PAGE_B 0x000328  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_GFX_CREDIT_CNTR_B 0x000330  
+#define PI_GFX_BIAS_B 0x000338  
+#define PI_GFX_INT_CNTR_B 0x000340  
+#define PI_GFX_INT_CMP_B 0x000348  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_GFX_OFFSET (PI_GFX_PAGE_B - PI_GFX_PAGE_A)
+#define PI_GFX_PAGE_ENABLE 0x0000010000000000LL
+#define PI_ERR_INT_PEND 0x000400  
+#define PI_ERR_INT_MASK_A 0x000408  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_INT_MASK_B 0x000410  
+#define PI_ERR_STACK_ADDR_A 0x000418  
+#define PI_ERR_STACK_ADDR_B 0x000420  
+#define PI_ERR_STACK_SIZE 0x000428  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_STATUS0_A 0x000430  
+#define PI_ERR_STATUS0_A_RCLR 0x000438  
+#define PI_ERR_STATUS1_A 0x000440  
+#define PI_ERR_STATUS1_A_RCLR 0x000448  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_STATUS0_B 0x000450  
+#define PI_ERR_STATUS0_B_RCLR 0x000458  
+#define PI_ERR_STATUS1_B 0x000460  
+#define PI_ERR_STATUS1_B_RCLR 0x000468  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_SPOOL_CMP_A 0x000470  
+#define PI_SPOOL_CMP_B 0x000478  
+#define PI_CRB_TIMEOUT_A 0x000480  
+#define PI_CRB_TIMEOUT_B 0x000488  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_SYSAD_ERRCHK_EN 0x000490  
+#define PI_BAD_CHECK_BIT_A 0x000498  
+#define PI_BAD_CHECK_BIT_B 0x0004a0  
+#define PI_NACK_CNT_A 0x0004a8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_NACK_CNT_B 0x0004b0  
+#define PI_NACK_CMP 0x0004b8  
+#define PI_STACKADDR_OFFSET (PI_ERR_STACK_ADDR_B - PI_ERR_STACK_ADDR_A)
+#define PI_ERRSTAT_OFFSET (PI_ERR_STATUS0_B - PI_ERR_STATUS0_A)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_RDCLR_OFFSET (PI_ERR_STATUS0_A_RCLR - PI_ERR_STATUS0_A)
+#define PI_ERR_SPOOL_CMP_B 0x00000001  
+#define PI_ERR_SPOOL_CMP_A 0x00000002
+#define PI_ERR_SPUR_MSG_B 0x00000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_SPUR_MSG_A 0x00000008
+#define PI_ERR_WRB_TERR_B 0x00000010  
+#define PI_ERR_WRB_TERR_A 0x00000020
+#define PI_ERR_WRB_WERR_B 0x00000040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_WRB_WERR_A 0x00000080
+#define PI_ERR_SYSSTATE_B 0x00000100  
+#define PI_ERR_SYSSTATE_A 0x00000200
+#define PI_ERR_SYSAD_DATA_B 0x00000400  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_SYSAD_DATA_A 0x00000800
+#define PI_ERR_SYSAD_ADDR_B 0x00001000  
+#define PI_ERR_SYSAD_ADDR_A 0x00002000
+#define PI_ERR_SYSCMD_DATA_B 0x00004000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_SYSCMD_DATA_A 0x00008000
+#define PI_ERR_SYSCMD_ADDR_B 0x00010000  
+#define PI_ERR_SYSCMD_ADDR_A 0x00020000
+#define PI_ERR_BAD_SPOOL_B 0x00040000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_BAD_SPOOL_A 0x00080000
+#define PI_ERR_UNCAC_UNCORR_B 0x00100000  
+#define PI_ERR_UNCAC_UNCORR_A 0x00200000
+#define PI_ERR_SYSSTATE_TAG_B 0x00400000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_SYSSTATE_TAG_A 0x00800000
+#define PI_ERR_MD_UNCORR 0x01000000  
+#define PI_ERR_CLEAR_ALL_A 0x00aaaaaa
+#define PI_ERR_CLEAR_ALL_B 0x00555555
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_FATAL_ERR_CPU_A (PI_ERR_SYSSTATE_TAG_A |   PI_ERR_BAD_SPOOL_A |   PI_ERR_SYSCMD_ADDR_A |   PI_ERR_SYSCMD_DATA_A |   PI_ERR_SYSAD_ADDR_A |   PI_ERR_SYSAD_DATA_A |   PI_ERR_SYSSTATE_A)
+#define PI_MISC_ERR_CPU_A (PI_ERR_UNCAC_UNCORR_A |   PI_ERR_WRB_WERR_A |   PI_ERR_WRB_TERR_A |   PI_ERR_SPUR_MSG_A |   PI_ERR_SPOOL_CMP_A)
+#define PI_FATAL_ERR_CPU_B (PI_ERR_SYSSTATE_TAG_B |   PI_ERR_BAD_SPOOL_B |   PI_ERR_SYSCMD_ADDR_B |   PI_ERR_SYSCMD_DATA_B |   PI_ERR_SYSAD_ADDR_B |   PI_ERR_SYSAD_DATA_B |   PI_ERR_SYSSTATE_B)
+#define PI_MISC_ERR_CPU_B (PI_ERR_UNCAC_UNCORR_B |   PI_ERR_WRB_WERR_B |   PI_ERR_WRB_TERR_B |   PI_ERR_SPUR_MSG_B |   PI_ERR_SPOOL_CMP_B)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_GENERIC (PI_ERR_MD_UNCORR)
+#define PI_ERR_ST0_TYPE_MASK 0x0000000000000007
+#define PI_ERR_ST0_TYPE_SHFT 0
+#define PI_ERR_ST0_REQNUM_MASK 0x0000000000000038
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST0_REQNUM_SHFT 3
+#define PI_ERR_ST0_SUPPL_MASK 0x000000000001ffc0
+#define PI_ERR_ST0_SUPPL_SHFT 6
+#define PI_ERR_ST0_CMD_MASK 0x0000000001fe0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST0_CMD_SHFT 17
+#define PI_ERR_ST0_ADDR_MASK 0x3ffffffffe000000
+#define PI_ERR_ST0_ADDR_SHFT 25
+#define PI_ERR_ST0_OVERRUN_MASK 0x4000000000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST0_OVERRUN_SHFT 62
+#define PI_ERR_ST0_VALID_MASK 0x8000000000000000
+#define PI_ERR_ST0_VALID_SHFT 63
+#define PI_ERR_ST1_SPOOL_MASK 0x00000000001fffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST1_SPOOL_SHFT 0
+#define PI_ERR_ST1_TOUTCNT_MASK 0x000000001fe00000
+#define PI_ERR_ST1_TOUTCNT_SHFT 21
+#define PI_ERR_ST1_INVCNT_MASK 0x0000007fe0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST1_INVCNT_SHFT 29
+#define PI_ERR_ST1_CRBNUM_MASK 0x0000038000000000
+#define PI_ERR_ST1_CRBNUM_SHFT 39
+#define PI_ERR_ST1_WRBRRB_MASK 0x0000040000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST1_WRBRRB_SHFT 42
+#define PI_ERR_ST1_CRBSTAT_MASK 0x001ff80000000000
+#define PI_ERR_ST1_CRBSTAT_SHFT 43
+#define PI_ERR_ST1_MSGSRC_MASK 0xffe0000000000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_ST1_MSGSRC_SHFT 53
+#define PI_ERR_STK_TYPE_MASK 0x0000000000000003
+#define PI_ERR_STK_TYPE_SHFT 0
+#define PI_ERR_STK_SUPPL_MASK 0x0000000000000038
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_STK_SUPPL_SHFT 3
+#define PI_ERR_STK_REQNUM_MASK 0x00000000000001c0
+#define PI_ERR_STK_REQNUM_SHFT 6
+#define PI_ERR_STK_CRBNUM_MASK 0x0000000000000e00
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_STK_CRBNUM_SHFT 9
+#define PI_ERR_STK_WRBRRB_MASK 0x0000000000001000
+#define PI_ERR_STK_WRBRRB_SHFT 12
+#define PI_ERR_STK_CRBSTAT_MASK 0x00000000007fe000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_STK_CRBSTAT_SHFT 13
+#define PI_ERR_STK_CMD_MASK 0x000000007f800000
+#define PI_ERR_STK_CMD_SHFT 23
+#define PI_ERR_STK_ADDR_MASK 0xffffffff80000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_STK_ADDR_SHFT 31
+#define PI_ERR_RD_PRERR 1
+#define PI_ERR_RD_DERR 2
+#define PI_ERR_RD_TERR 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_WR_WERR 0
+#define PI_ERR_WR_PWERR 1
+#define PI_ERR_WR_TERR 3
+#define PI_ERR_RRB 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_ERR_WRB 1
+#define PI_ERR_ANY_CRB 2
+#define ERR_STK_ADDR_SHFT 7
+#define ERR_STAT0_ADDR_SHFT 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_MIN_STACK_SIZE 4096  
+#define PI_STACK_SIZE_SHFT 12  
+#define ERR_STACK_SIZE_BYTES(_sz)   ((_sz) ? (PI_MIN_STACK_SIZE << ((_sz) - 1)) : 0)
+#ifndef __ASSEMBLY__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct err_stack_format {
+ u64 sk_addr : 33,
+ sk_cmd : 8,
+ sk_crb_sts : 10,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sk_rw_rb : 1,
+ sk_crb_num : 3,
+ sk_t5_req : 3,
+ sk_suppl : 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sk_err_type: 3;
+};
+typedef union pi_err_stack {
+ u64 pi_stk_word;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct err_stack_format pi_stk_fmt;
+} pi_err_stack_t;
+struct err_status0_format {
+ u64 s0_valid : 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ s0_ovr_run : 1,
+ s0_addr : 37,
+ s0_cmd : 8,
+ s0_supl : 11,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ s0_t5_req : 3,
+ s0_err_type: 3;
+};
+typedef union pi_err_stat0 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 pi_stat0_word;
+ struct err_status0_format pi_stat0_fmt;
+} pi_err_stat0_t;
+struct err_status1_format {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ u64 s1_src : 11,
+ s1_crb_sts : 10,
+ s1_rw_rb : 1,
+ s1_crb_num : 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ s1_inval_cnt:10,
+ s1_to_cnt : 8,
+ s1_spl_cnt : 21;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union pi_err_stat1 {
+ u64 pi_stat1_word;
+ struct err_status1_format pi_stat1_fmt;
+} pi_err_stat1_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef u64 rtc_time_t;
+#endif
+#define PI_SYSAD_ERRCHK_ECCGEN 0x01  
+#define PI_SYSAD_ERRCHK_QUALGEN 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_SYSAD_ERRCHK_SADP 0x04  
+#define PI_SYSAD_ERRCHK_CMDP 0x08  
+#define PI_SYSAD_ERRCHK_STATE 0x10  
+#define PI_SYSAD_ERRCHK_QUAL 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_SYSAD_CHECK_ALL 0x3f  
+#define HUB_IP_PEND0 0x0400
+#define HUB_IP_PEND1_CC 0x0800
+#define HUB_IP_RT 0x1000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HUB_IP_PROF 0x2000
+#define HUB_IP_ERROR 0x4000
+#define HUB_IP_MASK 0x7c00
+#define PRLC_USE_INT_SHFT 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRLC_USE_INT_MASK (UINT64_CAST 1 << 16)
+#define PRLC_USE_INT (UINT64_CAST 1 << 16)
+#define PRLC_GCLK_SHFT 15
+#define PRLC_GCLK_MASK (UINT64_CAST 1 << 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRLC_GCLK (UINT64_CAST 1 << 15)
+#define PRLC_GCLK_COUNT_SHFT 8
+#define PRLC_GCLK_COUNT_MASK (UINT64_CAST 0x7f << 8)
+#define PRLC_MAX_COUNT_SHFT 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PRLC_MAX_COUNT_MASK (UINT64_CAST 0x7f << 1)
+#define PRLC_GCLK_EN_SHFT 0
+#define PRLC_GCLK_EN_MASK (UINT64_CAST 1)
+#define PRLC_GCLK_EN (UINT64_CAST 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PI_NACK_CNT_EN_SHFT 20
+#define PI_NACK_CNT_EN_MASK 0x100000
+#define PI_NACK_CNT_MASK 0x0fffff
+#define PI_NACK_CNT_MAX 0x0fffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/sn/types.h b/libc/kernel/arch-mips/asm/sn/types.h
new file mode 100644
index 0000000..4079458
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sn/types.h
@@ -0,0 +1,35 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SN_TYPES_H
+#define _ASM_SN_TYPES_H
+#include <linux/types.h>
+typedef unsigned long cpuid_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned long cnodemask_t;
+typedef signed short nasid_t;
+typedef signed short cnodeid_t;
+typedef signed char partid_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef signed short moduleid_t;
+typedef signed short cmoduleid_t;
+typedef unsigned char clusterid_t;
+typedef unsigned long pfn_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef dev_t vertex_hdl_t;
+#endif
diff --git a/libc/kernel/arch-mips/asm/socket.h b/libc/kernel/arch-mips/asm/socket.h
new file mode 100644
index 0000000..ff8a3ba
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/socket.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SOCKET_H
+#define _ASM_SOCKET_H
+#include <asm/sockios.h>
+#define SOL_SOCKET 0xffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DEBUG 0x0001  
+#define SO_REUSEADDR 0x0004  
+#define SO_KEEPALIVE 0x0008  
+#define SO_DONTROUTE 0x0010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_BROADCAST 0x0020  
+#define SO_LINGER 0x0080  
+#define SO_OOBINLINE 0x0100  
+#define SO_TYPE 0x1008  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_STYLE SO_TYPE  
+#define SO_ERROR 0x1007  
+#define SO_SNDBUF 0x1001  
+#define SO_RCVBUF 0x1002  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SNDLOWAT 0x1003  
+#define SO_RCVLOWAT 0x1004  
+#define SO_SNDTIMEO 0x1005  
+#define SO_RCVTIMEO 0x1006  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_ACCEPTCONN 0x1009
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_BSDCOMPAT 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_PASSCRED 17
+#define SO_PEERCRED 18
+#define SO_SECURITY_AUTHENTICATION 22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SECURITY_ENCRYPTION_NETWORK 24
+#define SO_BINDTODEVICE 25
+#define SO_ATTACH_FILTER 26
+#define SO_DETACH_FILTER 27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+#define SCM_TIMESTAMP SO_TIMESTAMP
+#define SO_PEERSEC 30
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SNDBUFFORCE 31
+#define SO_RCVBUFFORCE 33
+#define SO_PASSSEC 34
+#define SO_TIMESTAMPNS 35
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
+#define SO_MARK 36
+#endif
diff --git a/libc/kernel/arch-mips/asm/sockios.h b/libc/kernel/arch-mips/asm/sockios.h
new file mode 100644
index 0000000..0e5a4ac
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sockios.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SOCKIOS_H
+#define _ASM_SOCKIOS_H
+#include <asm/ioctl.h>
+#define FIOGETOWN _IOR('f', 123, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FIOSETOWN _IOW('f', 124, int)
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SIOCGSTAMP 0x8906  
+#define SIOCGSTAMPNS 0x8907  
+#endif
diff --git a/libc/kernel/arch-mips/asm/stat.h b/libc/kernel/arch-mips/asm/stat.h
new file mode 100644
index 0000000..a8fee78
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/stat.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_STAT_H
+#define _ASM_STAT_H
+#include <linux/types.h>
+#include <asm/sgidefs.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_NABI32
+struct stat {
+ unsigned st_dev;
+ long st_pad1[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ gid_t st_gid;
+ unsigned st_rdev;
+ long st_pad2[2];
+ off_t st_size;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long st_pad3;
+ time_t st_atime;
+ long st_atime_nsec;
+ time_t st_mtime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long st_mtime_nsec;
+ time_t st_ctime;
+ long st_ctime_nsec;
+ long st_blksize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long st_blocks;
+ long st_pad4[14];
+};
+struct stat64 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_dev;
+ unsigned long st_pad0[3];
+ unsigned long long st_ino;
+ mode_t st_mode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned long st_rdev;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_pad1[3];
+ long long st_size;
+ time_t st_atime;
+ unsigned long st_atime_nsec;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ time_t st_mtime;
+ unsigned long st_mtime_nsec;
+ time_t st_ctime;
+ unsigned long st_ctime_nsec;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_blksize;
+ unsigned long st_pad2;
+ long long st_blocks;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI64
+struct stat {
+ unsigned int st_dev;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int st_pad0[3];
+ unsigned long st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned int st_rdev;
+ unsigned int st_pad1[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ off_t st_size;
+ unsigned int st_atime;
+ unsigned int st_atime_nsec;
+ unsigned int st_mtime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int st_mtime_nsec;
+ unsigned int st_ctime;
+ unsigned int st_ctime_nsec;
+ unsigned int st_blksize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int st_pad2;
+ unsigned long st_blocks;
+};
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STAT_HAVE_NSEC 1
+#endif
diff --git a/libc/kernel/arch-mips/asm/statfs.h b/libc/kernel/arch-mips/asm/statfs.h
new file mode 100644
index 0000000..a6e5c6a
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/statfs.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_STATFS_H
+#define _ASM_STATFS_H
+#include <linux/posix_types.h>
+#include <asm/sgidefs.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct statfs {
+ long f_type;
+#define f_fstyp f_type
+ long f_bsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_frsize;
+ long f_blocks;
+ long f_bfree;
+ long f_files;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_ffree;
+ long f_bavail;
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_spare[6];
+};
+#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_NABI32
+struct statfs64 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 f_type;
+ __u32 f_bsize;
+ __u32 f_frsize;
+ __u32 __pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 f_blocks;
+ __u64 f_bfree;
+ __u64 f_files;
+ __u64 f_ffree;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 f_bavail;
+ __kernel_fsid_t f_fsid;
+ __u32 f_namelen;
+ __u32 f_spare[6];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#endif
+#if _MIPS_SIM == _MIPS_SIM_ABI64
+struct statfs64 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_type;
+ long f_bsize;
+ long f_frsize;
+ long f_blocks;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_bfree;
+ long f_files;
+ long f_ffree;
+ long f_bavail;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+ long f_spare[6];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct compat_statfs64 {
+ __u32 f_type;
+ __u32 f_bsize;
+ __u32 f_frsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 __pad;
+ __u64 f_blocks;
+ __u64 f_bfree;
+ __u64 f_files;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 f_ffree;
+ __u64 f_bavail;
+ __kernel_fsid_t f_fsid;
+ __u32 f_namelen;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 f_spare[6];
+};
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/string.h b/libc/kernel/arch-mips/asm/string.h
new file mode 100644
index 0000000..856f61b
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/string.h
@@ -0,0 +1,25 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_STRING_H
+#define _ASM_STRING_H
+#define __HAVE_ARCH_MEMSET
+#define __HAVE_ARCH_MEMCPY
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __HAVE_ARCH_MEMMOVE
+#endif
diff --git a/libc/kernel/arch-mips/asm/sysmips.h b/libc/kernel/arch-mips/asm/sysmips.h
new file mode 100644
index 0000000..665f67f
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/sysmips.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SYSMIPS_H
+#define _ASM_SYSMIPS_H
+#define SETNAME 1  
+#define FLUSH_CACHE 3  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_FIXADE 7  
+#define MIPS_RDNVRAM 10  
+#define MIPS_ATOMIC_SET 2001  
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/system.h b/libc/kernel/arch-mips/asm/system.h
new file mode 100644
index 0000000..b2b2760
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/system.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_SYSTEM_H
+#define _ASM_SYSTEM_H
+#include <linux/types.h>
+#include <linux/irqflags.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/addrspace.h>
+#include <asm/barrier.h>
+#include <asm/cmpxchg.h>
+#include <asm/cpu-features.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/dsp.h>
+#include <asm/war.h>
+struct task_struct;
+#define __mips_mt_fpaff_switch_to(prev) do { (void) (prev); } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define switch_to(prev, next, last)  do {   __mips_mt_fpaff_switch_to(prev);   if (cpu_has_dsp)   __save_dsp(prev);   (last) = resume(prev, next, task_thread_info(next));  } while (0)
+#define finish_arch_switch(prev)  do {   if (cpu_has_dsp)   __restore_dsp(current);   if (cpu_has_userlocal)   write_c0_userlocal(current_thread_info()->tp_value);  } while (0)
+#define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels
+#define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef void (*vi_handler_t)(void);
+#define __ARCH_WANT_UNLOCKED_CTXSW
+#endif
diff --git a/libc/kernel/arch-mips/asm/termbits.h b/libc/kernel/arch-mips/asm/termbits.h
new file mode 100644
index 0000000..6a0add7
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/termbits.h
@@ -0,0 +1,240 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_TERMBITS_H
+#define _ASM_TERMBITS_H
+#include <linux/posix_types.h>
+typedef unsigned char cc_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+#define NCCS 23
+struct termios {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+};
+struct termios2 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+ speed_t c_ispeed;
+ speed_t c_ospeed;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct ktermios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ speed_t c_ispeed;
+ speed_t c_ospeed;
+};
+#define VINTR 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VQUIT 1  
+#define VERASE 2  
+#define VKILL 3  
+#define VMIN 4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VTIME 5  
+#define VEOL2 6  
+#define VSWTC 7  
+#define VSWTCH VSWTC
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VSTART 8  
+#define VSTOP 9  
+#define VSUSP 10  
+#define VREPRINT 12  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VDISCARD 13  
+#define VWERASE 14  
+#define VLNEXT 15  
+#define VEOF 16  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VEOL 17  
+#define IGNBRK 0000001  
+#define BRKINT 0000002  
+#define IGNPAR 0000004  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PARMRK 0000010  
+#define INPCK 0000020  
+#define ISTRIP 0000040  
+#define INLCR 0000100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IGNCR 0000200  
+#define ICRNL 0000400  
+#define IUCLC 0001000  
+#define IXON 0002000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define IXANY 0004000  
+#define IXOFF 0010000  
+#define IMAXBEL 0020000  
+#define IUTF8 0040000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OPOST 0000001  
+#define OLCUC 0000002  
+#define ONLCR 0000004  
+#define OCRNL 0000010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TAB3 0014000
+#define XTABS 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BS1 0020000
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+#define CBAUD 0010017
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B0 0000000  
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE 0000060  
+#define CS5 0000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CS6 0000020  
+#define CS7 0000040  
+#define CS8 0000060  
+#define CSTOPB 0000100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CREAD 0000200  
+#define PARENB 0000400  
+#define PARODD 0001000  
+#define HUPCL 0002000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CLOCAL 0004000  
+#define CBAUDEX 0010000
+#define BOTHER 0010000
+#define B57600 0010001
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define B3500000 0010016
+#define B4000000 0010017
+#define CIBAUD 002003600000  
+#define CMSPAR 010000000000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CRTSCTS 020000000000  
+#define IBSHIFT 16  
+#define ISIG 0000001  
+#define ICANON 0000002  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XCASE 0000004
+#define ECHO 0000010  
+#define ECHOE 0000020  
+#define ECHOK 0000040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ECHONL 0000100  
+#define NOFLSH 0000200  
+#define IEXTEN 0000400  
+#define ECHOCTL 0001000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ECHOPRT 0002000  
+#define ECHOKE 0004000  
+#define FLUSHO 0020000
+#define PENDIN 0040000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TOSTOP 0100000  
+#define ITOSTOP TOSTOP
+#define TIOCSER_TEMT 0x01  
+#define TCOOFF 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCOON 1  
+#define TCIOFF 2  
+#define TCION 3  
+#define TCIFLUSH 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCOFLUSH 1  
+#define TCIOFLUSH 2  
+#define TCSANOW TCSETS  
+#define TCSADRAIN TCSETSW  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TCSAFLUSH TCSETSF  
+#endif
diff --git a/libc/kernel/arch-mips/asm/termios.h b/libc/kernel/arch-mips/asm/termios.h
new file mode 100644
index 0000000..d6f230e
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/termios.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_TERMIOS_H
+#define _ASM_TERMIOS_H
+#include <asm/termbits.h>
+#include <asm/ioctls.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sgttyb {
+ char sg_ispeed;
+ char sg_ospeed;
+ char sg_erase;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char sg_kill;
+ int sg_flags;
+};
+struct tchars {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char t_intrc;
+ char t_quitc;
+ char t_startc;
+ char t_stopc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char t_eofc;
+ char t_brkc;
+};
+struct ltchars {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char t_suspc;
+ char t_dsuspc;
+ char t_rprntc;
+ char t_flushc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char t_werasc;
+ char t_lnextc;
+};
+struct winsize {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel;
+ unsigned short ws_ypixel;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define NCC 8
+struct termio {
+ unsigned short c_iflag;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short c_oflag;
+ unsigned short c_cflag;
+ unsigned short c_lflag;
+ char c_line;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char c_cc[NCCS];
+};
+#define TIOCM_LE 0x001  
+#define TIOCM_DTR 0x002  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCM_RTS 0x004  
+#define TIOCM_ST 0x010  
+#define TIOCM_SR 0x020  
+#define TIOCM_CTS 0x040  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCM_CAR 0x100  
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RNG 0x200  
+#define TIOCM_RI TIOCM_RNG
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TIOCM_DSR 0x400  
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define N_TTY 0
+#define N_SLIP 1
+#define N_MOUSE 2
+#define N_PPP 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define N_STRIP 4
+#define N_AX25 5
+#define N_X25 6
+#define N_6PACK 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define N_MASC 8
+#define N_R3964 9
+#define N_PROFIBUS_FDL 10
+#define N_IRDA 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define N_SMSBLOCK 12
+#define N_HDLC 13
+#define N_SYNC_PPP 14
+#define N_HCI 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-sh/asm/thread_info.h b/libc/kernel/arch-mips/asm/thread_info.h
similarity index 65%
rename from libc/kernel/arch-sh/asm/thread_info.h
rename to libc/kernel/arch-mips/asm/thread_info.h
index 03ef26d..07fc66b 100644
--- a/libc/kernel/arch-sh/asm/thread_info.h
+++ b/libc/kernel/arch-mips/asm/thread_info.h
@@ -7,9 +7,15 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_THREAD_INFO_H
-#define __ASM_SH_THREAD_INFO_H
-
+#ifndef _ASM_THREAD_INFO_H
+#define _ASM_THREAD_INFO_H
 #endif
diff --git a/libc/kernel/arch-sh/asm/atomic-irq.h b/libc/kernel/arch-mips/asm/timex.h
similarity index 65%
copy from libc/kernel/arch-sh/asm/atomic-irq.h
copy to libc/kernel/arch-mips/asm/timex.h
index b8f5eaf..99baac6 100644
--- a/libc/kernel/arch-sh/asm/atomic-irq.h
+++ b/libc/kernel/arch-mips/asm/timex.h
@@ -7,9 +7,15 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_IRQ_H
-#define __ASM_SH_ATOMIC_IRQ_H
-
+#ifndef _ASM_TIMEX_H
+#define _ASM_TIMEX_H
 #endif
diff --git a/libc/kernel/arch-mips/asm/tlb.h b/libc/kernel/arch-mips/asm/tlb.h
new file mode 100644
index 0000000..6f65f1d
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/tlb.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_TLB_H
+#define __ASM_TLB_H
+#define tlb_start_vma(tlb, vma)   do {   if (!tlb->fullmm)   flush_cache_range(vma, vma->vm_start, vma->vm_end);   } while (0)
+#define tlb_end_vma(tlb, vma) do { } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
+#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
+#include <asm-generic/tlb.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/tlbflush.h b/libc/kernel/arch-mips/asm/tlbflush.h
new file mode 100644
index 0000000..dab8e17
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/tlbflush.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_TLBFLUSH_H
+#define __ASM_TLBFLUSH_H
+#include <linux/mm.h>
+#define flush_tlb_all() local_flush_tlb_all()
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
+#define flush_tlb_range(vma, vmaddr, end) local_flush_tlb_range(vma, vmaddr, end)
+#define flush_tlb_kernel_range(vmaddr,end)   local_flush_tlb_kernel_range(vmaddr, end)
+#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr)
+#endif
diff --git a/libc/kernel/arch-mips/asm/topology.h b/libc/kernel/arch-mips/asm/topology.h
new file mode 100644
index 0000000..550e423
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/topology.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_TOPOLOGY_H
+#define __ASM_TOPOLOGY_H
+#include <topology.h>
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/txx9irq.h b/libc/kernel/arch-mips/asm/txx9irq.h
new file mode 100644
index 0000000..3272abe
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/txx9irq.h
@@ -0,0 +1,25 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_TXX9IRQ_H
+#define __ASM_TXX9IRQ_H
+#include <irq.h>
+#define TXX9_IRQ_BASE 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TXx9_MAX_IR 32
+#endif
diff --git a/libc/kernel/arch-mips/asm/types.h b/libc/kernel/arch-mips/asm/types.h
new file mode 100644
index 0000000..f67dd88
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/types.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_TYPES_H
+#define _ASM_TYPES_H
+#ifndef __ASSEMBLY__
+typedef unsigned short umode_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+#if _MIPS_SZLONG == 64
+typedef __signed__ long __s64;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned long __u64;
+#else
+#ifdef __GNUC__
+typedef __signed__ long long __s64;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned long long __u64;
+#endif
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/uaccess.h b/libc/kernel/arch-mips/asm/uaccess.h
new file mode 100644
index 0000000..3703af3
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/uaccess.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_UACCESS_H
+#define _ASM_UACCESS_H
+#include <linux/kernel.h>
+#include <linux/errno.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/thread_info.h>
+#include <asm-generic/uaccess.h>
+#define KERNEL_DS ((mm_segment_t) { 0UL })
+#define USER_DS ((mm_segment_t) { __UA_LIMIT })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VERIFY_READ 0
+#define VERIFY_WRITE 1
+#define get_ds() (KERNEL_DS)
+#define get_fs() (current_thread_info()->addr_limit)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define set_fs(x) (current_thread_info()->addr_limit = (x))
+#define segment_eq(a, b) ((a).seg == (b).seg)
+#define __ua_size(size)   ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
+#define __access_mask get_fs().seg
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __access_ok(addr, size, mask)   (((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0)
+#define access_ok(type, addr, size)   likely(__access_ok((unsigned long)(addr), (size), __access_mask))
+#define put_user(x,ptr)   __put_user_check((x), (ptr), sizeof(*(ptr)))
+#define get_user(x,ptr)   __get_user_check((x), (ptr), sizeof(*(ptr)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __put_user(x,ptr)   __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
+#define __get_user(x,ptr)   __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
+struct __large_struct { unsigned long buf[100]; };
+#define __m(x) (*(struct __large_struct __user *)(x))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __get_user_common(val, size, ptr)  do {   switch (size) {   case 1: __get_user_asm(val, "lb", ptr); break;   case 2: __get_user_asm(val, "lh", ptr); break;   case 4: __get_user_asm(val, "lw", ptr); break;   case 8: __GET_USER_DW(val, ptr); break;   default: __get_user_unknown(); break;   }  } while (0)
+#define __get_user_nocheck(x, ptr, size)  ({   long __gu_err;     __get_user_common((x), size, ptr);   __gu_err;  })
+#define __get_user_check(x, ptr, size)  ({   long __gu_err = -EFAULT;   const __typeof__(*(ptr)) __user * __gu_ptr = (ptr);     if (likely(access_ok(VERIFY_READ, __gu_ptr, size)))   __get_user_common((x), size, __gu_ptr);     __gu_err;  })
+#define __get_user_asm(val, insn, addr)  {   long __gu_tmp;     __asm__ __volatile__(   "1:	" insn "	%1, %3				\n"   "2:							\n"   "	.section .fixup,\"ax\"				\n"   "3:	li	%0, %4					\n"   "	j	2b					\n"   "	.previous					\n"   "	.section __ex_table,\"a\"			\n"   "	"__UA_ADDR "\t1b, 3b				\n"   "	.previous					\n"   : "=r" (__gu_err), "=r" (__gu_tmp)   : "0" (0), "o" (__m(addr)), "i" (-EFAULT));     (val) = (__typeof__(*(addr))) __gu_tmp;  }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __get_user_asm_ll32(val, addr)  {   union {   unsigned long long l;   __typeof__(*(addr)) t;   } __gu_tmp;     __asm__ __volatile__(   "1:	lw	%1, (%3)				\n"   "2:	lw	%D1, 4(%3)				\n"   "3:	.section	.fixup,\"ax\"			\n"   "4:	li	%0, %4					\n"   "	move	%1, $0					\n"   "	move	%D1, $0					\n"   "	j	3b					\n"   "	.previous					\n"   "	.section	__ex_table,\"a\"		\n"   "	" __UA_ADDR "	1b, 4b				\n"   "	" __UA_ADDR "	2b, 4b				\n"   "	.previous					\n"   : "=r" (__gu_err), "=&r" (__gu_tmp.l)   : "0" (0), "r" (addr), "i" (-EFAULT));     (val) = __gu_tmp.t;  }
+#define __put_user_nocheck(x, ptr, size)  ({   __typeof__(*(ptr)) __pu_val;   long __pu_err = 0;     __pu_val = (x);   switch (size) {   case 1: __put_user_asm("sb", ptr); break;   case 2: __put_user_asm("sh", ptr); break;   case 4: __put_user_asm("sw", ptr); break;   case 8: __PUT_USER_DW(ptr); break;   default: __put_user_unknown(); break;   }   __pu_err;  })
+#define __put_user_check(x, ptr, size)  ({   __typeof__(*(ptr)) __user *__pu_addr = (ptr);   __typeof__(*(ptr)) __pu_val = (x);   long __pu_err = -EFAULT;     if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) {   switch (size) {   case 1: __put_user_asm("sb", __pu_addr); break;   case 2: __put_user_asm("sh", __pu_addr); break;   case 4: __put_user_asm("sw", __pu_addr); break;   case 8: __PUT_USER_DW(__pu_addr); break;   default: __put_user_unknown(); break;   }   }   __pu_err;  })
+#define __put_user_asm(insn, ptr)  {   __asm__ __volatile__(   "1:	" insn "	%z2, %3		# __put_user_asm\n"   "2:							\n"   "	.section	.fixup,\"ax\"			\n"   "3:	li	%0, %4					\n"   "	j	2b					\n"   "	.previous					\n"   "	.section	__ex_table,\"a\"		\n"   "	" __UA_ADDR "	1b, 3b				\n"   "	.previous					\n"   : "=r" (__pu_err)   : "0" (0), "Jr" (__pu_val), "o" (__m(ptr)),   "i" (-EFAULT));  }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __put_user_asm_ll32(ptr)  {   __asm__ __volatile__(   "1:	sw	%2, (%3)	# __put_user_asm_ll32	\n"   "2:	sw	%D2, 4(%3)				\n"   "3:							\n"   "	.section	.fixup,\"ax\"			\n"   "4:	li	%0, %4					\n"   "	j	3b					\n"   "	.previous					\n"   "	.section	__ex_table,\"a\"		\n"   "	" __UA_ADDR "	1b, 4b				\n"   "	" __UA_ADDR "	2b, 4b				\n"   "	.previous"   : "=r" (__pu_err)   : "0" (0), "r" (__pu_val), "r" (ptr),   "i" (-EFAULT));  }
+#ifdef MODULE
+#define __MODULE_JAL(destination)   ".set\tnoat\n\t"   __UA_LA "\t$1, " #destination "\n\t"   "jalr\t$1\n\t"   ".set\tat\n\t"
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __MODULE_JAL(destination)   "jal\t" #destination "\n\t"
+#endif
+#define DADDI_SCRATCH "$0"
+#define __invoke_copy_to_user(to, from, n)  ({   register void __user *__cu_to_r __asm__("$4");   register const void *__cu_from_r __asm__("$5");   register long __cu_len_r __asm__("$6");     __cu_to_r = (to);   __cu_from_r = (from);   __cu_len_r = (n);   __asm__ __volatile__(   __MODULE_JAL(__copy_user)   : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r)   :   : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31",   DADDI_SCRATCH, "memory");   __cu_len_r;  })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __copy_to_user(to, from, n)  ({   void __user *__cu_to;   const void *__cu_from;   long __cu_len;     might_sleep();   __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len);   __cu_len;  })
+#define __copy_to_user_inatomic(to, from, n)  ({   void __user *__cu_to;   const void *__cu_from;   long __cu_len;     __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len);   __cu_len;  })
+#define __copy_from_user_inatomic(to, from, n)  ({   void *__cu_to;   const void __user *__cu_from;   long __cu_len;     __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   __cu_len = __invoke_copy_from_user_inatomic(__cu_to, __cu_from,   __cu_len);   __cu_len;  })
+#define copy_to_user(to, from, n)  ({   void __user *__cu_to;   const void *__cu_from;   long __cu_len;     might_sleep();   __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   if (access_ok(VERIFY_WRITE, __cu_to, __cu_len))   __cu_len = __invoke_copy_to_user(__cu_to, __cu_from,   __cu_len);   __cu_len;  })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __invoke_copy_from_user(to, from, n)  ({   register void *__cu_to_r __asm__("$4");   register const void __user *__cu_from_r __asm__("$5");   register long __cu_len_r __asm__("$6");     __cu_to_r = (to);   __cu_from_r = (from);   __cu_len_r = (n);   __asm__ __volatile__(   ".set\tnoreorder\n\t"   __MODULE_JAL(__copy_user)   ".set\tnoat\n\t"   __UA_ADDU "\t$1, %1, %2\n\t"   ".set\tat\n\t"   ".set\treorder"   : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r)   :   : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31",   DADDI_SCRATCH, "memory");   __cu_len_r;  })
+#define __invoke_copy_from_user_inatomic(to, from, n)  ({   register void *__cu_to_r __asm__("$4");   register const void __user *__cu_from_r __asm__("$5");   register long __cu_len_r __asm__("$6");     __cu_to_r = (to);   __cu_from_r = (from);   __cu_len_r = (n);   __asm__ __volatile__(   ".set\tnoreorder\n\t"   __MODULE_JAL(__copy_user_inatomic)   ".set\tnoat\n\t"   __UA_ADDU "\t$1, %1, %2\n\t"   ".set\tat\n\t"   ".set\treorder"   : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r)   :   : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31",   DADDI_SCRATCH, "memory");   __cu_len_r;  })
+#define __copy_from_user(to, from, n)  ({   void *__cu_to;   const void __user *__cu_from;   long __cu_len;     might_sleep();   __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   __cu_len = __invoke_copy_from_user(__cu_to, __cu_from,   __cu_len);   __cu_len;  })
+#define copy_from_user(to, from, n)  ({   void *__cu_to;   const void __user *__cu_from;   long __cu_len;     might_sleep();   __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   if (access_ok(VERIFY_READ, __cu_from, __cu_len))   __cu_len = __invoke_copy_from_user(__cu_to, __cu_from,   __cu_len);   __cu_len;  })
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __copy_in_user(to, from, n) __copy_from_user(to, from, n)
+#define copy_in_user(to, from, n)  ({   void __user *__cu_to;   const void __user *__cu_from;   long __cu_len;     might_sleep();   __cu_to = (to);   __cu_from = (from);   __cu_len = (n);   if (likely(access_ok(VERIFY_READ, __cu_from, __cu_len) &&   access_ok(VERIFY_WRITE, __cu_to, __cu_len)))   __cu_len = __invoke_copy_from_user(__cu_to, __cu_from,   __cu_len);   __cu_len;  })
+#define clear_user(addr,n)  ({   void __user * __cl_addr = (addr);   unsigned long __cl_size = (n);   if (__cl_size && access_ok(VERIFY_WRITE,   ((unsigned long)(__cl_addr)), __cl_size))   __cl_size = __clear_user(__cl_addr, __cl_size);   __cl_size;  })
+struct exception_table_entry
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+{
+ unsigned long insn;
+ unsigned long nextinsn;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/unaligned.h b/libc/kernel/arch-mips/asm/unaligned.h
new file mode 100644
index 0000000..3024aeb
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/unaligned.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MIPS_UNALIGNED_H
+#define _ASM_MIPS_UNALIGNED_H
+#include <linux/compiler.h>
+#ifdef __MIPSEB__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#define get_unaligned __get_unaligned_be
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define put_unaligned __put_unaligned_be
+#elif defined(__MIPSEL__)
+#include <linux/unaligned/le_struct.h>
+#include <linux/unaligned/be_byteshift.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/unaligned/generic.h>
+#define get_unaligned __get_unaligned_le
+#define put_unaligned __put_unaligned_le
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/unistd.h b/libc/kernel/arch-mips/asm/unistd.h
new file mode 100644
index 0000000..38e84cc
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/unistd.h
@@ -0,0 +1,1181 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_UNISTD_H
+#define _ASM_UNISTD_H
+#include <asm/sgidefs.h>
+#if _MIPS_SIM == _MIPS_SIM_ABI32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_Linux 4000
+#define __NR_syscall (__NR_Linux + 0)
+#define __NR_exit (__NR_Linux + 1)
+#define __NR_fork (__NR_Linux + 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_read (__NR_Linux + 3)
+#define __NR_write (__NR_Linux + 4)
+#define __NR_open (__NR_Linux + 5)
+#define __NR_close (__NR_Linux + 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_waitpid (__NR_Linux + 7)
+#define __NR_creat (__NR_Linux + 8)
+#define __NR_link (__NR_Linux + 9)
+#define __NR_unlink (__NR_Linux + 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_execve (__NR_Linux + 11)
+#define __NR_chdir (__NR_Linux + 12)
+#define __NR_time (__NR_Linux + 13)
+#define __NR_mknod (__NR_Linux + 14)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_chmod (__NR_Linux + 15)
+#define __NR_lchown (__NR_Linux + 16)
+#define __NR_break (__NR_Linux + 17)
+#define __NR_unused18 (__NR_Linux + 18)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lseek (__NR_Linux + 19)
+#define __NR_getpid (__NR_Linux + 20)
+#define __NR_mount (__NR_Linux + 21)
+#define __NR_umount (__NR_Linux + 22)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setuid (__NR_Linux + 23)
+#define __NR_getuid (__NR_Linux + 24)
+#define __NR_stime (__NR_Linux + 25)
+#define __NR_ptrace (__NR_Linux + 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_alarm (__NR_Linux + 27)
+#define __NR_unused28 (__NR_Linux + 28)
+#define __NR_pause (__NR_Linux + 29)
+#define __NR_utime (__NR_Linux + 30)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_stty (__NR_Linux + 31)
+#define __NR_gtty (__NR_Linux + 32)
+#define __NR_access (__NR_Linux + 33)
+#define __NR_nice (__NR_Linux + 34)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_ftime (__NR_Linux + 35)
+#define __NR_sync (__NR_Linux + 36)
+#define __NR_kill (__NR_Linux + 37)
+#define __NR_rename (__NR_Linux + 38)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mkdir (__NR_Linux + 39)
+#define __NR_rmdir (__NR_Linux + 40)
+#define __NR_dup (__NR_Linux + 41)
+#define __NR_pipe (__NR_Linux + 42)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_times (__NR_Linux + 43)
+#define __NR_prof (__NR_Linux + 44)
+#define __NR_brk (__NR_Linux + 45)
+#define __NR_setgid (__NR_Linux + 46)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getgid (__NR_Linux + 47)
+#define __NR_signal (__NR_Linux + 48)
+#define __NR_geteuid (__NR_Linux + 49)
+#define __NR_getegid (__NR_Linux + 50)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_acct (__NR_Linux + 51)
+#define __NR_umount2 (__NR_Linux + 52)
+#define __NR_lock (__NR_Linux + 53)
+#define __NR_ioctl (__NR_Linux + 54)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fcntl (__NR_Linux + 55)
+#define __NR_mpx (__NR_Linux + 56)
+#define __NR_setpgid (__NR_Linux + 57)
+#define __NR_ulimit (__NR_Linux + 58)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_unused59 (__NR_Linux + 59)
+#define __NR_umask (__NR_Linux + 60)
+#define __NR_chroot (__NR_Linux + 61)
+#define __NR_ustat (__NR_Linux + 62)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_dup2 (__NR_Linux + 63)
+#define __NR_getppid (__NR_Linux + 64)
+#define __NR_getpgrp (__NR_Linux + 65)
+#define __NR_setsid (__NR_Linux + 66)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sigaction (__NR_Linux + 67)
+#define __NR_sgetmask (__NR_Linux + 68)
+#define __NR_ssetmask (__NR_Linux + 69)
+#define __NR_setreuid (__NR_Linux + 70)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setregid (__NR_Linux + 71)
+#define __NR_sigsuspend (__NR_Linux + 72)
+#define __NR_sigpending (__NR_Linux + 73)
+#define __NR_sethostname (__NR_Linux + 74)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setrlimit (__NR_Linux + 75)
+#define __NR_getrlimit (__NR_Linux + 76)
+#define __NR_getrusage (__NR_Linux + 77)
+#define __NR_gettimeofday (__NR_Linux + 78)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_settimeofday (__NR_Linux + 79)
+#define __NR_getgroups (__NR_Linux + 80)
+#define __NR_setgroups (__NR_Linux + 81)
+#define __NR_reserved82 (__NR_Linux + 82)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_symlink (__NR_Linux + 83)
+#define __NR_unused84 (__NR_Linux + 84)
+#define __NR_readlink (__NR_Linux + 85)
+#define __NR_uselib (__NR_Linux + 86)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_swapon (__NR_Linux + 87)
+#define __NR_reboot (__NR_Linux + 88)
+#define __NR_readdir (__NR_Linux + 89)
+#define __NR_mmap (__NR_Linux + 90)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_munmap (__NR_Linux + 91)
+#define __NR_truncate (__NR_Linux + 92)
+#define __NR_ftruncate (__NR_Linux + 93)
+#define __NR_fchmod (__NR_Linux + 94)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fchown (__NR_Linux + 95)
+#define __NR_getpriority (__NR_Linux + 96)
+#define __NR_setpriority (__NR_Linux + 97)
+#define __NR_profil (__NR_Linux + 98)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_statfs (__NR_Linux + 99)
+#define __NR_fstatfs (__NR_Linux + 100)
+#define __NR_ioperm (__NR_Linux + 101)
+#define __NR_socketcall (__NR_Linux + 102)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_syslog (__NR_Linux + 103)
+#define __NR_setitimer (__NR_Linux + 104)
+#define __NR_getitimer (__NR_Linux + 105)
+#define __NR_stat (__NR_Linux + 106)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lstat (__NR_Linux + 107)
+#define __NR_fstat (__NR_Linux + 108)
+#define __NR_unused109 (__NR_Linux + 109)
+#define __NR_iopl (__NR_Linux + 110)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_vhangup (__NR_Linux + 111)
+#define __NR_idle (__NR_Linux + 112)
+#define __NR_vm86 (__NR_Linux + 113)
+#define __NR_wait4 (__NR_Linux + 114)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_swapoff (__NR_Linux + 115)
+#define __NR_sysinfo (__NR_Linux + 116)
+#define __NR_ipc (__NR_Linux + 117)
+#define __NR_fsync (__NR_Linux + 118)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sigreturn (__NR_Linux + 119)
+#define __NR_clone (__NR_Linux + 120)
+#define __NR_setdomainname (__NR_Linux + 121)
+#define __NR_uname (__NR_Linux + 122)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_modify_ldt (__NR_Linux + 123)
+#define __NR_adjtimex (__NR_Linux + 124)
+#define __NR_mprotect (__NR_Linux + 125)
+#define __NR_sigprocmask (__NR_Linux + 126)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_create_module (__NR_Linux + 127)
+#define __NR_init_module (__NR_Linux + 128)
+#define __NR_delete_module (__NR_Linux + 129)
+#define __NR_get_kernel_syms (__NR_Linux + 130)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_quotactl (__NR_Linux + 131)
+#define __NR_getpgid (__NR_Linux + 132)
+#define __NR_fchdir (__NR_Linux + 133)
+#define __NR_bdflush (__NR_Linux + 134)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sysfs (__NR_Linux + 135)
+#define __NR_personality (__NR_Linux + 136)
+#define __NR_afs_syscall (__NR_Linux + 137)  
+#define __NR_setfsuid (__NR_Linux + 138)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setfsgid (__NR_Linux + 139)
+#define __NR__llseek (__NR_Linux + 140)
+#define __NR_getdents (__NR_Linux + 141)
+#define __NR__newselect (__NR_Linux + 142)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_flock (__NR_Linux + 143)
+#define __NR_msync (__NR_Linux + 144)
+#define __NR_readv (__NR_Linux + 145)
+#define __NR_writev (__NR_Linux + 146)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_cacheflush (__NR_Linux + 147)
+#define __NR_cachectl (__NR_Linux + 148)
+#define __NR_sysmips (__NR_Linux + 149)
+#define __NR_unused150 (__NR_Linux + 150)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getsid (__NR_Linux + 151)
+#define __NR_fdatasync (__NR_Linux + 152)
+#define __NR__sysctl (__NR_Linux + 153)
+#define __NR_mlock (__NR_Linux + 154)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_munlock (__NR_Linux + 155)
+#define __NR_mlockall (__NR_Linux + 156)
+#define __NR_munlockall (__NR_Linux + 157)
+#define __NR_sched_setparam (__NR_Linux + 158)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_getparam (__NR_Linux + 159)
+#define __NR_sched_setscheduler (__NR_Linux + 160)
+#define __NR_sched_getscheduler (__NR_Linux + 161)
+#define __NR_sched_yield (__NR_Linux + 162)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_get_priority_max (__NR_Linux + 163)
+#define __NR_sched_get_priority_min (__NR_Linux + 164)
+#define __NR_sched_rr_get_interval (__NR_Linux + 165)
+#define __NR_nanosleep (__NR_Linux + 166)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mremap (__NR_Linux + 167)
+#define __NR_accept (__NR_Linux + 168)
+#define __NR_bind (__NR_Linux + 169)
+#define __NR_connect (__NR_Linux + 170)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getpeername (__NR_Linux + 171)
+#define __NR_getsockname (__NR_Linux + 172)
+#define __NR_getsockopt (__NR_Linux + 173)
+#define __NR_listen (__NR_Linux + 174)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_recv (__NR_Linux + 175)
+#define __NR_recvfrom (__NR_Linux + 176)
+#define __NR_recvmsg (__NR_Linux + 177)
+#define __NR_send (__NR_Linux + 178)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendmsg (__NR_Linux + 179)
+#define __NR_sendto (__NR_Linux + 180)
+#define __NR_setsockopt (__NR_Linux + 181)
+#define __NR_shutdown (__NR_Linux + 182)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_socket (__NR_Linux + 183)
+#define __NR_socketpair (__NR_Linux + 184)
+#define __NR_setresuid (__NR_Linux + 185)
+#define __NR_getresuid (__NR_Linux + 186)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_query_module (__NR_Linux + 187)
+#define __NR_poll (__NR_Linux + 188)
+#define __NR_nfsservctl (__NR_Linux + 189)
+#define __NR_setresgid (__NR_Linux + 190)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getresgid (__NR_Linux + 191)
+#define __NR_prctl (__NR_Linux + 192)
+#define __NR_rt_sigreturn (__NR_Linux + 193)
+#define __NR_rt_sigaction (__NR_Linux + 194)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigprocmask (__NR_Linux + 195)
+#define __NR_rt_sigpending (__NR_Linux + 196)
+#define __NR_rt_sigtimedwait (__NR_Linux + 197)
+#define __NR_rt_sigqueueinfo (__NR_Linux + 198)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigsuspend (__NR_Linux + 199)
+#define __NR_pread64 (__NR_Linux + 200)
+#define __NR_pwrite64 (__NR_Linux + 201)
+#define __NR_chown (__NR_Linux + 202)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getcwd (__NR_Linux + 203)
+#define __NR_capget (__NR_Linux + 204)
+#define __NR_capset (__NR_Linux + 205)
+#define __NR_sigaltstack (__NR_Linux + 206)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendfile (__NR_Linux + 207)
+#define __NR_getpmsg (__NR_Linux + 208)
+#define __NR_putpmsg (__NR_Linux + 209)
+#define __NR_mmap2 (__NR_Linux + 210)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_truncate64 (__NR_Linux + 211)
+#define __NR_ftruncate64 (__NR_Linux + 212)
+#define __NR_stat64 (__NR_Linux + 213)
+#define __NR_lstat64 (__NR_Linux + 214)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fstat64 (__NR_Linux + 215)
+#define __NR_pivot_root (__NR_Linux + 216)
+#define __NR_mincore (__NR_Linux + 217)
+#define __NR_madvise (__NR_Linux + 218)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getdents64 (__NR_Linux + 219)
+#define __NR_fcntl64 (__NR_Linux + 220)
+#define __NR_reserved221 (__NR_Linux + 221)
+#define __NR_gettid (__NR_Linux + 222)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_readahead (__NR_Linux + 223)
+#define __NR_setxattr (__NR_Linux + 224)
+#define __NR_lsetxattr (__NR_Linux + 225)
+#define __NR_fsetxattr (__NR_Linux + 226)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getxattr (__NR_Linux + 227)
+#define __NR_lgetxattr (__NR_Linux + 228)
+#define __NR_fgetxattr (__NR_Linux + 229)
+#define __NR_listxattr (__NR_Linux + 230)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_llistxattr (__NR_Linux + 231)
+#define __NR_flistxattr (__NR_Linux + 232)
+#define __NR_removexattr (__NR_Linux + 233)
+#define __NR_lremovexattr (__NR_Linux + 234)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fremovexattr (__NR_Linux + 235)
+#define __NR_tkill (__NR_Linux + 236)
+#define __NR_sendfile64 (__NR_Linux + 237)
+#define __NR_futex (__NR_Linux + 238)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_setaffinity (__NR_Linux + 239)
+#define __NR_sched_getaffinity (__NR_Linux + 240)
+#define __NR_io_setup (__NR_Linux + 241)
+#define __NR_io_destroy (__NR_Linux + 242)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_getevents (__NR_Linux + 243)
+#define __NR_io_submit (__NR_Linux + 244)
+#define __NR_io_cancel (__NR_Linux + 245)
+#define __NR_exit_group (__NR_Linux + 246)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lookup_dcookie (__NR_Linux + 247)
+#define __NR_epoll_create (__NR_Linux + 248)
+#define __NR_epoll_ctl (__NR_Linux + 249)
+#define __NR_epoll_wait (__NR_Linux + 250)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_remap_file_pages (__NR_Linux + 251)
+#define __NR_set_tid_address (__NR_Linux + 252)
+#define __NR_restart_syscall (__NR_Linux + 253)
+#define __NR_fadvise64 (__NR_Linux + 254)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_statfs64 (__NR_Linux + 255)
+#define __NR_fstatfs64 (__NR_Linux + 256)
+#define __NR_timer_create (__NR_Linux + 257)
+#define __NR_timer_settime (__NR_Linux + 258)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_gettime (__NR_Linux + 259)
+#define __NR_timer_getoverrun (__NR_Linux + 260)
+#define __NR_timer_delete (__NR_Linux + 261)
+#define __NR_clock_settime (__NR_Linux + 262)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_gettime (__NR_Linux + 263)
+#define __NR_clock_getres (__NR_Linux + 264)
+#define __NR_clock_nanosleep (__NR_Linux + 265)
+#define __NR_tgkill (__NR_Linux + 266)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_utimes (__NR_Linux + 267)
+#define __NR_mbind (__NR_Linux + 268)
+#define __NR_get_mempolicy (__NR_Linux + 269)
+#define __NR_set_mempolicy (__NR_Linux + 270)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_open (__NR_Linux + 271)
+#define __NR_mq_unlink (__NR_Linux + 272)
+#define __NR_mq_timedsend (__NR_Linux + 273)
+#define __NR_mq_timedreceive (__NR_Linux + 274)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_notify (__NR_Linux + 275)
+#define __NR_mq_getsetattr (__NR_Linux + 276)
+#define __NR_vserver (__NR_Linux + 277)
+#define __NR_waitid (__NR_Linux + 278)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_add_key (__NR_Linux + 280)
+#define __NR_request_key (__NR_Linux + 281)
+#define __NR_keyctl (__NR_Linux + 282)
+#define __NR_set_thread_area (__NR_Linux + 283)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_init (__NR_Linux + 284)
+#define __NR_inotify_add_watch (__NR_Linux + 285)
+#define __NR_inotify_rm_watch (__NR_Linux + 286)
+#define __NR_migrate_pages (__NR_Linux + 287)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_openat (__NR_Linux + 288)
+#define __NR_mkdirat (__NR_Linux + 289)
+#define __NR_mknodat (__NR_Linux + 290)
+#define __NR_fchownat (__NR_Linux + 291)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_futimesat (__NR_Linux + 292)
+#define __NR_fstatat64 (__NR_Linux + 293)
+#define __NR_unlinkat (__NR_Linux + 294)
+#define __NR_renameat (__NR_Linux + 295)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_linkat (__NR_Linux + 296)
+#define __NR_symlinkat (__NR_Linux + 297)
+#define __NR_readlinkat (__NR_Linux + 298)
+#define __NR_fchmodat (__NR_Linux + 299)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_faccessat (__NR_Linux + 300)
+#define __NR_pselect6 (__NR_Linux + 301)
+#define __NR_ppoll (__NR_Linux + 302)
+#define __NR_unshare (__NR_Linux + 303)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_splice (__NR_Linux + 304)
+#define __NR_sync_file_range (__NR_Linux + 305)
+#define __NR_tee (__NR_Linux + 306)
+#define __NR_vmsplice (__NR_Linux + 307)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_move_pages (__NR_Linux + 308)
+#define __NR_set_robust_list (__NR_Linux + 309)
+#define __NR_get_robust_list (__NR_Linux + 310)
+#define __NR_kexec_load (__NR_Linux + 311)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getcpu (__NR_Linux + 312)
+#define __NR_epoll_pwait (__NR_Linux + 313)
+#define __NR_ioprio_set (__NR_Linux + 314)
+#define __NR_ioprio_get (__NR_Linux + 315)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_utimensat (__NR_Linux + 316)
+#define __NR_signalfd (__NR_Linux + 317)
+#define __NR_timerfd (__NR_Linux + 318)
+#define __NR_eventfd (__NR_Linux + 319)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fallocate (__NR_Linux + 320)
+#define __NR_timerfd_create (__NR_Linux + 321)
+#define __NR_timerfd_gettime (__NR_Linux + 322)
+#define __NR_timerfd_settime (__NR_Linux + 323)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_signalfd4 (__NR_Linux + 324)
+#define __NR_eventfd2 (__NR_Linux + 325)
+#define __NR_epoll_create1 (__NR_Linux + 326)
+#define __NR_dup3 (__NR_Linux + 327)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pipe2 (__NR_Linux + 328)
+#define __NR_inotify_init1 (__NR_Linux + 329)
+#define __NR_Linux_syscalls 329
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_O32_Linux 4000
+#define __NR_O32_Linux_syscalls 329
+#if _MIPS_SIM == _MIPS_SIM_ABI64
+#define __NR_Linux 5000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_read (__NR_Linux + 0)
+#define __NR_write (__NR_Linux + 1)
+#define __NR_open (__NR_Linux + 2)
+#define __NR_close (__NR_Linux + 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_stat (__NR_Linux + 4)
+#define __NR_fstat (__NR_Linux + 5)
+#define __NR_lstat (__NR_Linux + 6)
+#define __NR_poll (__NR_Linux + 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lseek (__NR_Linux + 8)
+#define __NR_mmap (__NR_Linux + 9)
+#define __NR_mprotect (__NR_Linux + 10)
+#define __NR_munmap (__NR_Linux + 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_brk (__NR_Linux + 12)
+#define __NR_rt_sigaction (__NR_Linux + 13)
+#define __NR_rt_sigprocmask (__NR_Linux + 14)
+#define __NR_ioctl (__NR_Linux + 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pread64 (__NR_Linux + 16)
+#define __NR_pwrite64 (__NR_Linux + 17)
+#define __NR_readv (__NR_Linux + 18)
+#define __NR_writev (__NR_Linux + 19)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_access (__NR_Linux + 20)
+#define __NR_pipe (__NR_Linux + 21)
+#define __NR__newselect (__NR_Linux + 22)
+#define __NR_sched_yield (__NR_Linux + 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mremap (__NR_Linux + 24)
+#define __NR_msync (__NR_Linux + 25)
+#define __NR_mincore (__NR_Linux + 26)
+#define __NR_madvise (__NR_Linux + 27)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_shmget (__NR_Linux + 28)
+#define __NR_shmat (__NR_Linux + 29)
+#define __NR_shmctl (__NR_Linux + 30)
+#define __NR_dup (__NR_Linux + 31)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_dup2 (__NR_Linux + 32)
+#define __NR_pause (__NR_Linux + 33)
+#define __NR_nanosleep (__NR_Linux + 34)
+#define __NR_getitimer (__NR_Linux + 35)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setitimer (__NR_Linux + 36)
+#define __NR_alarm (__NR_Linux + 37)
+#define __NR_getpid (__NR_Linux + 38)
+#define __NR_sendfile (__NR_Linux + 39)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_socket (__NR_Linux + 40)
+#define __NR_connect (__NR_Linux + 41)
+#define __NR_accept (__NR_Linux + 42)
+#define __NR_sendto (__NR_Linux + 43)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_recvfrom (__NR_Linux + 44)
+#define __NR_sendmsg (__NR_Linux + 45)
+#define __NR_recvmsg (__NR_Linux + 46)
+#define __NR_shutdown (__NR_Linux + 47)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_bind (__NR_Linux + 48)
+#define __NR_listen (__NR_Linux + 49)
+#define __NR_getsockname (__NR_Linux + 50)
+#define __NR_getpeername (__NR_Linux + 51)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_socketpair (__NR_Linux + 52)
+#define __NR_setsockopt (__NR_Linux + 53)
+#define __NR_getsockopt (__NR_Linux + 54)
+#define __NR_clone (__NR_Linux + 55)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fork (__NR_Linux + 56)
+#define __NR_execve (__NR_Linux + 57)
+#define __NR_exit (__NR_Linux + 58)
+#define __NR_wait4 (__NR_Linux + 59)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_kill (__NR_Linux + 60)
+#define __NR_uname (__NR_Linux + 61)
+#define __NR_semget (__NR_Linux + 62)
+#define __NR_semop (__NR_Linux + 63)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_semctl (__NR_Linux + 64)
+#define __NR_shmdt (__NR_Linux + 65)
+#define __NR_msgget (__NR_Linux + 66)
+#define __NR_msgsnd (__NR_Linux + 67)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_msgrcv (__NR_Linux + 68)
+#define __NR_msgctl (__NR_Linux + 69)
+#define __NR_fcntl (__NR_Linux + 70)
+#define __NR_flock (__NR_Linux + 71)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fsync (__NR_Linux + 72)
+#define __NR_fdatasync (__NR_Linux + 73)
+#define __NR_truncate (__NR_Linux + 74)
+#define __NR_ftruncate (__NR_Linux + 75)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getdents (__NR_Linux + 76)
+#define __NR_getcwd (__NR_Linux + 77)
+#define __NR_chdir (__NR_Linux + 78)
+#define __NR_fchdir (__NR_Linux + 79)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rename (__NR_Linux + 80)
+#define __NR_mkdir (__NR_Linux + 81)
+#define __NR_rmdir (__NR_Linux + 82)
+#define __NR_creat (__NR_Linux + 83)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_link (__NR_Linux + 84)
+#define __NR_unlink (__NR_Linux + 85)
+#define __NR_symlink (__NR_Linux + 86)
+#define __NR_readlink (__NR_Linux + 87)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_chmod (__NR_Linux + 88)
+#define __NR_fchmod (__NR_Linux + 89)
+#define __NR_chown (__NR_Linux + 90)
+#define __NR_fchown (__NR_Linux + 91)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lchown (__NR_Linux + 92)
+#define __NR_umask (__NR_Linux + 93)
+#define __NR_gettimeofday (__NR_Linux + 94)
+#define __NR_getrlimit (__NR_Linux + 95)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getrusage (__NR_Linux + 96)
+#define __NR_sysinfo (__NR_Linux + 97)
+#define __NR_times (__NR_Linux + 98)
+#define __NR_ptrace (__NR_Linux + 99)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getuid (__NR_Linux + 100)
+#define __NR_syslog (__NR_Linux + 101)
+#define __NR_getgid (__NR_Linux + 102)
+#define __NR_setuid (__NR_Linux + 103)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setgid (__NR_Linux + 104)
+#define __NR_geteuid (__NR_Linux + 105)
+#define __NR_getegid (__NR_Linux + 106)
+#define __NR_setpgid (__NR_Linux + 107)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getppid (__NR_Linux + 108)
+#define __NR_getpgrp (__NR_Linux + 109)
+#define __NR_setsid (__NR_Linux + 110)
+#define __NR_setreuid (__NR_Linux + 111)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setregid (__NR_Linux + 112)
+#define __NR_getgroups (__NR_Linux + 113)
+#define __NR_setgroups (__NR_Linux + 114)
+#define __NR_setresuid (__NR_Linux + 115)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getresuid (__NR_Linux + 116)
+#define __NR_setresgid (__NR_Linux + 117)
+#define __NR_getresgid (__NR_Linux + 118)
+#define __NR_getpgid (__NR_Linux + 119)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setfsuid (__NR_Linux + 120)
+#define __NR_setfsgid (__NR_Linux + 121)
+#define __NR_getsid (__NR_Linux + 122)
+#define __NR_capget (__NR_Linux + 123)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_capset (__NR_Linux + 124)
+#define __NR_rt_sigpending (__NR_Linux + 125)
+#define __NR_rt_sigtimedwait (__NR_Linux + 126)
+#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigsuspend (__NR_Linux + 128)
+#define __NR_sigaltstack (__NR_Linux + 129)
+#define __NR_utime (__NR_Linux + 130)
+#define __NR_mknod (__NR_Linux + 131)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_personality (__NR_Linux + 132)
+#define __NR_ustat (__NR_Linux + 133)
+#define __NR_statfs (__NR_Linux + 134)
+#define __NR_fstatfs (__NR_Linux + 135)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sysfs (__NR_Linux + 136)
+#define __NR_getpriority (__NR_Linux + 137)
+#define __NR_setpriority (__NR_Linux + 138)
+#define __NR_sched_setparam (__NR_Linux + 139)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_getparam (__NR_Linux + 140)
+#define __NR_sched_setscheduler (__NR_Linux + 141)
+#define __NR_sched_getscheduler (__NR_Linux + 142)
+#define __NR_sched_get_priority_max (__NR_Linux + 143)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_get_priority_min (__NR_Linux + 144)
+#define __NR_sched_rr_get_interval (__NR_Linux + 145)
+#define __NR_mlock (__NR_Linux + 146)
+#define __NR_munlock (__NR_Linux + 147)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mlockall (__NR_Linux + 148)
+#define __NR_munlockall (__NR_Linux + 149)
+#define __NR_vhangup (__NR_Linux + 150)
+#define __NR_pivot_root (__NR_Linux + 151)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR__sysctl (__NR_Linux + 152)
+#define __NR_prctl (__NR_Linux + 153)
+#define __NR_adjtimex (__NR_Linux + 154)
+#define __NR_setrlimit (__NR_Linux + 155)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_chroot (__NR_Linux + 156)
+#define __NR_sync (__NR_Linux + 157)
+#define __NR_acct (__NR_Linux + 158)
+#define __NR_settimeofday (__NR_Linux + 159)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mount (__NR_Linux + 160)
+#define __NR_umount2 (__NR_Linux + 161)
+#define __NR_swapon (__NR_Linux + 162)
+#define __NR_swapoff (__NR_Linux + 163)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_reboot (__NR_Linux + 164)
+#define __NR_sethostname (__NR_Linux + 165)
+#define __NR_setdomainname (__NR_Linux + 166)
+#define __NR_create_module (__NR_Linux + 167)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_init_module (__NR_Linux + 168)
+#define __NR_delete_module (__NR_Linux + 169)
+#define __NR_get_kernel_syms (__NR_Linux + 170)
+#define __NR_query_module (__NR_Linux + 171)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_quotactl (__NR_Linux + 172)
+#define __NR_nfsservctl (__NR_Linux + 173)
+#define __NR_getpmsg (__NR_Linux + 174)
+#define __NR_putpmsg (__NR_Linux + 175)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_afs_syscall (__NR_Linux + 176)
+#define __NR_reserved177 (__NR_Linux + 177)
+#define __NR_gettid (__NR_Linux + 178)
+#define __NR_readahead (__NR_Linux + 179)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setxattr (__NR_Linux + 180)
+#define __NR_lsetxattr (__NR_Linux + 181)
+#define __NR_fsetxattr (__NR_Linux + 182)
+#define __NR_getxattr (__NR_Linux + 183)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lgetxattr (__NR_Linux + 184)
+#define __NR_fgetxattr (__NR_Linux + 185)
+#define __NR_listxattr (__NR_Linux + 186)
+#define __NR_llistxattr (__NR_Linux + 187)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_flistxattr (__NR_Linux + 188)
+#define __NR_removexattr (__NR_Linux + 189)
+#define __NR_lremovexattr (__NR_Linux + 190)
+#define __NR_fremovexattr (__NR_Linux + 191)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_tkill (__NR_Linux + 192)
+#define __NR_reserved193 (__NR_Linux + 193)
+#define __NR_futex (__NR_Linux + 194)
+#define __NR_sched_setaffinity (__NR_Linux + 195)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_getaffinity (__NR_Linux + 196)
+#define __NR_cacheflush (__NR_Linux + 197)
+#define __NR_cachectl (__NR_Linux + 198)
+#define __NR_sysmips (__NR_Linux + 199)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_setup (__NR_Linux + 200)
+#define __NR_io_destroy (__NR_Linux + 201)
+#define __NR_io_getevents (__NR_Linux + 202)
+#define __NR_io_submit (__NR_Linux + 203)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_cancel (__NR_Linux + 204)
+#define __NR_exit_group (__NR_Linux + 205)
+#define __NR_lookup_dcookie (__NR_Linux + 206)
+#define __NR_epoll_create (__NR_Linux + 207)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_ctl (__NR_Linux + 208)
+#define __NR_epoll_wait (__NR_Linux + 209)
+#define __NR_remap_file_pages (__NR_Linux + 210)
+#define __NR_rt_sigreturn (__NR_Linux + 211)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_set_tid_address (__NR_Linux + 212)
+#define __NR_restart_syscall (__NR_Linux + 213)
+#define __NR_semtimedop (__NR_Linux + 214)
+#define __NR_fadvise64 (__NR_Linux + 215)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_create (__NR_Linux + 216)
+#define __NR_timer_settime (__NR_Linux + 217)
+#define __NR_timer_gettime (__NR_Linux + 218)
+#define __NR_timer_getoverrun (__NR_Linux + 219)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_delete (__NR_Linux + 220)
+#define __NR_clock_settime (__NR_Linux + 221)
+#define __NR_clock_gettime (__NR_Linux + 222)
+#define __NR_clock_getres (__NR_Linux + 223)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_nanosleep (__NR_Linux + 224)
+#define __NR_tgkill (__NR_Linux + 225)
+#define __NR_utimes (__NR_Linux + 226)
+#define __NR_mbind (__NR_Linux + 227)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_get_mempolicy (__NR_Linux + 228)
+#define __NR_set_mempolicy (__NR_Linux + 229)
+#define __NR_mq_open (__NR_Linux + 230)
+#define __NR_mq_unlink (__NR_Linux + 231)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_timedsend (__NR_Linux + 232)
+#define __NR_mq_timedreceive (__NR_Linux + 233)
+#define __NR_mq_notify (__NR_Linux + 234)
+#define __NR_mq_getsetattr (__NR_Linux + 235)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_vserver (__NR_Linux + 236)
+#define __NR_waitid (__NR_Linux + 237)
+#define __NR_add_key (__NR_Linux + 239)
+#define __NR_request_key (__NR_Linux + 240)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_keyctl (__NR_Linux + 241)
+#define __NR_set_thread_area (__NR_Linux + 242)
+#define __NR_inotify_init (__NR_Linux + 243)
+#define __NR_inotify_add_watch (__NR_Linux + 244)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_rm_watch (__NR_Linux + 245)
+#define __NR_migrate_pages (__NR_Linux + 246)
+#define __NR_openat (__NR_Linux + 247)
+#define __NR_mkdirat (__NR_Linux + 248)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mknodat (__NR_Linux + 249)
+#define __NR_fchownat (__NR_Linux + 250)
+#define __NR_futimesat (__NR_Linux + 251)
+#define __NR_newfstatat (__NR_Linux + 252)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_unlinkat (__NR_Linux + 253)
+#define __NR_renameat (__NR_Linux + 254)
+#define __NR_linkat (__NR_Linux + 255)
+#define __NR_symlinkat (__NR_Linux + 256)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_readlinkat (__NR_Linux + 257)
+#define __NR_fchmodat (__NR_Linux + 258)
+#define __NR_faccessat (__NR_Linux + 259)
+#define __NR_pselect6 (__NR_Linux + 260)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_ppoll (__NR_Linux + 261)
+#define __NR_unshare (__NR_Linux + 262)
+#define __NR_splice (__NR_Linux + 263)
+#define __NR_sync_file_range (__NR_Linux + 264)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_tee (__NR_Linux + 265)
+#define __NR_vmsplice (__NR_Linux + 266)
+#define __NR_move_pages (__NR_Linux + 267)
+#define __NR_set_robust_list (__NR_Linux + 268)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_get_robust_list (__NR_Linux + 269)
+#define __NR_kexec_load (__NR_Linux + 270)
+#define __NR_getcpu (__NR_Linux + 271)
+#define __NR_epoll_pwait (__NR_Linux + 272)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_ioprio_set (__NR_Linux + 273)
+#define __NR_ioprio_get (__NR_Linux + 274)
+#define __NR_utimensat (__NR_Linux + 275)
+#define __NR_signalfd (__NR_Linux + 276)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timerfd (__NR_Linux + 277)
+#define __NR_eventfd (__NR_Linux + 278)
+#define __NR_fallocate (__NR_Linux + 279)
+#define __NR_timerfd_create (__NR_Linux + 280)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timerfd_gettime (__NR_Linux + 281)
+#define __NR_timerfd_settime (__NR_Linux + 282)
+#define __NR_signalfd4 (__NR_Linux + 283)
+#define __NR_eventfd2 (__NR_Linux + 284)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_create1 (__NR_Linux + 285)
+#define __NR_dup3 (__NR_Linux + 286)
+#define __NR_pipe2 (__NR_Linux + 287)
+#define __NR_inotify_init1 (__NR_Linux + 288)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_Linux_syscalls 288
+#endif
+#define __NR_64_Linux 5000
+#define __NR_64_Linux_syscalls 288
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if _MIPS_SIM == _MIPS_SIM_NABI32
+#define __NR_Linux 6000
+#define __NR_read (__NR_Linux + 0)
+#define __NR_write (__NR_Linux + 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_open (__NR_Linux + 2)
+#define __NR_close (__NR_Linux + 3)
+#define __NR_stat (__NR_Linux + 4)
+#define __NR_fstat (__NR_Linux + 5)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lstat (__NR_Linux + 6)
+#define __NR_poll (__NR_Linux + 7)
+#define __NR_lseek (__NR_Linux + 8)
+#define __NR_mmap (__NR_Linux + 9)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mprotect (__NR_Linux + 10)
+#define __NR_munmap (__NR_Linux + 11)
+#define __NR_brk (__NR_Linux + 12)
+#define __NR_rt_sigaction (__NR_Linux + 13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigprocmask (__NR_Linux + 14)
+#define __NR_ioctl (__NR_Linux + 15)
+#define __NR_pread64 (__NR_Linux + 16)
+#define __NR_pwrite64 (__NR_Linux + 17)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_readv (__NR_Linux + 18)
+#define __NR_writev (__NR_Linux + 19)
+#define __NR_access (__NR_Linux + 20)
+#define __NR_pipe (__NR_Linux + 21)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR__newselect (__NR_Linux + 22)
+#define __NR_sched_yield (__NR_Linux + 23)
+#define __NR_mremap (__NR_Linux + 24)
+#define __NR_msync (__NR_Linux + 25)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mincore (__NR_Linux + 26)
+#define __NR_madvise (__NR_Linux + 27)
+#define __NR_shmget (__NR_Linux + 28)
+#define __NR_shmat (__NR_Linux + 29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_shmctl (__NR_Linux + 30)
+#define __NR_dup (__NR_Linux + 31)
+#define __NR_dup2 (__NR_Linux + 32)
+#define __NR_pause (__NR_Linux + 33)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_nanosleep (__NR_Linux + 34)
+#define __NR_getitimer (__NR_Linux + 35)
+#define __NR_setitimer (__NR_Linux + 36)
+#define __NR_alarm (__NR_Linux + 37)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getpid (__NR_Linux + 38)
+#define __NR_sendfile (__NR_Linux + 39)
+#define __NR_socket (__NR_Linux + 40)
+#define __NR_connect (__NR_Linux + 41)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_accept (__NR_Linux + 42)
+#define __NR_sendto (__NR_Linux + 43)
+#define __NR_recvfrom (__NR_Linux + 44)
+#define __NR_sendmsg (__NR_Linux + 45)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_recvmsg (__NR_Linux + 46)
+#define __NR_shutdown (__NR_Linux + 47)
+#define __NR_bind (__NR_Linux + 48)
+#define __NR_listen (__NR_Linux + 49)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getsockname (__NR_Linux + 50)
+#define __NR_getpeername (__NR_Linux + 51)
+#define __NR_socketpair (__NR_Linux + 52)
+#define __NR_setsockopt (__NR_Linux + 53)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getsockopt (__NR_Linux + 54)
+#define __NR_clone (__NR_Linux + 55)
+#define __NR_fork (__NR_Linux + 56)
+#define __NR_execve (__NR_Linux + 57)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_exit (__NR_Linux + 58)
+#define __NR_wait4 (__NR_Linux + 59)
+#define __NR_kill (__NR_Linux + 60)
+#define __NR_uname (__NR_Linux + 61)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_semget (__NR_Linux + 62)
+#define __NR_semop (__NR_Linux + 63)
+#define __NR_semctl (__NR_Linux + 64)
+#define __NR_shmdt (__NR_Linux + 65)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_msgget (__NR_Linux + 66)
+#define __NR_msgsnd (__NR_Linux + 67)
+#define __NR_msgrcv (__NR_Linux + 68)
+#define __NR_msgctl (__NR_Linux + 69)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fcntl (__NR_Linux + 70)
+#define __NR_flock (__NR_Linux + 71)
+#define __NR_fsync (__NR_Linux + 72)
+#define __NR_fdatasync (__NR_Linux + 73)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_truncate (__NR_Linux + 74)
+#define __NR_ftruncate (__NR_Linux + 75)
+#define __NR_getdents (__NR_Linux + 76)
+#define __NR_getcwd (__NR_Linux + 77)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_chdir (__NR_Linux + 78)
+#define __NR_fchdir (__NR_Linux + 79)
+#define __NR_rename (__NR_Linux + 80)
+#define __NR_mkdir (__NR_Linux + 81)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rmdir (__NR_Linux + 82)
+#define __NR_creat (__NR_Linux + 83)
+#define __NR_link (__NR_Linux + 84)
+#define __NR_unlink (__NR_Linux + 85)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_symlink (__NR_Linux + 86)
+#define __NR_readlink (__NR_Linux + 87)
+#define __NR_chmod (__NR_Linux + 88)
+#define __NR_fchmod (__NR_Linux + 89)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_chown (__NR_Linux + 90)
+#define __NR_fchown (__NR_Linux + 91)
+#define __NR_lchown (__NR_Linux + 92)
+#define __NR_umask (__NR_Linux + 93)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_gettimeofday (__NR_Linux + 94)
+#define __NR_getrlimit (__NR_Linux + 95)
+#define __NR_getrusage (__NR_Linux + 96)
+#define __NR_sysinfo (__NR_Linux + 97)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_times (__NR_Linux + 98)
+#define __NR_ptrace (__NR_Linux + 99)
+#define __NR_getuid (__NR_Linux + 100)
+#define __NR_syslog (__NR_Linux + 101)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getgid (__NR_Linux + 102)
+#define __NR_setuid (__NR_Linux + 103)
+#define __NR_setgid (__NR_Linux + 104)
+#define __NR_geteuid (__NR_Linux + 105)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getegid (__NR_Linux + 106)
+#define __NR_setpgid (__NR_Linux + 107)
+#define __NR_getppid (__NR_Linux + 108)
+#define __NR_getpgrp (__NR_Linux + 109)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setsid (__NR_Linux + 110)
+#define __NR_setreuid (__NR_Linux + 111)
+#define __NR_setregid (__NR_Linux + 112)
+#define __NR_getgroups (__NR_Linux + 113)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setgroups (__NR_Linux + 114)
+#define __NR_setresuid (__NR_Linux + 115)
+#define __NR_getresuid (__NR_Linux + 116)
+#define __NR_setresgid (__NR_Linux + 117)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getresgid (__NR_Linux + 118)
+#define __NR_getpgid (__NR_Linux + 119)
+#define __NR_setfsuid (__NR_Linux + 120)
+#define __NR_setfsgid (__NR_Linux + 121)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getsid (__NR_Linux + 122)
+#define __NR_capget (__NR_Linux + 123)
+#define __NR_capset (__NR_Linux + 124)
+#define __NR_rt_sigpending (__NR_Linux + 125)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigtimedwait (__NR_Linux + 126)
+#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
+#define __NR_rt_sigsuspend (__NR_Linux + 128)
+#define __NR_sigaltstack (__NR_Linux + 129)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_utime (__NR_Linux + 130)
+#define __NR_mknod (__NR_Linux + 131)
+#define __NR_personality (__NR_Linux + 132)
+#define __NR_ustat (__NR_Linux + 133)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_statfs (__NR_Linux + 134)
+#define __NR_fstatfs (__NR_Linux + 135)
+#define __NR_sysfs (__NR_Linux + 136)
+#define __NR_getpriority (__NR_Linux + 137)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setpriority (__NR_Linux + 138)
+#define __NR_sched_setparam (__NR_Linux + 139)
+#define __NR_sched_getparam (__NR_Linux + 140)
+#define __NR_sched_setscheduler (__NR_Linux + 141)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_getscheduler (__NR_Linux + 142)
+#define __NR_sched_get_priority_max (__NR_Linux + 143)
+#define __NR_sched_get_priority_min (__NR_Linux + 144)
+#define __NR_sched_rr_get_interval (__NR_Linux + 145)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mlock (__NR_Linux + 146)
+#define __NR_munlock (__NR_Linux + 147)
+#define __NR_mlockall (__NR_Linux + 148)
+#define __NR_munlockall (__NR_Linux + 149)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_vhangup (__NR_Linux + 150)
+#define __NR_pivot_root (__NR_Linux + 151)
+#define __NR__sysctl (__NR_Linux + 152)
+#define __NR_prctl (__NR_Linux + 153)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_adjtimex (__NR_Linux + 154)
+#define __NR_setrlimit (__NR_Linux + 155)
+#define __NR_chroot (__NR_Linux + 156)
+#define __NR_sync (__NR_Linux + 157)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_acct (__NR_Linux + 158)
+#define __NR_settimeofday (__NR_Linux + 159)
+#define __NR_mount (__NR_Linux + 160)
+#define __NR_umount2 (__NR_Linux + 161)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_swapon (__NR_Linux + 162)
+#define __NR_swapoff (__NR_Linux + 163)
+#define __NR_reboot (__NR_Linux + 164)
+#define __NR_sethostname (__NR_Linux + 165)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setdomainname (__NR_Linux + 166)
+#define __NR_create_module (__NR_Linux + 167)
+#define __NR_init_module (__NR_Linux + 168)
+#define __NR_delete_module (__NR_Linux + 169)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_get_kernel_syms (__NR_Linux + 170)
+#define __NR_query_module (__NR_Linux + 171)
+#define __NR_quotactl (__NR_Linux + 172)
+#define __NR_nfsservctl (__NR_Linux + 173)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getpmsg (__NR_Linux + 174)
+#define __NR_putpmsg (__NR_Linux + 175)
+#define __NR_afs_syscall (__NR_Linux + 176)
+#define __NR_reserved177 (__NR_Linux + 177)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_gettid (__NR_Linux + 178)
+#define __NR_readahead (__NR_Linux + 179)
+#define __NR_setxattr (__NR_Linux + 180)
+#define __NR_lsetxattr (__NR_Linux + 181)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fsetxattr (__NR_Linux + 182)
+#define __NR_getxattr (__NR_Linux + 183)
+#define __NR_lgetxattr (__NR_Linux + 184)
+#define __NR_fgetxattr (__NR_Linux + 185)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_listxattr (__NR_Linux + 186)
+#define __NR_llistxattr (__NR_Linux + 187)
+#define __NR_flistxattr (__NR_Linux + 188)
+#define __NR_removexattr (__NR_Linux + 189)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lremovexattr (__NR_Linux + 190)
+#define __NR_fremovexattr (__NR_Linux + 191)
+#define __NR_tkill (__NR_Linux + 192)
+#define __NR_reserved193 (__NR_Linux + 193)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_futex (__NR_Linux + 194)
+#define __NR_sched_setaffinity (__NR_Linux + 195)
+#define __NR_sched_getaffinity (__NR_Linux + 196)
+#define __NR_cacheflush (__NR_Linux + 197)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_cachectl (__NR_Linux + 198)
+#define __NR_sysmips (__NR_Linux + 199)
+#define __NR_io_setup (__NR_Linux + 200)
+#define __NR_io_destroy (__NR_Linux + 201)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_getevents (__NR_Linux + 202)
+#define __NR_io_submit (__NR_Linux + 203)
+#define __NR_io_cancel (__NR_Linux + 204)
+#define __NR_exit_group (__NR_Linux + 205)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lookup_dcookie (__NR_Linux + 206)
+#define __NR_epoll_create (__NR_Linux + 207)
+#define __NR_epoll_ctl (__NR_Linux + 208)
+#define __NR_epoll_wait (__NR_Linux + 209)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_remap_file_pages (__NR_Linux + 210)
+#define __NR_rt_sigreturn (__NR_Linux + 211)
+#define __NR_fcntl64 (__NR_Linux + 212)
+#define __NR_set_tid_address (__NR_Linux + 213)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_restart_syscall (__NR_Linux + 214)
+#define __NR_semtimedop (__NR_Linux + 215)
+#define __NR_fadvise64 (__NR_Linux + 216)
+#define __NR_statfs64 (__NR_Linux + 217)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fstatfs64 (__NR_Linux + 218)
+#define __NR_sendfile64 (__NR_Linux + 219)
+#define __NR_timer_create (__NR_Linux + 220)
+#define __NR_timer_settime (__NR_Linux + 221)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_gettime (__NR_Linux + 222)
+#define __NR_timer_getoverrun (__NR_Linux + 223)
+#define __NR_timer_delete (__NR_Linux + 224)
+#define __NR_clock_settime (__NR_Linux + 225)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_gettime (__NR_Linux + 226)
+#define __NR_clock_getres (__NR_Linux + 227)
+#define __NR_clock_nanosleep (__NR_Linux + 228)
+#define __NR_tgkill (__NR_Linux + 229)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_utimes (__NR_Linux + 230)
+#define __NR_mbind (__NR_Linux + 231)
+#define __NR_get_mempolicy (__NR_Linux + 232)
+#define __NR_set_mempolicy (__NR_Linux + 233)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_open (__NR_Linux + 234)
+#define __NR_mq_unlink (__NR_Linux + 235)
+#define __NR_mq_timedsend (__NR_Linux + 236)
+#define __NR_mq_timedreceive (__NR_Linux + 237)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_notify (__NR_Linux + 238)
+#define __NR_mq_getsetattr (__NR_Linux + 239)
+#define __NR_vserver (__NR_Linux + 240)
+#define __NR_waitid (__NR_Linux + 241)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_add_key (__NR_Linux + 243)
+#define __NR_request_key (__NR_Linux + 244)
+#define __NR_keyctl (__NR_Linux + 245)
+#define __NR_set_thread_area (__NR_Linux + 246)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_init (__NR_Linux + 247)
+#define __NR_inotify_add_watch (__NR_Linux + 248)
+#define __NR_inotify_rm_watch (__NR_Linux + 249)
+#define __NR_migrate_pages (__NR_Linux + 250)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_openat (__NR_Linux + 251)
+#define __NR_mkdirat (__NR_Linux + 252)
+#define __NR_mknodat (__NR_Linux + 253)
+#define __NR_fchownat (__NR_Linux + 254)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_futimesat (__NR_Linux + 255)
+#define __NR_newfstatat (__NR_Linux + 256)
+#define __NR_unlinkat (__NR_Linux + 257)
+#define __NR_renameat (__NR_Linux + 258)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_linkat (__NR_Linux + 259)
+#define __NR_symlinkat (__NR_Linux + 260)
+#define __NR_readlinkat (__NR_Linux + 261)
+#define __NR_fchmodat (__NR_Linux + 262)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_faccessat (__NR_Linux + 263)
+#define __NR_pselect6 (__NR_Linux + 264)
+#define __NR_ppoll (__NR_Linux + 265)
+#define __NR_unshare (__NR_Linux + 266)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_splice (__NR_Linux + 267)
+#define __NR_sync_file_range (__NR_Linux + 268)
+#define __NR_tee (__NR_Linux + 269)
+#define __NR_vmsplice (__NR_Linux + 270)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_move_pages (__NR_Linux + 271)
+#define __NR_set_robust_list (__NR_Linux + 272)
+#define __NR_get_robust_list (__NR_Linux + 273)
+#define __NR_kexec_load (__NR_Linux + 274)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getcpu (__NR_Linux + 275)
+#define __NR_epoll_pwait (__NR_Linux + 276)
+#define __NR_ioprio_set (__NR_Linux + 277)
+#define __NR_ioprio_get (__NR_Linux + 278)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_utimensat (__NR_Linux + 279)
+#define __NR_signalfd (__NR_Linux + 280)
+#define __NR_timerfd (__NR_Linux + 281)
+#define __NR_eventfd (__NR_Linux + 282)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fallocate (__NR_Linux + 283)
+#define __NR_timerfd_create (__NR_Linux + 284)
+#define __NR_timerfd_gettime (__NR_Linux + 285)
+#define __NR_timerfd_settime (__NR_Linux + 286)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_signalfd4 (__NR_Linux + 287)
+#define __NR_eventfd2 (__NR_Linux + 288)
+#define __NR_epoll_create1 (__NR_Linux + 289)
+#define __NR_dup3 (__NR_Linux + 290)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pipe2 (__NR_Linux + 291)
+#define __NR_inotify_init1 (__NR_Linux + 292)
+#define __NR_Linux_syscalls 292
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_N32_Linux 6000
+#define __NR_N32_Linux_syscalls 292
+#endif
diff --git a/libc/kernel/arch-mips/asm/user.h b/libc/kernel/arch-mips/asm/user.h
new file mode 100644
index 0000000..a87f239
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/user.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_USER_H
+#define _ASM_USER_H
+#include <asm/page.h>
+#include <asm/reg.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EF_SIZE 180
+struct user {
+ unsigned long regs[EF_SIZE /
+ sizeof(unsigned long) + 64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ size_t u_tsize;
+ size_t u_dsize;
+ size_t u_ssize;
+ unsigned long start_code;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long start_data;
+ unsigned long start_stack;
+ long int signal;
+ unsigned long u_ar0;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long magic;
+ char u_comm[32];
+};
+#define NBPG PAGE_SIZE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_DATA_START_ADDR (u.start_data)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/vga.h b/libc/kernel/arch-mips/asm/vga.h
new file mode 100644
index 0000000..c0c2535
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/vga.h
@@ -0,0 +1,35 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_VGA_H
+#define _ASM_VGA_H
+#include <asm/byteorder.h>
+#define VGA_MAP_MEM(x, s) (0xb0000000L + (unsigned long)(x))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define vga_readb(x) (*(x))
+#define vga_writeb(x, y) (*(y) = (x))
+#define VT_BUF_HAVE_RW
+#undef scr_writew
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#undef scr_readw
+#define scr_memcpyw(d, s, c) memcpy(d, s, c)
+#define scr_memmovew(d, s, c) memmove(d, s, c)
+#define VT_BUF_HAVE_MEMCPYW
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VT_BUF_HAVE_MEMMOVEW
+#endif
diff --git a/libc/kernel/arch-mips/asm/vr41xx/irq.h b/libc/kernel/arch-mips/asm/vr41xx/irq.h
new file mode 100644
index 0000000..1c54b66
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/vr41xx/irq.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __NEC_VR41XX_IRQ_H
+#define __NEC_VR41XX_IRQ_H
+#define MIPS_CPU_IRQ_BASE 0
+#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
+#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
+#define INT0_IRQ MIPS_CPU_IRQ(2)
+#define INT1_IRQ MIPS_CPU_IRQ(3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define INT2_IRQ MIPS_CPU_IRQ(4)
+#define INT3_IRQ MIPS_CPU_IRQ(5)
+#define INT4_IRQ MIPS_CPU_IRQ(6)
+#define TIMER_IRQ MIPS_CPU_IRQ(7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYSINT1_IRQ_BASE 8
+#define SYSINT1_IRQ(x) (SYSINT1_IRQ_BASE + (x))
+#define BATTRY_IRQ SYSINT1_IRQ(0)
+#define POWER_IRQ SYSINT1_IRQ(1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RTCLONG1_IRQ SYSINT1_IRQ(2)
+#define ELAPSEDTIME_IRQ SYSINT1_IRQ(3)
+#define PIU_IRQ SYSINT1_IRQ(5)
+#define AIU_IRQ SYSINT1_IRQ(6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define KIU_IRQ SYSINT1_IRQ(7)
+#define GIUINT_IRQ SYSINT1_IRQ(8)
+#define SIU_IRQ SYSINT1_IRQ(9)
+#define BUSERR_IRQ SYSINT1_IRQ(10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SOFTINT_IRQ SYSINT1_IRQ(11)
+#define CLKRUN_IRQ SYSINT1_IRQ(12)
+#define DOZEPIU_IRQ SYSINT1_IRQ(13)
+#define SYSINT1_IRQ_LAST DOZEPIU_IRQ
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SYSINT2_IRQ_BASE 24
+#define SYSINT2_IRQ(x) (SYSINT2_IRQ_BASE + (x))
+#define RTCLONG2_IRQ SYSINT2_IRQ(0)
+#define LED_IRQ SYSINT2_IRQ(1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define HSP_IRQ SYSINT2_IRQ(2)
+#define TCLOCK_IRQ SYSINT2_IRQ(3)
+#define FIR_IRQ SYSINT2_IRQ(4)
+#define CEU_IRQ SYSINT2_IRQ(4)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DSIU_IRQ SYSINT2_IRQ(5)
+#define PCI_IRQ SYSINT2_IRQ(6)
+#define SCU_IRQ SYSINT2_IRQ(7)
+#define CSI_IRQ SYSINT2_IRQ(8)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define BCU_IRQ SYSINT2_IRQ(9)
+#define ETHERNET_IRQ SYSINT2_IRQ(10)
+#define SYSINT2_IRQ_LAST ETHERNET_IRQ
+#define GIU_IRQ_BASE 40
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GIU_IRQ(x) (GIU_IRQ_BASE + (x))  
+#define GIU_IRQ_LAST GIU_IRQ(31)
+#define VRC4173_IRQ_BASE 72
+#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VRC4173_USB_IRQ VRC4173_IRQ(0)
+#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
+#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
+#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
+#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
+#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
+#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
+#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
+#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
+#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
+#endif
diff --git a/libc/kernel/arch-mips/asm/war.h b/libc/kernel/arch-mips/asm/war.h
new file mode 100644
index 0000000..d8f95b2
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/war.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_WAR_H
+#define _ASM_WAR_H
+#include <war.h>
+#define R4000_WAR 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R4400_WAR 0
+#define DADDI_WAR 0
+#ifndef R4600_V1_INDEX_ICACHEOP_WAR
+#error Check setting of R4600_V1_INDEX_ICACHEOP_WAR for your platform
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef R4600_V1_HIT_CACHEOP_WAR
+#error Check setting of R4600_V1_HIT_CACHEOP_WAR for your platform
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef R4600_V2_HIT_CACHEOP_WAR
+#error Check setting of R4600_V2_HIT_CACHEOP_WAR for your platform
+#endif
+#ifndef R5432_CP0_INTERRUPT_WAR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#error Check setting of R5432_CP0_INTERRUPT_WAR for your platform
+#endif
+#ifndef BCM1250_M3_WAR
+#error Check setting of BCM1250_M3_WAR for your platform
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef SIBYTE_1956_WAR
+#error Check setting of SIBYTE_1956_WAR for your platform
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef MIPS4K_ICACHE_REFILL_WAR
+#error Check setting of MIPS4K_ICACHE_REFILL_WAR for your platform
+#endif
+#ifndef MIPS_CACHE_SYNC_WAR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#error Check setting of MIPS_CACHE_SYNC_WAR for your platform
+#endif
+#ifndef TX49XX_ICACHE_INDEX_INV_WAR
+#error Check setting of TX49XX_ICACHE_INDEX_INV_WAR for your platform
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef RM9000_CDEX_SMP_WAR
+#error Check setting of RM9000_CDEX_SMP_WAR for your platform
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef ICACHE_REFILLS_WORKAROUND_WAR
+#error Check setting of ICACHE_REFILLS_WORKAROUND_WAR for your platform
+#endif
+#ifndef R10000_LLSC_WAR
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#error Check setting of R10000_LLSC_WAR for your platform
+#endif
+#ifndef MIPS34K_MISSED_ITLB_WAR
+#error Check setting of MIPS34K_MISSED_ITLB_WAR for your platform
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/xtalk/xtalk.h b/libc/kernel/arch-mips/asm/xtalk/xtalk.h
new file mode 100644
index 0000000..3dfbaa0
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/xtalk/xtalk.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_XTALK_XTALK_H
+#define _ASM_XTALK_XTALK_H
+#ifndef __ASSEMBLY__
+typedef char xwidgetnum_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XWIDGET_NONE -1
+typedef int xwidget_part_num_t;
+#define XWIDGET_PART_NUM_NONE -1
+typedef int xwidget_rev_num_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XWIDGET_REV_NUM_NONE -1
+typedef int xwidget_mfg_num_t;
+#define XWIDGET_MFG_NUM_NONE -1
+typedef struct xtalk_piomap_s *xtalk_piomap_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XIO_NOWHERE (0xFFFFFFFFFFFFFFFFull)
+#define XIO_ADDR_BITS (0x0000FFFFFFFFFFFFull)
+#define XIO_PORT_BITS (0xF000000000000000ull)
+#define XIO_PORT_SHIFT (60)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define XIO_PACKED(x) (((x)&XIO_PORT_BITS) != 0)
+#define XIO_ADDR(x) ((x)&XIO_ADDR_BITS)
+#define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
+#define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-mips/asm/xtalk/xwidget.h b/libc/kernel/arch-mips/asm/xtalk/xwidget.h
new file mode 100644
index 0000000..03bb4c1
--- /dev/null
+++ b/libc/kernel/arch-mips/asm/xtalk/xwidget.h
@@ -0,0 +1,154 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_XTALK_XWIDGET_H
+#define _ASM_XTALK_XWIDGET_H
+#include <linux/types.h>
+#include <asm/xtalk/xtalk.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_ID 0x04
+#define WIDGET_STATUS 0x0c
+#define WIDGET_ERR_UPPER_ADDR 0x14
+#define WIDGET_ERR_LOWER_ADDR 0x1c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_CONTROL 0x24
+#define WIDGET_REQ_TIMEOUT 0x2c
+#define WIDGET_INTDEST_UPPER_ADDR 0x34
+#define WIDGET_INTDEST_LOWER_ADDR 0x3c
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_ERR_CMD_WORD 0x44
+#define WIDGET_LLP_CFG 0x4c
+#define WIDGET_TFLUSH 0x54
+#define WIDGET_REV_NUM 0xf0000000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_PART_NUM 0x0ffff000
+#define WIDGET_MFG_NUM 0x00000ffe
+#define WIDGET_REV_NUM_SHFT 28
+#define WIDGET_PART_NUM_SHFT 12
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_MFG_NUM_SHFT 1
+#define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
+#define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
+#define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_LLP_REC_CNT 0xff000000
+#define WIDGET_LLP_TX_CNT 0x00ff0000
+#define WIDGET_PENDING 0x0000001f
+#define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_F_BAD_PKT 0x00010000
+#define WIDGET_LLP_XBAR_CRD 0x0000f000
+#define WIDGET_LLP_XBAR_CRD_SHFT 12
+#define WIDGET_CLR_RLLP_CNT 0x00000800
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_CLR_TLLP_CNT 0x00000400
+#define WIDGET_SYS_END 0x00000200
+#define WIDGET_MAX_TRANS 0x000001f0
+#define WIDGET_WIDGET_ID 0x0000000f
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_INT_VECTOR 0xff000000
+#define WIDGET_INT_VECTOR_SHFT 24
+#define WIDGET_TARGET_ID 0x000f0000
+#define WIDGET_TARGET_ID_SHFT 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_UPP_ADDR 0x0000ffff
+#define WIDGET_DIDN 0xf0000000
+#define WIDGET_SIDN 0x0f000000
+#define WIDGET_PACTYP 0x00f00000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_TNUM 0x000f8000
+#define WIDGET_COHERENT 0x00004000
+#define WIDGET_DS 0x00003000
+#define WIDGET_GBR 0x00000800
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_VBPM 0x00000400
+#define WIDGET_ERROR 0x00000200
+#define WIDGET_BARRIER 0x00000100
+#define WIDGET_LLP_MAXRETRY 0x03ff0000
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_LLP_MAXRETRY_SHFT 16
+#define WIDGET_LLP_NULLTIMEOUT 0x0000fc00
+#define WIDGET_LLP_NULLTIMEOUT_SHFT 10
+#define WIDGET_LLP_MAXBURST 0x000003ff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define WIDGET_LLP_MAXBURST_SHFT 0
+#ifndef __ASSEMBLY__
+typedef u32 widgetreg_t;
+typedef volatile struct widget_cfg {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widgetreg_t w_pad_0;
+ widgetreg_t w_id;
+ widgetreg_t w_pad_1;
+ widgetreg_t w_status;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widgetreg_t w_pad_2;
+ widgetreg_t w_err_upper_addr;
+ widgetreg_t w_pad_3;
+ widgetreg_t w_err_lower_addr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widgetreg_t w_pad_4;
+ widgetreg_t w_control;
+ widgetreg_t w_pad_5;
+ widgetreg_t w_req_timeout;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widgetreg_t w_pad_6;
+ widgetreg_t w_intdest_upper_addr;
+ widgetreg_t w_pad_7;
+ widgetreg_t w_intdest_lower_addr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widgetreg_t w_pad_8;
+ widgetreg_t w_err_cmd_word;
+ widgetreg_t w_pad_9;
+ widgetreg_t w_llp_cfg;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ widgetreg_t w_pad_10;
+ widgetreg_t w_tflush;
+} widget_cfg_t;
+typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned didn:4;
+ unsigned sidn:4;
+ unsigned pactyp:4;
+ unsigned tnum:5;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned ct:1;
+ unsigned ds:2;
+ unsigned gbr:1;
+ unsigned vbpm:1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned error:1;
+ unsigned bo:1;
+ unsigned other:8;
+} w_err_cmd_word_f;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef union {
+ widgetreg_t r;
+ w_err_cmd_word_f f;
+} w_err_cmd_word_u;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef struct xwidget_info_s *xwidget_info_t;
+typedef struct xwidget_hwid_s {
+ xwidget_part_num_t part_num;
+ xwidget_rev_num_t rev_num;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ xwidget_mfg_num_t mfg_num;
+} *xwidget_hwid_t;
+#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2)   (((hwid1)->part_num == (hwid2)->part_num) &&   (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) ||   ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) ||   ((hwid1)->mfg_num == (hwid2)->mfg_num)))
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-sh/asm/adc.h b/libc/kernel/arch-sh/asm/adc.h
deleted file mode 100644
index 10de9ca..0000000
--- a/libc/kernel/arch-sh/asm/adc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_ADC_H
-#define __ASM_ADC_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/addrspace.h b/libc/kernel/arch-sh/asm/addrspace.h
deleted file mode 100644
index d7d592d..0000000
--- a/libc/kernel/arch-sh/asm/addrspace.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ADDRSPACE_H
-#define __ASM_SH_ADDRSPACE_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/atomic-grb.h b/libc/kernel/arch-sh/asm/atomic-grb.h
deleted file mode 100644
index 6c24b1d..0000000
--- a/libc/kernel/arch-sh/asm/atomic-grb.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_GRB_H
-#define __ASM_SH_ATOMIC_GRB_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/atomic-llsc.h b/libc/kernel/arch-sh/asm/atomic-llsc.h
deleted file mode 100644
index 22e63e7..0000000
--- a/libc/kernel/arch-sh/asm/atomic-llsc.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_LLSC_H
-#define __ASM_SH_ATOMIC_LLSC_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/atomic.h b/libc/kernel/arch-sh/asm/atomic.h
deleted file mode 100644
index e8f332d..0000000
--- a/libc/kernel/arch-sh/asm/atomic.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ATOMIC_H
-#define __ASM_SH_ATOMIC_H
-
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i) ((v)->counter = (i))
-
-#include <linux/compiler.h>
-#include <asm/system.h>
-
-#include <asm/atomic-llsc.h>
-
-#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
-
-#define atomic_dec_return(v) atomic_sub_return(1,(v))
-#define atomic_inc_return(v) atomic_add_return(1,(v))
-
-#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
-
-#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
-
-#define atomic_inc(v) atomic_add(1,(v))
-#define atomic_dec(v) atomic_sub(1,(v))
-
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
-#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-#define smp_mb__before_atomic_dec() barrier()
-#define smp_mb__after_atomic_dec() barrier()
-#define smp_mb__before_atomic_inc() barrier()
-#define smp_mb__after_atomic_inc() barrier()
-#include <asm-generic/atomic.h>
-#endif
diff --git a/libc/kernel/arch-sh/asm/auxvec.h b/libc/kernel/arch-sh/asm/auxvec.h
deleted file mode 100644
index 98317bc..0000000
--- a/libc/kernel/arch-sh/asm/auxvec.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_AUXVEC_H
-#define __ASM_SH_AUXVEC_H
-
-#define AT_FPUCW 18  
-
-#define AT_SYSINFO_EHDR 33
-
-#define AT_L1I_CACHESHAPE 34
-#define AT_L1D_CACHESHAPE 35
-#define AT_L2_CACHESHAPE 36
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/bitops-grb.h b/libc/kernel/arch-sh/asm/bitops-grb.h
deleted file mode 100644
index d881058..0000000
--- a/libc/kernel/arch-sh/asm/bitops-grb.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BITOPS_GRB_H
-#define __ASM_SH_BITOPS_GRB_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/bitops-irq.h b/libc/kernel/arch-sh/asm/bitops-irq.h
deleted file mode 100644
index a20d3ec..0000000
--- a/libc/kernel/arch-sh/asm/bitops-irq.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BITOPS_IRQ_H
-#define __ASM_SH_BITOPS_IRQ_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/bitops.h b/libc/kernel/arch-sh/asm/bitops.h
deleted file mode 100644
index 4c1f6d6..0000000
--- a/libc/kernel/arch-sh/asm/bitops.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BITOPS_H
-#define __ASM_SH_BITOPS_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/bug.h b/libc/kernel/arch-sh/asm/bug.h
deleted file mode 100644
index dd02cb9..0000000
--- a/libc/kernel/arch-sh/asm/bug.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BUG_H
-#define __ASM_SH_BUG_H
-
-#define TRAPA_BUG_OPCODE 0xc33e  
-
-#define HAVE_ARCH_BUG
-#define HAVE_ARCH_WARN_ON
-
-#define _EMIT_BUG_ENTRY   "\t.pushsection __bug_table,\"a\"\n"   "2:\t.long 1b\n"   "\t.short %O3\n"   "\t.org 2b+%O4\n"   "\t.popsection\n"
-
-#define BUG()  do {   __asm__ __volatile__ (   "1:\t.short %O0\n"   _EMIT_BUG_ENTRY   :   : "n" (TRAPA_BUG_OPCODE),   "i" (__FILE__),   "i" (__LINE__), "i" (0),   "i" (sizeof(struct bug_entry)));  } while (0)
-
-#define __WARN()  do {   __asm__ __volatile__ (   "1:\t.short %O0\n"   _EMIT_BUG_ENTRY   :   : "n" (TRAPA_BUG_OPCODE),   "i" (__FILE__),   "i" (__LINE__),   "i" (BUGFLAG_WARNING),   "i" (sizeof(struct bug_entry)));  } while (0)
-
-#define WARN_ON(x) ({   int __ret_warn_on = !!(x);   if (__builtin_constant_p(__ret_warn_on)) {   if (__ret_warn_on)   __WARN();   } else {   if (unlikely(__ret_warn_on))   __WARN();   }   unlikely(__ret_warn_on);  })
-
-#include <asm-generic/bug.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/bugs.h b/libc/kernel/arch-sh/asm/bugs.h
deleted file mode 100644
index 3b27870..0000000
--- a/libc/kernel/arch-sh/asm/bugs.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BUGS_H
-#define __ASM_SH_BUGS_H
-
-#include <asm/processor.h>
-
-#ifndef __LITTLE_ENDIAN__
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/byteorder.h b/libc/kernel/arch-sh/asm/byteorder.h
deleted file mode 100644
index 04ef224..0000000
--- a/libc/kernel/arch-sh/asm/byteorder.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BYTEORDER_H
-#define __ASM_SH_BYTEORDER_H
-
-#include <linux/compiler.h>
-#include <linux/types.h>
-
-static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
-{
- __asm__(
-#ifdef __SH5__
- "byterev	%0, %0\n\t"
- "shari		%0, 32, %0"
-#else
- "swap.b		%0, %0\n\t"
- "swap.w		%0, %0\n\t"
- "swap.b		%0, %0"
-#endif
- : "=r" (x)
- : "0" (x));
-
- return x;
-}
-
-static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
-{
- __asm__(
-#ifdef __SH5__
- "byterev	%0, %0\n\t"
- "shari		%0, 32, %0"
-#else
- "swap.b		%0, %0"
-#endif
- : "=r" (x)
- : "0" (x));
-
- return x;
-}
-
-static inline __u64 ___arch__swab64(__u64 val)
-{
- union {
- struct { __u32 a,b; } s;
- __u64 u;
- } v, w;
- v.u = val;
- w.s.b = ___arch__swab32(v.s.a);
- w.s.a = ___arch__swab32(v.s.b);
- return w.u;
-}
-
-#define __arch__swab64(x) ___arch__swab64(x)
-#define __arch__swab32(x) ___arch__swab32(x)
-#define __arch__swab16(x) ___arch__swab16(x)
-
-#ifndef __STRICT_ANSI__
-#define __BYTEORDER_HAS_U64__
-#define __SWAB_64_THRU_32__
-#endif
-
-#ifdef __LITTLE_ENDIAN__
-#include <linux/byteorder/little_endian.h>
-#else
-#include <linux/byteorder/big_endian.h>
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/cache.h b/libc/kernel/arch-sh/asm/cache.h
deleted file mode 100644
index 0bc339e..0000000
--- a/libc/kernel/arch-sh/asm/cache.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CACHE_H
-#define __ASM_SH_CACHE_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/cacheflush.h b/libc/kernel/arch-sh/asm/cacheflush.h
deleted file mode 100644
index 5c95ad1..0000000
--- a/libc/kernel/arch-sh/asm/cacheflush.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CACHEFLUSH_H
-#define __ASM_SH_CACHEFLUSH_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/checksum.h b/libc/kernel/arch-sh/asm/checksum.h
deleted file mode 100644
index c9193c5..0000000
--- a/libc/kernel/arch-sh/asm/checksum.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include "checksum_32.h"
diff --git a/libc/kernel/arch-sh/asm/checksum_32.h b/libc/kernel/arch-sh/asm/checksum_32.h
deleted file mode 100644
index 7a84e19..0000000
--- a/libc/kernel/arch-sh/asm/checksum_32.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CHECKSUM_H
-#define __ASM_SH_CHECKSUM_H
-
-#include <linux/in6.h>
-
-#ifdef __LITTLE_ENDIAN__
-#else
-#endif
-#define _HAVE_ARCH_IPV6_CSUM
-#define HAVE_CSUM_COPY_USER
-#endif
diff --git a/libc/kernel/arch-sh/asm/checksum_64.h b/libc/kernel/arch-sh/asm/checksum_64.h
deleted file mode 100644
index 203e11d..0000000
--- a/libc/kernel/arch-sh/asm/checksum_64.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CHECKSUM_64_H
-#define __ASM_SH_CHECKSUM_64_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/clock.h b/libc/kernel/arch-sh/asm/clock.h
deleted file mode 100644
index 9f127c3..0000000
--- a/libc/kernel/arch-sh/asm/clock.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CLOCK_H
-#define __ASM_SH_CLOCK_H
-
-#include <linux/kref.h>
-#include <linux/list.h>
-#include <linux/seq_file.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-struct clk;
-
-struct clk_ops {
- void (*init)(struct clk *clk);
- void (*enable)(struct clk *clk);
- void (*disable)(struct clk *clk);
- void (*recalc)(struct clk *clk);
- int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
- long (*round_rate)(struct clk *clk, unsigned long rate);
-};
-
-struct clk {
- struct list_head node;
- const char *name;
- int id;
- struct module *owner;
-
- struct clk *parent;
- struct clk_ops *ops;
-
- struct kref kref;
-
- unsigned long rate;
- unsigned long flags;
- unsigned long arch_flags;
-};
-
-#define CLK_ALWAYS_ENABLED (1 << 0)
-#define CLK_RATE_PROPAGATES (1 << 1)
-
-enum clk_sh_algo_id {
- NO_CHANGE = 0,
-
- IUS_N1_N1,
- IUS_322,
- IUS_522,
- IUS_N11,
-
- SB_N1,
-
- SB3_N1,
- SB3_32,
- SB3_43,
- SB3_54,
-
- BP_N1,
-
- IP_N1,
-};
-#endif
diff --git a/libc/kernel/arch-sh/asm/cmpxchg-grb.h b/libc/kernel/arch-sh/asm/cmpxchg-grb.h
deleted file mode 100644
index 7d35595..0000000
--- a/libc/kernel/arch-sh/asm/cmpxchg-grb.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CMPXCHG_GRB_H
-#define __ASM_SH_CMPXCHG_GRB_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/cmpxchg-irq.h b/libc/kernel/arch-sh/asm/cmpxchg-irq.h
deleted file mode 100644
index 5558b1f..0000000
--- a/libc/kernel/arch-sh/asm/cmpxchg-irq.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CMPXCHG_IRQ_H
-#define __ASM_SH_CMPXCHG_IRQ_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/cpu-features.h b/libc/kernel/arch-sh/asm/cpu-features.h
deleted file mode 100644
index 326d2d9..0000000
--- a/libc/kernel/arch-sh/asm/cpu-features.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_CPU_FEATURES_H
-#define __ASM_SH_CPU_FEATURES_H
-
-#define CPU_HAS_FPU 0x0001  
-#define CPU_HAS_P2_FLUSH_BUG 0x0002  
-#define CPU_HAS_MMU_PAGE_ASSOC 0x0004  
-#define CPU_HAS_DSP 0x0008  
-#define CPU_HAS_PERF_COUNTER 0x0010  
-#define CPU_HAS_PTEA 0x0020  
-#define CPU_HAS_LLSC 0x0040  
-#define CPU_HAS_L2_CACHE 0x0080  
-#define CPU_HAS_OP32 0x0100  
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/delay.h b/libc/kernel/arch-sh/asm/delay.h
deleted file mode 100644
index 15a1aa4..0000000
--- a/libc/kernel/arch-sh/asm/delay.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_DELAY_H
-#define __ASM_SH_DELAY_H
-
-#define udelay(n) (__builtin_constant_p(n) ?   ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) :   __udelay(n))
-
-#define ndelay(n) (__builtin_constant_p(n) ?   ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) :   __ndelay(n))
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/div64.h b/libc/kernel/arch-sh/asm/div64.h
deleted file mode 100644
index 53a10fc..0000000
--- a/libc/kernel/arch-sh/asm/div64.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/div64.h>
diff --git a/libc/kernel/arch-sh/asm/dma-mapping.h b/libc/kernel/arch-sh/asm/dma-mapping.h
deleted file mode 100644
index 3bbdf18..0000000
--- a/libc/kernel/arch-sh/asm/dma-mapping.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <asm/cacheflush.h>
-#include <asm/io.h>
-#include <asm-generic/dma-coherent.h>
-
-#define dma_supported(dev, mask) (1)
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-#define dma_is_consistent(d, h) (1)
-
-#define dma_unmap_single(dev, addr, size, dir) do { } while (0)
-#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0)
-#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/dma.h b/libc/kernel/arch-sh/asm/dma.h
deleted file mode 100644
index 40fe1d6..0000000
--- a/libc/kernel/arch-sh/asm/dma.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_DMA_H
-#define __ASM_SH_DMA_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/dmabrg.h b/libc/kernel/arch-sh/asm/dmabrg.h
deleted file mode 100644
index eadfcac..0000000
--- a/libc/kernel/arch-sh/asm/dmabrg.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _DMABRG_H_
-#define _DMABRG_H_
-
-#define DMABRGIRQ_USBDMA 0
-#define DMABRGIRQ_USBDMAERR 1
-#define DMABRGIRQ_A0TXF 2
-#define DMABRGIRQ_A0TXH 3
-#define DMABRGIRQ_A0RXF 4
-#define DMABRGIRQ_A0RXH 5
-#define DMABRGIRQ_A1TXF 6
-#define DMABRGIRQ_A1TXH 7
-#define DMABRGIRQ_A1RXF 8
-#define DMABRGIRQ_A1RXH 9
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/edosk7705.h b/libc/kernel/arch-sh/asm/edosk7705.h
deleted file mode 100644
index 146675d..0000000
--- a/libc/kernel/arch-sh/asm/edosk7705.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_EDOSK7705_IO_H
-#define __ASM_SH_EDOSK7705_IO_H
-
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/elf.h b/libc/kernel/arch-sh/asm/elf.h
deleted file mode 100644
index 4f283c2..0000000
--- a/libc/kernel/arch-sh/asm/elf.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ELF_H
-#define __ASM_SH_ELF_H
-
-#include <linux/utsname.h>
-#include <asm/auxvec.h>
-#include <asm/ptrace.h>
-#include <asm/user.h>
-
-#define EF_SH_PIC 0x100  
-#define EF_SH_FDPIC 0x8000  
-
-#define R_SH_NONE 0
-#define R_SH_DIR32 1
-#define R_SH_REL32 2
-#define R_SH_DIR8WPN 3
-#define R_SH_IND12W 4
-#define R_SH_DIR8WPL 5
-#define R_SH_DIR8WPZ 6
-#define R_SH_DIR8BP 7
-#define R_SH_DIR8W 8
-#define R_SH_DIR8L 9
-#define R_SH_SWITCH16 25
-#define R_SH_SWITCH32 26
-#define R_SH_USES 27
-#define R_SH_COUNT 28
-#define R_SH_ALIGN 29
-#define R_SH_CODE 30
-#define R_SH_DATA 31
-#define R_SH_LABEL 32
-#define R_SH_SWITCH8 33
-#define R_SH_GNU_VTINHERIT 34
-#define R_SH_GNU_VTENTRY 35
-#define R_SH_TLS_GD_32 144
-#define R_SH_TLS_LD_32 145
-#define R_SH_TLS_LDO_32 146
-#define R_SH_TLS_IE_32 147
-#define R_SH_TLS_LE_32 148
-#define R_SH_TLS_DTPMOD32 149
-#define R_SH_TLS_DTPOFF32 150
-#define R_SH_TLS_TPOFF32 151
-#define R_SH_GOT32 160
-#define R_SH_PLT32 161
-#define R_SH_COPY 162
-#define R_SH_GLOB_DAT 163
-#define R_SH_JMP_SLOT 164
-#define R_SH_RELATIVE 165
-#define R_SH_GOTOFF 166
-#define R_SH_GOTPC 167
-
-#define R_SH_GOT20 70
-#define R_SH_GOTOFF20 71
-#define R_SH_GOTFUNCDESC 72
-#define R_SH_GOTFUNCDESC20 73
-#define R_SH_GOTOFFFUNCDESC 74
-#define R_SH_GOTOFFFUNCDESC20 75
-#define R_SH_FUNCDESC 76
-#define R_SH_FUNCDESC_VALUE 77
-
-#define R_SH_IMM_LOW16 246
-#define R_SH_IMM_LOW16_PCREL 247
-#define R_SH_IMM_MEDLOW16 248
-#define R_SH_IMM_MEDLOW16_PCREL 249
-
-#define R_SH_NUM 256
-
-typedef unsigned long elf_greg_t;
-
-#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct user_fpu_struct elf_fpregset_t;
-
-#define ELF_CLASS ELFCLASS32
-#ifdef __LITTLE_ENDIAN__
-#define ELF_DATA ELFDATA2LSB
-#else
-#define ELF_DATA ELFDATA2MSB
-#endif
-#define ELF_ARCH EM_SH
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/emergency-restart.h b/libc/kernel/arch-sh/asm/emergency-restart.h
deleted file mode 100644
index 1c1964f..0000000
--- a/libc/kernel/arch-sh/asm/emergency-restart.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
-
-#include <asm-generic/emergency-restart.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/errno.h b/libc/kernel/arch-sh/asm/errno.h
deleted file mode 100644
index f35743b..0000000
--- a/libc/kernel/arch-sh/asm/errno.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ERRNO_H
-#define __ASM_SH_ERRNO_H
-
-#include <asm-generic/errno.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/fb.h b/libc/kernel/arch-sh/asm/fb.h
deleted file mode 100644
index f25951e..0000000
--- a/libc/kernel/arch-sh/asm/fb.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-
-#include <linux/fb.h>
-#include <linux/fs.h>
-#include <asm/page.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/fcntl.h b/libc/kernel/arch-sh/asm/fcntl.h
deleted file mode 100644
index 00630ad..0000000
--- a/libc/kernel/arch-sh/asm/fcntl.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/fcntl.h>
diff --git a/libc/kernel/arch-sh/asm/flat.h b/libc/kernel/arch-sh/asm/flat.h
deleted file mode 100644
index 6686199..0000000
--- a/libc/kernel/arch-sh/asm/flat.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_FLAT_H
-#define __ASM_SH_FLAT_H
-
-#define flat_stack_align(sp)  
-#define flat_argvp_envp_on_stack() 0
-#define flat_old_ram_flag(flags) (flags)
-#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
-#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
-#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
-#define flat_get_relocate_addr(rel) (rel)
-#define flat_set_persistent(relval, p) ({ (void)p; 0; })
-
-#define FLAT_PLAT_INIT(_r)   do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0;   _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0;   _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0;   _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0;   _r->sr = SR_FD; } while (0)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/fpu.h b/libc/kernel/arch-sh/asm/fpu.h
deleted file mode 100644
index 9671d75..0000000
--- a/libc/kernel/arch-sh/asm/fpu.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_FPU_H
-#define __ASM_SH_FPU_H
-
-#ifndef __ASSEMBLY__
-#include <linux/preempt.h>
-#include <asm/ptrace.h>
-
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/freq.h b/libc/kernel/arch-sh/asm/freq.h
deleted file mode 100644
index ad93c19..0000000
--- a/libc/kernel/arch-sh/asm/freq.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_FREQ_H
-#define __ASM_SH_FREQ_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/futex-irq.h b/libc/kernel/arch-sh/asm/futex-irq.h
deleted file mode 100644
index 20ca261..0000000
--- a/libc/kernel/arch-sh/asm/futex-irq.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_FUTEX_IRQ_H
-#define __ASM_SH_FUTEX_IRQ_H
-
-#include <asm/system.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/futex.h b/libc/kernel/arch-sh/asm/futex.h
deleted file mode 100644
index cad68a9..0000000
--- a/libc/kernel/arch-sh/asm/futex.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_FUTEX_H
-#define __ASM_SH_FUTEX_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/gpio.h b/libc/kernel/arch-sh/asm/gpio.h
deleted file mode 100644
index 8e26b01..0000000
--- a/libc/kernel/arch-sh/asm/gpio.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_GPIO_H
-#define __ASM_SH_GPIO_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hd64461.h b/libc/kernel/arch-sh/asm/hd64461.h
deleted file mode 100644
index af16596..0000000
--- a/libc/kernel/arch-sh/asm/hd64461.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_HD64461
-#define __ASM_SH_HD64461
-
-#define HD64461_PCC_WINDOW 0x01000000
-
-#define HD64461_PCC0_BASE (CONFIG_HD64461_IOBASE + 0x8000000)
-#define HD64461_PCC0_ATTR (HD64461_PCC0_BASE)  
-#define HD64461_PCC0_COMM (HD64461_PCC0_BASE+HD64461_PCC_WINDOW)  
-#define HD64461_PCC0_IO (HD64461_PCC0_BASE+2*HD64461_PCC_WINDOW)  
-
-#define HD64461_PCC1_BASE (CONFIG_HD64461_IOBASE + 0x4000000)
-#define HD64461_PCC1_ATTR (HD64461_PCC1_BASE)  
-#define HD64461_PCC1_COMM (HD64461_PCC1_BASE+HD64461_PCC_WINDOW)  
-
-#define HD64461_STBCR CONFIG_HD64461_IOBASE
-#define HD64461_STBCR_CKIO_STBY 0x2000
-#define HD64461_STBCR_SAFECKE_IST 0x1000
-#define HD64461_STBCR_SLCKE_IST 0x0800
-#define HD64461_STBCR_SAFECKE_OST 0x0400
-#define HD64461_STBCR_SLCKE_OST 0x0200
-#define HD64461_STBCR_SMIAST 0x0100
-#define HD64461_STBCR_SLCDST 0x0080
-#define HD64461_STBCR_SPC0ST 0x0040
-#define HD64461_STBCR_SPC1ST 0x0020
-#define HD64461_STBCR_SAFEST 0x0010
-#define HD64461_STBCR_STM0ST 0x0008
-#define HD64461_STBCR_STM1ST 0x0004
-#define HD64461_STBCR_SIRST 0x0002
-#define HD64461_STBCR_SURTST 0x0001
-
-#define HD64461_SYSCR (CONFIG_HD64461_IOBASE + 0x02)
-
-#define HD64461_SCPUCR (CONFIG_HD64461_IOBASE + 0x04)
-
-#define HD64461_LCDCBAR (CONFIG_HD64461_IOBASE + 0x1000)
-
-#define HD64461_LCDCLOR (CONFIG_HD64461_IOBASE + 0x1002)
-
-#define HD64461_LCDCCR (CONFIG_HD64461_IOBASE + 0x1004)
-
-#define HD64461_LCDCCR_STBACK 0x0400  
-#define HD64461_LCDCCR_STREQ 0x0100  
-#define HD64461_LCDCCR_MOFF 0x0080  
-#define HD64461_LCDCCR_REFSEL 0x0040  
-#define HD64461_LCDCCR_EPON 0x0020  
-#define HD64461_LCDCCR_SPON 0x0010  
-
-#define HD64461_LDR1 (CONFIG_HD64461_IOBASE + 0x1010)
-#define HD64461_LDR1_DON 0x01  
-#define HD64461_LDR1_DINV 0x80  
-
-#define HD64461_LDR2 (CONFIG_HD64461_IOBASE + 0x1012)
-#define HD64461_LDHNCR (CONFIG_HD64461_IOBASE + 0x1014)  
-#define HD64461_LDHNSR (CONFIG_HD64461_IOBASE + 0x1016)  
-#define HD64461_LDVNTR (CONFIG_HD64461_IOBASE + 0x1018)  
-#define HD64461_LDVNDR (CONFIG_HD64461_IOBASE + 0x101a)  
-#define HD64461_LDVSPR (CONFIG_HD64461_IOBASE + 0x101c)  
-
-#define HD64461_LDR3 (CONFIG_HD64461_IOBASE + 0x101e)
-
-#define HD64461_CPTWAR (CONFIG_HD64461_IOBASE + 0x1030)  
-#define HD64461_CPTWDR (CONFIG_HD64461_IOBASE + 0x1032)  
-#define HD64461_CPTRAR (CONFIG_HD64461_IOBASE + 0x1034)  
-#define HD64461_CPTRDR (CONFIG_HD64461_IOBASE + 0x1036)  
-
-#define HD64461_GRDOR (CONFIG_HD64461_IOBASE + 0x1040)  
-#define HD64461_GRSCR (CONFIG_HD64461_IOBASE + 0x1042)  
-#define HD64461_GRCFGR (CONFIG_HD64461_IOBASE + 0x1044)  
-
-#define HD64461_GRCFGR_ACCSTATUS 0x10  
-#define HD64461_GRCFGR_ACCRESET 0x08  
-#define HD64461_GRCFGR_ACCSTART_BITBLT 0x06  
-#define HD64461_GRCFGR_ACCSTART_LINE 0x04  
-#define HD64461_GRCFGR_COLORDEPTH16 0x01  
-#define HD64461_GRCFGR_COLORDEPTH8 0x01  
-
-#define HD64461_LNSARH (CONFIG_HD64461_IOBASE + 0x1046)  
-#define HD64461_LNSARL (CONFIG_HD64461_IOBASE + 0x1048)  
-#define HD64461_LNAXLR (CONFIG_HD64461_IOBASE + 0x104a)  
-#define HD64461_LNDGR (CONFIG_HD64461_IOBASE + 0x104c)  
-#define HD64461_LNAXR (CONFIG_HD64461_IOBASE + 0x104e)  
-#define HD64461_LNERTR (CONFIG_HD64461_IOBASE + 0x1050)  
-#define HD64461_LNMDR (CONFIG_HD64461_IOBASE + 0x1052)  
-
-#define HD64461_BBTSSARH (CONFIG_HD64461_IOBASE + 0x1054)  
-#define HD64461_BBTSSARL (CONFIG_HD64461_IOBASE + 0x1056)  
-#define HD64461_BBTDSARH (CONFIG_HD64461_IOBASE + 0x1058)  
-#define HD64461_BBTDSARL (CONFIG_HD64461_IOBASE + 0x105a)  
-#define HD64461_BBTDWR (CONFIG_HD64461_IOBASE + 0x105c)  
-#define HD64461_BBTDHR (CONFIG_HD64461_IOBASE + 0x105e)  
-#define HD64461_BBTPARH (CONFIG_HD64461_IOBASE + 0x1060)  
-#define HD64461_BBTPARL (CONFIG_HD64461_IOBASE + 0x1062)  
-#define HD64461_BBTMARH (CONFIG_HD64461_IOBASE + 0x1064)  
-#define HD64461_BBTMARL (CONFIG_HD64461_IOBASE + 0x1066)  
-#define HD64461_BBTROPR (CONFIG_HD64461_IOBASE + 0x1068)  
-#define HD64461_BBTMDR (CONFIG_HD64461_IOBASE + 0x106a)  
-
-#define HD64461_PCC0ISR (CONFIG_HD64461_IOBASE + 0x2000)  
-#define HD64461_PCC0GCR (CONFIG_HD64461_IOBASE + 0x2002)  
-#define HD64461_PCC0CSCR (CONFIG_HD64461_IOBASE + 0x2004)  
-#define HD64461_PCC0CSCIER (CONFIG_HD64461_IOBASE + 0x2006)  
-#define HD64461_PCC0SCR (CONFIG_HD64461_IOBASE + 0x2008)  
-
-#define HD64461_PCC1ISR (CONFIG_HD64461_IOBASE + 0x2010)  
-#define HD64461_PCC1GCR (CONFIG_HD64461_IOBASE + 0x2012)  
-#define HD64461_PCC1CSCR (CONFIG_HD64461_IOBASE + 0x2014)  
-#define HD64461_PCC1CSCIER (CONFIG_HD64461_IOBASE + 0x2016)  
-#define HD64461_PCC1SCR (CONFIG_HD64461_IOBASE + 0x2018)  
-
-#define HD64461_PCCISR_READY 0x80  
-#define HD64461_PCCISR_MWP 0x40  
-#define HD64461_PCCISR_VS2 0x20  
-#define HD64461_PCCISR_VS1 0x10  
-#define HD64461_PCCISR_CD2 0x08  
-#define HD64461_PCCISR_CD1 0x04  
-#define HD64461_PCCISR_BVD2 0x02  
-#define HD64461_PCCISR_BVD1 0x01  
-
-#define HD64461_PCCISR_PCD_MASK 0x0c  
-#define HD64461_PCCISR_BVD_MASK 0x03  
-#define HD64461_PCCISR_BVD_BATGOOD 0x03  
-#define HD64461_PCCISR_BVD_BATWARN 0x01  
-#define HD64461_PCCISR_BVD_BATDEAD1 0x02  
-#define HD64461_PCCISR_BVD_BATDEAD2 0x00  
-
-#define HD64461_PCCGCR_DRVE 0x80  
-#define HD64461_PCCGCR_PCCR 0x40  
-#define HD64461_PCCGCR_PCCT 0x20  
-#define HD64461_PCCGCR_VCC0 0x10  
-#define HD64461_PCCGCR_PMMOD 0x08  
-#define HD64461_PCCGCR_PA25 0x04  
-#define HD64461_PCCGCR_PA24 0x02  
-#define HD64461_PCCGCR_REG 0x01  
-
-#define HD64461_PCCCSCR_SCDI 0x80  
-#define HD64461_PCCCSCR_SRV1 0x40  
-#define HD64461_PCCCSCR_IREQ 0x20  
-#define HD64461_PCCCSCR_SC 0x10  
-#define HD64461_PCCCSCR_CDC 0x08  
-#define HD64461_PCCCSCR_RC 0x04  
-#define HD64461_PCCCSCR_BW 0x02  
-#define HD64461_PCCCSCR_BD 0x01  
-
-#define HD64461_PCCCSCIER_CRE 0x80  
-#define HD64461_PCCCSCIER_IREQE_MASK 0x60  
-#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00  
-#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20  
-#define HD64461_PCCCSCIER_IREQE_FALLING 0x40  
-#define HD64461_PCCCSCIER_IREQE_RISING 0x60  
-
-#define HD64461_PCCCSCIER_SCE 0x10  
-#define HD64461_PCCCSCIER_CDE 0x08  
-#define HD64461_PCCCSCIER_RE 0x04  
-#define HD64461_PCCCSCIER_BWE 0x02  
-#define HD64461_PCCCSCIER_BDE 0x01  
-
-#define HD64461_PCCSCR_VCC1 0x02  
-#define HD64461_PCCSCR_SWP 0x01  
-
-#define HD64461_P0OCR (CONFIG_HD64461_IOBASE + 0x202a)
-
-#define HD64461_P1OCR (CONFIG_HD64461_IOBASE + 0x202c)
-
-#define HD64461_PGCR (CONFIG_HD64461_IOBASE + 0x202e)
-
-#define HD64461_GPACR (CONFIG_HD64461_IOBASE + 0x4000)  
-#define HD64461_GPBCR (CONFIG_HD64461_IOBASE + 0x4002)  
-#define HD64461_GPCCR (CONFIG_HD64461_IOBASE + 0x4004)  
-#define HD64461_GPDCR (CONFIG_HD64461_IOBASE + 0x4006)  
-
-#define HD64461_GPADR (CONFIG_HD64461_IOBASE + 0x4010)  
-#define HD64461_GPBDR (CONFIG_HD64461_IOBASE + 0x4012)  
-#define HD64461_GPCDR (CONFIG_HD64461_IOBASE + 0x4014)  
-#define HD64461_GPDDR (CONFIG_HD64461_IOBASE + 0x4016)  
-
-#define HD64461_GPAICR (CONFIG_HD64461_IOBASE + 0x4020)  
-#define HD64461_GPBICR (CONFIG_HD64461_IOBASE + 0x4022)  
-#define HD64461_GPCICR (CONFIG_HD64461_IOBASE + 0x4024)  
-#define HD64461_GPDICR (CONFIG_HD64461_IOBASE + 0x4026)  
-
-#define HD64461_GPAISR (CONFIG_HD64461_IOBASE + 0x4040)  
-#define HD64461_GPBISR (CONFIG_HD64461_IOBASE + 0x4042)  
-#define HD64461_GPCISR (CONFIG_HD64461_IOBASE + 0x4044)  
-#define HD64461_GPDISR (CONFIG_HD64461_IOBASE + 0x4046)  
-
-#define HD64461_NIRR (CONFIG_HD64461_IOBASE + 0x5000)
-#define HD64461_NIMR (CONFIG_HD64461_IOBASE + 0x5002)
-
-#define HD64461_IRQBASE OFFCHIP_IRQ_BASE
-#define OFFCHIP_IRQ_BASE 64
-#define HD64461_IRQ_NUM 16
-
-#define HD64461_IRQ_UART (HD64461_IRQBASE+5)
-#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6)
-#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9)
-#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10)
-#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11)
-#define HD64461_IRQ_AFE (HD64461_IRQBASE+12)
-#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13)
-#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14)
-
-#define __IO_PREFIX hd64461
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hd64465/gpio.h b/libc/kernel/arch-sh/asm/hd64465/gpio.h
deleted file mode 100644
index 159c7c4..0000000
--- a/libc/kernel/arch-sh/asm/hd64465/gpio.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_HD64465_GPIO_
-#define _ASM_SH_HD64465_GPIO_ 1
-
-#include <asm/hd64465.h>
-
-#define HD64465_GPIO_PORTPIN(port,pin) (((port)-'A')<<3|(pin))
-
-#define HD64465_GPIO_FUNCTION2 0  
-#define HD64465_GPIO_OUT 1  
-#define HD64465_GPIO_IN_PULLUP 2  
-#define HD64465_GPIO_IN 3  
-
-#define HD64465_GPIO_FALLING 0
-#define HD64465_GPIO_RISING 1
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hd64465/hd64465.h b/libc/kernel/arch-sh/asm/hd64465/hd64465.h
deleted file mode 100644
index 108289b..0000000
--- a/libc/kernel/arch-sh/asm/hd64465/hd64465.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_HD64465_
-#define _ASM_SH_HD64465_ 1
-
-#include <asm/io.h>
-#include <asm/irq.h>
-
-#define HD64465_REG_SRR 0x1000c  
-#define HD64465_REG_SDID 0x10010  
-#define HD64465_SDID 0x8122  
-
-#define HD64465_REG_SMSCR 0x10000  
-#define HD64465_SMSCR_PS2ST 0x4000  
-#define HD64465_SMSCR_ADCST 0x1000  
-#define HD64465_SMSCR_UARTST 0x0800  
-#define HD64465_SMSCR_SCDIST 0x0200  
-#define HD64465_SMSCR_PPST 0x0100  
-#define HD64465_SMSCR_PC0ST 0x0040  
-#define HD64465_SMSCR_PC1ST 0x0020  
-#define HD64465_SMSCR_AFEST 0x0010  
-#define HD64465_SMSCR_TM0ST 0x0008  
-#define HD64465_SMSCR_TM1ST 0x0004  
-#define HD64465_SMSCR_IRDAST 0x0002  
-#define HD64465_SMSCR_KBCST 0x0001  
-
-#define HD64465_REG_NIRR 0x15000  
-#define HD64465_REG_NIMR 0x15002  
-#define HD64465_REG_NITR 0x15004  
-
-#define HD64465_REG_TCVR1 0x16000  
-#define HD64465_REG_TCVR0 0x16002  
-#define HD64465_REG_TRVR1 0x16004  
-#define HD64465_REG_TRVR0 0x16006  
-#define HD64465_REG_TCR1 0x16008  
-#define HD64465_REG_TCR0 0x1600A  
-#define HD64465_TCR_EADT 0x10  
-#define HD64465_TCR_ETMO 0x08  
-#define HD64465_TCR_PST_MASK 0x06  
-#define HD64465_TCR_PST_1 0x06  
-#define HD64465_TCR_PST_4 0x04  
-#define HD64465_TCR_PST_8 0x02  
-#define HD64465_TCR_PST_16 0x00  
-#define HD64465_TCR_TSTP 0x01  
-#define HD64465_REG_TIRR 0x1600C  
-#define HD64465_REG_TIDR 0x1600E  
-#define HD64465_REG_PWM1CS 0x16010  
-#define HD64465_REG_PWM1LPC 0x16012  
-#define HD64465_REG_PWM1HPC 0x16014  
-#define HD64465_REG_PWM0CS 0x16018  
-#define HD64465_REG_PWM0LPC 0x1601A  
-#define HD64465_REG_PWM0HPC 0x1601C  
-
-#define HD64465_REG_ADDRA 0x1E000  
-#define HD64465_REG_ADDRB 0x1E002  
-#define HD64465_REG_ADDRC 0x1E004  
-#define HD64465_REG_ADDRD 0x1E006  
-#define HD64465_REG_ADCSR 0x1E008  
-#define HD64465_ADCSR_ADF 0x80  
-#define HD64465_ADCSR_ADST 0x40  
-#define HD64465_ADCSR_ADIS 0x20  
-#define HD64465_ADCSR_TRGE 0x10  
-#define HD64465_ADCSR_ADIE 0x08  
-#define HD64465_ADCSR_SCAN 0x04  
-#define HD64465_ADCSR_CH_MASK 0x03  
-#define HD64465_REG_ADCALCR 0x1E00A  
-#define HD64465_REG_ADCAL 0x1E00C  
-
-#define HD64465_REG_GPACR 0x14000  
-#define HD64465_REG_GPBCR 0x14002  
-#define HD64465_REG_GPCCR 0x14004  
-#define HD64465_REG_GPDCR 0x14006  
-#define HD64465_REG_GPECR 0x14008  
-#define HD64465_REG_GPADR 0x14010  
-#define HD64465_REG_GPBDR 0x14012  
-#define HD64465_REG_GPCDR 0x14014  
-#define HD64465_REG_GPDDR 0x14016  
-#define HD64465_REG_GPEDR 0x14018  
-#define HD64465_REG_GPAICR 0x14020  
-#define HD64465_REG_GPBICR 0x14022  
-#define HD64465_REG_GPCICR 0x14024  
-#define HD64465_REG_GPDICR 0x14026  
-#define HD64465_REG_GPEICR 0x14028  
-#define HD64465_REG_GPAISR 0x14040  
-#define HD64465_REG_GPBISR 0x14042  
-#define HD64465_REG_GPCISR 0x14044  
-#define HD64465_REG_GPDISR 0x14046  
-#define HD64465_REG_GPEISR 0x14048  
-
-#define HD64465_REG_PCC0ISR 0x12000   
-#define HD64465_PCCISR_PREADY 0x80  
-#define HD64465_PCCISR_PIREQ 0x80
-#define HD64465_PCCISR_PMWP 0x40  
-#define HD64465_PCCISR_PVS2 0x20  
-#define HD64465_PCCISR_PVS1 0x10  
-#define HD64465_PCCISR_PCD_MASK 0x0c  
-#define HD64465_PCCISR_PBVD_MASK 0x03  
-#define HD64465_PCCISR_PBVD_BATGOOD 0x03  
-#define HD64465_PCCISR_PBVD_BATWARN 0x01  
-#define HD64465_PCCISR_PBVD_BATDEAD1 0x02  
-#define HD64465_PCCISR_PBVD_BATDEAD2 0x00  
-#define HD64465_REG_PCC0GCR 0x12002   
-#define HD64465_PCCGCR_PDRV 0x80  
-#define HD64465_PCCGCR_PCCR 0x40  
-#define HD64465_PCCGCR_PCCT 0x20  
-#define HD64465_PCCGCR_PVCC0 0x10  
-#define HD64465_PCCGCR_PMMOD 0x08  
-#define HD64465_PCCGCR_PPA25 0x04  
-#define HD64465_PCCGCR_PPA24 0x02  
-#define HD64465_PCCGCR_PREG 0x01  
-#define HD64465_REG_PCC0CSCR 0x12004   
-#define HD64465_PCCCSCR_PSCDI 0x80  
-#define HD64465_PCCCSCR_PSWSEL 0x40  
-#define HD64465_PCCCSCR_PIREQ 0x20  
-#define HD64465_PCCCSCR_PSC 0x10  
-#define HD64465_PCCCSCR_PCDC 0x08  
-#define HD64465_PCCCSCR_PRC 0x04  
-#define HD64465_PCCCSCR_PBW 0x02  
-#define HD64465_PCCCSCR_PBD 0x01  
-#define HD64465_REG_PCC0CSCIER 0x12006   
-#define HD64465_PCCCSCIER_PCRE 0x80  
-#define HD64465_PCCCSCIER_PIREQE_MASK 0x60  
-#define HD64465_PCCCSCIER_PIREQE_DISABLED 0x00  
-#define HD64465_PCCCSCIER_PIREQE_LEVEL 0x20  
-#define HD64465_PCCCSCIER_PIREQE_FALLING 0x40  
-#define HD64465_PCCCSCIER_PIREQE_RISING 0x60  
-#define HD64465_PCCCSCIER_PSCE 0x10  
-#define HD64465_PCCCSCIER_PCDE 0x08  
-#define HD64465_PCCCSCIER_PRE 0x04  
-#define HD64465_PCCCSCIER_PBWE 0x02  
-#define HD64465_PCCCSCIER_PBDE 0x01  
-#define HD64465_REG_PCC0SCR 0x12008   
-#define HD64465_PCCSCR_SHDN 0x10  
-#define HD64465_PCCSCR_SWP 0x01  
-#define HD64465_REG_PCCPSR 0x1200A   
-#define HD64465_REG_PCC1ISR 0x12010   
-#define HD64465_REG_PCC1GCR 0x12012   
-#define HD64465_REG_PCC1CSCR 0x12014   
-#define HD64465_REG_PCC1CSCIER 0x12016   
-#define HD64465_REG_PCC1SCR 0x12018   
-
-#define HD64465_REG_KBCSR 0x1dc00  
-#define HD64465_KBCSR_KBCIE 0x8000  
-#define HD64465_KBCSR_KBCOE 0x4000  
-#define HD64465_KBCSR_KBDOE 0x2000  
-#define HD64465_KBCSR_KBCD 0x1000  
-#define HD64465_KBCSR_KBDD 0x0800  
-#define HD64465_KBCSR_KBCS 0x0400  
-#define HD64465_KBCSR_KBDS 0x0200  
-#define HD64465_KBCSR_KBDP 0x0100  
-#define HD64465_KBCSR_KBD_MASK 0x00ff  
-#define HD64465_REG_KBISR 0x1dc04  
-#define HD64465_KBISR_KBRDF 0x0001  
-#define HD64465_REG_MSCSR 0x1dc10  
-#define HD64465_REG_MSISR 0x1dc14  
-
-#define CONFIG_HD64465_IOBASE 0xb0000000
-
-#define CONFIG_HD64465_IRQ 5
-
-#define _HD64465_IO_MASK 0xf8000000
-#define is_hd64465_addr(addr)   ((addr & _HD64465_IO_MASK) == (CONFIG_HD64465_IOBASE & _HD64465_IO_MASK))
-
-#define HD64465_IRQ_BASE OFFCHIP_IRQ_BASE
-#define HD64465_IRQ_NUM 16
-#define HD64465_IRQ_ADC (HD64465_IRQ_BASE+0)
-#define HD64465_IRQ_USB (HD64465_IRQ_BASE+1)
-#define HD64465_IRQ_SCDI (HD64465_IRQ_BASE+2)
-#define HD64465_IRQ_PARALLEL (HD64465_IRQ_BASE+3)
-
-#define HD64465_IRQ_UART (HD64465_IRQ_BASE+5)
-#define HD64465_IRQ_IRDA (HD64465_IRQ_BASE+6)
-#define HD64465_IRQ_PS2MOUSE (HD64465_IRQ_BASE+7)
-#define HD64465_IRQ_KBC (HD64465_IRQ_BASE+8)
-#define HD64465_IRQ_TIMER1 (HD64465_IRQ_BASE+9)
-#define HD64465_IRQ_TIMER0 (HD64465_IRQ_BASE+10)
-#define HD64465_IRQ_GPIO (HD64465_IRQ_BASE+11)
-#define HD64465_IRQ_AFE (HD64465_IRQ_BASE+12)
-#define HD64465_IRQ_PCMCIA1 (HD64465_IRQ_BASE+13)
-#define HD64465_IRQ_PCMCIA0 (HD64465_IRQ_BASE+14)
-#define HD64465_IRQ_PS2KBD (HD64465_IRQ_BASE+15)
-
-#define HD64465_PCC_WINDOW 0x01000000
-
-#define HD64465_PCC0_BASE 0xb8000000  
-#define HD64465_PCC0_ATTR (HD64465_PCC0_BASE)
-#define HD64465_PCC0_COMM (HD64465_PCC0_BASE+HD64465_PCC_WINDOW)
-#define HD64465_PCC0_IO (HD64465_PCC0_BASE+2*HD64465_PCC_WINDOW)
-
-#define HD64465_PCC1_BASE 0xb4000000  
-#define HD64465_PCC1_ATTR (HD64465_PCC1_BASE)
-#define HD64465_PCC1_COMM (HD64465_PCC1_BASE+HD64465_PCC_WINDOW)
-#define HD64465_PCC1_IO (HD64465_PCC1_BASE+2*HD64465_PCC_WINDOW)
-
-#define HD64465_USB_BASE (CONFIG_HD64465_IOBASE+0xb000)
-#define HD64465_USB_LEN 0x1000
-
-#define HD64465_SRAM_BASE (CONFIG_HD64465_IOBASE+0x9000)
-#define HD64465_SRAM_LEN 0x1000
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hd64465/io.h b/libc/kernel/arch-sh/asm/hd64465/io.h
deleted file mode 100644
index 9de2885..0000000
--- a/libc/kernel/arch-sh/asm/hd64465/io.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_IO_HD64465_H
-#define _ASM_SH_IO_HD64465_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/heartbeat.h b/libc/kernel/arch-sh/asm/heartbeat.h
deleted file mode 100644
index cbcfef1..0000000
--- a/libc/kernel/arch-sh/asm/heartbeat.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_HEARTBEAT_H
-#define __ASM_SH_HEARTBEAT_H
-
-#include <linux/timer.h>
-
-#define HEARTBEAT_INVERTED (1 << 0)
-
-struct heartbeat_data {
- void __iomem *base;
- unsigned char *bit_pos;
- unsigned int nr_bits;
- struct timer_list timer;
- unsigned int regsize;
- unsigned long flags;
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hp6xx.h b/libc/kernel/arch-sh/asm/hp6xx.h
deleted file mode 100644
index 023ae2e..0000000
--- a/libc/kernel/arch-sh/asm/hp6xx.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_HP6XX_H
-#define __ASM_SH_HP6XX_H
-
-#define HP680_BTN_IRQ 32  
-#define HP680_TS_IRQ 35  
-#define HP680_HD64461_IRQ 36  
-
-#define DAC_LCD_BRIGHTNESS 0
-#define DAC_SPEAKER_VOLUME 1
-
-#define PGDR_OPENED 0x01
-#define PGDR_MAIN_BATTERY_OUT 0x04
-#define PGDR_PLAY_BUTTON 0x08
-#define PGDR_REWIND_BUTTON 0x10
-#define PGDR_RECORD_BUTTON 0x20
-
-#define PHDR_TS_PEN_DOWN 0x08
-
-#define PJDR_LED_BLINK 0x02
-
-#define PKDR_LED_GREEN 0x10
-
-#define SCPDR_TS_SCAN_ENABLE 0x20
-#define SCPDR_TS_SCAN_Y 0x02
-#define SCPDR_TS_SCAN_X 0x01
-
-#define SCPCR_TS_ENABLE 0x405
-#define SCPCR_TS_MASK 0xc0f
-
-#define ADC_CHANNEL_TS_Y 1
-#define ADC_CHANNEL_TS_X 2
-#define ADC_CHANNEL_BATTERY 3
-#define ADC_CHANNEL_BACKUP 4
-#define ADC_CHANNEL_CHARGE 5
-
-#define HD64461_GPADR_SPEAKER 0x01
-#define HD64461_GPADR_PCMCIA0 (0x02|0x08)
-
-#define HD64461_GPBDR_LCDOFF 0x01
-#define HD64461_GPBDR_LCD_CONTRAST_MASK 0x78
-#define HD64461_GPBDR_LED_RED 0x80
-
-#include <asm/hd64461.h>
-#include <asm/io.h>
-
-#define PJDR 0xa4000130
-#define PKDR 0xa4000132
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hugetlb.h b/libc/kernel/arch-sh/asm/hugetlb.h
deleted file mode 100644
index ab3aa5a..0000000
--- a/libc/kernel/arch-sh/asm/hugetlb.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_HUGETLB_H
-#define _ASM_SH_HUGETLB_H
-
-#include <asm/page.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/hw_irq.h b/libc/kernel/arch-sh/asm/hw_irq.h
deleted file mode 100644
index 24e7278..0000000
--- a/libc/kernel/arch-sh/asm/hw_irq.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_HW_IRQ_H
-#define __ASM_SH_HW_IRQ_H
-
-#include <linux/init.h>
-#include <asm/atomic.h>
-
-struct ipr_data {
- unsigned char irq;
- unsigned char ipr_idx;
- unsigned char shift;
- unsigned char priority;
-};
-
-struct ipr_desc {
- unsigned long *ipr_offsets;
- unsigned int nr_offsets;
- struct ipr_data *ipr_data;
- unsigned int nr_irqs;
- struct irq_chip chip;
-};
-
-typedef unsigned char intc_enum;
-
-struct intc_vect {
- intc_enum enum_id;
- unsigned short vect;
-};
-
-#define INTC_VECT(enum_id, vect) { enum_id, vect }
-#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
-
-struct intc_group {
- intc_enum enum_id;
- intc_enum enum_ids[32];
-};
-
-#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
-
-struct intc_mask_reg {
- unsigned long set_reg, clr_reg, reg_width;
- intc_enum enum_ids[32];
-};
-
-struct intc_prio_reg {
- unsigned long set_reg, clr_reg, reg_width, field_width;
- intc_enum enum_ids[16];
-};
-
-struct intc_sense_reg {
- unsigned long reg, reg_width, field_width;
- intc_enum enum_ids[16];
-};
-
-#define INTC_SMP(stride, nr)
-
-struct intc_desc {
- struct intc_vect *vectors;
- unsigned int nr_vectors;
- struct intc_group *groups;
- unsigned int nr_groups;
- struct intc_mask_reg *mask_regs;
- unsigned int nr_mask_regs;
- struct intc_prio_reg *prio_regs;
- unsigned int nr_prio_regs;
- struct intc_sense_reg *sense_regs;
- unsigned int nr_sense_regs;
- char *name;
- struct intc_mask_reg *ack_regs;
- unsigned int nr_ack_regs;
-};
-
-#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
-#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups,   mask_regs, prio_regs, sense_regs)  struct intc_desc symbol __initdata = {   _INTC_ARRAY(vectors), _INTC_ARRAY(groups),   _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs),   _INTC_ARRAY(sense_regs),   chipname,  }
-
-#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups,   mask_regs, prio_regs, sense_regs, ack_regs)  struct intc_desc symbol __initdata = {   _INTC_ARRAY(vectors), _INTC_ARRAY(groups),   _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs),   _INTC_ARRAY(sense_regs),   chipname,   _INTC_ARRAY(ack_regs),  }
-
-enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210,
- IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK,
- IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/i2c-sh7760.h b/libc/kernel/arch-sh/asm/i2c-sh7760.h
deleted file mode 100644
index f510223..0000000
--- a/libc/kernel/arch-sh/asm/i2c-sh7760.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _I2C_SH7760_H_
-#define _I2C_SH7760_H_
-
-#define SH7760_I2C_DEVNAME "sh7760-i2c"
-
-#define SH7760_I2C0_MMIO 0xFE140000
-#define SH7760_I2C0_MMIOEND 0xFE14003B
-#define SH7760_I2C0_IRQ 62
-
-#define SH7760_I2C1_MMIO 0xFE150000
-#define SH7760_I2C1_MMIOEND 0xFE15003B
-#define SH7760_I2C1_IRQ 63
-
-struct sh7760_i2c_platdata {
- unsigned int speed_khz;
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/ilsel.h b/libc/kernel/arch-sh/asm/ilsel.h
deleted file mode 100644
index da35878..0000000
--- a/libc/kernel/arch-sh/asm/ilsel.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ILSEL_H
-#define __ASM_SH_ILSEL_H
-
-typedef enum {
- ILSEL_NONE,
- ILSEL_LAN,
- ILSEL_USBH_I,
- ILSEL_USBH_S,
- ILSEL_USBH_V,
- ILSEL_RTC,
- ILSEL_USBP_I,
- ILSEL_USBP_S,
- ILSEL_USBP_V,
- ILSEL_KEY,
-
- ILSEL_FPGA0,
- ILSEL_FPGA1,
- ILSEL_EX1,
- ILSEL_EX2,
- ILSEL_EX3,
- ILSEL_EX4,
-
- ILSEL_FPGA2 = ILSEL_FPGA0,
- ILSEL_FPGA3 = ILSEL_FPGA1,
- ILSEL_EX5 = ILSEL_EX1,
- ILSEL_EX6 = ILSEL_EX2,
- ILSEL_EX7 = ILSEL_EX3,
- ILSEL_EX8 = ILSEL_EX4,
-} ilsel_source_t;
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/io.h b/libc/kernel/arch-sh/asm/io.h
deleted file mode 100644
index 7730c15..0000000
--- a/libc/kernel/arch-sh/asm/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IO_H
-#define __ASM_SH_IO_H
-
-#include <asm/cache.h>
-#include <asm/system.h>
-#include <asm/addrspace.h>
-#include <asm/machvec.h>
-#include <asm/pgtable.h>
-#include <asm-generic/iomap.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/io_generic.h b/libc/kernel/arch-sh/asm/io_generic.h
deleted file mode 100644
index f122342..0000000
--- a/libc/kernel/arch-sh/asm/io_generic.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#define IO_CONCAT(a,b) _IO_CONCAT(a,b)
-#define _IO_CONCAT(a,b) a ## _ ## b
-
-#ifndef __IO_PREFIX
-#error "Don't include this header without a valid system prefix"
-#endif
-
-#undef __IO_PREFIX
diff --git a/libc/kernel/arch-sh/asm/io_trapped.h b/libc/kernel/arch-sh/asm/io_trapped.h
deleted file mode 100644
index 9702a8e..0000000
--- a/libc/kernel/arch-sh/asm/io_trapped.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IO_TRAPPED_H
-#define __ASM_SH_IO_TRAPPED_H
-
-#include <linux/list.h>
-#include <linux/ioport.h>
-#include <asm/page.h>
-
-#define IO_TRAPPED_MAGIC 0xfeedbeef
-
-struct trapped_io {
- unsigned int magic;
- struct resource *resource;
- unsigned int num_resources;
- unsigned int minimum_bus_width;
- struct list_head list;
- void __iomem *virt_base;
-} __aligned(PAGE_SIZE);
-
-#define register_trapped_io(tiop) (-1)
-#define handle_trapped_io(tiop, address) 0
-#define __ioremap_trapped(offset, size) NULL
-#define __ioport_map_trapped(offset, size) NULL
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/ioctl.h b/libc/kernel/arch-sh/asm/ioctl.h
deleted file mode 100644
index 6e446b6..0000000
--- a/libc/kernel/arch-sh/asm/ioctl.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/ioctl.h>
diff --git a/libc/kernel/arch-sh/asm/ioctls.h b/libc/kernel/arch-sh/asm/ioctls.h
deleted file mode 100644
index 94ca854..0000000
--- a/libc/kernel/arch-sh/asm/ioctls.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IOCTLS_H
-#define __ASM_SH_IOCTLS_H
-
-#include <asm/ioctl.h>
-
-#define FIOCLEX _IO('f', 1)
-#define FIONCLEX _IO('f', 2)
-#define FIOASYNC _IOW('f', 125, int)
-#define FIONBIO _IOW('f', 126, int)
-#define FIONREAD _IOR('f', 127, int)
-#define TIOCINQ FIONREAD
-#define FIOQSIZE _IOR('f', 128, loff_t)
-
-#define TCGETS 0x5401
-#define TCSETS 0x5402
-#define TCSETSW 0x5403
-#define TCSETSF 0x5404
-
-#define TCGETA 0x80127417  
-#define TCSETA 0x40127418  
-#define TCSETAW 0x40127419  
-#define TCSETAF 0x4012741C  
-
-#define TCSBRK _IO('t', 29)
-#define TCXONC _IO('t', 30)
-#define TCFLSH _IO('t', 31)
-
-#define TIOCSWINSZ 0x40087467  
-#define TIOCGWINSZ 0x80087468  
-#define TIOCSTART _IO('t', 110)  
-#define TIOCSTOP _IO('t', 111)  
-#define TIOCOUTQ _IOR('t', 115, int)  
-
-#define TIOCSPGRP _IOW('t', 118, int)
-#define TIOCGPGRP _IOR('t', 119, int)
-
-#define TIOCEXCL _IO('T', 12)  
-#define TIOCNXCL _IO('T', 13)  
-#define TIOCSCTTY _IO('T', 14)  
-
-#define TIOCSTI _IOW('T', 18, char)  
-#define TIOCMGET _IOR('T', 21, unsigned int)  
-#define TIOCMBIS _IOW('T', 22, unsigned int)  
-#define TIOCMBIC _IOW('T', 23, unsigned int)  
-#define TIOCMSET _IOW('T', 24, unsigned int)  
-#define TIOCM_LE 0x001
-#define TIOCM_DTR 0x002
-#define TIOCM_RTS 0x004
-#define TIOCM_ST 0x008
-#define TIOCM_SR 0x010
-#define TIOCM_CTS 0x020
-#define TIOCM_CAR 0x040
-#define TIOCM_RNG 0x080
-#define TIOCM_DSR 0x100
-#define TIOCM_CD TIOCM_CAR
-#define TIOCM_RI TIOCM_RNG
-
-#define TIOCGSOFTCAR _IOR('T', 25, unsigned int)  
-#define TIOCSSOFTCAR _IOW('T', 26, unsigned int)  
-#define TIOCLINUX _IOW('T', 28, char)  
-#define TIOCCONS _IO('T', 29)  
-#define TIOCGSERIAL 0x803C541E  
-#define TIOCSSERIAL 0x403C541F  
-#define TIOCPKT _IOW('T', 32, int)  
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-#define TIOCNOTTY _IO('T', 34)  
-#define TIOCSETD _IOW('T', 35, int)  
-#define TIOCGETD _IOR('T', 36, int)  
-#define TCSBRKP _IOW('T', 37, int)    
-#define TIOCSBRK _IO('T', 39)    
-#define TIOCCBRK _IO('T', 40)    
-#define TIOCGSID _IOR('T', 41, pid_t)    
-#define TCGETS2 _IOR('T', 42, struct termios2)
-#define TCSETS2 _IOW('T', 43, struct termios2)
-#define TCSETSW2 _IOW('T', 44, struct termios2)
-#define TCSETSF2 _IOW('T', 45, struct termios2)
-#define TIOCGPTN _IOR('T',0x30, unsigned int)  
-#define TIOCSPTLCK _IOW('T',0x31, int)  
-
-#define TIOCSERCONFIG _IO('T', 83)  
-#define TIOCSERGWILD _IOR('T', 84, int)  
-#define TIOCSERSWILD _IOW('T', 85, int)  
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x80d85458    
-#define TIOCSERGETLSR _IOR('T', 89, unsigned int)    
-
-#define TIOCSER_TEMT 0x01  
-#define TIOCSERGETMULTI 0x80A8545A    
-#define TIOCSERSETMULTI 0x40A8545B    
-
-#define TIOCMIWAIT _IO('T', 92)    
-#define TIOCGICOUNT 0x545D  
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/ipcbuf.h b/libc/kernel/arch-sh/asm/ipcbuf.h
deleted file mode 100644
index 7ebc070..0000000
--- a/libc/kernel/arch-sh/asm/ipcbuf.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IPCBUF_H__
-#define __ASM_SH_IPCBUF_H__
-
-struct ipc64_perm
-{
- __kernel_key_t key;
- __kernel_uid32_t uid;
- __kernel_gid32_t gid;
- __kernel_uid32_t cuid;
- __kernel_gid32_t cgid;
- __kernel_mode_t mode;
- unsigned short __pad1;
- unsigned short seq;
- unsigned short __pad2;
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/irq.h b/libc/kernel/arch-sh/asm/irq.h
deleted file mode 100644
index 128135a..0000000
--- a/libc/kernel/arch-sh/asm/irq.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IRQ_H
-#define __ASM_SH_IRQ_H
-
-#include <asm/machvec.h>
-
-#define NR_IRQS 256
-
-#define evt2irq(evt) (((evt) >> 5) - 16)
-#define irq2evt(irq) (((irq) + 16) << 5)
-
-#define irq_canonicalize(irq) (irq)
-#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
-#define irq_ctx_init(cpu) do { } while (0)
-#define irq_ctx_exit(cpu) do { } while (0)
-#endif
diff --git a/libc/kernel/arch-sh/asm/irq_regs.h b/libc/kernel/arch-sh/asm/irq_regs.h
deleted file mode 100644
index 1e8a2b6..0000000
--- a/libc/kernel/arch-sh/asm/irq_regs.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/irq_regs.h>
diff --git a/libc/kernel/arch-sh/asm/irqflags.h b/libc/kernel/arch-sh/asm/irqflags.h
deleted file mode 100644
index fe442e4..0000000
--- a/libc/kernel/arch-sh/asm/irqflags.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IRQFLAGS_H
-#define __ASM_SH_IRQFLAGS_H
-
-#include "irqflags_32.h"
-
-#define raw_local_save_flags(flags)   do { (flags) = __raw_local_save_flags(); } while (0)
-
-#define raw_local_irq_save(flags)   do { (flags) = __raw_local_irq_save(); } while (0)
-#endif
diff --git a/libc/kernel/arch-sh/asm/irqflags_32.h b/libc/kernel/arch-sh/asm/irqflags_32.h
deleted file mode 100644
index 711b0d6..0000000
--- a/libc/kernel/arch-sh/asm/irqflags_32.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IRQFLAGS_32_H
-#define __ASM_SH_IRQFLAGS_32_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/irqflags_64.h b/libc/kernel/arch-sh/asm/irqflags_64.h
deleted file mode 100644
index dbbdce7..0000000
--- a/libc/kernel/arch-sh/asm/irqflags_64.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_IRQFLAGS_64_H
-#define __ASM_SH_IRQFLAGS_64_H
-
-#include <cpu/registers.h>
-
-#define SR_MASK_LL 0x00000000000000f0LL
-#define SR_BL_LL 0x0000000010000000LL
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/kdebug.h b/libc/kernel/arch-sh/asm/kdebug.h
deleted file mode 100644
index fb8dbc0..0000000
--- a/libc/kernel/arch-sh/asm/kdebug.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_KDEBUG_H
-#define __ASM_SH_KDEBUG_H
-
-enum die_val {
- DIE_TRAP,
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/kexec.h b/libc/kernel/arch-sh/asm/kexec.h
deleted file mode 100644
index f5a865b..0000000
--- a/libc/kernel/arch-sh/asm/kexec.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_KEXEC_H
-#define __ASM_SH_KEXEC_H
-
-#include <asm/ptrace.h>
-#include <asm/string.h>
-
-#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
-
-#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
-
-#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
-
-#define KEXEC_CONTROL_PAGE_SIZE 4096
-
-#define KEXEC_ARCH KEXEC_ARCH_SH
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/kgdb.h b/libc/kernel/arch-sh/asm/kgdb.h
deleted file mode 100644
index 386b380..0000000
--- a/libc/kernel/arch-sh/asm/kgdb.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __KGDB_H
-#define __KGDB_H
-
-#include <asm/ptrace.h>
-
-struct kgdb_regs {
- unsigned long regs[16];
- unsigned long pc;
- unsigned long pr;
- unsigned long sr;
- unsigned long gbr;
- unsigned long mach;
- unsigned long macl;
- unsigned long vbr;
-};
-
-typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
-typedef void (kgdb_bus_error_hook_t)(void);
-
-struct console;
-
-#define _JBLEN 9
-typedef int jmp_buf[_JBLEN];
-
-#define breakpoint() __asm__ __volatile__("trapa   #0x3c")
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/kmap_types.h b/libc/kernel/arch-sh/asm/kmap_types.h
deleted file mode 100644
index ea30766..0000000
--- a/libc/kernel/arch-sh/asm/kmap_types.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __SH_KMAP_TYPES_H
-#define __SH_KMAP_TYPES_H
-
-#define D(n)
-
-enum km_type {
-D(0) KM_BOUNCE_READ,
-D(1) KM_SKB_SUNRPC_DATA,
-D(2) KM_SKB_DATA_SOFTIRQ,
-D(3) KM_USER0,
-D(4) KM_USER1,
-D(5) KM_BIO_SRC_IRQ,
-D(6) KM_BIO_DST_IRQ,
-D(7) KM_PTE0,
-D(8) KM_PTE1,
-D(9) KM_IRQ0,
-D(10) KM_IRQ1,
-D(11) KM_SOFTIRQ0,
-D(12) KM_SOFTIRQ1,
-D(13) KM_TYPE_NR
-};
-
-#undef D
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/lboxre2.h b/libc/kernel/arch-sh/asm/lboxre2.h
deleted file mode 100644
index 1791361..0000000
--- a/libc/kernel/arch-sh/asm/lboxre2.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_LBOXRE2_H
-#define __ASM_SH_LBOXRE2_H
-
-#define IRQ_CF1 9  
-#define IRQ_CF0 10  
-#define IRQ_INTD 11  
-#define IRQ_ETH1 12  
-#define IRQ_ETH0 13  
-#define IRQ_INTA 14  
-
-#define __IO_PREFIX lboxre2
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/local.h b/libc/kernel/arch-sh/asm/local.h
deleted file mode 100644
index 4a39637..0000000
--- a/libc/kernel/arch-sh/asm/local.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_LOCAL_H
-#define __ASM_SH_LOCAL_H
-
-#include <asm-generic/local.h>
-
-#endif
-
diff --git a/libc/kernel/arch-sh/asm/machvec.h b/libc/kernel/arch-sh/asm/machvec.h
deleted file mode 100644
index 5b48918..0000000
--- a/libc/kernel/arch-sh/asm/machvec.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_MACHVEC_H
-#define _ASM_SH_MACHVEC_H
-
-#include <linux/types.h>
-#include <linux/time.h>
-#include <asm/machtypes.h>
-
-struct device;
-
-struct sh_machine_vector {
- void (*mv_setup)(char **cmdline_p);
- const char *mv_name;
- int mv_nr_irqs;
-
- u8 (*mv_inb)(unsigned long);
- u16 (*mv_inw)(unsigned long);
- u32 (*mv_inl)(unsigned long);
- void (*mv_outb)(u8, unsigned long);
- void (*mv_outw)(u16, unsigned long);
- void (*mv_outl)(u32, unsigned long);
-
- u8 (*mv_inb_p)(unsigned long);
- u16 (*mv_inw_p)(unsigned long);
- u32 (*mv_inl_p)(unsigned long);
- void (*mv_outb_p)(u8, unsigned long);
- void (*mv_outw_p)(u16, unsigned long);
- void (*mv_outl_p)(u32, unsigned long);
-
- void (*mv_insb)(unsigned long, void *dst, unsigned long count);
- void (*mv_insw)(unsigned long, void *dst, unsigned long count);
- void (*mv_insl)(unsigned long, void *dst, unsigned long count);
- void (*mv_outsb)(unsigned long, const void *src, unsigned long count);
- void (*mv_outsw)(unsigned long, const void *src, unsigned long count);
- void (*mv_outsl)(unsigned long, const void *src, unsigned long count);
-
- u8 (*mv_readb)(void __iomem *);
- u16 (*mv_readw)(void __iomem *);
- u32 (*mv_readl)(void __iomem *);
- void (*mv_writeb)(u8, void __iomem *);
- void (*mv_writew)(u16, void __iomem *);
- void (*mv_writel)(u32, void __iomem *);
-
- int (*mv_irq_demux)(int irq);
-
- void (*mv_init_irq)(void);
- void (*mv_init_pci)(void);
-
- void (*mv_heartbeat)(void);
-
- void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
- void (*mv_ioport_unmap)(void __iomem *);
-};
-
-#define get_system_type() sh_mv.mv_name
-
-#define __initmv   __used __section(.machvec.init)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/magicpanelr2.h b/libc/kernel/arch-sh/asm/magicpanelr2.h
deleted file mode 100644
index e0fd4a2..0000000
--- a/libc/kernel/arch-sh/asm/magicpanelr2.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MAGICPANELR2_H
-#define __ASM_SH_MAGICPANELR2_H
-
-#include <asm/gpio.h>
-
-#define __IO_PREFIX mpr2
-#include <asm/io_generic.h>
-
-#define SETBITS_OUTB(mask, reg) ctrl_outb(ctrl_inb(reg) | mask, reg)
-#define SETBITS_OUTW(mask, reg) ctrl_outw(ctrl_inw(reg) | mask, reg)
-#define SETBITS_OUTL(mask, reg) ctrl_outl(ctrl_inl(reg) | mask, reg)
-#define CLRBITS_OUTB(mask, reg) ctrl_outb(ctrl_inb(reg) & ~mask, reg)
-#define CLRBITS_OUTW(mask, reg) ctrl_outw(ctrl_inw(reg) & ~mask, reg)
-#define CLRBITS_OUTL(mask, reg) ctrl_outl(ctrl_inl(reg) & ~mask, reg)
-
-#define PA_LED PORT_PADR  
-
-#define CMNCR 0xA4FD0000UL
-#define CS0BCR 0xA4FD0004UL
-#define CS2BCR 0xA4FD0008UL
-#define CS3BCR 0xA4FD000CUL
-#define CS4BCR 0xA4FD0010UL
-#define CS5ABCR 0xA4FD0014UL
-#define CS5BBCR 0xA4FD0018UL
-#define CS6ABCR 0xA4FD001CUL
-#define CS6BBCR 0xA4FD0020UL
-#define CS0WCR 0xA4FD0024UL
-#define CS2WCR 0xA4FD0028UL
-#define CS3WCR 0xA4FD002CUL
-#define CS4WCR 0xA4FD0030UL
-#define CS5AWCR 0xA4FD0034UL
-#define CS5BWCR 0xA4FD0038UL
-#define CS6AWCR 0xA4FD003CUL
-#define CS6BWCR 0xA4FD0040UL
-
-#define PORT_UTRCTL 0xA405012CUL
-#define PORT_UCLKCR_W 0xA40A0008UL
-
-#define INTC_ICR0 0xA414FEE0UL
-#define INTC_ICR1 0xA4140010UL
-#define INTC_ICR2 0xA4140012UL
-
-#define MPR2_MTD_BOOTLOADER_SIZE 0x00060000UL
-#define MPR2_MTD_KERNEL_SIZE 0x00200000UL
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/microdev.h b/libc/kernel/arch-sh/asm/microdev.h
deleted file mode 100644
index cff5a06..0000000
--- a/libc/kernel/arch-sh/asm/microdev.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MICRODEV_H
-#define __ASM_SH_MICRODEV_H
-
-#define MICRODEV_FPGA_INTC_BASE 0xa6110000ul  
-#define MICRODEV_FPGA_INTENB_REG (MICRODEV_FPGA_INTC_BASE+0ul)  
-#define MICRODEV_FPGA_INTDSB_REG (MICRODEV_FPGA_INTC_BASE+8ul)  
-#define MICRODEV_FPGA_INTC_MASK(n) (1ul<<(n))  
-#define MICRODEV_FPGA_INTPRI_REG(n) (MICRODEV_FPGA_INTC_BASE+0x10+((n)/8)*8) 
-#define MICRODEV_FPGA_INTPRI_LEVEL(n,x) ((x)<<(((n)%8)*4))  
-#define MICRODEV_FPGA_INTPRI_MASK(n) (MICRODEV_FPGA_INTPRI_LEVEL((n),0xful))  
-#define MICRODEV_FPGA_INTSRC_REG (MICRODEV_FPGA_INTC_BASE+0x30ul)  
-#define MICRODEV_FPGA_INTREQ_REG (MICRODEV_FPGA_INTC_BASE+0x38ul)  
-
-#define MICRODEV_LINUX_IRQ_KEYBOARD 1  
-#define MICRODEV_LINUX_IRQ_SERIAL1 2  
-#define MICRODEV_LINUX_IRQ_ETHERNET 3  
-#define MICRODEV_LINUX_IRQ_SERIAL2 4  
-#define MICRODEV_LINUX_IRQ_USB_HC 7  
-#define MICRODEV_LINUX_IRQ_MOUSE 12  
-#define MICRODEV_LINUX_IRQ_IDE2 13  
-#define MICRODEV_LINUX_IRQ_IDE1 14  
-
-#define MICRODEV_FPGA_IRQ_KEYBOARD 1  
-#define MICRODEV_FPGA_IRQ_SERIAL1 3  
-#define MICRODEV_FPGA_IRQ_SERIAL2 4  
-#define MICRODEV_FPGA_IRQ_MOUSE 12  
-#define MICRODEV_FPGA_IRQ_IDE1 14  
-#define MICRODEV_FPGA_IRQ_IDE2 15  
-#define MICRODEV_FPGA_IRQ_USB_HC 16  
-#define MICRODEV_FPGA_IRQ_ETHERNET 18  
-
-#define MICRODEV_IRQ_PCI_INTA 8
-#define MICRODEV_IRQ_PCI_INTB 9
-#define MICRODEV_IRQ_PCI_INTC 10
-#define MICRODEV_IRQ_PCI_INTD 11
-
-#define __IO_PREFIX microdev
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/migor.h b/libc/kernel/arch-sh/asm/migor.h
deleted file mode 100644
index be8ffb3..0000000
--- a/libc/kernel/arch-sh/asm/migor.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MIGOR_H
-#define __ASM_SH_MIGOR_H
-
-#include <asm/addrspace.h>
-
-#define PORT_PACR 0xa4050100
-#define PORT_PDCR 0xa4050106
-#define PORT_PECR 0xa4050108
-#define PORT_PHCR 0xa405010e
-#define PORT_PJCR 0xa4050110
-#define PORT_PKCR 0xa4050112
-#define PORT_PLCR 0xa4050114
-#define PORT_PMCR 0xa4050116
-#define PORT_PRCR 0xa405011c
-#define PORT_PTCR 0xa4050140
-#define PORT_PUCR 0xa4050142
-#define PORT_PVCR 0xa4050144
-#define PORT_PWCR 0xa4050146
-#define PORT_PXCR 0xa4050148
-#define PORT_PYCR 0xa405014a
-#define PORT_PZCR 0xa405014c
-#define PORT_PADR 0xa4050120
-#define PORT_PHDR 0xa405012e
-#define PORT_PTDR 0xa4050160
-#define PORT_PWDR 0xa4050166
-
-#define PORT_HIZCRA 0xa4050158
-#define PORT_HIZCRC 0xa405015c
-
-#define PORT_MSELCRB 0xa4050182
-
-#define PORT_PSELA 0xa405014e
-#define PORT_PSELB 0xa4050150
-#define PORT_PSELC 0xa4050152
-#define PORT_PSELD 0xa4050154
-#define PORT_PSELE 0xa4050156
-
-#define PORT_HIZCRA 0xa4050158
-#define PORT_HIZCRB 0xa405015a
-#define PORT_HIZCRC 0xa405015c
-
-#define BSC_CS6ABCR 0xfec1001c
-
-#include <asm/sh_mobile_lcdc.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/mman.h b/libc/kernel/arch-sh/asm/mman.h
deleted file mode 100644
index bf96efc..0000000
--- a/libc/kernel/arch-sh/asm/mman.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MMAN_H
-#define __ASM_SH_MMAN_H
-
-#include <asm-generic/mman.h>
-
-#define MAP_GROWSDOWN 0x0100  
-#define MAP_DENYWRITE 0x0800  
-#define MAP_EXECUTABLE 0x1000  
-#define MAP_LOCKED 0x2000  
-#define MAP_NORESERVE 0x4000  
-#define MAP_POPULATE 0x8000  
-#define MAP_NONBLOCK 0x10000  
-
-#define MCL_CURRENT 1  
-#define MCL_FUTURE 2  
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/mmu.h b/libc/kernel/arch-sh/asm/mmu.h
deleted file mode 100644
index cf54cb8..0000000
--- a/libc/kernel/arch-sh/asm/mmu.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __MMU_H
-#define __MMU_H
-
-typedef unsigned long mm_context_id_t[NR_CPUS];
-
-typedef struct {
- mm_context_id_t id;
- void *vdso;
-} mm_context_t;
-
-#define PMB_PASCR 0xff000070
-#define PMB_IRMCR 0xff000078
-
-#define PMB_ADDR 0xf6100000
-#define PMB_DATA 0xf7100000
-#define PMB_ENTRY_MAX 16
-#define PMB_E_MASK 0x0000000f
-#define PMB_E_SHIFT 8
-
-#define PMB_SZ_16M 0x00000000
-#define PMB_SZ_64M 0x00000010
-#define PMB_SZ_128M 0x00000080
-#define PMB_SZ_512M 0x00000090
-#define PMB_SZ_MASK PMB_SZ_512M
-#define PMB_C 0x00000008
-#define PMB_WT 0x00000001
-#define PMB_UB 0x00000200
-#define PMB_V 0x00000100
-
-#define PMB_NO_ENTRY (-1)
-
-struct pmb_entry;
-
-struct pmb_entry {
- unsigned long vpn;
- unsigned long ppn;
- unsigned long flags;
-
- int entry;
-
- struct pmb_entry *next;
-
- struct pmb_entry *link;
-};
-
-struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
- unsigned long flags);
-
-#endif
-
diff --git a/libc/kernel/arch-sh/asm/mmu_context.h b/libc/kernel/arch-sh/asm/mmu_context.h
deleted file mode 100644
index cbf07ef..0000000
--- a/libc/kernel/arch-sh/asm/mmu_context.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MMU_CONTEXT_H
-#define __ASM_SH_MMU_CONTEXT_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/mmu_context_32.h b/libc/kernel/arch-sh/asm/mmu_context_32.h
deleted file mode 100644
index dca7e6b..0000000
--- a/libc/kernel/arch-sh/asm/mmu_context_32.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MMU_CONTEXT_32_H
-#define __ASM_SH_MMU_CONTEXT_32_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/mmu_context_64.h b/libc/kernel/arch-sh/asm/mmu_context_64.h
deleted file mode 100644
index d7744be..0000000
--- a/libc/kernel/arch-sh/asm/mmu_context_64.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MMU_CONTEXT_64_H
-#define __ASM_SH_MMU_CONTEXT_64_H
-
-#include <cpu/registers.h>
-#include <asm/cacheflush.h>
-
-#define SR_ASID_MASK 0xffffffffff00ffffULL
-#define SR_ASID_SHIFT 16
-
-#define set_TTB(pgd) (mmu_pdtp_cache = (pgd))
-#define get_TTB() (mmu_pdtp_cache)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/mmzone.h b/libc/kernel/arch-sh/asm/mmzone.h
deleted file mode 100644
index 9bddda4..0000000
--- a/libc/kernel/arch-sh/asm/mmzone.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MMZONE_H
-#define __ASM_SH_MMZONE_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/module.h b/libc/kernel/arch-sh/asm/module.h
deleted file mode 100644
index 76bb90a..0000000
--- a/libc/kernel/arch-sh/asm/module.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_MODULE_H
-#define _ASM_SH_MODULE_H
-
-struct mod_arch_specific {
-
-};
-
-#define Elf_Shdr Elf32_Shdr
-#define Elf_Sym Elf32_Sym
-#define Elf_Ehdr Elf32_Ehdr
-
-#define MODULE_PROC_FAMILY "SH4LE "
-
-#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/page.h b/libc/kernel/arch-sh/asm/page.h
deleted file mode 100644
index f187dd7..0000000
--- a/libc/kernel/arch-sh/asm/page.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PAGE_H
-#define __ASM_SH_PAGE_H
-
-#include <linux/const.h>
-
-#define PAGE_SHIFT 12
-
-#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE-1))
-#define PTE_MASK PAGE_MASK
-
-#ifndef __ASSEMBLY__
-
-struct page;
-struct vm_area_struct;
-
-#define __HAVE_ARCH_COPY_USER_HIGHPAGE
-
-typedef struct { unsigned long pte_low; } pte_t;
-typedef struct { unsigned long pgprot; } pgprot_t;
-typedef struct { unsigned long pgd; } pgd_t;
-#define pte_val(x) ((x).pte_low)
-#define __pte(x) ((pte_t) { (x) } )
-
-#define pgd_val(x) ((x).pgd)
-#define pgprot_val(x) ((x).pgprot)
-
-#define __pgd(x) ((pgd_t) { (x) } )
-#define __pgprot(x) ((pgprot_t) { (x) } )
-
-typedef struct page *pgtable_t;
-
-#endif
-
-#define __MEMORY_START CONFIG_MEMORY_START
-#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
-
-#define PAGE_OFFSET CONFIG_PAGE_OFFSET
-
-#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
-#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
-
-#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
-#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
-
-#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
-#define ARCH_PFN_OFFSET (PFN_START)
-#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
-#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
-#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
-
-#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC |   VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-
-#include <asm-generic/memory_model.h>
-
-#define __HAVE_ARCH_GATE_AREA
-
-#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/param.h b/libc/kernel/arch-sh/asm/param.h
deleted file mode 100644
index 4a59cd8..0000000
--- a/libc/kernel/arch-sh/asm/param.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PARAM_H
-#define __ASM_SH_PARAM_H
-
-#ifndef HZ
-#define HZ 100
-#endif
-
-#define EXEC_PAGESIZE 4096
-
-#ifndef NOGROUP
-#define NOGROUP (-1)
-#endif
-
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/parport.h b/libc/kernel/arch-sh/asm/parport.h
deleted file mode 100644
index 8375b51..0000000
--- a/libc/kernel/arch-sh/asm/parport.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PARPORT_H
-#define __ASM_SH_PARPORT_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/pci.h b/libc/kernel/arch-sh/asm/pci.h
deleted file mode 100644
index 1fafad9..0000000
--- a/libc/kernel/arch-sh/asm/pci.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PCI_H
-#define __ASM_SH_PCI_H
-
-#include <asm-generic/pci.h>
-
-#include <asm-generic/pci-dma-compat.h>
-
-#endif
-
diff --git a/libc/kernel/arch-sh/asm/pgtable.h b/libc/kernel/arch-sh/asm/pgtable.h
deleted file mode 100644
index 3c8ece1..0000000
--- a/libc/kernel/arch-sh/asm/pgtable.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PGTABLE_H
-#define __ASM_SH_PGTABLE_H
-
-#include <asm-generic/pgtable-nopmd.h>
-#include <asm/page.h>
-
-#ifndef __ASSEMBLY__
-#include <asm/addrspace.h>
-#include <asm/fixmap.h>
-
-#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
-
-#endif
-
-#define NEFF 32
-#define NEFF_SIGN (1LL << (NEFF - 1))
-#define NEFF_MASK (-1LL << NEFF)
-
-#define NPHYS 29
-
-#define NPHYS_SIGN (1LL << (NPHYS - 1))
-#define NPHYS_MASK (-1LL << NPHYS)
-
-#define PTE_MAGNITUDE 2  
-#define PTE_SHIFT PAGE_SHIFT
-#define PTE_BITS (PTE_SHIFT - PTE_MAGNITUDE)
-
-#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS)
-#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
-#define PGDIR_MASK (~(PGDIR_SIZE-1))
-
-#define PTRS_PER_PTE (PAGE_SIZE / (1 << PTE_MAGNITUDE))
-#define PTRS_PER_PGD (PAGE_SIZE / sizeof(pgd_t))
-
-#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
-#define FIRST_USER_ADDRESS 0
-
-#define PHYS_ADDR_MASK 0x1fffffff
-
-#define PTE_PHYS_MASK (PHYS_ADDR_MASK & PAGE_MASK)
-
-#define VMALLOC_START (P3SEG)
-#define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
-
-#include <asm/pgtable_32.h>
-
-#define __P000 PAGE_NONE
-#define __P001 PAGE_READONLY
-#define __P010 PAGE_COPY
-#define __P011 PAGE_COPY
-#define __P100 PAGE_EXECREAD
-#define __P101 PAGE_EXECREAD
-#define __P110 PAGE_COPY
-#define __P111 PAGE_COPY
-
-#define __S000 PAGE_NONE
-#define __S001 PAGE_READONLY
-#define __S010 PAGE_WRITEONLY
-#define __S011 PAGE_SHARED
-#define __S100 PAGE_EXECREAD
-#define __S101 PAGE_EXECREAD
-#define __S110 PAGE_RWX
-#define __S111 PAGE_RWX
-
-typedef pte_t *pte_addr_t;
-
-#define kern_addr_valid(addr) (1)
-
-#define io_remap_pfn_range(vma, vaddr, pfn, size, prot)   remap_pfn_range(vma, vaddr, pfn, size, prot)
-
-#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT)))
-
-#define pgtable_cache_init() do { } while (0)
-
-struct mm_struct;
-#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
-
-struct vm_area_struct;
-
-#include <asm-generic/pgtable.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/pgtable_32.h b/libc/kernel/arch-sh/asm/pgtable_32.h
deleted file mode 100644
index 6ef21f1..0000000
--- a/libc/kernel/arch-sh/asm/pgtable_32.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PGTABLE_32_H
-#define __ASM_SH_PGTABLE_32_H
-
-#define _PAGE_WT 0x001  
-#define _PAGE_HW_SHARED 0x002  
-#define _PAGE_DIRTY 0x004  
-#define _PAGE_CACHABLE 0x008  
-#define _PAGE_SZ0 0x010  
-#define _PAGE_RW 0x020  
-#define _PAGE_USER 0x040  
-#define _PAGE_SZ1 0x080  
-#define _PAGE_PRESENT 0x100  
-#define _PAGE_PROTNONE 0x200  
-#define _PAGE_ACCESSED 0x400  
-#define _PAGE_FILE _PAGE_WT  
-
-#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
-#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
-
-#define _PAGE_EXT_ESZ0 0x0010  
-#define _PAGE_EXT_ESZ1 0x0020  
-#define _PAGE_EXT_ESZ2 0x0040  
-#define _PAGE_EXT_ESZ3 0x0080  
-
-#define _PAGE_EXT_USER_EXEC 0x0100  
-#define _PAGE_EXT_USER_WRITE 0x0200  
-#define _PAGE_EXT_USER_READ 0x0400  
-
-#define _PAGE_EXT_KERN_EXEC 0x0800  
-#define _PAGE_EXT_KERN_WRITE 0x1000  
-#define _PAGE_EXT_KERN_READ 0x2000  
-
-#define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
-
-#define _PAGE_PCC_AREA5 0x00000000  
-#define _PAGE_PCC_AREA6 0x80000000  
-
-#define _PAGE_PCC_IODYN 0x00000001  
-#define _PAGE_PCC_IO8 0x20000000  
-#define _PAGE_PCC_IO16 0x20000001  
-#define _PAGE_PCC_COM8 0x40000000  
-#define _PAGE_PCC_COM16 0x40000001  
-#define _PAGE_PCC_ATR8 0x60000000  
-#define _PAGE_PCC_ATR16 0x60000001  
-
-#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
-
-#define _PAGE_FLAGS_HARDWARE_MASK (PHYS_ADDR_MASK & ~(_PAGE_CLEAR_FLAGS))
-
-#define _PAGE_FLAGS_HARD _PAGE_SZ0
-
-#ifndef _PAGE_SZHUGE
-#define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
-#endif
-
-#define _PAGE_CHG_MASK   (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
-
-#ifndef __ASSEMBLY__
-
-#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |   _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
-
-#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER |   _PAGE_CACHABLE | _PAGE_ACCESSED |   _PAGE_FLAGS_HARD)
-
-#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE |   _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
-
-#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE |   _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
-
-#define PAGE_EXECREAD PAGE_READONLY
-#define PAGE_RWX PAGE_SHARED
-#define PAGE_WRITEONLY PAGE_SHARED
-
-#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE |   _PAGE_DIRTY | _PAGE_ACCESSED |   _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
-
-#define PAGE_KERNEL_NOCACHE   __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY |   _PAGE_ACCESSED | _PAGE_HW_SHARED |   _PAGE_FLAGS_HARD)
-
-#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE |   _PAGE_DIRTY | _PAGE_ACCESSED |   _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
-
-#define PAGE_KERNEL_PCC(slot, type)   __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY |   _PAGE_ACCESSED | _PAGE_FLAGS_HARD |   (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) |   (type))
-
-#endif
-
-#ifndef __ASSEMBLY__
-
-#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
-
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
-
-#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
-
-#define pfn_pte(pfn, prot)   __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
-#define pfn_pmd(pfn, prot)   __pmd(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
-
-#define pte_none(x) (!pte_val(x))
-#define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
-
-#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
-
-#define pmd_none(x) (!pmd_val(x))
-#define pmd_present(x) (pmd_val(x))
-#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
-#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
-
-#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
-#define pte_page(x) pfn_to_page(pte_pfn(x))
-
-#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
-#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
-#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
-#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
-#define pte_special(pte) (0)
-
-#define pte_write(pte) ((pte).pte_low & _PAGE_RW)
-
-#define PTE_BIT_FUNC(h,fn,op)  static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
-
-#define pgprot_writecombine(prot)   __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
-#define pgprot_noncached pgprot_writecombine
-#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
-#define pmd_page_vaddr(pmd) ((unsigned long)pmd_val(pmd))
-#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
-#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
-#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
-#define pgd_offset_k(address) pgd_offset(&init_mm, address)
-#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
-#define pte_offset_kernel(dir, address)   ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
-#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
-#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
-#define pte_unmap(pte) do { } while (0)
-#define pte_unmap_nested(pte) do { } while (0)
-#define pte_ERROR(e)   printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
-#define pgd_ERROR(e)   printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
-#define __swp_type(x) ((x).val & 0xff)
-#define __swp_offset(x) ((x).val >> 10)
-#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) <<10})
-#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 })
-#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 })
-#define PTE_FILE_MAX_BITS 29
-#define pte_to_pgoff(pte) (pte_val(pte) >> 1)
-#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/pgtable_64.h b/libc/kernel/arch-sh/asm/pgtable_64.h
deleted file mode 100644
index b5d60bb..0000000
--- a/libc/kernel/arch-sh/asm/pgtable_64.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PGTABLE_64_H
-#define __ASM_SH_PGTABLE_64_H
-
-#include <linux/threads.h>
-#include <asm/processor.h>
-#include <asm/page.h>
-
-#define pte_ERROR(e)   printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e))
-#define pgd_ERROR(e)   printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
-
-#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
-
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
-#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
-#define __pgd_offset(address) pgd_index(address)
-#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
-#define pgd_offset_k(address) pgd_offset(&init_mm, address)
-#define _PMD_EMPTY 0x0
-#define pmd_present(pmd_entry) (pmd_val(pmd_entry) & _PAGE_PRESENT)
-#define pmd_clear(pmd_entry_p) (set_pmd((pmd_entry_p), __pmd(_PMD_EMPTY)))
-#define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY)
-#define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
-#define pmd_page_vaddr(pmd_entry)   ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK))
-#define pmd_page(pmd)   (virt_to_page(pmd_val(pmd)))
-#define pte_index(address)   ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
-#define pte_offset_kernel(dir, addr)   ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr)))
-#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr)
-#define pte_offset_map_nested(dir,addr) pte_offset_kernel(dir, addr)
-#define pte_unmap(pte) do { } while (0)
-#define pte_unmap_nested(pte) do { } while (0)
-#ifndef __ASSEMBLY__
-#define IOBASE_VADDR 0xff000000
-#define IOBASE_END 0xffffffff
-#define _PAGE_WT 0x001  
-#define _PAGE_DEVICE 0x001  
-#define _PAGE_CACHABLE 0x002  
-#define _PAGE_PRESENT 0x004  
-#define _PAGE_FILE 0x004  
-#define _PAGE_SIZE0 0x008  
-#define _PAGE_SIZE1 0x010  
-#define _PAGE_SHARED 0x020  
-#define _PAGE_READ 0x040  
-#define _PAGE_EXECUTE 0x080  
-#define _PAGE_WRITE 0x100  
-#define _PAGE_USER 0x200  
-#define _PAGE_DIRTY 0x400  
-#define _PAGE_ACCESSED 0x800  
-#define _PAGE_FLAGS_HARDWARE_MASK 0xfffffffffffff3dbLL
-#ifndef _PAGE_SZHUGE
-#define _PAGE_SZHUGE (0)
-#endif
-#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |   _PAGE_EXECUTE |   _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_DIRTY |   _PAGE_SHARED)
-#define _PAGE_TABLE (_KERNPG_TABLE | _PAGE_USER)
-#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
-#define _PAGE_COMMON (_PAGE_PRESENT | _PAGE_USER |   _PAGE_CACHABLE | _PAGE_ACCESSED)
-#define PAGE_NONE __pgprot(_PAGE_CACHABLE | _PAGE_ACCESSED)
-#define PAGE_SHARED __pgprot(_PAGE_COMMON | _PAGE_READ | _PAGE_WRITE |   _PAGE_SHARED)
-#define PAGE_EXECREAD __pgprot(_PAGE_COMMON | _PAGE_READ | _PAGE_EXECUTE)
-#define PAGE_COPY PAGE_EXECREAD
-#define PAGE_READONLY __pgprot(_PAGE_COMMON | _PAGE_READ)
-#define PAGE_WRITEONLY __pgprot(_PAGE_COMMON | _PAGE_WRITE)
-#define PAGE_RWX __pgprot(_PAGE_COMMON | _PAGE_READ |   _PAGE_WRITE | _PAGE_EXECUTE)
-#define PAGE_KERNEL __pgprot(_KERNPG_TABLE)
-#define PAGE_KERNEL_NOCACHE   __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |   _PAGE_EXECUTE | _PAGE_ACCESSED |   _PAGE_DIRTY | _PAGE_SHARED)
-#define pgprot_noncached(x) __pgprot(((x).pgprot & ~(_PAGE_CACHABLE)) | _PAGE_DEVICE)
-#define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
-
-#define __handle_bad_pmd(x) __handle_bad_pmd_kernel(x)
-
-#define _PTE_EMPTY 0x0
-#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
-#define pte_clear(mm,addr,xp) (set_pte_at(mm, addr, xp, __pte(_PTE_EMPTY)))
-#define pte_none(x) (pte_val(x) == _PTE_EMPTY)
-
-#define pte_pagenr(x) (((unsigned long) (pte_val(x)) -   __MEMORY_START) >> PAGE_SHIFT)
-
-#define pte_page(x) (mem_map + pte_pagenr(x))
-
-#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
-
-#define mk_pte(page,pgprot)  ({   pte_t __pte;     set_pte(&__pte, __pte((((page)-mem_map) << PAGE_SHIFT) |   __MEMORY_START | pgprot_val((pgprot))));   __pte;  })
-#define mk_pte_phys(physpage, pgprot)  ({ pte_t __pte; set_pte(&__pte, __pte(physpage | pgprot_val(pgprot))); __pte; })
-#define __swp_type(x) (((x).val & 3) + (((x).val >> 1) & 0x3c))
-#define __swp_offset(x) ((x).val >> 8)
-#define __swp_entry(type, offset) ((swp_entry_t) { ((offset << 8) + ((type & 0x3c) << 1) + (type & 3)) })
-#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
-#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
-#define PTE_FILE_MAX_BITS 29
-#define pte_to_pgoff(pte) (pte_val(pte))
-#define pgoff_to_pte(off) ((pte_t) { (off) | _PAGE_FILE })
-#endif
-#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
-#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
-#endif
diff --git a/libc/kernel/arch-sh/asm/pm.h b/libc/kernel/arch-sh/asm/pm.h
deleted file mode 100644
index ba4caa7..0000000
--- a/libc/kernel/arch-sh/asm/pm.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PM_H
-#define __ASM_SH_PM_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/poll.h b/libc/kernel/arch-sh/asm/poll.h
deleted file mode 100644
index 5b16673..0000000
--- a/libc/kernel/arch-sh/asm/poll.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/poll.h>
diff --git a/libc/kernel/arch-sh/asm/posix_types.h b/libc/kernel/arch-sh/asm/posix_types.h
deleted file mode 100644
index 7d13b5d..0000000
--- a/libc/kernel/arch-sh/asm/posix_types.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifdef __SH5__
-#include "posix_types_64.h"
-#else
-#include "posix_types_32.h"
-#endif
diff --git a/libc/kernel/arch-sh/asm/posix_types_32.h b/libc/kernel/arch-sh/asm/posix_types_32.h
deleted file mode 100644
index 7cca40b..0000000
--- a/libc/kernel/arch-sh/asm/posix_types_32.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_POSIX_TYPES_H
-#define __ASM_SH_POSIX_TYPES_H
-
-typedef unsigned long __kernel_ino_t;
-typedef unsigned short __kernel_mode_t;
-typedef unsigned short __kernel_nlink_t;
-typedef long __kernel_off_t;
-typedef int __kernel_pid_t;
-typedef unsigned short __kernel_ipc_pid_t;
-typedef unsigned short __kernel_uid_t;
-typedef unsigned short __kernel_gid_t;
-typedef unsigned int __kernel_size_t;
-typedef int __kernel_ssize_t;
-typedef int __kernel_ptrdiff_t;
-typedef long __kernel_time_t;
-typedef long __kernel_suseconds_t;
-typedef long __kernel_clock_t;
-typedef int __kernel_timer_t;
-typedef int __kernel_clockid_t;
-typedef int __kernel_daddr_t;
-typedef char * __kernel_caddr_t;
-typedef unsigned short __kernel_uid16_t;
-typedef unsigned short __kernel_gid16_t;
-typedef unsigned int __kernel_uid32_t;
-typedef unsigned int __kernel_gid32_t;
-
-typedef unsigned short __kernel_old_uid_t;
-typedef unsigned short __kernel_old_gid_t;
-typedef unsigned short __kernel_old_dev_t;
-
-#ifdef __GNUC__
-typedef long long __kernel_loff_t;
-#endif
-
-typedef struct {
-#ifdef __USE_ALL
- int val[2];
-#else
- int __val[2];
-#endif
-} __kernel_fsid_t;
-
-#if !defined(__GLIBC__) || __GLIBC__ < 2
-
-#undef __FD_SET
-static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
-{
- unsigned long __tmp = __fd / __NFDBITS;
- unsigned long __rem = __fd % __NFDBITS;
- __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
-}
-
-#undef __FD_CLR
-static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
-{
- unsigned long __tmp = __fd / __NFDBITS;
- unsigned long __rem = __fd % __NFDBITS;
- __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
-}
-
-#undef __FD_ISSET
-static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
-{
- unsigned long __tmp = __fd / __NFDBITS;
- unsigned long __rem = __fd % __NFDBITS;
- return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
-}
-
-#undef __FD_ZERO
-static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
-{
- unsigned long *__tmp = __p->fds_bits;
- int __i;
-
- if (__builtin_constant_p(__FDSET_LONGS)) {
- switch (__FDSET_LONGS) {
- case 16:
- __tmp[ 0] = 0; __tmp[ 1] = 0;
- __tmp[ 2] = 0; __tmp[ 3] = 0;
- __tmp[ 4] = 0; __tmp[ 5] = 0;
- __tmp[ 6] = 0; __tmp[ 7] = 0;
- __tmp[ 8] = 0; __tmp[ 9] = 0;
- __tmp[10] = 0; __tmp[11] = 0;
- __tmp[12] = 0; __tmp[13] = 0;
- __tmp[14] = 0; __tmp[15] = 0;
- return;
-
- case 8:
- __tmp[ 0] = 0; __tmp[ 1] = 0;
- __tmp[ 2] = 0; __tmp[ 3] = 0;
- __tmp[ 4] = 0; __tmp[ 5] = 0;
- __tmp[ 6] = 0; __tmp[ 7] = 0;
- return;
-
- case 4:
- __tmp[ 0] = 0; __tmp[ 1] = 0;
- __tmp[ 2] = 0; __tmp[ 3] = 0;
- return;
- }
- }
- __i = __FDSET_LONGS;
- while (__i) {
- __i--;
- *__tmp = 0;
- __tmp++;
- }
-}
-
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/posix_types_64.h b/libc/kernel/arch-sh/asm/posix_types_64.h
deleted file mode 100644
index babc366..0000000
--- a/libc/kernel/arch-sh/asm/posix_types_64.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH64_POSIX_TYPES_H
-#define __ASM_SH64_POSIX_TYPES_H
-
-typedef unsigned long __kernel_ino_t;
-typedef unsigned short __kernel_mode_t;
-typedef unsigned short __kernel_nlink_t;
-typedef long __kernel_off_t;
-typedef int __kernel_pid_t;
-typedef unsigned short __kernel_ipc_pid_t;
-typedef unsigned short __kernel_uid_t;
-typedef unsigned short __kernel_gid_t;
-typedef long unsigned int __kernel_size_t;
-typedef int __kernel_ssize_t;
-typedef int __kernel_ptrdiff_t;
-typedef long __kernel_time_t;
-typedef long __kernel_suseconds_t;
-typedef long __kernel_clock_t;
-typedef int __kernel_timer_t;
-typedef int __kernel_clockid_t;
-typedef int __kernel_daddr_t;
-typedef char * __kernel_caddr_t;
-typedef unsigned short __kernel_uid16_t;
-typedef unsigned short __kernel_gid16_t;
-typedef unsigned int __kernel_uid32_t;
-typedef unsigned int __kernel_gid32_t;
-
-typedef unsigned short __kernel_old_uid_t;
-typedef unsigned short __kernel_old_gid_t;
-typedef unsigned short __kernel_old_dev_t;
-
-#ifdef __GNUC__
-typedef long long __kernel_loff_t;
-#endif
-
-typedef struct {
-#ifdef __USE_ALL
- int val[2];
-#else
- int __val[2];
-#endif
-} __kernel_fsid_t;
-
-#if !defined(__GLIBC__) || __GLIBC__ < 2
-
-#undef __FD_SET
-static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
-{
- unsigned long __tmp = __fd / __NFDBITS;
- unsigned long __rem = __fd % __NFDBITS;
- __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
-}
-
-#undef __FD_CLR
-static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
-{
- unsigned long __tmp = __fd / __NFDBITS;
- unsigned long __rem = __fd % __NFDBITS;
- __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
-}
-
-#undef __FD_ISSET
-static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
-{
- unsigned long __tmp = __fd / __NFDBITS;
- unsigned long __rem = __fd % __NFDBITS;
- return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
-}
-
-#undef __FD_ZERO
-static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
-{
- unsigned long *__tmp = __p->fds_bits;
- int __i;
-
- if (__builtin_constant_p(__FDSET_LONGS)) {
- switch (__FDSET_LONGS) {
- case 16:
- __tmp[ 0] = 0; __tmp[ 1] = 0;
- __tmp[ 2] = 0; __tmp[ 3] = 0;
- __tmp[ 4] = 0; __tmp[ 5] = 0;
- __tmp[ 6] = 0; __tmp[ 7] = 0;
- __tmp[ 8] = 0; __tmp[ 9] = 0;
- __tmp[10] = 0; __tmp[11] = 0;
- __tmp[12] = 0; __tmp[13] = 0;
- __tmp[14] = 0; __tmp[15] = 0;
- return;
-
- case 8:
- __tmp[ 0] = 0; __tmp[ 1] = 0;
- __tmp[ 2] = 0; __tmp[ 3] = 0;
- __tmp[ 4] = 0; __tmp[ 5] = 0;
- __tmp[ 6] = 0; __tmp[ 7] = 0;
- return;
-
- case 4:
- __tmp[ 0] = 0; __tmp[ 1] = 0;
- __tmp[ 2] = 0; __tmp[ 3] = 0;
- return;
- }
- }
- __i = __FDSET_LONGS;
- while (__i) {
- __i--;
- *__tmp = 0;
- __tmp++;
- }
-}
-
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/processor.h b/libc/kernel/arch-sh/asm/processor.h
deleted file mode 100644
index e808ed6..0000000
--- a/libc/kernel/arch-sh/asm/processor.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PROCESSOR_H
-#define __ASM_SH_PROCESSOR_H
-
-#include <asm/cpu-features.h>
-#include <asm/segment.h>
-
-#ifndef __ASSEMBLY__
-
-enum cpu_type {
-
- CPU_SH7619,
-
- CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
-
- CPU_SH7705, CPU_SH7706, CPU_SH7707,
- CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
- CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
- CPU_SH7720, CPU_SH7721, CPU_SH7729,
-
- CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
- CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
-
- CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785,
- CPU_SH7723, CPU_SHX3,
-
- CPU_SH7343, CPU_SH7722, CPU_SH7366,
-
- CPU_SH5_101, CPU_SH5_103,
-
- CPU_SH_NONE
-};
-
-struct sh_cpuinfo;
-
-#endif
-
-#include "processor_32.h"
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/processor_32.h b/libc/kernel/arch-sh/asm/processor_32.h
deleted file mode 100644
index d60b2f8..0000000
--- a/libc/kernel/arch-sh/asm/processor_32.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PROCESSOR_32_H
-#define __ASM_SH_PROCESSOR_32_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/processor_64.h b/libc/kernel/arch-sh/asm/processor_64.h
deleted file mode 100644
index 035a526..0000000
--- a/libc/kernel/arch-sh/asm/processor_64.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PROCESSOR_64_H
-#define __ASM_SH_PROCESSOR_64_H
-
-#ifndef __ASSEMBLY__
-
-#include <linux/compiler.h>
-#include <asm/page.h>
-#include <asm/types.h>
-#include <asm/cache.h>
-#include <asm/ptrace.h>
-#include <cpu/registers.h>
-
-#define current_text_addr() ({  void *pc;  unsigned long long __dummy = 0;  __asm__("gettr	tr0, %1\n\t"   "pta	4, tr0\n\t"   "gettr	tr0, %0\n\t"   "ptabs	%1, tr0\n\t"   :"=r" (pc), "=r" (__dummy)   : "1" (__dummy));  pc; })
-
-struct tlb_info {
- unsigned long long next;
- unsigned long long first;
- unsigned long long last;
-
- unsigned int entries;
- unsigned int step;
-
- unsigned long flags;
-};
-
-struct sh_cpuinfo {
- enum cpu_type type;
- unsigned long loops_per_jiffy;
- unsigned long asid_cache;
-
- unsigned int cpu_clock, master_clock, bus_clock, module_clock;
-
- struct cache_info icache;
- struct cache_info dcache;
- struct cache_info scache;
-
- struct tlb_info itlb;
- struct tlb_info dtlb;
-
- unsigned long flags;
-};
-
-#define boot_cpu_data cpu_data[0]
-#define current_cpu_data cpu_data[smp_processor_id()]
-#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
-
-#endif
-
-#define TASK_SIZE 0x7ffff000UL
-
-#define STACK_TOP TASK_SIZE
-#define STACK_TOP_MAX STACK_TOP
-
-#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
-
-#define SR_MMU 0x80000000
-
-#define SR_IMASK 0x000000f0
-#define SR_FD 0x00008000
-#define SR_SSTEP 0x08000000
-
-#ifndef __ASSEMBLY__
-
-struct sh_fpu_hard_struct {
- unsigned long fp_regs[64];
- unsigned int fpscr;
-
-};
-
-union sh_fpu_union {
- struct sh_fpu_hard_struct hard;
-
- unsigned long long alignment_dummy;
-};
-
-struct thread_struct {
- unsigned long sp;
- unsigned long pc;
-
- struct pt_regs *kregs;
-
- struct pt_regs *uregs;
-
- unsigned long trap_no, error_code;
- unsigned long address;
-
- union sh_fpu_union fpu;
-};
-
-#define INIT_MMAP  { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-
-#define INIT_THREAD {   .sp = sizeof(init_stack) +   (long) &init_stack,   .pc = 0,   .kregs = &fake_swapper_regs,   .uregs = NULL,   .trap_no = 0,   .error_code = 0,   .address = 0,   .fpu = { { { 0, } }, }  }
-
-#define SR_USER (SR_MMU | SR_FD)
-
-#define start_thread(regs, new_pc, new_sp)   set_fs(USER_DS);   regs->sr = SR_USER;     regs->pc = new_pc - 4;     regs->pc |= 1;     regs->regs[18] = 0;   regs->regs[15] = new_sp
-
-struct task_struct;
-struct mm_struct;
-
-#define copy_segments(p, mm) do { } while (0)
-#define release_segments(mm) do { } while (0)
-#define forget_segments() do { } while (0)
-#define prepare_to_copy(tsk) do { } while (0)
-
-#define FPSCR_INIT 0x00000000
-
-#define thread_saved_pc(tsk) (tsk->thread.pc)
-
-#define KSTK_EIP(tsk) ((tsk)->thread.pc)
-#define KSTK_ESP(tsk) ((tsk)->thread.sp)
-
-#define cpu_relax() barrier()
-
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/ptrace.h b/libc/kernel/arch-sh/asm/ptrace.h
deleted file mode 100644
index 452af81..0000000
--- a/libc/kernel/arch-sh/asm/ptrace.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PTRACE_H
-#define __ASM_SH_PTRACE_H
-
-#ifdef __SH5__
-struct pt_regs {
- unsigned long long pc;
- unsigned long long sr;
- unsigned long long syscall_nr;
- unsigned long long regs[63];
- unsigned long long tregs[8];
- unsigned long long pad[2];
-};
-#else
-
-#define REG_REG0 0
-#define REG_REG15 15
-
-#define REG_PC 16
-
-#define REG_PR 17
-#define REG_SR 18
-#define REG_GBR 19
-#define REG_MACH 20
-#define REG_MACL 21
-
-#define REG_SYSCALL 22
-
-#define REG_FPREG0 23
-#define REG_FPREG15 38
-#define REG_XFREG0 39
-#define REG_XFREG15 54
-
-#define REG_FPSCR 55
-#define REG_FPUL 56
-
-struct pt_regs {
- unsigned long regs[16];
- unsigned long pc;
- unsigned long pr;
- unsigned long sr;
- unsigned long gbr;
- unsigned long mach;
- unsigned long macl;
- long tra;
-};
-
-struct pt_dspregs {
- unsigned long a1;
- unsigned long a0g;
- unsigned long a1g;
- unsigned long m0;
- unsigned long m1;
- unsigned long a0;
- unsigned long x0;
- unsigned long x1;
- unsigned long y0;
- unsigned long y1;
- unsigned long dsr;
- unsigned long rs;
- unsigned long re;
- unsigned long mod;
-};
-
-#define PTRACE_GETFDPIC 31  
-
-#define PTRACE_GETFDPIC_EXEC 0  
-#define PTRACE_GETFDPIC_INTERP 1  
-
-#define PTRACE_GETDSPREGS 55
-#define PTRACE_SETDSPREGS 56
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/push-switch.h b/libc/kernel/arch-sh/asm/push-switch.h
deleted file mode 100644
index e07bf67..0000000
--- a/libc/kernel/arch-sh/asm/push-switch.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_PUSH_SWITCH_H
-#define __ASM_SH_PUSH_SWITCH_H
-
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/workqueue.h>
-#include <linux/platform_device.h>
-
-struct push_switch {
-
- unsigned int state:1;
-
- struct timer_list debounce;
-
- struct work_struct work;
-
- struct platform_device *pdev;
-};
-
-struct push_switch_platform_info {
-
- irqreturn_t (*irq_handler)(int irq, void *data);
-
- unsigned int irq_flags;
-
- unsigned int bit;
-
- const char *name;
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/r7780rp.h b/libc/kernel/arch-sh/asm/r7780rp.h
deleted file mode 100644
index 50e0df8..0000000
--- a/libc/kernel/arch-sh/asm/r7780rp.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_RENESAS_R7780RP_H
-#define __ASM_SH_RENESAS_R7780RP_H
-
-#define HL_FPGA_IRQ_BASE 200
-#define HL_NR_IRL 15
-
-#define IRQ_AX88796 (HL_FPGA_IRQ_BASE + 0)
-#define IRQ_CF (HL_FPGA_IRQ_BASE + 1)
-#define IRQ_PSW (HL_FPGA_IRQ_BASE + 2)
-#define IRQ_EXT0 (HL_FPGA_IRQ_BASE + 3)
-#define IRQ_EXT1 (HL_FPGA_IRQ_BASE + 4)
-#define IRQ_EXT2 (HL_FPGA_IRQ_BASE + 5)
-#define IRQ_EXT3 (HL_FPGA_IRQ_BASE + 6)
-#define IRQ_EXT4 (HL_FPGA_IRQ_BASE + 7)
-#define IRQ_EXT5 (HL_FPGA_IRQ_BASE + 8)
-#define IRQ_EXT6 (HL_FPGA_IRQ_BASE + 9)
-#define IRQ_EXT7 (HL_FPGA_IRQ_BASE + 10)
-#define IRQ_SMBUS (HL_FPGA_IRQ_BASE + 11)
-#define IRQ_TP (HL_FPGA_IRQ_BASE + 12)
-#define IRQ_RTC (HL_FPGA_IRQ_BASE + 13)
-#define IRQ_TH_ALERT (HL_FPGA_IRQ_BASE + 14)
-#define IRQ_SCIF0 (HL_FPGA_IRQ_BASE + 15)
-#define IRQ_SCIF1 (HL_FPGA_IRQ_BASE + 16)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/resource.h b/libc/kernel/arch-sh/asm/resource.h
deleted file mode 100644
index da606cc..0000000
--- a/libc/kernel/arch-sh/asm/resource.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_RESOURCE_H
-#define __ASM_SH_RESOURCE_H
-
-#include <asm-generic/resource.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/rtc.h b/libc/kernel/arch-sh/asm/rtc.h
deleted file mode 100644
index ecc6f37..0000000
--- a/libc/kernel/arch-sh/asm/rtc.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_RTC_H
-#define _ASM_RTC_H
-
-#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
-
-struct sh_rtc_platform_info {
- unsigned long capabilities;
-};
-
-#include <cpu/rtc.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/rts7751r2d.h b/libc/kernel/arch-sh/asm/rts7751r2d.h
deleted file mode 100644
index 775f25b..0000000
--- a/libc/kernel/arch-sh/asm/rts7751r2d.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_RENESAS_RTS7751R2D_H
-#define __ASM_SH_RENESAS_RTS7751R2D_H
-
-#define PA_BCR 0xa4000000  
-#define PA_IRLMON 0xa4000002  
-#define PA_CFCTL 0xa4000004  
-#define PA_CFPOW 0xa4000006  
-#define PA_DISPCTL 0xa4000008  
-#define PA_SDMPOW 0xa400000a  
-#define PA_RTCCE 0xa400000c  
-#define PA_PCICD 0xa400000e  
-#define PA_VOYAGERRTS 0xa4000020  
-
-#define PA_R2D1_AXRST 0xa4000022  
-#define PA_R2D1_CFRST 0xa4000024  
-#define PA_R2D1_ADMRTS 0xa4000026  
-#define PA_R2D1_EXTRST 0xa4000028  
-#define PA_R2D1_CFCDINTCLR 0xa400002a  
-
-#define PA_R2DPLUS_CFRST 0xa4000022  
-#define PA_R2DPLUS_ADMRTS 0xa4000024  
-#define PA_R2DPLUS_EXTRST 0xa4000026  
-#define PA_R2DPLUS_CFCDINTCLR 0xa4000028  
-#define PA_R2DPLUS_KEYCTLCLR 0xa400002a  
-
-#define PA_POWOFF 0xa4000030  
-#define PA_VERREG 0xa4000032  
-#define PA_INPORT 0xa4000034  
-#define PA_OUTPORT 0xa4000036  
-#define PA_BVERREG 0xa4000038  
-
-#define PA_AX88796L 0xaa000400  
-#define PA_VOYAGER 0xab000000  
-#define PA_IDE_OFFSET 0x1f0  
-#define AX88796L_IO_BASE 0x1000  
-
-#define IRLCNTR1 (PA_BCR + 0)  
-
-#define R2D_FPGA_IRQ_BASE 100
-
-#define IRQ_VOYAGER (R2D_FPGA_IRQ_BASE + 0)
-#define IRQ_EXT (R2D_FPGA_IRQ_BASE + 1)
-#define IRQ_TP (R2D_FPGA_IRQ_BASE + 2)
-#define IRQ_RTC_T (R2D_FPGA_IRQ_BASE + 3)
-#define IRQ_RTC_A (R2D_FPGA_IRQ_BASE + 4)
-#define IRQ_SDCARD (R2D_FPGA_IRQ_BASE + 5)
-#define IRQ_CF_CD (R2D_FPGA_IRQ_BASE + 6)
-#define IRQ_CF_IDE (R2D_FPGA_IRQ_BASE + 7)
-#define IRQ_AX88796 (R2D_FPGA_IRQ_BASE + 8)
-#define IRQ_KEY (R2D_FPGA_IRQ_BASE + 9)
-#define IRQ_PCI_INTA (R2D_FPGA_IRQ_BASE + 10)
-#define IRQ_PCI_INTB (R2D_FPGA_IRQ_BASE + 11)
-#define IRQ_PCI_INTC (R2D_FPGA_IRQ_BASE + 12)
-#define IRQ_PCI_INTD (R2D_FPGA_IRQ_BASE + 13)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/rwsem.h b/libc/kernel/arch-sh/asm/rwsem.h
deleted file mode 100644
index 4b5552e..0000000
--- a/libc/kernel/arch-sh/asm/rwsem.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_RWSEM_H
-#define _ASM_SH_RWSEM_H
-
-#ifndef _LINUX_RWSEM_H
-#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/scatterlist.h b/libc/kernel/arch-sh/asm/scatterlist.h
deleted file mode 100644
index 1c5c818..0000000
--- a/libc/kernel/arch-sh/asm/scatterlist.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SCATTERLIST_H
-#define __ASM_SH_SCATTERLIST_H
-
-#include <asm/types.h>
-
-struct scatterlist {
- unsigned long page_link;
- unsigned int offset;
- dma_addr_t dma_address;
- unsigned int length;
-};
-
-#define ISA_DMA_THRESHOLD PHYS_ADDR_MASK
-
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sdk7780.h b/libc/kernel/arch-sh/asm/sdk7780.h
deleted file mode 100644
index e5659d9..0000000
--- a/libc/kernel/arch-sh/asm/sdk7780.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_RENESAS_SDK7780_H
-#define __ASM_SH_RENESAS_SDK7780_H
-
-#include <asm/addrspace.h>
-
-#define SE_AREA0_WIDTH 4  
-#define PA_ROM 0xa0000000  
-#define PA_ROM_SIZE 0x00400000  
-#define PA_FROM 0xa0800000  
-#define PA_FROM_SIZE 0x00400000  
-#define PA_EXT1 0xa4000000
-#define PA_EXT1_SIZE 0x04000000
-#define PA_SDRAM 0xa8000000  
-#define PA_SDRAM_SIZE 0x08000000
-
-#define PA_EXT4 0xb0000000
-#define PA_EXT4_SIZE 0x04000000
-#define PA_EXT_USER PA_EXT4  
-
-#define PA_PERIPHERAL PA_AREA5_IO
-
-#define PA_RESERVED (PA_PERIPHERAL + 0)
-
-#define PA_FPGA (PA_PERIPHERAL + 0x01000000)
-
-#define PA_LAN (PA_PERIPHERAL + 0x01800000)
-
-#define FPGA_SRSTR (PA_FPGA + 0x000)  
-#define FPGA_IRQ0SR (PA_FPGA + 0x010)  
-#define FPGA_IRQ0MR (PA_FPGA + 0x020)  
-#define FPGA_BDMR (PA_FPGA + 0x030)  
-#define FPGA_INTT0PRTR (PA_FPGA + 0x040)  
-#define FPGA_INTT0SELR (PA_FPGA + 0x050)  
-#define FPGA_INTT1POLR (PA_FPGA + 0x060)  
-#define FPGA_NMIR (PA_FPGA + 0x070)  
-#define FPGA_NMIMR (PA_FPGA + 0x080)  
-#define FPGA_IRQR (PA_FPGA + 0x090)  
-#define FPGA_IRQMR (PA_FPGA + 0x0A0)  
-#define FPGA_SLEDR (PA_FPGA + 0x0B0)  
-#define PA_LED FPGA_SLEDR
-#define FPGA_MAPSWR (PA_FPGA + 0x0C0)  
-#define FPGA_FPVERR (PA_FPGA + 0x0D0)  
-#define FPGA_FPDATER (PA_FPGA + 0x0E0)  
-#define FPGA_RSE (PA_FPGA + 0x100)  
-#define FPGA_EASR (PA_FPGA + 0x110)  
-#define FPGA_SPER (PA_FPGA + 0x120)  
-#define FPGA_IMSR (PA_FPGA + 0x130)  
-#define FPGA_PCIMR (PA_FPGA + 0x140)  
-#define FPGA_DIPSWMR (PA_FPGA + 0x150)  
-#define FPGA_FPODR (PA_FPGA + 0x160)  
-#define FPGA_ATAESR (PA_FPGA + 0x170)  
-#define FPGA_IRQPOLR (PA_FPGA + 0x180)  
-
-#define SDK7780_NR_IRL 15
-
-#define IRQ_CFCARD 14
-
-#define IRQ_ETHERNET 6
-
-#define __IO_PREFIX sdk7780
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/seccomp.h b/libc/kernel/arch-sh/asm/seccomp.h
deleted file mode 100644
index ab9cab3..0000000
--- a/libc/kernel/arch-sh/asm/seccomp.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SECCOMP_H
-
-#include <linux/unistd.h>
-
-#define __NR_seccomp_read __NR_read
-#define __NR_seccomp_write __NR_write
-#define __NR_seccomp_exit __NR_exit
-#define __NR_seccomp_sigreturn __NR_rt_sigreturn
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/segment.h b/libc/kernel/arch-sh/asm/segment.h
deleted file mode 100644
index 3525a35..0000000
--- a/libc/kernel/arch-sh/asm/segment.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SEGMENT_H
-#define __ASM_SH_SEGMENT_H
-
-#ifndef __ASSEMBLY__
-
-typedef struct {
- unsigned long seg;
-} mm_segment_t;
-
-#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
-
-#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL)
-#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
-
-#define segment_eq(a,b) ((a).seg == (b).seg)
-
-#define get_ds() (KERNEL_DS)
-
-#define get_fs() (current_thread_info()->addr_limit)
-#define set_fs(x) (current_thread_info()->addr_limit = (x))
-
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/serial.h b/libc/kernel/arch-sh/asm/serial.h
deleted file mode 100644
index ae59411..0000000
--- a/libc/kernel/arch-sh/asm/serial.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SERIAL_H
-#define _ASM_SERIAL_H
-
-#include <linux/kernel.h>
-
-#define BASE_BAUD ( 1843200 / 16 )
-
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
-
-#define SERIAL_PORT_DFNS
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sfp-machine.h b/libc/kernel/arch-sh/asm/sfp-machine.h
deleted file mode 100644
index f5e9844..0000000
--- a/libc/kernel/arch-sh/asm/sfp-machine.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _SFP_MACHINE_H
-#define _SFP_MACHINE_H
-
-#define _FP_W_TYPE_SIZE 32
-#define _FP_W_TYPE unsigned long
-#define _FP_WS_TYPE signed long
-#define _FP_I_TYPE long
-
-#define _FP_MUL_MEAT_S(R,X,Y)   _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_D(R,X,Y)   _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_Q(R,X,Y)   _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
-
-#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
-#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
-#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
-
-#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
-#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
-#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
-#define _FP_NANSIGN_S 0
-#define _FP_NANSIGN_D 0
-#define _FP_NANSIGN_Q 0
-
-#define _FP_KEEPNANFRACP 1
-
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)   do {   if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)   && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))   {   R##_s = Y##_s;   _FP_FRAC_COPY_##wc(R,Y);   }   else   {   R##_s = X##_s;   _FP_FRAC_COPY_##wc(R,X);   }   R##_c = FP_CLS_NAN;   } while (0)
-
-#define FP_DENORM_ZERO 1 
-
-#define FP_EX_INVALID (1<<4)
-#define FP_EX_DIVZERO (1<<3)
-#define FP_EX_OVERFLOW (1<<2)
-#define FP_EX_UNDERFLOW (1<<1)
-#define FP_EX_INEXACT (1<<0)
-
-#endif
-
diff --git a/libc/kernel/arch-sh/asm/sh7760fb.h b/libc/kernel/arch-sh/asm/sh7760fb.h
deleted file mode 100644
index 1082668..0000000
--- a/libc/kernel/arch-sh/asm/sh7760fb.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_SH7760FB_H
-#define _ASM_SH_SH7760FB_H
-
-#define SH7760FB_PALETTE_MASK 0x00f8fcf8
-
-#define SH7760FB_DMA_MASK 0x0C000000
-
-#define LDPR(x) (((x) << 2))
-
-#define LDICKR 0x400
-#define LDMTR 0x402
-
-#define LDDFR 0x404
-#define LDDFR_PABD (1 << 8)
-#define LDDFR_COLOR_MASK 0x7F
-#define LDSMR 0x406
-#define LDSMR_ROT (1 << 13)
-#define LDSARU 0x408
-#define LDSARL 0x40c
-#define LDLAOR 0x410
-#define LDPALCR 0x412
-#define LDPALCR_PALS (1 << 4)
-#define LDPALCR_PALEN (1 << 0)
-#define LDHCNR 0x414
-#define LDHSYNR 0x416
-#define LDVDLNR 0x418
-#define LDVTLNR 0x41a
-#define LDVSYNR 0x41c
-#define LDACLNR 0x41e
-#define LDINTR 0x420
-#define LDPMMR 0x424
-#define LDPSPR 0x426
-#define LDCNTR 0x428
-#define LDCNTR_DON (1 << 0)
-#define LDCNTR_DON2 (1 << 4)
-
-#define LDINTR_VINTSEL (1 << 12)
-#define LDINTR_VINTE (1 << 8)
-#define LDINTR_VINTS (1 << 0)
-#define VINT_START (LDINTR_VINTSEL)
-#define VINT_CHECK (LDINTR_VINTS)
-
-#define LDMTR_FLMPOL (1 << 15)
-
-#define LDMTR_CL1POL (1 << 14)
-
-#define LDMTR_DISPEN_LOWACT (1 << 13)
-
-#define LDMTR_DPOL_LOWACT (1 << 12)
-
-#define LDMTR_MCNT (1 << 10)
-
-#define LDMTR_CL1CNT (1 << 9)
-
-#define LDMTR_CL2CNT (1 << 8)
-
-#define LDMTR_STN_MONO_4 0x00
-#define LDMTR_STN_MONO_8 0x01
-#define LDMTR_STN_COLOR_4 0x08
-#define LDMTR_STN_COLOR_8 0x09
-#define LDMTR_STN_COLOR_12 0x0A
-#define LDMTR_STN_COLOR_16 0x0B
-#define LDMTR_DSTN_MONO_8 0x11
-#define LDMTR_DSTN_MONO_16 0x13
-#define LDMTR_DSTN_COLOR_8 0x19
-#define LDMTR_DSTN_COLOR_12 0x1A
-#define LDMTR_DSTN_COLOR_16 0x1B
-#define LDMTR_TFT_COLOR_16 0x2B
-
-#define LDDFR_1BPP_MONO 0x00
-#define LDDFR_2BPP_MONO 0x01
-#define LDDFR_4BPP_MONO 0x02
-#define LDDFR_6BPP_MONO 0x04
-#define LDDFR_4BPP 0x0A
-#define LDDFR_8BPP 0x0C
-#define LDDFR_16BPP_RGB555 0x1D
-#define LDDFR_16BPP_RGB565 0x2D
-
-#define LCDC_CLKSRC_BUSCLOCK 0
-#define LCDC_CLKSRC_PERIPHERAL 1
-#define LCDC_CLKSRC_EXTERNAL 2
-
-#define LDICKR_CLKSRC(x)   (((x) & 3) << 12)
-
-#define LDICKR_CLKDIV(x)   ((x) & 0x1f)
-
-struct sh7760fb_platdata {
-
- struct fb_videomode *def_mode;
-
- u16 ldmtr;
-
- u16 lddfr;
-
- u16 ldpmmr;
- u16 ldpspr;
-
- u16 ldaclnr;
-
- u16 ldickr;
-
- int rotate;
-
- int novsync;
-
- void (*blank) (int);
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sh7763rdp.h b/libc/kernel/arch-sh/asm/sh7763rdp.h
deleted file mode 100644
index 7c1aa19..0000000
--- a/libc/kernel/arch-sh/asm/sh7763rdp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SH7763RDP_H
-#define __ASM_SH_SH7763RDP_H
-
-#include <asm/addrspace.h>
-
-#define MSTPCR1 0xFFC80038
-
-#define PORT_PSEL0 0xFFEF0070
-#define PORT_PSEL1 0xFFEF0072
-#define PORT_PSEL2 0xFFEF0074
-#define PORT_PSEL3 0xFFEF0076
-#define PORT_PSEL4 0xFFEF0078
-
-#define PORT_PACR 0xFFEF0000
-#define PORT_PCCR 0xFFEF0004
-#define PORT_PFCR 0xFFEF000A
-#define PORT_PGCR 0xFFEF000C
-#define PORT_PHCR 0xFFEF000E
-#define PORT_PICR 0xFFEF0010
-#define PORT_PJCR 0xFFEF0012
-#define PORT_PKCR 0xFFEF0014
-#define PORT_PLCR 0xFFEF0016
-#define PORT_PMCR 0xFFEF0018
-#define PORT_PNCR 0xFFEF001A
-
-#define CPLD_BOARD_ID_ERV_REG 0xB1000000
-#define CPLD_CPLD_CMD_REG 0xB1000006
-
-#define USB_USBHSC 0xFFEC80f0
-
-#define __IO_PREFIX sh7763rdp
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sh7785lcr.h b/libc/kernel/arch-sh/asm/sh7785lcr.h
deleted file mode 100644
index 0729f53..0000000
--- a/libc/kernel/arch-sh/asm/sh7785lcr.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_RENESAS_SH7785LCR_H
-#define __ASM_SH_RENESAS_SH7785LCR_H
-
-#define NOR_FLASH_ADDR 0x00000000
-#define NOR_FLASH_SIZE 0x04000000
-
-#define PLD_BASE_ADDR 0x04000000
-#define PLD_PCICR (PLD_BASE_ADDR + 0x00)
-#define PLD_LCD_BK_CONTR (PLD_BASE_ADDR + 0x02)
-#define PLD_LOCALCR (PLD_BASE_ADDR + 0x04)
-#define PLD_POFCR (PLD_BASE_ADDR + 0x06)
-#define PLD_LEDCR (PLD_BASE_ADDR + 0x08)
-#define PLD_SWSR (PLD_BASE_ADDR + 0x0a)
-#define PLD_VERSR (PLD_BASE_ADDR + 0x0c)
-#define PLD_MMSR (PLD_BASE_ADDR + 0x0e)
-
-#define SM107_MEM_ADDR 0x10000000
-#define SM107_MEM_SIZE 0x00e00000
-#define SM107_REG_ADDR 0x13e00000
-#define SM107_REG_SIZE 0x00200000
-
-#define R8A66597_ADDR 0x08000000
-#define CG200_ADDR 0x0c000000
-#define PCA9564_ADDR 0x14000000
-
-#define R8A66597_SIZE 0x00000100
-#define CG200_SIZE 0x00010000
-#define PCA9564_SIZE 0x00000100
-
-#endif
-
diff --git a/libc/kernel/arch-sh/asm/sh_bios.h b/libc/kernel/arch-sh/asm/sh_bios.h
deleted file mode 100644
index d78679a..0000000
--- a/libc/kernel/arch-sh/asm/sh_bios.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_BIOS_H
-#define __ASM_SH_BIOS_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sh_eth.h b/libc/kernel/arch-sh/asm/sh_eth.h
deleted file mode 100644
index f9fc253..0000000
--- a/libc/kernel/arch-sh/asm/sh_eth.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_ETH_H__
-#define __ASM_SH_ETH_H__
-
-enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
-
-struct sh_eth_plat_data {
- int phy;
- int edmac_endian;
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sh_keysc.h b/libc/kernel/arch-sh/asm/sh_keysc.h
deleted file mode 100644
index a14b47f..0000000
--- a/libc/kernel/arch-sh/asm/sh_keysc.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_KEYSC_H__
-#define __ASM_KEYSC_H__
-
-#define SH_KEYSC_MAXKEYS 30
-
-struct sh_keysc_info {
- enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
- int scan_timing;
- int delay;
- int keycodes[SH_KEYSC_MAXKEYS];
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sh_mobile_lcdc.h b/libc/kernel/arch-sh/asm/sh_mobile_lcdc.h
deleted file mode 100644
index 2b3e730..0000000
--- a/libc/kernel/arch-sh/asm/sh_mobile_lcdc.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_MOBILE_LCDC_H__
-#define __ASM_SH_MOBILE_LCDC_H__
-
-#include <linux/fb.h>
-
-enum { RGB8,
- RGB9,
- RGB12A,
- RGB12B,
- RGB16,
- RGB18,
- RGB24,
- SYS8A,
- SYS8B,
- SYS8C,
- SYS8D,
- SYS9,
- SYS12,
- SYS16A,
- SYS16B,
- SYS16C,
- SYS18,
- SYS24 };
-
-enum { LCDC_CHAN_DISABLED = 0,
- LCDC_CHAN_MAINLCD,
- LCDC_CHAN_SUBLCD };
-
-enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
-
-struct sh_mobile_lcdc_sys_bus_cfg {
- unsigned long ldmt2r;
- unsigned long ldmt3r;
-};
-
-struct sh_mobile_lcdc_sys_bus_ops {
- void (*write_index)(void *handle, unsigned long data);
- void (*write_data)(void *handle, unsigned long data);
- unsigned long (*read_data)(void *handle);
-};
-
-struct sh_mobile_lcdc_board_cfg {
- void *board_data;
- int (*setup_sys)(void *board_data, void *sys_ops_handle,
- struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
- void (*display_on)(void *board_data);
- void (*display_off)(void *board_data);
-};
-
-struct sh_mobile_lcdc_lcd_size_cfg {
- unsigned long width;
- unsigned long height;
-};
-
-struct sh_mobile_lcdc_chan_cfg {
- int chan;
- int bpp;
- int interface_type;
- int clock_divider;
- struct fb_videomode lcd_cfg;
- struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
- struct sh_mobile_lcdc_board_cfg board_cfg;
- struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg;
-};
-
-struct sh_mobile_lcdc_info {
- unsigned long lddckr;
- int clock_source;
- struct sh_mobile_lcdc_chan_cfg ch[2];
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/shmin.h b/libc/kernel/arch-sh/asm/shmin.h
deleted file mode 100644
index 0d61b94..0000000
--- a/libc/kernel/arch-sh/asm/shmin.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SHMIN_H
-#define __ASM_SH_SHMIN_H
-
-#define SHMIN_IO_BASE 0xb0000000UL
-
-#define SHMIN_NE_IRQ IRQ2_IRQ
-#define SHMIN_NE_BASE 0x300
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/shmparam.h b/libc/kernel/arch-sh/asm/shmparam.h
deleted file mode 100644
index a51628e..0000000
--- a/libc/kernel/arch-sh/asm/shmparam.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SHMPARAM_H
-#define __ASM_SH_SHMPARAM_H
-
-#define SHMLBA 0x4000  
-
-#define __ARCH_FORCE_SHMLBA
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sigcontext.h b/libc/kernel/arch-sh/asm/sigcontext.h
deleted file mode 100644
index 3cf7cad..0000000
--- a/libc/kernel/arch-sh/asm/sigcontext.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SIGCONTEXT_H
-#define __ASM_SH_SIGCONTEXT_H
-
-struct sigcontext {
- unsigned long oldmask;
-
-#ifdef __SH5__
-
- unsigned long long sc_regs[63];
- unsigned long long sc_tregs[8];
- unsigned long long sc_pc;
- unsigned long long sc_sr;
-
- unsigned long long sc_fpregs[32];
- unsigned int sc_fpscr;
- unsigned int sc_fpvalid;
-#else
-
- unsigned long sc_regs[16];
- unsigned long sc_pc;
- unsigned long sc_pr;
- unsigned long sc_sr;
- unsigned long sc_gbr;
- unsigned long sc_mach;
- unsigned long sc_macl;
-
- unsigned long sc_fpregs[16];
- unsigned long sc_xfpregs[16];
- unsigned int sc_fpscr;
- unsigned int sc_fpul;
- unsigned int sc_ownedfp;
-#endif
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/siginfo.h b/libc/kernel/arch-sh/asm/siginfo.h
deleted file mode 100644
index 864960e..0000000
--- a/libc/kernel/arch-sh/asm/siginfo.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SIGINFO_H
-#define __ASM_SH_SIGINFO_H
-
-#include <asm-generic/siginfo.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/signal.h b/libc/kernel/arch-sh/asm/signal.h
deleted file mode 100644
index 5edf0d2..0000000
--- a/libc/kernel/arch-sh/asm/signal.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SIGNAL_H
-#define __ASM_SH_SIGNAL_H
-
-#include <linux/types.h>
-
-struct pt_regs;
-struct siginfo;
-
-#define NSIG 32
-typedef unsigned long sigset_t;
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGTRAP 5
-#define SIGABRT 6
-#define SIGIOT 6
-#define SIGBUS 7
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGUSR1 10
-#define SIGSEGV 11
-#define SIGUSR2 12
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGSTKFLT 16
-#define SIGCHLD 17
-#define SIGCONT 18
-#define SIGSTOP 19
-#define SIGTSTP 20
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGURG 23
-#define SIGXCPU 24
-#define SIGXFSZ 25
-#define SIGVTALRM 26
-#define SIGPROF 27
-#define SIGWINCH 28
-#define SIGIO 29
-#define SIGPOLL SIGIO
-
-#define SIGPWR 30
-#define SIGSYS 31
-#define SIGUNUSED 31
-
-#define SIGRTMIN 32
-#define SIGRTMAX _NSIG
-
-#define SA_NOCLDSTOP 0x00000001
-#define SA_NOCLDWAIT 0x00000002
-#define SA_SIGINFO 0x00000004
-#define SA_ONSTACK 0x08000000
-#define SA_RESTART 0x10000000
-#define SA_NODEFER 0x40000000
-#define SA_RESETHAND 0x80000000
-
-#define SA_NOMASK SA_NODEFER
-#define SA_ONESHOT SA_RESETHAND
-
-#define SA_RESTORER 0x04000000
-
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
-#define MINSIGSTKSZ 2048
-#define SIGSTKSZ 8192
-
-#include <asm-generic/signal.h>
-
-struct sigaction {
- union {
- __sighandler_t _sa_handler;
- void (*_sa_sigaction)(int, struct siginfo *, void *);
- } _u;
- sigset_t sa_mask;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
-};
-
-#define sa_handler _u._sa_handler
-#define sa_sigaction _u._sa_sigaction
-
-typedef struct sigaltstack {
- void *ss_sp;
- int ss_flags;
- size_t ss_size;
-} stack_t;
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/smc37c93x.h b/libc/kernel/arch-sh/asm/smc37c93x.h
deleted file mode 100644
index 7d2f393..0000000
--- a/libc/kernel/arch-sh/asm/smc37c93x.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SMC37C93X_H
-#define __ASM_SH_SMC37C93X_H
-
-#define FDC_PRIMARY_BASE 0x3f0
-#define IDE1_PRIMARY_BASE 0x1f0
-#define IDE1_SECONDARY_BASE 0x170
-#define PARPORT_PRIMARY_BASE 0x378
-#define COM1_PRIMARY_BASE 0x2f8
-#define COM2_PRIMARY_BASE 0x3f8
-#define RTC_PRIMARY_BASE 0x070
-#define KBC_PRIMARY_BASE 0x060
-#define AUXIO_PRIMARY_BASE 0x000  
-
-#define LDN_FDC 0
-#define LDN_IDE1 1
-#define LDN_IDE2 2
-#define LDN_PARPORT 3
-#define LDN_COM1 4
-#define LDN_COM2 5
-#define LDN_RTC 6
-#define LDN_KBC 7
-#define LDN_AUXIO 8
-
-#define CONFIG_PORT 0x3f0
-#define INDEX_PORT CONFIG_PORT
-#define DATA_PORT 0x3f1
-#define CONFIG_ENTER 0x55
-#define CONFIG_EXIT 0xaa
-
-#define CURRENT_LDN_INDEX 0x07
-#define POWER_CONTROL_INDEX 0x22
-#define ACTIVATE_INDEX 0x30
-#define IO_BASE_HI_INDEX 0x60
-#define IO_BASE_LO_INDEX 0x61
-#define IRQ_SELECT_INDEX 0x70
-#define DMA_SELECT_INDEX 0x74
-
-#define GPIO46_INDEX 0xc6
-#define GPIO47_INDEX 0xc7
-
-#define UART_RBR 0x0  
-#define UART_THR 0x0  
-#define UART_IER 0x2  
-#define UART_IIR 0x4  
-#define UART_FCR 0x4  
-#define UART_LCR 0x6  
-#define UART_MCR 0x8  
-#define UART_LSR 0xa  
-#define UART_MSR 0xc  
-#define UART_SCR 0xe  
-#define UART_DLL 0x0  
-#define UART_DLM 0x2  
-
-#ifndef __ASSEMBLY__
-typedef struct uart_reg {
- volatile __u16 rbr;
- volatile __u16 ier;
- volatile __u16 iir;
- volatile __u16 lcr;
- volatile __u16 mcr;
- volatile __u16 lsr;
- volatile __u16 msr;
- volatile __u16 scr;
-} uart_reg;
-#endif
-
-#define thr rbr
-#define tcr iir
-
-#define dll rbr
-#define dlm ier
-#define fcr iir
-
-#define IER_ERDAI 0x0100  
-#define IER_ETHREI 0x0200  
-#define IER_ELSI 0x0400  
-#define IER_EMSI 0x0800  
-
-#define IIR_IP 0x0100  
-#define IIR_IIB0 0x0200  
-#define IIR_IIB1 0x0400  
-#define IIR_IIB2 0x0800  
-#define IIR_FIFO 0xc000  
-
-#define FCR_FEN 0x0100  
-#define FCR_RFRES 0x0200  
-#define FCR_TFRES 0x0400  
-#define FCR_DMA 0x0800  
-#define FCR_RTL 0x4000  
-#define FCR_RTM 0x8000  
-
-#define LCR_WLS0 0x0100  
-#define LCR_WLS1 0x0200  
-#define LCR_STB 0x0400  
-#define LCR_PEN 0x0800  
-#define LCR_EPS 0x1000  
-#define LCR_SP 0x2000  
-#define LCR_SB 0x4000  
-#define LCR_DLAB 0x8000  
-
-#define MCR_DTR 0x0100  
-#define MCR_RTS 0x0200  
-#define MCR_OUT1 0x0400  
-#define MCR_IRQEN 0x0800  
-#define MCR_LOOP 0x1000  
-
-#define LSR_DR 0x0100  
-#define LSR_OE 0x0200  
-#define LSR_PE 0x0400  
-#define LSR_FE 0x0800  
-#define LSR_BI 0x1000  
-#define LSR_THRE 0x2000  
-#define LSR_TEMT 0x4000  
-#define LSR_FIFOE 0x8000  
-
-#define MSR_DCTS 0x0100  
-#define MSR_DDSR 0x0200  
-#define MSR_TERI 0x0400  
-#define MSR_DDCD 0x0800  
-#define MSR_CTS 0x1000  
-#define MSR_DSR 0x2000  
-#define MSR_RI 0x4000  
-#define MSR_DCD 0x8000  
-
-#define UART_CLK (1843200)  
-#define UART_BAUD(x) (UART_CLK / (16 * (x)))
-
-#define RTC_SECONDS 0
-#define RTC_SECONDS_ALARM 1
-#define RTC_MINUTES 2
-#define RTC_MINUTES_ALARM 3
-#define RTC_HOURS 4
-#define RTC_HOURS_ALARM 5
-#define RTC_DAY_OF_WEEK 6
-#define RTC_DAY_OF_MONTH 7
-#define RTC_MONTH 8
-#define RTC_YEAR 9
-#define RTC_FREQ_SELECT 10
-#define RTC_UIP 0x80
-#define RTC_DIV_CTL 0x70
-
-#define RTC_OSC_ENABLE 0x20
-#define RTC_OSC_DISABLE 0x00
-#define RTC_CONTROL 11
-#define RTC_SET 0x80
-#define RTC_PIE 0x40
-#define RTC_AIE 0x20
-#define RTC_UIE 0x10
-#define RTC_SQWE 0x08
-#define RTC_DM_BINARY 0x04
-#define RTC_24H 0x02
-#define RTC_DST_EN 0x01
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/snapgear.h b/libc/kernel/arch-sh/asm/snapgear.h
deleted file mode 100644
index e0e72e2..0000000
--- a/libc/kernel/arch-sh/asm/snapgear.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_IO_SNAPGEAR_H
-#define _ASM_SH_IO_SNAPGEAR_H
-
-#define IRL0_IRQ 2
-#define IRL0_PRIORITY 13
-
-#define IRL1_IRQ 5
-#define IRL1_PRIORITY 10
-
-#define IRL2_IRQ 8
-#define IRL2_PRIORITY 7
-
-#define IRL3_IRQ 11
-#define IRL3_PRIORITY 4
-
-#define __IO_PREFIX snapgear
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/socket.h b/libc/kernel/arch-sh/asm/socket.h
deleted file mode 100644
index ad1031d..0000000
--- a/libc/kernel/arch-sh/asm/socket.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SOCKET_H
-#define __ASM_SH_SOCKET_H
-
-#include <asm/sockios.h>
-
-#define SOL_SOCKET 1
-
-#define SO_DEBUG 1
-#define SO_REUSEADDR 2
-#define SO_TYPE 3
-#define SO_ERROR 4
-#define SO_DONTROUTE 5
-#define SO_BROADCAST 6
-#define SO_SNDBUF 7
-#define SO_RCVBUF 8
-#define SO_RCVBUFFORCE 32
-#define SO_SNDBUFFORCE 33
-#define SO_KEEPALIVE 9
-#define SO_OOBINLINE 10
-#define SO_NO_CHECK 11
-#define SO_PRIORITY 12
-#define SO_LINGER 13
-#define SO_BSDCOMPAT 14
-
-#define SO_PASSCRED 16
-#define SO_PEERCRED 17
-#define SO_RCVLOWAT 18
-#define SO_SNDLOWAT 19
-#define SO_RCVTIMEO 20
-#define SO_SNDTIMEO 21
-
-#define SO_SECURITY_AUTHENTICATION 22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-#define SO_SECURITY_ENCRYPTION_NETWORK 24
-
-#define SO_BINDTODEVICE 25
-
-#define SO_ATTACH_FILTER 26
-#define SO_DETACH_FILTER 27
-
-#define SO_PEERNAME 28
-#define SO_TIMESTAMP 29
-#define SCM_TIMESTAMP SO_TIMESTAMP
-
-#define SO_ACCEPTCONN 30
-
-#define SO_PEERSEC 31
-#define SO_PASSSEC 34
-#define SO_TIMESTAMPNS 35
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-
-#define SO_MARK 36
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/sockios.h b/libc/kernel/arch-sh/asm/sockios.h
deleted file mode 100644
index fd88099..0000000
--- a/libc/kernel/arch-sh/asm/sockios.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SOCKIOS_H
-#define __ASM_SH_SOCKIOS_H
-
-#define FIOGETOWN _IOR('f', 123, int)
-#define FIOSETOWN _IOW('f', 124, int)
-
-#define SIOCATMARK _IOR('s', 7, int)
-#define SIOCSPGRP _IOW('s', 8, pid_t)
-#define SIOCGPGRP _IOR('s', 9, pid_t)
-
-#define SIOCGSTAMP _IOR('s', 100, struct timeval)  
-#define SIOCGSTAMPNS _IOR('s', 101, struct timespec)  
-#endif
diff --git a/libc/kernel/arch-sh/asm/sparsemem.h b/libc/kernel/arch-sh/asm/sparsemem.h
deleted file mode 100644
index b316514..0000000
--- a/libc/kernel/arch-sh/asm/sparsemem.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SPARSEMEM_H
-#define __ASM_SH_SPARSEMEM_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/spi.h b/libc/kernel/arch-sh/asm/spi.h
deleted file mode 100644
index e8899b2..0000000
--- a/libc/kernel/arch-sh/asm/spi.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SPI_H__
-#define __ASM_SPI_H__
-
-struct sh_spi_info;
-
-struct sh_spi_info {
- int bus_num;
- int num_chipselect;
-
- void (*chip_select)(struct sh_spi_info *spi, int cs, int state);
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/spinlock.h b/libc/kernel/arch-sh/asm/spinlock.h
deleted file mode 100644
index 2eeb198..0000000
--- a/libc/kernel/arch-sh/asm/spinlock.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SPINLOCK_H
-#define __ASM_SH_SPINLOCK_H
-
-#define __raw_spin_is_locked(x) ((x)->lock <= 0)
-#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
-#define __raw_spin_unlock_wait(x)   do { cpu_relax(); } while ((x)->lock)
-
-#define __raw_read_can_lock(x) ((x)->lock > 0)
-#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
-#define _raw_spin_relax(lock) cpu_relax()
-#define _raw_read_relax(lock) cpu_relax()
-#define _raw_write_relax(lock) cpu_relax()
-#endif
diff --git a/libc/kernel/arch-sh/asm/spinlock_types.h b/libc/kernel/arch-sh/asm/spinlock_types.h
deleted file mode 100644
index e21fc1e..0000000
--- a/libc/kernel/arch-sh/asm/spinlock_types.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SPINLOCK_TYPES_H
-#define __ASM_SH_SPINLOCK_TYPES_H
-
-#ifndef __LINUX_SPINLOCK_TYPES_H
-#error "please don't include this file directly"
-#endif
-
-typedef struct {
- volatile unsigned int lock;
-} raw_spinlock_t;
-
-#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
-
-typedef struct {
- volatile unsigned int lock;
-} raw_rwlock_t;
-
-#define RW_LOCK_BIAS 0x01000000
-#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/stat.h b/libc/kernel/arch-sh/asm/stat.h
deleted file mode 100644
index 1360798..0000000
--- a/libc/kernel/arch-sh/asm/stat.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_STAT_H
-#define __ASM_SH_STAT_H
-
-struct __old_kernel_stat {
- unsigned short st_dev;
- unsigned short st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned short st_rdev;
- unsigned long st_size;
- unsigned long st_atime;
- unsigned long st_mtime;
- unsigned long st_ctime;
-};
-
-#ifdef __SH5__
-struct stat {
- unsigned short st_dev;
- unsigned short __pad1;
- unsigned long st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned short st_rdev;
- unsigned short __pad2;
- unsigned long st_size;
- unsigned long st_blksize;
- unsigned long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-struct stat64 {
- unsigned short st_dev;
- unsigned char __pad0[10];
-
- unsigned long st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
-
- unsigned long st_uid;
- unsigned long st_gid;
-
- unsigned short st_rdev;
- unsigned char __pad3[10];
-
- long long st_size;
- unsigned long st_blksize;
-
- unsigned long st_blocks;
- unsigned long __pad4;
-
- unsigned long st_atime;
- unsigned long st_atime_nsec;
-
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
-
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
-
- unsigned long __unused1;
- unsigned long __unused2;
-};
-#else
-struct stat {
- unsigned long st_dev;
- unsigned long st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned long st_rdev;
- unsigned long st_size;
- unsigned long st_blksize;
- unsigned long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-struct stat64 {
- unsigned long long st_dev;
- unsigned char __pad0[4];
-
-#define STAT64_HAS_BROKEN_ST_INO 1
- unsigned long __st_ino;
-
- unsigned int st_mode;
- unsigned int st_nlink;
-
- unsigned long st_uid;
- unsigned long st_gid;
-
- unsigned long long st_rdev;
- unsigned char __pad3[4];
-
- long long st_size;
- unsigned long st_blksize;
-
- unsigned long long st_blocks;
-
- unsigned long st_atime;
- unsigned long st_atime_nsec;
-
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
-
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
-
- unsigned long long st_ino;
-};
-
-#define STAT_HAVE_NSEC 1
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/statfs.h b/libc/kernel/arch-sh/asm/statfs.h
deleted file mode 100644
index 32a335b..0000000
--- a/libc/kernel/arch-sh/asm/statfs.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_STATFS_H
-#define __ASM_SH_STATFS_H
-
-#include <asm-generic/statfs.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/string.h b/libc/kernel/arch-sh/asm/string.h
deleted file mode 100644
index ba7b12b..0000000
--- a/libc/kernel/arch-sh/asm/string.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include "string_32.h"
diff --git a/libc/kernel/arch-sh/asm/string_32.h b/libc/kernel/arch-sh/asm/string_32.h
deleted file mode 100644
index 70f2939..0000000
--- a/libc/kernel/arch-sh/asm/string_32.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_STRING_H
-#define __ASM_SH_STRING_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/string_64.h b/libc/kernel/arch-sh/asm/string_64.h
deleted file mode 100644
index a7f5128..0000000
--- a/libc/kernel/arch-sh/asm/string_64.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_STRING_64_H
-#define __ASM_SH_STRING_64_H
-
-#define __HAVE_ARCH_MEMCPY
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/system.h b/libc/kernel/arch-sh/asm/system.h
deleted file mode 100644
index 8b1981e..0000000
--- a/libc/kernel/arch-sh/asm/system.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SYSTEM_H
-#define __ASM_SH_SYSTEM_H
-
-#include <linux/irqflags.h>
-#include <linux/compiler.h>
-#include <linux/linkage.h>
-#include <asm/types.h>
-#include <asm/ptrace.h>
-
-#define AT_VECTOR_SIZE_ARCH 5  
-
-#define __icbi()  {   unsigned long __addr;   __addr = 0xa8000000;   __asm__ __volatile__(   "icbi   %0\n\t"   :     : "m" (__m(__addr)));  }
-
-#define mb() __asm__ __volatile__ ("synco": : :"memory")
-#define rmb() mb()
-#define wmb() __asm__ __volatile__ ("synco": : :"memory")
-#define ctrl_barrier() __icbi()
-#define read_barrier_depends() do { } while(0)
-
-#define smp_mb() barrier()
-#define smp_rmb() barrier()
-#define smp_wmb() barrier()
-#define smp_read_barrier_depends() do { } while(0)
-
-#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
-
-#include <asm/cmpxchg-irq.h>
-
-#define __xchg(ptr, x, size)  ({   unsigned long __xchg__res;   volatile void *__xchg_ptr = (ptr);   switch (size) {   case 4:   __xchg__res = xchg_u32(__xchg_ptr, x);   break;   case 1:   __xchg__res = xchg_u8(__xchg_ptr, x);   break;   default:   __xchg_called_with_bad_pointer();   __xchg__res = x;   break;   }     __xchg__res;  })
-
-#define xchg(ptr,x)   ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
-
-#define __HAVE_ARCH_CMPXCHG 1
-
-#define cmpxchg(ptr,o,n)   ({   __typeof__(*(ptr)) _o_ = (o);   __typeof__(*(ptr)) _n_ = (n);   (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,   (unsigned long)_n_, sizeof(*(ptr)));   })
-
-#define instruction_size(insn) (2)
-
-#define BUILD_TRAP_HANDLER(name)  asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5,   unsigned long r6, unsigned long r7,   struct pt_regs __regs)
-
-#define TRAP_HANDLER_DECL   struct pt_regs *regs = RELOC_HIDE(&__regs, 0);   unsigned int vec = regs->tra;   (void)vec;
-
-#define arch_align_stack(x) (x)
-
-struct mem_access {
- unsigned long (*from)(void *dst, const void *src, unsigned long cnt);
- unsigned long (*to)(void *dst, const void *src, unsigned long cnt);
-};
-
-#include "system_32.h"
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/system_32.h b/libc/kernel/arch-sh/asm/system_32.h
deleted file mode 100644
index 5151677..0000000
--- a/libc/kernel/arch-sh/asm/system_32.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SYSTEM_32_H
-#define __ASM_SH_SYSTEM_32_H
-
-#include <linux/types.h>
-
-struct task_struct *__switch_to(struct task_struct *prev,
- struct task_struct *next);
-
-#define switch_to(prev, next, last)  do {   register u32 *__ts1 __asm__ ("r1") = (u32 *)&prev->thread.sp;   register u32 *__ts2 __asm__ ("r2") = (u32 *)&prev->thread.pc;   register u32 *__ts4 __asm__ ("r4") = (u32 *)prev;   register u32 *__ts5 __asm__ ("r5") = (u32 *)next;   register u32 *__ts6 __asm__ ("r6") = (u32 *)&next->thread.sp;   register u32 __ts7 __asm__ ("r7") = next->thread.pc;   struct task_struct *__last;     __asm__ __volatile__ (   ".balign 4\n\t"   "stc.l	gbr, @-r15\n\t"   "sts.l	pr, @-r15\n\t"   "mov.l	r8, @-r15\n\t"   "mov.l	r9, @-r15\n\t"   "mov.l	r10, @-r15\n\t"   "mov.l	r11, @-r15\n\t"   "mov.l	r12, @-r15\n\t"   "mov.l	r13, @-r15\n\t"   "mov.l	r14, @-r15\n\t"   "mov.l	r15, @r1\t! save SP\n\t"   "mov.l	@r6, r15\t! change to new stack\n\t"   "mova	1f, %0\n\t"   "mov.l	%0, @r2\t! save PC\n\t"   "mov.l	2f, %0\n\t"   "jmp	@%0\t! call __switch_to\n\t"   " lds	r7, pr\t!  with return to new PC\n\t"   ".balign	4\n"   "2:\n\t"   ".long	__switch_to\n"   "1:\n\t"   "mov.l	@r15+, r14\n\t"   "mov.l	@r15+, r13\n\t"   "mov.l	@r15+, r12\n\t"   "mov.l	@r15+, r11\n\t"   "mov.l	@r15+, r10\n\t"   "mov.l	@r15+, r9\n\t"   "mov.l	@r15+, r8\n\t"   "lds.l	@r15+, pr\n\t"   "ldc.l	@r15+, gbr\n\t"   : "=z" (__last)   : "r" (__ts1), "r" (__ts2), "r" (__ts4),   "r" (__ts5), "r" (__ts6), "r" (__ts7)   : "r3", "t");     last = __last;  } while (0)
-
-#define __uses_jump_to_uncached __attribute__ ((__section__ (".uncached.text")))
-
-#define jump_to_uncached()  do {   unsigned long __dummy;     __asm__ __volatile__(   "mova	1f, %0\n\t"   "add	%1, %0\n\t"   "jmp	@%0\n\t"   " nop\n\t"   ".balign 4\n"   "1:"   : "=&z" (__dummy)   : "r" (cached_to_uncached));  } while (0)
-
-#define back_to_cached()  do {   unsigned long __dummy;   ctrl_barrier();   __asm__ __volatile__(   "mov.l	1f, %0\n\t"   "jmp	@%0\n\t"   " nop\n\t"   ".balign 4\n"   "1:	.long 2f\n"   "2:"   : "=&r" (__dummy));  } while (0)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/system_64.h b/libc/kernel/arch-sh/asm/system_64.h
deleted file mode 100644
index 1bc4710..0000000
--- a/libc/kernel/arch-sh/asm/system_64.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SYSTEM_64_H
-#define __ASM_SH_SYSTEM_64_H
-
-#include <asm/processor.h>
-
-struct task_struct *sh64_switch_to(struct task_struct *prev,
- struct thread_struct *prev_thread,
- struct task_struct *next,
- struct thread_struct *next_thread);
-
-#define switch_to(prev,next,last)  do {   if (last_task_used_math != next) {   struct pt_regs *regs = next->thread.uregs;   if (regs) regs->sr |= SR_FD;   }   last = sh64_switch_to(prev, &prev->thread, next,   &next->thread);  } while (0)
-
-#define __uses_jump_to_uncached
-
-#define jump_to_uncached() do { } while (0)
-#define back_to_cached() do { } while (0)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/systemh7751.h b/libc/kernel/arch-sh/asm/systemh7751.h
deleted file mode 100644
index b2dfc35..0000000
--- a/libc/kernel/arch-sh/asm/systemh7751.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_SYSTEMH_7751SYSTEMH_H
-#define __ASM_SH_SYSTEMH_7751SYSTEMH_H
-
-#define PA_ROM 0x00000000  
-#define PA_ROM_SIZE 0x00400000  
-#define PA_FROM 0x01000000  
-#define PA_FROM_SIZE 0x00400000  
-#define PA_EXT1 0x04000000
-#define PA_EXT1_SIZE 0x04000000
-#define PA_EXT2 0x08000000
-#define PA_EXT2_SIZE 0x04000000
-#define PA_SDRAM 0x0c000000
-#define PA_SDRAM_SIZE 0x04000000
-
-#define PA_EXT4 0x12000000
-#define PA_EXT4_SIZE 0x02000000
-#define PA_EXT5 0x14000000
-#define PA_EXT5_SIZE 0x04000000
-#define PA_PCIC 0x18000000  
-
-#define PA_DIPSW0 0xb9000000  
-#define PA_DIPSW1 0xb9000002  
-#define PA_LED 0xba000000  
-#define PA_BCR 0xbb000000  
-
-#define PA_MRSHPC 0xb83fffe0  
-#define PA_MRSHPC_MW1 0xb8400000  
-#define PA_MRSHPC_MW2 0xb8500000  
-#define PA_MRSHPC_IO 0xb8600000  
-#define MRSHPC_MODE (PA_MRSHPC + 4)
-#define MRSHPC_OPTION (PA_MRSHPC + 6)
-#define MRSHPC_CSR (PA_MRSHPC + 8)
-#define MRSHPC_ISR (PA_MRSHPC + 10)
-#define MRSHPC_ICR (PA_MRSHPC + 12)
-#define MRSHPC_CPWCR (PA_MRSHPC + 14)
-#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
-#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
-#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
-#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
-#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
-#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
-#define MRSHPC_CDCR (PA_MRSHPC + 28)
-#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
-
-#define BCR_ILCRA (PA_BCR + 0)
-#define BCR_ILCRB (PA_BCR + 2)
-#define BCR_ILCRC (PA_BCR + 4)
-#define BCR_ILCRD (PA_BCR + 6)
-#define BCR_ILCRE (PA_BCR + 8)
-#define BCR_ILCRF (PA_BCR + 10)
-#define BCR_ILCRG (PA_BCR + 12)
-
-#define IRQ_79C973 13
-
-#define __IO_PREFIX sh7751systemh
-#include <asm/io_generic.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/termbits.h b/libc/kernel/arch-sh/asm/termbits.h
deleted file mode 100644
index 97b26db..0000000
--- a/libc/kernel/arch-sh/asm/termbits.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TERMBITS_H
-#define __ASM_SH_TERMBITS_H
-
-#include <linux/posix_types.h>
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-#define NCCS 19
-struct termios {
- tcflag_t c_iflag;
- tcflag_t c_oflag;
- tcflag_t c_cflag;
- tcflag_t c_lflag;
- cc_t c_line;
- cc_t c_cc[NCCS];
-};
-
-struct termios2 {
- tcflag_t c_iflag;
- tcflag_t c_oflag;
- tcflag_t c_cflag;
- tcflag_t c_lflag;
- cc_t c_line;
- cc_t c_cc[NCCS];
- speed_t c_ispeed;
- speed_t c_ospeed;
-};
-
-struct ktermios {
- tcflag_t c_iflag;
- tcflag_t c_oflag;
- tcflag_t c_cflag;
- tcflag_t c_lflag;
- cc_t c_line;
- cc_t c_cc[NCCS];
- speed_t c_ispeed;
- speed_t c_ospeed;
-};
-
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VEOF 4
-#define VTIME 5
-#define VMIN 6
-#define VSWTC 7
-#define VSTART 8
-#define VSTOP 9
-#define VSUSP 10
-#define VEOL 11
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE 14
-#define VLNEXT 15
-#define VEOL2 16
-
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK 0000020
-#define ISTRIP 0000040
-#define INLCR 0000100
-#define IGNCR 0000200
-#define ICRNL 0000400
-#define IUCLC 0001000
-#define IXON 0002000
-#define IXANY 0004000
-#define IXOFF 0010000
-#define IMAXBEL 0020000
-#define IUTF8 0040000
-
-#define OPOST 0000001
-#define OLCUC 0000002
-#define ONLCR 0000004
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-#define OFILL 0000100
-#define OFDEL 0000200
-#define NLDLY 0000400
-#define NL0 0000000
-#define NL1 0000400
-#define CRDLY 0003000
-#define CR0 0000000
-#define CR1 0001000
-#define CR2 0002000
-#define CR3 0003000
-#define TABDLY 0014000
-#define TAB0 0000000
-#define TAB1 0004000
-#define TAB2 0010000
-#define TAB3 0014000
-#define XTABS 0014000
-#define BSDLY 0020000
-#define BS0 0000000
-#define BS1 0020000
-#define VTDLY 0040000
-#define VT0 0000000
-#define VT1 0040000
-#define FFDLY 0100000
-#define FF0 0000000
-#define FF1 0100000
-
-#define CBAUD 0010017
-#define B0 0000000  
-#define B50 0000001
-#define B75 0000002
-#define B110 0000003
-#define B134 0000004
-#define B150 0000005
-#define B200 0000006
-#define B300 0000007
-#define B600 0000010
-#define B1200 0000011
-#define B1800 0000012
-#define B2400 0000013
-#define B4800 0000014
-#define B9600 0000015
-#define B19200 0000016
-#define B38400 0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CSIZE 0000060
-#define CS5 0000000
-#define CS6 0000020
-#define CS7 0000040
-#define CS8 0000060
-#define CSTOPB 0000100
-#define CREAD 0000200
-#define PARENB 0000400
-#define PARODD 0001000
-#define HUPCL 0002000
-#define CLOCAL 0004000
-#define CBAUDEX 0010000
-#define BOTHER 0010000
-#define B57600 0010001
-#define B115200 0010002
-#define B230400 0010003
-#define B460800 0010004
-#define B500000 0010005
-#define B576000 0010006
-#define B921600 0010007
-#define B1000000 0010010
-#define B1152000 0010011
-#define B1500000 0010012
-#define B2000000 0010013
-#define B2500000 0010014
-#define B3000000 0010015
-#define B3500000 0010016
-#define B4000000 0010017
-#define CIBAUD 002003600000  
-#define CMSPAR 010000000000  
-#define CRTSCTS 020000000000  
-
-#define IBSHIFT 16  
-
-#define ISIG 0000001
-#define ICANON 0000002
-#define XCASE 0000004
-#define ECHO 0000010
-#define ECHOE 0000020
-#define ECHOK 0000040
-#define ECHONL 0000100
-#define NOFLSH 0000200
-#define TOSTOP 0000400
-#define ECHOCTL 0001000
-#define ECHOPRT 0002000
-#define ECHOKE 0004000
-#define FLUSHO 0010000
-#define PENDIN 0040000
-#define IEXTEN 0100000
-
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/termios.h b/libc/kernel/arch-sh/asm/termios.h
deleted file mode 100644
index fb31cbe..0000000
--- a/libc/kernel/arch-sh/asm/termios.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TERMIOS_H
-#define __ASM_SH_TERMIOS_H
-
-#include <asm/termbits.h>
-#include <asm/ioctls.h>
-
-struct winsize {
- unsigned short ws_row;
- unsigned short ws_col;
- unsigned short ws_xpixel;
- unsigned short ws_ypixel;
-};
-
-#define NCC 8
-struct termio {
- unsigned short c_iflag;
- unsigned short c_oflag;
- unsigned short c_cflag;
- unsigned short c_lflag;
- unsigned char c_line;
- unsigned char c_cc[NCC];
-};
-
-#define TIOCM_LE 0x001
-#define TIOCM_DTR 0x002
-#define TIOCM_RTS 0x004
-#define TIOCM_ST 0x008
-#define TIOCM_SR 0x010
-#define TIOCM_CTS 0x020
-#define TIOCM_CAR 0x040
-#define TIOCM_RNG 0x080
-#define TIOCM_DSR 0x100
-#define TIOCM_CD TIOCM_CAR
-#define TIOCM_RI TIOCM_RNG
-#define TIOCM_OUT1 0x2000
-#define TIOCM_OUT2 0x4000
-#define TIOCM_LOOP 0x8000
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/timer.h b/libc/kernel/arch-sh/asm/timer.h
deleted file mode 100644
index ff298f3..0000000
--- a/libc/kernel/arch-sh/asm/timer.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TIMER_H
-#define __ASM_SH_TIMER_H
-
-#include <linux/sysdev.h>
-#include <linux/clocksource.h>
-#include <cpu/timer.h>
-
-struct sys_timer_ops {
- int (*init)(void);
- int (*start)(void);
- int (*stop)(void);
- cycle_t (*read)(void);
-};
-
-struct sys_timer {
- const char *name;
-
- struct sys_device dev;
- struct sys_timer_ops *ops;
-};
-
-#define TICK_SIZE (tick_nsec / 1000)
-
-struct sys_timer *get_sys_timer(void);
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/timex.h b/libc/kernel/arch-sh/asm/timex.h
deleted file mode 100644
index 9003c78..0000000
--- a/libc/kernel/arch-sh/asm/timex.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TIMEX_H
-#define __ASM_SH_TIMEX_H
-
-#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4)  
-
-typedef unsigned long long cycles_t;
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/titan.h b/libc/kernel/arch-sh/asm/titan.h
deleted file mode 100644
index 71d2e8e..0000000
--- a/libc/kernel/arch-sh/asm/titan.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_TITAN_H
-#define _ASM_SH_TITAN_H
-
-#define __IO_PREFIX titan
-#include <asm/io_generic.h>
-
-#define TITAN_IRQ_WAN 2  
-#define TITAN_IRQ_LAN 5  
-#define TITAN_IRQ_MPCIA 8  
-#define TITAN_IRQ_MPCIB 11  
-#define TITAN_IRQ_USB 11  
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/tlb.h b/libc/kernel/arch-sh/asm/tlb.h
deleted file mode 100644
index 602250b..0000000
--- a/libc/kernel/arch-sh/asm/tlb.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TLB_H
-#define __ASM_SH_TLB_H
-
-#ifndef __ASSEMBLY__
-
-#define tlb_start_vma(tlb, vma)   flush_cache_range(vma, vma->vm_start, vma->vm_end)
-
-#define tlb_end_vma(tlb, vma)   flush_tlb_range(vma, vma->vm_start, vma->vm_end)
-
-#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
-
-#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
-
-#include <linux/pagemap.h>
-#include <asm-generic/tlb.h>
-
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/tlb_64.h b/libc/kernel/arch-sh/asm/tlb_64.h
deleted file mode 100644
index 77c54eb..0000000
--- a/libc/kernel/arch-sh/asm/tlb_64.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TLB_64_H
-#define __ASM_SH_TLB_64_H
-
-#define ITLB_FIXED 0x00000000  
-#define ITLB_LAST_VAR_UNRESTRICTED 0x000003F0  
-
-#define DTLB_FIXED 0x00800000  
-#define DTLB_LAST_VAR_UNRESTRICTED 0x008003F0  
-
-#ifndef __ASSEMBLY__
-
-#define for_each_dtlb_entry(tlb)   for (tlb = cpu_data->dtlb.first;   tlb <= cpu_data->dtlb.last;   tlb += cpu_data->dtlb.step)
-
-#define for_each_itlb_entry(tlb)   for (tlb = cpu_data->itlb.first;   tlb <= cpu_data->itlb.last;   tlb += cpu_data->itlb.step)
-
-#endif
-#endif
diff --git a/libc/kernel/arch-sh/asm/tlbflush.h b/libc/kernel/arch-sh/asm/tlbflush.h
deleted file mode 100644
index 7d61293..0000000
--- a/libc/kernel/arch-sh/asm/tlbflush.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TLBFLUSH_H
-#define __ASM_SH_TLBFLUSH_H
-
-#define flush_tlb_all() local_flush_tlb_all()
-#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
-#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
-#define flush_tlb_one(asid, page) local_flush_tlb_one(asid, page)
-
-#define flush_tlb_range(vma, start, end)   local_flush_tlb_range(vma, start, end)
-
-#define flush_tlb_kernel_range(start, end)   local_flush_tlb_kernel_range(start, end)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/topology.h b/libc/kernel/arch-sh/asm/topology.h
deleted file mode 100644
index 1b5461b..0000000
--- a/libc/kernel/arch-sh/asm/topology.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_TOPOLOGY_H
-#define _ASM_SH_TOPOLOGY_H
-
-#include <asm-generic/topology.h>
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/types.h b/libc/kernel/arch-sh/asm/types.h
deleted file mode 100644
index 1febd0d..0000000
--- a/libc/kernel/arch-sh/asm/types.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_TYPES_H
-#define __ASM_SH_TYPES_H
-
-#ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
-#endif
-
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/uaccess.h b/libc/kernel/arch-sh/asm/uaccess.h
deleted file mode 100644
index 8b27346..0000000
--- a/libc/kernel/arch-sh/asm/uaccess.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UACCESS_H
-#define __ASM_SH_UACCESS_H
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <asm/segment.h>
-
-#define VERIFY_READ 0
-#define VERIFY_WRITE 1
-
-#define __addr_ok(addr)   ((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg)
-
-#define __access_ok(addr, size)   (__addr_ok((addr) + (size)))
-#define access_ok(type, addr, size)   (__chk_user_ptr(addr),   __access_ok((unsigned long __force)(addr), (size)))
-
-#define put_user(x,ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
-#define get_user(x,ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
-
-#define __put_user(x,ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
-#define __get_user(x,ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
-
-struct __large_struct { unsigned long buf[100]; };
-#define __m(x) (*(struct __large_struct __user *)(x))
-
-#define __get_user_nocheck(x,ptr,size)  ({   long __gu_err;   unsigned long __gu_val;   const __typeof__(*(ptr)) __user *__gu_addr = (ptr);   __chk_user_ptr(ptr);   __get_user_size(__gu_val, __gu_addr, (size), __gu_err);   (x) = (__typeof__(*(ptr)))__gu_val;   __gu_err;  })
-
-#define __get_user_check(x,ptr,size)  ({   long __gu_err = -EFAULT;   unsigned long __gu_val = 0;   const __typeof__(*(ptr)) *__gu_addr = (ptr);   if (likely(access_ok(VERIFY_READ, __gu_addr, (size))))   __get_user_size(__gu_val, __gu_addr, (size), __gu_err);   (x) = (__typeof__(*(ptr)))__gu_val;   __gu_err;  })
-
-#define __put_user_nocheck(x,ptr,size)  ({   long __pu_err;   __typeof__(*(ptr)) __user *__pu_addr = (ptr);   __typeof__(*(ptr)) __pu_val = x;   __chk_user_ptr(ptr);   __put_user_size(__pu_val, __pu_addr, (size), __pu_err);   __pu_err;  })
-
-#define __put_user_check(x,ptr,size)  ({   long __pu_err = -EFAULT;   __typeof__(*(ptr)) __user *__pu_addr = (ptr);   __typeof__(*(ptr)) __pu_val = x;   if (likely(access_ok(VERIFY_WRITE, __pu_addr, size)))   __put_user_size(__pu_val, __pu_addr, (size),   __pu_err);   __pu_err;  })
-
-#include "uaccess_32.h"
-
-#define __copy_to_user_inatomic __copy_to_user
-#define __copy_from_user_inatomic __copy_from_user
-
-#define clear_user(addr,n)  ({   void __user * __cl_addr = (addr);   unsigned long __cl_size = (n);     if (__cl_size && access_ok(VERIFY_WRITE,   ((unsigned long)(__cl_addr)), __cl_size))   __cl_size = __clear_user(__cl_addr, __cl_size);     __cl_size;  })
-
-#define strncpy_from_user(dest,src,count)  ({   unsigned long __sfu_src = (unsigned long)(src);   int __sfu_count = (int)(count);   long __sfu_res = -EFAULT;     if (__access_ok(__sfu_src, __sfu_count))   __sfu_res = __strncpy_from_user((unsigned long)(dest),   __sfu_src, __sfu_count);     __sfu_res;  })
-
-#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/uaccess_32.h b/libc/kernel/arch-sh/asm/uaccess_32.h
deleted file mode 100644
index af82591..0000000
--- a/libc/kernel/arch-sh/asm/uaccess_32.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UACCESS_32_H
-#define __ASM_SH_UACCESS_32_H
-
-#define __get_user_size(x,ptr,size,retval)  do {   retval = 0;   switch (size) {   case 1:   __get_user_asm(x, ptr, retval, "b");   break;   case 2:   __get_user_asm(x, ptr, retval, "w");   break;   case 4:   __get_user_asm(x, ptr, retval, "l");   break;   default:   __get_user_unknown();   break;   }  } while (0)
-
-#define __get_user_asm(x, addr, err, insn)  ({  __asm__ __volatile__(   "1:\n\t"   "mov." insn "	%2, %1\n\t"   "2:\n"   ".section	.fixup,\"ax\"\n"   "3:\n\t"   "mov	#0, %1\n\t"   "mov.l	4f, %0\n\t"   "jmp	@%0\n\t"   " mov	%3, %0\n\t"   ".balign	4\n"   "4:	.long	2b\n\t"   ".previous\n"   ".section	__ex_table,\"a\"\n\t"   ".long	1b, 3b\n\t"   ".previous"   :"=&r" (err), "=&r" (x)   :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
-
-#define __put_user_size(x,ptr,size,retval)  do {   retval = 0;   switch (size) {   case 1:   __put_user_asm(x, ptr, retval, "b");   break;   case 2:   __put_user_asm(x, ptr, retval, "w");   break;   case 4:   __put_user_asm(x, ptr, retval, "l");   break;   case 8:   __put_user_u64(x, ptr, retval);   break;   default:   __put_user_unknown();   }  } while (0)
-
-#define __put_user_asm(x, addr, err, insn)  do {   __asm__ __volatile__ (   "1:\n\t"   "mov." insn "	%1, %2\n\t"   "2:\n"   ".section	.fixup,\"ax\"\n"   "3:\n\t"   "mov.l	4f, %0\n\t"   "jmp	@%0\n\t"   " mov	%3, %0\n\t"   ".balign	4\n"   "4:	.long	2b\n\t"   ".previous\n"   ".section	__ex_table,\"a\"\n\t"   ".long	1b, 3b\n\t"   ".previous"   : "=&r" (err)   : "r" (x), "m" (__m(addr)), "i" (-EFAULT),   "0" (err)   : "memory"   );  } while (0)
-
-#define __put_user_u64(val,addr,retval)  ({  __asm__ __volatile__(   "1:\n\t"   "mov.l	%R1,%2\n\t"   "mov.l	%S1,%T2\n\t"   "2:\n"   ".section	.fixup,\"ax\"\n"   "3:\n\t"   "mov.l	4f,%0\n\t"   "jmp	@%0\n\t"   " mov	%3,%0\n\t"   ".balign	4\n"   "4:	.long	2b\n\t"   ".previous\n"   ".section	__ex_table,\"a\"\n\t"   ".long	1b, 3b\n\t"   ".previous"   : "=r" (retval)   : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval)   : "memory"); })
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/uaccess_64.h b/libc/kernel/arch-sh/asm/uaccess_64.h
deleted file mode 100644
index b0661dc..0000000
--- a/libc/kernel/arch-sh/asm/uaccess_64.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UACCESS_64_H
-#define __ASM_SH_UACCESS_64_H
-
-#define __get_user_size(x,ptr,size,retval)  do {   retval = 0;   switch (size) {   case 1:   retval = __get_user_asm_b(x, ptr);   break;   case 2:   retval = __get_user_asm_w(x, ptr);   break;   case 4:   retval = __get_user_asm_l(x, ptr);   break;   case 8:   retval = __get_user_asm_q(x, ptr);   break;   default:   __get_user_unknown();   break;   }  } while (0)
-
-#define __put_user_size(x,ptr,size,retval)  do {   retval = 0;   switch (size) {   case 1:   retval = __put_user_asm_b(x, ptr);   break;   case 2:   retval = __put_user_asm_w(x, ptr);   break;   case 4:   retval = __put_user_asm_l(x, ptr);   break;   case 8:   retval = __put_user_asm_q(x, ptr);   break;   default:   __put_user_unknown();   }  } while (0)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/ubc.h b/libc/kernel/arch-sh/asm/ubc.h
deleted file mode 100644
index cde9ede..0000000
--- a/libc/kernel/arch-sh/asm/ubc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UBC_H
-#define __ASM_SH_UBC_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/ucontext.h b/libc/kernel/arch-sh/asm/ucontext.h
deleted file mode 100644
index 815f79f..0000000
--- a/libc/kernel/arch-sh/asm/ucontext.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UCONTEXT_H
-#define __ASM_SH_UCONTEXT_H
-
-struct ucontext {
- unsigned long uc_flags;
- struct ucontext *uc_link;
- stack_t uc_stack;
- struct sigcontext uc_mcontext;
- sigset_t uc_sigmask;
-};
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/unaligned.h b/libc/kernel/arch-sh/asm/unaligned.h
deleted file mode 100644
index 43ef01e..0000000
--- a/libc/kernel/arch-sh/asm/unaligned.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_SH_UNALIGNED_H
-#define _ASM_SH_UNALIGNED_H
-
-#ifdef __LITTLE_ENDIAN__
-#include <linux/unaligned/le_struct.h>
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/generic.h>
-#define get_unaligned __get_unaligned_le
-#define put_unaligned __put_unaligned_le
-#else
-#include <linux/unaligned/be_struct.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-#define get_unaligned __get_unaligned_be
-#define put_unaligned __put_unaligned_be
-#endif
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/unistd.h b/libc/kernel/arch-sh/asm/unistd.h
deleted file mode 100644
index 02969d7..0000000
--- a/libc/kernel/arch-sh/asm/unistd.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifdef __SH5__
-#include "unistd_64.h"
-#else
-#include "unistd_32.h"
-#endif
diff --git a/libc/kernel/arch-sh/asm/unistd_32.h b/libc/kernel/arch-sh/asm/unistd_32.h
deleted file mode 100644
index 0db5074..0000000
--- a/libc/kernel/arch-sh/asm/unistd_32.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UNISTD_H
-#define __ASM_SH_UNISTD_H
-
-#define __NR_restart_syscall 0
-#define __NR_exit 1
-#define __NR_fork 2
-#define __NR_read 3
-#define __NR_write 4
-#define __NR_open 5
-#define __NR_close 6
-#define __NR_waitpid 7
-#define __NR_creat 8
-#define __NR_link 9
-#define __NR_unlink 10
-#define __NR_execve 11
-#define __NR_chdir 12
-#define __NR_time 13
-#define __NR_mknod 14
-#define __NR_chmod 15
-#define __NR_lchown 16
-#define __NR_break 17
-#define __NR_oldstat 18
-#define __NR_lseek 19
-#define __NR_getpid 20
-#define __NR_mount 21
-#define __NR_umount 22
-#define __NR_setuid 23
-#define __NR_getuid 24
-#define __NR_stime 25
-#define __NR_ptrace 26
-#define __NR_alarm 27
-#define __NR_oldfstat 28
-#define __NR_pause 29
-#define __NR_utime 30
-#define __NR_stty 31
-#define __NR_gtty 32
-#define __NR_access 33
-#define __NR_nice 34
-#define __NR_ftime 35
-#define __NR_sync 36
-#define __NR_kill 37
-#define __NR_rename 38
-#define __NR_mkdir 39
-#define __NR_rmdir 40
-#define __NR_dup 41
-#define __NR_pipe 42
-#define __NR_times 43
-#define __NR_prof 44
-#define __NR_brk 45
-#define __NR_setgid 46
-#define __NR_getgid 47
-#define __NR_signal 48
-#define __NR_geteuid 49
-#define __NR_getegid 50
-#define __NR_acct 51
-#define __NR_umount2 52
-#define __NR_lock 53
-#define __NR_ioctl 54
-#define __NR_fcntl 55
-#define __NR_mpx 56
-#define __NR_setpgid 57
-#define __NR_ulimit 58
-#define __NR_oldolduname 59
-#define __NR_umask 60
-#define __NR_chroot 61
-#define __NR_ustat 62
-#define __NR_dup2 63
-#define __NR_getppid 64
-#define __NR_getpgrp 65
-#define __NR_setsid 66
-#define __NR_sigaction 67
-#define __NR_sgetmask 68
-#define __NR_ssetmask 69
-#define __NR_setreuid 70
-#define __NR_setregid 71
-#define __NR_sigsuspend 72
-#define __NR_sigpending 73
-#define __NR_sethostname 74
-#define __NR_setrlimit 75
-#define __NR_getrlimit 76  
-#define __NR_getrusage 77
-#define __NR_gettimeofday 78
-#define __NR_settimeofday 79
-#define __NR_getgroups 80
-#define __NR_setgroups 81
-#define __NR_select 82
-#define __NR_symlink 83
-#define __NR_oldlstat 84
-#define __NR_readlink 85
-#define __NR_uselib 86
-#define __NR_swapon 87
-#define __NR_reboot 88
-#define __NR_readdir 89
-#define __NR_mmap 90
-#define __NR_munmap 91
-#define __NR_truncate 92
-#define __NR_ftruncate 93
-#define __NR_fchmod 94
-#define __NR_fchown 95
-#define __NR_getpriority 96
-#define __NR_setpriority 97
-#define __NR_profil 98
-#define __NR_statfs 99
-#define __NR_fstatfs 100
-#define __NR_ioperm 101
-#define __NR_socketcall 102
-#define __NR_syslog 103
-#define __NR_setitimer 104
-#define __NR_getitimer 105
-#define __NR_stat 106
-#define __NR_lstat 107
-#define __NR_fstat 108
-#define __NR_olduname 109
-#define __NR_iopl 110
-#define __NR_vhangup 111
-#define __NR_idle 112
-#define __NR_vm86old 113
-#define __NR_wait4 114
-#define __NR_swapoff 115
-#define __NR_sysinfo 116
-#define __NR_ipc 117
-#define __NR_fsync 118
-#define __NR_sigreturn 119
-#define __NR_clone 120
-#define __NR_setdomainname 121
-#define __NR_uname 122
-#define __NR_modify_ldt 123
-#define __NR_adjtimex 124
-#define __NR_mprotect 125
-#define __NR_sigprocmask 126
-#define __NR_create_module 127
-#define __NR_init_module 128
-#define __NR_delete_module 129
-#define __NR_get_kernel_syms 130
-#define __NR_quotactl 131
-#define __NR_getpgid 132
-#define __NR_fchdir 133
-#define __NR_bdflush 134
-#define __NR_sysfs 135
-#define __NR_personality 136
-#define __NR_afs_syscall 137  
-#define __NR_setfsuid 138
-#define __NR_setfsgid 139
-#define __NR__llseek 140
-#define __NR_getdents 141
-#define __NR__newselect 142
-#define __NR_flock 143
-#define __NR_msync 144
-#define __NR_readv 145
-#define __NR_writev 146
-#define __NR_getsid 147
-#define __NR_fdatasync 148
-#define __NR__sysctl 149
-#define __NR_mlock 150
-#define __NR_munlock 151
-#define __NR_mlockall 152
-#define __NR_munlockall 153
-#define __NR_sched_setparam 154
-#define __NR_sched_getparam 155
-#define __NR_sched_setscheduler 156
-#define __NR_sched_getscheduler 157
-#define __NR_sched_yield 158
-#define __NR_sched_get_priority_max 159
-#define __NR_sched_get_priority_min 160
-#define __NR_sched_rr_get_interval 161
-#define __NR_nanosleep 162
-#define __NR_mremap 163
-#define __NR_setresuid 164
-#define __NR_getresuid 165
-#define __NR_vm86 166
-#define __NR_query_module 167
-#define __NR_poll 168
-#define __NR_nfsservctl 169
-#define __NR_setresgid 170
-#define __NR_getresgid 171
-#define __NR_prctl 172
-#define __NR_rt_sigreturn 173
-#define __NR_rt_sigaction 174
-#define __NR_rt_sigprocmask 175
-#define __NR_rt_sigpending 176
-#define __NR_rt_sigtimedwait 177
-#define __NR_rt_sigqueueinfo 178
-#define __NR_rt_sigsuspend 179
-#define __NR_pread64 180
-#define __NR_pwrite64 181
-#define __NR_chown 182
-#define __NR_getcwd 183
-#define __NR_capget 184
-#define __NR_capset 185
-#define __NR_sigaltstack 186
-#define __NR_sendfile 187
-#define __NR_streams1 188  
-#define __NR_streams2 189  
-#define __NR_vfork 190
-#define __NR_ugetrlimit 191  
-#define __NR_mmap2 192
-#define __NR_truncate64 193
-#define __NR_ftruncate64 194
-#define __NR_stat64 195
-#define __NR_lstat64 196
-#define __NR_fstat64 197
-#define __NR_lchown32 198
-#define __NR_getuid32 199
-#define __NR_getgid32 200
-#define __NR_geteuid32 201
-#define __NR_getegid32 202
-#define __NR_setreuid32 203
-#define __NR_setregid32 204
-#define __NR_getgroups32 205
-#define __NR_setgroups32 206
-#define __NR_fchown32 207
-#define __NR_setresuid32 208
-#define __NR_getresuid32 209
-#define __NR_setresgid32 210
-#define __NR_getresgid32 211
-#define __NR_chown32 212
-#define __NR_setuid32 213
-#define __NR_setgid32 214
-#define __NR_setfsuid32 215
-#define __NR_setfsgid32 216
-#define __NR_pivot_root 217
-#define __NR_mincore 218
-#define __NR_madvise 219
-#define __NR_getdents64 220
-#define __NR_fcntl64 221
-
-#define __NR_gettid 224
-#define __NR_readahead 225
-#define __NR_setxattr 226
-#define __NR_lsetxattr 227
-#define __NR_fsetxattr 228
-#define __NR_getxattr 229
-#define __NR_lgetxattr 230
-#define __NR_fgetxattr 231
-#define __NR_listxattr 232
-#define __NR_llistxattr 233
-#define __NR_flistxattr 234
-#define __NR_removexattr 235
-#define __NR_lremovexattr 236
-#define __NR_fremovexattr 237
-#define __NR_tkill 238
-#define __NR_sendfile64 239
-#define __NR_futex 240
-#define __NR_sched_setaffinity 241
-#define __NR_sched_getaffinity 242
-#define __NR_set_thread_area 243
-#define __NR_get_thread_area 244
-#define __NR_io_setup 245
-#define __NR_io_destroy 246
-#define __NR_io_getevents 247
-#define __NR_io_submit 248
-#define __NR_io_cancel 249
-#define __NR_fadvise64 250
-
-#define __NR_exit_group 252
-#define __NR_lookup_dcookie 253
-#define __NR_epoll_create 254
-#define __NR_epoll_ctl 255
-#define __NR_epoll_wait 256
-#define __NR_remap_file_pages 257
-#define __NR_set_tid_address 258
-#define __NR_timer_create 259
-#define __NR_timer_settime (__NR_timer_create+1)
-#define __NR_timer_gettime (__NR_timer_create+2)
-#define __NR_timer_getoverrun (__NR_timer_create+3)
-#define __NR_timer_delete (__NR_timer_create+4)
-#define __NR_clock_settime (__NR_timer_create+5)
-#define __NR_clock_gettime (__NR_timer_create+6)
-#define __NR_clock_getres (__NR_timer_create+7)
-#define __NR_clock_nanosleep (__NR_timer_create+8)
-#define __NR_statfs64 268
-#define __NR_fstatfs64 269
-#define __NR_tgkill 270
-#define __NR_utimes 271
-#define __NR_fadvise64_64 272
-#define __NR_vserver 273
-#define __NR_mbind 274
-#define __NR_get_mempolicy 275
-#define __NR_set_mempolicy 276
-#define __NR_mq_open 277
-#define __NR_mq_unlink (__NR_mq_open+1)
-#define __NR_mq_timedsend (__NR_mq_open+2)
-#define __NR_mq_timedreceive (__NR_mq_open+3)
-#define __NR_mq_notify (__NR_mq_open+4)
-#define __NR_mq_getsetattr (__NR_mq_open+5)
-#define __NR_kexec_load 283
-#define __NR_waitid 284
-#define __NR_add_key 285
-#define __NR_request_key 286
-#define __NR_keyctl 287
-#define __NR_ioprio_set 288
-#define __NR_ioprio_get 289
-#define __NR_inotify_init 290
-#define __NR_inotify_add_watch 291
-#define __NR_inotify_rm_watch 292
-
-#define __NR_migrate_pages 294
-#define __NR_openat 295
-#define __NR_mkdirat 296
-#define __NR_mknodat 297
-#define __NR_fchownat 298
-#define __NR_futimesat 299
-#define __NR_fstatat64 300
-#define __NR_unlinkat 301
-#define __NR_renameat 302
-#define __NR_linkat 303
-#define __NR_symlinkat 304
-#define __NR_readlinkat 305
-#define __NR_fchmodat 306
-#define __NR_faccessat 307
-#define __NR_pselect6 308
-#define __NR_ppoll 309
-#define __NR_unshare 310
-#define __NR_set_robust_list 311
-#define __NR_get_robust_list 312
-#define __NR_splice 313
-#define __NR_sync_file_range 314
-#define __NR_tee 315
-#define __NR_vmsplice 316
-#define __NR_move_pages 317
-#define __NR_getcpu 318
-#define __NR_epoll_pwait 319
-#define __NR_utimensat 320
-#define __NR_signalfd 321
-#define __NR_timerfd_create 322
-#define __NR_eventfd 323
-#define __NR_fallocate 324
-#define __NR_timerfd_settime 325
-#define __NR_timerfd_gettime 326
-#define __NR_signalfd4 327
-#define __NR_eventfd2 328
-#define __NR_epoll_create1 329
-#define __NR_dup3 330
-#define __NR_pipe2 331
-#define __NR_inotify_init1 332
-
-#define NR_syscalls 333
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/unistd_64.h b/libc/kernel/arch-sh/asm/unistd_64.h
deleted file mode 100644
index 2a72b96..0000000
--- a/libc/kernel/arch-sh/asm/unistd_64.h
+++ /dev/null
@@ -1,378 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_UNISTD_64_H
-#define __ASM_SH_UNISTD_64_H
-
-#define __NR_restart_syscall 0
-#define __NR_exit 1
-#define __NR_fork 2
-#define __NR_read 3
-#define __NR_write 4
-#define __NR_open 5
-#define __NR_close 6
-#define __NR_waitpid 7
-#define __NR_creat 8
-#define __NR_link 9
-#define __NR_unlink 10
-#define __NR_execve 11
-#define __NR_chdir 12
-#define __NR_time 13
-#define __NR_mknod 14
-#define __NR_chmod 15
-#define __NR_lchown 16
-#define __NR_break 17
-#define __NR_oldstat 18
-#define __NR_lseek 19
-#define __NR_getpid 20
-#define __NR_mount 21
-#define __NR_umount 22
-#define __NR_setuid 23
-#define __NR_getuid 24
-#define __NR_stime 25
-#define __NR_ptrace 26
-#define __NR_alarm 27
-#define __NR_oldfstat 28
-#define __NR_pause 29
-#define __NR_utime 30
-#define __NR_stty 31
-#define __NR_gtty 32
-#define __NR_access 33
-#define __NR_nice 34
-#define __NR_ftime 35
-#define __NR_sync 36
-#define __NR_kill 37
-#define __NR_rename 38
-#define __NR_mkdir 39
-#define __NR_rmdir 40
-#define __NR_dup 41
-#define __NR_pipe 42
-#define __NR_times 43
-#define __NR_prof 44
-#define __NR_brk 45
-#define __NR_setgid 46
-#define __NR_getgid 47
-#define __NR_signal 48
-#define __NR_geteuid 49
-#define __NR_getegid 50
-#define __NR_acct 51
-#define __NR_umount2 52
-#define __NR_lock 53
-#define __NR_ioctl 54
-#define __NR_fcntl 55
-#define __NR_mpx 56
-#define __NR_setpgid 57
-#define __NR_ulimit 58
-#define __NR_oldolduname 59
-#define __NR_umask 60
-#define __NR_chroot 61
-#define __NR_ustat 62
-#define __NR_dup2 63
-#define __NR_getppid 64
-#define __NR_getpgrp 65
-#define __NR_setsid 66
-#define __NR_sigaction 67
-#define __NR_sgetmask 68
-#define __NR_ssetmask 69
-#define __NR_setreuid 70
-#define __NR_setregid 71
-#define __NR_sigsuspend 72
-#define __NR_sigpending 73
-#define __NR_sethostname 74
-#define __NR_setrlimit 75
-#define __NR_getrlimit 76  
-#define __NR_getrusage 77
-#define __NR_gettimeofday 78
-#define __NR_settimeofday 79
-#define __NR_getgroups 80
-#define __NR_setgroups 81
-#define __NR_select 82
-#define __NR_symlink 83
-#define __NR_oldlstat 84
-#define __NR_readlink 85
-#define __NR_uselib 86
-#define __NR_swapon 87
-#define __NR_reboot 88
-#define __NR_readdir 89
-#define __NR_mmap 90
-#define __NR_munmap 91
-#define __NR_truncate 92
-#define __NR_ftruncate 93
-#define __NR_fchmod 94
-#define __NR_fchown 95
-#define __NR_getpriority 96
-#define __NR_setpriority 97
-#define __NR_profil 98
-#define __NR_statfs 99
-#define __NR_fstatfs 100
-#define __NR_ioperm 101
-#define __NR_socketcall 102  
-#define __NR_syslog 103
-#define __NR_setitimer 104
-#define __NR_getitimer 105
-#define __NR_stat 106
-#define __NR_lstat 107
-#define __NR_fstat 108
-#define __NR_olduname 109
-#define __NR_iopl 110
-#define __NR_vhangup 111
-#define __NR_idle 112
-#define __NR_vm86old 113
-#define __NR_wait4 114
-#define __NR_swapoff 115
-#define __NR_sysinfo 116
-#define __NR_ipc 117
-#define __NR_fsync 118
-#define __NR_sigreturn 119
-#define __NR_clone 120
-#define __NR_setdomainname 121
-#define __NR_uname 122
-#define __NR_modify_ldt 123
-#define __NR_adjtimex 124
-#define __NR_mprotect 125
-#define __NR_sigprocmask 126
-#define __NR_create_module 127
-#define __NR_init_module 128
-#define __NR_delete_module 129
-#define __NR_get_kernel_syms 130
-#define __NR_quotactl 131
-#define __NR_getpgid 132
-#define __NR_fchdir 133
-#define __NR_bdflush 134
-#define __NR_sysfs 135
-#define __NR_personality 136
-#define __NR_afs_syscall 137  
-#define __NR_setfsuid 138
-#define __NR_setfsgid 139
-#define __NR__llseek 140
-#define __NR_getdents 141
-#define __NR__newselect 142
-#define __NR_flock 143
-#define __NR_msync 144
-#define __NR_readv 145
-#define __NR_writev 146
-#define __NR_getsid 147
-#define __NR_fdatasync 148
-#define __NR__sysctl 149
-#define __NR_mlock 150
-#define __NR_munlock 151
-#define __NR_mlockall 152
-#define __NR_munlockall 153
-#define __NR_sched_setparam 154
-#define __NR_sched_getparam 155
-#define __NR_sched_setscheduler 156
-#define __NR_sched_getscheduler 157
-#define __NR_sched_yield 158
-#define __NR_sched_get_priority_max 159
-#define __NR_sched_get_priority_min 160
-#define __NR_sched_rr_get_interval 161
-#define __NR_nanosleep 162
-#define __NR_mremap 163
-#define __NR_setresuid 164
-#define __NR_getresuid 165
-#define __NR_vm86 166
-#define __NR_query_module 167
-#define __NR_poll 168
-#define __NR_nfsservctl 169
-#define __NR_setresgid 170
-#define __NR_getresgid 171
-#define __NR_prctl 172
-#define __NR_rt_sigreturn 173
-#define __NR_rt_sigaction 174
-#define __NR_rt_sigprocmask 175
-#define __NR_rt_sigpending 176
-#define __NR_rt_sigtimedwait 177
-#define __NR_rt_sigqueueinfo 178
-#define __NR_rt_sigsuspend 179
-#define __NR_pread64 180
-#define __NR_pwrite64 181
-#define __NR_chown 182
-#define __NR_getcwd 183
-#define __NR_capget 184
-#define __NR_capset 185
-#define __NR_sigaltstack 186
-#define __NR_sendfile 187
-#define __NR_streams1 188  
-#define __NR_streams2 189  
-#define __NR_vfork 190
-#define __NR_ugetrlimit 191  
-#define __NR_mmap2 192
-#define __NR_truncate64 193
-#define __NR_ftruncate64 194
-#define __NR_stat64 195
-#define __NR_lstat64 196
-#define __NR_fstat64 197
-#define __NR_lchown32 198
-#define __NR_getuid32 199
-#define __NR_getgid32 200
-#define __NR_geteuid32 201
-#define __NR_getegid32 202
-#define __NR_setreuid32 203
-#define __NR_setregid32 204
-#define __NR_getgroups32 205
-#define __NR_setgroups32 206
-#define __NR_fchown32 207
-#define __NR_setresuid32 208
-#define __NR_getresuid32 209
-#define __NR_setresgid32 210
-#define __NR_getresgid32 211
-#define __NR_chown32 212
-#define __NR_setuid32 213
-#define __NR_setgid32 214
-#define __NR_setfsuid32 215
-#define __NR_setfsgid32 216
-#define __NR_pivot_root 217
-#define __NR_mincore 218
-#define __NR_madvise 219
-
-#define __NR_socket 220
-#define __NR_bind 221
-#define __NR_connect 222
-#define __NR_listen 223
-#define __NR_accept 224
-#define __NR_getsockname 225
-#define __NR_getpeername 226
-#define __NR_socketpair 227
-#define __NR_send 228
-#define __NR_sendto 229
-#define __NR_recv 230
-#define __NR_recvfrom 231
-#define __NR_shutdown 232
-#define __NR_setsockopt 233
-#define __NR_getsockopt 234
-#define __NR_sendmsg 235
-#define __NR_recvmsg 236
-
-#define __NR_semop 237
-#define __NR_semget 238
-#define __NR_semctl 239
-#define __NR_msgsnd 240
-#define __NR_msgrcv 241
-#define __NR_msgget 242
-#define __NR_msgctl 243
-#define __NR_shmdt 245
-#define __NR_shmget 246
-#define __NR_shmctl 247
-
-#define __NR_getdents64 248
-#define __NR_fcntl64 249
-
-#define __NR_gettid 252
-#define __NR_readahead 253
-#define __NR_setxattr 254
-#define __NR_lsetxattr 255
-#define __NR_fsetxattr 256
-#define __NR_getxattr 257
-#define __NR_lgetxattr 258
-#define __NR_fgetxattr 269
-#define __NR_listxattr 260
-#define __NR_llistxattr 261
-#define __NR_flistxattr 262
-#define __NR_removexattr 263
-#define __NR_lremovexattr 264
-#define __NR_fremovexattr 265
-#define __NR_tkill 266
-#define __NR_sendfile64 267
-#define __NR_futex 268
-#define __NR_sched_setaffinity 269
-#define __NR_sched_getaffinity 270
-#define __NR_set_thread_area 271
-#define __NR_get_thread_area 272
-#define __NR_io_setup 273
-#define __NR_io_destroy 274
-#define __NR_io_getevents 275
-#define __NR_io_submit 276
-#define __NR_io_cancel 277
-#define __NR_fadvise64 278
-#define __NR_exit_group 280
-
-#define __NR_lookup_dcookie 281
-#define __NR_epoll_create 282
-#define __NR_epoll_ctl 283
-#define __NR_epoll_wait 284
-#define __NR_remap_file_pages 285
-#define __NR_set_tid_address 286
-#define __NR_timer_create 287
-#define __NR_timer_settime (__NR_timer_create+1)
-#define __NR_timer_gettime (__NR_timer_create+2)
-#define __NR_timer_getoverrun (__NR_timer_create+3)
-#define __NR_timer_delete (__NR_timer_create+4)
-#define __NR_clock_settime (__NR_timer_create+5)
-#define __NR_clock_gettime (__NR_timer_create+6)
-#define __NR_clock_getres (__NR_timer_create+7)
-#define __NR_clock_nanosleep (__NR_timer_create+8)
-#define __NR_statfs64 296
-#define __NR_fstatfs64 297
-#define __NR_tgkill 298
-#define __NR_utimes 299
-#define __NR_fadvise64_64 300
-#define __NR_vserver 301
-#define __NR_mbind 302
-#define __NR_get_mempolicy 303
-#define __NR_set_mempolicy 304
-#define __NR_mq_open 305
-#define __NR_mq_unlink (__NR_mq_open+1)
-#define __NR_mq_timedsend (__NR_mq_open+2)
-#define __NR_mq_timedreceive (__NR_mq_open+3)
-#define __NR_mq_notify (__NR_mq_open+4)
-#define __NR_mq_getsetattr (__NR_mq_open+5)
-#define __NR_kexec_load 311
-#define __NR_waitid 312
-#define __NR_add_key 313
-#define __NR_request_key 314
-#define __NR_keyctl 315
-#define __NR_ioprio_set 316
-#define __NR_ioprio_get 317
-#define __NR_inotify_init 318
-#define __NR_inotify_add_watch 319
-#define __NR_inotify_rm_watch 320
-
-#define __NR_migrate_pages 322
-#define __NR_openat 323
-#define __NR_mkdirat 324
-#define __NR_mknodat 325
-#define __NR_fchownat 326
-#define __NR_futimesat 327
-#define __NR_fstatat64 328
-#define __NR_unlinkat 329
-#define __NR_renameat 330
-#define __NR_linkat 331
-#define __NR_symlinkat 332
-#define __NR_readlinkat 333
-#define __NR_fchmodat 334
-#define __NR_faccessat 335
-#define __NR_pselect6 336
-#define __NR_ppoll 337
-#define __NR_unshare 338
-#define __NR_set_robust_list 339
-#define __NR_get_robust_list 340
-#define __NR_splice 341
-#define __NR_sync_file_range 342
-#define __NR_tee 343
-#define __NR_vmsplice 344
-#define __NR_move_pages 345
-#define __NR_getcpu 346
-#define __NR_epoll_pwait 347
-#define __NR_utimensat 348
-#define __NR_signalfd 349
-#define __NR_timerfd_create 350
-#define __NR_eventfd 351
-#define __NR_fallocate 352
-#define __NR_timerfd_settime 353
-#define __NR_timerfd_gettime 354
-#define __NR_signalfd4 355
-#define __NR_eventfd2 356
-#define __NR_epoll_create1 357
-#define __NR_dup3 358
-#define __NR_pipe2 359
-#define __NR_inotify_init1 360
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/user.h b/libc/kernel/arch-sh/asm/user.h
deleted file mode 100644
index 81ab4e3..0000000
--- a/libc/kernel/arch-sh/asm/user.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_USER_H
-#define __ASM_SH_USER_H
-
-#include <asm/ptrace.h>
-#include <asm/page.h>
-
-#ifdef __SH5__
-struct user_fpu_struct {
- unsigned long fp_regs[32];
- unsigned int fpscr;
-};
-#else
-struct user_fpu_struct {
- unsigned long fp_regs[16];
- unsigned long xfp_regs[16];
- unsigned long fpscr;
- unsigned long fpul;
-};
-#endif
-
-struct user {
- struct pt_regs regs;
- struct user_fpu_struct fpu;
- int u_fpvalid;
- size_t u_tsize;
- size_t u_dsize;
- size_t u_ssize;
- unsigned long start_code;
- unsigned long start_data;
- unsigned long start_stack;
- long int signal;
- unsigned long u_ar0;
- struct user_fpu_struct* u_fpstate;
- unsigned long magic;
- char u_comm[32];
-};
-
-#define NBPG PAGE_SIZE
-#define UPAGES 1
-#define HOST_TEXT_START_ADDR (u.start_code)
-#define HOST_DATA_START_ADDR (u.start_data)
-#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/vga.h b/libc/kernel/arch-sh/asm/vga.h
deleted file mode 100644
index 9e857a9..0000000
--- a/libc/kernel/arch-sh/asm/vga.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_VGA_H
-#define __ASM_SH_VGA_H
-
-#endif
diff --git a/libc/kernel/arch-sh/asm/watchdog.h b/libc/kernel/arch-sh/asm/watchdog.h
deleted file mode 100644
index 81d7905..0000000
--- a/libc/kernel/arch-sh/asm/watchdog.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ASM_SH_WATCHDOG_H
-#define __ASM_SH_WATCHDOG_H
-#endif
diff --git a/libc/kernel/arch-sh/asm/xor.h b/libc/kernel/arch-sh/asm/xor.h
deleted file mode 100644
index 780a4ac..0000000
--- a/libc/kernel/arch-sh/asm/xor.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#include <asm-generic/xor.h>
diff --git a/libc/kernel/common/asm-generic/resource.h b/libc/kernel/common/asm-generic/resource.h
index a7f7dec..c49b476 100644
--- a/libc/kernel/common/asm-generic/resource.h
+++ b/libc/kernel/common/asm-generic/resource.h
@@ -7,51 +7,57 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _ASM_GENERIC_RESOURCE_H
 #define _ASM_GENERIC_RESOURCE_H
-
 #define RLIMIT_CPU 0  
 #define RLIMIT_FSIZE 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define RLIMIT_DATA 2  
 #define RLIMIT_STACK 3  
 #define RLIMIT_CORE 4  
-
 #ifndef RLIMIT_RSS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define RLIMIT_RSS 5  
 #endif
-
 #ifndef RLIMIT_NPROC
 #define RLIMIT_NPROC 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
-
 #ifndef RLIMIT_NOFILE
 #define RLIMIT_NOFILE 7  
 #endif
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #ifndef RLIMIT_MEMLOCK
 #define RLIMIT_MEMLOCK 8  
 #endif
-
 #ifndef RLIMIT_AS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define RLIMIT_AS 9  
 #endif
-
 #define RLIMIT_LOCKS 10  
 #define RLIMIT_SIGPENDING 11  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define RLIMIT_MSGQUEUE 12  
 #define RLIMIT_NICE 13  
 #define RLIMIT_RTPRIO 14  
-
-#define RLIM_NLIMITS 15
-
+#define RLIMIT_RTTIME 15  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RLIM_NLIMITS 16
 #ifndef RLIM_INFINITY
 #define RLIM_INFINITY (~0UL)
 #endif
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #ifndef _STK_LIM_MAX
 #define _STK_LIM_MAX RLIM_INFINITY
 #endif
-
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/common/linux/fb.h b/libc/kernel/common/linux/fb.h
index 336c439..6fd3468 100644
--- a/libc/kernel/common/linux/fb.h
+++ b/libc/kernel/common/linux/fb.h
@@ -7,341 +7,391 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _LINUX_FB_H
 #define _LINUX_FB_H
-
-#include <asm/types.h>
-
-#define FB_MAJOR 29
+#include <linux/types.h>
+#include <linux/i2c.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_MAX 32  
-
 #define FBIOGET_VSCREENINFO 0x4600
 #define FBIOPUT_VSCREENINFO 0x4601
 #define FBIOGET_FSCREENINFO 0x4602
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FBIOGETCMAP 0x4604
 #define FBIOPUTCMAP 0x4605
 #define FBIOPAN_DISPLAY 0x4606
 #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FBIOGET_CON2FBMAP 0x460F
 #define FBIOPUT_CON2FBMAP 0x4610
 #define FBIOBLANK 0x4611  
 #define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FBIO_ALLOC 0x4613
 #define FBIO_FREE 0x4614
 #define FBIOGET_GLYPH 0x4615
 #define FBIOGET_HWCINFO 0x4616
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FBIOPUT_MODEINFO 0x4617
 #define FBIOGET_DISPINFO 0x4618
-
+#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
 #define FB_TYPE_PACKED_PIXELS 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_TYPE_PLANES 1  
 #define FB_TYPE_INTERLEAVED_PLANES 2  
 #define FB_TYPE_TEXT 3  
 #define FB_TYPE_VGA_PLANES 4  
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_AUX_TEXT_MDA 0  
 #define FB_AUX_TEXT_CGA 1  
 #define FB_AUX_TEXT_S3_MMIO 2  
 #define FB_AUX_TEXT_MGA_STEP16 3  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_AUX_TEXT_MGA_STEP8 4  
-
+#define FB_AUX_TEXT_SVGA_GROUP 8  
+#define FB_AUX_TEXT_SVGA_MASK 7  
+#define FB_AUX_TEXT_SVGA_STEP2 8  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FB_AUX_TEXT_SVGA_STEP4 9  
+#define FB_AUX_TEXT_SVGA_STEP8 10  
+#define FB_AUX_TEXT_SVGA_STEP16 11  
+#define FB_AUX_TEXT_SVGA_LAST 15  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_AUX_VGA_PLANES_VGA4 0  
 #define FB_AUX_VGA_PLANES_CFB4 1  
 #define FB_AUX_VGA_PLANES_CFB8 2  
-
 #define FB_VISUAL_MONO01 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_VISUAL_MONO10 1  
 #define FB_VISUAL_TRUECOLOR 2  
 #define FB_VISUAL_PSEUDOCOLOR 3  
 #define FB_VISUAL_DIRECTCOLOR 4  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_VISUAL_STATIC_PSEUDOCOLOR 5  
-
 #define FB_ACCEL_NONE 0  
 #define FB_ACCEL_ATARIBLITT 1  
 #define FB_ACCEL_AMIGABLITT 2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_S3_TRIO64 3  
 #define FB_ACCEL_NCR_77C32BLT 4  
 #define FB_ACCEL_S3_VIRGE 5  
 #define FB_ACCEL_ATI_MACH64GX 6  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_DEC_TGA 7  
 #define FB_ACCEL_ATI_MACH64CT 8  
 #define FB_ACCEL_ATI_MACH64VT 9  
 #define FB_ACCEL_ATI_MACH64GT 10  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_SUN_CREATOR 11  
 #define FB_ACCEL_SUN_CGSIX 12  
 #define FB_ACCEL_SUN_LEO 13  
 #define FB_ACCEL_IMS_TWINTURBO 14  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_3DLABS_PERMEDIA2 15  
 #define FB_ACCEL_MATROX_MGA2064W 16  
 #define FB_ACCEL_MATROX_MGA1064SG 17  
 #define FB_ACCEL_MATROX_MGA2164W 18  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_MATROX_MGA2164W_AGP 19  
 #define FB_ACCEL_MATROX_MGAG100 20  
 #define FB_ACCEL_MATROX_MGAG200 21  
 #define FB_ACCEL_SUN_CG14 22  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_SUN_BWTWO 23  
 #define FB_ACCEL_SUN_CGTHREE 24  
 #define FB_ACCEL_SUN_TCX 25  
 #define FB_ACCEL_MATROX_MGAG400 26  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_NV3 27  
 #define FB_ACCEL_NV4 28  
 #define FB_ACCEL_NV5 29  
 #define FB_ACCEL_CT_6555x 30  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_3DFX_BANSHEE 31  
 #define FB_ACCEL_ATI_RAGE128 32  
 #define FB_ACCEL_IGS_CYBER2000 33  
 #define FB_ACCEL_IGS_CYBER2010 34  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_IGS_CYBER5000 35  
 #define FB_ACCEL_SIS_GLAMOUR 36  
 #define FB_ACCEL_3DLABS_PERMEDIA3 37  
 #define FB_ACCEL_ATI_RADEON 38  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_I810 39  
 #define FB_ACCEL_SIS_GLAMOUR_2 40  
 #define FB_ACCEL_SIS_XABRE 41  
 #define FB_ACCEL_I830 42  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_NV_10 43  
 #define FB_ACCEL_NV_20 44  
 #define FB_ACCEL_NV_30 45  
 #define FB_ACCEL_NV_40 46  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_XGI_VOLARI_V 47  
 #define FB_ACCEL_XGI_VOLARI_Z 48  
 #define FB_ACCEL_OMAP1610 49  
+#define FB_ACCEL_TRIDENT_TGUI 50  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FB_ACCEL_TRIDENT_3DIMAGE 51  
+#define FB_ACCEL_TRIDENT_BLADE3D 52  
+#define FB_ACCEL_TRIDENT_BLADEXP 53  
+#define FB_ACCEL_CIRRUS_ALPINE 53  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_NEOMAGIC_NM2070 90  
 #define FB_ACCEL_NEOMAGIC_NM2090 91  
 #define FB_ACCEL_NEOMAGIC_NM2093 92  
 #define FB_ACCEL_NEOMAGIC_NM2097 93  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_NEOMAGIC_NM2160 94  
 #define FB_ACCEL_NEOMAGIC_NM2200 95  
 #define FB_ACCEL_NEOMAGIC_NM2230 96  
 #define FB_ACCEL_NEOMAGIC_NM2360 97  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_NEOMAGIC_NM2380 98  
-
+#define FB_ACCEL_PXA3XX 99  
 #define FB_ACCEL_SAVAGE4 0x80  
 #define FB_ACCEL_SAVAGE3D 0x81  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_SAVAGE3D_MV 0x82  
 #define FB_ACCEL_SAVAGE2000 0x83  
 #define FB_ACCEL_SAVAGE_MX_MV 0x84  
 #define FB_ACCEL_SAVAGE_MX 0x85  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_SAVAGE_IX_MV 0x86  
 #define FB_ACCEL_SAVAGE_IX 0x87  
 #define FB_ACCEL_PROSAVAGE_PM 0x88  
 #define FB_ACCEL_PROSAVAGE_KM 0x89  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_S3TWISTER_P 0x8a  
 #define FB_ACCEL_S3TWISTER_K 0x8b  
 #define FB_ACCEL_SUPERSAVAGE 0x8c  
 #define FB_ACCEL_PROSAVAGE_DDR 0x8d  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACCEL_PROSAVAGE_DDRK 0x8e  
-
+#define FB_ACCEL_PUV3_UNIGFX 0xa0  
 struct fb_fix_screeninfo {
  char id[16];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  unsigned long smem_start;
-
  __u32 smem_len;
  __u32 type;
  __u32 type_aux;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 visual;
  __u16 xpanstep;
  __u16 ypanstep;
  __u16 ywrapstep;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 line_length;
  unsigned long mmio_start;
-
  __u32 mmio_len;
  __u32 accel;
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u16 reserved[3];
 };
-
 struct fb_bitfield {
  __u32 offset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 length;
  __u32 msb_right;
-
 };
-
 #define FB_NONSTD_HAM 1  
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FB_NONSTD_REV_PIX_IN_B 2  
 #define FB_ACTIVATE_NOW 0  
 #define FB_ACTIVATE_NXTOPEN 1  
 #define FB_ACTIVATE_TEST 2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACTIVATE_MASK 15
-
 #define FB_ACTIVATE_VBL 16  
 #define FB_CHANGE_CMAP_VBL 32  
 #define FB_ACTIVATE_ALL 64  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ACTIVATE_FORCE 128  
 #define FB_ACTIVATE_INV_MODE 256  
-
 #define FB_ACCELF_TEXT 1  
-
 #define FB_SYNC_HOR_HIGH_ACT 1  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_SYNC_VERT_HIGH_ACT 2  
 #define FB_SYNC_EXT 4  
 #define FB_SYNC_COMP_HIGH_ACT 8  
 #define FB_SYNC_BROADCAST 16  
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_SYNC_ON_GREEN 32  
-
 #define FB_VMODE_NONINTERLACED 0  
 #define FB_VMODE_INTERLACED 1  
 #define FB_VMODE_DOUBLE 2  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FB_VMODE_ODD_FLD_FIRST 4  
 #define FB_VMODE_MASK 255
-
 #define FB_VMODE_YWRAP 256  
 #define FB_VMODE_SMOOTH_XPAN 512  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_VMODE_CONUPDATE 512  
-
+#define FB_FLAG_RATIO_4_3 64
+#define FB_FLAG_RATIO_16_9 128
+#define FB_FLAG_PIXEL_REPEAT 256
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_ROTATE_UR 0
 #define FB_ROTATE_CW 1
 #define FB_ROTATE_UD 2
 #define FB_ROTATE_CCW 3
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define PICOS2KHZ(a) (1000000000UL/(a))
 #define KHZ2PICOS(a) (1000000000UL/(a))
-
 struct fb_var_screeninfo {
  __u32 xres;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 yres;
  __u32 xres_virtual;
  __u32 yres_virtual;
  __u32 xoffset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 yoffset;
-
  __u32 bits_per_pixel;
  __u32 grayscale;
-
  struct fb_bitfield red;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  struct fb_bitfield green;
  struct fb_bitfield blue;
  struct fb_bitfield transp;
-
  __u32 nonstd;
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 activate;
-
  __u32 height;
  __u32 width;
-
  __u32 accel_flags;
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 pixclock;
  __u32 left_margin;
  __u32 right_margin;
  __u32 upper_margin;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 lower_margin;
  __u32 hsync_len;
  __u32 vsync_len;
  __u32 sync;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 vmode;
  __u32 rotate;
  __u32 reserved[5];
 };
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct fb_cmap {
  __u32 start;
  __u32 len;
  __u16 *red;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u16 *green;
  __u16 *blue;
  __u16 *transp;
 };
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct fb_con2fbmap {
  __u32 console;
  __u32 framebuffer;
 };
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define VESA_NO_BLANKING 0
 #define VESA_VSYNC_SUSPEND 1
 #define VESA_HSYNC_SUSPEND 2
 #define VESA_POWERDOWN 3
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum {
-
  FB_BLANK_UNBLANK = VESA_NO_BLANKING,
-
  FB_BLANK_NORMAL = VESA_NO_BLANKING + 1,
-
  FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
-
  FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1
 };
-
 #define FB_VBLANK_VBLANKING 0x001  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_VBLANK_HBLANKING 0x002  
 #define FB_VBLANK_HAVE_VBLANK 0x004  
 #define FB_VBLANK_HAVE_HBLANK 0x008  
 #define FB_VBLANK_HAVE_COUNT 0x010  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_VBLANK_HAVE_VCOUNT 0x020  
 #define FB_VBLANK_HAVE_HCOUNT 0x040  
 #define FB_VBLANK_VSYNCING 0x080  
 #define FB_VBLANK_HAVE_VSYNC 0x100  
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct fb_vblank {
  __u32 flags;
  __u32 count;
  __u32 vcount;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 hcount;
  __u32 reserved[4];
 };
-
 #define ROP_COPY 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define ROP_XOR 1
-
 struct fb_copyarea {
  __u32 dx;
  __u32 dy;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 width;
  __u32 height;
  __u32 sx;
  __u32 sy;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
-
 struct fb_fillrect {
  __u32 dx;
  __u32 dy;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 width;
  __u32 height;
  __u32 color;
  __u32 rop;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
-
 struct fb_image {
  __u32 dx;
  __u32 dy;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u32 width;
  __u32 height;
  __u32 fg_color;
  __u32 bg_color;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u8 depth;
  const char *data;
  struct fb_cmap cmap;
 };
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_CUR_SETIMAGE 0x01
 #define FB_CUR_SETPOS 0x02
 #define FB_CUR_SETHOT 0x04
 #define FB_CUR_SETCMAP 0x08
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define FB_CUR_SETSHAPE 0x10
 #define FB_CUR_SETSIZE 0x20
 #define FB_CUR_SETALL 0xFF
-
 struct fbcurpos {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u16 x, y;
 };
-
 struct fb_cursor {
  __u16 set;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u16 enable;
  __u16 rop;
  const char *mask;
  struct fbcurpos hot;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  struct fb_image image;
 };
-
 #endif
+
diff --git a/libc/kernel/common/linux/genetlink.h b/libc/kernel/common/linux/genetlink.h
new file mode 100644
index 0000000..bc6042c
--- /dev/null
+++ b/libc/kernel/common/linux/genetlink.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_GENERIC_NETLINK_H
+#define __LINUX_GENERIC_NETLINK_H
+#include <linux/types.h>
+#include <linux/netlink.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GENL_NAMSIZ 16  
+#define GENL_MIN_ID NLMSG_MIN_TYPE
+#define GENL_MAX_ID 1023
+struct genlmsghdr {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 cmd;
+ __u8 version;
+ __u16 reserved;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
+#define GENL_ADMIN_PERM 0x01
+#define GENL_CMD_CAP_DO 0x02
+#define GENL_CMD_CAP_DUMP 0x04
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define GENL_CMD_CAP_HASPOL 0x08
+#define GENL_ID_GENERATE 0
+#define GENL_ID_CTRL NLMSG_MIN_TYPE
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTRL_CMD_UNSPEC,
+ CTRL_CMD_NEWFAMILY,
+ CTRL_CMD_DELFAMILY,
+ CTRL_CMD_GETFAMILY,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTRL_CMD_NEWOPS,
+ CTRL_CMD_DELOPS,
+ CTRL_CMD_GETOPS,
+ CTRL_CMD_NEWMCAST_GRP,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTRL_CMD_DELMCAST_GRP,
+ CTRL_CMD_GETMCAST_GRP,
+ __CTRL_CMD_MAX,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
+enum {
+ CTRL_ATTR_UNSPEC,
+ CTRL_ATTR_FAMILY_ID,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTRL_ATTR_FAMILY_NAME,
+ CTRL_ATTR_VERSION,
+ CTRL_ATTR_HDRSIZE,
+ CTRL_ATTR_MAXATTR,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTRL_ATTR_OPS,
+ CTRL_ATTR_MCAST_GROUPS,
+ __CTRL_ATTR_MAX,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
+enum {
+ CTRL_ATTR_OP_UNSPEC,
+ CTRL_ATTR_OP_ID,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTRL_ATTR_OP_FLAGS,
+ __CTRL_ATTR_OP_MAX,
+};
+#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ CTRL_ATTR_MCAST_GRP_UNSPEC,
+ CTRL_ATTR_MCAST_GRP_NAME,
+ CTRL_ATTR_MCAST_GRP_ID,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __CTRL_ATTR_MCAST_GRP_MAX,
+};
+#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+
diff --git a/libc/kernel/common/linux/icmpv6.h b/libc/kernel/common/linux/icmpv6.h
new file mode 100644
index 0000000..d1be8cd
--- /dev/null
+++ b/libc/kernel/common/linux/icmpv6.h
@@ -0,0 +1,152 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_ICMPV6_H
+#define _LINUX_ICMPV6_H
+
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+struct icmp6hdr {
+
+ __u8 icmp6_type;
+ __u8 icmp6_code;
+ __sum16 icmp6_cksum;
+
+ union {
+ __be32 un_data32[1];
+ __be16 un_data16[2];
+ __u8 un_data8[4];
+
+ struct icmpv6_echo {
+ __be16 identifier;
+ __be16 sequence;
+ } u_echo;
+
+ struct icmpv6_nd_advt {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+ __u32 reserved:5,
+ override:1,
+ solicited:1,
+ router:1,
+ reserved2:24;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+ __u32 router:1,
+ solicited:1,
+ override:1,
+ reserved:29;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ } u_nd_advt;
+
+ struct icmpv6_nd_ra {
+ __u8 hop_limit;
+#ifdef __LITTLE_ENDIAN_BITFIELD
+ __u8 reserved:3,
+ router_pref:2,
+ home_agent:1,
+ other:1,
+ managed:1;
+
+#elif defined(__BIG_ENDIAN_BITFIELD)
+ __u8 managed:1,
+ other:1,
+ home_agent:1,
+ router_pref:2,
+ reserved:3;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __be16 rt_lifetime;
+ } u_nd_ra;
+
+ } icmp6_dataun;
+
+#define icmp6_identifier icmp6_dataun.u_echo.identifier
+#define icmp6_sequence icmp6_dataun.u_echo.sequence
+#define icmp6_pointer icmp6_dataun.un_data32[0]
+#define icmp6_mtu icmp6_dataun.un_data32[0]
+#define icmp6_unused icmp6_dataun.un_data32[0]
+#define icmp6_maxdelay icmp6_dataun.un_data16[0]
+#define icmp6_router icmp6_dataun.u_nd_advt.router
+#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited
+#define icmp6_override icmp6_dataun.u_nd_advt.override
+#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved
+#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit
+#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed
+#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
+#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
+#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
+};
+
+#define ICMPV6_ROUTER_PREF_LOW 0x3
+#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
+#define ICMPV6_ROUTER_PREF_HIGH 0x1
+#define ICMPV6_ROUTER_PREF_INVALID 0x2
+
+#define ICMPV6_DEST_UNREACH 1
+#define ICMPV6_PKT_TOOBIG 2
+#define ICMPV6_TIME_EXCEED 3
+#define ICMPV6_PARAMPROB 4
+
+#define ICMPV6_INFOMSG_MASK 0x80
+
+#define ICMPV6_ECHO_REQUEST 128
+#define ICMPV6_ECHO_REPLY 129
+#define ICMPV6_MGM_QUERY 130
+#define ICMPV6_MGM_REPORT 131
+#define ICMPV6_MGM_REDUCTION 132
+
+#define ICMPV6_NI_QUERY 139
+#define ICMPV6_NI_REPLY 140
+
+#define ICMPV6_MLD2_REPORT 143
+
+#define ICMPV6_DHAAD_REQUEST 144
+#define ICMPV6_DHAAD_REPLY 145
+#define ICMPV6_MOBILE_PREFIX_SOL 146
+#define ICMPV6_MOBILE_PREFIX_ADV 147
+
+#define ICMPV6_NOROUTE 0
+#define ICMPV6_ADM_PROHIBITED 1
+#define ICMPV6_NOT_NEIGHBOUR 2
+#define ICMPV6_ADDR_UNREACH 3
+#define ICMPV6_PORT_UNREACH 4
+
+#define ICMPV6_EXC_HOPLIMIT 0
+#define ICMPV6_EXC_FRAGTIME 1
+
+#define ICMPV6_HDR_FIELD 0
+#define ICMPV6_UNK_NEXTHDR 1
+#define ICMPV6_UNK_OPTION 2
+
+#define ICMPV6_FILTER 1
+
+#define ICMPV6_FILTER_BLOCK 1
+#define ICMPV6_FILTER_PASS 2
+#define ICMPV6_FILTER_BLOCKOTHERS 3
+#define ICMPV6_FILTER_PASSONLY 4
+
+struct icmp6_filter {
+ __u32 data[8];
+};
+
+#define MLD2_MODE_IS_INCLUDE 1
+#define MLD2_MODE_IS_EXCLUDE 2
+#define MLD2_CHANGE_TO_INCLUDE 3
+#define MLD2_CHANGE_TO_EXCLUDE 4
+#define MLD2_ALLOW_NEW_SOURCES 5
+#define MLD2_BLOCK_OLD_SOURCES 6
+
+#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
+
+#endif
diff --git a/libc/kernel/common/linux/if_pppol2tp.h b/libc/kernel/common/linux/if_pppol2tp.h
new file mode 100644
index 0000000..6d0f6af
--- /dev/null
+++ b/libc/kernel/common/linux/if_pppol2tp.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_IF_PPPOL2TP_H
+#define __LINUX_IF_PPPOL2TP_H
+#include <linux/types.h>
+struct pppol2tp_addr {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_pid_t pid;
+ int fd;
+ struct sockaddr_in addr;
+ __u16 s_tunnel, s_session;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 d_tunnel, d_session;
+};
+struct pppol2tpv3_addr {
+ pid_t pid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int fd;
+ struct sockaddr_in addr;
+ __u32 s_tunnel, s_session;
+ __u32 d_tunnel, d_session;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum {
+ PPPOL2TP_SO_DEBUG = 1,
+ PPPOL2TP_SO_RECVSEQ = 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ PPPOL2TP_SO_SENDSEQ = 3,
+ PPPOL2TP_SO_LNSMODE = 4,
+ PPPOL2TP_SO_REORDERTO = 5,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ PPPOL2TP_MSG_DEBUG = (1 << 0),
+ PPPOL2TP_MSG_CONTROL = (1 << 1),
+ PPPOL2TP_MSG_SEQ = (1 << 2),
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ PPPOL2TP_MSG_DATA = (1 << 3),
+};
+#endif
diff --git a/libc/kernel/common/linux/if_pppolac.h b/libc/kernel/common/linux/if_pppolac.h
index bf6eba0..ad212e7 100644
--- a/libc/kernel/common/linux/if_pppolac.h
+++ b/libc/kernel/common/linux/if_pppolac.h
@@ -7,23 +7,28 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef __LINUX_IF_PPPOLAC_H
 #define __LINUX_IF_PPPOLAC_H
-
 #include <linux/socket.h>
 #include <linux/types.h>
-
-#define PX_PROTO_OLAC 2
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct sockaddr_pppolac {
  sa_family_t sa_family;
  unsigned int sa_protocol;
  int udp_socket;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  struct __attribute__((packed)) {
  __u16 tunnel, session;
  } local, remote;
 } __attribute__((packed));
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/common/linux/if_pppopns.h b/libc/kernel/common/linux/if_pppopns.h
index ac75210..0eb7670 100644
--- a/libc/kernel/common/linux/if_pppopns.h
+++ b/libc/kernel/common/linux/if_pppopns.h
@@ -7,22 +7,27 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef __LINUX_IF_PPPOPNS_H
 #define __LINUX_IF_PPPOPNS_H
-
 #include <linux/socket.h>
 #include <linux/types.h>
-
-#define PX_PROTO_OPNS 3
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 struct sockaddr_pppopns {
  sa_family_t sa_family;
  unsigned int sa_protocol;
  int tcp_socket;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __u16 local;
  __u16 remote;
 } __attribute__((packed));
-
 #endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/common/linux/if_pppox.h b/libc/kernel/common/linux/if_pppox.h
new file mode 100644
index 0000000..47ed22e
--- /dev/null
+++ b/libc/kernel/common/linux/if_pppox.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_IF_PPPOX_H
+#define __LINUX_IF_PPPOX_H
+#include <linux/types.h>
+#include <asm/byteorder.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/if_pppol2tp.h>
+#include <linux/if_pppolac.h>
+#include <linux/if_pppopns.h>
+#ifndef AF_PPPOX
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AF_PPPOX 24
+#define PF_PPPOX AF_PPPOX
+#endif
+typedef __be16 sid_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct pppoe_addr {
+ sid_t sid;
+ unsigned char remote[ETH_ALEN];
+ char dev[IFNAMSIZ];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct pptp_addr {
+ __be16 call_id;
+ struct in_addr sin_addr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define PX_PROTO_OE 0  
+#define PX_PROTO_OL2TP 1  
+#define PX_PROTO_PPTP 2
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PX_PROTO_OLAC 3
+#define PX_PROTO_OPNS 4
+#define PX_MAX_PROTO 5
+struct sockaddr_pppox {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sa_family_t sa_family;
+ unsigned int sa_protocol;
+ union {
+ struct pppoe_addr pppoe;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct pptp_addr pptp;
+ } sa_addr;
+} __attribute__((packed));
+struct sockaddr_pppol2tp {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sa_family_t sa_family;
+ unsigned int sa_protocol;
+ struct pppol2tp_addr pppol2tp;
+} __attribute__((packed));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sockaddr_pppol2tpv3 {
+ sa_family_t sa_family;
+ unsigned int sa_protocol;
+ struct pppol2tpv3_addr pppol2tp;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} __attribute__((packed));
+#define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t)
+#define PPPOEIOCDFWD _IO(0xB1 ,1)
+#define PADI_CODE 0x09
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PADO_CODE 0x07
+#define PADR_CODE 0x19
+#define PADS_CODE 0x65
+#define PADT_CODE 0xa7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct pppoe_tag {
+ __be16 tag_type;
+ __be16 tag_len;
+ char tag_data[0];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} __attribute__ ((packed));
+#define PTT_EOL __cpu_to_be16(0x0000)
+#define PTT_SRV_NAME __cpu_to_be16(0x0101)
+#define PTT_AC_NAME __cpu_to_be16(0x0102)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTT_HOST_UNIQ __cpu_to_be16(0x0103)
+#define PTT_AC_COOKIE __cpu_to_be16(0x0104)
+#define PTT_VENDOR __cpu_to_be16(0x0105)
+#define PTT_RELAY_SID __cpu_to_be16(0x0110)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTT_SRV_ERR __cpu_to_be16(0x0201)
+#define PTT_SYS_ERR __cpu_to_be16(0x0202)
+#define PTT_GEN_ERR __cpu_to_be16(0x0203)
+struct pppoe_hdr {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __LITTLE_ENDIAN_BITFIELD
+ __u8 ver : 4;
+ __u8 type : 4;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 type : 4;
+ __u8 ver : 4;
+#else
+#error "Please fix <asm/byteorder.h>"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+ __u8 code;
+ __be16 sid;
+ __be16 length;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct pppoe_tag tag[0];
+} __attribute__((packed));
+#define PPPOE_SES_HLEN 8
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/common/linux/in6.h b/libc/kernel/common/linux/in6.h
index ceaeb7d..d148dfd 100644
--- a/libc/kernel/common/linux/in6.h
+++ b/libc/kernel/common/linux/in6.h
@@ -14,25 +14,21 @@
 
 #include <linux/types.h>
 
-struct in6_addr
-{
- union
- {
+struct in6_addr {
+ union {
  __u8 u6_addr8[16];
- __u16 u6_addr16[8];
- __u32 u6_addr32[4];
+ __be16 u6_addr16[8];
+ __be32 u6_addr32[4];
  } in6_u;
 #define s6_addr in6_u.u6_addr8
 #define s6_addr16 in6_u.u6_addr16
 #define s6_addr32 in6_u.u6_addr32
 };
 
-#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
-
 struct sockaddr_in6 {
  unsigned short int sin6_family;
- __u16 sin6_port;
- __u32 sin6_flowinfo;
+ __be16 sin6_port;
+ __be32 sin6_flowinfo;
  struct in6_addr sin6_addr;
  __u32 sin6_scope_id;
 };
@@ -46,10 +42,9 @@
 
 #define ipv6mr_acaddr ipv6mr_multiaddr
 
-struct in6_flowlabel_req
-{
+struct in6_flowlabel_req {
  struct in6_addr flr_dst;
- __u32 flr_label;
+ __be32 flr_label;
  __u8 flr_action;
  __u8 flr_share;
  __u16 flr_flags;
@@ -98,11 +93,13 @@
 #define IPPROTO_ICMPV6 58  
 #define IPPROTO_NONE 59  
 #define IPPROTO_DSTOPTS 60  
+#define IPPROTO_MH 135  
 
 #define IPV6_TLV_PAD0 0
 #define IPV6_TLV_PADN 1
 #define IPV6_TLV_ROUTERALERT 5
 #define IPV6_TLV_JUMBO 194
+#define IPV6_TLV_HAO 201  
 
 #define IPV6_ADDRFORM 1
 #define IPV6_2292PKTINFO 2
@@ -133,6 +130,7 @@
 #define IPV6_PMTUDISC_DONT 0
 #define IPV6_PMTUDISC_WANT 1
 #define IPV6_PMTUDISC_DO 2
+#define IPV6_PMTUDISC_PROBE 3
 
 #define IPV6_FLOWLABEL_MGR 32
 #define IPV6_FLOWINFO_SEND 33
@@ -151,8 +149,27 @@
 #define IPV6_RTHDR 57
 #define IPV6_RECVDSTOPTS 58
 #define IPV6_DSTOPTS 59
+#define IPV6_RECVPATHMTU 60
+#define IPV6_PATHMTU 61
+#define IPV6_DONTFRAG 62
 
 #define IPV6_RECVTCLASS 66
 #define IPV6_TCLASS 67
 
+#define IPV6_ADDR_PREFERENCES 72
+
+#define IPV6_PREFER_SRC_TMP 0x0001
+#define IPV6_PREFER_SRC_PUBLIC 0x0002
+#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
+#define IPV6_PREFER_SRC_COA 0x0004
+#define IPV6_PREFER_SRC_HOME 0x0400
+#define IPV6_PREFER_SRC_CGA 0x0008
+#define IPV6_PREFER_SRC_NONCGA 0x0800
+
+#define IPV6_MINHOPCOUNT 73
+
+#define IPV6_ORIGDSTADDR 74
+#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
+#define IPV6_TRANSPARENT 75
+
 #endif
diff --git a/libc/kernel/common/linux/input.h b/libc/kernel/common/linux/input.h
index 96dae14..4045eb0 100644
--- a/libc/kernel/common/linux/input.h
+++ b/libc/kernel/common/linux/input.h
@@ -7,66 +7,79 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _INPUT_H
 #define _INPUT_H
-
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
-#include <asm/types.h>
-
+#include <linux/types.h>
 struct input_event {
  struct timeval time;
  __u16 type;
  __u16 code;
  __s32 value;
 };
-
-#define EV_VERSION 0x010000
-
+#define EV_VERSION 0x010001
 struct input_id {
  __u16 bustype;
  __u16 vendor;
  __u16 product;
  __u16 version;
 };
-
 struct input_absinfo {
  __s32 value;
  __s32 minimum;
  __s32 maximum;
  __s32 fuzz;
  __s32 flat;
+ __s32 resolution;
 };
-
-#define EVIOCGVERSION _IOR('E', 0x01, int)  
-#define EVIOCGID _IOR('E', 0x02, struct input_id)  
-#define EVIOCGREP _IOR('E', 0x03, int[2])  
-#define EVIOCSREP _IOW('E', 0x03, int[2])  
-#define EVIOCGKEYCODE _IOR('E', 0x04, int[2])  
-#define EVIOCSKEYCODE _IOW('E', 0x04, int[2])  
-
-#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len)  
-#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len)  
-#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len)  
-
-#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len)  
-#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len)  
-#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len)  
-#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len)  
-
-#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len)  
-#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo)  
-#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo)  
-
-#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))  
-#define EVIOCRMFF _IOW('E', 0x81, int)  
-#define EVIOCGEFFECTS _IOR('E', 0x84, int)  
-
-#define EVIOCGRAB _IOW('E', 0x90, int)  
-
+struct input_keymap_entry {
+#define INPUT_KEYMAP_BY_INDEX (1 << 0)
+ __u8 flags;
+ __u8 len;
+ __u16 index;
+ __u32 keycode;
+ __u8 scancode[32];
+};
+#define EVIOCGVERSION _IOR('E', 0x01, int)
+#define EVIOCGID _IOR('E', 0x02, struct input_id)
+#define EVIOCGREP _IOR('E', 0x03, unsigned int[2])
+#define EVIOCSREP _IOW('E', 0x03, unsigned int[2])
+#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2])
+#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
+#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2])
+#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
+#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len)
+#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len)
+#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len)
+#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len)
+#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len)
+#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len)
+#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len)
+#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len)
+#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len)
+#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo)
+#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo)
+#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))
+#define EVIOCRMFF _IOW('E', 0x81, int)
+#define EVIOCGEFFECTS _IOR('E', 0x84, int)
+#define EVIOCGRAB _IOW('E', 0x90, int)
+#define INPUT_PROP_POINTER 0x00
+#define INPUT_PROP_DIRECT 0x01
+#define INPUT_PROP_BUTTONPAD 0x02
+#define INPUT_PROP_SEMI_MT 0x03
+#define INPUT_PROP_MAX 0x1f
+#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
 #define EV_SYN 0x00
 #define EV_KEY 0x01
 #define EV_REL 0x02
@@ -80,10 +93,11 @@
 #define EV_PWR 0x16
 #define EV_FF_STATUS 0x17
 #define EV_MAX 0x1f
-
+#define EV_CNT (EV_MAX+1)
 #define SYN_REPORT 0
 #define SYN_CONFIG 1
-
+#define SYN_MT_REPORT 2
+#define SYN_DROPPED 3
 #define KEY_RESERVED 0
 #define KEY_ESC 1
 #define KEY_1 2
@@ -168,7 +182,6 @@
 #define KEY_KP3 81
 #define KEY_KP0 82
 #define KEY_KPDOT 83
-
 #define KEY_ZENKAKUHANKAKU 85
 #define KEY_102ND 86
 #define KEY_F11 87
@@ -204,7 +217,7 @@
 #define KEY_KPEQUAL 117
 #define KEY_KPPLUSMINUS 118
 #define KEY_PAUSE 119
-
+#define KEY_SCALE 120
 #define KEY_KPCOMMA 121
 #define KEY_HANGEUL 122
 #define KEY_HANGUEL KEY_HANGEUL
@@ -213,7 +226,6 @@
 #define KEY_LEFTMETA 125
 #define KEY_RIGHTMETA 126
 #define KEY_COMPOSE 127
-
 #define KEY_STOP 128
 #define KEY_AGAIN 129
 #define KEY_PROPS 130
@@ -239,6 +251,7 @@
 #define KEY_WWW 150
 #define KEY_MSDOS 151
 #define KEY_COFFEE 152
+#define KEY_SCREENLOCK KEY_COFFEE
 #define KEY_DIRECTION 153
 #define KEY_CYCLEWINDOWS 154
 #define KEY_MAIL 155
@@ -269,7 +282,6 @@
 #define KEY_KPRIGHTPAREN 180
 #define KEY_NEW 181
 #define KEY_REDO 182
-
 #define KEY_F13 183
 #define KEY_F14 184
 #define KEY_F15 185
@@ -282,11 +294,11 @@
 #define KEY_F22 192
 #define KEY_F23 193
 #define KEY_F24 194
-
 #define KEY_PLAYCD 200
 #define KEY_PAUSECD 201
 #define KEY_PROG3 202
 #define KEY_PROG4 203
+#define KEY_DASHBOARD 204
 #define KEY_SUSPEND 205
 #define KEY_CLOSE 206
 #define KEY_PLAY 207
@@ -309,32 +321,27 @@
 #define KEY_BRIGHTNESSDOWN 224
 #define KEY_BRIGHTNESSUP 225
 #define KEY_MEDIA 226
-
-#define KEY_STAR 227
-#define KEY_SHARP 228
-#define KEY_SOFT1 229
-#define KEY_SOFT2 230
-#define KEY_SEND 231
-#define KEY_CENTER 232
-#define KEY_HEADSETHOOK 233
-#define KEY_0_5 234
-#define KEY_2_5 235
-
-#define KEY_SWITCHVIDEOMODE 236
-#define KEY_KBDILLUMTOGGLE 237
-#define KEY_KBDILLUMDOWN 238
-#define KEY_KBDILLUMUP 239
-
+#define KEY_SWITCHVIDEOMODE 227
+#define KEY_KBDILLUMTOGGLE 228
+#define KEY_KBDILLUMDOWN 229
+#define KEY_KBDILLUMUP 230
 #define KEY_SEND 231
 #define KEY_REPLY 232
 #define KEY_FORWARDMAIL 233
 #define KEY_SAVE 234
 #define KEY_DOCUMENTS 235
-
 #define KEY_BATTERY 236
-
+#define KEY_BLUETOOTH 237
+#define KEY_WLAN 238
+#define KEY_UWB 239
 #define KEY_UNKNOWN 240
-
+#define KEY_VIDEO_NEXT 241
+#define KEY_VIDEO_PREV 242
+#define KEY_BRIGHTNESS_CYCLE 243
+#define KEY_BRIGHTNESS_ZERO 244
+#define KEY_DISPLAY_OFF 245
+#define KEY_WIMAX 246
+#define KEY_RFKILL 247
 #define BTN_MISC 0x100
 #define BTN_0 0x100
 #define BTN_1 0x101
@@ -346,7 +353,6 @@
 #define BTN_7 0x107
 #define BTN_8 0x108
 #define BTN_9 0x109
-
 #define BTN_MOUSE 0x110
 #define BTN_LEFT 0x110
 #define BTN_RIGHT 0x111
@@ -356,7 +362,6 @@
 #define BTN_FORWARD 0x115
 #define BTN_BACK 0x116
 #define BTN_TASK 0x117
-
 #define BTN_JOYSTICK 0x120
 #define BTN_TRIGGER 0x120
 #define BTN_THUMB 0x121
@@ -371,7 +376,6 @@
 #define BTN_BASE5 0x12a
 #define BTN_BASE6 0x12b
 #define BTN_DEAD 0x12f
-
 #define BTN_GAMEPAD 0x130
 #define BTN_A 0x130
 #define BTN_B 0x131
@@ -388,7 +392,6 @@
 #define BTN_MODE 0x13c
 #define BTN_THUMBL 0x13d
 #define BTN_THUMBR 0x13e
-
 #define BTN_DIGI 0x140
 #define BTN_TOOL_PEN 0x140
 #define BTN_TOOL_RUBBER 0x141
@@ -403,11 +406,10 @@
 #define BTN_STYLUS2 0x14c
 #define BTN_TOOL_DOUBLETAP 0x14d
 #define BTN_TOOL_TRIPLETAP 0x14e
-
+#define BTN_TOOL_QUADTAP 0x14f
 #define BTN_WHEEL 0x150
 #define BTN_GEAR_DOWN 0x150
 #define BTN_GEAR_UP 0x151
-
 #define KEY_OK 0x160
 #define KEY_SELECT 0x161
 #define KEY_GOTO 0x162
@@ -472,12 +474,37 @@
 #define KEY_DIGITS 0x19d
 #define KEY_TEEN 0x19e
 #define KEY_TWEN 0x19f
-
+#define KEY_VIDEOPHONE 0x1a0
+#define KEY_GAMES 0x1a1
+#define KEY_ZOOMIN 0x1a2
+#define KEY_ZOOMOUT 0x1a3
+#define KEY_ZOOMRESET 0x1a4
+#define KEY_WORDPROCESSOR 0x1a5
+#define KEY_EDITOR 0x1a6
+#define KEY_SPREADSHEET 0x1a7
+#define KEY_GRAPHICSEDITOR 0x1a8
+#define KEY_PRESENTATION 0x1a9
+#define KEY_DATABASE 0x1aa
+#define KEY_NEWS 0x1ab
+#define KEY_VOICEMAIL 0x1ac
+#define KEY_ADDRESSBOOK 0x1ad
+#define KEY_MESSENGER 0x1ae
+#define KEY_DISPLAYTOGGLE 0x1af
+#define KEY_SPELLCHECK 0x1b0
+#define KEY_LOGOFF 0x1b1
+#define KEY_DOLLAR 0x1b2
+#define KEY_EURO 0x1b3
+#define KEY_FRAMEBACK 0x1b4
+#define KEY_FRAMEFORWARD 0x1b5
+#define KEY_CONTEXT_MENU 0x1b6
+#define KEY_MEDIA_REPEAT 0x1b7
+#define KEY_10CHANNELSUP 0x1b8
+#define KEY_10CHANNELSDOWN 0x1b9
+#define KEY_IMAGES 0x1ba
 #define KEY_DEL_EOL 0x1c0
 #define KEY_DEL_EOS 0x1c1
 #define KEY_INS_LINE 0x1c2
 #define KEY_DEL_LINE 0x1c3
-
 #define KEY_FN 0x1d0
 #define KEY_FN_ESC 0x1d1
 #define KEY_FN_F1 0x1d2
@@ -499,7 +526,6 @@
 #define KEY_FN_F 0x1e2
 #define KEY_FN_S 0x1e3
 #define KEY_FN_B 0x1e4
-
 #define KEY_BRL_DOT1 0x1f1
 #define KEY_BRL_DOT2 0x1f2
 #define KEY_BRL_DOT3 0x1f3
@@ -508,10 +534,75 @@
 #define KEY_BRL_DOT6 0x1f6
 #define KEY_BRL_DOT7 0x1f7
 #define KEY_BRL_DOT8 0x1f8
-
+#define KEY_BRL_DOT9 0x1f9
+#define KEY_BRL_DOT10 0x1fa
+#define KEY_NUMERIC_0 0x200
+#define KEY_NUMERIC_1 0x201
+#define KEY_NUMERIC_2 0x202
+#define KEY_NUMERIC_3 0x203
+#define KEY_NUMERIC_4 0x204
+#define KEY_NUMERIC_5 0x205
+#define KEY_NUMERIC_6 0x206
+#define KEY_NUMERIC_7 0x207
+#define KEY_NUMERIC_8 0x208
+#define KEY_NUMERIC_9 0x209
+#define KEY_NUMERIC_STAR 0x20a
+#define KEY_NUMERIC_POUND 0x20b
+#define KEY_CAMERA_FOCUS 0x210
+#define KEY_WPS_BUTTON 0x211
+#define KEY_TOUCHPAD_TOGGLE 0x212
+#define KEY_TOUCHPAD_ON 0x213
+#define KEY_TOUCHPAD_OFF 0x214
+#define KEY_CAMERA_ZOOMIN 0x215
+#define KEY_CAMERA_ZOOMOUT 0x216
+#define KEY_CAMERA_UP 0x217
+#define KEY_CAMERA_DOWN 0x218
+#define KEY_CAMERA_LEFT 0x219
+#define KEY_CAMERA_RIGHT 0x21a
+#define BTN_TRIGGER_HAPPY 0x2c0
+#define BTN_TRIGGER_HAPPY1 0x2c0
+#define BTN_TRIGGER_HAPPY2 0x2c1
+#define BTN_TRIGGER_HAPPY3 0x2c2
+#define BTN_TRIGGER_HAPPY4 0x2c3
+#define BTN_TRIGGER_HAPPY5 0x2c4
+#define BTN_TRIGGER_HAPPY6 0x2c5
+#define BTN_TRIGGER_HAPPY7 0x2c6
+#define BTN_TRIGGER_HAPPY8 0x2c7
+#define BTN_TRIGGER_HAPPY9 0x2c8
+#define BTN_TRIGGER_HAPPY10 0x2c9
+#define BTN_TRIGGER_HAPPY11 0x2ca
+#define BTN_TRIGGER_HAPPY12 0x2cb
+#define BTN_TRIGGER_HAPPY13 0x2cc
+#define BTN_TRIGGER_HAPPY14 0x2cd
+#define BTN_TRIGGER_HAPPY15 0x2ce
+#define BTN_TRIGGER_HAPPY16 0x2cf
+#define BTN_TRIGGER_HAPPY17 0x2d0
+#define BTN_TRIGGER_HAPPY18 0x2d1
+#define BTN_TRIGGER_HAPPY19 0x2d2
+#define BTN_TRIGGER_HAPPY20 0x2d3
+#define BTN_TRIGGER_HAPPY21 0x2d4
+#define BTN_TRIGGER_HAPPY22 0x2d5
+#define BTN_TRIGGER_HAPPY23 0x2d6
+#define BTN_TRIGGER_HAPPY24 0x2d7
+#define BTN_TRIGGER_HAPPY25 0x2d8
+#define BTN_TRIGGER_HAPPY26 0x2d9
+#define BTN_TRIGGER_HAPPY27 0x2da
+#define BTN_TRIGGER_HAPPY28 0x2db
+#define BTN_TRIGGER_HAPPY29 0x2dc
+#define BTN_TRIGGER_HAPPY30 0x2dd
+#define BTN_TRIGGER_HAPPY31 0x2de
+#define BTN_TRIGGER_HAPPY32 0x2df
+#define BTN_TRIGGER_HAPPY33 0x2e0
+#define BTN_TRIGGER_HAPPY34 0x2e1
+#define BTN_TRIGGER_HAPPY35 0x2e2
+#define BTN_TRIGGER_HAPPY36 0x2e3
+#define BTN_TRIGGER_HAPPY37 0x2e4
+#define BTN_TRIGGER_HAPPY38 0x2e5
+#define BTN_TRIGGER_HAPPY39 0x2e6
+#define BTN_TRIGGER_HAPPY40 0x2e7
 #define KEY_MIN_INTERESTING KEY_MUTE
-#define KEY_MAX 0x1ff
-
+#define KEY_MAX 0x2ff
+#define KEY_CNT (KEY_MAX+1)
 #define REL_X 0x00
 #define REL_Y 0x01
 #define REL_Z 0x02
@@ -523,7 +614,7 @@
 #define REL_WHEEL 0x08
 #define REL_MISC 0x09
 #define REL_MAX 0x0f
-
+#define REL_CNT (REL_MAX+1)
 #define ABS_X 0x00
 #define ABS_Y 0x01
 #define ABS_Z 0x02
@@ -550,20 +641,44 @@
 #define ABS_TOOL_WIDTH 0x1c
 #define ABS_VOLUME 0x20
 #define ABS_MISC 0x28
+#define ABS_MT_SLOT 0x2f
+#define ABS_MT_TOUCH_MAJOR 0x30
+#define ABS_MT_TOUCH_MINOR 0x31
+#define ABS_MT_WIDTH_MAJOR 0x32
+#define ABS_MT_WIDTH_MINOR 0x33
+#define ABS_MT_ORIENTATION 0x34
+#define ABS_MT_POSITION_X 0x35
+#define ABS_MT_POSITION_Y 0x36
+#define ABS_MT_TOOL_TYPE 0x37
+#define ABS_MT_BLOB_ID 0x38
+#define ABS_MT_TRACKING_ID 0x39
+#define ABS_MT_PRESSURE 0x3a
+#define ABS_MT_DISTANCE 0x3b
 #define ABS_MAX 0x3f
-
-#define SW_LID 0x00  
-#define SW_TABLET_MODE 0x01  
-#define SW_HEADPHONE_INSERT 0x02  
+#define ABS_CNT (ABS_MAX+1)
+#define SW_LID 0x00
+#define SW_TABLET_MODE 0x01
+#define SW_HEADPHONE_INSERT 0x02
+#define SW_RFKILL_ALL 0x03
+#define SW_RADIO SW_RFKILL_ALL
+#define SW_MICROPHONE_INSERT 0x04
+#define SW_DOCK 0x05
+#define SW_LINEOUT_INSERT 0x06
+#define SW_JACK_PHYSICAL_INSERT 0x07
+#define SW_VIDEOOUT_INSERT 0x08
+#define SW_CAMERA_LENS_COVER 0x09
+#define SW_KEYPAD_SLIDE 0x0a
+#define SW_FRONT_PROXIMITY 0x0b
+#define SW_ROTATE_LOCK 0x0c
 #define SW_MAX 0x0f
-
+#define SW_CNT (SW_MAX+1)
 #define MSC_SERIAL 0x00
 #define MSC_PULSELED 0x01
 #define MSC_GESTURE 0x02
 #define MSC_RAW 0x03
 #define MSC_SCAN 0x04
 #define MSC_MAX 0x07
-
+#define MSC_CNT (MSC_MAX+1)
 #define LED_NUML 0x00
 #define LED_CAPSL 0x01
 #define LED_SCROLLL 0x02
@@ -576,27 +691,26 @@
 #define LED_MAIL 0x09
 #define LED_CHARGING 0x0a
 #define LED_MAX 0x0f
-
+#define LED_CNT (LED_MAX+1)
 #define REP_DELAY 0x00
 #define REP_PERIOD 0x01
 #define REP_MAX 0x01
-
+#define REP_CNT (REP_MAX+1)
 #define SND_CLICK 0x00
 #define SND_BELL 0x01
 #define SND_TONE 0x02
 #define SND_MAX 0x07
-
+#define SND_CNT (SND_MAX+1)
 #define ID_BUS 0
 #define ID_VENDOR 1
 #define ID_PRODUCT 2
 #define ID_VERSION 3
-
 #define BUS_PCI 0x01
 #define BUS_ISAPNP 0x02
 #define BUS_USB 0x03
 #define BUS_HIL 0x04
 #define BUS_BLUETOOTH 0x05
-
+#define BUS_VIRTUAL 0x06
 #define BUS_ISA 0x10
 #define BUS_I8042 0x11
 #define BUS_XTKBD 0x12
@@ -608,80 +722,65 @@
 #define BUS_I2C 0x18
 #define BUS_HOST 0x19
 #define BUS_GSC 0x1A
-
+#define BUS_ATARI 0x1B
+#define BUS_SPI 0x1C
+#define MT_TOOL_FINGER 0
+#define MT_TOOL_PEN 1
+#define MT_TOOL_MAX 1
 #define FF_STATUS_STOPPED 0x00
 #define FF_STATUS_PLAYING 0x01
 #define FF_STATUS_MAX 0x01
-
 struct ff_replay {
  __u16 length;
  __u16 delay;
 };
-
 struct ff_trigger {
  __u16 button;
  __u16 interval;
 };
-
 struct ff_envelope {
  __u16 attack_length;
  __u16 attack_level;
  __u16 fade_length;
  __u16 fade_level;
 };
-
 struct ff_constant_effect {
  __s16 level;
  struct ff_envelope envelope;
 };
-
 struct ff_ramp_effect {
  __s16 start_level;
  __s16 end_level;
  struct ff_envelope envelope;
 };
-
 struct ff_condition_effect {
  __u16 right_saturation;
  __u16 left_saturation;
-
  __s16 right_coeff;
  __s16 left_coeff;
-
  __u16 deadband;
  __s16 center;
-
 };
-
 struct ff_periodic_effect {
  __u16 waveform;
  __u16 period;
  __s16 magnitude;
  __s16 offset;
  __u16 phase;
-
  struct ff_envelope envelope;
-
  __u32 custom_len;
  __s16 *custom_data;
-
 };
-
 struct ff_rumble_effect {
  __u16 strong_magnitude;
  __u16 weak_magnitude;
 };
-
 struct ff_effect {
  __u16 type;
-
  __s16 id;
-
  __u16 direction;
-
  struct ff_trigger trigger;
  struct ff_replay replay;
-
  union {
  struct ff_constant_effect constant;
  struct ff_ramp_effect ramp;
@@ -690,7 +789,6 @@
  struct ff_rumble_effect rumble;
  } u;
 };
-
 #define FF_RUMBLE 0x50
 #define FF_PERIODIC 0x51
 #define FF_CONSTANT 0x52
@@ -699,17 +797,19 @@
 #define FF_DAMPER 0x55
 #define FF_INERTIA 0x56
 #define FF_RAMP 0x57
-
+#define FF_EFFECT_MIN FF_RUMBLE
+#define FF_EFFECT_MAX FF_RAMP
 #define FF_SQUARE 0x58
 #define FF_TRIANGLE 0x59
 #define FF_SINE 0x5a
 #define FF_SAW_UP 0x5b
 #define FF_SAW_DOWN 0x5c
 #define FF_CUSTOM 0x5d
-
+#define FF_WAVEFORM_MIN FF_SQUARE
+#define FF_WAVEFORM_MAX FF_CUSTOM
 #define FF_GAIN 0x60
 #define FF_AUTOCENTER 0x61
-
 #define FF_MAX 0x7f
-
+#define FF_CNT (FF_MAX+1)
 #endif
+
diff --git a/libc/kernel/common/linux/ion.h b/libc/kernel/common/linux/ion.h
new file mode 100644
index 0000000..ac8b264
--- /dev/null
+++ b/libc/kernel/common/linux/ion.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_ION_H
+#define _LINUX_ION_H
+#include <linux/types.h>
+struct ion_handle;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum ion_heap_type {
+ ION_HEAP_TYPE_SYSTEM,
+ ION_HEAP_TYPE_SYSTEM_CONTIG,
+ ION_HEAP_TYPE_CARVEOUT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ ION_HEAP_TYPE_CUSTOM,
+ ION_NUM_HEAPS,
+};
+#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
+#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
+struct ion_allocation_data {
+ size_t len;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ size_t align;
+ unsigned int flags;
+ struct ion_handle *handle;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct ion_fd_data {
+ struct ion_handle *handle;
+ int fd;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct ion_handle_data {
+ struct ion_handle *handle;
+};
+struct ion_custom_data {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int cmd;
+ unsigned long arg;
+};
+#define ION_IOC_MAGIC 'I'
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0,   struct ion_allocation_data)
+#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
+#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
+#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int)
+#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
+#endif
+
diff --git a/libc/kernel/common/linux/ipv6.h b/libc/kernel/common/linux/ipv6.h
new file mode 100644
index 0000000..f4ee9a1
--- /dev/null
+++ b/libc/kernel/common/linux/ipv6.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _IPV6_H
+#define _IPV6_H
+
+#include <linux/types.h>
+#include <linux/in6.h>
+#include <asm/byteorder.h>
+
+#define IPV6_MIN_MTU 1280
+
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr;
+ int ipi6_ifindex;
+};
+
+struct ip6_mtuinfo {
+ struct sockaddr_in6 ip6m_addr;
+ __u32 ip6m_mtu;
+};
+
+struct in6_ifreq {
+ struct in6_addr ifr6_addr;
+ __u32 ifr6_prefixlen;
+ int ifr6_ifindex;
+};
+
+#define IPV6_SRCRT_STRICT 0x01  
+#define IPV6_SRCRT_TYPE_0 0  
+#define IPV6_SRCRT_TYPE_2 2  
+
+struct ipv6_rt_hdr {
+ __u8 nexthdr;
+ __u8 hdrlen;
+ __u8 type;
+ __u8 segments_left;
+
+};
+
+struct ipv6_opt_hdr {
+ __u8 nexthdr;
+ __u8 hdrlen;
+
+} __attribute__((packed));
+
+#define ipv6_destopt_hdr ipv6_opt_hdr
+#define ipv6_hopopt_hdr ipv6_opt_hdr
+
+struct rt0_hdr {
+ struct ipv6_rt_hdr rt_hdr;
+ __u32 reserved;
+ struct in6_addr addr[0];
+
+#define rt0_type rt_hdr.type
+};
+
+struct rt2_hdr {
+ struct ipv6_rt_hdr rt_hdr;
+ __u32 reserved;
+ struct in6_addr addr;
+
+#define rt2_type rt_hdr.type
+};
+
+struct ipv6_destopt_hao {
+ __u8 type;
+ __u8 length;
+ struct in6_addr addr;
+} __attribute__((packed));
+
+struct ipv6hdr {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+ __u8 priority:4,
+ version:4;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+ __u8 version:4,
+ priority:4;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __u8 flow_lbl[3];
+
+ __be16 payload_len;
+ __u8 nexthdr;
+ __u8 hop_limit;
+
+ struct in6_addr saddr;
+ struct in6_addr daddr;
+};
+
+enum {
+ DEVCONF_FORWARDING = 0,
+ DEVCONF_HOPLIMIT,
+ DEVCONF_MTU6,
+ DEVCONF_ACCEPT_RA,
+ DEVCONF_ACCEPT_REDIRECTS,
+ DEVCONF_AUTOCONF,
+ DEVCONF_DAD_TRANSMITS,
+ DEVCONF_RTR_SOLICITS,
+ DEVCONF_RTR_SOLICIT_INTERVAL,
+ DEVCONF_RTR_SOLICIT_DELAY,
+ DEVCONF_USE_TEMPADDR,
+ DEVCONF_TEMP_VALID_LFT,
+ DEVCONF_TEMP_PREFERED_LFT,
+ DEVCONF_REGEN_MAX_RETRY,
+ DEVCONF_MAX_DESYNC_FACTOR,
+ DEVCONF_MAX_ADDRESSES,
+ DEVCONF_FORCE_MLD_VERSION,
+ DEVCONF_ACCEPT_RA_DEFRTR,
+ DEVCONF_ACCEPT_RA_PINFO,
+ DEVCONF_ACCEPT_RA_RTR_PREF,
+ DEVCONF_RTR_PROBE_INTERVAL,
+ DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
+ DEVCONF_PROXY_NDP,
+ DEVCONF_OPTIMISTIC_DAD,
+ DEVCONF_ACCEPT_SOURCE_ROUTE,
+ DEVCONF_MC_FORWARDING,
+ DEVCONF_DISABLE_IPV6,
+ DEVCONF_ACCEPT_DAD,
+ DEVCONF_FORCE_TLLAO,
+ DEVCONF_MAX
+};
+
+#endif
diff --git a/libc/kernel/common/linux/leds-an30259a.h b/libc/kernel/common/linux/leds-an30259a.h
new file mode 100644
index 0000000..cae8f45
--- /dev/null
+++ b/libc/kernel/common/linux/leds-an30259a.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LEDS_AN30259A_H
+#define _LEDS_AN30259A_H
+#include <linux/ioctl.h>
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define LED_LIGHT_OFF 0
+#define LED_LIGHT_ON 1
+#define LED_LIGHT_PULSE 2
+#define LED_LIGHT_SLOPE 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct an30259a_pr_control {
+ __u32 color;
+ __u32 state;
+ __u16 start_delay;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 time_slope_up_1;
+ __u16 time_slope_up_2;
+ __u16 time_on;
+ __u16 time_slope_down_1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 time_slope_down_2;
+ __u16 time_off;
+ __u8 mid_brightness;
+} __packed;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define AN30259A_PR_SET_LED _IOW('S', 42, struct an30259a_pr_control)
+#define AN30259A_PR_SET_LEDS _IOW('S', 43, struct an30259a_pr_control[3])
+#define AN30259A_PR_SET_IMAX _IOW('S', 44, __u8)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/common/linux/mroute6.h b/libc/kernel/common/linux/mroute6.h
new file mode 100644
index 0000000..2b151b9
--- /dev/null
+++ b/libc/kernel/common/linux/mroute6.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_MROUTE6_H
+#define __LINUX_MROUTE6_H
+
+#include <linux/types.h>
+#include <linux/sockios.h>
+
+#define MRT6_BASE 200
+#define MRT6_INIT (MRT6_BASE)  
+#define MRT6_DONE (MRT6_BASE+1)  
+#define MRT6_ADD_MIF (MRT6_BASE+2)  
+#define MRT6_DEL_MIF (MRT6_BASE+3)  
+#define MRT6_ADD_MFC (MRT6_BASE+4)  
+#define MRT6_DEL_MFC (MRT6_BASE+5)  
+#define MRT6_VERSION (MRT6_BASE+6)  
+#define MRT6_ASSERT (MRT6_BASE+7)  
+#define MRT6_PIM (MRT6_BASE+8)  
+#define MRT6_TABLE (MRT6_BASE+9)  
+
+#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE  
+#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
+#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
+
+#define MAXMIFS 32
+typedef unsigned long mifbitmap_t;
+typedef unsigned short mifi_t;
+#define ALL_MIFS ((mifi_t)(-1))
+
+#ifndef IF_SETSIZE
+#define IF_SETSIZE 256
+#endif
+
+typedef __u32 if_mask;
+#define NIFBITS (sizeof(if_mask) * 8)  
+
+#ifndef DIV_ROUND_UP
+#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
+#endif
+
+typedef struct if_set {
+ if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
+} if_set;
+
+#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
+#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
+#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
+#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
+#define IF_ZERO(p) bzero(p, sizeof(*(p)))
+
+struct mif6ctl {
+ mifi_t mif6c_mifi;
+ unsigned char mif6c_flags;
+ unsigned char vifc_threshold;
+ __u16 mif6c_pifi;
+ unsigned int vifc_rate_limit;
+};
+
+#define MIFF_REGISTER 0x1  
+
+struct mf6cctl {
+ struct sockaddr_in6 mf6cc_origin;
+ struct sockaddr_in6 mf6cc_mcastgrp;
+ mifi_t mf6cc_parent;
+ struct if_set mf6cc_ifset;
+};
+
+struct sioc_sg_req6 {
+ struct sockaddr_in6 src;
+ struct sockaddr_in6 grp;
+ unsigned long pktcnt;
+ unsigned long bytecnt;
+ unsigned long wrong_if;
+};
+
+struct sioc_mif_req6 {
+ mifi_t mifi;
+ unsigned long icount;
+ unsigned long ocount;
+ unsigned long ibytes;
+ unsigned long obytes;
+};
+
+struct mrt6msg {
+#define MRT6MSG_NOCACHE 1
+#define MRT6MSG_WRONGMIF 2
+#define MRT6MSG_WHOLEPKT 3  
+ __u8 im6_mbz;
+ __u8 im6_msgtype;
+ __u16 im6_mif;
+ __u32 im6_pad;
+ struct in6_addr im6_src, im6_dst;
+};
+
+#endif
diff --git a/libc/kernel/common/linux/netfilter.h b/libc/kernel/common/linux/netfilter.h
index 0488344..ce8d394 100644
--- a/libc/kernel/common/linux/netfilter.h
+++ b/libc/kernel/common/linux/netfilter.h
@@ -7,30 +7,66 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef __LINUX_NETFILTER_H
 #define __LINUX_NETFILTER_H
-
+#include <linux/types.h>
 #include <linux/compiler.h>
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define NF_DROP 0
 #define NF_ACCEPT 1
 #define NF_STOLEN 2
 #define NF_QUEUE 3
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define NF_REPEAT 4
 #define NF_STOP 5
 #define NF_MAX_VERDICT NF_STOP
-
 #define NF_VERDICT_MASK 0x0000ffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define NF_VERDICT_BITS 16
-
 #define NF_VERDICT_QMASK 0xffff0000
 #define NF_VERDICT_QBITS 16
-
-#define NF_QUEUE_NR(x) (((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK) | NF_QUEUE)
-
+#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define NFC_UNKNOWN 0x4000
 #define NFC_ALTERED 0x8000
-
+enum nf_inet_hooks {
+ NF_INET_PRE_ROUTING,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ NF_INET_LOCAL_IN,
+ NF_INET_FORWARD,
+ NF_INET_LOCAL_OUT,
+ NF_INET_POST_ROUTING,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ NF_INET_NUMHOOKS
+};
+enum {
+ NFPROTO_UNSPEC = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ NFPROTO_IPV4 = 2,
+ NFPROTO_ARP = 3,
+ NFPROTO_BRIDGE = 7,
+ NFPROTO_IPV6 = 10,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ NFPROTO_DECNET = 12,
+ NFPROTO_NUMPROTO,
+};
+union nf_inet_addr {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 all[4];
+ __be32 ip;
+ __be32 ip6[4];
+ struct in_addr in;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct in6_addr in6;
+};
 #endif
+
diff --git a/libc/kernel/common/linux/netfilter/nfnetlink_conntrack.h b/libc/kernel/common/linux/netfilter/nfnetlink_conntrack.h
index 105dd09..0b1b356 100644
--- a/libc/kernel/common/linux/netfilter/nfnetlink_conntrack.h
+++ b/libc/kernel/common/linux/netfilter/nfnetlink_conntrack.h
@@ -7,140 +7,206 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _IPCONNTRACK_NETLINK_H
 #define _IPCONNTRACK_NETLINK_H
 #include <linux/netfilter/nfnetlink.h>
-
 enum cntl_msg_types {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  IPCTNL_MSG_CT_NEW,
  IPCTNL_MSG_CT_GET,
  IPCTNL_MSG_CT_DELETE,
  IPCTNL_MSG_CT_GET_CTRZERO,
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  IPCTNL_MSG_MAX
 };
-
 enum ctnl_exp_msg_types {
  IPCTNL_MSG_EXP_NEW,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  IPCTNL_MSG_EXP_GET,
  IPCTNL_MSG_EXP_DELETE,
-
  IPCTNL_MSG_EXP_MAX
 };
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum ctattr_type {
  CTA_UNSPEC,
  CTA_TUPLE_ORIG,
  CTA_TUPLE_REPLY,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_STATUS,
  CTA_PROTOINFO,
  CTA_HELP,
  CTA_NAT_SRC,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CTA_NAT CTA_NAT_SRC  
  CTA_TIMEOUT,
  CTA_MARK,
  CTA_COUNTERS_ORIG,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_COUNTERS_REPLY,
  CTA_USE,
  CTA_ID,
  CTA_NAT_DST,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_TUPLE_MASTER,
+ CTA_NAT_SEQ_ADJ_ORIG,
+ CTA_NAT_SEQ_ADJ_REPLY,
+ CTA_SECMARK,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_ZONE,
  __CTA_MAX
 };
 #define CTA_MAX (__CTA_MAX - 1)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum ctattr_tuple {
  CTA_TUPLE_UNSPEC,
  CTA_TUPLE_IP,
  CTA_TUPLE_PROTO,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  __CTA_TUPLE_MAX
 };
 #define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1)
-
 enum ctattr_ip {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_IP_UNSPEC,
  CTA_IP_V4_SRC,
  CTA_IP_V4_DST,
  CTA_IP_V6_SRC,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_IP_V6_DST,
  __CTA_IP_MAX
 };
 #define CTA_IP_MAX (__CTA_IP_MAX - 1)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum ctattr_l4proto {
  CTA_PROTO_UNSPEC,
  CTA_PROTO_NUM,
  CTA_PROTO_SRC_PORT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_PROTO_DST_PORT,
  CTA_PROTO_ICMP_ID,
  CTA_PROTO_ICMP_TYPE,
  CTA_PROTO_ICMP_CODE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_PROTO_ICMPV6_ID,
  CTA_PROTO_ICMPV6_TYPE,
  CTA_PROTO_ICMPV6_CODE,
  __CTA_PROTO_MAX
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1)
-
 enum ctattr_protoinfo {
  CTA_PROTOINFO_UNSPEC,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_PROTOINFO_TCP,
+ CTA_PROTOINFO_DCCP,
+ CTA_PROTOINFO_SCTP,
  __CTA_PROTOINFO_MAX
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
-
 enum ctattr_protoinfo_tcp {
  CTA_PROTOINFO_TCP_UNSPEC,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_PROTOINFO_TCP_STATE,
+ CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
+ CTA_PROTOINFO_TCP_WSCALE_REPLY,
+ CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_PROTOINFO_TCP_FLAGS_REPLY,
  __CTA_PROTOINFO_TCP_MAX
 };
 #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum ctattr_protoinfo_dccp {
+ CTA_PROTOINFO_DCCP_UNSPEC,
+ CTA_PROTOINFO_DCCP_STATE,
+ CTA_PROTOINFO_DCCP_ROLE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ,
+ __CTA_PROTOINFO_DCCP_MAX,
+};
+#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum ctattr_protoinfo_sctp {
+ CTA_PROTOINFO_SCTP_UNSPEC,
+ CTA_PROTOINFO_SCTP_STATE,
+ CTA_PROTOINFO_SCTP_VTAG_ORIGINAL,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_PROTOINFO_SCTP_VTAG_REPLY,
+ __CTA_PROTOINFO_SCTP_MAX
+};
+#define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum ctattr_counters {
  CTA_COUNTERS_UNSPEC,
  CTA_COUNTERS_PACKETS,
  CTA_COUNTERS_BYTES,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_COUNTERS32_PACKETS,
  CTA_COUNTERS32_BYTES,
  __CTA_COUNTERS_MAX
 };
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
-
 enum ctattr_nat {
  CTA_NAT_UNSPEC,
  CTA_NAT_MINIP,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_NAT_MAXIP,
  CTA_NAT_PROTO,
  __CTA_NAT_MAX
 };
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define CTA_NAT_MAX (__CTA_NAT_MAX - 1)
-
 enum ctattr_protonat {
  CTA_PROTONAT_UNSPEC,
  CTA_PROTONAT_PORT_MIN,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_PROTONAT_PORT_MAX,
  __CTA_PROTONAT_MAX
 };
 #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum ctattr_natseq {
+ CTA_NAT_SEQ_UNSPEC,
+ CTA_NAT_SEQ_CORRECTION_POS,
+ CTA_NAT_SEQ_OFFSET_BEFORE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_NAT_SEQ_OFFSET_AFTER,
+ __CTA_NAT_SEQ_MAX
+};
+#define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum ctattr_expect {
  CTA_EXPECT_UNSPEC,
  CTA_EXPECT_MASTER,
  CTA_EXPECT_TUPLE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  CTA_EXPECT_MASK,
  CTA_EXPECT_TIMEOUT,
  CTA_EXPECT_ID,
  CTA_EXPECT_HELP_NAME,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CTA_EXPECT_ZONE,
  __CTA_EXPECT_MAX
 };
 #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 enum ctattr_help {
  CTA_HELP_UNSPEC,
  CTA_HELP_NAME,
  __CTA_HELP_MAX
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
 #define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
-
 #endif
+
diff --git a/libc/kernel/common/linux/netfilter_ipv6.h b/libc/kernel/common/linux/netfilter_ipv6.h
index 0d68cd9..ce2f12c 100644
--- a/libc/kernel/common/linux/netfilter_ipv6.h
+++ b/libc/kernel/common/linux/netfilter_ipv6.h
@@ -52,13 +52,13 @@
 enum nf_ip6_hook_priorities {
  NF_IP6_PRI_FIRST = INT_MIN,
  NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
+ NF_IP6_PRI_RAW = -300,
  NF_IP6_PRI_SELINUX_FIRST = -225,
  NF_IP6_PRI_CONNTRACK = -200,
- NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175,
  NF_IP6_PRI_MANGLE = -150,
  NF_IP6_PRI_NAT_DST = -100,
- NF_IP6_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50,
  NF_IP6_PRI_FILTER = 0,
+ NF_IP6_PRI_SECURITY = 50,
  NF_IP6_PRI_NAT_SRC = 100,
  NF_IP6_PRI_SELINUX_LAST = 225,
  NF_IP6_PRI_LAST = INT_MAX,
diff --git a/libc/kernel/common/linux/nvhdcp.h b/libc/kernel/common/linux/nvhdcp.h
new file mode 100644
index 0000000..d21ea55
--- /dev/null
+++ b/libc/kernel/common/linux/nvhdcp.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_NVHDCP_H_
+#define _LINUX_NVHDCP_H_
+#include <linux/fb.h>
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/ioctl.h>
+#define TEGRA_NVHDCP_MAX_DEVS 127
+#define TEGRA_NVHDCP_FLAG_AN 0x0001
+#define TEGRA_NVHDCP_FLAG_AKSV 0x0002
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRA_NVHDCP_FLAG_BKSV 0x0004
+#define TEGRA_NVHDCP_FLAG_BSTATUS 0x0008  
+#define TEGRA_NVHDCP_FLAG_CN 0x0010  
+#define TEGRA_NVHDCP_FLAG_CKSV 0x0020  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRA_NVHDCP_FLAG_DKSV 0x0040  
+#define TEGRA_NVHDCP_FLAG_KP 0x0080  
+#define TEGRA_NVHDCP_FLAG_S 0x0100  
+#define TEGRA_NVHDCP_FLAG_CS 0x0200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRA_NVHDCP_FLAG_V 0x0400
+#define TEGRA_NVHDCP_FLAG_MP 0x0800
+#define TEGRA_NVHDCP_FLAG_BKSVLIST 0x1000
+#define TEGRA_NVHDCP_RESULT_SUCCESS 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRA_NVHDCP_RESULT_UNSUCCESSFUL 1
+#define TEGRA_NVHDCP_RESULT_PENDING 0x103
+#define TEGRA_NVHDCP_RESULT_LINK_FAILED 0xc0000013
+#define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER 0xc000000d
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER_MIX 0xc0000030
+#define TEGRA_NVHDCP_RESULT_NO_MEMORY 0xc0000017
+struct tegra_nvhdcp_packet {
+ __u32 value_flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 packet_results;
+ __u64 c_n;
+ __u64 c_ksv;
+ __u32 b_status;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 hdcp_status;
+ __u64 cs;
+ __u64 k_prime;
+ __u64 a_n;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 a_ksv;
+ __u64 b_ksv;
+ __u64 d_ksv;
+ __u8 v_prime[20];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 m_prime;
+ __u32 num_bksv_list;
+ __u64 bksv_list[TEGRA_NVHDCP_MAX_DEVS];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRA_NVHDCP_POLICY_ON_DEMAND 0
+#define TEGRA_NVHDCP_POLICY_ALWAYS_ON 1
+#define TEGRAIO_NVHDCP_ON _IO('F', 0x70)
+#define TEGRAIO_NVHDCP_OFF _IO('F', 0x71)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TEGRAIO_NVHDCP_SET_POLICY _IOW('F', 0x72, __u32)
+#define TEGRAIO_NVHDCP_READ_M _IOWR('F', 0x73, struct tegra_nvhdcp_packet)
+#define TEGRAIO_NVHDCP_READ_S _IOWR('F', 0x74, struct tegra_nvhdcp_packet)
+#define TEGRAIO_NVHDCP_RENEGOTIATE _IO('F', 0x75)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+
diff --git a/libc/kernel/common/linux/omap_ion.h b/libc/kernel/common/linux/omap_ion.h
new file mode 100644
index 0000000..216533e
--- /dev/null
+++ b/libc/kernel/common/linux/omap_ion.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_OMAP_ION_H
+#define _LINUX_OMAP_ION_H
+#include <linux/types.h>
+struct omap_ion_tiler_alloc_data {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ size_t w;
+ size_t h;
+ int fmt;
+ unsigned int flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct ion_handle *handle;
+ size_t stride;
+ size_t offset;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1,
+};
+#define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ OMAP_ION_TILER_ALLOC,
+};
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ TILER_PIXEL_FMT_MIN = 0,
+ TILER_PIXEL_FMT_8BIT = 0,
+ TILER_PIXEL_FMT_16BIT = 1,
+ TILER_PIXEL_FMT_32BIT = 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ TILER_PIXEL_FMT_PAGE = 3,
+ TILER_PIXEL_FMT_MAX = 3
+};
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_ION_HEAP_LARGE_SURFACES,
+ OMAP_ION_HEAP_TILER,
+ OMAP_ION_HEAP_SECURE_INPUT,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+
diff --git a/libc/kernel/common/linux/rpmsg_omx.h b/libc/kernel/common/linux/rpmsg_omx.h
new file mode 100644
index 0000000..2a757bc
--- /dev/null
+++ b/libc/kernel/common/linux/rpmsg_omx.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef RPMSG_OMX_H
+#define RPMSG_OMX_H
+#include <linux/ioctl.h>
+#define OMX_IOC_MAGIC 'X'
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define OMX_IOCCONNECT _IOW(OMX_IOC_MAGIC, 1, char *)
+#define OMX_IOCIONREGISTER _IOWR(OMX_IOC_MAGIC, 2, struct ion_fd_data)
+#define OMX_IOCIONUNREGISTER _IOWR(OMX_IOC_MAGIC, 3, struct ion_fd_data)
+#define OMX_IOC_MAXNR (3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct omx_conn_req {
+ char name[48];
+} __packed;
+struct omx_packet {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint16_t desc;
+ uint16_t msg_id;
+ uint32_t flags;
+ uint32_t fxn_idx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int32_t result;
+ uint32_t data_size;
+ uint32_t data[0];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+
diff --git a/libc/kernel/common/linux/stddef.h b/libc/kernel/common/linux/stddef.h
index 5412f47..cca408c 100644
--- a/libc/kernel/common/linux/stddef.h
+++ b/libc/kernel/common/linux/stddef.h
@@ -7,25 +7,24 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef _LINUX_STDDEF_H
 #define _LINUX_STDDEF_H
-
 #include <linux/compiler.h>
-
 #undef NULL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #ifdef __cplusplus
 #define NULL 0
 #else
 #define NULL ((void *)0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
-
-#undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
 #endif
diff --git a/libc/kernel/common/linux/tegrafb.h b/libc/kernel/common/linux/tegrafb.h
index b8e79ae..ea63e04 100644
--- a/libc/kernel/common/linux/tegrafb.h
+++ b/libc/kernel/common/linux/tegrafb.h
@@ -43,9 +43,14 @@
 #define TEGRA_FB_WIN_BLEND_PREMULT 1
 #define TEGRA_FB_WIN_BLEND_COVERAGE 2
 
+#define TEGRA_FB_WIN_FLAG_INVERT_H (1<<0)
+#define TEGRA_FB_WIN_FLAG_INVERT_V (1<<1)
+#define TEGRA_FB_WIN_FLAG_TILED (1<<2)
+
 struct tegra_fb_windowattr {
  __s32 index;
  __u32 buff_id;
+ __u32 flags;
  __u32 blend;
  __u32 offset;
  __u32 offset_u;
diff --git a/libc/kernel/common/linux/usb/f_accessory.h b/libc/kernel/common/linux/usb/f_accessory.h
index 7ee9b7f..97346b7 100644
--- a/libc/kernel/common/linux/usb/f_accessory.h
+++ b/libc/kernel/common/linux/usb/f_accessory.h
@@ -40,4 +40,5 @@
 #define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256])
 #define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256])
 #define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256])
+#define ACCESSORY_IS_START_REQUESTED _IO('M', 7)
 #endif
diff --git a/libc/kernel/common/linux/usb/f_mtp.h b/libc/kernel/common/linux/usb/f_mtp.h
index a9e37c2..c7e9d1e 100644
--- a/libc/kernel/common/linux/usb/f_mtp.h
+++ b/libc/kernel/common/linux/usb/f_mtp.h
@@ -7,36 +7,34 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 #ifndef __LINUX_USB_F_MTP_H
 #define __LINUX_USB_F_MTP_H
-
-#define MTP_INTERFACE_MODE_MTP 0
-#define MTP_INTERFACE_MODE_PTP 1
-
 struct mtp_file_range {
-
  int fd;
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  loff_t offset;
-
  int64_t length;
+ uint16_t command;
+ uint32_t transaction_id;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
-
 struct mtp_event {
-
  size_t length;
-
  void *data;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 };
-
 #define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
-
 #define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
-
-#define MTP_SET_INTERFACE_MODE _IOW('M', 2, int)
-
 #define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
-
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
 #endif
diff --git a/libc/kernel/common/media/soc2030.h b/libc/kernel/common/media/soc2030.h
index ad0ddfc..850ab13 100644
--- a/libc/kernel/common/media/soc2030.h
+++ b/libc/kernel/common/media/soc2030.h
@@ -12,7 +12,7 @@
 #ifndef __SOC2030_H__
 #define __SOC2030_H__
 
-#include <linux/ioctl.h>  
+#include <linux/ioctl.h>
 
 #define SOC2030_IOCTL_SET_MODE _IOWR('o', 1, struct soc2030_mode)
 #define SOC2030_IOCTL_GET_STATUS _IOC(_IOC_READ, 'o', 2, 10)
@@ -22,10 +22,11 @@
 #define SOC2030_IOCTL_SET_EFFECT _IOWR('o', 6, unsigned int)
 #define SOC2030_IOCTL_SET_WHITEBALANCE _IOWR('o', 7, unsigned int)
 #define SOC2030_IOCTL_SET_EXP_COMP _IOWR('o', 8, int)
+#define SOC2030_IOCTL_SET_LOCK _IOWR('o', 9, struct soc2030_lock)
 
 #define SOC2030_POLL_WAITMS 50
 #define SOC2030_MAX_RETRIES 3
-#define SOC2030_POLL_RETRIES 5
+#define SOC2030_POLL_RETRIES 7
 
 #define SOC2030_MAX_PRIVATE_SIZE 1024
 #define SOC2030_MAX_NUM_MODES 6
@@ -45,8 +46,21 @@
  WRITE_VAR_DATA,
  POLL_VAR_DATA,
  DELAY_MS,
+ WRITE_REG_VAR1,
+ WRITE_REG_VAR2,
+ WRITE_REG_VAR3,
+ WRITE_REG_VAR4,
+ READ_REG_VAR1,
+ READ_REG_VAR2,
+ READ_REG_VAR3,
+ READ_REG_VAR4,
 };
 
+#define REG_VAR1 (READ_REG_VAR1 - READ_REG_VAR1)
+#define REG_VAR2 (READ_REG_VAR2 - READ_REG_VAR1)
+#define REG_VAR3 (READ_REG_VAR3 - READ_REG_VAR1)
+#define REG_VAR4 (READ_REG_VAR4 - READ_REG_VAR1)
+
 enum {
  EFFECT_NONE,
  EFFECT_BW,
@@ -74,6 +88,14 @@
  __u16 val;
 };
 
+struct soc2030_lock {
+        __u8 aelock;
+        __u8 aerelock;
+        __u8 awblock;
+        __u8 awbrelock;
+        __u8 previewactive;
+};
+
 struct soc2030_mode {
  int xres;
  int yres;
@@ -82,5 +104,3 @@
 };
 
 #endif
-
-
diff --git a/libc/kernel/common/sound/asound.h b/libc/kernel/common/sound/asound.h
new file mode 100644
index 0000000..10c749c
--- /dev/null
+++ b/libc/kernel/common/sound/asound.h
@@ -0,0 +1,908 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __SOUND_ASOUND_H
+#define __SOUND_ASOUND_H
+#include <linux/types.h>
+#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
+#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
+#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
+#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion)   (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) ||   (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) &&   SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_aes_iec958 {
+ unsigned char status[24];
+ unsigned char subcode[147];
+ unsigned char pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char dig_subframe[4];
+};
+#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_HWDEP_IFACE_OPL2 = 0,
+ SNDRV_HWDEP_IFACE_OPL3,
+ SNDRV_HWDEP_IFACE_OPL4,
+ SNDRV_HWDEP_IFACE_SB16CSP,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_HWDEP_IFACE_EMU10K1,
+ SNDRV_HWDEP_IFACE_YSS225,
+ SNDRV_HWDEP_IFACE_ICS2115,
+ SNDRV_HWDEP_IFACE_SSCAPE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_HWDEP_IFACE_VX,
+ SNDRV_HWDEP_IFACE_MIXART,
+ SNDRV_HWDEP_IFACE_USX2Y,
+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_HWDEP_IFACE_BLUETOOTH,
+ SNDRV_HWDEP_IFACE_USX2Y_PCM,
+ SNDRV_HWDEP_IFACE_PCXHR,
+ SNDRV_HWDEP_IFACE_SB_RC,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_HWDEP_IFACE_HDA,
+ SNDRV_HWDEP_IFACE_USB_STREAM,
+ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_hwdep_info {
+ unsigned int device;
+ int card;
+ unsigned char id[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char name[80];
+ int iface;
+ unsigned char reserved[64];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_hwdep_dsp_status {
+ unsigned int version;
+ unsigned char id[32];
+ unsigned int num_dsps;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int dsp_loaded;
+ unsigned int chip_ready;
+ unsigned char reserved[16];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_hwdep_dsp_image {
+ unsigned int index;
+ unsigned char name[64];
+ unsigned char __user *image;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ size_t length;
+ unsigned long driver_data;
+};
+#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
+#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
+#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned long snd_pcm_uframes_t;
+typedef signed long snd_pcm_sframes_t;
+enum {
+ SNDRV_PCM_CLASS_GENERIC = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_CLASS_MULTI,
+ SNDRV_PCM_CLASS_MODEM,
+ SNDRV_PCM_CLASS_DIGITIZER,
+ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum {
+ SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0,
+ SNDRV_PCM_SUBCLASS_MULTI_MIX,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
+};
+enum {
+ SNDRV_PCM_STREAM_PLAYBACK = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_STREAM_CAPTURE,
+ SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
+};
+typedef int __bitwise snd_pcm_access_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0)  
+#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1)  
+#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2)  
+#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4)  
+#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
+typedef int __bitwise snd_pcm_format_t;
+#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
+#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
+#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
+#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
+#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6)  
+#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7)  
+#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9)  
+#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
+#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
+#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
+#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14)  
+#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15)  
+#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17)  
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18)  
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19)  
+#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
+#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
+#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
+#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
+#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32)  
+#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33)  
+#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35)  
+#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36)  
+#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37)  
+#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39)  
+#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40)  
+#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41)  
+#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43)  
+#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE
+#ifdef SNDRV_LITTLE_ENDIAN
+#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
+#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
+#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
+#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
+#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
+#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifdef SNDRV_BIG_ENDIAN
+#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
+#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
+#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
+#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
+#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
+#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef int __bitwise snd_pcm_subformat_t;
+#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
+#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
+#define SNDRV_PCM_INFO_MMAP 0x00000001  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002  
+#define SNDRV_PCM_INFO_DOUBLE 0x00000004  
+#define SNDRV_PCM_INFO_BATCH 0x00000010  
+#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200  
+#define SNDRV_PCM_INFO_COMPLEX 0x00000400  
+#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000  
+#define SNDRV_PCM_INFO_OVERRANGE 0x00020000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_INFO_RESUME 0x00040000  
+#define SNDRV_PCM_INFO_PAUSE 0x00080000  
+#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000  
+#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_INFO_SYNC_START 0x00400000  
+#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000  
+typedef int __bitwise snd_pcm_state_t;
+#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1)  
+#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2)  
+#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3)  
+#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5)  
+#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6)  
+#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7)  
+#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
+enum {
+ SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
+ SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
+};
+union snd_pcm_sync_id {
+ unsigned char id[16];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short id16[8];
+ unsigned int id32[4];
+};
+struct snd_pcm_info {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int device;
+ unsigned int subdevice;
+ int stream;
+ int card;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char id[64];
+ unsigned char name[80];
+ unsigned char subname[32];
+ int dev_class;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int dev_subclass;
+ unsigned int subdevices_count;
+ unsigned int subdevices_avail;
+ union snd_pcm_sync_id sync;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char reserved[64];
+};
+typedef int snd_pcm_hw_param_t;
+#define SNDRV_PCM_HW_PARAM_ACCESS 0  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_HW_PARAM_FORMAT 1  
+#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2  
+#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
+#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8  
+#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9  
+#define SNDRV_PCM_HW_PARAM_CHANNELS 10  
+#define SNDRV_PCM_HW_PARAM_RATE 11  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12  
+#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13  
+#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14  
+#define SNDRV_PCM_HW_PARAM_PERIODS 15  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16  
+#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17  
+#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18  
+#define SNDRV_PCM_HW_PARAM_TICK_TIME 19  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
+#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
+#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0)  
+struct snd_interval {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int min, max;
+ unsigned int openmin:1,
+ openmax:1,
+ integer:1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ empty:1;
+};
+#define SNDRV_MASK_MAX 256
+struct snd_mask {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 bits[(SNDRV_MASK_MAX+31)/32];
+};
+struct snd_pcm_hw_params {
+ unsigned int flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
+ SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
+ struct snd_mask mres[5];
+ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
+ struct snd_interval ires[9];
+ unsigned int rmask;
+ unsigned int cmask;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int info;
+ unsigned int msbits;
+ unsigned int rate_num;
+ unsigned int rate_den;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t fifo_size;
+ unsigned char reserved[64];
+};
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_TSTAMP_NONE = 0,
+ SNDRV_PCM_TSTAMP_ENABLE,
+ SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_pcm_sw_params {
+ int tstamp_mode;
+ unsigned int period_step;
+ unsigned int sleep_min;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t avail_min;
+ snd_pcm_uframes_t xfer_align;
+ snd_pcm_uframes_t start_threshold;
+ snd_pcm_uframes_t stop_threshold;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t silence_threshold;
+ snd_pcm_uframes_t silence_size;
+ snd_pcm_uframes_t boundary;
+ unsigned char reserved[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct snd_pcm_channel_info {
+ unsigned int channel;
+ __kernel_off_t offset;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int first;
+ unsigned int step;
+};
+struct snd_pcm_status {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_state_t state;
+ struct timespec trigger_tstamp;
+ struct timespec tstamp;
+ snd_pcm_uframes_t appl_ptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_sframes_t delay;
+ snd_pcm_uframes_t avail;
+ snd_pcm_uframes_t avail_max;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t overrange;
+ snd_pcm_state_t suspended_state;
+ unsigned char reserved[60];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_pcm_mmap_status {
+ snd_pcm_state_t state;
+ int pad1;
+ snd_pcm_uframes_t hw_ptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct timespec tstamp;
+ snd_pcm_state_t suspended_state;
+};
+struct snd_pcm_mmap_control {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t appl_ptr;
+ snd_pcm_uframes_t avail_min;
+};
+#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_SYNC_PTR_APPL (1<<1)  
+#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2)  
+struct snd_pcm_sync_ptr {
+ unsigned int flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ struct snd_pcm_mmap_status status;
+ unsigned char reserved[64];
+ } s;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ struct snd_pcm_mmap_control control;
+ unsigned char reserved[64];
+ } c;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct snd_xferi {
+ snd_pcm_sframes_t result;
+ void __user *buf;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ snd_pcm_uframes_t frames;
+};
+struct snd_xfern {
+ snd_pcm_sframes_t result;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ void __user * __user *bufs;
+ snd_pcm_uframes_t frames;
+};
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,
+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
+ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
+#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
+#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
+#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
+#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
+#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
+#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
+#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
+#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
+#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
+#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
+#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
+#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
+#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
+#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
+#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
+enum {
+ SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_RAWMIDI_STREAM_INPUT,
+ SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
+};
+#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
+#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
+struct snd_rawmidi_info {
+ unsigned int device;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int subdevice;
+ int stream;
+ int card;
+ unsigned int flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char id[64];
+ unsigned char name[80];
+ unsigned char subname[32];
+ unsigned int subdevices_count;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int subdevices_avail;
+ unsigned char reserved[64];
+};
+struct snd_rawmidi_params {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int stream;
+ size_t buffer_size;
+ size_t avail_min;
+ unsigned int no_active_sensing: 1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char reserved[16];
+};
+struct snd_rawmidi_status {
+ int stream;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct timespec tstamp;
+ size_t avail;
+ size_t xruns;
+ unsigned char reserved[16];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
+#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
+#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
+#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
+#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ SNDRV_TIMER_CLASS_NONE = -1,
+ SNDRV_TIMER_CLASS_SLAVE = 0,
+ SNDRV_TIMER_CLASS_GLOBAL,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_TIMER_CLASS_CARD,
+ SNDRV_TIMER_CLASS_PCM,
+ SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ SNDRV_TIMER_SCLASS_NONE = 0,
+ SNDRV_TIMER_SCLASS_APPLICATION,
+ SNDRV_TIMER_SCLASS_SEQUENCER,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
+ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
+};
+#define SNDRV_TIMER_GLOBAL_SYSTEM 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_TIMER_GLOBAL_RTC 1
+#define SNDRV_TIMER_GLOBAL_HPET 2
+#define SNDRV_TIMER_GLOBAL_HRTIMER 3
+#define SNDRV_TIMER_FLG_SLAVE (1<<0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_timer_id {
+ int dev_class;
+ int dev_sclass;
+ int card;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int device;
+ int subdevice;
+};
+struct snd_timer_ginfo {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct snd_timer_id tid;
+ unsigned int flags;
+ int card;
+ unsigned char id[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char name[80];
+ unsigned long reserved0;
+ unsigned long resolution;
+ unsigned long resolution_min;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long resolution_max;
+ unsigned int clients;
+ unsigned char reserved[32];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_timer_gparams {
+ struct snd_timer_id tid;
+ unsigned long period_num;
+ unsigned long period_den;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char reserved[32];
+};
+struct snd_timer_gstatus {
+ struct snd_timer_id tid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long resolution;
+ unsigned long resolution_num;
+ unsigned long resolution_den;
+ unsigned char reserved[32];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct snd_timer_select {
+ struct snd_timer_id id;
+ unsigned char reserved[32];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct snd_timer_info {
+ unsigned int flags;
+ int card;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char id[64];
+ unsigned char name[80];
+ unsigned long reserved0;
+ unsigned long resolution;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char reserved[64];
+};
+#define SNDRV_TIMER_PSFLG_AUTO (1<<0)  
+#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2)  
+struct snd_timer_params {
+ unsigned int flags;
+ unsigned int ticks;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int queue_size;
+ unsigned int reserved0;
+ unsigned int filter;
+ unsigned char reserved[60];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct snd_timer_status {
+ struct timespec tstamp;
+ unsigned int resolution;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int lost;
+ unsigned int overrun;
+ unsigned int queue;
+ unsigned char reserved[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
+#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
+#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
+#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
+#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
+#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
+#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
+#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
+#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
+#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
+#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
+struct snd_timer_read {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int resolution;
+ unsigned int ticks;
+};
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_TIMER_EVENT_RESOLUTION = 0,
+ SNDRV_TIMER_EVENT_TICK,
+ SNDRV_TIMER_EVENT_START,
+ SNDRV_TIMER_EVENT_STOP,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_TIMER_EVENT_CONTINUE,
+ SNDRV_TIMER_EVENT_PAUSE,
+ SNDRV_TIMER_EVENT_EARLY,
+ SNDRV_TIMER_EVENT_SUSPEND,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_TIMER_EVENT_RESUME,
+ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
+ SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
+ SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
+ SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
+ SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct snd_timer_tread {
+ int event;
+ struct timespec tstamp;
+ unsigned int val;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
+struct snd_ctl_card_info {
+ int card;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int pad;
+ unsigned char id[16];
+ unsigned char driver[16];
+ unsigned char name[32];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char longname[80];
+ unsigned char reserved_[16];
+ unsigned char mixername[80];
+ unsigned char components[128];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+typedef int __bitwise snd_ctl_elem_type_t;
+#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0)  
+#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2)  
+#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3)  
+#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4)  
+#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6)  
+#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
+typedef int __bitwise snd_ctl_elem_iface_t;
+#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1)  
+#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2)  
+#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3)  
+#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5)  
+#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6)  
+#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
+#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
+#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
+#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2)  
+#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4)  
+#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5)  
+#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
+#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8)  
+#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9)  
+#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10)  
+#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28)   
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29)  
+#define SNDRV_CTL_POWER_D0 0x0000  
+#define SNDRV_CTL_POWER_D1 0x0100  
+#define SNDRV_CTL_POWER_D2 0x0200  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_POWER_D3 0x0300  
+#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000)  
+#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001)  
+struct snd_ctl_elem_id {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int numid;
+ snd_ctl_elem_iface_t iface;
+ unsigned int device;
+ unsigned int subdevice;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char name[44];
+ unsigned int index;
+};
+struct snd_ctl_elem_list {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int offset;
+ unsigned int space;
+ unsigned int used;
+ unsigned int count;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct snd_ctl_elem_id __user *pids;
+ unsigned char reserved[50];
+};
+struct snd_ctl_elem_info {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct snd_ctl_elem_id id;
+ snd_ctl_elem_type_t type;
+ unsigned int access;
+ unsigned int count;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_pid_t owner;
+ union {
+ struct {
+ long min;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long max;
+ long step;
+ } integer;
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long long min;
+ long long max;
+ long long step;
+ } integer64;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ unsigned int items;
+ unsigned int item;
+ char name[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } enumerated;
+ unsigned char reserved[128];
+ } value;
+ union {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short d[4];
+ unsigned short *d_ptr;
+ } dimen;
+ unsigned char reserved[64-4*sizeof(unsigned short)];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct snd_ctl_elem_value {
+ struct snd_ctl_elem_id id;
+ unsigned int indirect: 1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ union {
+ long value[128];
+ long *value_ptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } integer;
+ union {
+ long long value[64];
+ long long *value_ptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } integer64;
+ union {
+ unsigned int item[128];
+ unsigned int *item_ptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } enumerated;
+ union {
+ unsigned char data[512];
+ unsigned char *data_ptr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } bytes;
+ struct snd_aes_iec958 iec958;
+ } value;
+ struct timespec tstamp;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char reserved[128-sizeof(struct timespec)];
+};
+struct snd_ctl_tlv {
+ unsigned int numid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int length;
+ unsigned int tlv[0];
+};
+#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
+#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
+#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
+#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
+#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
+#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
+#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
+#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
+#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum sndrv_ctl_event_type {
+ SNDRV_CTL_EVENT_ELEM = 0,
+ SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0)  
+#define SNDRV_CTL_EVENT_MASK_INFO (1<<1)  
+#define SNDRV_CTL_EVENT_MASK_ADD (1<<2)  
+#define SNDRV_CTL_EVENT_MASK_TLV (1<<3)  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U)  
+struct snd_ctl_event {
+ int type;
+ union {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
+ unsigned int mask;
+ struct snd_ctl_elem_id id;
+ } elem;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned char data8[60];
+ } data;
+};
+#define SNDRV_CTL_NAME_NONE ""
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_NAME_PLAYBACK "Playback "
+#define SNDRV_CTL_NAME_CAPTURE "Capture "
+#define SNDRV_CTL_NAME_IEC958_NONE ""
+#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
+#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
+#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
+#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
+#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
+#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/common/video/dsscomp.h b/libc/kernel/common/video/dsscomp.h
new file mode 100644
index 0000000..575071f
--- /dev/null
+++ b/libc/kernel/common/video/dsscomp.h
@@ -0,0 +1,372 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_DSSCOMP_H
+#define _LINUX_DSSCOMP_H
+enum omap_plane {
+ OMAP_DSS_GFX = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_VIDEO1 = 1,
+ OMAP_DSS_VIDEO2 = 2,
+ OMAP_DSS_VIDEO3 = 3,
+ OMAP_DSS_WB = 4,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum omap_channel {
+ OMAP_DSS_CHANNEL_LCD = 0,
+ OMAP_DSS_CHANNEL_DIGIT = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_CHANNEL_LCD2 = 2,
+};
+enum omap_color_mode {
+ OMAP_DSS_COLOR_CLUT1 = 1 << 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_CLUT2 = 1 << 1,
+ OMAP_DSS_COLOR_CLUT4 = 1 << 2,
+ OMAP_DSS_COLOR_CLUT8 = 1 << 3,
+ OMAP_DSS_COLOR_RGB12U = 1 << 4,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_ARGB16 = 1 << 5,
+ OMAP_DSS_COLOR_RGB16 = 1 << 6,
+ OMAP_DSS_COLOR_RGB24U = 1 << 7,
+ OMAP_DSS_COLOR_RGB24P = 1 << 8,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_YUV2 = 1 << 9,
+ OMAP_DSS_COLOR_UYVY = 1 << 10,
+ OMAP_DSS_COLOR_ARGB32 = 1 << 11,
+ OMAP_DSS_COLOR_RGBA32 = 1 << 12,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_RGBX24 = 1 << 13,
+ OMAP_DSS_COLOR_RGBX32 = 1 << 13,
+ OMAP_DSS_COLOR_NV12 = 1 << 14,
+ OMAP_DSS_COLOR_RGBA16 = 1 << 15,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_RGBX12 = 1 << 16,
+ OMAP_DSS_COLOR_RGBX16 = 1 << 16,
+ OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17,
+ OMAP_DSS_COLOR_XRGB15 = 1 << 18,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18,
+};
+enum omap_dss_trans_key_type {
+ OMAP_DSS_COLOR_KEY_GFX_DST = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_COLOR_KEY_VID_SRC = 1,
+};
+enum omap_dss_display_state {
+ OMAP_DSS_DISPLAY_DISABLED = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_DISPLAY_ACTIVE,
+ OMAP_DSS_DISPLAY_SUSPENDED,
+ OMAP_DSS_DISPLAY_TRANSITION,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct omap_video_timings {
+ __u16 x_res;
+ __u16 y_res;
+ __u32 pixel_clock;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 hsw;
+ __u16 hfp;
+ __u16 hbp;
+ __u16 vsw;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 vfp;
+ __u16 vbp;
+};
+struct omap_dss_cconv_coefs {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __s16 ry, rcr, rcb;
+ __s16 gy, gcr, gcb;
+ __s16 by, bcr, bcb;
+ __u16 full_range;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} __attribute__ ((aligned(4)));
+struct omap_dss_cpr_coefs {
+ __s16 rr, rg, rb;
+ __s16 gr, gg, gb;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __s16 br, bg, bb;
+};
+struct dsscomp_videomode {
+ const char *name;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 refresh;
+ __u32 xres;
+ __u32 yres;
+ __u32 pixclock;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 left_margin;
+ __u32 right_margin;
+ __u32 upper_margin;
+ __u32 lower_margin;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 hsync_len;
+ __u32 vsync_len;
+ __u32 sync;
+ __u32 vmode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 flag;
+};
+enum s3d_disp_type {
+ S3D_DISP_NONE = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ S3D_DISP_FRAME_SEQ,
+ S3D_DISP_ROW_IL,
+ S3D_DISP_COL_IL,
+ S3D_DISP_PIX_IL,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ S3D_DISP_CHECKB,
+ S3D_DISP_OVERUNDER,
+ S3D_DISP_SIDEBYSIDE,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum s3d_disp_sub_sampling {
+ S3D_DISP_SUB_SAMPLE_NONE = 0,
+ S3D_DISP_SUB_SAMPLE_V,
+ S3D_DISP_SUB_SAMPLE_H,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum s3d_disp_order {
+ S3D_DISP_ORDER_L = 0,
+ S3D_DISP_ORDER_R = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum s3d_disp_view {
+ S3D_DISP_VIEW_L = 0,
+ S3D_DISP_VIEW_R,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct s3d_disp_info {
+ enum s3d_disp_type type;
+ enum s3d_disp_sub_sampling sub_samp;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum s3d_disp_order order;
+ unsigned int gap;
+};
+enum omap_dss_ilace_mode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_ILACE = (1 << 0),
+ OMAP_DSS_ILACE_SEQ = (1 << 1),
+ OMAP_DSS_ILACE_SWAP = (1 << 2),
+ OMAP_DSS_ILACE_NONE = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_ILACE_IL_TB = OMAP_DSS_ILACE,
+ OMAP_DSS_ILACE_IL_BT = OMAP_DSS_ILACE | OMAP_DSS_ILACE_SWAP,
+ OMAP_DSS_ILACE_SEQ_TB = OMAP_DSS_ILACE_IL_TB | OMAP_DSS_ILACE_SEQ,
+ OMAP_DSS_ILACE_SEQ_BT = OMAP_DSS_ILACE_IL_BT | OMAP_DSS_ILACE_SEQ,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct dss2_vc1_range_map_info {
+ __u8 enable;
+ __u8 range_y;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 range_uv;
+} __attribute__ ((aligned(4)));
+struct dss2_rect_t {
+ __s32 x;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __s32 y;
+ __u32 w;
+ __u32 h;
+} __attribute__ ((aligned(4)));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct dss2_decim {
+ __u8 min_x;
+ __u8 max_x;
+ __u8 min_y;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 max_y;
+} __attribute__ ((aligned(4)));
+struct dss2_ovl_cfg {
+ __u16 width;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 height;
+ __u32 stride;
+ enum omap_color_mode color_mode;
+ __u8 pre_mult_alpha;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 global_alpha;
+ __u8 rotation;
+ __u8 mirror;
+ enum omap_dss_ilace_mode ilace;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dss2_rect_t win;
+ struct dss2_rect_t crop;
+ struct dss2_decim decim;
+ struct omap_dss_cconv_coefs cconv;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dss2_vc1_range_map_info vc1;
+ __u8 ix;
+ __u8 zorder;
+ __u8 enabled;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 zonly;
+ __u8 mgr_ix;
+} __attribute__ ((aligned(4)));
+enum omapdss_buffer_type {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_BUFTYPE_SDMA,
+ OMAP_DSS_BUFTYPE_TILER_8BIT,
+ OMAP_DSS_BUFTYPE_TILER_16BIT,
+ OMAP_DSS_BUFTYPE_TILER_32BIT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_BUFTYPE_TILER_PAGE,
+};
+enum omapdss_buffer_addressing_type {
+ OMAP_DSS_BUFADDR_DIRECT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_BUFADDR_BYTYPE,
+ OMAP_DSS_BUFADDR_ION,
+ OMAP_DSS_BUFADDR_GRALLOC,
+ OMAP_DSS_BUFADDR_OVL_IX,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ OMAP_DSS_BUFADDR_LAYER_IX,
+ OMAP_DSS_BUFADDR_FB,
+};
+struct dss2_ovl_info {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dss2_ovl_cfg cfg;
+ enum omapdss_buffer_addressing_type addressing;
+ union {
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ void *address;
+ void *uv_address;
+ };
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum omapdss_buffer_type ba_type;
+ enum omapdss_buffer_type uv_type;
+ };
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 ba;
+ __u32 uv;
+ };
+ };
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct dss2_mgr_info {
+ __u32 ix;
+ __u32 default_color;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum omap_dss_trans_key_type trans_key_type;
+ __u32 trans_key;
+ struct omap_dss_cpr_coefs cpr_coefs;
+ __u8 trans_enabled;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 interlaced;
+ __u8 alpha_blending;
+ __u8 cpr_enabled;
+ __u8 swap_rb;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} __attribute__ ((aligned(4)));
+enum dsscomp_setup_mode {
+ DSSCOMP_SETUP_MODE_APPLY = (1 << 0),
+ DSSCOMP_SETUP_MODE_DISPLAY = (1 << 1),
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ DSSCOMP_SETUP_MODE_CAPTURE = (1 << 2),
+ DSSCOMP_SETUP_APPLY = DSSCOMP_SETUP_MODE_APPLY,
+ DSSCOMP_SETUP_DISPLAY =
+ DSSCOMP_SETUP_MODE_APPLY | DSSCOMP_SETUP_MODE_DISPLAY,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ DSSCOMP_SETUP_CAPTURE =
+ DSSCOMP_SETUP_MODE_APPLY | DSSCOMP_SETUP_MODE_CAPTURE,
+ DSSCOMP_SETUP_DISPLAY_CAPTURE =
+ DSSCOMP_SETUP_DISPLAY | DSSCOMP_SETUP_CAPTURE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct dsscomp_setup_mgr_data {
+ __u32 sync_id;
+ struct dss2_rect_t win;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum dsscomp_setup_mode mode;
+ __u16 num_ovls;
+ __u16 get_sync_obj;
+ struct dss2_mgr_info mgr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dss2_ovl_info ovls[0];
+};
+struct dsscomp_check_ovl_data {
+ enum dsscomp_setup_mode mode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dss2_mgr_info mgr;
+ struct dss2_ovl_info ovl;
+};
+struct dsscomp_setup_dispc_data {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 sync_id;
+ enum dsscomp_setup_mode mode;
+ __u16 num_ovls;
+ __u16 num_mgrs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 get_sync_obj;
+ struct dss2_mgr_info mgrs[3];
+ struct dss2_ovl_info ovls[5];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct dsscomp_wb_copy_data {
+ struct dss2_ovl_info ovl, wb;
+};
+struct dsscomp_display_info {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 ix;
+ __u32 overlays_available;
+ __u32 overlays_owned;
+ enum omap_channel channel;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum omap_dss_display_state state;
+ __u8 enabled;
+ struct omap_video_timings timings;
+ struct s3d_disp_info s3d_info;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dss2_mgr_info mgr;
+ __u16 width_in_mm;
+ __u16 height_in_mm;
+ __u32 modedb_len;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dsscomp_videomode modedb[];
+};
+struct dsscomp_setup_display_data {
+ __u32 ix;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct dsscomp_videomode mode;
+};
+enum dsscomp_wait_phase {
+ DSSCOMP_WAIT_PROGRAMMED = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ DSSCOMP_WAIT_DISPLAYED,
+ DSSCOMP_WAIT_RELEASED,
+};
+struct dsscomp_wait_data {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 timeout_us;
+ enum dsscomp_wait_phase phase;
+};
+#define DSSCIOC_SETUP_MGR _IOW('O', 128, struct dsscomp_setup_mgr_data)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DSSCIOC_CHECK_OVL _IOWR('O', 129, struct dsscomp_check_ovl_data)
+#define DSSCIOC_WB_COPY _IOW('O', 130, struct dsscomp_wb_copy_data)
+#define DSSCIOC_QUERY_DISPLAY _IOWR('O', 131, struct dsscomp_display_info)
+#define DSSCIOC_WAIT _IOW('O', 132, struct dsscomp_wait_data)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define DSSCIOC_SETUP_DISPC _IOW('O', 133, struct dsscomp_setup_dispc_data)
+#define DSSCIOC_SETUP_DISPLAY _IOW('O', 134, struct dsscomp_setup_display_data)
+#endif
+
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index dad9120..0549fc2 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -7,12 +7,12 @@
 
 noUpdate = 1
 
-def  cleanupFile( path ):
+def  cleanupFile( path, original_path):
     """reads an original header and perform the cleanup operation on it
        this functions returns the destination path and the clean header
        as a single string"""
     # check the header path
-    src_path    = path
+    src_path = path
 
     if not os.path.exists(src_path):
         if noUpdate:
@@ -26,7 +26,6 @@
         sys.stderr.write( "warning: not a file: %s\n" % path )
         return None, None
 
-    original_path = kernel_original_path
     if os.path.commonprefix( [ src_path, original_path ] ) != original_path:
         if noUpdate:
             panic( "file is not in 'original' directory: %s\n" % path );
@@ -54,27 +53,27 @@
     else:
         dst_path = "common/" + src_path
 
-    dst_path = os.path.normpath( original_path + "/../" + dst_path )
+    dst_path = os.path.normpath( kernel_cleaned_path + "/" + dst_path )
 
     # now, let's parse the file
     #
-    list = cpp.BlockParser().parseFile(path)
-    if not list:
+    blocks = cpp.BlockParser().parseFile(path)
+    if not blocks:
         sys.stderr.write( "error: can't parse '%s'" % path )
         sys.exit(1)
 
 
-    list.optimizeMacros( kernel_known_macros )
-    list.optimizeIf01()
-    list.removeVarsAndFuncs( statics )
-    list.removeComments()
-    list.removeEmptyLines()
-    list.removeMacroDefines( kernel_ignored_macros )
-    list.insertDisclaimer( kernel.kernel_disclaimer )
-    list.replaceTokens( kernel_token_replacements )
+    blocks.optimizeMacros( kernel_known_macros )
+    blocks.optimizeIf01()
+    blocks.removeVarsAndFuncs( statics )
+    blocks.replaceTokens( kernel_token_replacements )
+    blocks.removeComments()
+    blocks.removeMacroDefines( kernel_ignored_macros )
+    blocks.removeWhiteSpace()
 
     out = StringOutput()
-    list.write(out)
+    out.write( kernel_disclaimer )
+    blocks.writeWithWarning(out, kernel_warning, 4)
     return dst_path, out.get()
 
 
@@ -92,12 +91,15 @@
                 if the content has changed. with this, you can pass more
                 than one file on the command-line
 
+            -k<path>  specify path of original kernel headers
+            -d<path>  specify path of cleaned kernel headers
+
         <header_path> must be in a subdirectory of 'original'
     """ % os.path.basename(sys.argv[0])
         sys.exit(1)
 
     try:
-        optlist, args = getopt.getopt( sys.argv[1:], 'uvk:' )
+        optlist, args = getopt.getopt( sys.argv[1:], 'uvk:d:' )
     except:
         # unrecognized option
         sys.stderr.write( "error: unrecognized option\n" )
@@ -111,13 +113,15 @@
             D_setlevel(1)
         elif opt == '-k':
             kernel_original_path = arg
+        elif opt == '-d':
+            kernel_cleaned_path = arg
 
     if len(args) == 0:
         usage()
 
     if noUpdate:
         for path in args:
-            dst_path, newdata = cleanupFile(path)
+            dst_path, newdata = cleanupFile(path,kernel_original_path)
             print newdata
 
         sys.exit(0)
@@ -127,7 +131,7 @@
     b = BatchFileUpdater()
 
     for path in args:
-        dst_path, newdata = cleanupFile(path)
+        dst_path, newdata = cleanupFile(path,kernel_original_path)
         if not dst_path:
             continue
 
@@ -143,9 +147,6 @@
         print "cleaning: %-*s -> %-*s (%s)" % ( 35, path, 35, dst_path, r )
 
 
-    if os.environ.has_key("ANDROID_PRODUCT_OUT"):
-        b.updateP4Files()
-    else:
-        b.updateFiles()
+    b.updateGitFiles()
 
     sys.exit(0)
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 8828a5d..8e15a67 100644
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -1529,7 +1529,7 @@
 
 class Block:
     """a class used to model a block of input source text. there are two block types:
-        - direcive blocks: contain the tokens of a single pre-processor directive (e.g. #if)
+        - directive blocks: contain the tokens of a single pre-processor directive (e.g. #if)
         - text blocks, contain the tokens of non-directive blocks
 
        the cpp parser class below will transform an input source file into a list of Block
@@ -1609,6 +1609,91 @@
         else:
             return None
 
+    def removeWhiteSpace(self):
+        # Remove trailing whitespace and empty lines
+        # All whitespace is also contracted to a single space
+        if self.directive != None:
+            return
+
+        tokens = []
+        line   = 0     # index of line start
+        space  = -1    # index of first space, or -1
+        ii = 0
+        nn = len(self.tokens)
+        while ii < nn:
+            tok = self.tokens[ii]
+
+            # If we find a space, record its position if this is the first
+            # one the line start or the previous character. Don't append
+            # anything to tokens array yet though.
+            if tok.id == tokSPACE:
+                if space < 0:
+                    space = ii
+                ii += 1
+                continue
+
+            # If this is a line space, ignore the spaces we found previously
+            # on the line, and remove empty lines.
+            if tok.id == tokLN:
+                old_line  = line
+                old_space = space
+                #print "N line=%d space=%d ii=%d" % (line, space, ii)
+                ii   += 1
+                line  = ii
+                space = -1
+                if old_space == old_line:  # line only contains spaces
+                    #print "-s"
+                    continue
+                if ii-1 == old_line:  # line is empty
+                    #print "-e"
+                    continue
+                tokens.append(tok)
+                continue
+
+            # Other token, append any space range if any, converting each
+            # one to a single space character, then append the token.
+            if space >= 0:
+                jj = space
+                space = -1
+                while jj < ii:
+                    tok2 = self.tokens[jj]
+                    tok2.value = " "
+                    tokens.append(tok2)
+                    jj += 1
+
+            tokens.append(tok)
+            ii += 1
+
+        self.tokens = tokens
+
+    def writeWithWarning(self,out,warning,left_count,repeat_count):
+        # removeWhiteSpace() will sometimes creates non-directive blocks
+        # without any tokens. These come from blocks that only contained
+        # empty lines and spaces. They should not be printed in the final
+        # output, and then should not be counted for this operation.
+        #
+        if not self.directive and self.tokens == []:
+            return left_count
+
+        if self.directive:
+            out.write(str(self) + "\n")
+            left_count -= 1
+            if left_count == 0:
+                out.write(warning)
+                left_count = repeat_count
+
+        else:
+            for tok in self.tokens:
+                out.write(str(tok))
+                if tok.id == tokLN:
+                    left_count -= 1
+                    if left_count == 0:
+                        out.write(warning)
+                        left_count = repeat_count
+
+        return left_count
+
+
     def __repr__(self):
         """generate the representation of a given block"""
         if self.directive:
@@ -1651,7 +1736,6 @@
 
         return result
 
-
 class BlockList:
     """a convenience class used to hold and process a list of blocks returned by
        the cpp parser"""
@@ -1694,6 +1778,10 @@
             if b.isIf():
                 b.expr.removePrefixed(prefix,names)
 
+    def removeWhiteSpace(self):
+        for b in self.blocks:
+            b.removeWhiteSpace()
+
     def optimizeAll(self,macros):
         self.optimizeMacros(macros)
         self.optimizeIf01()
@@ -1713,72 +1801,17 @@
     def write(self,out):
         out.write(str(self))
 
+    def writeWithWarning(self,out,warning,repeat_count):
+        left_count = repeat_count
+        for b in self.blocks:
+            left_count = b.writeWithWarning(out,warning,left_count,repeat_count)
+
     def removeComments(self):
         for b in self.blocks:
             for tok in b.tokens:
                 if tok.id == tokSPACE:
                     tok.value = " "
 
-    def removeEmptyLines(self):
-        # state = 1 => previous line was tokLN
-        # state = 0 => previous line was directive
-        state  = 1
-        for b in self.blocks:
-            if b.isDirective():
-                #print "$$$ directive %s" % str(b)
-                state = 0
-            else:
-                # a tokLN followed by spaces is replaced by a single tokLN
-                # several successive tokLN are replaced by a single one
-                #
-                dst   = []
-                src   = b.tokens
-                n     = len(src)
-                i     = 0
-                #print "$$$ parsing %s" % repr(src)
-                while i < n:
-                    # find final tokLN
-                    j = i
-                    while j < n and src[j].id != tokLN:
-                        j += 1
-
-                    if j >= n:
-                        # uhhh
-                        dst += src[i:]
-                        break
-
-                    if src[i].id == tokSPACE:
-                        k = i+1
-                        while src[k].id == tokSPACE:
-                            k += 1
-
-                        if k == j: # empty lines with spaces in it
-                            i = j  # remove the spaces
-
-                    if i == j:
-                        # an empty line
-                        if state == 1:
-                            i += 1   # remove it
-                        else:
-                            state = 1
-                            dst.append(src[i])
-                            i   += 1
-                    else:
-                        # this line is not empty, remove trailing spaces
-                        k = j
-                        while k > i and src[k-1].id == tokSPACE:
-                            k -= 1
-
-                        nn = i
-                        while nn < k:
-                            dst.append(src[nn])
-                            nn += 1
-                        dst.append(src[j])
-                        state = 0
-                        i = j+1
-
-                b.tokens = dst
-
     def removeVarsAndFuncs(self,knownStatics=set()):
         """remove all extern and static declarations corresponding
            to variable and function declarations. we only accept typedefs
@@ -1789,66 +1822,118 @@
            which is useful for optimized byteorder swap functions and
            stuff like that.
            """
-        # state = 1 => typedef/struct encountered
-        # state = 2 => vars or func declaration encountered, skipping until ";"
         # state = 0 => normal (i.e. LN + spaces)
+        # state = 1 => typedef/struct encountered, ends with ";"
+        # state = 2 => var declaration encountered, ends with ";"
+        # state = 3 => func declaration encountered, ends with "}"
         state      = 0
         depth      = 0
         blocks2    = []
+        skipTokens = False
         for b in self.blocks:
             if b.isDirective():
                 blocks2.append(b)
             else:
                 n     = len(b.tokens)
                 i     = 0
-                first = 0
-                if state == 2:
+                if skipTokens:
                     first = n
+                else:
+                    first = 0
                 while i < n:
                     tok = b.tokens[i]
-                    if state == 0:
-                        bad = 0
-                        if tok.id in [tokLN, tokSPACE]:
-                            pass
-                        elif tok.value in [ 'struct', 'typedef', 'enum', 'union', '__extension__' ]:
-                            state = 1
-                        else:
-                            if tok.value in [ 'static', 'extern', '__KINLINE' ]:
-                                j = i+1
-                                ident = ""
-                                while j < n and not (b.tokens[j].id in [ '(', ';' ]):
-                                    if b.tokens[j].id == tokIDENT:
-                                        ident = b.tokens[j].value
-                                    j += 1
-                                if j < n and ident in knownStatics:
-                                    # this is a known static, we're going to keep its
-                                    # definition in the final output
-                                    state = 1
-                                else:
-                                    #print "### skip static '%s'" % ident
-                                    pass
-
-                            if state == 0:
-                                if i > first:
-                                    #print "### intermediate from '%s': '%s'" % (tok.value, repr(b.tokens[first:i]))
-                                    blocks2.append( Block(b.tokens[first:i]) )
-                                state = 2
-                                first = n
-
-                    else:  # state > 0
-                        if tok.id == '{':
+                    tokid = tok.id
+                    # If we are not looking for the start of a new
+                    # type/var/func, then skip over tokens until
+                    # we find our terminator, managing the depth of
+                    # accolades as we go.
+                    if state > 0:
+                        terminator = False
+                        if tokid == '{':
                             depth += 1
-
-                        elif tok.id == '}':
+                        elif tokid == '}':
                             if depth > 0:
                                 depth -= 1
+                            if (depth == 0) and (state == 3):
+                                terminator = True
+                        elif tokid == ';' and depth == 0:
+                            terminator = True
 
-                        elif depth == 0 and tok.id == ';':
-                            if state == 2:
-                                first = i+1
+                        if terminator:
+                            # we found the terminator
                             state = 0
+                            if skipTokens:
+                                skipTokens = False
+                                first = i+1
 
-                    i += 1
+                        i = i+1
+                        continue
+
+                    # We are looking for the start of a new type/func/var
+                    # ignore whitespace
+                    if tokid in [tokLN, tokSPACE]:
+                        i = i+1
+                        continue
+
+                    # Is it a new type definition, then start recording it
+                    if tok.value in [ 'struct', 'typedef', 'enum', 'union', '__extension__' ]:
+                        #print "$$$ keep type declr" + repr(b.tokens[i:])
+                        state = 1
+                        i     = i+1
+                        continue
+
+                    # Is it a variable or function definition. If so, first
+                    # try to determine which type it is, and also extract
+                    # its name.
+                    #
+                    # We're going to parse the next tokens of the same block
+                    # until we find a semi-column or a left parenthesis.
+                    #
+                    # The semi-column corresponds to a variable definition,
+                    # the left-parenthesis to a function definition.
+                    #
+                    # We also assume that the var/func name is the last
+                    # identifier before the terminator.
+                    #
+                    j = i+1
+                    ident = ""
+                    while j < n:
+                        tokid = b.tokens[j].id
+                        if tokid == '(':  # a function declaration
+                            state = 3
+                            break
+                        elif tokid == ';': # a variable declaration
+                            state = 2
+                            break
+                        if tokid == tokIDENT:
+                            ident = b.tokens[j].value
+                        j += 1
+
+                    if j >= n:
+                        # This can only happen when the declaration
+                        # does not end on the current block (e.g. with
+                        # a directive mixed inside it.
+                        #
+                        # We will treat it as malformed because
+                        # it's very hard to recover from this case
+                        # without making our parser much more
+                        # complex.
+                        #
+                        #print "### skip unterminated static '%s'" % ident
+                        break
+
+                    if ident in knownStatics:
+                        #print "### keep var/func '%s': %s" % (ident,repr(b.tokens[i:j]))
+                        pass
+                    else:
+                        # We're going to skip the tokens for this declaration
+                        #print "### skip variable /func'%s': %s" % (ident,repr(b.tokens[i:j]))
+                        if i > first:
+                            blocks2.append( Block(b.tokens[first:i]))
+                        skipTokens = True
+                        first      = n
+
+                    i = i+1
 
                 if i > first:
                     #print "### final '%s'" % repr(b.tokens[first:i])
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index ca7e6bb..200c77c 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -7,7 +7,7 @@
 
 # the list of supported architectures
 #
-kernel_archs = [ 'arm', 'x86', 'sh' ]
+kernel_archs = [ 'arm', 'x86', 'mips' ]
 
 # the list of include directories that belong to the kernel
 # tree. used when looking for sources...
@@ -16,7 +16,11 @@
 
 # path to the directory containing the original kernel headers
 #
-kernel_original_path = os.path.normpath( find_program_dir() + '/../original' )
+kernel_original_path = os.path.normpath( find_program_dir() + '/../../../../external/kernel-headers/original' )
+
+# path to the default location of the cleaned-up headers
+#
+kernel_cleaned_path = os.path.normpath( find_program_dir() + '/..' )
 
 # a special value that is used to indicate that a given macro is known to be
 # undefined during optimization
@@ -45,7 +49,7 @@
 
 # Replace tokens in the output according to this mapping
 kernel_token_replacements = {
-    {"asm": "__asm__"},
+    "asm": "__asm__",
     }
 
 # this is the set of known static inline functions that we want to keep
@@ -62,13 +66,9 @@
         ]
     )
 
-kernel_known_sh_statics = set(
-       [ "___arch__swab16",    # asm-sh/byteorder.h
-         "___arch__swab32",    # asm-sh/byteorder.h
-         "___arch__swab64",    # asm-sh/byteorder.h
-         "__FD_ZERO",          # asm-sh/posix_types_32/64.h
-         "__FD_SET",           # asm-sh/posix_types_32/64.h
-       ]
+kernel_known_mips_statics = set(
+        [
+        ]
     )
 
 kernel_known_generic_statics = set(
@@ -86,7 +86,7 @@
 kernel_known_statics = {
         "arm" : kernel_known_arm_statics,
         "x86" : kernel_known_x86_statics,
-        "sh" : kernel_known_sh_statics
+        "mips" : kernel_known_mips_statics
     }
 
 # this is a list of macros which we want to specifically exclude from
@@ -112,6 +112,18 @@
  ***   structures, and macros generated from the original header, and thus,
  ***   contains no copyrightable information.
  ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
  ****************************************************************************
  ****************************************************************************/
 """
+
+# This is the warning line that will be inserted every N-th line in the output
+kernel_warning = """\
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+"""
diff --git a/libc/kernel/tools/find_headers.py b/libc/kernel/tools/find_headers.py
index 8e72bb6..9b3572a 100755
--- a/libc/kernel/tools/find_headers.py
+++ b/libc/kernel/tools/find_headers.py
@@ -3,7 +3,7 @@
 # this program is used to find source code that includes linux kernel headers directly
 # (e.g. with #include <linux/...> or #include <asm/...>)
 #
-# then it lists
+# then it lists them on the standard output.
 
 import sys, cpp, glob, os, re, getopt, kernel
 from utils import *
@@ -12,20 +12,14 @@
 program_dir = find_program_dir()
 
 wanted_archs   = kernel_archs
-wanted_include = os.path.normpath(program_dir + '/../original')
-wanted_config  = os.path.normpath(program_dir + '/../original/config')
+wanted_config  = None
 
 def usage():
     print """\
-  usage:  find_headers.py [options] (file|directory|@listfile)+
+  usage:  find_headers.py [options] <kernel-root> (file|directory|@listfile)+
 
      options:
-        -d <include-dir>   specify alternate kernel headers
-                           'include' directory
-                           ('%s' by default)
-
-        -c <file>          specify alternate .config file
-                           ('%s' by default)
+        -c <file>          specify .config file (none by default)
 
         -a <archs>         used to specify an alternative list
                            of architectures to support
@@ -37,12 +31,12 @@
     by a set of source files or directories containing them. the search
     is recursive to find *all* required files.
 
-""" % ( wanted_include, wanted_config, string.join(kernel_archs,",") )
+""" % ( string.join(kernel_archs,",") )
     sys.exit(1)
 
 
 try:
-    optlist, args = getopt.getopt( sys.argv[1:], 'vc:d:a:' )
+    optlist, args = getopt.getopt( sys.argv[1:], 'vc:d:a:k:' )
 except:
     # unrecognized option
     print "error: unrecognized option"
@@ -51,8 +45,6 @@
 for opt, arg in optlist:
     if opt == '-a':
         wanted_archs = string.split(arg,',')
-    elif opt == '-d':
-        wanted_include = arg
     elif opt == '-c':
         wanted_config = arg
     elif opt == '-v':
@@ -62,10 +54,10 @@
     else:
         usage()
 
-if len(args) < 1:
+if len(args) < 2:
     usage()
 
-kernel_root = wanted_include
+kernel_root = args[0]
 if not os.path.exists(kernel_root):
     sys.stderr.write( "error: directory '%s' does not exist\n" % kernel_root )
     sys.exit(1)
@@ -74,42 +66,42 @@
     sys.stderr.write( "error: '%s' is not a directory\n" % kernel_root )
     sys.exit(1)
 
-if not os.path.isdir(kernel_root+"/linux"):
-    sys.stderr.write( "error: '%s' does not have a 'linux' directory\n" % kernel_root )
+if not os.path.isdir(kernel_root+"/include/linux"):
+    sys.stderr.write( "error: '%s' does not have an 'include/linux' directory\n" % kernel_root )
     sys.exit(1)
 
-if not os.path.exists(wanted_config):
-    sys.stderr.write( "error: file '%s' does not exist\n" % wanted_config )
-    sys.exit(1)
+if wanted_config:
+    if not os.path.exists(wanted_config):
+        sys.stderr.write( "error: file '%s' does not exist\n" % wanted_config )
+        sys.exit(1)
 
-if not os.path.isfile(wanted_config):
-    sys.stderr.write( "error: '%s' is not a file\n" % wanted_config )
-    sys.exit(1)
+    if not os.path.isfile(wanted_config):
+        sys.stderr.write( "error: '%s' is not a file\n" % wanted_config )
+        sys.exit(1)
 
 # find all architectures in the kernel tree
-re_asm_ = re.compile(r"asm-(\w+)")
 archs   = []
-for dir in os.listdir(kernel_root):
-    m = re_asm_.match(dir)
-    if m:
-        if verbose: print ">> found kernel arch '%s'" % m.group(1)
-        archs.append(m.group(1))
+for archdir in os.listdir(kernel_root+"/arch"):
+    if os.path.exists("%s/arch/%s/include/asm" % (kernel_root, archdir)):
+        if verbose:
+            print "Found arch '%s'" % archdir
+        archs.append(archdir)
 
 # if we're using the 'kernel_headers' directory, there is only asm/
-# and no other asm-<arch> directories (arm is assumed, which sucks)
+# and no other asm-<arch> directories
 #
 in_kernel_headers = False
 if len(archs) == 0:
     # this can happen when we're using the 'kernel_headers' directory
     if os.path.isdir(kernel_root+"/asm"):
         in_kernel_headers = True
-        archs = [ "arm" ]
+        archs = [ "arm", "mips"]
 
 # if the user has specified some architectures with -a <archs> ensure that
 # all those he wants are available from the kernel include tree
 if wanted_archs != None:
-    if in_kernel_headers and wanted_archs != [ "arm" ]:
-        sys.stderr.write( "error: when parsing kernel_headers, 'arm' architecture only is supported at the moment\n" )
+    if in_kernel_headers and wanted_archs != [ "arm", "mips" ]:
+        sys.stderr.write( "error: when parsing kernel_headers, only 'arm' and 'mips' architectures are supported at the moment\n" )
         sys.exit(1)
     missing = []
     for arch in wanted_archs:
@@ -126,6 +118,7 @@
 
 # helper function used to walk the user files
 def parse_file(path, parser):
+    #print "parse %s" % path
     parser.parseFile(path)
 
 
@@ -136,7 +129,8 @@
 # try to read the config file
 try:
     cparser = kernel.ConfigParser()
-    cparser.parseFile( wanted_config )
+    if wanted_config:
+        cparser.parseFile( wanted_config )
 except:
     sys.stderr.write( "error: can't parse '%s'" % wanted_config )
     sys.exit(1)
@@ -145,7 +139,8 @@
 
 # first, obtain the list of kernel files used by our clients
 fparser = kernel.HeaderScanner()
-walk_source_files( args, parse_file, fparser, excludes=["kernel_headers"] )
+dir_excludes=[".repo","external/kernel-headers","ndk","out","prebuilt","bionic/libc/kernel","development/ndk","external/qemu/distrib"]
+walk_source_files( args[1:], parse_file, fparser, excludes=["./"+f for f in dir_excludes] )
 headers = fparser.getHeaders()
 files   = fparser.getFiles()
 
@@ -170,6 +165,6 @@
     sys.exit(0)
 
 for h in sorted(headers):
-    print h
+    print "%s" % h
 
 sys.exit(0)
diff --git a/libc/kernel/tools/kernel.py b/libc/kernel/tools/kernel.py
index 9d9b5f0..c203985 100644
--- a/libc/kernel/tools/kernel.py
+++ b/libc/kernel/tools/kernel.py
@@ -55,8 +55,11 @@
     #    <asm-generic/*>
     #    <mtd/*>
     #
-    re_combined =\
-       re.compile(r"^.*<((%s)/[\d\w_\+\.\-/]*)>.*$" % string.join(kernel_dirs,"|") )
+    re_combined_str=\
+       r"^.*<((%s)/[\d\w_\+\.\-/]*)>.*$" % string.join(kernel_dirs,"|")
+
+    re_combined = re.compile(re_combined_str)
+
     # some kernel files choose to include files with relative paths (x86 32/64
     # dispatch for instance)
     re_rel_dir = re.compile(r'^.*"([\d\w_\+\.\-/]+)".*$')
diff --git a/libc/kernel/tools/update_all.py b/libc/kernel/tools/update_all.py
index d25dc0e..6a730a5 100755
--- a/libc/kernel/tools/update_all.py
+++ b/libc/kernel/tools/update_all.py
@@ -6,7 +6,7 @@
 
 def usage():
     print """\
-  usage: %(progname)s
+  usage: %(progname)s [kernel-original-path]
 
     this program is used to update all the auto-generated clean headers
     used by the Bionic C library. it assumes the following:
@@ -31,13 +31,19 @@
     sys.stderr.write( "error: unrecognized option\n" )
     usage()
 
-if len(optlist) > 0 or len(args) > 0:
+if len(optlist) > 0 or len(args) > 1:
     usage()
 
 progdir = find_program_dir()
-original_dir = os.path.normpath( progdir + "/../original" )
-if not os.path.isdir( original_dir ):
-    panic( "required directory does not exists: %s\n" % original_dir )
+
+if len(args) == 1:
+    original_dir = arg[0]
+    if not os.path.isdir(original_dir):
+        panic( "Not a directory: %s" % original_dir )
+else:
+    original_dir = kernel_original_path
+    if not os.path.isdir(original_dir):
+        panic( "Missing directory, please specify one through command-line: %s" % original_dir )
 
 # find all source files in 'original'
 #
@@ -57,29 +63,36 @@
 
 #print "OLD " + repr(b.old_files)
 
+oldlen = 120
 for path in sources:
-    dst_path, newdata = clean_header.cleanupFile(path)
+    dst_path, newdata = clean_header.cleanupFile(path, original_dir)
     if not dst_path:
         continue
 
     b.readFile( dst_path )
     r = b.editFile( dst_path, newdata )
     if r == 0:
-        r = "unchanged"
+        state = "unchanged"
     elif r == 1:
-        r = "edited"
+        state = "edited"
     else:
-        r = "added"
+        state = "added"
 
-    print "cleaning: %-*s -> %-*s (%s)" % ( 35, path, 35, dst_path, r )
+    str = "cleaning: %-*s -> %-*s (%s)" % ( 35, "<original>" + path[len(original_dir):], 35, dst_path, state )
+    if sys.stdout.isatty():
+        print "%-*s" % (oldlen,str),
+        if (r == 0):
+            print "\r",
+        else:
+            print "\n",
+            oldlen = 0
+    else:
+        print str
 
-# We don't use Perforce anymore, but just in case, define ANDROID_USE_P4
-# in your environment if you think you need it.
-usePerforce = os.environ.has_key("ANDROID_USE_P4")
+    oldlen = len(str)
 
-if usePerforce:
-    b.updateP4Files()
-else:
-    b.updateFiles()
+print "%-*s" % (oldlen,"Done!")
+
+b.updateGitFiles()
 
 sys.exit(0)
diff --git a/libc/kernel/tools/utils.py b/libc/kernel/tools/utils.py
index 763c7d2..f4cf540 100644
--- a/libc/kernel/tools/utils.py
+++ b/libc/kernel/tools/utils.py
@@ -231,6 +231,15 @@
 def walk_source_files(paths,callback,args,excludes=[]):
     """recursively walk a list of paths and files, only keeping the source files in directories"""
     for path in paths:
+        if len(path) > 0 and path[0] == '@':
+            # this is the name of another file, include it and parse it
+            path = path[1:]
+            if os.path.exists(path):
+                for line in open(path):
+                    if len(line) > 0 and line[-1] == '\n':
+                        line = line[:-1]
+                    walk_source_files([line],callback,args,excludes)
+            continue
         if not os.path.isdir(path):
             callback(path,args)
         else:
@@ -238,7 +247,7 @@
                 #print "w-- %s (ex: %s)" % (repr((root,dirs)), repr(excludes))
                 if len(excludes):
                     for d in dirs[:]:
-                        if d in excludes:
+                        if os.path.join(root,d) in excludes:
                             dirs.remove(d)
                 for f in files:
                     r, ext = os.path.splitext(f)
@@ -395,3 +404,19 @@
             D2("P4 DELETES: %s" % files)
             o = commands.getoutput( "p4 delete " + files )
             D2( o )
+
+    def updateGitFiles(self):
+        adds, deletes, edits = self.getChanges()
+
+        if adds:
+            for dst in sorted(adds):
+                self._writeFile(dst)
+            commands.getoutput("git add " + " ".join(adds))
+
+        if deletes:
+            commands.getoutput("git rm " + " ".join(deletes))
+
+        if edits:
+            for dst in sorted(edits):
+                self._writeFile(dst)
+            commands.getoutput("git add " + " ".join(edits))
diff --git a/libc/netbsd/gethnamaddr.c b/libc/netbsd/gethnamaddr.c
index 3ebe53e..9a9f6e2 100644
--- a/libc/netbsd/gethnamaddr.c
+++ b/libc/netbsd/gethnamaddr.c
@@ -67,6 +67,7 @@
 #include <netdb.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <strings.h>
 #include <syslog.h>
 
 #ifndef LOG_AUTH
@@ -637,7 +638,7 @@
 }
 
 struct hostent *
-gethostbyaddr(const char *addr,	/* XXX should have been def'd as u_char! */
+gethostbyaddr(const void *addr,
     socklen_t len, int af)
 {
 	const u_char *uaddr = (const u_char *)addr;
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c
index edb4f70..ace8c1a 100644
--- a/libc/netbsd/net/getaddrinfo.c
+++ b/libc/netbsd/net/getaddrinfo.c
@@ -97,6 +97,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <unistd.h>
 
 #include <syslog.h>
@@ -1910,6 +1911,13 @@
 		if (pai->ai_flags & AI_ADDRCONFIG) {
 			query_ipv6 = _have_ipv6();
 			query_ipv4 = _have_ipv4();
+			if (query_ipv6 == 0 && query_ipv4 == 0) {
+				// Both our IPv4 and IPv6 connectivity probes failed, which indicates
+				// that we have neither an IPv4 or an IPv6 default route (and thus no
+				// global IPv4 or IPv6 connectivity). We might be in a walled garden.
+				// Throw up our arms and ask for both A and AAAA.
+				query_ipv6 = query_ipv4 = 1;
+			}
 		}
 		if (query_ipv6) {
 			q.qtype = T_AAAA;
diff --git a/libc/netbsd/net/nsdispatch.c b/libc/netbsd/net/nsdispatch.c
index fa99366..15282be 100644
--- a/libc/netbsd/net/nsdispatch.c
+++ b/libc/netbsd/net/nsdispatch.c
@@ -84,6 +84,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <unistd.h>
 
 static nss_method
diff --git a/libc/netbsd/resolv/res_cache.c b/libc/netbsd/resolv/res_cache.c
index 58d60c9..284ca2f 100644
--- a/libc/netbsd/resolv/res_cache.c
+++ b/libc/netbsd/resolv/res_cache.c
@@ -27,6 +27,7 @@
  */
 
 #include "resolv_cache.h"
+#include <resolv.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
@@ -35,6 +36,12 @@
 #include <errno.h>
 #include "arpa_nameser.h"
 #include <sys/system_properties.h>
+#include <net/if.h>
+#include <netdb.h>
+#include <linux/if.h>
+
+#include <arpa/inet.h>
+#include "resolv_private.h"
 
 /* This code implements a small and *simple* DNS resolver cache.
  *
@@ -159,9 +166,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#include <arpa/inet.h>
-#include "resolv_private.h"
-
 /** BOUNDED BUFFER FORMATTING
  **/
 
@@ -1165,6 +1169,14 @@
     Entry*           entries;
 } Cache;
 
+typedef struct resolv_cache_info {
+    char                        ifname[IF_NAMESIZE + 1];
+    struct in_addr              ifaddr;
+    Cache*                      cache;
+    struct resolv_cache_info*   next;
+    char*                       nameservers[MAXNS +1];
+    struct addrinfo*            nsaddrinfo[MAXNS + 1];
+} CacheInfo;
 
 #define  HTABLE_VALID(x)  ((x) != NULL && (x) != HTABLE_DELETED)
 
@@ -1393,6 +1405,10 @@
         XLOG("%s: OLDEST NOT IN HTABLE ?", __FUNCTION__);
         return;
     }
+    if (DEBUG) {
+        XLOG("Cache full - removing oldest");
+        XLOG_QUERY(oldest->query, oldest->querylen);
+    }
     _cache_remove_p(cache, lookup);
 }
 
@@ -1462,6 +1478,7 @@
     /* remove stale entries here */
     if (now >= e->expires) {
         XLOG( " NOT IN CACHE (STALE ENTRY %p DISCARDED)", *lookup );
+        XLOG_QUERY(e->query, e->querylen);
         _cache_remove_p(cache, lookup);
         goto Exit;
     }
@@ -1567,11 +1584,47 @@
 /****************************************************************************/
 /****************************************************************************/
 
-static struct resolv_cache*  _res_cache;
 static pthread_once_t        _res_cache_once;
 
+// Head of the list of caches.  Protected by _res_cache_list_lock.
+static struct resolv_cache_info _res_cache_list;
+
+// name of the current default inteface
+static char            _res_default_ifname[IF_NAMESIZE + 1];
+
+// lock protecting everything in the _resolve_cache_info structs (next ptr, etc)
+static pthread_mutex_t _res_cache_list_lock;
+
+
+/* lookup the default interface name */
+static char *_get_default_iface_locked();
+/* insert resolv_cache_info into the list of resolv_cache_infos */
+static void _insert_cache_info_locked(struct resolv_cache_info* cache_info);
+/* creates a resolv_cache_info */
+static struct resolv_cache_info* _create_cache_info( void );
+/* gets cache associated with an interface name, or NULL if none exists */
+static struct resolv_cache* _find_named_cache_locked(const char* ifname);
+/* gets a resolv_cache_info associated with an interface name, or NULL if not found */
+static struct resolv_cache_info* _find_cache_info_locked(const char* ifname);
+/* free dns name server list of a resolv_cache_info structure */
+static void _free_nameservers(struct resolv_cache_info* cache_info);
+/* look up the named cache, and creates one if needed */
+static struct resolv_cache* _get_res_cache_for_iface_locked(const char* ifname);
+/* empty the named cache */
+static void _flush_cache_for_iface_locked(const char* ifname);
+/* empty the nameservers set for the named cache */
+static void _free_nameservers_locked(struct resolv_cache_info* cache_info);
+/* lookup the namserver for the name interface */
+static int _get_nameserver_locked(const char* ifname, int n, char* addr, int addrLen);
+/* lookup the addr of the nameserver for the named interface */
+static struct addrinfo* _get_nameserver_addr_locked(const char* ifname, int n);
+/* lookup the inteface's address */
+static struct in_addr* _get_addr_locked(const char * ifname);
+
+
+
 static void
-_res_cache_init( void )
+_res_cache_init(void)
 {
     const char*  env = getenv(CONFIG_ENV);
 
@@ -1580,29 +1633,393 @@
         return;
     }
 
-    _res_cache = _resolv_cache_create();
+    memset(&_res_default_ifname, 0, sizeof(_res_default_ifname));
+    memset(&_res_cache_list, 0, sizeof(_res_cache_list));
+    pthread_mutex_init(&_res_cache_list_lock, NULL);
 }
 
-
 struct resolv_cache*
-__get_res_cache( void )
+__get_res_cache(void)
 {
-    pthread_once( &_res_cache_once, _res_cache_init );
-    return _res_cache;
+    struct resolv_cache *cache;
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+
+    pthread_mutex_lock(&_res_cache_list_lock);
+
+    char* ifname = _get_default_iface_locked();
+
+    // if default interface not set then use the first cache
+    // associated with an interface as the default one.
+    if (ifname[0] == '\0') {
+        struct resolv_cache_info* cache_info = _res_cache_list.next;
+        while (cache_info) {
+            if (cache_info->ifname[0] != '\0') {
+                ifname = cache_info->ifname;
+                break;
+            }
+
+            cache_info = cache_info->next;
+        }
+    }
+    cache = _get_res_cache_for_iface_locked(ifname);
+
+    pthread_mutex_unlock(&_res_cache_list_lock);
+    XLOG("_get_res_cache. default_ifname = %s\n", ifname);
+    return cache;
+}
+
+static struct resolv_cache*
+_get_res_cache_for_iface_locked(const char* ifname)
+{
+    if (ifname == NULL)
+        return NULL;
+
+    struct resolv_cache* cache = _find_named_cache_locked(ifname);
+    if (!cache) {
+        struct resolv_cache_info* cache_info = _create_cache_info();
+        if (cache_info) {
+            cache = _resolv_cache_create();
+            if (cache) {
+                int len = sizeof(cache_info->ifname);
+                cache_info->cache = cache;
+                strncpy(cache_info->ifname, ifname, len - 1);
+                cache_info->ifname[len - 1] = '\0';
+
+                _insert_cache_info_locked(cache_info);
+            } else {
+                free(cache_info);
+            }
+        }
+    }
+    return cache;
 }
 
 void
-_resolv_cache_reset( unsigned  generation )
+_resolv_cache_reset(unsigned  generation)
 {
     XLOG("%s: generation=%d", __FUNCTION__, generation);
 
-    if (_res_cache == NULL)
-        return;
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
 
-    pthread_mutex_lock( &_res_cache->lock );
-    if (_res_cache->generation != generation) {
-        _cache_flush_locked(_res_cache);
-        _res_cache->generation = generation;
+    char* ifname = _get_default_iface_locked();
+    // if default interface not set then use the first cache
+    // associated with an interface as the default one.
+    // Note: Copied the code from __get_res_cache since this
+    // method will be deleted/obsolete when cache per interface
+    // implemented all over
+    if (ifname[0] == '\0') {
+        struct resolv_cache_info* cache_info = _res_cache_list.next;
+        while (cache_info) {
+            if (cache_info->ifname[0] != '\0') {
+                ifname = cache_info->ifname;
+                break;
+            }
+
+            cache_info = cache_info->next;
+        }
     }
-    pthread_mutex_unlock( &_res_cache->lock );
+    struct resolv_cache* cache = _get_res_cache_for_iface_locked(ifname);
+
+    if (cache != NULL) {
+        pthread_mutex_lock( &cache->lock );
+        if (cache->generation != generation) {
+            _cache_flush_locked(cache);
+            cache->generation = generation;
+        }
+        pthread_mutex_unlock( &cache->lock );
+    }
+
+    pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
+void
+_resolv_flush_cache_for_default_iface(void)
+{
+    char* ifname;
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+
+    ifname = _get_default_iface_locked();
+    _flush_cache_for_iface_locked(ifname);
+
+    pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
+void
+_resolv_flush_cache_for_iface(const char* ifname)
+{
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+
+    _flush_cache_for_iface_locked(ifname);
+
+    pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
+static void
+_flush_cache_for_iface_locked(const char* ifname)
+{
+    struct resolv_cache* cache = _find_named_cache_locked(ifname);
+    if (cache) {
+        pthread_mutex_lock(&cache->lock);
+        _cache_flush_locked(cache);
+        pthread_mutex_unlock(&cache->lock);
+    }
+}
+
+static struct resolv_cache_info*
+_create_cache_info(void)
+{
+    struct resolv_cache_info*  cache_info;
+
+    cache_info = calloc(sizeof(*cache_info), 1);
+    return cache_info;
+}
+
+static void
+_insert_cache_info_locked(struct resolv_cache_info* cache_info)
+{
+    struct resolv_cache_info* last;
+
+    for (last = &_res_cache_list; last->next; last = last->next);
+
+    last->next = cache_info;
+
+}
+
+static struct resolv_cache*
+_find_named_cache_locked(const char* ifname) {
+
+    struct resolv_cache_info* info = _find_cache_info_locked(ifname);
+
+    if (info != NULL) return info->cache;
+
+    return NULL;
+}
+
+static struct resolv_cache_info*
+_find_cache_info_locked(const char* ifname)
+{
+    if (ifname == NULL)
+        return NULL;
+
+    struct resolv_cache_info* cache_info = _res_cache_list.next;
+
+    while (cache_info) {
+        if (strcmp(cache_info->ifname, ifname) == 0) {
+            break;
+        }
+
+        cache_info = cache_info->next;
+    }
+    return cache_info;
+}
+
+static char*
+_get_default_iface_locked(void)
+{
+    char* iface = _res_default_ifname;
+
+    return iface;
+}
+
+void
+_resolv_set_default_iface(const char* ifname)
+{
+    XLOG("_resolv_set_default_if ifname %s\n",ifname);
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+
+    int size = sizeof(_res_default_ifname);
+    memset(_res_default_ifname, 0, size);
+    strncpy(_res_default_ifname, ifname, size - 1);
+    _res_default_ifname[size - 1] = '\0';
+
+    pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
+void
+_resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers)
+{
+    int i, rt, index;
+    struct addrinfo hints;
+    char sbuf[NI_MAXSERV];
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+
+    pthread_mutex_lock(&_res_cache_list_lock);
+    // creates the cache if not created
+    _get_res_cache_for_iface_locked(ifname);
+
+    struct resolv_cache_info* cache_info = _find_cache_info_locked(ifname);
+
+    if (cache_info != NULL) {
+        // free current before adding new
+        _free_nameservers_locked(cache_info);
+
+        memset(&hints, 0, sizeof(hints));
+        hints.ai_family = PF_UNSPEC;
+        hints.ai_socktype = SOCK_DGRAM; /*dummy*/
+        hints.ai_flags = AI_NUMERICHOST;
+        sprintf(sbuf, "%u", NAMESERVER_PORT);
+
+        index = 0;
+        for (i = 0; i < numservers && i < MAXNS; i++) {
+            rt = getaddrinfo(servers[i], sbuf, &hints, &cache_info->nsaddrinfo[index]);
+            if (rt == 0) {
+                cache_info->nameservers[index] = strdup(servers[i]);
+                index++;
+            } else {
+                cache_info->nsaddrinfo[index] = NULL;
+            }
+        }
+    }
+    pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
+static void
+_free_nameservers_locked(struct resolv_cache_info* cache_info)
+{
+    int i;
+    for (i = 0; i <= MAXNS; i++) {
+        free(cache_info->nameservers[i]);
+        cache_info->nameservers[i] = NULL;
+        if (cache_info->nsaddrinfo[i] != NULL) {
+            freeaddrinfo(cache_info->nsaddrinfo[i]);
+            cache_info->nsaddrinfo[i] = NULL;
+        }
+    }
+}
+
+int
+_resolv_cache_get_nameserver(int n, char* addr, int addrLen)
+{
+    char *ifname;
+    int result = 0;
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+
+    ifname = _get_default_iface_locked();
+    result = _get_nameserver_locked(ifname, n, addr, addrLen);
+
+    pthread_mutex_unlock(&_res_cache_list_lock);
+    return result;
+}
+
+static int
+_get_nameserver_locked(const char* ifname, int n, char* addr, int addrLen)
+{
+    int len = 0;
+    char* ns;
+    struct resolv_cache_info* cache_info;
+
+    if (n < 1 || n > MAXNS || !addr)
+        return 0;
+
+    cache_info = _find_cache_info_locked(ifname);
+    if (cache_info) {
+        ns = cache_info->nameservers[n - 1];
+        if (ns) {
+            len = strlen(ns);
+            if (len < addrLen) {
+                strncpy(addr, ns, len);
+                addr[len] = '\0';
+            } else {
+                len = 0;
+            }
+        }
+    }
+
+    return len;
+}
+
+struct addrinfo*
+_cache_get_nameserver_addr(int n)
+{
+    struct addrinfo *result;
+    char* ifname;
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+
+    ifname = _get_default_iface_locked();
+
+    result = _get_nameserver_addr_locked(ifname, n);
+    pthread_mutex_unlock(&_res_cache_list_lock);
+    return result;
+}
+
+static struct addrinfo*
+_get_nameserver_addr_locked(const char* ifname, int n)
+{
+    struct addrinfo* ai = NULL;
+    struct resolv_cache_info* cache_info;
+
+    if (n < 1 || n > MAXNS)
+        return NULL;
+
+    cache_info = _find_cache_info_locked(ifname);
+    if (cache_info) {
+        ai = cache_info->nsaddrinfo[n - 1];
+    }
+    return ai;
+}
+
+void
+_resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr)
+{
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+    struct resolv_cache_info* cache_info = _find_cache_info_locked(ifname);
+    if (cache_info) {
+        memcpy(&cache_info->ifaddr, addr, sizeof(*addr));
+
+        if (DEBUG) {
+            char* addr_s = inet_ntoa(cache_info->ifaddr);
+            XLOG("address of interface %s is %s\n", ifname, addr_s);
+        }
+    }
+    pthread_mutex_unlock(&_res_cache_list_lock);
+}
+
+struct in_addr*
+_resolv_get_addr_of_default_iface(void)
+{
+    struct in_addr* ai = NULL;
+    char* ifname;
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+    ifname = _get_default_iface_locked();
+    ai = _get_addr_locked(ifname);
+    pthread_mutex_unlock(&_res_cache_list_lock);
+
+    return ai;
+}
+
+struct in_addr*
+_resolv_get_addr_of_iface(const char* ifname)
+{
+    struct in_addr* ai = NULL;
+
+    pthread_once(&_res_cache_once, _res_cache_init);
+    pthread_mutex_lock(&_res_cache_list_lock);
+    ai =_get_addr_locked(ifname);
+    pthread_mutex_unlock(&_res_cache_list_lock);
+    return ai;
+}
+
+static struct in_addr*
+_get_addr_locked(const char * ifname)
+{
+    struct resolv_cache_info* cache_info = _find_cache_info_locked(ifname);
+    if (cache_info) {
+        return &cache_info->ifaddr;
+    }
+    return NULL;
 }
diff --git a/libc/netbsd/resolv/res_debug.c b/libc/netbsd/resolv/res_debug.c
index 721e015..46e583b 100644
--- a/libc/netbsd/resolv/res_debug.c
+++ b/libc/netbsd/resolv/res_debug.c
@@ -123,6 +123,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <time.h>
 
 
diff --git a/libc/netbsd/resolv/res_init.c b/libc/netbsd/resolv/res_init.c
index 2158f20..ffd4054 100644
--- a/libc/netbsd/resolv/res_init.c
+++ b/libc/netbsd/resolv/res_init.c
@@ -225,6 +225,9 @@
 	char dnsProperty[PROP_VALUE_MAX];
 #endif
 
+        if ((statp->options & RES_INIT) != 0U)
+                res_ndestroy(statp);
+
 	if (!preinit) {
 		statp->retrans = RES_TIMEOUT;
 		statp->retry = RES_DFLRETRY;
@@ -232,9 +235,6 @@
 		statp->id = res_randomid();
 	}
 
-	if ((statp->options & RES_INIT) != 0U)
-		res_ndestroy(statp);
-
 	memset(u, 0, sizeof(u));
 #ifdef USELOOPBACK
 	u[nserv].sin.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
diff --git a/libc/netbsd/resolv/res_send.c b/libc/netbsd/resolv/res_send.c
index b118956..dbad6dd 100644
--- a/libc/netbsd/resolv/res_send.c
+++ b/libc/netbsd/resolv/res_send.c
@@ -99,6 +99,7 @@
 #include <arpa/inet.h>
 
 #include <errno.h>
+#include <fcntl.h>
 #include <netdb.h>
 #ifdef ANDROID_CHANGES
 #include "resolv_private.h"
@@ -109,6 +110,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <isc/eventlib.h>
@@ -117,6 +119,8 @@
 #  include <resolv_cache.h>
 #endif
 
+#include "logd.h"
+
 #ifndef DE_CONST
 #define DE_CONST(c,v)   v = ((c) ? \
     strchr((const void *)(c), *(const char *)(const void *)(c)) : NULL)
@@ -130,6 +134,7 @@
 #include "res_private.h"
 
 #define EXT(res) ((res)->_u._ext)
+#define DBG 0
 
 static const int highestFD = FD_SETSIZE - 1;
 
@@ -152,7 +157,10 @@
 				const sigset_t *);
 #endif
 void res_pquery(const res_state, const u_char *, int, FILE *);
-
+static int connect_with_timeout(int sock, const struct sockaddr *nsap,
+			socklen_t salen, int sec);
+static int retrying_select(const int sock, fd_set *readset, fd_set *writeset,
+			const struct timespec *finish);
 
 /* BIONIC-BEGIN: implement source port randomization */
 typedef union {
@@ -413,7 +421,7 @@
 				if (EXT(statp).nssocks[ns] == -1)
 					continue;
 				peerlen = sizeof(peer);
-				if (getsockname(EXT(statp).nssocks[ns],
+				if (getpeername(EXT(statp).nssocks[ns],
 				    (struct sockaddr *)(void *)&peer, &peerlen) < 0) {
 					needclose++;
 					break;
@@ -521,16 +529,23 @@
 
 		Dprint(((statp->options & RES_DEBUG) &&
 			getnameinfo(nsap, (socklen_t)nsaplen, abuf, sizeof(abuf),
-				    NULL, 0, niflags) == 0),
-		       (stdout, ";; Querying server (# %d) address = %s\n",
-			ns + 1, abuf));
+				NULL, 0, niflags) == 0),
+				(stdout, ";; Querying server (# %d) address = %s\n",
+				ns + 1, abuf));
 
 
 		if (v_circuit) {
 			/* Use VC; at most one attempt per server. */
 			try = statp->retry;
+
 			n = send_vc(statp, buf, buflen, ans, anssiz, &terrno,
 				    ns);
+
+			if (DBG) {
+				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+					"used send_vc %d\n", n);
+			}
+
 			if (n < 0)
 				goto fail;
 			if (n == 0)
@@ -538,12 +553,26 @@
 			resplen = n;
 		} else {
 			/* Use datagrams. */
+			if (DBG) {
+				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+					"using send_dg\n");
+			}
+
 			n = send_dg(statp, buf, buflen, ans, anssiz, &terrno,
 				    ns, &v_circuit, &gotsomewhere);
+			if (DBG) {
+				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+					"used send_dg %d\n",n);
+			}
+
 			if (n < 0)
 				goto fail;
 			if (n == 0)
 				goto next_ns;
+			if (DBG) {
+				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+					"time=%d, %d\n",time(NULL), time(NULL)%2);
+			}
 			if (v_circuit)
 				goto same_ns;
 			resplen = n;
@@ -668,6 +697,23 @@
 	}
 }
 
+static int get_timeout(const res_state statp, const int ns)
+{
+	int timeout = (statp->retrans << ns);
+	if (ns > 0) {
+		timeout /= statp->nscount;
+	}
+	if (timeout <= 0) {
+		timeout = 1;
+	}
+	if (DBG) {
+		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+			"using timeout of %d sec\n", timeout);
+	}
+
+	return timeout;
+}
+
 static int
 send_vc(res_state statp,
 	const u_char *buf, int buflen, u_char *ans, int anssiz,
@@ -683,6 +729,10 @@
 	u_char *cp;
 	void *tmp;
 
+	if (DBG) {
+		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", "using send_vc\n");
+	}
+
 	nsap = get_nsaddr(statp, (size_t)ns);
 	nsaplen = get_salen(nsap);
 
@@ -735,7 +785,8 @@
 			res_nclose(statp);
 			return (0);
 		}
-		if (connect(statp->_vcsock, nsap, (socklen_t)nsaplen) < 0) {
+		if (connect_with_timeout(statp->_vcsock, nsap, (socklen_t)nsaplen,
+				get_timeout(statp, ns)) < 0) {
 			*terrno = errno;
 			Aerror(statp, stderr, "connect/vc", errno, nsap,
 			    nsaplen);
@@ -859,6 +910,111 @@
 	return (resplen);
 }
 
+/* return -1 on error (errno set), 0 on success */
+static int
+connect_with_timeout(int sock, const struct sockaddr *nsap, socklen_t salen, int sec)
+{
+	int res, origflags;
+	fd_set rset, wset;
+	struct timespec now, timeout, finish;
+
+	origflags = fcntl(sock, F_GETFL, 0);
+	fcntl(sock, F_SETFL, origflags | O_NONBLOCK);
+
+	res = connect(sock, nsap, salen);
+	if (res < 0 && errno != EINPROGRESS) {
+                res = -1;
+                goto done;
+	}
+	if (res != 0) {
+		now = evNowTime();
+		timeout = evConsTime((long)sec, 0L);
+		finish = evAddTime(now, timeout);
+		if (DBG) {
+			__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+				"  %d send_vc\n", sock);
+		}
+
+		res = retrying_select(sock, &rset, &wset, &finish);
+		if (res <= 0) {
+                        res = -1;
+		}
+	}
+done:
+	fcntl(sock, F_SETFL, origflags);
+	if (DBG) {
+		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+			"  %d connect_with_timeout returning %s\n", sock, res);
+	}
+	return res;
+}
+
+static int
+retrying_select(const int sock, fd_set *readset, fd_set *writeset, const struct timespec *finish)
+{
+	struct timespec now, timeout;
+	int n, error;
+	socklen_t len;
+
+
+retry:
+	if (DBG) {
+		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", "  %d retying_select\n", sock);
+	}
+
+	now = evNowTime();
+	if (readset) {
+		FD_ZERO(readset);
+		FD_SET(sock, readset);
+	}
+	if (writeset) {
+		FD_ZERO(writeset);
+		FD_SET(sock, writeset);
+	}
+	if (evCmpTime(*finish, now) > 0)
+		timeout = evSubTime(*finish, now);
+	else
+		timeout = evConsTime(0L, 0L);
+
+	n = pselect(sock + 1, readset, writeset, NULL, &timeout, NULL);
+	if (n == 0) {
+		if (DBG) {
+			__libc_android_log_print(ANDROID_LOG_DEBUG, " libc",
+				"  %d retrying_select timeout\n", sock);
+		}
+		errno = ETIMEDOUT;
+		return 0;
+	}
+	if (n < 0) {
+		if (errno == EINTR)
+			goto retry;
+		if (DBG) {
+			__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+				"  %d retrying_select got error %d\n",sock, n);
+		}
+		return n;
+	}
+	if ((readset && FD_ISSET(sock, readset)) || (writeset && FD_ISSET(sock, writeset))) {
+		len = sizeof(error);
+		if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &len) < 0 || error) {
+			errno = error;
+			if (DBG) {
+				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+					"  %d retrying_select dot error2 %d\n", sock, errno);
+			}
+
+			return -1;
+		}
+	}
+	if (DBG) {
+		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
+			"  %d retrying_select returning %d for %d\n",sock, n);
+	}
+
+	return n;
+}
+
+
 static int
 send_dg(res_state statp,
 	const u_char *buf, int buflen, u_char *ans, int anssiz,
@@ -944,33 +1100,19 @@
 	/*
 	 * Wait for reply.
 	 */
-	seconds = (statp->retrans << ns);
-	if (ns > 0)
-		seconds /= statp->nscount;
-	if (seconds <= 0)
-		seconds = 1;
+	seconds = get_timeout(statp, ns);
 	now = evNowTime();
 	timeout = evConsTime((long)seconds, 0L);
 	finish = evAddTime(now, timeout);
-	goto nonow;
- wait:
-	now = evNowTime();
- nonow:
-	FD_ZERO(&dsmask);
-	FD_SET(s, &dsmask);
-	if (evCmpTime(finish, now) > 0)
-		timeout = evSubTime(finish, now);
-	else
-		timeout = evConsTime(0L, 0L);
-	n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL);
+retry:
+	n = retrying_select(s, &dsmask, NULL, &finish);
+
 	if (n == 0) {
 		Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
 		*gotsomewhere = 1;
 		return (0);
 	}
 	if (n < 0) {
-		if (errno == EINTR)
-			goto wait;
 		Perror(statp, stderr, "select", errno);
 		res_nclose(statp);
 		return (0);
@@ -1006,7 +1148,7 @@
 			(statp->pfcode & RES_PRF_REPLY),
 			(stdout, ";; old answer:\n"),
 			ans, (resplen > anssiz) ? anssiz : resplen);
-		goto wait;
+		goto retry;
 	}
 	if (!(statp->options & RES_INSECURE1) &&
 	    !res_ourserver_p(statp, (struct sockaddr *)(void *)&from)) {
@@ -1019,7 +1161,7 @@
 			(statp->pfcode & RES_PRF_REPLY),
 			(stdout, ";; not our server:\n"),
 			ans, (resplen > anssiz) ? anssiz : resplen);
-		goto wait;
+		goto retry;
 	}
 #ifdef RES_USE_EDNS0
 	if (anhp->rcode == FORMERR && (statp->options & RES_USE_EDNS0) != 0U) {
@@ -1049,7 +1191,7 @@
 			(statp->pfcode & RES_PRF_REPLY),
 			(stdout, ";; wrong query name:\n"),
 			ans, (resplen > anssiz) ? anssiz : resplen);
-		goto wait;
+		goto retry;;
 	}
 	if (anhp->rcode == SERVFAIL ||
 	    anhp->rcode == NOTIMP ||
diff --git a/libc/netbsd/resolv/res_state.c b/libc/netbsd/resolv/res_state.c
index 3209b6f..e05846a 100644
--- a/libc/netbsd/resolv/res_state.c
+++ b/libc/netbsd/resolv/res_state.c
@@ -38,21 +38,32 @@
 #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
 #include <sys/_system_properties.h>
 
+/* Set to 1 to enable debug traces */
+#define DEBUG 0
+
+#if DEBUG
+#  include <logd.h>
+#  include <unistd.h>  /* for gettid() */
+#  define D(...)  __libc_android_log_print(ANDROID_LOG_DEBUG,"libc", __VA_ARGS__)
+#else
+#  define D(...)  do{}while(0)
+#endif
+
 static pthread_key_t   _res_key;
 static pthread_once_t  _res_once;
 
 typedef struct {
-    int                    _h_errno;
-    struct __res_state     _nres[1];
-    unsigned               _serial;
-    struct prop_info*      _pi;
-    struct res_static      _rstatic[1];
+    int                  _h_errno;
+    struct __res_state  _nres[1];
+    unsigned             _serial;
+    struct prop_info*   _pi;
+    struct res_static   _rstatic[1];
 } _res_thread;
 
 static _res_thread*
 _res_thread_alloc(void)
 {
-    _res_thread*  rt = malloc(sizeof(*rt));
+    _res_thread*  rt = calloc(1, sizeof(*rt));
 
     if (rt) {
         rt->_h_errno = 0;
@@ -62,12 +73,7 @@
         if (rt->_pi) {
             rt->_serial = rt->_pi->serial;
         }
-        if ( res_ninit( rt->_nres ) < 0 ) {
-            free(rt);
-            rt = NULL;
-        } else {
-            memset(rt->_rstatic, 0, sizeof rt->_rstatic);
-        }
+        memset(rt->_rstatic, 0, sizeof rt->_rstatic);
     }
     return rt;
 }
@@ -91,6 +97,8 @@
 {
     _res_thread*  rt = _rt;
 
+    D("%s: rt=%p for thread=%d", __FUNCTION__, rt, gettid());
+
     _res_static_done(rt->_rstatic);
     res_ndestroy(rt->_nres);
     free(rt);
@@ -108,29 +116,60 @@
     _res_thread*  rt;
     pthread_once( &_res_once, _res_init_key );
     rt = pthread_getspecific( _res_key );
-    if (rt == NULL) {
-        if ((rt = _res_thread_alloc()) == NULL) {
-            return NULL;
+
+    if (rt != NULL) {
+        /* We already have one thread-specific DNS state object.
+         * Check the serial value for any changes to net.* properties */
+        D("%s: Called for tid=%d rt=%p rt->pi=%p rt->serial=%d",
+           __FUNCTION__, gettid(), rt, rt->_pi, rt->_serial);
+        if (rt->_pi == NULL) {
+            /* The property wasn't created when _res_thread_get() was
+             * called the last time. This should only happen very
+             * early during the boot sequence. First, let's try to see if it
+             * is here now. */
+            rt->_pi = (struct prop_info*) __system_property_find("net.change");
+            if (rt->_pi == NULL) {
+                /* Still nothing, return current state */
+                D("%s: exiting for tid=%d rt=%d since system property not found",
+                  __FUNCTION__, gettid(), rt);
+                return rt;
+            }
         }
-        rt->_h_errno = 0;
-        rt->_serial = 0;
-        pthread_setspecific( _res_key, rt );
+        if (rt->_serial == rt->_pi->serial) {
+            /* Nothing changed, so return the current state */
+            D("%s: tid=%d rt=%p nothing changed, returning",
+              __FUNCTION__, gettid(), rt);
+            return rt;
+        }
+        /* Update the recorded serial number, and go reset the state */
+        rt->_serial = rt->_pi->serial;
+        goto RESET_STATE;
     }
-    /* Check the serial value for any chanes to net.* properties. */
-    if (rt->_pi == NULL) {
-        rt->_pi = (struct prop_info*) __system_property_find("net.change");
+
+    /* It is the first time this function is called in this thread,
+     * we need to create a new thread-specific DNS resolver state. */
+    rt = _res_thread_alloc();
+    if (rt == NULL) {
+        return NULL;
     }
-    if (rt->_pi == NULL || rt->_serial == rt->_pi->serial) {
-        return rt;
-    }
-    rt->_serial = rt->_pi->serial;
-    /* Reload from system properties. */
+    pthread_setspecific( _res_key, rt );
+    D("%s: tid=%d Created new DNS state rt=%p",
+      __FUNCTION__, gettid(), rt);
+
+RESET_STATE:
+    /* Reset the state, note that res_ninit() can now properly reset
+     * an existing state without leaking memory.
+     */
+    D("%s: tid=%d, rt=%p, resetting DNS state (options RES_INIT=%d)",
+      __FUNCTION__, gettid(), rt, (rt->_nres->options & RES_INIT) != 0);
     if ( res_ninit( rt->_nres ) < 0 ) {
-        free(rt);
-        rt = NULL;
-        pthread_setspecific( _res_key, rt );
+        /* This should not happen */
+        D("%s: tid=%d rt=%p, woot, res_ninit() returned < 0",
+          __FUNCTION__, gettid(), rt);
+        _res_thread_free(rt);
+        pthread_setspecific( _res_key, NULL );
+        return NULL;
     }
-    _resolv_cache_reset(rt->_serial);
     return rt;
 }
 
diff --git a/libc/private/__dso_handle.S b/libc/private/__dso_handle.S
index fcebab6..3e80128 100644
--- a/libc/private/__dso_handle.S
+++ b/libc/private/__dso_handle.S
@@ -32,6 +32,11 @@
 #
         .section .bss
         .align 4
+
+#ifndef CRT_LEGACY_WORKAROUND
+	.hidden __dso_handle
+#endif
+
         .globl __dso_handle
 __dso_handle:
         .long 0
diff --git a/libc/arch-sh/bionic/__get_sp.S b/libc/private/__dso_handle_so.S
similarity index 79%
copy from libc/arch-sh/bionic/__get_sp.S
copy to libc/private/__dso_handle_so.S
index 0e34a01..77a5d7f 100644
--- a/libc/arch-sh/bionic/__get_sp.S
+++ b/libc/private/__dso_handle_so.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,14 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-.text
-.type   __get_sp, @function
-.globl  __get_sp
-.align  4
 
-__get_sp:
-    rts
-    mov     r15, r0
-
+# The __dso_handle global variable is used by static
+# C++ constructors and destructors in the binary.
+# See http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor
+#
+	.data
+        .align 4
+	.hidden __dso_handle
+        .globl __dso_handle
+__dso_handle:
+        .long __dso_handle
diff --git a/libc/arch-sh/bionic/__get_sp.S b/libc/private/bionic_pthread.h
similarity index 79%
copy from libc/arch-sh/bionic/__get_sp.S
copy to libc/private/bionic_pthread.h
index 0e34a01..28d6ad8 100644
--- a/libc/arch-sh/bionic/__get_sp.S
+++ b/libc/private/bionic_pthread.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2011 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,18 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-.text
-.type   __get_sp, @function
-.globl  __get_sp
-.align  4
 
-__get_sp:
-    rts
-    mov     r15, r0
+#ifndef _BIONIC_PTHREAD_H
+#define _BIONIC_PTHREAD_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/* Internal, not an NDK API */
+extern pid_t __pthread_gettid(pthread_t thid);
+extern int __pthread_settid(pthread_t thid, pid_t tid);
+
+__END_DECLS
+
+#endif /* _BIONIC_PTHREAD_H */
diff --git a/libc/private/logd.h b/libc/private/logd.h
index 43fa742..4a9b62e 100644
--- a/libc/private/logd.h
+++ b/libc/private/logd.h
@@ -44,6 +44,7 @@
     ANDROID_LOG_SILENT,     /* only for SetMinPriority(); must be last */
 };
 
+int __libc_android_log_write(int prio, const char* tag, const char* buffer);
 int __libc_android_log_print(int prio, const char *tag, const char *fmt, ...);
 int __libc_android_log_vprint(int prio, const char *tag, const char *fmt, va_list ap);
 
diff --git a/libc/private/resolv_cache.h b/libc/private/resolv_cache.h
index cd876fb..2a54453 100644
--- a/libc/private/resolv_cache.h
+++ b/libc/private/resolv_cache.h
@@ -30,13 +30,45 @@
 
 struct resolv_cache;  /* forward */
 
-/* get cache instance, can be NULL if cache is disabled
- * (e.g. through an environment variable) */
+/* gets the cache for the default interface. Might be NULL*/
 extern struct resolv_cache*  __get_res_cache(void);
 
+/* get the cache for a specified interface. Can be NULL*/
+extern struct resolv_cache* __get_res_cache_for_iface(const char* ifname);
+
 /* this gets called everytime we detect some changes in the DNS configuration
  * and will flush the cache */
-extern void   _resolv_cache_reset( unsigned  generation );
+extern void  _resolv_cache_reset( unsigned  generation );
+
+/* Gets the address of the n:th name server for the default interface
+ * Return length of address on success else 0.
+ * Note: The first name server is at n = 1 */
+extern int _resolv_cache_get_nameserver(int n, char* addr, int addrLen);
+
+/* Gets the address of the n:th name server for a certain interface
+ * Return length of address on success else 0.
+ * Note: The first name server is at n = 1 */
+extern int _resolv_cache_get_nameserver_for_iface(const char* ifname, int n,
+        char* addr, int addrLen);
+
+/* Gets addrinfo of the n:th name server associated with an interface.
+ * NULL is returned if no address if found.
+ * Note: The first name server is at n = 1. */
+extern struct addrinfo* _resolv_cache_get_nameserver_addr_for_iface(const char* ifname, int n);
+
+/* Gets addrinfo of the n:th name server associated with the default interface
+ * NULL is returned if no address if found.
+ * Note: The first name server is at n = 1. */
+extern struct addrinfo* _resolv_cache_get_nameserver_addr(int n);
+
+/* gets the address associated with the default interface */
+extern struct in_addr* _resolv_get_addr_of_default_iface();
+
+/* gets the address associated with the specified interface */
+extern struct in_addr* _resolv_get_addr_of_iface(const char* ifname);
+
+/* Get name of default interface */
+extern char* _resolv_get_default_iface();
 
 typedef enum {
     RESOLV_CACHE_UNSUPPORTED,  /* the cache can't handle that kind of queries */
diff --git a/libc/stdio/asprintf.c b/libc/stdio/asprintf.c
index 1257c7f..c3d8d61 100644
--- a/libc/stdio/asprintf.c
+++ b/libc/stdio/asprintf.c
@@ -38,7 +38,7 @@
 		goto err;
 	f._bf._size = f._w = 127;		/* Leave room for the NUL */
 	va_start(ap, fmt);
-	ret = vfprintf(&f, fmt, ap);
+	ret = __vfprintf(&f, fmt, ap);
 	va_end(ap);
 	if (ret == -1)
 		goto err;
diff --git a/libc/stdio/clrerr.c b/libc/stdio/clrerr.c
index 20f1994..cb6c4df 100644
--- a/libc/stdio/clrerr.c
+++ b/libc/stdio/clrerr.c
@@ -32,12 +32,13 @@
  */
 
 #include <stdio.h>
+#include "local.h"
 #undef	clearerr
 
 void
 clearerr(FILE *fp)
 {
-	flockfile(fp);
+	FLOCKFILE(fp);
 	__sclearerr(fp);
-	funlockfile(fp);
+	FUNLOCKFILE(fp);
 }
diff --git a/libc/stdio/fclose.c b/libc/stdio/fclose.c
index e94292b..8c3bac4 100644
--- a/libc/stdio/fclose.c
+++ b/libc/stdio/fclose.c
@@ -36,9 +36,6 @@
 #include <stdlib.h>
 #include "local.h"
 
-/* BIONIC: remove any file lock associated with a FILE* pointer */
-extern void __fremovelock(FILE *fp);
-
 int
 fclose(FILE *fp)
 {
@@ -48,6 +45,7 @@
 		errno = EBADF;
 		return (EOF);
 	}
+	FLOCKFILE(fp);
 	WCIO_FREE(fp);
 	r = fp->_flags & __SWR ? __sflush(fp) : 0;
 	if (fp->_close != NULL && (*fp->_close)(fp->_cookie) < 0)
@@ -58,8 +56,8 @@
 		FREEUB(fp);
 	if (HASLB(fp))
 		FREELB(fp);
-	fp->_flags = 0;		/* Release this FILE for reuse. */
 	fp->_r = fp->_w = 0;	/* Mess up if reaccessed. */
-	__fremovelock(fp);
+	fp->_flags = 0;		/* Release this FILE for reuse. */
+	FUNLOCKFILE(fp);
 	return (r);
 }
diff --git a/libc/stdio/feof.c b/libc/stdio/feof.c
index eb742da..0fa65b0 100644
--- a/libc/stdio/feof.c
+++ b/libc/stdio/feof.c
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include "local.h"
 
 /*
  * A subroutine version of the macro feof.
@@ -41,5 +42,10 @@
 int
 feof(FILE *fp)
 {
-	return (__sfeof(fp));
+	int ret;
+
+	FLOCKFILE(fp);
+	ret = __sfeof(fp);
+	FUNLOCKFILE(fp);
+	return (ret);
 }
diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c
index 3f72ad8..e69bdcc 100644
--- a/libc/stdio/fflush.c
+++ b/libc/stdio/fflush.c
@@ -39,14 +39,18 @@
 int
 fflush(FILE *fp)
 {
+	int r;
 
 	if (fp == NULL)
-		return (_fwalk(__sflush));
+		return (_fwalk(__sflush_locked));
+	FLOCKFILE(fp);
 	if ((fp->_flags & (__SWR | __SRW)) == 0) {
 		errno = EBADF;
-		return (EOF);
-	}
-	return (__sflush(fp));
+		r = EOF;
+	} else
+		r = __sflush(fp);
+	FUNLOCKFILE(fp);
+	return (r);
 }
 
 int
@@ -80,3 +84,14 @@
 	}
 	return (0);
 }
+
+int
+__sflush_locked(FILE *fp)
+{
+	int r;
+
+	FLOCKFILE(fp);
+	r = __sflush(fp);
+	FUNLOCKFILE(fp);
+	return (r);
+}
diff --git a/libc/stdio/fgetc.c b/libc/stdio/fgetc.c
index 53e2948..0a6d54e 100644
--- a/libc/stdio/fgetc.c
+++ b/libc/stdio/fgetc.c
@@ -36,5 +36,5 @@
 int
 fgetc(FILE *fp)
 {
-	return (__sgetc(fp));
+	return (getc(fp));
 }
diff --git a/libc/stdio/fgetln.c b/libc/stdio/fgetln.c
index 95a5b31..0947dd8 100644
--- a/libc/stdio/fgetln.c
+++ b/libc/stdio/fgetln.c
@@ -71,19 +71,18 @@
 fgetln(FILE *fp, size_t *lenp)
 {
 	unsigned char *p;
+	char *ret;
 	size_t len;
 	size_t off;
 
+	FLOCKFILE(fp);
+
 	/* make sure there is input */
-	if (fp->_r <= 0 && __srefill(fp)) {
-		*lenp = 0;
-		return (NULL);
-	}
+	if (fp->_r <= 0 && __srefill(fp))
+		goto error;
 
 	/* look for a newline in the input */
 	if ((p = memchr((void *)fp->_p, '\n', fp->_r)) != NULL) {
-		char *ret;
-
 		/*
 		 * Found one.  Flag buffer as modified to keep fseek from
 		 * `optimising' a backward seek, in case the user stomps on
@@ -95,6 +94,7 @@
 		fp->_flags |= __SMOD;
 		fp->_r -= len;
 		fp->_p = p;
+		FUNLOCKFILE(fp);
 		return (ret);
 	}
 
@@ -139,12 +139,15 @@
 		break;
 	}
 	*lenp = len;
+	ret = (char *)fp->_lb._base;
 #ifdef notdef
-	fp->_lb._base[len] = '\0';
+	ret[len] = '\0';
 #endif
-	return ((char *)fp->_lb._base);
+	FUNLOCKFILE(fp);
+	return (ret);
 
 error:
 	*lenp = 0;		/* ??? */
+	FUNLOCKFILE(fp);
 	return (NULL);		/* ??? */
 }
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index f26385d..311b7b2 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -51,6 +51,7 @@
 	if (n <= 0)		/* sanity check */
 		return (NULL);
 
+	FLOCKFILE(fp);
 	_SET_ORIENTATION(fp, -1);
 	s = buf;
 	n--;			/* leave space for NUL */
@@ -61,8 +62,10 @@
 		if (fp->_r <= 0) {
 			if (__srefill(fp)) {
 				/* EOF/error: stop with partial or no line */
-				if (s == buf)
+				if (s == buf) {
+					FUNLOCKFILE(fp);
 					return (NULL);
+                                }
 				break;
 			}
 		}
@@ -84,6 +87,7 @@
 			fp->_p = t;
 			(void)memcpy((void *)s, (void *)p, len);
 			s[len] = '\0';
+			FUNLOCKFILE(fp);
 			return (buf);
 		}
 		fp->_r -= len;
@@ -93,5 +97,6 @@
 		n -= len;
 	}
 	*s = '\0';
+	FUNLOCKFILE(fp);
 	return (buf);
 }
diff --git a/libc/stdio/fileno.c b/libc/stdio/fileno.c
index 0fd985b..cbefdeb 100644
--- a/libc/stdio/fileno.c
+++ b/libc/stdio/fileno.c
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include "local.h"
 
 /*
  * A subroutine version of the macro fileno.
@@ -41,5 +42,10 @@
 int
 fileno(FILE *fp)
 {
-	return (__sfileno(fp));
+	int ret;
+
+	FLOCKFILE(fp);
+	ret = __sfileno(fp);
+	FUNLOCKFILE(fp);
+	return (ret);
 }
diff --git a/libc/stdio/findfp.c b/libc/stdio/findfp.c
index 1d0f9c5..a659c87 100644
--- a/libc/stdio/findfp.c
+++ b/libc/stdio/findfp.c
@@ -39,6 +39,7 @@
 #include <string.h>
 #include "local.h"
 #include "glue.h"
+#include "thread_private.h"
 
 int	__sdidinit;
 
@@ -54,6 +55,8 @@
 static FILE usual[FOPEN_MAX - 3];
 static struct __sfileext usualext[FOPEN_MAX - 3];
 static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
+static struct glue *lastglue = &uglue;
+_THREAD_PRIVATE_MUTEX(__sfp_mutex);
 
 static struct __sfileext __sFext[3];
 FILE __sF[3] = {
@@ -104,16 +107,25 @@
 
 	if (!__sdidinit)
 		__sinit();
-	for (g = &__sglue;; g = g->next) {
+
+	_THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex);
+	for (g = &__sglue; g != NULL; g = g->next) {
 		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
 			if (fp->_flags == 0)
 				goto found;
-		if (g->next == NULL && (g->next = moreglue(NDYNAMIC)) == NULL)
-			break;
 	}
-	return (NULL);
+
+	/* release lock while mallocing */
+	_THREAD_PRIVATE_MUTEX_UNLOCK(__sfp_mutex);
+	if ((g = moreglue(NDYNAMIC)) == NULL)
+		return (NULL);
+	_THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex);
+	lastglue->next = g;
+	lastglue = g;
+	fp = g->iobs;
 found:
 	fp->_flags = 1;		/* reserve this slot; caller sets real flags */
+	_THREAD_PRIVATE_MUTEX_UNLOCK(__sfp_mutex);
 	fp->_p = NULL;		/* no current pointer */
 	fp->_w = 0;		/* nothing to read or write */
 	fp->_r = 0;
@@ -144,8 +156,12 @@
 	n = getdtablesize() - FOPEN_MAX + 20;		/* 20 for slop. */
 	for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next)
 		/* void */;
-	if (n > 0)
-		g->next = moreglue(n);
+	if (n > 0 && ((g = moreglue(n)) != NULL)) {
+		_THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex);
+		lastglue->next = g;
+		lastglue = g;
+		_THREAD_PRIVATE_MUTEX_UNLOCK(__sfp_mutex);
+	}
 }
 #endif
 
@@ -170,12 +186,18 @@
 void
 __sinit(void)
 {
+	_THREAD_PRIVATE_MUTEX(__sinit_mutex);
 	int i;
 
+	_THREAD_PRIVATE_MUTEX_LOCK(__sinit_mutex);
+	if (__sdidinit)
+		goto out;	/* bail out if caller lost the race */
 	for (i = 0; i < FOPEN_MAX - 3; i++) {
 		_FILEEXT_SETUP(usual+i, usualext+i);
 	}
 	/* make sure we clean up on exit */
 	__atexit_register_cleanup(_cleanup); /* conservative */
 	__sdidinit = 1;
+out:
+	_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
 }
diff --git a/libc/stdio/fpurge.c b/libc/stdio/fpurge.c
index fa0213a..e04c4fe 100644
--- a/libc/stdio/fpurge.c
+++ b/libc/stdio/fpurge.c
@@ -43,7 +43,9 @@
 int
 fpurge(FILE *fp)
 {
+	FLOCKFILE(fp);
 	if (!fp->_flags) {
+		FUNLOCKFILE(fp);
 		errno = EBADF;
 		return(EOF);
 	}
@@ -54,5 +56,6 @@
 	fp->_p = fp->_bf._base;
 	fp->_r = 0;
 	fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
+	FUNLOCKFILE(fp);
 	return (0);
 }
diff --git a/libc/stdio/fputc.c b/libc/stdio/fputc.c
index 2a6e7b7..90809e2 100644
--- a/libc/stdio/fputc.c
+++ b/libc/stdio/fputc.c
@@ -33,14 +33,9 @@
 
 #include <stdio.h>
 #include <errno.h>
-#include "local.h"
 
 int
 fputc(int c, FILE *fp)
 {
-	if (cantwrite(fp)) {
-		errno = EBADF;
-		return (EOF);
-	}
 	return (putc(c, fp));
 }
diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c
index 7434ca8..c2462ba 100644
--- a/libc/stdio/fputs.c
+++ b/libc/stdio/fputs.c
@@ -44,11 +44,15 @@
 {
 	struct __suio uio;
 	struct __siov iov;
+	int ret;
 
 	iov.iov_base = (void *)s;
 	iov.iov_len = uio.uio_resid = strlen(s);
 	uio.uio_iov = &iov;
 	uio.uio_iovcnt = 1;
+	FLOCKFILE(fp);
 	_SET_ORIENTATION(fp, -1);
-	return (__sfvwrite(fp, &uio));
+	ret = __sfvwrite(fp, &uio);
+	FUNLOCKFILE(fp);
+	return (ret);
 }
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index 69c40b3..649db17 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -39,9 +39,8 @@
 static int
 lflush(FILE *fp)
 {
-
     if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
-        return (__sflush(fp));
+        return (__sflush_locked(fp));
     return (0);
 }
 
@@ -60,6 +59,7 @@
      */
     if ((resid = count * size) == 0)
         return (0);
+    FLOCKFILE(fp);
     if (fp->_r < 0)
         fp->_r = 0;
     total = resid;
@@ -79,20 +79,25 @@
         fp->_r = 0;     /* largely a convenience for callers */
 
         /* SysV does not make this test; take it out for compatibility */
-        if (fp->_flags & __SEOF)
+        if (fp->_flags & __SEOF) {
+            FUNLOCKFILE(fp);
             return (EOF);
+        }
 
         /* if not already reading, have to be reading and writing */
         if ((fp->_flags & __SRD) == 0) {
             if ((fp->_flags & __SRW) == 0) {
-                errno = EBADF;
                 fp->_flags |= __SERR;
+                FUNLOCKFILE(fp);
+                errno = EBADF;
                 return (EOF);
             }
             /* switch to reading */
             if (fp->_flags & __SWR) {
-                if (__sflush(fp))
+                if (__sflush(fp)) {
+                    FUNLOCKFILE(fp);
                     return (EOF);
+                }
                 fp->_flags &= ~__SWR;
                 fp->_w = 0;
                 fp->_lbfsize = 0;
@@ -116,8 +121,16 @@
          * standard.
          */
 
-        if (fp->_flags & (__SLBF|__SNBF))
+        if (fp->_flags & (__SLBF|__SNBF)) {
+            /* Ignore this file in _fwalk to deadlock. */
+            fp->_flags |= __SIGN;
             (void) _fwalk(lflush);
+            fp->_flags &= ~__SIGN;
+
+            /* Now flush this file without locking it. */
+            if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
+                __sflush(fp);
+        }
 
         while (resid > 0) {
             int   len = (*fp->_read)(fp->_cookie, p, resid );
@@ -128,11 +141,13 @@
                 else {
                     fp->_flags |= __SERR;
                 }
+                FUNLOCKFILE(fp);
                 return ((total - resid) / size);
             }
             p     += len;
             resid -= len;
         }
+        FUNLOCKFILE(fp);
         return (count);
     }
     else
@@ -146,6 +161,7 @@
             resid -= r;
             if (__srefill(fp)) {
                 /* no more input: return partial result */
+                FUNLOCKFILE(fp);
                 return ((total - resid) / size);
             }
         }
@@ -154,5 +170,6 @@
     (void)memcpy((void *)p, (void *)fp->_p, resid);
     fp->_r -= resid;
     fp->_p += resid;
+    FUNLOCKFILE(fp);
     return (count);
 }
diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c
index 59b2228..da3a674 100644
--- a/libc/stdio/freopen.c
+++ b/libc/stdio/freopen.c
@@ -59,6 +59,8 @@
 	if (!__sdidinit)
 		__sinit();
 
+	FLOCKFILE(fp);
+
 	/*
 	 * There are actually programs that depend on being able to "freopen"
 	 * descriptors that weren't originally open.  Keep this from breaking.
@@ -120,6 +122,7 @@
 
 	if (f < 0) {			/* did not get it after all */
 		fp->_flags = 0;		/* set it free */
+		FUNLOCKFILE(fp);
 		errno = sverrno;	/* restore in case _close clobbered */
 		return (NULL);
 	}
@@ -154,5 +157,6 @@
 	 */
 	if (oflags & O_APPEND)
 		(void) __sseek((void *)fp, (fpos_t)0, SEEK_END);
+	FUNLOCKFILE(fp);
 	return (fp);
 }
diff --git a/libc/stdio/fseek.c b/libc/stdio/fseek.c
index 8581b62..38697f5 100644
--- a/libc/stdio/fseek.c
+++ b/libc/stdio/fseek.c
@@ -70,6 +70,7 @@
 	 * Change any SEEK_CUR to SEEK_SET, and check `whence' argument.
 	 * After this, whence is either SEEK_SET or SEEK_END.
 	 */
+	FLOCKFILE(fp);
 	switch (whence) {
 
 	case SEEK_CUR:
@@ -83,8 +84,10 @@
 			curoff = fp->_offset;
 		else {
 			curoff = (*seekfn)(fp->_cookie, (fpos_t)0, SEEK_CUR);
-			if (curoff == (fpos_t)-1)
+			if (curoff == (fpos_t)-1) {
+				FUNLOCKFILE(fp);
 				return (EOF);
+			}
 		}
 		if (fp->_flags & __SRD) {
 			curoff -= fp->_r;
@@ -105,6 +108,7 @@
 		break;
 
 	default:
+		FUNLOCKFILE(fp);
 		errno = EINVAL;
 		return (EOF);
 	}
@@ -189,6 +193,7 @@
 		if (HASUB(fp))
 			FREEUB(fp);
 		fp->_flags &= ~__SEOF;
+		FUNLOCKFILE(fp);
 		return (0);
 	}
 
@@ -215,6 +220,7 @@
 		fp->_p += n;
 		fp->_r -= n;
 	}
+	FUNLOCKFILE(fp);
 	return (0);
 
 	/*
@@ -224,6 +230,7 @@
 dumb:
 	if (__sflush(fp) ||
 	    (*seekfn)(fp->_cookie, (fpos_t)offset, whence) == POS_ERR) {
+		FUNLOCKFILE(fp);
 		return (EOF);
 	}
 	/* success: clear EOF indicator and discard ungetc() data */
@@ -233,6 +240,7 @@
 	fp->_r = 0;
 	/* fp->_w = 0; */	/* unnecessary (I think...) */
 	fp->_flags &= ~__SEOF;
+	FUNLOCKFILE(fp);
 	return (0);
 }
 
diff --git a/libc/stdio/ftell.c b/libc/stdio/ftell.c
index b7d449e..9f850ee 100644
--- a/libc/stdio/ftell.c
+++ b/libc/stdio/ftell.c
@@ -45,20 +45,22 @@
 
 	if (fp->_seek == NULL) {
 		errno = ESPIPE;			/* historic practice */
-		return ((off_t)-1);
+		pos = -1;
+                goto out;
 	}
 
 	/*
 	 * Find offset of underlying I/O object, then
 	 * adjust for buffered bytes.
 	 */
+        FLOCKFILE(fp);
 	__sflush(fp);		/* may adjust seek offset on append stream */
 	if (fp->_flags & __SOFF)
 		pos = fp->_offset;
 	else {
 		pos = (*fp->_seek)(fp->_cookie, (fpos_t)0, SEEK_CUR);
-		if (pos == -1L)
-			return (pos);
+		if (pos == -1)
+			goto out;
 	}
 	if (fp->_flags & __SRD) {
 		/*
@@ -77,6 +79,7 @@
 		 */
 		pos += fp->_p - fp->_bf._base;
 	}
+out:	FUNLOCKFILE(fp);
 	return (pos);
 }
 
diff --git a/libc/stdio/fvwrite.c b/libc/stdio/fvwrite.c
index 57a57e6..39d0604 100644
--- a/libc/stdio/fvwrite.c
+++ b/libc/stdio/fvwrite.c
@@ -48,7 +48,7 @@
 __sfvwrite(FILE *fp, struct __suio *uio)
 {
 	size_t len;
-	char *p;
+	const char *p;
 	struct __siov *iov;
 	int w, s;
 	char *nl;
diff --git a/libc/stdio/fvwrite.h b/libc/stdio/fvwrite.h
index 2344e42..96f65de 100644
--- a/libc/stdio/fvwrite.h
+++ b/libc/stdio/fvwrite.h
@@ -36,7 +36,7 @@
  * I/O descriptors for __sfvwrite().
  */
 struct __siov {
-	void	*iov_base;
+	const void	*iov_base;
 	size_t	iov_len;
 };
 struct __suio {
diff --git a/libc/stdio/fwalk.c b/libc/stdio/fwalk.c
index 5606cf1..b1df891 100644
--- a/libc/stdio/fwalk.c
+++ b/libc/stdio/fwalk.c
@@ -45,8 +45,9 @@
 
 	ret = 0;
 	for (g = &__sglue; g != NULL; g = g->next)
-		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
-			if (fp->_flags != 0)
+		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) {
+			if ((fp->_flags != 0) && ((fp->_flags & __SIGN) == 0))
 				ret |= (*function)(fp);
+		}
 	return (ret);
 }
diff --git a/libc/stdio/fwrite.c b/libc/stdio/fwrite.c
index 8a508dc..a97313e 100644
--- a/libc/stdio/fwrite.c
+++ b/libc/stdio/fwrite.c
@@ -45,6 +45,7 @@
 	size_t n;
 	struct __suio uio;
 	struct __siov iov;
+	int ret;
 
 	iov.iov_base = (void *)buf;
 	uio.uio_resid = iov.iov_len = n = count * size;
@@ -56,7 +57,10 @@
 	 * skip the divide if this happens, since divides are
 	 * generally slow and since this occurs whenever size==0.
 	 */
-	if (__sfvwrite(fp, &uio) == 0)
+	FLOCKFILE(fp);
+	ret = __sfvwrite(fp, &uio);
+	FUNLOCKFILE(fp);
+	if (ret == 0)
 		return (count);
 	return ((n - uio.uio_resid) / size);
 }
diff --git a/libc/stdio/getc.c b/libc/stdio/getc.c
index cdd5722..16a5b1d 100644
--- a/libc/stdio/getc.c
+++ b/libc/stdio/getc.c
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include "local.h"
 
 /*
  * A subroutine version of the macro getc_unlocked.
@@ -54,8 +55,8 @@
 {
 	int c;
 
-	flockfile(fp);
+	FLOCKFILE(fp);
 	c = __sgetc(fp);
-	funlockfile(fp);
+	FUNLOCKFILE(fp);
 	return (c);
 }
diff --git a/libc/stdio/gets.c b/libc/stdio/gets.c
index 004eb99..93e2edd 100644
--- a/libc/stdio/gets.c
+++ b/libc/stdio/gets.c
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include "local.h"
 
 __warn_references(gets,
     "warning: gets() is very unsafe; consider using fgets()");
@@ -42,14 +43,17 @@
 	int c;
 	char *s;
 
-	for (s = buf; (c = getchar()) != '\n';)
+	FLOCKFILE(stdin);
+	for (s = buf; (c = getchar_unlocked()) != '\n';)
 		if (c == EOF)
-			if (s == buf)
+			if (s == buf) {
+				FUNLOCKFILE(stdin);
 				return (NULL);
-			else
+			} else
 				break;
 		else
 			*s++ = c;
 	*s = '\0';
+	FUNLOCKFILE(stdin);
 	return (buf);
 }
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index 3db1fc5..6b2111a 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -46,6 +46,7 @@
  */
 
 int	__sflush(FILE *);
+int	__sflush_locked(FILE *);
 FILE	*__sfp(void);
 int	__srefill(FILE *);
 int	__sread(void *, char *, int);
@@ -59,6 +60,7 @@
 int	_fwalk(int (*)(FILE *));
 int	__swsetup(FILE *);
 int	__sflags(const char *, int *);
+int	__vfprintf(FILE *, const char *, __va_list);
 
 extern void __atexit_register_cleanup(void (*)(void));
 extern int __sdidinit;
@@ -89,3 +91,6 @@
 	free((char *)(fp)->_lb._base); \
 	(fp)->_lb._base = NULL; \
 }
+
+#define FLOCKFILE(fp)   do { if (__isthreaded) flockfile(fp); } while (0)
+#define FUNLOCKFILE(fp) do { if (__isthreaded) funlockfile(fp); } while (0)
diff --git a/libc/stdio/putc.c b/libc/stdio/putc.c
index 9250215..2b05504 100644
--- a/libc/stdio/putc.c
+++ b/libc/stdio/putc.c
@@ -60,8 +60,8 @@
 {
 	int ret;
 
-	flockfile(fp);
+	FLOCKFILE(fp);
 	ret = putc_unlocked(c, fp);
-	funlockfile(fp);
+	FUNLOCKFILE(fp);
 	return (ret);
 }
diff --git a/libc/stdio/puts.c b/libc/stdio/puts.c
index c6ecc24..4603a3d 100644
--- a/libc/stdio/puts.c
+++ b/libc/stdio/puts.c
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include "local.h"
 #include "fvwrite.h"
 
 /*
@@ -44,6 +45,7 @@
 	size_t c = strlen(s);
 	struct __suio uio;
 	struct __siov iov[2];
+	int ret;
 
 	iov[0].iov_base = (void *)s;
 	iov[0].iov_len = c;
@@ -52,5 +54,8 @@
 	uio.uio_resid = c + 1;
 	uio.uio_iov = &iov[0];
 	uio.uio_iovcnt = 2;
-	return (__sfvwrite(stdout, &uio) ? EOF : '\n');
+	FLOCKFILE(stdout);
+	ret = __sfvwrite(stdout, &uio);
+	FUNLOCKFILE(stdout);
+	return (ret ? EOF : '\n');
 }
diff --git a/libc/stdio/refill.c b/libc/stdio/refill.c
index 74b378e..7cb6b78 100644
--- a/libc/stdio/refill.c
+++ b/libc/stdio/refill.c
@@ -39,9 +39,8 @@
 static int
 lflush(FILE *fp)
 {
-
 	if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
-		return (__sflush(fp));
+		return (__sflush_locked(fp)); /* ignored... */
 	return (0);
 }
 
@@ -103,8 +102,16 @@
 	 * flush all line buffered output files, per the ANSI C
 	 * standard.
 	 */
-	if (fp->_flags & (__SLBF|__SNBF))
+	if (fp->_flags & (__SLBF|__SNBF)) {
+		/* Ignore this file in _fwalk to avoid potential deadlock. */
+		fp->_flags |= __SIGN;
 		(void) _fwalk(lflush);
+		fp->_flags &= ~__SIGN;
+
+		/* Now flush this file without locking it. */
+		if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
+		    __sflush(fp);
+	}
 	fp->_p = fp->_bf._base;
 	fp->_r = (*fp->_read)(fp->_cookie, (char *)fp->_p, fp->_bf._size);
 	fp->_flags &= ~__SMOD;	/* buffer contents are again pristine */
diff --git a/libc/stdio/setvbuf.c b/libc/stdio/setvbuf.c
index 9b92bf0..2fb76af 100644
--- a/libc/stdio/setvbuf.c
+++ b/libc/stdio/setvbuf.c
@@ -61,6 +61,7 @@
 	 * malloc()ed.  We also clear any eof condition, as if this were
 	 * a seek.
 	 */
+	FLOCKFILE(fp);
 	ret = 0;
 	(void)__sflush(fp);
 	if (HASUB(fp))
@@ -107,6 +108,7 @@
 			fp->_w = 0;
 			fp->_bf._base = fp->_p = fp->_nbuf;
 			fp->_bf._size = 1;
+			FUNLOCKFILE(fp);
 			return (ret);
 		}
 		flags |= __SMBF;
@@ -145,6 +147,7 @@
 		/* begin/continue reading, or stay in intermediate state */
 		fp->_w = 0;
 	}
+	FUNLOCKFILE(fp);
 	__atexit_register_cleanup(_cleanup);
 
 	return (ret);
diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c
index 45ef7eb..5aa54be 100644
--- a/libc/stdio/snprintf.c
+++ b/libc/stdio/snprintf.c
@@ -60,7 +60,7 @@
 	f._bf._base = f._p = (unsigned char *)str;
 	f._bf._size = f._w = n - 1;
 	va_start(ap, fmt);
-	ret = vfprintf(&f, fmt, ap);
+	ret = __vfprintf(&f, fmt, ap);
 	va_end(ap);
 	*f._p = '\0';
 	return (ret);
diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c
index 67f924b..3cf7952 100644
--- a/libc/stdio/sprintf.c
+++ b/libc/stdio/sprintf.c
@@ -56,7 +56,7 @@
 	f._bf._base = f._p = (unsigned char *)str;
 	f._bf._size = f._w = INT_MAX;
 	va_start(ap, fmt);
-	ret = vfprintf(&f, fmt, ap);
+	ret = __vfprintf(&f, fmt, ap);
 	va_end(ap);
 	*f._p = '\0';
 	return (ret);
diff --git a/libc/stdio/ungetc.c b/libc/stdio/ungetc.c
index fe05258..b493d21 100644
--- a/libc/stdio/ungetc.c
+++ b/libc/stdio/ungetc.c
@@ -82,17 +82,20 @@
 		return (EOF);
 	if (!__sdidinit)
 		__sinit();
+	FLOCKFILE(fp);
 	_SET_ORIENTATION(fp, -1);
 	if ((fp->_flags & __SRD) == 0) {
 		/*
 		 * Not already reading: no good unless reading-and-writing.
 		 * Otherwise, flush any current write stuff.
 		 */
-		if ((fp->_flags & __SRW) == 0)
+		if ((fp->_flags & __SRW) == 0) {
+error:			FUNLOCKFILE(fp);
 			return (EOF);
+		}
 		if (fp->_flags & __SWR) {
 			if (__sflush(fp))
-				return (EOF);
+				goto error;
 			fp->_flags &= ~__SWR;
 			fp->_w = 0;
 			fp->_lbfsize = 0;
@@ -107,9 +110,10 @@
 	 */
 	if (HASUB(fp)) {
 		if (fp->_r >= _UB(fp)._size && __submore(fp))
-			return (EOF);
+			goto error;
 		*--fp->_p = c;
-		fp->_r++;
+inc_ret:	fp->_r++;
+		FUNLOCKFILE(fp);
 		return (c);
 	}
 	fp->_flags &= ~__SEOF;
@@ -122,8 +126,7 @@
 	if (fp->_bf._base != NULL && fp->_p > fp->_bf._base &&
 	    fp->_p[-1] == c) {
 		fp->_p--;
-		fp->_r++;
-		return (c);
+		goto inc_ret;
 	}
 
 	/*
@@ -137,5 +140,6 @@
 	fp->_ubuf[sizeof(fp->_ubuf) - 1] = c;
 	fp->_p = &fp->_ubuf[sizeof(fp->_ubuf) - 1];
 	fp->_r = 1;
+	FUNLOCKFILE(fp);
 	return (c);
 }
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c
index 54c46b3..1630ccb 100644
--- a/libc/stdio/vasprintf.c
+++ b/libc/stdio/vasprintf.c
@@ -37,7 +37,7 @@
 	if (f._bf._base == NULL)
 		goto err;
 	f._bf._size = f._w = 127;		/* Leave room for the NUL */
-	ret = vfprintf(&f, fmt, ap);
+	ret = __vfprintf(&f, fmt, ap);
 	if (ret == -1)
 		goto err;
 	*f._p = '\0';
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index 2ce0361..dac8496 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -100,8 +100,8 @@
 	fake._lbfsize = 0;	/* not actually used, but Just In Case */
 
 	/* do the work, then copy any error status */
-	ret = vfprintf(&fake, fmt, ap);
-	if (ret >= 0 && fflush(&fake))
+	ret = __vfprintf(&fake, fmt, ap);
+	if (ret >= 0 && __sflush(&fake))
 		ret = EOF;
 	if (fake._flags & __SERR)
 		fp->_flags |= __SERR;
@@ -158,6 +158,17 @@
 int
 vfprintf(FILE *fp, const char *fmt0, __va_list ap)
 {
+	int ret;
+
+	FLOCKFILE(fp);
+	ret = __vfprintf(fp, fmt0, ap);
+	FUNLOCKFILE(fp);
+	return (ret);
+}
+
+int
+__vfprintf(FILE *fp, const char *fmt0, __va_list ap)
+{
 	char *fmt;	/* format string */
 	int ch;	/* character from fmt */
 	int n, m, n2;	/* handy integers (short term usage) */
@@ -203,9 +214,9 @@
 	 * below longer.
 	 */
 #define	PADSIZE	16		/* pad chunk size */
-	static char blanks[PADSIZE] =
+	static const char blanks[PADSIZE] =
 	 {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
-	static char zeroes[PADSIZE] =
+	static const char zeroes[PADSIZE] =
 	 {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
 
 	/*
@@ -1219,7 +1230,6 @@
 {
 	int mode, dsgn;
 	char *digits, *bp, *rve;
-	static  char  temp[64];
 
 	if (ch == 'f') {
 		mode = 3;		/* ndigits after the decimal point */
diff --git a/libc/stdio/vfscanf.c b/libc/stdio/vfscanf.c
index c48dd36..78f404e 100644
--- a/libc/stdio/vfscanf.c
+++ b/libc/stdio/vfscanf.c
@@ -117,6 +117,7 @@
 	static short basefix[17] =
 		{ 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
 
+	FLOCKFILE(fp);
 	_SET_ORIENTATION(fp, -1);
 
 	nassigned = 0;
@@ -124,8 +125,10 @@
 	base = 0;		/* XXX just to keep gcc happy */
 	for (;;) {
 		c = *fmt++;
-		if (c == 0)
+		if (c == 0) {
+			FUNLOCKFILE(fp);
 			return (nassigned);
+		}
 		if (isspace(c)) {
 			while ((fp->_r > 0 || __srefill(fp) == 0) &&
 			    isspace(*fp->_p))
@@ -298,6 +301,7 @@
 		 * Disgusting backwards compatibility hacks.	XXX
 		 */
 		case '\0':	/* compat */
+			FUNLOCKFILE(fp);
 			return (EOF);
 
 		default:	/* compat */
@@ -695,8 +699,10 @@
 		}
 	}
 input_failure:
-	return (nassigned ? nassigned : -1);
+	if (nassigned == 0)
+		nassigned = -1;
 match_failure:
+	FUNLOCKFILE(fp);
 	return (nassigned);
 }
 
diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c
index e6dd009..ca30f94 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -58,7 +58,7 @@
 	f._flags = __SWR | __SSTR;
 	f._bf._base = f._p = (unsigned char *)str;
 	f._bf._size = f._w = n - 1;
-	ret = vfprintf(&f, fmt, ap);
+	ret = __vfprintf(&f, fmt, ap);
 	*f._p = '\0';
 	return (ret);
 }
diff --git a/libc/stdio/vsprintf.c b/libc/stdio/vsprintf.c
index 67a53a1..846ee8a 100644
--- a/libc/stdio/vsprintf.c
+++ b/libc/stdio/vsprintf.c
@@ -53,7 +53,7 @@
 	f._flags = __SWR | __SSTR;
 	f._bf._base = f._p = (unsigned char *)str;
 	f._bf._size = f._w = INT_MAX;
-	ret = vfprintf(&f, fmt, ap);
+	ret = __vfprintf(&f, fmt, ap);
 	*f._p = '\0';
 	return (ret);
 }
diff --git a/libc/stdio/wbuf.c b/libc/stdio/wbuf.c
index c757799..e09ac59 100644
--- a/libc/stdio/wbuf.c
+++ b/libc/stdio/wbuf.c
@@ -65,20 +65,20 @@
 	 * stuff c into the buffer.  If this causes the buffer to fill
 	 * completely, or if c is '\n' and the file is line buffered,
 	 * flush it (perhaps a second time).  The second flush will always
-	 * happen on unbuffered streams, where _bf._size==1; fflush()
+	 * happen on unbuffered streams, where _bf._size==1; __sflush()
 	 * guarantees that putc() will always call wbuf() by setting _w
 	 * to 0, so we need not do anything else.
 	 */
 	n = fp->_p - fp->_bf._base;
 	if (n >= fp->_bf._size) {
-		if (fflush(fp))
+		if (__sflush(fp))
 			return (EOF);
 		n = 0;
 	}
 	fp->_w--;
 	*fp->_p++ = c;
 	if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n'))
-		if (fflush(fp))
+		if (__sflush(fp))
 			return (EOF);
 	return (c);
 }
diff --git a/libc/stdio/wcio.h b/libc/stdio/wcio.h
index f8ac1b2..dd6db21 100644
--- a/libc/stdio/wcio.h
+++ b/libc/stdio/wcio.h
@@ -41,7 +41,7 @@
 
 /* BIONIC: disable wchar support */
 #define WCIO_GET(fp) \
-	((struct whcar_io_data*) 0)
+	((struct wchar_io_data*) 0)
 
 #define _SET_ORIENTATION(fp, mode) ((void)0)
 
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 4ba2177..f4bcab9 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -104,6 +104,7 @@
 	return (ret);
 }
 
+#ifdef CRT_LEGACY_WORKAROUND
 /*
  * Register a function to be performed at exit.
  */
@@ -112,6 +113,7 @@
 {
 	return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
 }
+#endif
 
 /*
  * Call all handlers registered with __cxa_atexit() for the shared
diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c
index 2851506..ab637a1 100644
--- a/libc/stdlib/strtod.c
+++ b/libc/stdlib/strtod.c
@@ -754,6 +754,7 @@
 }
 
  static Bigint *p5s;
+ static pthread_mutex_t p5s_mutex = PTHREAD_MUTEX_INITIALIZER;
 
  static Bigint *
 pow5mult
@@ -775,11 +776,13 @@
 
 	if (!(k = (unsigned int) k >> 2))
 		return b;
+	mutex_lock(&p5s_mutex);
 	if (!(p5 = p5s)) {
 		/* first time */
 		p5 = i2b(625);
 		if (p5 == BIGINT_INVALID) {
 			Bfree(b);
+			mutex_unlock(&p5s_mutex);
 			return p5;
 		}
 		p5s = p5;
@@ -797,6 +800,7 @@
 			p51 = mult(p5,p5);
 			if (p51 == BIGINT_INVALID) {
 				Bfree(b);
+				mutex_unlock(&p5s_mutex);
 				return p51;
 			}
 			p5->next = p51;
@@ -804,6 +808,7 @@
 		}
 		p5 = p51;
 	}
+	mutex_unlock(&p5s_mutex);
 	return b;
 }
 
diff --git a/libc/string/index.c b/libc/string/index.c
index fb0492f..81bfba4 100644
--- a/libc/string/index.c
+++ b/libc/string/index.c
@@ -34,7 +34,7 @@
 index(const char *p, int ch)
 {
 	for (;; ++p) {
-		if (*p == ch)
+		if (*p == (char) ch)
 			return((char *)p);
 		if (!*p)
 			return((char *)NULL);
diff --git a/libc/string/memrchr.c b/libc/string/memrchr.c
index a533fef..aeb5643 100644
--- a/libc/string/memrchr.c
+++ b/libc/string/memrchr.c
@@ -35,10 +35,10 @@
         const char*  q = p + n;
 
         while (1) {
-            q--; if (q < p || q[0] == c) break;
-            q--; if (q < p || q[0] == c) break;
-            q--; if (q < p || q[0] == c) break;
-            q--; if (q < p || q[0] == c) break;
+            q--; if (q < p || q[0] == (char) c) break;
+            q--; if (q < p || q[0] == (char) c) break;
+            q--; if (q < p || q[0] == (char) c) break;
+            q--; if (q < p || q[0] == (char) c) break;
         }
         if (q >= p)
             return (void*)q;
diff --git a/libc/string/strchr.c b/libc/string/strchr.c
index 31ba4e2..9b4332c 100644
--- a/libc/string/strchr.c
+++ b/libc/string/strchr.c
@@ -34,7 +34,7 @@
 strchr(const char *p, int ch)
 {
 	for (;; ++p) {
-		if (*p == ch)
+		if (*p == (char) ch)
 			return((char *)p);
 		if (!*p)
 			return((char *)NULL);
diff --git a/libc/string/strerror_r.c b/libc/string/strerror_r.c
index f43d417..2f26f17 100644
--- a/libc/string/strerror_r.c
+++ b/libc/string/strerror_r.c
@@ -21,7 +21,7 @@
 
     for (;;)
     {
-        if (strings[nn].code == 0)
+        if (strings[nn].msg == NULL)
             break;
 
         if (strings[nn].code == code)
diff --git a/libc/string/strrchr.c b/libc/string/strrchr.c
index 4918f82..10c07e6 100644
--- a/libc/string/strrchr.c
+++ b/libc/string/strrchr.c
@@ -36,7 +36,7 @@
 	char *save;
 
 	for (save = NULL;; ++p) {
-		if (*p == ch)
+		if (*p == (char) ch)
 			save = (char *)p;
 		if (!*p)
 			return(save);
diff --git a/libc/tools/bionic_utils.py b/libc/tools/bionic_utils.py
index 17eef13..0bc947b 100644
--- a/libc/tools/bionic_utils.py
+++ b/libc/tools/bionic_utils.py
@@ -105,8 +105,29 @@
     else:
         return None
 
+def find_original_kernel_headers():
+    """try to find the directory containing the original kernel headers"""
+    bionic_root = find_bionic_root()
+    if not bionic_root:
+        D("Could not find Bionic root !!")
+        return None
+
+    path = os.path.normpath(bionic_root + "/../../external/kernel-headers/original")
+    if not os.path.isdir(path):
+        D("Could not find %s" % (path))
+        return None
+
+    return path
+
 def find_kernel_headers():
     """try to find the directory containing the kernel headers for this machine"""
+
+    # First try to find the original kernel headers.
+    ret = find_original_kernel_headers()
+    if ret:
+        D("found original kernel headers in: %s" % (ret))
+        return ret
+
     status, version = commands.getstatusoutput( "uname -r" )  # get Linux kernel version
     if status != 0:
         D("could not execute 'uname -r' command properly")
@@ -116,14 +137,39 @@
     if len(version) > 5 and version[-5:] == "-xenU":
         version = version[:-5]
 
-    path = "/usr/src/linux-headers-" + version
-    D("probing %s for kernel headers" % (path+"/include"))
+    path = "/usr/src/linux-headers-" + version + "/include"
+    D("probing %s for kernel headers" % (path))
     ret = os.path.isdir( path )
     if ret:
-        D("found kernel headers in: %s" % (path + "/include"))
+        D("found kernel headers in: %s" % (path))
         return path
     return None
 
+def find_arch_header(kernel_headers,arch,header):
+    # First, try in <root>/arch/<arm>/include/<header>
+    # corresponding to the location in the kernel source tree for
+    # certain architectures (e.g. arm).
+    path = "%s/arch/%s/include/asm/%s" % (kernel_headers, arch, header)
+    D("Probing for %s" % path)
+    if os.path.exists(path):
+        return path
+
+    # Try <root>/asm-<arch>/include/<header> corresponding to the location
+    # in the kernel source tree for other architectures (e.g. x86).
+    path = "%s/include/asm-%s/%s" % (kernel_headers, arch, header)
+    D("Probing for %s" % path)
+    if os.path.exists(path):
+        return path
+
+    # Otherwise, look under <root>/asm-<arch>/<header> corresponding
+    # the original kernel headers directory
+    path = "%s/asm-%s/%s" % (kernel_headers, arch, header)
+    D("Probing for %s" % path)
+    if os.path.exists(path):
+        return path
+
+
+    return None
 
 # parser for the SYSCALLS.TXT file
 #
@@ -194,7 +240,6 @@
         if number == "stub":
             syscall_id  = -1
             syscall_id2 = -1
-            syscall_id3 = -1
         else:
             try:
                 if number[0] == '#':
@@ -202,21 +247,21 @@
                 numbers = string.split(number,',')
                 syscall_id  = int(numbers[0])
                 syscall_id2 = syscall_id
-                syscall_id3 = syscall_id
                 if len(numbers) > 1:
                     syscall_id2 = int(numbers[1])
-                    syscall_id3 = syscall_id2
-                if len(numbers) > 2:
-                    syscall_id3 = int(numbers[2])
             except:
                 E("invalid syscall number in '%s'" % line)
                 return
 
-        print str(syscall_id) + ':' + str(syscall_id2) + ':' + str(syscall_id3)
+		global verbose
+        if verbose >= 2:
+            if call_id < 0:
+                print "%s: %d,%d" % (syscall_name, syscall_id, syscall_id2)
+            else:
+                print "%s(%d): %d,%d" % (syscall_name, call_id, syscall_id, syscall_id2)
 
         t = { "id"     : syscall_id,
               "id2"    : syscall_id2,
-              "id3"    : syscall_id3,
               "cid"    : call_id,
               "name"   : syscall_name,
               "func"   : syscall_func,
diff --git a/libc/tools/checksyscalls.py b/libc/tools/checksyscalls.py
index 9edb390..2c563d7 100755
--- a/libc/tools/checksyscalls.py
+++ b/libc/tools/checksyscalls.py
@@ -40,8 +40,8 @@
     if len(args) == 0:
         linux_root = find_kernel_headers()
         if linux_root == None:
-            print "could not locate this system kernel headers root directory, please"
-            print "specify one when calling this program, i.e. 'checksyscalls <headers-directory>'"
+            print "Could not locate original or system kernel headers root directory."
+            print "Please specify one when calling this program, i.e. 'checksyscalls <headers-directory>'"
             sys.exit(1)
         print "using the following kernel headers root: '%s'" % linux_root
     else:
@@ -86,8 +86,14 @@
 
     m = re_arm_nr_line.match(line)
     if m:
-        #print "%s = %s" % (m.group(1), m.group(2))
-        dict["ARM_"+m.group(1)] = int(m.group(2)) + 0x0f0000
+        offset_str = m.group(2)
+        #print "%s = %s" % (m.group(1), offset_str)
+        base = 10
+        if offset_str.lower().startswith("0x"):
+          # Processing something similar to
+          #   #define __ARM_NR_cmpxchg  (__ARM_NR_BASE+0x00fff0)
+          base = 16
+        dict["ARM_"+m.group(1)] = int(offset_str, base) + 0x0f0000
         return
 
     m = re_x86_line.match(line)
@@ -113,61 +119,53 @@
 arm_dict = {}
 x86_dict = {}
 
-
-# remove trailing slash and '/include' from the linux_root, if any
+# remove trailing slash from the linux_root, if any
 if linux_root[-1] == '/':
     linux_root = linux_root[:-1]
 
-if len(linux_root) > 8 and linux_root[-8:] == '/include':
-    linux_root = linux_root[:-8]
-
-arm_unistd = linux_root + "/include/asm-arm/unistd.h"
-if not os.path.exists(arm_unistd):
-    print "WEIRD: could not locate the ARM unistd.h header file"
-    print "tried searching in '%s'" % arm_unistd
-    print "maybe using a different set of kernel headers might help"
+arm_unistd = find_arch_header(linux_root, "arm", "unistd.h")
+if not arm_unistd:
+    print "WEIRD: Could not locate the ARM unistd.h kernel header file,"
+    print "maybe using a different set of kernel headers might help."
     sys.exit(1)
 
 # on recent kernels, asm-i386 and asm-x64_64 have been merged into asm-x86
 # with two distinct unistd_32.h and unistd_64.h definition files.
 # take care of this here
 #
-x86_unistd = linux_root + "/include/asm-i386/unistd.h"
-if not os.path.exists(x86_unistd):
-    x86_unistd1 = x86_unistd
-    x86_unistd = linux_root + "/include/asm-x86/unistd_32.h"
-    if not os.path.exists(x86_unistd):
-        print "WEIRD: could not locate the i386/x86 unistd.h header file"
-        print "tried searching in '%s' and '%s'" % (x86_unistd1, x86_unistd)
-        print "maybe using a different set of kernel headers might help"
+x86_unistd = find_arch_header(linux_root, "i386", "unistd.h")
+if not x86_unistd:
+    x86_unistd = find_arch_header(linux_root, "x86", "unistd_32.h")
+    if not x86_unistd:
+        print "WEIRD: Could not locate the i386/x86 unistd.h header file,"
+        print "maybe using a different set of kernel headers might help."
         sys.exit(1)
 
-process_header( linux_root+"/include/asm-arm/unistd.h", arm_dict )
+process_header( arm_unistd, arm_dict )
 process_header( x86_unistd, x86_dict )
 
 # now perform the comparison
 errors = 0
-for sc in syscalls:
-    sc_name = sc["name"]
-    sc_id   = sc["id"]
-    if sc_id >= 0:
-        if not arm_dict.has_key(sc_name):
-            print "arm syscall %s not defined !!" % sc_name
-            errors += 1
-        elif arm_dict[sc_name] != sc_id:
-            print "arm syscall %s should be %d instead of %d !!" % (sc_name, arm_dict[sc_name], sc_id)
-            errors += 1
 
-for sc in syscalls:
-    sc_name = sc["name"]
-    sc_id2  = sc["id2"]
-    if sc_id2 >= 0:
-        if not x86_dict.has_key(sc_name):
-            print "x86 syscall %s not defined !!" % sc_name
-            errors += 1
-        elif x86_dict[sc_name] != sc_id2:
-            print "x86 syscall %s should be %d instead of %d !!" % (sc_name, x86_dict[sc_name], sc_id2)
-            errors += 1
+def check_syscalls(archname, idname, arch_dict):
+    errors = 0
+    for sc in syscalls:
+        sc_name = sc["name"]
+        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)
+                errors += 1
+            elif not arch_dict.has_key(sc_name):
+                print "%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)
+                errors += 1
+    return errors
+
+errors += check_syscalls("arm", "id", arm_dict)
+errors += check_syscalls("x86", "id2", x86_dict)
 
 if errors == 0:
     print "congratulations, everything's fine !!"
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 0535e56..bed9445 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -31,7 +31,7 @@
 bionic_temp = "/tmp/bionic_gensyscalls/"
 
 # all architectures, update as you see fit
-all_archs = [ "arm", "x86", "sh" ]
+all_archs = [ "arm", "x86" ]
 
 def make_dir( path ):
     if not os.path.exists(path):
@@ -79,15 +79,14 @@
 # ARM assembler templates for each syscall stub
 #
 arm_header = """/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
 #include <sys/linux-syscalls.h>
 
-    .text
-    .type %(fname)s, #function
-    .globl %(fname)s
-    .align 4
-    .fnstart
+ENTRY(%(fname)s)
+"""
 
-%(fname)s:
+arm_footer = """\
+END(%(fname)s)
 """
 
 arm_call_default = arm_header + """\
@@ -95,8 +94,7 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
-"""
+""" + arm_footer
 
 arm_call_long = arm_header + """\
     .save   {r4, r5, lr}
@@ -108,8 +106,7 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
-"""
+""" + arm_footer
 
 arm_eabi_call_default = arm_header + """\
     .save   {r4, r7}
@@ -120,8 +117,7 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
-"""
+""" + arm_footer
 
 arm_eabi_call_long = arm_header + """\
     mov     ip, sp
@@ -134,8 +130,7 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-    .fnend
-"""
+""" + arm_footer
 
 # ARM thumb assembler templates for each syscall stub
 #
@@ -188,63 +183,6 @@
     .fnend
 """
 
-# SuperH assembler templates for each syscall stub
-#
-superh_header = """/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type %(fname)s, @function
-    .globl %(fname)s
-    .align 4
-
-%(fname)s:
-"""
-
-superh_call_default = """
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(%(numargs)s + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      %(idname)s_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-%(idname)s_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   %(idname)s
-1:  .long   __set_syscall_errno
-"""
-
-superh_5args_header = """
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-"""
-
-superh_6args_header = """
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-    mov.l   @(4, r15), r1
-"""
-
-superh_7args_header = """
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-    mov.l   @(4, r15), r1
-    mov.l   @(8, r15), r2
-"""
-
-
 def param_uses_64bits(param):
     """Returns True iff a syscall parameter description corresponds
        to a 64-bit type."""
@@ -442,10 +380,6 @@
                 E("cid for dispatch syscalls is only supported for x86 in "
                   "'%s'" % syscall_name)
                 return
-            if t["id3"] >= 0:
-                num_regs = count_generic_param_registers(syscall_params)
-                t["asm-sh"] = self.superh_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
-
 
 
     def gen_NR_syscall(self,fp,name,id):
@@ -495,20 +429,6 @@
                 gen_syscalls[sc_name] = True
         fp.write( "#endif\n" );
 
-        # all superh-specific syscalls
-        fp.write( "\n#if defined(__SH3__) || defined(__SH4__) \n" );
-        for sc in self.syscalls:
-            sc_id  = sc["id"]
-            sc_id2 = sc["id2"]
-            sc_id3 = sc["id3"]
-            sc_name = sc["name"]
-            if sc_id2 != sc_id3 and sc_id3 >= 0:
-                self.gen_NR_syscall( fp, sc_name, sc_id3 )
-            else:
-                if sc_id != sc_id2 and sc_id2 >= 0:
-                    self.gen_NR_syscall( fp, sc_name, sc_id2 )
-        fp.write( "#endif\n" );
-
         fp.write( "\n#endif\n" )
         fp.write( "\n#endif /* _BIONIC_LINUX_SYSCALLS_H_ */\n" );
         fp.close()
@@ -542,7 +462,6 @@
         arch_test = {
             "arm": lambda x: x.has_key("asm-arm") or x.has_key("asm-thumb"),
             "x86": lambda x: x.has_key("asm-x86"),
-            "sh": lambda x: x.has_key("asm-sh")
         }
 
         for sc in self.syscalls:
@@ -557,7 +476,7 @@
         for sc in self.syscalls:
             if sc.has_key("asm-arm") and 'arm' in all_archs:
                 fname = "arch-arm/syscalls/%s.S" % sc["func"]
-                D( ">>> generating "+fname )
+                D2( ">>> generating "+fname )
                 fp = create_file( fname )
                 fp.write(sc["asm-arm"])
                 fp.close()
@@ -565,7 +484,7 @@
 
             if sc.has_key("asm-thumb") and 'arm' in all_archs:
                 fname = "arch-arm/syscalls/%s.S" % sc["func"]
-                D( ">>> generating "+fname )
+                D2( ">>> generating "+fname )
                 fp = create_file( fname )
                 fp.write(sc["asm-thumb"])
                 fp.close()
@@ -573,20 +492,12 @@
 
             if sc.has_key("asm-x86") and 'x86' in all_archs:
                 fname = "arch-x86/syscalls/%s.S" % sc["func"]
-                D( ">>> generating "+fname )
+                D2( ">>> generating "+fname )
                 fp = create_file( fname )
                 fp.write(sc["asm-x86"])
                 fp.close()
                 self.new_stubs.append( fname )
 
-            if sc.has_key("asm-sh"):
-                fname = "arch-sh/syscalls/%s.S" % sc["func"]
-                D( ">>> generating "+fname )
-                fp = create_file( fname )
-                fp.write(sc["asm-sh"])
-                fp.close()
-                self.new_stubs.append( fname )
-
 
     def  regenerate(self):
         D( "scanning for existing architecture-specific stub files" )
@@ -626,7 +537,7 @@
 
         for stub in self.new_stubs + self.other_files:
             if not os.path.exists( bionic_root + stub ):
-                # new file, P4 add it
+                # new file, git add it
                 D( "new file:     " + stub)
                 adds.append( bionic_root + stub )
                 shutil.copyfile( bionic_temp + stub, bionic_root + stub )
@@ -643,16 +554,21 @@
 
 
         if adds:
-            commands.getoutput("p4 add " + " ".join(adds))
+            commands.getoutput("git add " + " ".join(adds))
         if deletes:
-            commands.getoutput("p4 delete " + " ".join(deletes))
+            commands.getoutput("git rm " + " ".join(deletes))
         if edits:
-            commands.getoutput("p4 edit " +
-                               " ".join((bionic_root + file) for file in edits))
             for file in edits:
                 shutil.copyfile( bionic_temp + file, bionic_root + file )
+            commands.getoutput("git add " +
+                               " ".join((bionic_root + file) for file in edits))
 
-        D("ready to go !!")
+        commands.getoutput("git add %s%s" % (bionic_root,"SYSCALLS.TXT"))
+
+        if (not adds) and (not deletes) and (not edits):
+            D("no changes detected!")
+        else:
+            D("ready to go!!")
 
 D_setlevel(1)
 
diff --git a/libc/tools/zoneinfo/ZoneCompactor.java b/libc/tools/zoneinfo/ZoneCompactor.java
new file mode 100644
index 0000000..b657748
--- /dev/null
+++ b/libc/tools/zoneinfo/ZoneCompactor.java
@@ -0,0 +1,166 @@
+
+import java.io.*;
+import java.util.*;
+
+// usage: java ZoneCompiler <setup file> <top-level directory>
+//
+// Compile a set of tzfile-formatted files into a single file plus
+// an index file.
+//
+// The compilation is controlled by a setup file, which is provided as a
+// command-line argument.  The setup file has the form:
+//
+// Link <toName> <fromName>
+// ...
+// <zone filename>
+// ...
+//
+// Note that the links must be declared prior to the zone names.  A
+// zone name is a filename relative to the source directory such as
+// 'GMT', 'Africa/Dakar', or 'America/Argentina/Jujuy'.
+//
+// Use the 'zic' command-line tool to convert from flat files
+// (e.g., 'africa', 'northamerica') into a suitable source directory
+// hierarchy for this tool (e.g., 'data/Africa/Abidjan').
+//
+// Example:
+//     zic -d data tz2007h
+//     javac ZoneCompactor.java
+//     java ZoneCompactor setup data
+//     <produces zoneinfo.dat and zoneinfo.idx>
+
+public class ZoneCompactor {
+
+    // Zone name synonyms
+    Map<String,String> links = new HashMap<String,String>();
+
+    // File starting bytes by zone name
+    Map<String,Integer> starts = new HashMap<String,Integer>();
+
+    // File lengths by zone name
+    Map<String,Integer> lengths = new HashMap<String,Integer>();
+
+    // Raw GMT offsets by zone name
+    Map<String,Integer> offsets = new HashMap<String,Integer>();
+    int start = 0;
+
+    // Maximum number of characters in a zone name, including '\0' terminator
+    private static final int MAXNAME = 40;
+
+    // Concatenate the contents of 'inFile' onto 'out'
+    // and return the contents as a byte array.
+    private static byte[] copyFile(File inFile, OutputStream out)
+        throws Exception {
+        byte[] ret = new byte[0];
+
+        InputStream in = new FileInputStream(inFile);
+        byte[] buf = new byte[8192];
+        while (true) {
+            int nbytes = in.read(buf);
+            if (nbytes == -1) {
+                break;
+            }
+            out.write(buf, 0, nbytes);
+
+            byte[] nret = new byte[ret.length + nbytes];
+            System.arraycopy(ret, 0, nret, 0, ret.length);
+            System.arraycopy(buf, 0, nret, ret.length, nbytes);
+            ret = nret;
+        }
+        out.flush();
+        return ret;
+    }
+    
+    // Write a 32-bit integer in network byte order
+    private void writeInt(OutputStream os, int x) throws IOException {
+        os.write((x >> 24) & 0xff);
+        os.write((x >> 16) & 0xff);
+        os.write((x >>  8) & 0xff);
+        os.write( x        & 0xff);
+    }
+
+    public ZoneCompactor(String setupFilename, String dirName)
+        throws Exception {
+        File zoneInfoFile = new File("zoneinfo.dat");
+        zoneInfoFile.delete();
+        OutputStream zoneInfo = new FileOutputStream(zoneInfoFile);
+
+        BufferedReader rdr = new BufferedReader(new FileReader(setupFilename));
+    
+        String s;
+        while ((s = rdr.readLine()) != null) {
+            s = s.trim();
+            if (s.startsWith("Link")) {
+                StringTokenizer st = new StringTokenizer(s);
+                st.nextToken();
+                String to = st.nextToken();
+                String from = st.nextToken();
+                links.put(from, to);
+            } else {
+                String link = links.get(s);
+                if (link == null) {
+                    File f = new File(dirName, s);
+                    long length = f.length();
+                    starts.put(s, new Integer(start));
+                    lengths.put(s, new Integer((int)length));
+
+                    start += length;
+                    byte[] data = copyFile(f, zoneInfo);
+
+                    TimeZone tz = ZoneInfo.make(s, data);
+                    int gmtOffset = tz.getRawOffset();
+                    offsets.put(s, new Integer(gmtOffset));
+                }
+            }
+        }
+        zoneInfo.close();
+
+        // Fill in fields for links
+        Iterator<String> iter = links.keySet().iterator();
+        while (iter.hasNext()) {
+            String from = iter.next();
+            String to = links.get(from);
+
+            starts.put(from, starts.get(to));
+            lengths.put(from, lengths.get(to));
+            offsets.put(from, offsets.get(to));
+        }
+
+        File idxFile = new File("zoneinfo.idx");
+        idxFile.delete();
+        FileOutputStream idx = new FileOutputStream(idxFile);
+
+        ArrayList<String> l = new ArrayList<String>();
+        l.addAll(starts.keySet());
+        Collections.sort(l);
+        Iterator<String> ziter = l.iterator();
+        while (ziter.hasNext()) {
+            String zname = ziter.next();
+            if (zname.length() >= MAXNAME) {
+                System.err.println("Error - zone filename exceeds " +
+                                   (MAXNAME - 1) + " characters!");
+            }
+
+            byte[] znameBuf = new byte[MAXNAME];
+            for (int i = 0; i < zname.length(); i++) {
+                znameBuf[i] = (byte)zname.charAt(i);
+            }
+            idx.write(znameBuf);
+            writeInt(idx, starts.get(zname).intValue());
+            writeInt(idx, lengths.get(zname).intValue());
+            writeInt(idx, offsets.get(zname).intValue());
+        }
+        idx.close();
+
+        // System.out.println("maxLength = " + maxLength);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            System.err.println("usage: java ZoneCompactor <setup> <data dir>");
+            System.exit(0);
+        }
+        new ZoneCompactor(args[0], args[1]);
+    }
+
+}
diff --git a/libc/tools/zoneinfo/ZoneInfo.java b/libc/tools/zoneinfo/ZoneInfo.java
new file mode 100644
index 0000000..99507ae
--- /dev/null
+++ b/libc/tools/zoneinfo/ZoneInfo.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * Copied from ZoneInfo and ZoneInfoDB in dalvik.
+ * {@hide}
+ */
+public class ZoneInfo extends TimeZone {
+
+    private static final long MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
+    private static final long MILLISECONDS_PER_400_YEARS =
+        MILLISECONDS_PER_DAY * (400 * 365 + 100 - 3);
+
+    private static final long UNIX_OFFSET = 62167219200000L;
+
+    private static final int[] NORMAL = new int[] {
+        0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
+    };
+
+    private static final int[] LEAP = new int[] {
+        0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335,
+    };
+
+    private static String nullName(byte[] data, int where, int off) {
+        if (off < 0)
+            return null;
+
+        int end = where + off;
+        while (end < data.length && data[end] != '\0')
+            end++;
+
+        return new String(data, where + off, end - (where + off));
+    }
+
+    public static ZoneInfo make(String name, byte[] data) {
+        int ntransition = read4(data, 32);
+        int ngmtoff = read4(data, 36);
+        int base = 44;
+
+        int[] transitions = new int[ntransition];
+        for (int i = 0; i < ntransition; i++)
+            transitions[i] = read4(data, base + 4 * i);
+        base += 4 * ntransition;
+
+        byte[] type = new byte[ntransition];
+        for (int i = 0; i < ntransition; i++)
+            type[i] = data[base + i];
+        base += ntransition;
+
+        int[] gmtoff = new int[ngmtoff];
+        byte[] isdst = new byte[ngmtoff];
+        byte[] abbrev = new byte[ngmtoff];
+        for (int i = 0; i < ngmtoff; i++) {
+            gmtoff[i] = read4(data, base + 6 * i);
+            isdst[i] = data[base + 6 * i + 4];
+            abbrev[i] = data[base + 6 * i + 5];
+        }
+
+        base += 6 * ngmtoff;
+
+        return new ZoneInfo(name, transitions, type, gmtoff, isdst, abbrev, data, base);
+    }
+
+    private static int read4(byte[] data, int off) {
+        return ((data[off    ] & 0xFF) << 24) |
+               ((data[off + 1] & 0xFF) << 16) |
+               ((data[off + 2] & 0xFF) <<  8) |
+               ((data[off + 3] & 0xFF) <<  0);
+    }
+
+    /*package*/ ZoneInfo(String name, int[] transitions, byte[] type,
+                     int[] gmtoff, byte[] isdst, byte[] abbrev,
+                     byte[] data, int abbrevoff) {
+        mTransitions = transitions;
+        mTypes = type;
+        mGmtOffs = gmtoff;
+        mIsDsts = isdst;
+        mUseDst = false;
+        setID(name);
+
+        // Find the latest GMT and non-GMT offsets for their abbreviations
+
+        int lastdst;
+        for (lastdst = mTransitions.length - 1; lastdst >= 0; lastdst--) {
+            if (mIsDsts[mTypes[lastdst] & 0xFF] != 0)
+                break;
+        }
+
+        int laststd;
+        for (laststd = mTransitions.length - 1; laststd >= 0; laststd--) {
+            if (mIsDsts[mTypes[laststd] & 0xFF] == 0)
+                break;
+        }
+
+        if (lastdst >= 0) {
+            mDaylightName = nullName(data, abbrevoff,
+                                     abbrev[mTypes[lastdst] & 0xFF]);
+        }
+        if (laststd >= 0) {
+            mStandardName = nullName(data, abbrevoff,
+                                     abbrev[mTypes[laststd] & 0xFF]);
+        }
+
+        // Use the latest non-DST offset if any as the raw offset
+
+        if (laststd < 0) {
+            laststd = 0;
+        }
+
+        if (laststd >= mTypes.length) {
+            mRawOffset = mGmtOffs[0];
+        } else {
+            mRawOffset = mGmtOffs[mTypes[laststd] & 0xFF];
+        }
+
+        // Subtract the raw offset from all offsets so it can be changed
+        // and affect them too.
+        // Find whether there exist any observances of DST.
+
+        for (int i = 0; i < mGmtOffs.length; i++) {
+            mGmtOffs[i] -= mRawOffset;
+
+            if (mIsDsts[i] != 0) {
+                mUseDst = true;
+            }
+        }
+
+        mRawOffset *= 1000;
+    }
+
+    @Override
+    public int getOffset(@SuppressWarnings("unused") int era,
+        int year, int month, int day,
+        @SuppressWarnings("unused") int dayOfWeek,
+        int millis) {
+        // XXX This assumes Gregorian always; Calendar switches from
+        // Julian to Gregorian in 1582.  What calendar system are the
+        // arguments supposed to come from?
+
+        long calc = (year / 400) * MILLISECONDS_PER_400_YEARS;
+        year %= 400;
+
+        calc += year * (365 * MILLISECONDS_PER_DAY);
+        calc += ((year + 3) / 4) * MILLISECONDS_PER_DAY;
+
+        if (year > 0)
+            calc -= ((year - 1) / 100) * MILLISECONDS_PER_DAY;
+
+        boolean isLeap = (year == 0 || (year % 4 == 0 && year % 100 != 0));
+        int[] mlen = isLeap ? LEAP : NORMAL;
+
+        calc += mlen[month] * MILLISECONDS_PER_DAY;
+        calc += (day - 1) * MILLISECONDS_PER_DAY;
+        calc += millis;
+
+        calc -= mRawOffset;
+        calc -= UNIX_OFFSET;
+
+        return getOffset(calc);
+    }
+
+    @Override
+    public int getOffset(long when) {
+        int unix = (int) (when / 1000);
+        int trans = Arrays.binarySearch(mTransitions, unix);
+
+        if (trans == ~0) {
+            return mGmtOffs[0] * 1000 + mRawOffset;
+        }
+        if (trans < 0) {
+            trans = ~trans - 1;
+        }
+
+        return mGmtOffs[mTypes[trans] & 0xFF] * 1000 + mRawOffset;
+    }
+
+    @Override
+    public int getRawOffset() {
+        return mRawOffset;
+    }
+
+    @Override
+    public void setRawOffset(int off) {
+        mRawOffset = off;
+    }
+
+    @Override
+    public boolean inDaylightTime(Date when) {
+        int unix = (int) (when.getTime() / 1000);
+        int trans = Arrays.binarySearch(mTransitions, unix);
+
+        if (trans == ~0) {
+            return mIsDsts[0] != 0;
+        }
+        if (trans < 0) {
+            trans = ~trans - 1;
+        }
+
+        return mIsDsts[mTypes[trans] & 0xFF] != 0;
+    }
+
+    @Override
+    public boolean useDaylightTime() {
+        return mUseDst;
+    }
+
+    private int mRawOffset;
+    private int[] mTransitions;
+    private int[] mGmtOffs;
+    private byte[] mTypes;
+    private byte[] mIsDsts;
+    private boolean mUseDst;
+    private String mDaylightName;
+    private String mStandardName;
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof ZoneInfo)) {
+           return false;
+        }
+        ZoneInfo other = (ZoneInfo) obj;
+        return mUseDst == other.mUseDst
+                && (mDaylightName == null ? other.mDaylightName == null :
+                        mDaylightName.equals(other.mDaylightName))
+                && (mStandardName == null ? other.mStandardName == null :
+                        mStandardName.equals(other.mStandardName))
+                && mRawOffset == other.mRawOffset
+                // Arrays.equals returns true if both arrays are null
+                && Arrays.equals(mGmtOffs, other.mGmtOffs)
+                && Arrays.equals(mIsDsts, other.mIsDsts)
+                && Arrays.equals(mTypes, other.mTypes)
+                && Arrays.equals(mTransitions, other.mTransitions);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((mDaylightName == null) ? 0 :
+                mDaylightName.hashCode());
+        result = prime * result + Arrays.hashCode(mGmtOffs);
+        result = prime * result + Arrays.hashCode(mIsDsts);
+        result = prime * result + mRawOffset;
+        result = prime * result + ((mStandardName == null) ? 0 :
+                mStandardName.hashCode());
+        result = prime * result + Arrays.hashCode(mTransitions);
+        result = prime * result + Arrays.hashCode(mTypes);
+        result = prime * result + (mUseDst ? 1231 : 1237);
+        return result;
+    }
+}
diff --git a/libc/tools/zoneinfo/generate b/libc/tools/zoneinfo/generate
new file mode 100755
index 0000000..3e21d0b
--- /dev/null
+++ b/libc/tools/zoneinfo/generate
@@ -0,0 +1,82 @@
+#!/bin/bash
+# Run with no arguments from any directory, with no special setup required.
+
+# Abort if any command returns an error exit status, or if an undefined
+# variable is used.
+set -e
+set -u
+
+echo "Looking for bionic..."
+bionic_dir=$(cd $(dirname $0)/../../.. && pwd)
+bionic_zoneinfo_dir=$bionic_dir/libc/zoneinfo
+bionic_zoneinfo_tools_dir=$bionic_dir/libc/tools/zoneinfo
+if [[ ! -d "$bionic_zoneinfo_dir" || ! -d "$bionic_zoneinfo_tools_dir" ]]; then
+  echo "Can't find bionic's zoneinfo directories!"
+  exit 1
+fi
+
+echo "Switching to temporary directory..."
+temp_dir=`mktemp -d`
+cd $temp_dir
+trap "rm -rf $temp_dir; exit" INT TERM EXIT
+
+# URL from "Sources for Time Zone and Daylight Saving Time Data"
+# http://www.twinsun.com/tz/tz-link.htm
+echo "Looking for new tzdata..."
+wget -N --no-verbose 'ftp://munnari.oz.au/pub/tzdata*.tar.gz'
+zoneinfo_version_file=$bionic_zoneinfo_dir/zoneinfo.version
+if [ -f "$zoneinfo_version_file" ]; then
+  current_version=tzdata`sed s/\n// < $zoneinfo_version_file`
+else
+  current_version=missing
+fi
+latest_archive=`ls -r -v tzdata*.tar.gz | head -n1`
+latest_version=`basename $latest_archive .tar.gz`
+if [ "$current_version" == "$latest_version" ]; then
+  echo "You already have the latest tzdata ($latest_version)!"
+  exit 1
+fi
+
+md5_sum=`md5sum $latest_archive`
+echo "MD5: $md5_sum"
+
+echo "Extracting $latest_version..."
+mkdir $latest_version
+tar -C $latest_version -zxf $latest_archive
+
+echo "Compiling $latest_version..."
+mkdir data
+for i in \
+    africa \
+    antarctica \
+    asia \
+    australasia \
+    etcetera \
+    europe \
+    factory \
+    northamerica \
+    solar87 \
+    solar88 \
+    solar89 \
+    southamerica
+do
+    zic -d data $latest_version/$i
+done
+
+echo "Compacting $latest_version..."
+(
+    cat $latest_version/* | grep '^Link' | awk '{print $1, $2, $3}'
+    (
+        cat $latest_version/* | grep '^Zone' | awk '{print $2}'
+        cat $latest_version/* | grep '^Link' | awk '{print $3}'
+    ) | LC_ALL="C" sort
+) | grep -v Riyadh8 > setup
+
+javac -d . \
+    $bionic_zoneinfo_tools_dir/ZoneCompactor.java \
+    $bionic_zoneinfo_tools_dir/ZoneInfo.java
+java ZoneCompactor setup data
+
+echo "Updating bionic to $latest_version..."
+mv zoneinfo.dat zoneinfo.idx $bionic_zoneinfo_dir
+echo $latest_version | sed 's/tzdata//' > $bionic_zoneinfo_dir/zoneinfo.version
diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c
index ab713fb..a2cc3b3 100644
--- a/libc/tzcode/strftime.c
+++ b/libc/tzcode/strftime.c
@@ -407,9 +407,9 @@
                     tm = *t;
                     mkt = mktime64(&tm);
                     if (TYPE_SIGNED(time64_t))
-                        (void) sprintf(buf, "%lld",
+                        (void) snprintf(buf, sizeof(buf), "%lld",
                             (long long) mkt);
-                    else    (void) sprintf(buf, "%llu",
+                    else    (void) snprintf(buf, sizeof(buf), "%llu",
                             (unsigned long long) mkt);
                     pt = _add(buf, pt, ptlim, modifier);
                 }
diff --git a/libc/tzcode/strptime.c b/libc/tzcode/strptime.c
index 1f481c9..0567aa4 100644
--- a/libc/tzcode/strptime.c
+++ b/libc/tzcode/strptime.c
@@ -89,29 +89,31 @@
 #define _LEGAL_ALT(x)       { if (alt_format & ~(x)) return (0); }
 
 
+struct century_relyear {
+    int century;
+    int relyear;
+};
 static  int _conv_num(const unsigned char **, int *, int, int);
-static  unsigned char *_strptime(const unsigned char *, const char *, struct tm *, int);
+static  unsigned char *_strptime(const unsigned char *, const char *, struct tm *,
+        struct century_relyear *);
 
 
 char *
 strptime(const char *buf, const char *fmt, struct tm *tm)
 {
-    return (char*)(_strptime((const unsigned char*)buf, fmt, tm, 1));
+    struct century_relyear cr;
+    cr.century = TM_YEAR_BASE;
+    cr.relyear = -1;
+    return (char*)(_strptime((const unsigned char*)buf, fmt, tm, &cr));
 }
 
 static unsigned char *
-_strptime(const unsigned char *buf, const char *fmt, struct tm *tm, int initialize)
+_strptime(const unsigned char *buf, const char *fmt, struct tm *tm, struct century_relyear *cr)
 {
     unsigned char c;
     const unsigned char *bp;
     size_t len = 0;
     int alt_format, i;
-    static int century, relyear;
-
-    if (initialize) {
-        century = TM_YEAR_BASE;
-        relyear = -1;
-    }
 
     bp = (unsigned char *)buf;
     while ((c = *fmt) != '\0') {
@@ -158,43 +160,43 @@
          */
         case 'c':   /* Date and time, using the locale's format. */
             _LEGAL_ALT(_ALT_E);
-            if (!(bp = _strptime(bp, _ctloc(d_t_fmt), tm, 0)))
+            if (!(bp = _strptime(bp, _ctloc(d_t_fmt), tm, cr)))
                 return (NULL);
             break;
 
         case 'D':   /* The date as "%m/%d/%y". */
             _LEGAL_ALT(0);
-            if (!(bp = _strptime(bp, "%m/%d/%y", tm, 0)))
+            if (!(bp = _strptime(bp, "%m/%d/%y", tm, cr)))
                 return (NULL);
             break;
     
         case 'R':   /* The time as "%H:%M". */
             _LEGAL_ALT(0);
-            if (!(bp = _strptime(bp, "%H:%M", tm, 0)))
+            if (!(bp = _strptime(bp, "%H:%M", tm, cr)))
                 return (NULL);
             break;
 
         case 'r':   /* The time as "%I:%M:%S %p". */
             _LEGAL_ALT(0);
-            if (!(bp = _strptime(bp, "%I:%M:%S %p", tm, 0)))
+            if (!(bp = _strptime(bp, "%I:%M:%S %p", tm, cr)))
                 return (NULL);
             break;
 
         case 'T':   /* The time as "%H:%M:%S". */
             _LEGAL_ALT(0);
-            if (!(bp = _strptime(bp, "%H:%M:%S", tm, 0)))
+            if (!(bp = _strptime(bp, "%H:%M:%S", tm, cr)))
                 return (NULL);
             break;
 
         case 'X':   /* The time, using the locale's format. */
             _LEGAL_ALT(_ALT_E);
-            if (!(bp = _strptime(bp, _ctloc(t_fmt), tm, 0)))
+            if (!(bp = _strptime(bp, _ctloc(t_fmt), tm, cr)))
                 return (NULL);
             break;
 
         case 'x':   /* The date, using the locale's format. */
             _LEGAL_ALT(_ALT_E);
-            if (!(bp = _strptime(bp, _ctloc(d_fmt), tm, 0)))
+            if (!(bp = _strptime(bp, _ctloc(d_fmt), tm, cr)))
                 return (NULL);
             break;
 
@@ -253,7 +255,7 @@
             if (!(_conv_num(&bp, &i, 0, 99)))
                 return (NULL);
 
-            century = i * 100;
+            cr->century = i * 100;
             break;
 
         case 'd':   /* The day of month. */
@@ -359,13 +361,13 @@
             if (!(_conv_num(&bp, &i, 0, 9999)))
                 return (NULL);
 
-            relyear = -1;
+            cr->relyear = -1;
             tm->tm_year = i - TM_YEAR_BASE;
             break;
 
         case 'y':   /* The year within the century (2 digits). */
             _LEGAL_ALT(_ALT_E | _ALT_O);
-            if (!(_conv_num(&bp, &relyear, 0, 99)))
+            if (!(_conv_num(&bp, &cr->relyear, 0, 99)))
                 return (NULL);
             break;
 
@@ -391,14 +393,14 @@
      * We need to evaluate the two digit year spec (%y)
      * last as we can get a century spec (%C) at any time.
      */
-    if (relyear != -1) {
-        if (century == TM_YEAR_BASE) {
-            if (relyear <= 68)
-                tm->tm_year = relyear + 2000 - TM_YEAR_BASE;
+    if (cr->relyear != -1) {
+        if (cr->century == TM_YEAR_BASE) {
+            if (cr->relyear <= 68)
+                tm->tm_year = cr->relyear + 2000 - TM_YEAR_BASE;
             else
-                tm->tm_year = relyear + 1900 - TM_YEAR_BASE;
+                tm->tm_year = cr->relyear + 1900 - TM_YEAR_BASE;
         } else {
-            tm->tm_year = relyear + century - TM_YEAR_BASE;
+            tm->tm_year = cr->relyear + cr->century - TM_YEAR_BASE;
         }
     }
 
diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c
index cbb98b3..2fe2a4e 100644
--- a/libc/unistd/exec.c
+++ b/libc/unistd/exec.c
@@ -36,6 +36,7 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <stdio.h>
 #include <paths.h>
 #include <stdarg.h>
@@ -194,9 +195,9 @@
 			(void)writev(STDERR_FILENO, iov, 3);
 			continue;
 		}
-		bcopy(p, buf, lp);
+		memcpy(buf, p, lp);
 		buf[lp] = '/';
-		bcopy(name, buf + lp + 1, ln);
+		memcpy(buf + lp + 1, name, ln);
 		buf[lp + ln + 1] = '\0';
 
 retry:		(void)execve(bp, argv, environ);
@@ -216,7 +217,7 @@
 				goto done;
 			memp[0] = "sh";
 			memp[1] = bp;
-			bcopy(argv + 1, memp + 2, cnt * sizeof(char *));
+			memcpy(memp + 2, argv + 1, cnt * sizeof(char *));
 			(void)execve(_PATH_BSHELL, memp, environ);
 			goto done;
 		case ENOMEM:
diff --git a/libc/unistd/getcwd.c b/libc/unistd/getcwd.c
index 1cf80e9..1172445 100644
--- a/libc/unistd/getcwd.c
+++ b/libc/unistd/getcwd.c
@@ -26,10 +26,15 @@
  * SUCH DAMAGE.
  */
 #include <unistd.h>
+#include <errno.h>
 
 extern int __getcwd(char * buf, size_t size);
 
 char *getcwd(char *buf, size_t size)
 {
+  if (buf == NULL || size == 0) {
+    errno = EINVAL;
+    return NULL;
+  }
   return ( __getcwd(buf, size) < 0 ) ? NULL : buf;
 }
diff --git a/libc/unistd/open.c b/libc/unistd/open.c
index e8b1c89..03cba45 100644
--- a/libc/unistd/open.c
+++ b/libc/unistd/open.c
@@ -35,9 +35,7 @@
 {
     mode_t  mode = 0;
 
-#if !defined(__i386__)
     flags |= O_LARGEFILE;
-#endif
 
     if (flags & O_CREAT)
     {
diff --git a/libc/unistd/openat.c b/libc/unistd/openat.c
index 88b39a4..6b7b367 100644
--- a/libc/unistd/openat.c
+++ b/libc/unistd/openat.c
@@ -35,9 +35,7 @@
 {
     mode_t  mode = 0;
 
-#if !defined(__i386__)
     flags |= O_LARGEFILE;
-#endif
 
     if (flags & O_CREAT)
     {
diff --git a/libc/unistd/opendir.c b/libc/unistd/opendir.c
index afa3ea0..f178bc6 100644
--- a/libc/unistd/opendir.c
+++ b/libc/unistd/opendir.c
@@ -92,6 +92,9 @@
 _readdir_unlocked(DIR*  dir)
 {
     struct dirent*  entry;
+#ifndef NDEBUG
+    unsigned reclen;
+#endif
 
     if ( !dir->_DIR_avail )
     {
@@ -115,15 +118,18 @@
     if (((long)(void*)entry & 3) != 0)
         return NULL;
 
-    if ( (unsigned)entry->d_reclen > sizeof(*entry)         ||
-         entry->d_reclen <= offsetof(struct dirent, d_name) )
+#ifndef NDEBUG
+    // paranoid testing of the interface with the kernel getdents64 system call
+    reclen = offsetof(struct dirent, d_name) + strlen(entry->d_name) + 1;
+    if ( reclen > sizeof(*entry) || reclen <= offsetof(struct dirent, d_name) )
         goto Bad;
 
-    if ( (char*)entry + entry->d_reclen > (char*)dir->_DIR_buff + sizeof(dir->_DIR_buff) )
+    if ( (char*)entry + reclen > (char*)dir->_DIR_buff + sizeof(dir->_DIR_buff) )
         goto Bad;
 
-    if ( !memchr( entry->d_name, 0, entry->d_reclen - offsetof(struct dirent, d_name)) )
+    if ( !memchr( entry->d_name, 0, reclen - offsetof(struct dirent, d_name)) )
         goto Bad; 
+#endif
 
     dir->_DIR_next   = (struct dirent*)((char*)entry + entry->d_reclen);
     dir->_DIR_avail -= entry->d_reclen;
diff --git a/libc/unistd/pathconf.c b/libc/unistd/pathconf.c
index 032f918..26b580f 100644
--- a/libc/unistd/pathconf.c
+++ b/libc/unistd/pathconf.c
@@ -70,13 +70,12 @@
     };
     int  nn = 0;
 
-    for (;;) {
-        if ( known64[nn] == EOL_MAGIC )
-            return 32;
-
-        if ( known64[nn] == s->f_type )
+    for (; known64[nn] != EOL_MAGIC; ++nn) {
+        if (known64[nn] == s->f_type) {
             return 64;
+        }
     }
+    return 32;
 }
 
 
@@ -99,12 +98,10 @@
     };
     int   nn = 0;
 
-    for (;;) {
-        if ( knownMax[nn].type == EOL_MAGIC )
-            return LINK_MAX;
-
-        if ( knownMax[nn].type == s->f_type )
+    for (; knownMax[nn].type != EOL_MAGIC; ++nn) {
+        if (knownMax[nn].type == s->f_type) {
             return knownMax[nn].max;
+        }
     }
     return LINK_MAX;
 }
@@ -121,12 +118,12 @@
     };
     int  nn = 0;
 
-    for (;;) {
-        if (knownNoSymlinks[nn] == 0)
-            return 1;
-        if (knownNoSymlinks[nn] == s->f_type)
+    for (; knownNoSymlinks[nn] != EOL_MAGIC; ++nn) {
+        if (knownNoSymlinks[nn] == s->f_type) {
             return 0;
+        }
     }
+    return 1;
 }
 
 static long
diff --git a/libc/unistd/popen.c b/libc/unistd/popen.c
index 15f8325..c2355c1 100644
--- a/libc/unistd/popen.c
+++ b/libc/unistd/popen.c
@@ -48,6 +48,8 @@
 	pid_t pid;
 } *pidlist;
 
+extern char **environ;
+
 FILE *
 popen(const char *program, const char *type)
 {
@@ -55,6 +57,7 @@
 	FILE *iop;
 	int pdes[2];
 	pid_t pid;
+	char *argp[] = {"sh", "-c", NULL, NULL};
 
 	if ((*type != 'r' && *type != 'w') || type[1] != '\0') {
 		errno = EINVAL;
@@ -69,7 +72,7 @@
 		return (NULL);
 	}
 
-	switch (pid = vfork()) {
+	switch (pid = fork()) {
 	case -1:			/* Error. */
 		(void)close(pdes[0]);
 		(void)close(pdes[1]);
@@ -80,24 +83,17 @@
 	    {
 		struct pid *pcur;
 		/*
-		 * because vfork() instead of fork(), must leak FILE *,
-		 * but luckily we are terminally headed for an execl()
+		 * We fork()'d, we got our own copy of the list, no
+		 * contention.
 		 */
 		for (pcur = pidlist; pcur; pcur = pcur->next)
 			close(fileno(pcur->fp));
 
 		if (*type == 'r') {
-			int tpdes1 = pdes[1];
-
 			(void) close(pdes[0]);
-			/*
-			 * We must NOT modify pdes, due to the
-			 * semantics of vfork.
-			 */
-			if (tpdes1 != STDOUT_FILENO) {
-				(void)dup2(tpdes1, STDOUT_FILENO);
-				(void)close(tpdes1);
-				tpdes1 = STDOUT_FILENO;
+			if (pdes[1] != STDOUT_FILENO) {
+				(void)dup2(pdes[1], STDOUT_FILENO);
+				(void)close(pdes[1]);
 			}
 		} else {
 			(void)close(pdes[1]);
@@ -106,7 +102,8 @@
 				(void)close(pdes[0]);
 			}
 		}
-		execl(_PATH_BSHELL, "sh", "-c", program, (char *)NULL);
+		argp[2] = (char *)program;
+		execve(_PATH_BSHELL, argp, environ);
 		_exit(127);
 		/* NOTREACHED */
 	    }
diff --git a/libc/unistd/time.c b/libc/unistd/time.c
index 13d7366..18aa62c 100644
--- a/libc/unistd/time.c
+++ b/libc/unistd/time.c
@@ -34,29 +34,40 @@
 time(time_t *t)
 {
 	struct timeval tt;
+	time_t ret;
 
 	if (gettimeofday(&tt, (struct timezone *)0) < 0)
-		return (-1);
-	if (t)
-		*t = (time_t)tt.tv_sec;
-	return (tt.tv_sec);
+		ret = -1;
+	else
+		ret = tt.tv_sec;
+	if (t != NULL)
+		*t = ret;
+	return ret;
 }
 
+// return monotonically increasing CPU time in ticks relative to unspecified epoch
+static inline clock_t clock_now(void)
+{
+	struct timespec tm;
+	clock_gettime( CLOCK_MONOTONIC, &tm);
+	return tm.tv_sec * CLOCKS_PER_SEC + (tm.tv_nsec * (CLOCKS_PER_SEC/1e9));
+}
 
+// initialized by the constructor below
+static clock_t clock_start;
+
+// called by dlopen when .so is loaded
+__attribute__((constructor)) static void clock_crt0(void)
+{
+	clock_start = clock_now();
+}
+
+// return elapsed CPU time in clock ticks, since start of program execution
+// (spec says epoch is undefined, but glibc uses crt0 as epoch)
 clock_t
 clock(void)
 {
-	struct timespec  tm;
-	static int       clock_inited;
-	static clock_t   clock_start;
-	clock_t          now;
-
-	clock_gettime( CLOCK_MONOTONIC, &tm);
-	now = tm.tv_sec * CLOCKS_PER_SEC + (tm.tv_nsec * (CLOCKS_PER_SEC/1e9));
-
-	if (!clock_inited) {
-		clock_start  = now;
-		clock_inited = 1;
-	}
-	return  now - clock_start;
+	// note that if we are executing in a different thread than crt0, then the
+	// pthread_create that made us had a memory barrier so clock_start is defined
+	return clock_now() - clock_start;
 }
diff --git a/libc/zoneinfo/MODULE_LICENSE_PUBLIC_DOMAIN b/libc/zoneinfo/MODULE_LICENSE_PUBLIC_DOMAIN
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc/zoneinfo/MODULE_LICENSE_PUBLIC_DOMAIN
diff --git a/libc/zoneinfo/zoneinfo.dat b/libc/zoneinfo/zoneinfo.dat
index 27ca5d0..cc1cb38 100644
--- a/libc/zoneinfo/zoneinfo.dat
+++ b/libc/zoneinfo/zoneinfo.dat
Binary files differ
diff --git a/libc/zoneinfo/zoneinfo.idx b/libc/zoneinfo/zoneinfo.idx
index 09bd15f..0483c28 100644
--- a/libc/zoneinfo/zoneinfo.idx
+++ b/libc/zoneinfo/zoneinfo.idx
Binary files differ
diff --git a/libc/zoneinfo/zoneinfo.version b/libc/zoneinfo/zoneinfo.version
index 76dcafb..9412b94 100644
--- a/libc/zoneinfo/zoneinfo.version
+++ b/libc/zoneinfo/zoneinfo.version
@@ -1 +1 @@
-2010k
+2012c
diff --git a/libdl/Android.mk b/libdl/Android.mk
index 8d56f9a..d2289f8 100644
--- a/libdl/Android.mk
+++ b/libdl/Android.mk
@@ -18,11 +18,9 @@
 LOCAL_LDFLAGS := -Wl,--exclude-libs=libgcc.a
 
 # for x86, exclude libgcc_eh.a for the same reasons as above
-ifneq ($(TARGET_SIMULATOR),true)
 ifeq ($(TARGET_ARCH),x86)
 LOCAL_LDFLAGS += -Wl,--exclude-libs=libgcc_eh.a
 endif
-endif
 
 LOCAL_SRC_FILES:= libdl.c
 
diff --git a/libdl/libdl.c b/libdl/libdl.c
index b36af16..1d51c37 100644
--- a/libdl/libdl.c
+++ b/libdl/libdl.c
@@ -21,16 +21,16 @@
 void *dlopen(const char *filename, int flag) { return 0; }
 const char *dlerror(void) { return 0; }
 void *dlsym(void *handle, const char *symbol) { return 0; }
-int dladdr(void *addr, Dl_info *info) { return 0; }
+int dladdr(const void *addr, Dl_info *info) { return 0; }
 int dlclose(void *handle) { return 0; }
 
 #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 29c75a2..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,31 +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
-    ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-sh)
-      libm_common_src_files += \
-		sh/fenv.c \
-		src/s_scalbln.c \
-		src/s_scalbn.c \
-		src/s_scalbnf.c
-
-      libm_common_includes = $(LOCAL_PATH)/sh
-    else
-      $(error "Unknown architecture")
-    endif
-  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
 # ========================================================
@@ -198,6 +197,7 @@
 
 LOCAL_ARM_MODE := arm
 LOCAL_C_INCLUDES += $(libm_common_includes)
+LOCAL_CFLAGS := $(libm_common_cflags)
 
 LOCAL_MODULE:= libm
 
@@ -216,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/i387/fenv.c b/libm/i387/fenv.c
index aabe270..89ddc55 100644
--- a/libm/i387/fenv.c
+++ b/libm/i387/fenv.c
@@ -31,16 +31,46 @@
 #include "npx.h"
 #include "fenv.h"
 
+/*
+ * As compared to the x87 control word, the SSE unit's control word
+ * has the rounding control bits offset by 3 and the exception mask
+ * bits offset by 7.
+ */
+#define	_SSE_ROUND_SHIFT	3
+#define	_SSE_EMASK_SHIFT	7
+
 const fenv_t __fe_dfl_env = {
-	__INITIAL_NPXCW__,
-	0x0000,
-	0x0000,
-	0x1f80,
-	0xffffffff,
+	__INITIAL_NPXCW__, /*__control*/
+	0x0000,            /*__mxcsr_hi*/
+	0x0000,            /*__status*/
+	0x1f80,            /*__mxcsr_lo*/
+	0xffffffff,        /*__tag*/
 	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }
+	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff } /*__other*/
 };
 
+#define __fldcw(__cw)           __asm __volatile("fldcw %0" : : "m" (__cw))
+#define __fldenv(__env)         __asm __volatile("fldenv %0" : : "m" (__env))
+#define	__fldenvx(__env)	__asm __volatile("fldenv %0" : : "m" (__env)  \
+				: "st", "st(1)", "st(2)", "st(3)", "st(4)",   \
+				"st(5)", "st(6)", "st(7)")
+#define __fnclex()              __asm __volatile("fnclex")
+#define __fnstenv(__env)        __asm __volatile("fnstenv %0" : "=m" (*(__env)))
+#define __fnstcw(__cw)          __asm __volatile("fnstcw %0" : "=m" (*(__cw)))
+#define __fnstsw(__sw)          __asm __volatile("fnstsw %0" : "=am" (*(__sw)))
+#define __fwait()               __asm __volatile("fwait")
+#define __ldmxcsr(__csr)        __asm __volatile("ldmxcsr %0" : : "m" (__csr))
+#define __stmxcsr(__csr)        __asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
+
+/* After testing for SSE support once, we cache the result in __has_sse. */
+enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK };
+#ifdef __SSE__
+#define __HAS_SSE()     1
+#else
+#define __HAS_SSE()     (__has_sse == __SSE_YES ||                      \
+                         (__has_sse == __SSE_UNK && __test_sse()))
+#endif
+
 enum __sse_support __has_sse =
 #ifdef __SSE__
 	__SSE_YES;
@@ -48,6 +78,7 @@
 	__SSE_UNK;
 #endif
 
+#ifndef __SSE__
 #define	getfl(x)	__asm __volatile("pushfl\n\tpopl %0" : "=mr" (*(x)))
 #define	setfl(x)	__asm __volatile("pushl %0\n\tpopfl" : : "g" (x))
 #define	cpuid_dx(x)	__asm __volatile("pushl %%ebx\n\tmovl $1, %%eax\n\t"  \
@@ -82,23 +113,27 @@
 	__has_sse = __SSE_NO;
 	return (0);
 }
+#endif /* __SSE__ */
 
 int
 fesetexceptflag(const fexcept_t *flagp, int excepts)
 {
 	fenv_t env;
-	int mxcsr;
+	__uint32_t mxcsr;
 
-	__fnstenv(&env);
-	env.__status &= ~excepts;
-	env.__status |= *flagp & excepts;
-	__fldenv(env);
-
-	if (__HAS_SSE()) {
-		__stmxcsr(&mxcsr);
-		mxcsr &= ~excepts;
-		mxcsr |= *flagp & excepts;
-		__ldmxcsr(mxcsr);
+	excepts &= FE_ALL_EXCEPT;
+	if (excepts) { /* Do nothing if excepts is 0 */
+		__fnstenv(&env);
+		env.__status &= ~excepts;
+		env.__status |= *flagp & excepts;
+		__fnclex();
+		__fldenv(env);
+		if (__HAS_SSE()) {
+			__stmxcsr(&mxcsr);
+			mxcsr &= ~excepts;
+			mxcsr |= *flagp & excepts;
+			__ldmxcsr(mxcsr);
+		}
 	}
 
 	return (0);
@@ -117,32 +152,38 @@
 int
 fegetenv(fenv_t *envp)
 {
-	int control, mxcsr;
+	__uint32_t mxcsr;
 
-	/*
-	 * fnstenv masks all exceptions, so we need to save and
-	 * restore the control word to avoid this side effect.
-	 */
-	__fnstcw(&control);
 	__fnstenv(envp);
+	/*
+	 * fnstenv masks all exceptions, so we need to restore
+	 * the old control word to avoid this side effect.
+	 */
+	__fldcw(envp->__control);
 	if (__HAS_SSE()) {
 		__stmxcsr(&mxcsr);
-		__set_mxcsr(*envp, mxcsr);
+		envp->__mxcsr_hi = mxcsr >> 16;
+		envp->__mxcsr_lo = mxcsr & 0xffff;
 	}
-	__fldcw(control);
 	return (0);
 }
 
 int
 feholdexcept(fenv_t *envp)
 {
-	int mxcsr;
+	__uint32_t mxcsr;
+	fenv_t env;
 
-	__fnstenv(envp);
+	__fnstenv(&env);
+	*envp = env;
+	env.__status &= ~FE_ALL_EXCEPT;
+	env.__control |= FE_ALL_EXCEPT;
 	__fnclex();
+	__fldenv(env);
 	if (__HAS_SSE()) {
 		__stmxcsr(&mxcsr);
-		__set_mxcsr(*envp, mxcsr);
+		envp->__mxcsr_hi = mxcsr >> 16;
+		envp->__mxcsr_lo = mxcsr & 0xffff;
 		mxcsr &= ~FE_ALL_EXCEPT;
 		mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT;
 		__ldmxcsr(mxcsr);
@@ -153,60 +194,198 @@
 int
 feupdateenv(const fenv_t *envp)
 {
-	int mxcsr;
-	short status;
+	__uint32_t mxcsr;
+	__uint16_t status;
 
 	__fnstsw(&status);
-	if (__HAS_SSE())
+	if (__HAS_SSE()) {
 		__stmxcsr(&mxcsr);
-	else
+	} else {
 		mxcsr = 0;
+	}
 	fesetenv(envp);
 	feraiseexcept((mxcsr | status) & FE_ALL_EXCEPT);
 	return (0);
 }
 
 int
-__feenableexcept(int mask)
+feenableexcept(int mask)
 {
-	int mxcsr, control, omask;
+	__uint32_t mxcsr;
+	__uint16_t control, omask;
 
 	mask &= FE_ALL_EXCEPT;
 	__fnstcw(&control);
-	if (__HAS_SSE())
-		__stmxcsr(&mxcsr);
-	else
-		mxcsr = 0;
-	omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
-	control &= ~mask;
-	__fldcw(control);
 	if (__HAS_SSE()) {
-		mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
-		__ldmxcsr(mxcsr);
+		__stmxcsr(&mxcsr);
+	} else {
+		mxcsr = 0;
 	}
-	return (~omask);
+	omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
+	if (mask) {
+		control &= ~mask;
+		__fldcw(control);
+		if (__HAS_SSE()) {
+			mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
+			__ldmxcsr(mxcsr);
+		}
+	}
+	return (omask);
 }
 
 int
-__fedisableexcept(int mask)
+fedisableexcept(int mask)
 {
-	int mxcsr, control, omask;
+	__uint32_t mxcsr;
+	__uint16_t control, omask;
 
 	mask &= FE_ALL_EXCEPT;
 	__fnstcw(&control);
-	if (__HAS_SSE())
-		__stmxcsr(&mxcsr);
-	else
-		mxcsr = 0;
-	omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
-	control |= mask;
-	__fldcw(control);
 	if (__HAS_SSE()) {
-		mxcsr |= mask << _SSE_EMASK_SHIFT;
-		__ldmxcsr(mxcsr);
+		__stmxcsr(&mxcsr);
+	} else {
+		mxcsr = 0;
 	}
-	return (~omask);
+	omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
+	if (mask) {
+		control |= mask;
+		__fldcw(control);
+		if (__HAS_SSE()) {
+			mxcsr |= mask << _SSE_EMASK_SHIFT;
+			__ldmxcsr(mxcsr);
+		}
+	}
+	return (omask);
 }
 
-__weak_reference(__feenableexcept, feenableexcept);
-__weak_reference(__fedisableexcept, fedisableexcept);
+int
+feclearexcept(int excepts)
+{
+	fenv_t env;
+	__uint32_t mxcsr;
+
+	excepts &= FE_ALL_EXCEPT;
+	if (excepts) { /* Do nothing if excepts is 0 */
+		__fnstenv(&env);
+		env.__status &= ~excepts;
+		__fnclex();
+		__fldenv(env);
+		if (__HAS_SSE()) {
+			__stmxcsr(&mxcsr);
+			mxcsr &= ~excepts;
+			__ldmxcsr(mxcsr);
+		}
+	}
+	return (0);
+}
+
+int
+fegetexceptflag(fexcept_t *flagp, int excepts)
+{
+	__uint32_t mxcsr;
+	__uint16_t status;
+
+	excepts &= FE_ALL_EXCEPT;
+	__fnstsw(&status);
+	if (__HAS_SSE()) {
+		__stmxcsr(&mxcsr);
+	} else {
+		mxcsr = 0;
+	}
+	*flagp = (status | mxcsr) & excepts;
+	return (0);
+}
+
+int
+fetestexcept(int excepts)
+{
+	__uint32_t mxcsr;
+	__uint16_t status;
+
+	excepts &= FE_ALL_EXCEPT;
+	if (excepts) { /* Do nothing if excepts is 0 */
+		__fnstsw(&status);
+		if (__HAS_SSE()) {
+			__stmxcsr(&mxcsr);
+		} else {
+			mxcsr = 0;
+		}
+		return ((status | mxcsr) & excepts);
+	}
+	return (0);
+}
+
+int
+fegetround(void)
+{
+	__uint16_t control;
+
+	/*
+	 * We assume that the x87 and the SSE unit agree on the
+	 * rounding mode.  Reading the control word on the x87 turns
+	 * out to be about 5 times faster than reading it on the SSE
+	 * unit on an Opteron 244.
+	 */
+	__fnstcw(&control);
+	return (control & _ROUND_MASK);
+}
+
+int
+fesetround(int round)
+{
+	__uint32_t mxcsr;
+	__uint16_t control;
+
+	if (round & ~_ROUND_MASK) {
+		return (-1);
+	} else {
+		__fnstcw(&control);
+		control &= ~_ROUND_MASK;
+		control |= round;
+		__fldcw(control);
+		if (__HAS_SSE()) {
+			__stmxcsr(&mxcsr);
+			mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT);
+			mxcsr |= round << _SSE_ROUND_SHIFT;
+			__ldmxcsr(mxcsr);
+		}
+		return (0);
+	}
+}
+
+int
+fesetenv(const fenv_t *envp)
+{
+	fenv_t env = *envp;
+	__uint32_t mxcsr;
+
+	mxcsr = (env.__mxcsr_hi << 16) | (env.__mxcsr_lo);
+	env.__mxcsr_hi = 0xffff;
+	env.__mxcsr_lo = 0xffff;
+	/*
+	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this
+	 * instruction clobbers the i387 register stack.  This happens because
+	 * we restore the tag word from the saved environment.  Normally, this
+	 * would happen anyway and we wouldn't care, because the ABI allows
+	 * function calls to clobber the i387 regs.  However, fesetenv() is
+	 * inlined, so we need to be more careful.
+	 */
+	__fldenvx(env);
+	if (__HAS_SSE()) {
+		__ldmxcsr(mxcsr);
+	}
+	return (0);
+}
+
+int
+fegetexcept(void)
+{
+	__uint16_t control;
+
+	/*
+	 * We assume that the masks for the x87 and the SSE unit are
+	 * the same.
+	 */
+	__fnstcw(&control);
+	return (~control & FE_ALL_EXCEPT);
+}
diff --git a/libm/include/i387/fenv.h b/libm/include/i387/fenv.h
index 5fe64e2..710494c 100644
--- a/libm/include/i387/fenv.h
+++ b/libm/include/i387/fenv.h
@@ -45,13 +45,6 @@
 	char		__other[16];
 } fenv_t;
 
-#define	__get_mxcsr(env)	(((env).__mxcsr_hi << 16) |	\
-				 ((env).__mxcsr_lo))
-#define	__set_mxcsr(env, x)	do {				\
-	(env).__mxcsr_hi = (__uint32_t)(x) >> 16;		\
-	(env).__mxcsr_lo = (__uint16_t)(x);			\
-} while (0)
-
 typedef	__uint16_t	fexcept_t;
 
 /* Exception flags */
@@ -72,168 +65,35 @@
 #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
 			 FE_UPWARD | FE_TOWARDZERO)
 
-/*
- * As compared to the x87 control word, the SSE unit's control word
- * has the rounding control bits offset by 3 and the exception mask
- * bits offset by 7.
- */
-#define	_SSE_ROUND_SHIFT	3
-#define	_SSE_EMASK_SHIFT	7
-
-/* After testing for SSE support once, we cache the result in __has_sse. */
-enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK };
-extern enum __sse_support __has_sse;
-int __test_sse(void);
-#ifdef __SSE__
-#define	__HAS_SSE()	1
-#else
-#define	__HAS_SSE()	(__has_sse == __SSE_YES ||			\
-			 (__has_sse == __SSE_UNK && __test_sse()))
-#endif
-
 __BEGIN_DECLS
 
 /* Default floating-point environment */
 extern const fenv_t	__fe_dfl_env;
 #define	FE_DFL_ENV	(&__fe_dfl_env)
 
-#define	__fldcw(__cw)		__asm __volatile("fldcw %0" : : "m" (__cw))
-#define	__fldenv(__env)		__asm __volatile("fldenv %0" : : "m" (__env))
-#define	__fnclex()		__asm __volatile("fnclex")
-#define	__fnstenv(__env)	__asm __volatile("fnstenv %0" : "=m" (*(__env)))
-#define	__fnstcw(__cw)		__asm __volatile("fnstcw %0" : "=m" (*(__cw)))
-#define	__fnstsw(__sw)		__asm __volatile("fnstsw %0" : "=a" (*(__sw)))
-#define	__fwait()		__asm __volatile("fwait")
-#define	__ldmxcsr(__csr)	__asm __volatile("ldmxcsr %0" : : "m" (__csr))
-#define	__stmxcsr(__csr)	__asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
+/* C99 floating-point exception functions */
+int feclearexcept(int excepts);
+int fegetexceptflag(fexcept_t *flagp, int excepts);
+int fesetexceptflag(const fexcept_t *flagp, int excepts);
+/* feraiseexcept does not set the inexact flag on overflow/underflow */
+int feraiseexcept(int excepts);
+int fetestexcept(int excepts);
 
-static __inline int
-feclearexcept(int __excepts)
-{
-	fenv_t __env;
-	int __mxcsr;
+/* C99 rounding control functions */
+int fegetround(void);
+int fesetround(int round);
 
-	if (__excepts == FE_ALL_EXCEPT) {
-		__fnclex();
-	} else {
-		__fnstenv(&__env);
-		__env.__status &= ~__excepts;
-		__fldenv(__env);
-	}
-	if (__HAS_SSE()) {
-		__stmxcsr(&__mxcsr);
-		__mxcsr &= ~__excepts;
-		__ldmxcsr(__mxcsr);
-	}
-	return (0);
-}
-
-static __inline int
-fegetexceptflag(fexcept_t *__flagp, int __excepts)
-{
-	int __mxcsr;
-	short __status;
-
-	__fnstsw(&__status);
-	if (__HAS_SSE())
-		__stmxcsr(&__mxcsr);
-	else
-		__mxcsr = 0;
-	*__flagp = (__mxcsr | __status) & __excepts;
-	return (0);
-}
-
-int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
-int feraiseexcept(int __excepts);
-
-static __inline int
-fetestexcept(int __excepts)
-{
-	int __mxcsr;
-	short __status;
-
-	__fnstsw(&__status);
-	if (__HAS_SSE())
-		__stmxcsr(&__mxcsr);
-	else
-		__mxcsr = 0;
-	return ((__status | __mxcsr) & __excepts);
-}
-
-static __inline int
-fegetround(void)
-{
-	int __control;
-
-	/*
-	 * We assume that the x87 and the SSE unit agree on the
-	 * rounding mode.  Reading the control word on the x87 turns
-	 * out to be about 5 times faster than reading it on the SSE
-	 * unit on an Opteron 244.
-	 */
-	__fnstcw(&__control);
-	return (__control & _ROUND_MASK);
-}
-
-static __inline int
-fesetround(int __round)
-{
-	int __mxcsr, __control;
-
-	if (__round & ~_ROUND_MASK)
-		return (-1);
-
-	__fnstcw(&__control);
-	__control &= ~_ROUND_MASK;
-	__control |= __round;
-	__fldcw(__control);
-
-	if (__HAS_SSE()) {
-		__stmxcsr(&__mxcsr);
-		__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT);
-		__mxcsr |= __round << _SSE_ROUND_SHIFT;
-		__ldmxcsr(__mxcsr);
-	}
-
-	return (0);
-}
-
+/* C99 floating-point environment functions */
 int fegetenv(fenv_t *__envp);
 int feholdexcept(fenv_t *__envp);
-
-static __inline int
-fesetenv(const fenv_t *__envp)
-{
-	fenv_t __env = *__envp;
-	int __mxcsr;
-
-	__mxcsr = __get_mxcsr(__env);
-	__set_mxcsr(__env, 0xffffffff);
-	__fldenv(__env);
-	if (__HAS_SSE())
-		__ldmxcsr(__mxcsr);
-	return (0);
-}
-
+int fesetenv(const fenv_t *envp);
 int feupdateenv(const fenv_t *__envp);
 
 #if __BSD_VISIBLE
-
+/* Additional support functions to set/query floating point traps */
 int feenableexcept(int __mask);
 int fedisableexcept(int __mask);
-
-static __inline int
-fegetexcept(void)
-{
-	int __control;
-
-	/*
-	 * We assume that the masks for the x87 and the SSE unit are
-	 * the same.
-	 */
-	__fnstcw(&__control);
-	return (~__control & FE_ALL_EXCEPT);
-}
+int fegetexcept(void);
 
 #endif /* __BSD_VISIBLE */
 
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/sincos.c b/libm/sincos.c
index 116b151..e9f6dcc 100644
--- a/libm/sincos.c
+++ b/libm/sincos.c
@@ -27,6 +27,14 @@
 #define _GNU_SOURCE 1
 #include <math.h>
 
+// Disable sincos optimization for all functions in this file,
+// otherwise gcc would generate infinite calls.
+// Refer to gcc PR46926.
+// -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
+// but these two options do not work inside optimize pragma in-file.
+// Thus we just enforce -O0 when compiling this file.
+#pragma GCC optimize ("O0")
+
 void  sincos(double x, double *psin, double *pcos)
 {
     *psin = sin(x);
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/libm/src/s_logb.c b/libm/src/s_logb.c
index 30edb87..57f91c4 100644
--- a/libm/src/s_logb.c
+++ b/libm/src/s_logb.c
@@ -36,9 +36,9 @@
 	if(ix>=0x7ff00000) return x*x;
 	if(ix<0x00100000) {
 		x *= two54;		 /* convert subnormal x to normal */
-		GET_FLOAT_WORD(ix,x);
+		GET_HIGH_WORD(ix,x);
 		ix &= 0x7fffffff;
-		return (float) ((ix>>20)-1023-54);
+		return (double) ((ix>>20)-1023-54);
 	} else
 		return (double) ((ix>>20)-1023);
 }
diff --git a/libm/src/s_remquo.c b/libm/src/s_remquo.c
index eee65df..9ad1e4c 100644
--- a/libm/src/s_remquo.c
+++ b/libm/src/s_remquo.c
@@ -49,7 +49,7 @@
 		goto fixup;	/* |x|<|y| return x or x-y */
 	    }
 	    if(lx==ly) {
-		*quo = 1;
+                *quo = (sxy ? -1 : 1);
 		return Zero[(u_int32_t)sx>>31];	/* |x|=|y| return x*0*/
 	    }
 	}
@@ -112,7 +112,8 @@
 
     /* convert back to floating value and restore the sign */
 	if((hx|lx)==0) {			/* return sign(x)*0 */
-	    *quo = (sxy ? -q : q);
+            q &= 0x7fffffff;
+            *quo = (sxy ? -q : q);
 	    return Zero[(u_int32_t)sx>>31];
 	}
 	while(hx<0x00100000) {		/* normalize x */
@@ -127,9 +128,9 @@
 		lx = (lx>>n)|((u_int32_t)hx<<(32-n));
 		hx >>= n;
 	    } else if (n<=31) {
-		lx = (hx<<(32-n))|(lx>>n); hx = sx;
+                lx = (hx<<(32-n))|(lx>>n); hx = 0;
 	    } else {
-		lx = hx>>(n-32); hx = sx;
+                lx = hx>>(n-32); hx = 0;
 	    }
 	}
 fixup:
diff --git a/libm/src/s_remquof.c b/libm/src/s_remquof.c
index 5d722ce..43e05cb 100644
--- a/libm/src/s_remquof.c
+++ b/libm/src/s_remquof.c
@@ -46,7 +46,7 @@
 	    q = 0;
 	    goto fixup;	/* |x|<|y| return x or x-y */
 	} else if(hx==hy) {
-	    *quo = 1;
+            *quo = (sxy ? -1 : 1);
 	    return Zero[(u_int32_t)sx>>31];	/* |x|=|y| return x*0*/
 	}
 
@@ -88,7 +88,8 @@
 
     /* convert back to floating value and restore the sign */
 	if(hx==0) {				/* return sign(x)*0 */
-	    *quo = (sxy ? -q : q);
+            q &= 0x7fffffff;
+            *quo = (sxy ? -q : q);
 	    return Zero[(u_int32_t)sx>>31];
 	}
 	while(hx<0x00800000) {		/* normalize x */
diff --git a/libstdc++/src/new.cpp b/libstdc++/src/new.cpp
index a9c92d4..ddd3dba 100644
--- a/libstdc++/src/new.cpp
+++ b/libstdc++/src/new.cpp
@@ -7,7 +7,7 @@
 {
     void* p = malloc(size);
     if (p == NULL) {
-        // abort();
+        abort();
     }
     return p;
 }
@@ -16,7 +16,7 @@
 {
     void* p = malloc(size);
     if (p == NULL) {
-        // abort();
+        abort();
     }
     return p;
 }
diff --git a/libstdc++/src/one_time_construction.cpp b/libstdc++/src/one_time_construction.cpp
index 2a44c79..00adce9 100644
--- a/libstdc++/src/one_time_construction.cpp
+++ b/libstdc++/src/one_time_construction.cpp
@@ -10,46 +10,102 @@
 
 #include <stddef.h>
 #include <sys/atomics.h>
+#include <endian.h>
 #include <bionic_futex.h>
 #include <bionic_atomic_inline.h>
 
-extern "C" int __cxa_guard_acquire(int volatile * gv)
+// ARM C++ ABI and Itanium/x86 C++ ABI has different definition for
+// one time construction:
+//
+//    ARM C++ ABI defines the LSB of guard variable should be tested
+//    by compiler-generated code before calling __cxa_guard_acquire et al.
+//
+//    The Itanium/x86 C++ ABI defines the low-order _byte_ should be
+//    tested instead.
+//
+//    Meanwhile, guard variable are 32bit aligned for ARM, and 64bit
+//    aligned for x86.
+//
+// Reference documentation:
+//
+//    section 3.2.3 of ARM IHI 0041C (for ARM)
+//    section 3.3.2 of the Itanium C++ ABI specification v1.83 (for x86).
+//
+// There is no C++ ABI available for other ARCH. But the gcc source
+// shows all other ARCH follow the definition of Itanium/x86 C++ ABI.
+
+
+#if defined(__arm__)
+// The ARM C++ ABI mandates that guard variable are
+// 32-bit aligned, 32-bit values. And only its LSB is tested by
+// the compiler-generated code before calling
+// __cxa_guard_acquire.
+//
+typedef union {
+    int volatile state;
+    int32_t aligner;
+} _guard_t;
+
+const static int ready = 0x1;
+const static int pending = 0x2;
+const static int waiting = 0x6;
+
+#else   // GCC sources indicates all none-arm follow the same ABI
+// The Itanium/x86 C++ ABI mandates that guard variables
+// are 64-bit aligned, 64-bit values. Also, the least-significant
+// byte is tested by the compiler-generated code before, we calling
+// __cxa_guard_acquire. We can access it through the first
+// 32-bit word in the union below.
+//
+typedef union {
+    int volatile state;
+    int64_t aligner;
+} _guard_t;
+
+const static int ready     = letoh32(0x1);
+const static int pending   = letoh32(0x100);
+const static int waiting   = letoh32(0x10000);
+#endif
+
+extern "C" int __cxa_guard_acquire(_guard_t* gv)
 {
-    // 0 -> 2, return 1
-    // 2 -> 6, wait and return 0
-    // 6 untouched, wait and return 0
-    // 1 untouched, return 0
+    // 0 -> pending, return 1
+    // pending -> waiting, wait and return 0
+    // waiting: untouched, wait and return 0
+    // ready: untouched, return 0
+
 retry:
-    if (__atomic_cmpxchg(0, 0x2, gv) == 0) {
+    if (__atomic_cmpxchg(0, pending, &gv->state) == 0) {
         ANDROID_MEMBAR_FULL();
         return 1;
     }
-    __atomic_cmpxchg(0x2, 0x6, gv); // Indicate there is a waiter
-    __futex_wait(gv, 0x6, NULL);
+    __atomic_cmpxchg(pending, waiting, &gv->state); // Indicate there is a waiter
+    __futex_wait(&gv->state, waiting, NULL);
 
-    if(*gv != 1) // __cxa_guard_abort was called, let every thread try since there is no return code for this condition
+    if (gv->state != ready) // __cxa_guard_abort was called, let every thread try since there is no return code for this condition
         goto retry;
 
     ANDROID_MEMBAR_FULL();
     return 0;
 }
 
-extern "C" void __cxa_guard_release(int volatile * gv)
+extern "C" void __cxa_guard_release(_guard_t* gv)
 {
-    // 2 -> 1
-    // 6 -> 1, and wake
+    // pending -> ready
+    // waiting -> ready, and wake
+
     ANDROID_MEMBAR_FULL();
-    if (__atomic_cmpxchg(0x2, 0x1, gv) == 0) {
+    if (__atomic_cmpxchg(pending, ready, &gv->state) == 0) {
         return;
     }
 
-    *gv = 0x1;
-    __futex_wake(gv, 0x7fffffff);
+    gv->state = ready;
+    __futex_wake(&gv->state, 0x7fffffff);
 }
 
-extern "C" void __cxa_guard_abort(int volatile * gv)
+extern "C" void __cxa_guard_abort(_guard_t* gv)
 {
     ANDROID_MEMBAR_FULL();
-    *gv = 0;
-    __futex_wake(gv, 0x7fffffff);
+    gv->state= 0;
+    __futex_wake(&gv->state, 0x7fffffff);
 }
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;
 }
diff --git a/linker/Android.mk b/linker/Android.mk
index da311cd..803b6c3 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -8,8 +8,7 @@
 	linker_format.c \
 	rt.c \
 	dlfcn.c \
-	debugger.c \
-	ba.c
+	debugger.c
 
 ifeq ($(TARGET_ARCH),sh)
 # SH-4A series virtual address range from 0x00000000 to 0x7FFFFFFF.
@@ -50,12 +49,6 @@
 else
   ifeq ($(TARGET_ARCH),x86)
     LOCAL_CFLAGS += -DANDROID_X86_LINKER
-  else
-    ifeq ($(TARGET_ARCH),sh)
-      LOCAL_CFLAGS += -DANDROID_SH_LINKER
-    else
-      $(error Unsupported TARGET_ARCH $(TARGET_ARCH))
-    endif
   endif
 endif
 
@@ -76,8 +69,6 @@
 LOCAL_MODULE_CLASS := EXECUTABLES
 LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
 
-# Executables are not prelinked.
-LOCAL_PRELINK_MODULE := false
 
 include $(BUILD_SYSTEM)/dynamic_binary.mk
 
diff --git a/linker/README.TXT b/linker/README.TXT
index 052a65b..a8efe35 100644
--- a/linker/README.TXT
+++ b/linker/README.TXT
@@ -77,7 +77,7 @@
       Same as DT_INITARRAY but for finalizers. Note that the
       functions must be called in reverse-order though
 
-      Note: this is generally stroed in a .fini_array section
+      Note: this is generally stored in a .fini_array section
 
   DT_FINI_ARRAYSZ
       Size of FT_FINIARRAY
@@ -88,7 +88,7 @@
       a list of functions that need to be called before any other
       initialization function (i.e. DT_INIT and/or DT_INIT_ARRAY)
 
-      Note: this is generally stroed in a .preinit_array section
+      Note: this is generally stored in a .preinit_array section
 
   DT_PREINIT_ARRAYSZ
       The size of DT_PREINIT_ARRAY
@@ -103,14 +103,14 @@
 much processor dependent, and may use different ELF sections.
 
 On the ARM (see "C++ ABI for ARM" document), the static constructors
-must be called explicitely from the DT_INIT_ARRAY, and each one of them
+must be called explicitly from the DT_INIT_ARRAY, and each one of them
 shall register a destructor by calling the special __eabi_atexit()
 function (provided by the C library). The DT_FINI_ARRAY is not used
 by static C++ destructors.
 
 On x86, the lists of constructors and destructors are placed in special
 sections named ".ctors" and ".dtors", and the DT_INIT / DT_FINI functions
-are in charge of calling them explicitely.
+are in charge of calling them explicitly.
 
 
 Debugging:
@@ -140,4 +140,4 @@
 
 By default, traces are sent to logcat, with the "linker" tag. You can
 change this to go to stdout instead by setting the definition of
-LINKER_DEBUG_TO_LOG to 0 in "linker_debug.h"
+LINKER_DEBUG_TO_LOG to 0 in "linker_debug.h".
diff --git a/linker/arch/sh/begin.S b/linker/arch/sh/begin.S
deleted file mode 100644
index 6f49557..0000000
--- a/linker/arch/sh/begin.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-.text
-.align  4
-.type   _start,#function
-.globl  _start
-
-_start:
-    mov     r15, r4
-
-    mov.l   0f, r0
-    jsr     @r0
-    nop
-
-    /* linker init returns the _entry address in the main image */
-    jmp     @r0
-    nop
-
-    .balign 4
-0:  .long   __linker_init
-
-    .section .ctors, "wa"
-    .globl  __CTOR_LIST__
-__CTOR_LIST__:
-    .long   -1
diff --git a/linker/ba.c b/linker/ba.c
deleted file mode 100644
index db49c4b..0000000
--- a/linker/ba.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-
-#include "linker.h"
-#include "linker_debug.h"
-#include "ba.h"
-
-#undef min
-#define min(a,b) ((a)<(b)?(a):(b))
-
-#define BA_IS_FREE(index) (!(ba->bitmap[index].allocated))
-#define BA_ORDER(index) ba->bitmap[index].order
-#define BA_BUDDY_INDEX(index) ((index) ^ (1 << BA_ORDER(index)))
-#define BA_NEXT_INDEX(index) ((index) + (1 << BA_ORDER(index)))
-#define BA_OFFSET(index) ((index) * ba->min_alloc)
-#define BA_START_ADDR(index) (BA_OFFSET(index) + ba->base)
-#define BA_LEN(index) ((1 << BA_ORDER(index)) * ba->min_alloc)
-
-static unsigned long ba_order(struct ba *ba, unsigned long len);
-
-void ba_init(struct ba *ba)
-{
-    int i, index = 0;
-
-    unsigned long max_order = ba_order(ba, ba->size);
-    if (ba->max_order == 0 || ba->max_order > max_order)
-        ba->max_order = max_order;
-
-    for (i = sizeof(ba->num_entries) * 8 - 1; i >= 0; i--) {
-        if (ba->num_entries &  1<<i) {
-            BA_ORDER(index) = i;
-            index = BA_NEXT_INDEX(index);
-        }
-    }
-}
-
-int ba_free(struct ba *ba, int index)
-{
-    int buddy, curr = index;
-
-    /* clean up the bitmap, merging any buddies */
-    ba->bitmap[curr].allocated = 0;
-    /* find a slots buddy Buddy# = Slot# ^ (1 << order)
-     * if the buddy is also free merge them
-     * repeat until the buddy is not free or end of the bitmap is reached
-     */
-    do {
-        buddy = BA_BUDDY_INDEX(curr);
-        if (BA_IS_FREE(buddy) &&
-                BA_ORDER(buddy) == BA_ORDER(curr)) {
-            BA_ORDER(buddy)++;
-            BA_ORDER(curr)++;
-            curr = min(buddy, curr);
-        } else {
-            break;
-        }
-    } while (curr < ba->num_entries);
-
-    return 0;
-}
-
-static unsigned long ba_order(struct ba *ba, unsigned long len)
-{
-    unsigned long i;
-
-    len = (len + ba->min_alloc - 1) / ba->min_alloc;
-    len--;
-    for (i = 0; i < sizeof(len)*8; i++)
-        if (len >> i == 0)
-            break;
-    return i;
-}
-
-int ba_allocate(struct ba *ba, unsigned long len)
-{
-    int curr = 0;
-    int end = ba->num_entries;
-    int best_fit = -1;
-    unsigned long order = ba_order(ba, len);
-
-    if (order > ba->max_order)
-        return -1;
-
-    /* look through the bitmap:
-     *  if you find a free slot of the correct order use it
-     *  otherwise, use the best fit (smallest with size > order) slot
-     */
-    while (curr < end) {
-        if (BA_IS_FREE(curr)) {
-            if (BA_ORDER(curr) == (unsigned char)order) {
-                /* set the not free bit and clear others */
-                best_fit = curr;
-                break;
-            }
-            if (BA_ORDER(curr) > (unsigned char)order &&
-                (best_fit < 0 ||
-                 BA_ORDER(curr) < BA_ORDER(best_fit)))
-                best_fit = curr;
-        }
-        curr = BA_NEXT_INDEX(curr);
-    }
-
-    /* if best_fit < 0, there are no suitable slots,
-     * return an error
-     */
-    if (best_fit < 0)
-        return -1;
-
-    /* now partition the best fit:
-     *  split the slot into 2 buddies of order - 1
-     *  repeat until the slot is of the correct order
-     */
-    while (BA_ORDER(best_fit) > (unsigned char)order) {
-        int buddy;
-        BA_ORDER(best_fit) -= 1;
-        buddy = BA_BUDDY_INDEX(best_fit);
-        BA_ORDER(buddy) = BA_ORDER(best_fit);
-    }
-    ba->bitmap[best_fit].allocated = 1;
-    return best_fit;
-}
-
-unsigned long ba_start_addr(struct ba *ba, int index)
-{
-    return BA_START_ADDR(index);
-}
-
-unsigned long ba_len(struct ba *ba, int index)
-{
-    return BA_LEN(index);
-}
diff --git a/linker/ba.h b/linker/ba.h
deleted file mode 100644
index c11017b..0000000
--- a/linker/ba.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * 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 COPYRIGHT HOLDERS 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
- * COPYRIGHT OWNER 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.
- */
-
-#ifndef __LINKER_BA_H
-#define __LINKER_BA_H
-
-struct ba_bits {
-    unsigned allocated:1;           /* 1 if allocated, 0 if free */
-    unsigned order:7;               /* size of the region in ba space */
-};
-
-struct ba {
-    /* start address of the ba space */
-    unsigned long base;
-    /* total size of the ba space */
-    unsigned long size;
-    /* the smaller allocation that can be made */
-    unsigned long min_alloc;
-    /* the order of the largest allocation that can be made */
-    unsigned long max_order;
-    /* number of entries in the ba space */
-    int num_entries;
-    /* the bitmap for the region indicating which entries are allocated
-     * and which are free */
-    struct ba_bits *bitmap;
-};
-
-extern void ba_init(struct ba *ba);
-extern int ba_allocate(struct ba *ba, unsigned long len);
-extern int ba_free(struct ba *ba, int index);
-extern unsigned long ba_start_addr(struct ba *ba, int index);
-extern unsigned long ba_len(struct ba *ba, int index);
-
-#endif
diff --git a/linker/debugger.c b/linker/debugger.c
index abb383c..648dc78 100644
--- a/linker/debugger.c
+++ b/linker/debugger.c
@@ -87,13 +87,49 @@
     return s;
 }
 
-void debugger_signal_handler(int n)
+#include "linker_format.h"
+#include <../libc/private/logd.h>
+
+/*
+ * Writes a summary of the signal to the log file.
+ *
+ * We could be here as a result of native heap corruption, or while a
+ * mutex is being held, so we don't want to use any libc functions that
+ * could allocate memory or hold a lock.
+ */
+static void logSignalSummary(int signum, const siginfo_t* info)
+{
+    char buffer[128];
+
+    char* signame;
+    switch (signum) {
+        case SIGILL:    signame = "SIGILL";     break;
+        case SIGABRT:   signame = "SIGABRT";    break;
+        case SIGBUS:    signame = "SIGBUS";     break;
+        case SIGFPE:    signame = "SIGFPE";     break;
+        case SIGSEGV:   signame = "SIGSEGV";    break;
+        case SIGSTKFLT: signame = "SIGSTKFLT";  break;
+        case SIGPIPE:   signame = "SIGPIPE";    break;
+        default:        signame = "???";        break;
+    }
+
+    format_buffer(buffer, sizeof(buffer),
+        "Fatal signal %d (%s) at 0x%08x (code=%d)",
+        signum, signame, info->si_addr, info->si_code);
+
+    __libc_android_log_write(ANDROID_LOG_FATAL, "libc", buffer);
+}
+
+/*
+ * Catches fatal signals so we can ask debuggerd to ptrace us before
+ * we crash.
+ */
+void debugger_signal_handler(int n, siginfo_t* info, void* unused)
 {
     unsigned tid;
     int s;
 
-    /* avoid picking up GC interrupts */
-    signal(SIGUSR1, SIG_IGN);
+    logSignalSummary(n, info);
 
     tid = gettid();
     s = socket_abstract_client("android:debuggerd", SOCK_STREAM);
@@ -117,16 +153,22 @@
     }
 
     /* remove our net so we fault for real when we return */
-    signal(n, SIG_IGN);
+    signal(n, SIG_DFL);
 }
 
 void debugger_init()
 {
-    signal(SIGILL, debugger_signal_handler);
-    signal(SIGABRT, debugger_signal_handler);
-    signal(SIGBUS, debugger_signal_handler);
-    signal(SIGFPE, debugger_signal_handler);
-    signal(SIGSEGV, debugger_signal_handler);
-    signal(SIGSTKFLT, debugger_signal_handler);
-    signal(SIGPIPE, debugger_signal_handler);
+    struct sigaction act;
+    memset(&act, 0, sizeof(act));
+    act.sa_sigaction = debugger_signal_handler;
+    act.sa_flags = SA_RESTART | SA_SIGINFO;
+    sigemptyset(&act.sa_mask);
+
+    sigaction(SIGILL, &act, NULL);
+    sigaction(SIGABRT, &act, NULL);
+    sigaction(SIGBUS, &act, NULL);
+    sigaction(SIGFPE, &act, NULL);
+    sigaction(SIGSEGV, &act, NULL);
+    sigaction(SIGSTKFLT, &act, NULL);
+    sigaction(SIGPIPE, &act, NULL);
 }
diff --git a/linker/dlfcn.c b/linker/dlfcn.c
index a36b42c..194a4ae 100644
--- a/linker/dlfcn.c
+++ b/linker/dlfcn.c
@@ -42,7 +42,7 @@
 #define likely(expr)   __builtin_expect (expr, 1)
 #define unlikely(expr) __builtin_expect (expr, 0)
 
-static pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t dl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
 
 static void set_dlerror(int err)
 {
@@ -124,7 +124,7 @@
     return 0;
 }
 
-int dladdr(void *addr, Dl_info *info)
+int dladdr(const void *addr, Dl_info *info)
 {
     int ret = 0;
 
@@ -174,14 +174,7 @@
 //                     0123456 78901234 567890 12345678 9012345 6789012345678901
 #define ANDROID_LIBDL_STRTAB \
                       "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
-
-#elif defined(ANDROID_SH_LINKER)
-//                     0000000 00011111 111112 22222222 2333333 3333444444444455
-//                     0123456 78901234 567890 12345678 9012345 6789012345678901
-#define ANDROID_LIBDL_STRTAB \
-                      "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
-
-#else /* !defined(ANDROID_ARM_LINKER) && !defined(ANDROID_X86_LINKER) */
+#else
 #error Unsupported architecture. Only ARM and x86 are presently supported.
 #endif
 
@@ -230,12 +223,6 @@
       st_info: STB_GLOBAL << 4,
       st_shndx: 1,
     },
-#elif defined(ANDROID_SH_LINKER)
-    { st_name: 36,
-      st_value: (Elf32_Addr) &dl_iterate_phdr,
-      st_info: STB_GLOBAL << 4,
-      st_shndx: 1,
-    },
 #endif
 };
 
diff --git a/linker/linker.c b/linker/linker.c
index 00f36c0..bcfa8dc 100644
--- a/linker/linker.c
+++ b/linker/linker.c
@@ -51,10 +51,8 @@
 #include "linker_environ.h"
 #include "linker_format.h"
 
-#include "ba.h"
-
 #define ALLOW_SYMBOLS_FROM_MAIN 1
-#define SO_MAX 96
+#define SO_MAX 128
 
 /* Assume average path length of 64 and max 8 paths */
 #define LDPATH_BUFSIZE 512
@@ -96,17 +94,6 @@
 #endif
 
 
-/* Set up for the buddy allocator managing the non-prelinked libraries. */
-static struct ba_bits ba_nonprelink_bitmap[(LIBLAST - LIBBASE) / LIBINC];
-static struct ba ba_nonprelink = {
-    .base = LIBBASE,
-    .size = LIBLAST - LIBBASE,
-    .min_alloc = LIBINC,
-    /* max_order will be determined automatically */
-    .bitmap = ba_nonprelink_bitmap,
-    .num_entries = sizeof(ba_nonprelink_bitmap)/sizeof(ba_nonprelink_bitmap[0]),
-};
-
 static inline int validate_soinfo(soinfo *si)
 {
     return (si >= sopool && si < sopool + SO_MAX) ||
@@ -292,7 +279,6 @@
     memset(si, 0, sizeof(soinfo));
     strlcpy((char*) si->name, name, sizeof(si->name));
     sonext->next = si;
-    si->ba_index = -1; /* by default, prelinked */
     si->next = NULL;
     si->refcount = 0;
     sonext = si;
@@ -379,7 +365,7 @@
    *pcount = 0;
     return NULL;
 }
-#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_SH_LINKER)
+#elif defined(ANDROID_X86_LINKER)
 /* Here, we only have to provide a callback to iterate across all the
  * loaded libraries. gcc_eh does the rest. */
 int
@@ -560,7 +546,7 @@
     return NULL;
 }
 
-soinfo *find_containing_library(void *addr)
+soinfo *find_containing_library(const void *addr)
 {
     soinfo *si;
 
@@ -574,7 +560,7 @@
     return NULL;
 }
 
-Elf32_Sym *find_containing_symbol(void *addr, soinfo *si)
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si)
 {
     unsigned int i;
     unsigned soaddr = (unsigned)addr - si->base;
@@ -721,7 +707,11 @@
     if (hdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
 
     /* TODO: Should we verify anything else in the header? */
-
+#ifdef ANDROID_ARM_LINKER
+    if (hdr->e_machine != EM_ARM) return -1;
+#elif defined(ANDROID_X86_LINKER)
+    if (hdr->e_machine != EM_386) return -1;
+#endif
     return 0;
 }
 
@@ -844,28 +834,25 @@
 {
     if (si->base) {
         /* Attempt to mmap a prelinked library. */
-        si->ba_index = -1;
         return reserve_mem_region(si);
     }
 
-    /* This is not a prelinked library, so we attempt to allocate space
-       for it from the buddy allocator, which manages the area between
-       LIBBASE and LIBLAST.
+    /* This is not a prelinked library, so we use the kernel's default
+       allocator.
     */
-    si->ba_index = ba_allocate(&ba_nonprelink, si->size);
-    if(si->ba_index >= 0) {
-        si->base = ba_start_addr(&ba_nonprelink, si->ba_index);
-        PRINT("%5d mapping library '%s' at %08x (index %d) " \
-              "through buddy allocator.\n",
-              pid, si->name, si->base, si->ba_index);
-        if (reserve_mem_region(si) < 0) {
-            ba_free(&ba_nonprelink, si->ba_index);
-            si->ba_index = -1;
-            si->base = 0;
-            goto err;
-        }
-        return 0;
+
+    void *base = mmap(NULL, si->size, PROT_READ | PROT_EXEC,
+                      MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+    if (base == MAP_FAILED) {
+        DL_ERR("%5d mmap of library '%s' failed: %d (%s)\n",
+              pid, si->name,
+              errno, strerror(errno));
+        goto err;
     }
+    si->base = (unsigned) base;
+    PRINT("%5d mapped library '%s' to %08x via kernel allocator.\n",
+          pid, si->name, si->base);
+    return 0;
 
 err:
     DL_ERR("OOPS: %5d cannot map library '%s'. no vspace available.",
@@ -1154,10 +1141,6 @@
 
     /* Now actually load the library's segments into right places in memory */
     if (load_segments(fd, &__header[0], si) < 0) {
-        if (si->ba_index >= 0) {
-            ba_free(&ba_nonprelink, si->ba_index);
-            si->ba_index = -1;
-        }
         goto fail;
     }
 
@@ -1187,9 +1170,6 @@
     TRACE("[ %5d init_library base=0x%08x sz=0x%08x name='%s') ]\n",
           pid, si->base, si->size, si->name);
 
-    if (si->base < LIBBASE || si->base >= LIBLAST)
-        si->flags |= FLAG_PRELINKED;
-
     if(link_image(si, wr_offset)) {
             /* We failed to link.  However, we can only restore libbase
             ** if no additional libraries have moved it since we updated it.
@@ -1264,12 +1244,6 @@
         }
 
         munmap((char *)si->base, si->size);
-        if (si->ba_index >= 0) {
-            PRINT("%5d releasing library '%s' address space at %08x "\
-                  "through buddy allocator.\n",
-                  pid, si->name, si->base);
-            ba_free(&ba_nonprelink, si->ba_index);
-        }
         notify_gdb_of_unload(si);
         free_info(si);
         si->refcount = 0;
@@ -1488,101 +1462,6 @@
     return 0;
 }
 
-#if defined(ANDROID_SH_LINKER)
-static int reloc_library_a(soinfo *si, Elf32_Rela *rela, unsigned count)
-{
-    Elf32_Sym *symtab = si->symtab;
-    const char *strtab = si->strtab;
-    Elf32_Sym *s;
-    unsigned base;
-    Elf32_Rela *start = rela;
-    unsigned idx;
-
-    for (idx = 0; idx < count; ++idx) {
-        unsigned type = ELF32_R_TYPE(rela->r_info);
-        unsigned sym = ELF32_R_SYM(rela->r_info);
-        unsigned reloc = (unsigned)(rela->r_offset + si->base);
-        unsigned sym_addr = 0;
-        char *sym_name = NULL;
-
-        DEBUG("%5d Processing '%s' relocation at index %d\n", pid,
-              si->name, idx);
-        if(sym != 0) {
-            sym_name = (char *)(strtab + symtab[sym].st_name);
-            s = _do_lookup(si, sym_name, &base);
-            if(s == 0) {
-                DL_ERR("%5d cannot locate '%s'...", pid, sym_name);
-                return -1;
-            }
-#if 0
-            if((base == 0) && (si->base != 0)){
-                    /* linking from libraries to main image is bad */
-                DL_ERR("%5d cannot locate '%s'...",
-                       pid, strtab + symtab[sym].st_name);
-                return -1;
-            }
-#endif
-            if ((s->st_shndx == SHN_UNDEF) && (s->st_value != 0)) {
-                DL_ERR("%5d In '%s', shndx=%d && value=0x%08x. We do not "
-                      "handle this yet", pid, si->name, s->st_shndx,
-                      s->st_value);
-                return -1;
-            }
-            sym_addr = (unsigned)(s->st_value + base);
-            COUNT_RELOC(RELOC_SYMBOL);
-        } else {
-            s = 0;
-        }
-
-/* TODO: This is ugly. Split up the relocations by arch into
- * different files.
- */
-        switch(type){
-        case R_SH_JUMP_SLOT:
-            COUNT_RELOC(RELOC_ABSOLUTE);
-            MARK(rela->r_offset);
-            TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
-                       reloc, sym_addr, sym_name);
-            *((unsigned*)reloc) = sym_addr;
-            break;
-        case R_SH_GLOB_DAT:
-            COUNT_RELOC(RELOC_ABSOLUTE);
-            MARK(rela->r_offset);
-            TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
-                       reloc, sym_addr, sym_name);
-            *((unsigned*)reloc) = sym_addr;
-            break;
-        case R_SH_DIR32:
-            COUNT_RELOC(RELOC_ABSOLUTE);
-            MARK(rela->r_offset);
-            TRACE_TYPE(RELO, "%5d RELO DIR32 %08x <- %08x %s\n", pid,
-                       reloc, sym_addr, sym_name);
-            *((unsigned*)reloc) += sym_addr;
-            break;
-        case R_SH_RELATIVE:
-            COUNT_RELOC(RELOC_RELATIVE);
-            MARK(rela->r_offset);
-            if(sym){
-                DL_ERR("%5d odd RELATIVE form...", pid);
-                return -1;
-            }
-            TRACE_TYPE(RELO, "%5d RELO RELATIVE %08x <- +%08x\n", pid,
-                       reloc, si->base);
-            *((unsigned*)reloc) += si->base;
-            break;
-
-        default:
-            DL_ERR("%5d unknown reloc type %d @ %p (%d)",
-                  pid, type, rela, (int) (rela - start));
-            return -1;
-        }
-        rela++;
-    }
-    return 0;
-}
-#endif /* ANDROID_SH_LINKER */
-
-
 /* Please read the "Initialization and Termination functions" functions.
  * of the linker design note in bionic/linker/README.TXT to understand
  * what the following code is doing.
@@ -1834,40 +1713,24 @@
         case DT_SYMTAB:
             si->symtab = (Elf32_Sym *) (si->base + *d);
             break;
-#if !defined(ANDROID_SH_LINKER)
         case DT_PLTREL:
             if(*d != DT_REL) {
                 DL_ERR("DT_RELA not supported");
                 goto fail;
             }
             break;
-#endif
-#ifdef ANDROID_SH_LINKER
-        case DT_JMPREL:
-            si->plt_rela = (Elf32_Rela*) (si->base + *d);
-            break;
-        case DT_PLTRELSZ:
-            si->plt_rela_count = *d / sizeof(Elf32_Rela);
-            break;
-#else
         case DT_JMPREL:
             si->plt_rel = (Elf32_Rel*) (si->base + *d);
             break;
         case DT_PLTRELSZ:
             si->plt_rel_count = *d / 8;
             break;
-#endif
         case DT_REL:
             si->rel = (Elf32_Rel*) (si->base + *d);
             break;
         case DT_RELSZ:
             si->rel_count = *d / 8;
             break;
-#ifdef ANDROID_SH_LINKER
-        case DT_RELASZ:
-            si->rela_count = *d / sizeof(Elf32_Rela);
-             break;
-#endif
         case DT_PLTGOT:
             /* Save this in case we decide to do lazy binding. We don't yet. */
             si->plt_got = (unsigned *)(si->base + *d);
@@ -1876,15 +1739,9 @@
             // Set the DT_DEBUG entry to the addres of _r_debug for GDB
             *d = (int) &_r_debug;
             break;
-#ifdef ANDROID_SH_LINKER
-        case DT_RELA:
-            si->rela = (Elf32_Rela *) (si->base + *d);
-            break;
-#else
          case DT_RELA:
             DL_ERR("%5d DT_RELA not supported", pid);
             goto fail;
-#endif
         case DT_INIT:
             si->init_func = (void (*)(void))(si->base + *d);
             DEBUG("%5d %s constructors (init func) found at %p\n",
@@ -1989,19 +1846,6 @@
             goto fail;
     }
 
-#ifdef ANDROID_SH_LINKER
-    if(si->plt_rela) {
-        DEBUG("[ %5d relocating %s plt ]\n", pid, si->name );
-        if(reloc_library_a(si, si->plt_rela, si->plt_rela_count))
-            goto fail;
-    }
-    if(si->rela) {
-        DEBUG("[ %5d relocating %s ]\n", pid, si->name );
-        if(reloc_library_a(si, si->rela, si->rela_count))
-            goto fail;
-    }
-#endif /* ANDROID_SH_LINKER */
-
     si->flags |= FLAG_LINKED;
     DEBUG("[ %5d finished linking %s ]\n", pid, si->name);
 
@@ -2039,8 +1883,8 @@
      */
     if (program_is_setuid)
         nullify_closed_stdio ();
-    call_constructors(si);
     notify_gdb_of_load(si);
+    call_constructors(si);
     return 0;
 
 fail:
@@ -2112,6 +1956,7 @@
     int argc = (int) *elfdata;
     char **argv = (char**) (elfdata + 1);
     unsigned *vecs = (unsigned*) (argv + argc + 1);
+    unsigned *v;
     soinfo *si;
     struct link_map * map;
     const char *ldpath_env = NULL;
@@ -2139,12 +1984,23 @@
      */
     __tls_area[TLS_SLOT_BIONIC_PREINIT] = elfdata;
 
-    /* Are we setuid? */
-    program_is_setuid = (getuid() != geteuid()) || (getgid() != getegid());
-
     /* Initialize environment functions, and get to the ELF aux vectors table */
     vecs = linker_env_init(vecs);
 
+    /* Check auxv for AT_SECURE first to see if program is setuid, setgid,
+       has file caps, or caused a SELinux/AppArmor domain transition. */
+    for (v = vecs; v[0]; v += 2) {
+        if (v[0] == AT_SECURE) {
+            /* kernel told us whether to enable secure mode */
+            program_is_setuid = v[1];
+            goto sanitize;
+        }
+    }
+
+    /* Kernel did not provide AT_SECURE - fall back on legacy test. */
+    program_is_setuid = (getuid() != geteuid()) || (getgid() != getegid());
+
+sanitize:
     /* Sanitize environment if we're loading a setuid program */
     if (program_is_setuid)
         linker_env_secure();
@@ -2213,8 +2069,6 @@
         vecs += 2;
     }
 
-    ba_init(&ba_nonprelink);
-
     si->base = 0;
     si->dynamic = (unsigned *)-1;
     si->wrprotect_start = 0xffffffff;
diff --git a/linker/linker.h b/linker/linker.h
index 68ac275..d29484c 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -83,7 +83,6 @@
 #define FLAG_LINKED     0x00000001
 #define FLAG_ERROR      0x00000002
 #define FLAG_EXE        0x00000004 // The main executable
-#define FLAG_PRELINKED  0x00000008 // This is a pre-linked lib
 
 #define SOINFO_NAME_LEN 128
 
@@ -95,8 +94,8 @@
     unsigned entry;
     unsigned base;
     unsigned size;
-    // buddy-allocator index, negative for prelinked libraries
-    int ba_index;
+
+    int unused;  // DO NOT USE, maintained for compatibility.
 
     unsigned *dynamic;
 
@@ -122,14 +121,6 @@
     Elf32_Rel *rel;
     unsigned rel_count;
 
-#ifdef ANDROID_SH_LINKER
-    Elf32_Rela *plt_rela;
-    unsigned plt_rela_count;
-
-    Elf32_Rela *rela;
-    unsigned rela_count;
-#endif /* ANDROID_SH_LINKER */
-
     unsigned *preinit_array;
     unsigned preinit_array_count;
 
@@ -154,17 +145,6 @@
 
 extern soinfo libdl_info;
 
-/* these must all be powers of two */
-#ifdef ARCH_SH
-#define LIBBASE 0x60000000
-#define LIBLAST 0x70000000
-#define LIBINC  0x00100000
-#else
-#define LIBBASE 0x80000000
-#define LIBLAST 0x90000000
-#define LIBINC  0x00100000
-#endif
-
 #ifdef ANDROID_ARM_LINKER
 
 #define R_ARM_COPY       20
@@ -187,15 +167,7 @@
 #define R_386_JUMP_SLOT  7
 #define R_386_RELATIVE   8
 
-#elif defined(ANDROID_SH_LINKER)
-
-#define R_SH_DIR32      1
-#define R_SH_GLOB_DAT   163
-#define R_SH_JUMP_SLOT  164
-#define R_SH_RELATIVE   165
-
-#endif /* ANDROID_*_LINKER */
-
+#endif
 
 #ifndef DT_INIT_ARRAY
 #define DT_INIT_ARRAY      25
@@ -225,14 +197,14 @@
 unsigned unload_library(soinfo *si);
 Elf32_Sym *lookup_in_library(soinfo *si, const char *name);
 Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start);
-soinfo *find_containing_library(void *addr);
-Elf32_Sym *find_containing_symbol(void *addr, soinfo *si);
+soinfo *find_containing_library(const void *addr);
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si);
 const char *linker_get_error(void);
 
 #ifdef ANDROID_ARM_LINKER 
 typedef long unsigned int *_Unwind_Ptr;
 _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
-#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_SH_LINKER)
+#elif defined(ANDROID_X86_LINKER)
 int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *), void *);
 #endif
 
diff --git a/linker/linker_format.c b/linker/linker_format.c
index 4d00bd9..0c68a0b 100644
--- a/linker/linker_format.c
+++ b/linker/linker_format.c
@@ -427,18 +427,20 @@
 static void
 out_vformat(Out *o, const char *format, va_list args)
 {
-    int nn = 0, mm;
-    int padZero = 0;
-    int padLeft = 0;
-    char sign = '\0';
-    int width = -1;
-    int prec  = -1;
-    size_t bytelen = sizeof(int);
-    const char*  str;
-    int slen;
-    char buffer[32];  /* temporary buffer used to format numbers */
+    int nn = 0;
 
     for (;;) {
+        int mm;
+        int padZero = 0;
+        int padLeft = 0;
+        char sign = '\0';
+        int width = -1;
+        int prec  = -1;
+        size_t bytelen = sizeof(int);
+        const char*  str;
+        int slen;
+        char buffer[32];  /* temporary buffer used to format numbers */
+
         char  c;
 
         /* first, find all characters that are not 0 or '%' */
@@ -525,9 +527,6 @@
             bytelen = sizeof(ptrdiff_t);
             c = format[nn++];
             break;
-        case 'p':
-            bytelen = sizeof(void*);
-            c = format[nn++];
         default:
             ;
         }
@@ -543,7 +542,7 @@
             buffer[1] = '\0';
             str = buffer;
         } else if (c == 'p') {
-            uint64_t  value = (uint64_t)(ptrdiff_t) va_arg(args, void*);
+            uint64_t  value = (uintptr_t) va_arg(args, void*);
             buffer[0] = '0';
             buffer[1] = 'x';
             format_hex(buffer + 2, sizeof buffer-2, value, 0);
@@ -684,7 +683,7 @@
     utest_expect("-8123", "%d", -8123);
     utest_expect("16", "%hd", 0x7fff0010);
     utest_expect("16", "%hhd", 0x7fffff10);
-    utest_expect("68719476736", "%lld", 0x1000000000);
+    utest_expect("68719476736", "%lld", 0x1000000000LL);
     utest_expect("70000", "%ld", 70000);
     utest_expect("0xb0001234", "%p", (void*)0xb0001234);
     utest_expect("12ab", "%x", 0x12ab);
@@ -697,6 +696,9 @@
     utest_expect("1234    ", "%-8d", 1234);
     utest_expect("abcdef     ", "%-11s", "abcdef");
     utest_expect("something:1234", "%s:%d", "something", 1234);
+    utest_expect("005:5:05", "%03d:%d:%02d", 5, 5, 5);
+    utest_expect("5,0x0", "%d,%p", 5, NULL);
+    utest_expect("68719476736,6,7,8", "%lld,%d,%d,%d", 0x1000000000LL, 6, 7, 8);
     return gFails != 0;
 }