summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-05-03 15:33:05 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2010-05-03 15:33:05 -0700
commitf450fa5f991af3c0814f96265cb3b2aafdce2309 (patch)
tree1f0e549863606fb8e11215061ad5dde0f37b50cd
parent5ef5272be985dfdeafa86077c306f6b64d334240 (diff)
parent0be7eda75a14815aaa3e5cd5d5d4e5d25dc35d1c (diff)
downloadbionic-f450fa5f991af3c0814f96265cb3b2aafdce2309.zip
bionic-f450fa5f991af3c0814f96265cb3b2aafdce2309.tar.gz
bionic-f450fa5f991af3c0814f96265cb3b2aafdce2309.tar.bz2
merge from open-source master
Change-Id: If02d33af51017dbd85e91c79ac2e848eda6cf253
-rw-r--r--libc/bionic/logd_write.c2
-rw-r--r--libc/bionic/malloc_debug_leak.c2
-rw-r--r--libc/kernel/arch-sh/asm/adc.h14
-rw-r--r--libc/kernel/arch-sh/asm/addrspace.h15
-rw-r--r--libc/kernel/arch-sh/asm/atomic-grb.h15
-rw-r--r--libc/kernel/arch-sh/asm/atomic-irq.h15
-rw-r--r--libc/kernel/arch-sh/asm/atomic-llsc.h15
-rw-r--r--libc/kernel/arch-sh/asm/atomic.h47
-rw-r--r--libc/kernel/arch-sh/asm/auxvec.h23
-rw-r--r--libc/kernel/arch-sh/asm/bitops-grb.h15
-rw-r--r--libc/kernel/arch-sh/asm/bitops-irq.h15
-rw-r--r--libc/kernel/arch-sh/asm/bitops.h15
-rw-r--r--libc/kernel/arch-sh/asm/bug.h30
-rw-r--r--libc/kernel/arch-sh/asm/bugs.h19
-rw-r--r--libc/kernel/arch-sh/asm/byteorder.h77
-rw-r--r--libc/kernel/arch-sh/asm/cache.h14
-rw-r--r--libc/kernel/arch-sh/asm/cacheflush.h15
-rw-r--r--libc/kernel/arch-sh/asm/checksum.h12
-rw-r--r--libc/kernel/arch-sh/asm/checksum_32.h22
-rw-r--r--libc/kernel/arch-sh/asm/checksum_64.h15
-rw-r--r--libc/kernel/arch-sh/asm/clock.h70
-rw-r--r--libc/kernel/arch-sh/asm/cmpxchg-grb.h15
-rw-r--r--libc/kernel/arch-sh/asm/cmpxchg-irq.h15
-rw-r--r--libc/kernel/arch-sh/asm/cpu-features.h25
-rw-r--r--libc/kernel/arch-sh/asm/cputime.h17
-rw-r--r--libc/kernel/arch-sh/asm/current.h20
-rw-r--r--libc/kernel/arch-sh/asm/delay.h19
-rw-r--r--libc/kernel/arch-sh/asm/device.h15
-rw-r--r--libc/kernel/arch-sh/asm/div64.h12
-rw-r--r--libc/kernel/arch-sh/asm/dma-mapping.h31
-rw-r--r--libc/kernel/arch-sh/asm/dma.h14
-rw-r--r--libc/kernel/arch-sh/asm/dmabrg.h26
-rw-r--r--libc/kernel/arch-sh/asm/edosk7705.h17
-rw-r--r--libc/kernel/arch-sh/asm/elf.h92
-rw-r--r--libc/kernel/arch-sh/asm/emergency-restart.h17
-rw-r--r--libc/kernel/arch-sh/asm/errno.h17
-rw-r--r--libc/kernel/arch-sh/asm/fb.h19
-rw-r--r--libc/kernel/arch-sh/asm/fcntl.h12
-rw-r--r--libc/kernel/arch-sh/asm/fixmap.h37
-rw-r--r--libc/kernel/arch-sh/asm/flat.h26
-rw-r--r--libc/kernel/arch-sh/asm/fpu.h20
-rw-r--r--libc/kernel/arch-sh/asm/freq.h14
-rw-r--r--libc/kernel/arch-sh/asm/futex-irq.h17
-rw-r--r--libc/kernel/arch-sh/asm/futex.h15
-rw-r--r--libc/kernel/arch-sh/asm/gpio.h15
-rw-r--r--libc/kernel/arch-sh/asm/hardirq.h24
-rw-r--r--libc/kernel/arch-sh/asm/hd64461.h216
-rw-r--r--libc/kernel/arch-sh/asm/hd64465/gpio.h27
-rw-r--r--libc/kernel/arch-sh/asm/hd64465/hd64465.h210
-rw-r--r--libc/kernel/arch-sh/asm/hd64465/io.h15
-rw-r--r--libc/kernel/arch-sh/asm/heartbeat.h28
-rw-r--r--libc/kernel/arch-sh/asm/hp6xx.h60
-rw-r--r--libc/kernel/arch-sh/asm/hugetlb.h17
-rw-r--r--libc/kernel/arch-sh/asm/hw_irq.h92
-rw-r--r--libc/kernel/arch-sh/asm/i2c-sh7760.h29
-rw-r--r--libc/kernel/arch-sh/asm/ilsel.h42
-rw-r--r--libc/kernel/arch-sh/asm/io.h22
-rw-r--r--libc/kernel/arch-sh/asm/io_generic.h19
-rw-r--r--libc/kernel/arch-sh/asm/io_trapped.h35
-rw-r--r--libc/kernel/arch-sh/asm/ioctl.h12
-rw-r--r--libc/kernel/arch-sh/asm/ioctls.h113
-rw-r--r--libc/kernel/arch-sh/asm/ipcbuf.h30
-rw-r--r--libc/kernel/arch-sh/asm/irq.h26
-rw-r--r--libc/kernel/arch-sh/asm/irq_regs.h12
-rw-r--r--libc/kernel/arch-sh/asm/irqflags.h20
-rw-r--r--libc/kernel/arch-sh/asm/irqflags_32.h15
-rw-r--r--libc/kernel/arch-sh/asm/irqflags_64.h20
-rw-r--r--libc/kernel/arch-sh/asm/kdebug.h19
-rw-r--r--libc/kernel/arch-sh/asm/kexec.h28
-rw-r--r--libc/kernel/arch-sh/asm/kgdb.h38
-rw-r--r--libc/kernel/arch-sh/asm/kmap_types.h36
-rw-r--r--libc/kernel/arch-sh/asm/lboxre2.h25
-rw-r--r--libc/kernel/arch-sh/asm/linkage.h18
-rw-r--r--libc/kernel/arch-sh/asm/local.h18
-rw-r--r--libc/kernel/arch-sh/asm/machvec.h69
-rw-r--r--libc/kernel/arch-sh/asm/magicpanelr2.h57
-rw-r--r--libc/kernel/arch-sh/asm/mc146818rtc.h15
-rw-r--r--libc/kernel/arch-sh/asm/microdev.h51
-rw-r--r--libc/kernel/arch-sh/asm/migor.h57
-rw-r--r--libc/kernel/arch-sh/asm/mman.h28
-rw-r--r--libc/kernel/arch-sh/asm/mmu.h61
-rw-r--r--libc/kernel/arch-sh/asm/mmu_context.h15
-rw-r--r--libc/kernel/arch-sh/asm/mmu_context_32.h15
-rw-r--r--libc/kernel/arch-sh/asm/mmu_context_64.h24
-rw-r--r--libc/kernel/arch-sh/asm/mmzone.h15
-rw-r--r--libc/kernel/arch-sh/asm/module.h27
-rw-r--r--libc/kernel/arch-sh/asm/msgbuf.h32
-rw-r--r--libc/kernel/arch-sh/asm/mutex.h12
-rw-r--r--libc/kernel/arch-sh/asm/page.h71
-rw-r--r--libc/kernel/arch-sh/asm/param.h26
-rw-r--r--libc/kernel/arch-sh/asm/parport.h15
-rw-r--r--libc/kernel/arch-sh/asm/pci.h20
-rw-r--r--libc/kernel/arch-sh/asm/percpu.h17
-rw-r--r--libc/kernel/arch-sh/asm/pgalloc.h25
-rw-r--r--libc/kernel/arch-sh/asm/pgtable.h93
-rw-r--r--libc/kernel/arch-sh/asm/pgtable_32.h152
-rw-r--r--libc/kernel/arch-sh/asm/pgtable_64.h105
-rw-r--r--libc/kernel/arch-sh/asm/pm.h15
-rw-r--r--libc/kernel/arch-sh/asm/poll.h12
-rw-r--r--libc/kernel/arch-sh/asm/posix_types.h16
-rw-r--r--libc/kernel/arch-sh/asm/posix_types_32.h122
-rw-r--r--libc/kernel/arch-sh/asm/posix_types_64.h122
-rw-r--r--libc/kernel/arch-sh/asm/processor.h50
-rw-r--r--libc/kernel/arch-sh/asm/processor_32.h14
-rw-r--r--libc/kernel/arch-sh/asm/processor_64.h127
-rw-r--r--libc/kernel/arch-sh/asm/ptrace.h84
-rw-r--r--libc/kernel/arch-sh/asm/push-switch.h42
-rw-r--r--libc/kernel/arch-sh/asm/r7780rp.h36
-rw-r--r--libc/kernel/arch-sh/asm/resource.h17
-rw-r--r--libc/kernel/arch-sh/asm/rtc.h23
-rw-r--r--libc/kernel/arch-sh/asm/rts7751r2d.h67
-rw-r--r--libc/kernel/arch-sh/asm/rwsem.h19
-rw-r--r--libc/kernel/arch-sh/asm/scatterlist.h29
-rw-r--r--libc/kernel/arch-sh/asm/sdk7780.h74
-rw-r--r--libc/kernel/arch-sh/asm/seccomp.h21
-rw-r--r--libc/kernel/arch-sh/asm/sections.h18
-rw-r--r--libc/kernel/arch-sh/asm/segment.h34
-rw-r--r--libc/kernel/arch-sh/asm/sembuf.h26
-rw-r--r--libc/kernel/arch-sh/asm/serial.h23
-rw-r--r--libc/kernel/arch-sh/asm/setup.h17
-rw-r--r--libc/kernel/arch-sh/asm/sfp-machine.h48
-rw-r--r--libc/kernel/arch-sh/asm/sh7760fb.h120
-rw-r--r--libc/kernel/arch-sh/asm/sh7763rdp.h45
-rw-r--r--libc/kernel/arch-sh/asm/sh7785lcr.h42
-rw-r--r--libc/kernel/arch-sh/asm/sh_bios.h15
-rw-r--r--libc/kernel/arch-sh/asm/sh_eth.h22
-rw-r--r--libc/kernel/arch-sh/asm/sh_keysc.h24
-rw-r--r--libc/kernel/arch-sh/asm/sh_mobile_lcdc.h83
-rw-r--r--libc/kernel/arch-sh/asm/shmbuf.h43
-rw-r--r--libc/kernel/arch-sh/asm/shmin.h20
-rw-r--r--libc/kernel/arch-sh/asm/shmparam.h19
-rw-r--r--libc/kernel/arch-sh/asm/sigcontext.h46
-rw-r--r--libc/kernel/arch-sh/asm/siginfo.h17
-rw-r--r--libc/kernel/arch-sh/asm/signal.h102
-rw-r--r--libc/kernel/arch-sh/asm/smc37c93x.h165
-rw-r--r--libc/kernel/arch-sh/asm/smp.h20
-rw-r--r--libc/kernel/arch-sh/asm/snapgear.h30
-rw-r--r--libc/kernel/arch-sh/asm/socket.h65
-rw-r--r--libc/kernel/arch-sh/asm/sockios.h24
-rw-r--r--libc/kernel/arch-sh/asm/sparsemem.h15
-rw-r--r--libc/kernel/arch-sh/asm/spi.h24
-rw-r--r--libc/kernel/arch-sh/asm/spinlock.h24
-rw-r--r--libc/kernel/arch-sh/asm/spinlock_types.h32
-rw-r--r--libc/kernel/arch-sh/asm/stat.h143
-rw-r--r--libc/kernel/arch-sh/asm/statfs.h17
-rw-r--r--libc/kernel/arch-sh/asm/string.h12
-rw-r--r--libc/kernel/arch-sh/asm/string_32.h15
-rw-r--r--libc/kernel/arch-sh/asm/string_64.h17
-rw-r--r--libc/kernel/arch-sh/asm/system.h63
-rw-r--r--libc/kernel/arch-sh/asm/system_32.h28
-rw-r--r--libc/kernel/arch-sh/asm/system_64.h29
-rw-r--r--libc/kernel/arch-sh/asm/systemh7751.h69
-rw-r--r--libc/kernel/arch-sh/asm/termbits.h201
-rw-r--r--libc/kernel/arch-sh/asm/termios.h50
-rw-r--r--libc/kernel/arch-sh/asm/thread_info.h15
-rw-r--r--libc/kernel/arch-sh/asm/timer.h37
-rw-r--r--libc/kernel/arch-sh/asm/timex.h19
-rw-r--r--libc/kernel/arch-sh/asm/titan.h24
-rw-r--r--libc/kernel/arch-sh/asm/tlb.h29
-rw-r--r--libc/kernel/arch-sh/asm/tlb_64.h28
-rw-r--r--libc/kernel/arch-sh/asm/tlbflush.h24
-rw-r--r--libc/kernel/arch-sh/asm/topology.h17
-rw-r--r--libc/kernel/arch-sh/asm/types.h35
-rw-r--r--libc/kernel/arch-sh/asm/uaccess.h55
-rw-r--r--libc/kernel/arch-sh/asm/uaccess_32.h25
-rw-r--r--libc/kernel/arch-sh/asm/uaccess_64.h19
-rw-r--r--libc/kernel/arch-sh/asm/ubc.h14
-rw-r--r--libc/kernel/arch-sh/asm/ucontext.h23
-rw-r--r--libc/kernel/arch-sh/asm/unaligned.h29
-rw-r--r--libc/kernel/arch-sh/asm/unistd.h16
-rw-r--r--libc/kernel/arch-sh/asm/unistd_32.h350
-rw-r--r--libc/kernel/arch-sh/asm/unistd_64.h378
-rw-r--r--libc/kernel/arch-sh/asm/user.h55
-rw-r--r--libc/kernel/arch-sh/asm/vga.h15
-rw-r--r--libc/kernel/arch-sh/asm/watchdog.h14
-rw-r--r--libc/kernel/arch-sh/asm/xor.h12
-rw-r--r--libc/stdio/asprintf.c7
-rw-r--r--libc/stdio/vasprintf.c5
-rw-r--r--libc/stdlib/assert.c2
-rw-r--r--libc/stdlib/ctype_.c2
-rw-r--r--libc/stdlib/getenv.c4
-rw-r--r--libc/stdlib/putenv.c2
-rw-r--r--libc/stdlib/qsort.c26
-rw-r--r--libc/stdlib/seed48.c2
-rw-r--r--libc/stdlib/sha1hash.c15
-rw-r--r--libc/stdlib/strtod.c377
-rw-r--r--libc/stdlib/strtoimax.c6
-rw-r--r--libc/stdlib/strtoumax.c6
-rw-r--r--libc/stdlib/wchar.c2
189 files changed, 7416 insertions, 232 deletions
diff --git a/libc/bionic/logd_write.c b/libc/bionic/logd_write.c
index 2c5bf42..618160f 100644
--- a/libc/bionic/logd_write.c
+++ b/libc/bionic/logd_write.c
@@ -114,6 +114,8 @@ static int __write_to_log_init(log_id_t log_id, struct iovec *vec)
(fd < 0) ? __write_to_log_null : __write_to_log_kernel;
log_channels[log_id].fd = fd;
+ log_channels[log_id].fd = fd;
+
pthread_mutex_unlock(&log_init_lock);
return log_channels[log_id].logger(log_id, vec);
diff --git a/libc/bionic/malloc_debug_leak.c b/libc/bionic/malloc_debug_leak.c
index 2ff8cee..0a3a68d 100644
--- a/libc/bionic/malloc_debug_leak.c
+++ b/libc/bionic/malloc_debug_leak.c
@@ -149,6 +149,8 @@ static HashEntry* record_backtrace(intptr_t* backtrace, size_t numEntries, size_
} else {
// create a new entry
entry = (HashEntry*)dlmalloc(sizeof(HashEntry) + numEntries*sizeof(intptr_t));
+ if (!entry)
+ return NULL;
entry->allocations = 1;
entry->slot = slot;
entry->prev = NULL;
diff --git a/libc/kernel/arch-sh/asm/adc.h b/libc/kernel/arch-sh/asm/adc.h
new file mode 100644
index 0000000..10de9ca
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/adc.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..d7d592d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/addrspace.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..6c24b1d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/atomic-grb.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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-irq.h b/libc/kernel/arch-sh/asm/atomic-irq.h
new file mode 100644
index 0000000..b8f5eaf
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/atomic-irq.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_IRQ_H
+#define __ASM_SH_ATOMIC_IRQ_H
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/atomic-llsc.h b/libc/kernel/arch-sh/asm/atomic-llsc.h
new file mode 100644
index 0000000..22e63e7
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/atomic-llsc.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..e8f332d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/atomic.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..98317bc
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/auxvec.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..d881058
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/bitops-grb.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..a20d3ec
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/bitops-irq.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..4c1f6d6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/bitops.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..dd02cb9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/bug.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..3b27870
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/bugs.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..04ef224
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/byteorder.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..0bc339e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/cache.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..5c95ad1
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/cacheflush.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..c9193c5
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/checksum.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7a84e19
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/checksum_32.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..203e11d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/checksum_64.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..9f127c3
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/clock.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7d35595
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/cmpxchg-grb.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..5558b1f
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/cmpxchg-irq.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..326d2d9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/cpu-features.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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/cputime.h b/libc/kernel/arch-sh/asm/cputime.h
new file mode 100644
index 0000000..8a85d30
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/cputime.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_CPUTIME_H
+#define __SH_CPUTIME_H
+
+#include <asm-generic/cputime.h>
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/current.h b/libc/kernel/arch-sh/asm/current.h
new file mode 100644
index 0000000..e2ce122
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/current.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_CURRENT_H
+#define __ASM_SH_CURRENT_H
+
+#include <linux/thread_info.h>
+
+struct task_struct;
+
+#define current get_current()
+#endif
diff --git a/libc/kernel/arch-sh/asm/delay.h b/libc/kernel/arch-sh/asm/delay.h
new file mode 100644
index 0000000..15a1aa4
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/delay.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/device.h b/libc/kernel/arch-sh/asm/device.h
new file mode 100644
index 0000000..a46d06f
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/device.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/device.h>
+
+struct platform_device;
+
diff --git a/libc/kernel/arch-sh/asm/div64.h b/libc/kernel/arch-sh/asm/div64.h
new file mode 100644
index 0000000..53a10fc
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/div64.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..3bbdf18
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/dma-mapping.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..40fe1d6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/dma.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..eadfcac
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/dmabrg.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..146675d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/edosk7705.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..4f283c2
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/elf.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..1c1964f
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/emergency-restart.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..f35743b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/errno.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..f25951e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/fb.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..00630ad
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/fcntl.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/fixmap.h b/libc/kernel/arch-sh/asm/fixmap.h
new file mode 100644
index 0000000..3f7b948
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/fixmap.h
@@ -0,0 +1,37 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_FIXMAP_H
+#define _ASM_FIXMAP_H
+
+#include <linux/kernel.h>
+#include <asm/page.h>
+
+enum fixed_addresses {
+#define FIX_N_COLOURS 16
+ FIX_CMAP_BEGIN,
+ FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
+ FIX_UNCACHED,
+ __end_of_fixed_addresses
+};
+
+#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_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
+#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
+
+#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-sh/asm/flat.h b/libc/kernel/arch-sh/asm/flat.h
new file mode 100644
index 0000000..6686199
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/flat.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..9671d75
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/fpu.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..ad93c19
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/freq.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..20ca261
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/futex-irq.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..cad68a9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/futex.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..8e26b01
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/gpio.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/hardirq.h b/libc/kernel/arch-sh/asm/hardirq.h
new file mode 100644
index 0000000..6d80d02
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hardirq.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SH_HARDIRQ_H
+#define __ASM_SH_HARDIRQ_H
+
+#include <linux/threads.h>
+#include <linux/irq.h>
+
+typedef struct {
+ unsigned int __softirq_pending;
+} ____cacheline_aligned irq_cpustat_t;
+
+#include <linux/irq_cpustat.h>
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/hd64461.h b/libc/kernel/arch-sh/asm/hd64461.h
new file mode 100644
index 0000000..af16596
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hd64461.h
@@ -0,0 +1,216 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..159c7c4
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hd64465/gpio.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..108289b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hd64465/hd64465.h
@@ -0,0 +1,210 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..9de2885
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hd64465/io.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..cbcfef1
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/heartbeat.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..023ae2e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hp6xx.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..ab3aa5a
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hugetlb.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..24e7278
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/hw_irq.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..f510223
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/i2c-sh7760.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..da35878
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ilsel.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7730c15
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/io.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..f122342
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/io_generic.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..9702a8e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/io_trapped.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..6e446b6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ioctl.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..94ca854
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ioctls.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..7ebc070
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ipcbuf.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..128135a
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/irq.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..1e8a2b6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/irq_regs.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..fe442e4
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/irqflags.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..711b0d6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/irqflags_32.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..dbbdce7
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/irqflags_64.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..fb8dbc0
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/kdebug.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..f5a865b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/kexec.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..386b380
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/kgdb.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..ea30766
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/kmap_types.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..1791361
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/lboxre2.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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/linkage.h b/libc/kernel/arch-sh/asm/linkage.h
new file mode 100644
index 0000000..1921dd3
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/linkage.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+#define __ALIGN .balign 4
+#define __ALIGN_STR ".balign 4"
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/local.h b/libc/kernel/arch-sh/asm/local.h
new file mode 100644
index 0000000..4a39637
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/local.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..5b48918
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/machvec.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..e0fd4a2
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/magicpanelr2.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/mc146818rtc.h b/libc/kernel/arch-sh/asm/mc146818rtc.h
new file mode 100644
index 0000000..fe5300a
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mc146818rtc.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_MC146818RTC_H
+#define _ASM_MC146818RTC_H
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/microdev.h b/libc/kernel/arch-sh/asm/microdev.h
new file mode 100644
index 0000000..cff5a06
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/microdev.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..be8ffb3
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/migor.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..bf96efc
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mman.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..cf54cb8
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mmu.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..cbf07ef
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mmu_context.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..dca7e6b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mmu_context_32.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..d7744be
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mmu_context_64.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..9bddda4
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mmzone.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..76bb90a
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/module.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/msgbuf.h b/libc/kernel/arch-sh/asm/msgbuf.h
new file mode 100644
index 0000000..ec64905
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/msgbuf.h
@@ -0,0 +1,32 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_MSGBUF_H
+#define __ASM_SH_MSGBUF_H
+
+struct msqid64_ds {
+ struct ipc64_perm msg_perm;
+ __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;
+ unsigned long msg_qnum;
+ unsigned long msg_qbytes;
+ __kernel_pid_t msg_lspid;
+ __kernel_pid_t msg_lrpid;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/mutex.h b/libc/kernel/arch-sh/asm/mutex.h
new file mode 100644
index 0000000..79054b2
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/mutex.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/mutex-dec.h>
diff --git a/libc/kernel/arch-sh/asm/page.h b/libc/kernel/arch-sh/asm/page.h
new file mode 100644
index 0000000..f187dd7
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/page.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..4a59cd8
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/param.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..8375b51
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/parport.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..1fafad9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/pci.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/percpu.h b/libc/kernel/arch-sh/asm/percpu.h
new file mode 100644
index 0000000..1b3a8cb
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/percpu.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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 __ARCH_SH_PERCPU
+#define __ARCH_SH_PERCPU
+
+#include <asm-generic/percpu.h>
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/pgalloc.h b/libc/kernel/arch-sh/asm/pgalloc.h
new file mode 100644
index 0000000..6c15ea5
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/pgalloc.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SH_PGALLOC_H
+#define __ASM_SH_PGALLOC_H
+
+#include <linux/quicklist.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)
+#endif
diff --git a/libc/kernel/arch-sh/asm/pgtable.h b/libc/kernel/arch-sh/asm/pgtable.h
new file mode 100644
index 0000000..3c8ece1
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/pgtable.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..6ef21f1
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/pgtable_32.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 __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
new file mode 100644
index 0000000..b5d60bb
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/pgtable_64.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..ba4caa7
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/pm.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..5b16673
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/poll.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7d13b5d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/posix_types.h
@@ -0,0 +1,16 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7cca40b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/posix_types_32.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..babc366
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/posix_types_64.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..e808ed6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/processor.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..d60b2f8
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/processor_32.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..035a526
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/processor_64.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..452af81
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ptrace.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..e07bf67
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/push-switch.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..50e0df8
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/r7780rp.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..da606cc
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/resource.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..ecc6f37
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/rtc.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..775f25b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/rts7751r2d.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..4b5552e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/rwsem.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..1c5c818
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/scatterlist.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..e5659d9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sdk7780.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..ab9cab3
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/seccomp.h
@@ -0,0 +1,21 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/sections.h b/libc/kernel/arch-sh/asm/sections.h
new file mode 100644
index 0000000..71c66a6
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sections.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_SECTIONS_H
+#define __ASM_SH_SECTIONS_H
+
+#include <asm-generic/sections.h>
+
+#endif
+
diff --git a/libc/kernel/arch-sh/asm/segment.h b/libc/kernel/arch-sh/asm/segment.h
new file mode 100644
index 0000000..3525a35
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/segment.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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/sembuf.h b/libc/kernel/arch-sh/asm/sembuf.h
new file mode 100644
index 0000000..7c0bdf9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sembuf.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_SEMBUF_H
+#define __ASM_SH_SEMBUF_H
+
+struct semid64_ds {
+ struct ipc64_perm sem_perm;
+ __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;
+};
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/serial.h b/libc/kernel/arch-sh/asm/serial.h
new file mode 100644
index 0000000..ae59411
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/serial.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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/setup.h b/libc/kernel/arch-sh/asm/setup.h
new file mode 100644
index 0000000..f97e133
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/setup.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_SETUP_H
+#define _SH_SETUP_H
+
+#define COMMAND_LINE_SIZE 256
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/sfp-machine.h b/libc/kernel/arch-sh/asm/sfp-machine.h
new file mode 100644
index 0000000..f5e9844
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sfp-machine.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..1082668
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh7760fb.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7c1aa19
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh7763rdp.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..0729f53
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh7785lcr.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..d78679a
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh_bios.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..f9fc253
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh_eth.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..a14b47f
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh_keysc.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..2b3e730
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sh_mobile_lcdc.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/shmbuf.h b/libc/kernel/arch-sh/asm/shmbuf.h
new file mode 100644
index 0000000..7cbe0c7
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/shmbuf.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_SHMBUF_H
+#define __ASM_SH_SHMBUF_H
+
+struct shmid64_ds {
+ struct ipc64_perm shm_perm;
+ 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;
+ __kernel_pid_t shm_cpid;
+ __kernel_pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+struct shminfo64 {
+ unsigned long shmmax;
+ unsigned long shmmin;
+ unsigned long shmmni;
+ unsigned long shmseg;
+ unsigned long shmall;
+ unsigned long __unused1;
+ unsigned long __unused2;
+ unsigned long __unused3;
+ unsigned long __unused4;
+};
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/shmin.h b/libc/kernel/arch-sh/asm/shmin.h
new file mode 100644
index 0000000..0d61b94
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/shmin.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..a51628e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/shmparam.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..3cf7cad
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sigcontext.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..864960e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/siginfo.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..5edf0d2
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/signal.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..7d2f393
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/smc37c93x.h
@@ -0,0 +1,165 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/smp.h b/libc/kernel/arch-sh/asm/smp.h
new file mode 100644
index 0000000..e377a6b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/smp.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_SMP_H
+#define __ASM_SH_SMP_H
+
+#include <linux/bitops.h>
+#include <linux/cpumask.h>
+
+#define hard_smp_processor_id() (0)
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/snapgear.h b/libc/kernel/arch-sh/asm/snapgear.h
new file mode 100644
index 0000000..e0e72e2
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/snapgear.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..ad1031d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/socket.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..fd88099
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sockios.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..b316514
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/sparsemem.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..e8899b2
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/spi.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..2eeb198
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/spinlock.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..e21fc1e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/spinlock_types.h
@@ -0,0 +1,32 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..1360798
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/stat.h
@@ -0,0 +1,143 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..32a335b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/statfs.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..ba7b12b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/string.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..70f2939
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/string_32.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..a7f5128
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/string_64.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..8b1981e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/system.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..5151677
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/system_32.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..1bc4710
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/system_64.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..b2dfc35
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/systemh7751.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..97b26db
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/termbits.h
@@ -0,0 +1,201 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..fb31cbe
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/termios.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/thread_info.h b/libc/kernel/arch-sh/asm/thread_info.h
new file mode 100644
index 0000000..03ef26d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/thread_info.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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_THREAD_INFO_H
+#define __ASM_SH_THREAD_INFO_H
+
+#endif
diff --git a/libc/kernel/arch-sh/asm/timer.h b/libc/kernel/arch-sh/asm/timer.h
new file mode 100644
index 0000000..ff298f3
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/timer.h
@@ -0,0 +1,37 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..9003c78
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/timex.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..71d2e8e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/titan.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..602250b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/tlb.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..77c54eb
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/tlb_64.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..7d61293
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/tlbflush.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..1b5461b
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/topology.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..1febd0d
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..8b27346
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/uaccess.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..af82591
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/uaccess_32.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..b0661dc
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/uaccess_64.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..cde9ede
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ubc.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..815f79f
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/ucontext.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..43ef01e
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/unaligned.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.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#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
new file mode 100644
index 0000000..02969d7
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/unistd.h
@@ -0,0 +1,16 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..0db5074
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/unistd_32.h
@@ -0,0 +1,350 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..2a72b96
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/unistd_64.h
@@ -0,0 +1,378 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..81ab4e3
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/user.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..9e857a9
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/vga.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..81d7905
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/watchdog.h
@@ -0,0 +1,14 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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
new file mode 100644
index 0000000..780a4ac
--- /dev/null
+++ b/libc/kernel/arch-sh/asm/xor.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call 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/stdio/asprintf.c b/libc/stdio/asprintf.c
index 7379140..1257c7f 100644
--- a/libc/stdio/asprintf.c
+++ b/libc/stdio/asprintf.c
@@ -39,7 +39,7 @@ asprintf(char **str, const char *fmt, ...)
f._bf._size = f._w = 127; /* Leave room for the NUL */
va_start(ap, fmt);
ret = vfprintf(&f, fmt, ap);
- va_end(ap);
+ va_end(ap);
if (ret == -1)
goto err;
*f._p = '\0';
@@ -50,10 +50,7 @@ asprintf(char **str, const char *fmt, ...)
return (ret);
err:
- if (f._bf._base) {
- free(f._bf._base);
- f._bf._base = NULL;
- }
+ free(f._bf._base);
*str = NULL;
errno = ENOMEM;
return (-1);
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c
index c3280c9..54c46b3 100644
--- a/libc/stdio/vasprintf.c
+++ b/libc/stdio/vasprintf.c
@@ -48,10 +48,7 @@ vasprintf(char **str, const char *fmt, __va_list ap)
return (ret);
err:
- if (f._bf._base) {
- free(f._bf._base);
- f._bf._base = NULL;
- }
+ free(f._bf._base);
*str = NULL;
errno = ENOMEM;
return (-1);
diff --git a/libc/stdlib/assert.c b/libc/stdlib/assert.c
index b439d8e..816b050 100644
--- a/libc/stdlib/assert.c
+++ b/libc/stdlib/assert.c
@@ -49,6 +49,6 @@ __assert2(const char *file, int line, const char *func, const char *failedexpr)
(void)fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d, function \"%s\"\n",
failedexpr, file, line, func);
- abort();
+ abort();
/* NOTREACHED */
}
diff --git a/libc/stdlib/ctype_.c b/libc/stdlib/ctype_.c
index f59af3e..cf32f16 100644
--- a/libc/stdlib/ctype_.c
+++ b/libc/stdlib/ctype_.c
@@ -53,7 +53,7 @@ const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
-/* determine printability based on the IS0 8859 8-bit standard */
+ /* determine printability based on the IS0 8859 8-bit standard */
_L, _L, _L, _P, _P, _P, _P, _C,
_C, _C, _C, _C, _C, _C, _C, _C, /* 80 */
diff --git a/libc/stdlib/getenv.c b/libc/stdlib/getenv.c
index 13abe30..72367b3 100644
--- a/libc/stdlib/getenv.c
+++ b/libc/stdlib/getenv.c
@@ -62,8 +62,8 @@ __findenv(const char *name, int *offset)
if (i == 0 && *cp++ == '=') {
*offset = p - environ;
return (cp);
- }
- }
+ }
+ }
return (NULL);
}
diff --git a/libc/stdlib/putenv.c b/libc/stdlib/putenv.c
index c3bedae..54482f6 100644
--- a/libc/stdlib/putenv.c
+++ b/libc/stdlib/putenv.c
@@ -42,7 +42,7 @@ putenv(const char *str)
if ((equal = strchr(p, '=')) == NULL) {
(void)free(p);
return (-1);
- }
+ }
*equal = '\0';
rval = setenv(p, equal + 1, 1);
(void)free(p);
diff --git a/libc/stdlib/qsort.c b/libc/stdlib/qsort.c
index cd66961..f6fc8e1 100644
--- a/libc/stdlib/qsort.c
+++ b/libc/stdlib/qsort.c
@@ -39,11 +39,11 @@ static __inline void swapfunc(char *, char *, int, int);
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
*/
-#define swapcode(TYPE, parmi, parmj, n) { \
- long i = (n) / sizeof (TYPE); \
- TYPE *pi = (TYPE *) (parmi); \
- TYPE *pj = (TYPE *) (parmj); \
- do { \
+#define swapcode(TYPE, parmi, parmj, n) { \
+ long i = (n) / sizeof (TYPE); \
+ TYPE *pi = (TYPE *) (parmi); \
+ TYPE *pj = (TYPE *) (parmj); \
+ do { \
TYPE t = *pi; \
*pi++ = *pj; \
*pj++ = t; \
@@ -56,7 +56,7 @@ static __inline void swapfunc(char *, char *, int, int);
static __inline void
swapfunc(char *a, char *b, int n, int swaptype)
{
- if (swaptype <= 1)
+ if (swaptype <= 1)
swapcode(long, a, b, n)
else
swapcode(char, a, b, n)
@@ -70,7 +70,7 @@ swapfunc(char *a, char *b, int n, int swaptype)
} else \
swapfunc(a, b, es, swaptype)
-#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
+#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
static __inline char *
med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
@@ -110,7 +110,7 @@ loop: SWAPINIT(a, es);
}
swap(a, pm);
pa = pb = (char *)a + es;
-
+
pc = pd = (char *)a + (n - 1) * es;
for (;;) {
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
@@ -118,7 +118,7 @@ loop: SWAPINIT(a, es);
swap_cnt = 1;
swap(pa, pb);
pa += es;
- }
+ }
pb += es;
}
while (pb <= pc && (r = cmp(pc, a)) >= 0) {
@@ -138,11 +138,11 @@ loop: SWAPINIT(a, es);
}
if (swap_cnt == 0) { /* Switch to insertion sort */
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
- for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
+ for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
pl -= es)
swap(pl, pl - es);
return;
- }
+ }
pn = (char *)a + n * es;
r = min(pa - (char *)a, pb - pa);
@@ -151,11 +151,11 @@ loop: SWAPINIT(a, es);
vecswap(pb, pn - r, r);
if ((r = pb - pa) > (int)es)
qsort(a, r / es, es, cmp);
- if ((r = pd - pc) > (int)es) {
+ if ((r = pd - pc) > (int)es) {
/* Iterate rather than recurse to save stack space */
a = pn - r;
n = r / es;
goto loop;
}
-/* qsort(pn - r, r / es, es, cmp);*/
+ /* qsort(pn - r, r / es, es, cmp); */
}
diff --git a/libc/stdlib/seed48.c b/libc/stdlib/seed48.c
index afd5f54..583262f 100644
--- a/libc/stdlib/seed48.c
+++ b/libc/stdlib/seed48.c
@@ -22,7 +22,7 @@ unsigned short *
seed48(unsigned short xseed[3])
{
static unsigned short sseed[3];
-
+
sseed[0] = __rand48_seed[0];
sseed[1] = __rand48_seed[1];
sseed[2] = __rand48_seed[2];
diff --git a/libc/stdlib/sha1hash.c b/libc/stdlib/sha1hash.c
index 28e3399..1c7aaf3 100644
--- a/libc/stdlib/sha1hash.c
+++ b/libc/stdlib/sha1hash.c
@@ -4,7 +4,7 @@ By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
-----------------
-Modified 7/98
+Modified 7/98
By James H. Brown <jbrown@burgoyne.com>
Still 100% Public Domain
@@ -26,7 +26,7 @@ Since the file IO in main() reads 16K at a time, any file 8K or larger would
be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
"a"s).
-I also changed the declaration of variables i & j in SHA1Update to
+I also changed the declaration of variables i & j in SHA1Update to
unsigned long from unsigned int for the same reason.
These changes should make no difference to any 32 bit implementations since
@@ -53,7 +53,7 @@ Still 100% public domain
Modified 4/01
By Saul Kravitz <Saul.Kravitz@celera.com>
Still 100% PD
-Modified to run on Compaq Alpha hardware.
+Modified to run on Compaq Alpha hardware.
-----------------
Modified 2/03
@@ -116,7 +116,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
void SHAPrintContext(SHA1_CTX *context, char *msg){
printf("%s (%d,%d) %x %x %x %x %x\n",
msg,
- context->count[0], context->count[1],
+ context->count[0], context->count[1],
context->state[0],
context->state[1],
context->state[2],
@@ -238,8 +238,7 @@ unsigned char finalcount[8];
while ((context->count[0] & 504) != 448) {
SHA1Update(context, (unsigned char *)"\0", 1);
}
- SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
-*/
+ SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
for (i = 0; i < 20; i++) {
digest[i] = (unsigned char)
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
@@ -254,7 +253,7 @@ unsigned char finalcount[8];
SHA1Transform(context->state, context->buffer);
#endif
}
-
+
/*************************************************************/
/* This is not quite the MIME base64 algorithm: it uses _ instead of /,
@@ -302,7 +301,7 @@ int main(int argc, char** argv)
fputs("Unable to open file.", stderr);
return(-1);
}
- }
+ }
SHA1Init(&context);
while (!feof(file)) { /* note: what if ferror(file) */
i = fread(buffer, 1, 16384, file);
diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c
index b1f5868..9d599b0 100644
--- a/libc/stdlib/strtod.c
+++ b/libc/stdlib/strtod.c
@@ -364,7 +364,7 @@ Bigint {
struct Bigint *next;
int k, maxwds, sign, wds;
ULong x[1];
- };
+};
typedef struct Bigint Bigint;
@@ -411,7 +411,7 @@ Balloc
if ((rv = freelist[k]) != NULL) {
freelist[k] = rv->next;
- }
+ }
else {
x = 1 << k;
rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long));
@@ -421,13 +421,13 @@ Balloc
}
rv->k = k;
rv->maxwds = x;
- }
+ }
rv->sign = rv->wds = 0;
EXIT:
mutex_unlock(&freelist_mutex);
return rv;
- }
+}
static void
Bfree
@@ -444,8 +444,8 @@ Bfree
freelist[v->k] = v;
mutex_unlock(&freelist_mutex);
- }
}
+}
#define Bcopy_valid(x,y) memcpy(&(x)->sign, &(y)->sign, \
(y)->wds*sizeof(Long) + 2*sizeof(int))
@@ -498,8 +498,8 @@ multadd
a = (int)(y >> 16);
*x++ = y & 0xffff;
#endif
- }
- while(++i < wds);
+ }
+ while(++i < wds);
if (a) {
if (wds >= b->maxwds) {
b1 = Balloc(b->k+1);
@@ -513,9 +513,9 @@ multadd
}
b->x[wds++] = a;
b->wds = wds;
- }
- return b;
}
+ return b;
+}
static Bigint *
s2b
@@ -552,13 +552,13 @@ s2b
do b = multadd(b, 10, *s++ - '0');
while(++i < nd0);
s++;
- }
+ }
else
s += 10;
for(; i < nd; i++)
b = multadd(b, 10, *s++ - '0');
return b;
- }
+}
static int
hi0bits
@@ -573,26 +573,26 @@ hi0bits
if (!(x & 0xffff0000)) {
k = 16;
x <<= 16;
- }
+ }
if (!(x & 0xff000000)) {
k += 8;
x <<= 8;
- }
+ }
if (!(x & 0xf0000000)) {
k += 4;
x <<= 4;
- }
+ }
if (!(x & 0xc0000000)) {
k += 2;
x <<= 2;
- }
+ }
if (!(x & 0x80000000)) {
k++;
if (!(x & 0x40000000))
return 32;
- }
- return k;
}
+ return k;
+}
static int
lo0bits
@@ -614,33 +614,33 @@ lo0bits
}
*y = x >> 2;
return 2;
- }
+ }
k = 0;
if (!(x & 0xffff)) {
k = 16;
x >>= 16;
- }
+ }
if (!(x & 0xff)) {
k += 8;
x >>= 8;
- }
+ }
if (!(x & 0xf)) {
k += 4;
x >>= 4;
- }
+ }
if (!(x & 0x3)) {
k += 2;
x >>= 2;
- }
+ }
if (!(x & 1)) {
k++;
x >>= 1;
if (!x & 1)
return 32;
- }
+ }
*y = x;
return k;
- }
+}
static Bigint *
i2b
@@ -658,7 +658,7 @@ i2b
b->wds = 1;
}
return b;
- }
+}
static Bigint *
mult
@@ -683,7 +683,7 @@ mult
c = a;
a = b;
b = c;
- }
+ }
k = a->k;
wa = a->wds;
wb = b->wds;
@@ -712,10 +712,10 @@ mult
z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
carry = z2 >> 16;
Storeinc(xc, z2, z);
- }
- while(x < xae);
- *xc = carry;
}
+ while(x < xae);
+ *xc = carry;
+ }
if ((y = *xb >> 16) != 0) {
x = xa;
xc = xc0;
@@ -727,11 +727,11 @@ mult
Storeinc(xc, z, z2);
z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
carry = z2 >> 16;
- }
- while(x < xae);
- *xc = z2;
}
+ while(x < xae);
+ *xc = z2;
}
+ }
#else
for(; xb < xbe; xc0++) {
if (y = *xb++) {
@@ -742,16 +742,16 @@ mult
z = *x++ * y + *xc + carry;
carry = z >> 16;
*xc++ = z & 0xffff;
- }
- while(x < xae);
- *xc = carry;
}
+ while(x < xae);
+ *xc = carry;
}
+ }
#endif
for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ;
c->wds = wc;
return c;
- }
+}
static Bigint *p5s;
@@ -784,13 +784,13 @@ pow5mult
}
p5s = p5;
p5->next = 0;
- }
+ }
for(;;) {
if (k & 1) {
b1 = mult(b, p5);
Bfree(b);
b = b1;
- }
+ }
if (!(k = (unsigned int) k >> 1))
break;
if (!(p51 = p5->next)) {
@@ -801,11 +801,11 @@ pow5mult
}
p5->next = p51;
p51->next = 0;
- }
- p5 = p51;
}
- return b;
+ p5 = p51;
}
+ return b;
+}
static Bigint *
lshift
@@ -848,11 +848,11 @@ lshift
do {
*x1++ = *x << k | z;
z = *x++ >> k1;
- }
- while(x < xe);
+ }
+ while(x < xe);
if ((*x1 = z) != 0)
++n1;
- }
+ }
#else
if (k &= 0xf) {
k1 = 16 - k;
@@ -860,11 +860,11 @@ lshift
do {
*x1++ = *x << k & 0xffff | z;
z = *x++ >> k1;
- }
- while(x < xe);
+ }
+ while(x < xe);
if (*x1 = z)
++n1;
- }
+ }
#endif
else do
*x1++ = *x++;
@@ -872,7 +872,7 @@ lshift
b1->wds = n1 - 1;
Bfree(b);
return b1;
- }
+}
static int
cmp
@@ -911,9 +911,9 @@ cmp
return *xa < *xb ? -1 : 1;
if (xa <= xa0)
break;
- }
- return 0;
}
+ return 0;
+}
static Bigint *
diff
@@ -942,13 +942,13 @@ diff
c->x[0] = 0;
}
return c;
- }
+ }
if (i < 0) {
c = a;
a = b;
b = c;
i = 1;
- }
+ }
else
i = 0;
c = Balloc(a->k);
@@ -972,8 +972,8 @@ diff
borrow = (ULong)z >> 16;
Sign_Extend(borrow, z);
Storeinc(xc, z, y);
- }
- while(xb < xbe);
+ }
+ while(xb < xbe);
while(xa < xae) {
y = (*xa & 0xffff) + borrow;
borrow = (ULong)y >> 16;
@@ -982,27 +982,27 @@ diff
borrow = (ULong)z >> 16;
Sign_Extend(borrow, z);
Storeinc(xc, z, y);
- }
+ }
#else
do {
y = *xa++ - *xb++ + borrow;
borrow = y >> 16;
Sign_Extend(borrow, y);
*xc++ = y & 0xffff;
- }
- while(xb < xbe);
+ }
+ while(xb < xbe);
while(xa < xae) {
y = *xa++ + borrow;
borrow = y >> 16;
Sign_Extend(borrow, y);
*xc++ = y & 0xffff;
- }
+ }
#endif
while(!*--xc)
wa--;
c->wds = wa;
return c;
- }
+}
static double
ulp
@@ -1027,22 +1027,22 @@ ulp
word0(a) = L;
word1(a) = 0;
#ifndef Sudden_Underflow
- }
+ }
else {
L = (ULong)-L >> Exp_shift;
if (L < Exp_shift) {
word0(a) = 0x80000 >> L;
word1(a) = 0;
- }
+ }
else {
word0(a) = 0;
L -= Exp_shift;
word1(a) = L >= 31 ? 1 : 1 << (31 - L);
- }
}
+ }
#endif
return value(a);
- }
+}
static double
b2d
@@ -1079,17 +1079,17 @@ b2d
w = xa > xa0 ? *--xa : 0;
d1 = y << ((32-Ebits) + k) | w >> (Ebits - k);
goto ret_d;
- }
+ }
z = xa > xa0 ? *--xa : 0;
if (k -= Ebits) {
d0 = Exp_1 | y << k | z >> (32 - k);
y = xa > xa0 ? *--xa : 0;
d1 = z << k | y >> (32 - k);
- }
+ }
else {
d0 = Exp_1 | y;
d1 = z;
- }
+ }
#else
if (k < Ebits + 16) {
z = xa > xa0 ? *--xa : 0;
@@ -1098,7 +1098,7 @@ b2d
y = xa > xa0 ? *--xa : 0;
d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k;
goto ret_d;
- }
+ }
z = xa > xa0 ? *--xa : 0;
w = xa > xa0 ? *--xa : 0;
k -= Ebits + 16;
@@ -1115,7 +1115,7 @@ b2d
#undef d1
#endif
return value(d);
- }
+}
static Bigint *
d2b
@@ -1167,11 +1167,11 @@ d2b
if ((k = lo0bits(&y)) != 0) {
x[0] = y | z << (32 - k);
z >>= k;
- }
+ }
else
x[0] = y;
i = b->wds = (x[1] = z) ? 2 : 1;
- }
+ }
else {
#ifdef DEBUG
if (!z)
@@ -1181,7 +1181,7 @@ d2b
x[0] = z;
i = b->wds = 1;
k += 32;
- }
+ }
#else
if (y = d1) {
if (k = lo0bits(&y))
@@ -1190,22 +1190,22 @@ d2b
x[1] = z >> k - 16 & 0xffff;
x[2] = z >> k;
i = 2;
- }
+ }
else {
x[0] = y & 0xffff;
x[1] = y >> 16 | z << 16 - k & 0xffff;
x[2] = z >> k & 0xffff;
x[3] = z >> k+16;
i = 3;
- }
+ }
else {
x[0] = y & 0xffff;
x[1] = y >> 16;
x[2] = z & 0xffff;
x[3] = z >> 16;
i = 3;
- }
}
+ }
else {
#ifdef DEBUG
if (!z)
@@ -1215,14 +1215,14 @@ d2b
if (k >= 16) {
x[0] = z;
i = 0;
- }
+ }
else {
x[0] = z & 0xffff;
x[1] = z >> 16;
i = 1;
- }
- k += 32;
}
+ k += 32;
+ }
while(!x[i])
--i;
b->wds = i + 1;
@@ -1238,7 +1238,7 @@ d2b
*bits = P - k;
#endif
#ifndef Sudden_Underflow
- }
+ }
else {
*e = de - Bias - (P-1) + 1 + k;
#ifdef Pack_32
@@ -1249,7 +1249,7 @@ d2b
}
#endif
return b;
- }
+}
#undef d0
#undef d1
@@ -1279,23 +1279,23 @@ ratio
word0(da) += (k >> 2)*Exp_msk1;
if (k &= 3)
da *= 1 << k;
- }
+ }
else {
k = -k;
word0(db) += (k >> 2)*Exp_msk1;
if (k &= 3)
db *= 1 << k;
- }
+ }
#else
if (k > 0)
word0(da) += k*Exp_msk1;
else {
k = -k;
word0(db) += k*Exp_msk1;
- }
+ }
#endif
return value(da) / value(db);
- }
+}
static CONST double
tens[] = {
@@ -1305,7 +1305,7 @@ tens[] = {
#ifdef VAX
, 1e23, 1e24
#endif
- };
+};
#ifdef IEEE_Arith
static CONST double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
@@ -1410,7 +1410,7 @@ strtod
while(*++s == '0') ;
if (!*s)
goto ret;
- }
+ }
s0 = s;
y = z = 0;
for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
@@ -1431,7 +1431,7 @@ strtod
goto have_dig;
}
goto dig_done;
- }
+ }
for(; c >= '0' && c <= '9'; c = *++s) {
have_dig:
nz++;
@@ -1447,16 +1447,16 @@ strtod
else if (nd <= DBL_DIG + 1)
z = 10*z + c;
nz = 0;
- }
}
}
+ }
dig_done:
e = 0;
if (c == 'e' || c == 'E') {
if (!nd && !nz && !nz0) {
s = s00;
goto ret;
- }
+ }
s00 = s;
esign = 0;
switch(c = *++s) {
@@ -1465,7 +1465,7 @@ strtod
/* FALLTHROUGH */
case '+':
c = *++s;
- }
+ }
if (c >= '0' && c <= '9') {
while(c == '0')
c = *++s;
@@ -1483,18 +1483,18 @@ strtod
e = (int)L;
if (esign)
e = -e;
- }
+ }
else
e = 0;
- }
+ }
else
s = s00;
- }
+ }
if (!nd) {
if (!nz && !nz0)
s = s00;
goto ret;
- }
+ }
e1 = e -= nf;
/* Now we have nd0 digits, starting at s0, followed by a
@@ -1513,7 +1513,7 @@ strtod
#ifndef RND_PRODQUOT
&& FLT_ROUNDS == 1
#endif
- ) {
+ ) {
if (!e)
goto ret;
if (e > 0) {
@@ -1525,7 +1525,7 @@ strtod
tens[e]);
goto ret;
#endif
- }
+ }
i = DBL_DIG - nd;
if (e <= Ten_pmax + i) {
/* A fancier test would sometimes let us do
@@ -1550,16 +1550,16 @@ strtod
tens[e]);
#endif
goto ret;
- }
}
+ }
#ifndef Inaccurate_Divide
else if (e >= -Ten_pmax) {
/* value(rv) = */ rounded_quotient(value(rv),
tens[-e]);
goto ret;
- }
-#endif
}
+#endif
+ }
e1 += nd - k;
/* Get starting approximation = rv * 10**e1 */
@@ -1575,7 +1575,7 @@ strtod
if (bd0)
goto retfree;
goto ret;
- }
+ }
if ((e1 = (unsigned int)e1 >> 4) != 0) {
for(j = 0; e1 > 1; j++,
e1 = (unsigned int)e1 >> 1)
@@ -1595,10 +1595,9 @@ strtod
}
else
word0(rv) += P*Exp_msk1;
- }
-
}
}
+ }
else if (e1 < 0) {
e1 = -e1;
if ((i = e1 & 15) != 0)
@@ -1624,15 +1623,15 @@ strtod
if (bd0)
goto retfree;
goto ret;
- }
+ }
word0(rv) = Tiny0;
word1(rv) = Tiny1;
/* The refinement below will clean
* this approximation up.
*/
- }
}
}
+ }
/* Now the hard part -- adjusting rv to the correct value.*/
@@ -1649,11 +1648,11 @@ strtod
if (e >= 0) {
bb2 = bb5 = 0;
bd2 = bd5 = e;
- }
+ }
else {
bb2 = bb5 = -e;
bd2 = bd5 = 0;
- }
+ }
if (bbe >= 0)
bb2 += bbe;
else
@@ -1681,13 +1680,13 @@ strtod
bb2 -= i;
bd2 -= i;
bs2 -= i;
- }
+ }
if (bb5 > 0) {
bs = pow5mult(bs, bb5);
bb1 = mult(bs, bb);
Bfree(bb);
bb = bb1;
- }
+ }
if (bb2 > 0)
bb = lshift(bb, bb2);
if (bd5 > 0)
@@ -1710,7 +1709,7 @@ strtod
if (cmp(delta, bs) > 0)
goto drop_down;
break;
- }
+ }
if (i == 0) {
/* exactly half-way between */
if (dsign) {
@@ -1725,8 +1724,8 @@ strtod
;
word1(rv) = 0;
break;
- }
}
+ }
else if (!(word0(rv) & Bndry_mask) && !word1(rv)) {
drop_down:
/* boundary case -- decrement exponent */
@@ -1749,7 +1748,7 @@ strtod
#else
break;
#endif
- }
+ }
#ifndef ROUND_BIASED
if (!(word1(rv) & LSB))
break;
@@ -1763,10 +1762,10 @@ strtod
if (!value(rv))
goto undfl;
#endif
- }
+ }
#endif
break;
- }
+ }
if ((aadj = ratio(delta, bs)) <= 2.) {
if (dsign)
aadj = aadj1 = 1.;
@@ -1777,7 +1776,7 @@ strtod
#endif
aadj = 1.;
aadj1 = -1.;
- }
+ }
else {
/* special case -- power of FLT_RADIX to be */
/* rounded down... */
@@ -1788,7 +1787,7 @@ strtod
aadj *= 0.5;
aadj1 = -aadj;
}
- }
+ }
else {
aadj *= 0.5;
aadj1 = dsign ? aadj : -aadj;
@@ -1800,12 +1799,12 @@ strtod
case 0: /* towards 0 */
case 3: /* towards -infinity */
aadj1 += 0.5;
- }
+ }
#else
if (FLT_ROUNDS == 0)
aadj1 += 0.5;
#endif
- }
+ }
y = word0(rv) & Exp_mask;
/* Check for overflow */
@@ -1822,10 +1821,10 @@ strtod
word0(rv) = Big0;
word1(rv) = Big1;
goto cont;
- }
+ }
else
word0(rv) += P*Exp_msk1;
- }
+ }
else {
#ifdef Sudden_Underflow
if ((word0(rv) & Exp_mask) <= P*Exp_msk1) {
@@ -1838,21 +1837,21 @@ strtod
#else
if ((word0(rv) & Exp_mask) <= P*Exp_msk1)
#endif
- {
+ {
if (word0(rv0) == Tiny0
&& word1(rv0) == Tiny1)
goto undfl;
word0(rv) = Tiny0;
word1(rv) = Tiny1;
goto cont;
- }
+ }
else
word0(rv) -= P*Exp_msk1;
}
else {
adj = aadj1 * ulp(value(rv));
value(rv) += adj;
- }
+ }
#else
/* Compute adj so that the IEEE rounding rules will
* correctly round rv + adj in some half-way cases.
@@ -1865,11 +1864,11 @@ strtod
aadj1 = (double)(int)(aadj + 0.5);
if (!dsign)
aadj1 = -aadj1;
- }
+ }
adj = aadj1 * ulp(value(rv));
value(rv) += adj;
#endif
- }
+ }
z = word0(rv) & Exp_mask;
if (y == z) {
/* Can we stop now? */
@@ -1879,16 +1878,16 @@ strtod
if (dsign || word1(rv) || word0(rv) & Bndry_mask) {
if (aadj < .4999999 || aadj > .5000001)
break;
- }
+ }
else if (aadj < .4999999/FLT_RADIX)
break;
- }
+ }
cont:
Bfree(bb);
Bfree(bd);
Bfree(bs);
Bfree(delta);
- }
+ }
retfree:
Bfree(bb);
Bfree(bd);
@@ -1900,7 +1899,7 @@ strtod
/* LINTED interface specification */
*se = (char *)s;
return sign ? -value(rv) : value(rv);
- }
+}
static int
quorem
@@ -1962,15 +1961,15 @@ quorem
Sign_Extend(borrow, y);
*bx++ = y & 0xffff;
#endif
- }
- while(sx <= sxe);
+ }
+ while(sx <= sxe);
if (!*bxe) {
bx = b->x;
while(--bxe > bx && !*bxe)
--n;
b->wds = n;
- }
}
+ }
if (cmp(b, S) >= 0) {
q++;
borrow = 0;
@@ -1998,18 +1997,18 @@ quorem
Sign_Extend(borrow, y);
*bx++ = y & 0xffff;
#endif
- }
- while(sx <= sxe);
+ }
+ while(sx <= sxe);
bx = b->x;
bxe = bx + n;
if (!*bxe) {
while(--bxe > bx && !*bxe)
--n;
b->wds = n;
- }
}
- return q;
}
+ return q;
+}
/* freedtoa(s) must be used to free values s returned by dtoa
* when MULTIPLE_THREADS is #defined. It should be used in all cases,
@@ -2129,7 +2128,7 @@ __dtoa
/* set sign for everything, including 0's and NaNs */
*sign = 1;
word0(d) &= ~Sign_bit; /* clear sign bit */
- }
+ }
else
*sign = 0;
@@ -2139,7 +2138,7 @@ __dtoa
#else
if (word0(d) == 0x8000)
#endif
- {
+ {
/* Infinity or NaN */
*decpt = 9999;
s =
@@ -2159,7 +2158,7 @@ __dtoa
#endif
s0 + 3;
return s0;
- }
+ }
#endif
#ifdef IBM
value(d) += 0; /* normalize */
@@ -2169,12 +2168,12 @@ __dtoa
result = Balloc(2);
if (result == BIGINT_INVALID)
return NULL;
- s0 = (char *)(void *)result;
- strcpy(s0, "0");
- if (rve)
+ s0 = (char *)(void *)result;
+ strcpy(s0, "0");
+ if (rve)
*rve = s0 + 1;
- return s0;
- }
+ return s0;
+ }
b = d2b(value(d), &be, &bbits);
#ifdef Sudden_Underflow
@@ -2219,7 +2218,7 @@ __dtoa
#endif
#ifndef Sudden_Underflow
denorm = 0;
- }
+ }
else {
/* d is denormalized */
@@ -2230,7 +2229,7 @@ __dtoa
word0(d2) -= 31*Exp_msk1; /* adjust exponent */
i -= (Bias + (P-1) - 1) + 1;
denorm = 1;
- }
+ }
#endif
ds = (value(d2)-1.5)*0.289529654602168 + 0.1760912590558 +
i*0.301029995663981;
@@ -2242,33 +2241,33 @@ __dtoa
if (value(d) < tens[k])
k--;
k_check = 0;
- }
+ }
j = bbits - i - 1;
if (j >= 0) {
b2 = 0;
s2 = j;
- }
+ }
else {
b2 = -j;
s2 = 0;
- }
+ }
if (k >= 0) {
b5 = 0;
s5 = k;
s2 += k;
- }
+ }
else {
b2 -= k;
b5 = -k;
s5 = 0;
- }
+ }
if (mode < 0 || mode > 9)
mode = 0;
try_quick = 1;
if (mode > 5) {
mode -= 4;
try_quick = 0;
- }
+ }
leftright = 1;
switch(mode) {
case 0:
@@ -2294,7 +2293,7 @@ __dtoa
ilim1 = i - 1;
if (i <= 0)
i = 1;
- }
+ }
j = sizeof(ULong);
for(result_k = 0; (int)(sizeof(Bigint) - sizeof(ULong)) + j <= i;
j <<= 1) result_k++;
@@ -2334,7 +2333,7 @@ __dtoa
ds *= bigtens[i];
}
value(d) /= ds;
- }
+ }
else if ((jj1 = -k) != 0) {
value(d) *= tens[jj1 & 0xf];
for(j = (unsigned int)jj1 >> 4; j;
@@ -2342,8 +2341,8 @@ __dtoa
if (j & 1) {
ieps++;
value(d) *= bigtens[i];
- }
- }
+ }
+ }
if (k_check && value(d) < 1. && ilim > 0) {
if (ilim1 <= 0)
goto fast_failed;
@@ -2351,7 +2350,7 @@ __dtoa
k--;
value(d) *= 10.;
ieps++;
- }
+ }
value(eps) = ieps*value(d) + 7.;
word0(eps) -= (P-1)*Exp_msk1;
if (ilim == 0) {
@@ -2362,7 +2361,7 @@ __dtoa
if (value(d) < -value(eps))
goto no_digits;
goto fast_failed;
- }
+ }
#ifndef No_leftright
if (leftright) {
/* Use Steele & White method of only
@@ -2382,7 +2381,7 @@ __dtoa
value(eps) *= 10.;
value(d) *= 10.;
}
- }
+ }
else {
#endif
/* Generate ilim digits, then fix them up. */
@@ -2400,17 +2399,17 @@ __dtoa
goto ret1;
}
break;
- }
}
-#ifndef No_leftright
}
+#ifndef No_leftright
+ }
#endif
fast_failed:
s = s0;
value(d) = value(d2);
k = k0;
ilim = ilim0;
- }
+ }
/* Do we have a "small" integer? */
@@ -2422,7 +2421,7 @@ __dtoa
if (ilim < 0 || value(d) <= 5*ds)
goto no_digits;
goto one_digit;
- }
+ }
for(i = 1;; i++) {
L = value(d) / ds;
value(d) -= L*ds;
@@ -2431,7 +2430,7 @@ __dtoa
if (value(d) < 0) {
L--;
value(d) += ds;
- }
+ }
#endif
*s++ = '0' + (int)L;
if (i == ilim) {
@@ -2443,16 +2442,16 @@ __dtoa
k++;
*s = '0';
break;
- }
+ }
++*s++;
- }
- break;
}
+ break;
+ }
if (!(value(d) *= 10.))
break;
}
goto ret1;
- }
+ }
m2 = b2;
m5 = b5;
@@ -2468,7 +2467,7 @@ __dtoa
#else
1 + P - bbits;
#endif
- }
+ }
else {
j = ilim - 1;
if (m5 >= j)
@@ -2477,22 +2476,22 @@ __dtoa
s5 += j -= m5;
b5 += j;
m5 = 0;
- }
+ }
if ((i = ilim) < 0) {
m2 -= i;
i = 0;
- }
}
+ }
b2 += i;
s2 += i;
mhi = i2b(1);
- }
+ }
if (m2 > 0 && s2 > 0) {
i = m2 < s2 ? m2 : s2;
b2 -= i;
m2 -= i;
s2 -= i;
- }
+ }
if (b5 > 0) {
if (leftright) {
if (m5 > 0) {
@@ -2500,13 +2499,13 @@ __dtoa
b1 = mult(mhi, b);
Bfree(b);
b = b1;
- }
+ }
if ((j = b5 - m5) != 0)
b = pow5mult(b, j);
}
else
b = pow5mult(b, b5);
- }
+ }
S = i2b(1);
if (s5 > 0)
S = pow5mult(S, s5);
@@ -2526,7 +2525,7 @@ __dtoa
}
else
spec_case = 0;
- }
+ }
/* Arrange for convenient computation of quotients:
* shift left if necessary so divisor has 4 leading 0 bits.
@@ -2552,13 +2551,13 @@ __dtoa
b2 += i;
m2 += i;
s2 += i;
- }
+ }
else if (i < 4) {
i += 28;
b2 += i;
m2 += i;
s2 += i;
- }
+ }
if (b2 > 0)
b = lshift(b, b2);
if (s2 > 0)
@@ -2571,19 +2570,19 @@ __dtoa
mhi = multadd(mhi, 10, 0);
ilim = ilim1;
}
- }
+ }
if (ilim <= 0 && mode > 2) {
if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) {
/* no digits, fcvt style */
no_digits:
k = -1 - ndigits;
goto ret;
- }
+ }
one_digit:
*s++ = '1';
k++;
goto ret;
- }
+ }
if (leftright) {
if (m2 > 0)
mhi = lshift(mhi, m2);
@@ -2597,7 +2596,7 @@ __dtoa
mhi = Balloc(mhi->k);
Bcopy(mhi, mlo);
mhi = lshift(mhi, Log2P);
- }
+ }
for(i = 1;;i++) {
dig = quorem(b,S) + '0';
@@ -2616,7 +2615,7 @@ __dtoa
dig++;
*s++ = dig;
goto ret;
- }
+ }
#endif
if (j < 0 || (j == 0 && !mode
#ifndef ROUND_BIASED
@@ -2632,7 +2631,7 @@ __dtoa
}
*s++ = dig;
goto ret;
- }
+ }
if (jj1 > 0) {
if (dig == '9') { /* possible if i == 1 */
round_9_up:
@@ -2641,7 +2640,7 @@ __dtoa
}
*s++ = dig + 1;
goto ret;
- }
+ }
*s++ = dig;
if (i == ilim)
break;
@@ -2651,16 +2650,16 @@ __dtoa
else {
mlo = multadd(mlo, 10, 0);
mhi = multadd(mhi, 10, 0);
- }
}
}
+ }
else
for(i = 1;; i++) {
*s++ = dig = quorem(b,S) + '0';
if (i >= ilim)
break;
b = multadd(b, 10, 0);
- }
+ }
/* Round off last digit */
@@ -2675,18 +2674,18 @@ __dtoa
goto ret;
}
++*s++;
- }
+ }
else {
while(*--s == '0');
s++;
- }
+ }
ret:
Bfree(S);
if (mhi) {
if (mlo && mlo != mhi)
Bfree(mlo);
Bfree(mhi);
- }
+ }
ret1:
Bfree(b);
if (s == s0) { /* don't return empty string */
@@ -2698,7 +2697,7 @@ __dtoa
if (rve)
*rve = s;
return s0;
- }
+}
#ifdef __cplusplus
}
#endif
diff --git a/libc/stdlib/strtoimax.c b/libc/stdlib/strtoimax.c
index a742eb9..0b4323d 100644
--- a/libc/stdlib/strtoimax.c
+++ b/libc/stdlib/strtoimax.c
@@ -103,7 +103,7 @@ strtoimax(const char *nptr, char **endptr, int base)
cutoff = INTMAX_MAX / x; \
}; \
break
-
+
switch (base) {
case 4:
if (neg) {
@@ -118,13 +118,13 @@ strtoimax(const char *nptr, char **endptr, int base)
CASE_BASE(8);
CASE_BASE(10);
CASE_BASE(16);
- default:
+ default:
cutoff = neg ? INTMAX_MIN : INTMAX_MAX;
cutlim = cutoff % base;
cutoff /= base;
}
#undef CASE_BASE
-
+
if (neg) {
if (cutlim > 0) {
cutlim -= base;
diff --git a/libc/stdlib/strtoumax.c b/libc/stdlib/strtoumax.c
index ec45377..e1ff623 100644
--- a/libc/stdlib/strtoumax.c
+++ b/libc/stdlib/strtoumax.c
@@ -57,7 +57,7 @@ strtoumax(const char *nptr, char **endptr, int base)
if (c == '-') {
neg = 1;
c = *s++;
- } else {
+ } else {
neg = 0;
if (c == '+')
c = *s++;
@@ -76,7 +76,7 @@ strtoumax(const char *nptr, char **endptr, int base)
case x: cutoff = UINTMAX_MAX / x; \
cutlim = UINTMAX_MAX % x; \
break
-
+
switch (base) {
CASE_BASE(8);
CASE_BASE(10);
@@ -85,7 +85,7 @@ strtoumax(const char *nptr, char **endptr, int base)
cutoff = UINTMAX_MAX / base;
cutlim = UINTMAX_MAX % base;
}
-
+
for (acc = 0, any = 0;; c = (unsigned char) *s++) {
if (isdigit(c))
c -= '0';
diff --git a/libc/stdlib/wchar.c b/libc/stdlib/wchar.c
index 7722b34..02947d4 100644
--- a/libc/stdlib/wchar.c
+++ b/libc/stdlib/wchar.c
@@ -397,7 +397,7 @@ size_t wcsxfrm(wchar_t *ws1, const wchar_t *ws2, size_t n)
int wctob(wint_t c)
{
- return c;
+ return c;
}
wctype_t wctype(const char *property)