summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/arch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 13:54:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 13:54:38 +0000
commit8c1ab65c0f548d20b7f177bdb736daaf603340e1 (patch)
treedf55b7e75bf43f2bf500845b105afe3ac3a5157e /libc-top-half/musl/arch
parentInitial commit. (diff)
downloadwasi-libc-upstream/0.0_git20221206.8b7148f.tar.xz
wasi-libc-upstream/0.0_git20221206.8b7148f.zip
Adding upstream version 0.0~git20221206.8b7148f.upstream/0.0_git20221206.8b7148f
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/musl/arch')
-rw-r--r--libc-top-half/musl/arch/aarch64/atomic_arch.h82
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/alltypes.h.in24
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/fcntl.h38
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/fenv.h19
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/hwcap.h52
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/mman.h2
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/reg.h2
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/signal.h153
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/stat.h18
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/syscall.h.in302
-rw-r--r--libc-top-half/musl/arch/aarch64/bits/user.h16
-rw-r--r--libc-top-half/musl/arch/aarch64/crt_arch.h15
-rw-r--r--libc-top-half/musl/arch/aarch64/fp_arch.h25
-rw-r--r--libc-top-half/musl/arch/aarch64/kstat.h21
-rw-r--r--libc-top-half/musl/arch/aarch64/pthread_arch.h11
-rw-r--r--libc-top-half/musl/arch/aarch64/reloc.h24
-rw-r--r--libc-top-half/musl/arch/aarch64/syscall_arch.h78
-rw-r--r--libc-top-half/musl/arch/arm/arch.mak1
-rw-r--r--libc-top-half/musl/arch/arm/atomic_arch.h107
-rw-r--r--libc-top-half/musl/arch/arm/bits/alltypes.h.in21
-rw-r--r--libc-top-half/musl/arch/arm/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/arm/bits/fenv.h23
-rw-r--r--libc-top-half/musl/arch/arm/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/arm/bits/hwcap.h53
-rw-r--r--libc-top-half/musl/arch/arm/bits/ioctl_fix.h2
-rw-r--r--libc-top-half/musl/arch/arm/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/arm/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/arm/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/arm/bits/ptrace.h25
-rw-r--r--libc-top-half/musl/arch/arm/bits/reg.h3
-rw-r--r--libc-top-half/musl/arch/arm/bits/sem.h18
-rw-r--r--libc-top-half/musl/arch/arm/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/arm/bits/shm.h31
-rw-r--r--libc-top-half/musl/arch/arm/bits/signal.h86
-rw-r--r--libc-top-half/musl/arch/arm/bits/stat.h25
-rw-r--r--libc-top-half/musl/arch/arm/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/arm/bits/syscall.h.in409
-rw-r--r--libc-top-half/musl/arch/arm/bits/user.h36
-rw-r--r--libc-top-half/musl/arch/arm/crt_arch.h18
-rw-r--r--libc-top-half/musl/arch/arm/kstat.h21
-rw-r--r--libc-top-half/musl/arch/arm/pthread_arch.h32
-rw-r--r--libc-top-half/musl/arch/arm/reloc.h32
-rw-r--r--libc-top-half/musl/arch/arm/syscall_arch.h103
-rw-r--r--libc-top-half/musl/arch/generic/bits/dirent.h11
-rw-r--r--libc-top-half/musl/arch/generic/bits/errno.h134
-rw-r--r--libc-top-half/musl/arch/generic/bits/fcntl.h46
-rw-r--r--libc-top-half/musl/arch/generic/bits/fenv.h10
-rw-r--r--libc-top-half/musl/arch/generic/bits/hwcap.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/io.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/ioctl.h115
-rw-r--r--libc-top-half/musl/arch/generic/bits/ioctl_fix.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/ipc.h11
-rw-r--r--libc-top-half/musl/arch/generic/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/generic/bits/kd.h1
-rw-r--r--libc-top-half/musl/arch/generic/bits/limits.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/link.h1
-rw-r--r--libc-top-half/musl/arch/generic/bits/mman.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/msg.h12
-rw-r--r--libc-top-half/musl/arch/generic/bits/poll.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/ptrace.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/resource.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/sem.h14
-rw-r--r--libc-top-half/musl/arch/generic/bits/shm.h24
-rw-r--r--libc-top-half/musl/arch/generic/bits/socket.h0
-rw-r--r--libc-top-half/musl/arch/generic/bits/soundcard.h1
-rw-r--r--libc-top-half/musl/arch/generic/bits/statfs.h7
-rw-r--r--libc-top-half/musl/arch/generic/bits/termios.h166
-rw-r--r--libc-top-half/musl/arch/generic/bits/vt.h1
-rw-r--r--libc-top-half/musl/arch/generic/fp_arch.h0
-rw-r--r--libc-top-half/musl/arch/i386/arch.mak1
-rw-r--r--libc-top-half/musl/arch/i386/atomic_arch.h108
-rw-r--r--libc-top-half/musl/arch/i386/bits/alltypes.h.in31
-rw-r--r--libc-top-half/musl/arch/i386/bits/fenv.h33
-rw-r--r--libc-top-half/musl/arch/i386/bits/float.h20
-rw-r--r--libc-top-half/musl/arch/i386/bits/io.h77
-rw-r--r--libc-top-half/musl/arch/i386/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/i386/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/i386/bits/mman.h1
-rw-r--r--libc-top-half/musl/arch/i386/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/i386/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/i386/bits/ptrace.h11
-rw-r--r--libc-top-half/musl/arch/i386/bits/reg.h19
-rw-r--r--libc-top-half/musl/arch/i386/bits/sem.h13
-rw-r--r--libc-top-half/musl/arch/i386/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/i386/bits/shm.h31
-rw-r--r--libc-top-half/musl/arch/i386/bits/signal.h142
-rw-r--r--libc-top-half/musl/arch/i386/bits/stat.h25
-rw-r--r--libc-top-half/musl/arch/i386/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/i386/bits/syscall.h.in439
-rw-r--r--libc-top-half/musl/arch/i386/bits/user.h44
-rw-r--r--libc-top-half/musl/arch/i386/crt_arch.h16
-rw-r--r--libc-top-half/musl/arch/i386/kstat.h21
-rw-r--r--libc-top-half/musl/arch/i386/pthread_arch.h8
-rw-r--r--libc-top-half/musl/arch/i386/reloc.h23
-rw-r--r--libc-top-half/musl/arch/i386/syscall_arch.h89
-rw-r--r--libc-top-half/musl/arch/m68k/arch.mak1
-rw-r--r--libc-top-half/musl/arch/m68k/atomic_arch.h8
-rw-r--r--libc-top-half/musl/arch/m68k/bits/alltypes.h.in25
-rw-r--r--libc-top-half/musl/arch/m68k/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/m68k/bits/fenv.h29
-rw-r--r--libc-top-half/musl/arch/m68k/bits/float.h39
-rw-r--r--libc-top-half/musl/arch/m68k/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/m68k/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/m68k/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/m68k/bits/ptrace.h2
-rw-r--r--libc-top-half/musl/arch/m68k/bits/reg.h45
-rw-r--r--libc-top-half/musl/arch/m68k/bits/sem.h13
-rw-r--r--libc-top-half/musl/arch/m68k/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/m68k/bits/shm.h31
-rw-r--r--libc-top-half/musl/arch/m68k/bits/signal.h140
-rw-r--r--libc-top-half/musl/arch/m68k/bits/stat.h25
-rw-r--r--libc-top-half/musl/arch/m68k/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/m68k/bits/syscall.h.in418
-rw-r--r--libc-top-half/musl/arch/m68k/bits/user.h38
-rw-r--r--libc-top-half/musl/arch/m68k/crt_arch.h14
-rw-r--r--libc-top-half/musl/arch/m68k/kstat.h21
-rw-r--r--libc-top-half/musl/arch/m68k/pthread_arch.h12
-rw-r--r--libc-top-half/musl/arch/m68k/reloc.h30
-rw-r--r--libc-top-half/musl/arch/m68k/syscall_arch.h90
-rw-r--r--libc-top-half/musl/arch/microblaze/arch.mak1
-rw-r--r--libc-top-half/musl/arch/microblaze/atomic_arch.h53
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/alltypes.h.in21
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/reg.h3
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/sem.h18
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/shm.h31
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/signal.h88
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/stat.h25
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/syscall.h.in440
-rw-r--r--libc-top-half/musl/arch/microblaze/bits/user.h25
-rw-r--r--libc-top-half/musl/arch/microblaze/crt_arch.h17
-rw-r--r--libc-top-half/musl/arch/microblaze/kstat.h21
-rw-r--r--libc-top-half/musl/arch/microblaze/pthread_arch.h8
-rw-r--r--libc-top-half/musl/arch/microblaze/reloc.h27
-rw-r--r--libc-top-half/musl/arch/microblaze/syscall_arch.h99
-rw-r--r--libc-top-half/musl/arch/mips/arch.mak1
-rw-r--r--libc-top-half/musl/arch/mips/atomic_arch.h58
-rw-r--r--libc-top-half/musl/arch/mips/bits/alltypes.h.in21
-rw-r--r--libc-top-half/musl/arch/mips/bits/errno.h134
-rw-r--r--libc-top-half/musl/arch/mips/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/mips/bits/fenv.h25
-rw-r--r--libc-top-half/musl/arch/mips/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/mips/bits/hwcap.h14
-rw-r--r--libc-top-half/musl/arch/mips/bits/ioctl.h114
-rw-r--r--libc-top-half/musl/arch/mips/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/mips/bits/mman.h25
-rw-r--r--libc-top-half/musl/arch/mips/bits/msg.h27
-rw-r--r--libc-top-half/musl/arch/mips/bits/poll.h2
-rw-r--r--libc-top-half/musl/arch/mips/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/mips/bits/ptrace.h9
-rw-r--r--libc-top-half/musl/arch/mips/bits/reg.h47
-rw-r--r--libc-top-half/musl/arch/mips/bits/resource.h5
-rw-r--r--libc-top-half/musl/arch/mips/bits/sem.h16
-rw-r--r--libc-top-half/musl/arch/mips/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/mips/bits/shm.h29
-rw-r--r--libc-top-half/musl/arch/mips/bits/signal.h124
-rw-r--r--libc-top-half/musl/arch/mips/bits/socket.h35
-rw-r--r--libc-top-half/musl/arch/mips/bits/stat.h26
-rw-r--r--libc-top-half/musl/arch/mips/bits/statfs.h8
-rw-r--r--libc-top-half/musl/arch/mips/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/mips/bits/syscall.h.in421
-rw-r--r--libc-top-half/musl/arch/mips/bits/termios.h169
-rw-r--r--libc-top-half/musl/arch/mips/bits/user.h13
-rw-r--r--libc-top-half/musl/arch/mips/crt_arch.h29
-rw-r--r--libc-top-half/musl/arch/mips/ksigaction.h13
-rw-r--r--libc-top-half/musl/arch/mips/kstat.h22
-rw-r--r--libc-top-half/musl/arch/mips/pthread_arch.h18
-rw-r--r--libc-top-half/musl/arch/mips/reloc.h50
-rw-r--r--libc-top-half/musl/arch/mips/syscall_arch.h153
-rw-r--r--libc-top-half/musl/arch/mips64/atomic_arch.h56
-rw-r--r--libc-top-half/musl/arch/mips64/bits/alltypes.h.in22
-rw-r--r--libc-top-half/musl/arch/mips64/bits/errno.h134
-rw-r--r--libc-top-half/musl/arch/mips64/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/mips64/bits/fenv.h25
-rw-r--r--libc-top-half/musl/arch/mips64/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/mips64/bits/hwcap.h3
-rw-r--r--libc-top-half/musl/arch/mips64/bits/ioctl.h114
-rw-r--r--libc-top-half/musl/arch/mips64/bits/ipc.h12
-rw-r--r--libc-top-half/musl/arch/mips64/bits/mman.h25
-rw-r--r--libc-top-half/musl/arch/mips64/bits/poll.h2
-rw-r--r--libc-top-half/musl/arch/mips64/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/mips64/bits/ptrace.h9
-rw-r--r--libc-top-half/musl/arch/mips64/bits/reg.h47
-rw-r--r--libc-top-half/musl/arch/mips64/bits/resource.h5
-rw-r--r--libc-top-half/musl/arch/mips64/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/mips64/bits/signal.h143
-rw-r--r--libc-top-half/musl/arch/mips64/bits/socket.h35
-rw-r--r--libc-top-half/musl/arch/mips64/bits/stat.h20
-rw-r--r--libc-top-half/musl/arch/mips64/bits/statfs.h8
-rw-r--r--libc-top-half/musl/arch/mips64/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/mips64/bits/syscall.h.in351
-rw-r--r--libc-top-half/musl/arch/mips64/bits/termios.h169
-rw-r--r--libc-top-half/musl/arch/mips64/bits/user.h15
-rw-r--r--libc-top-half/musl/arch/mips64/crt_arch.h33
-rw-r--r--libc-top-half/musl/arch/mips64/ksigaction.h10
-rw-r--r--libc-top-half/musl/arch/mips64/kstat.h21
-rw-r--r--libc-top-half/musl/arch/mips64/pthread_arch.h19
-rw-r--r--libc-top-half/musl/arch/mips64/reloc.h60
-rw-r--r--libc-top-half/musl/arch/mips64/syscall_arch.h128
-rw-r--r--libc-top-half/musl/arch/mipsn32/arch.mak1
-rw-r--r--libc-top-half/musl/arch/mipsn32/atomic_arch.h52
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/alltypes.h.in21
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/errno.h134
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/fenv.h25
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/hwcap.h3
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/ioctl.h114
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/mman.h25
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/msg.h27
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/poll.h2
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/ptrace.h9
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/reg.h47
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/resource.h5
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/sem.h16
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/shm.h29
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/signal.h143
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/socket.h35
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/stat.h23
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/statfs.h8
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/syscall.h.in375
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/termios.h169
-rw-r--r--libc-top-half/musl/arch/mipsn32/bits/user.h15
-rw-r--r--libc-top-half/musl/arch/mipsn32/crt_arch.h32
-rw-r--r--libc-top-half/musl/arch/mipsn32/ksigaction.h10
-rw-r--r--libc-top-half/musl/arch/mipsn32/kstat.h22
-rw-r--r--libc-top-half/musl/arch/mipsn32/pthread_arch.h19
-rw-r--r--libc-top-half/musl/arch/mipsn32/reloc.h50
-rw-r--r--libc-top-half/musl/arch/mipsn32/syscall_arch.h130
-rw-r--r--libc-top-half/musl/arch/or1k/arch.mak1
-rw-r--r--libc-top-half/musl/arch/or1k/atomic_arch.h14
-rw-r--r--libc-top-half/musl/arch/or1k/bits/alltypes.h.in16
-rw-r--r--libc-top-half/musl/arch/or1k/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/or1k/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/or1k/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/or1k/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/or1k/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/or1k/bits/reg.h3
-rw-r--r--libc-top-half/musl/arch/or1k/bits/sem.h13
-rw-r--r--libc-top-half/musl/arch/or1k/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/or1k/bits/shm.h31
-rw-r--r--libc-top-half/musl/arch/or1k/bits/signal.h85
-rw-r--r--libc-top-half/musl/arch/or1k/bits/stat.h25
-rw-r--r--libc-top-half/musl/arch/or1k/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/or1k/bits/syscall.h.in324
-rw-r--r--libc-top-half/musl/arch/or1k/bits/user.h0
-rw-r--r--libc-top-half/musl/arch/or1k/crt_arch.h18
-rw-r--r--libc-top-half/musl/arch/or1k/kstat.h21
-rw-r--r--libc-top-half/musl/arch/or1k/pthread_arch.h16
-rw-r--r--libc-top-half/musl/arch/or1k/reloc.h24
-rw-r--r--libc-top-half/musl/arch/or1k/syscall_arch.h115
-rw-r--r--libc-top-half/musl/arch/powerpc/arch.mak1
-rw-r--r--libc-top-half/musl/arch/powerpc/atomic_arch.h38
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/alltypes.h.in20
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/errno.h134
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/fenv.h36
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/hwcap.h43
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/ioctl.h120
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/ipc.h12
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/mman.h13
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/ptrace.h25
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/reg.h3
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/sem.h12
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/shm.h30
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/signal.h119
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/socket.h25
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/stat.h24
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/syscall.h.in428
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/termios.h171
-rw-r--r--libc-top-half/musl/arch/powerpc/bits/user.h23
-rw-r--r--libc-top-half/musl/arch/powerpc/crt_arch.h20
-rw-r--r--libc-top-half/musl/arch/powerpc/kstat.h20
-rw-r--r--libc-top-half/musl/arch/powerpc/pthread_arch.h16
-rw-r--r--libc-top-half/musl/arch/powerpc/reloc.h31
-rw-r--r--libc-top-half/musl/arch/powerpc/syscall_arch.h94
-rw-r--r--libc-top-half/musl/arch/powerpc64/atomic_arch.h62
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/alltypes.h.in20
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/errno.h134
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/fenv.h31
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/hwcap.h43
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/ioctl.h120
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/ipc.h12
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/mman.h13
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/ptrace.h25
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/reg.h3
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/shm.h23
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/signal.h110
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/socket.h27
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/stat.h16
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/syscall.h.in400
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/termios.h171
-rw-r--r--libc-top-half/musl/arch/powerpc64/bits/user.h23
-rw-r--r--libc-top-half/musl/arch/powerpc64/crt_arch.h19
-rw-r--r--libc-top-half/musl/arch/powerpc64/kstat.h19
-rw-r--r--libc-top-half/musl/arch/powerpc64/pthread_arch.h16
-rw-r--r--libc-top-half/musl/arch/powerpc64/reloc.h31
-rw-r--r--libc-top-half/musl/arch/powerpc64/syscall_arch.h90
-rw-r--r--libc-top-half/musl/arch/riscv64/atomic_arch.h38
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/alltypes.h.in18
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/fenv.h17
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/reg.h2
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/signal.h118
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/stat.h18
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/syscall.h.in304
-rw-r--r--libc-top-half/musl/arch/riscv64/bits/user.h6
-rw-r--r--libc-top-half/musl/arch/riscv64/crt_arch.h19
-rw-r--r--libc-top-half/musl/arch/riscv64/kstat.h21
-rw-r--r--libc-top-half/musl/arch/riscv64/pthread_arch.h13
-rw-r--r--libc-top-half/musl/arch/riscv64/reloc.h22
-rw-r--r--libc-top-half/musl/arch/riscv64/syscall_arch.h78
-rw-r--r--libc-top-half/musl/arch/s390x/atomic_arch.h30
-rw-r--r--libc-top-half/musl/arch/s390x/bits/alltypes.h.in19
-rw-r--r--libc-top-half/musl/arch/s390x/bits/fcntl.h43
-rw-r--r--libc-top-half/musl/arch/s390x/bits/fenv.h17
-rw-r--r--libc-top-half/musl/arch/s390x/bits/float.h20
-rw-r--r--libc-top-half/musl/arch/s390x/bits/hwcap.h15
-rw-r--r--libc-top-half/musl/arch/s390x/bits/ioctl_fix.h2
-rw-r--r--libc-top-half/musl/arch/s390x/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/s390x/bits/link.h1
-rw-r--r--libc-top-half/musl/arch/s390x/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/s390x/bits/ptrace.h12
-rw-r--r--libc-top-half/musl/arch/s390x/bits/reg.h2
-rw-r--r--libc-top-half/musl/arch/s390x/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/s390x/bits/signal.h121
-rw-r--r--libc-top-half/musl/arch/s390x/bits/stat.h16
-rw-r--r--libc-top-half/musl/arch/s390x/bits/statfs.h7
-rw-r--r--libc-top-half/musl/arch/s390x/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/s390x/bits/syscall.h.in365
-rw-r--r--libc-top-half/musl/arch/s390x/bits/user.h62
-rw-r--r--libc-top-half/musl/arch/s390x/crt_arch.h17
-rw-r--r--libc-top-half/musl/arch/s390x/kstat.h19
-rw-r--r--libc-top-half/musl/arch/s390x/pthread_arch.h12
-rw-r--r--libc-top-half/musl/arch/s390x/reloc.h13
-rw-r--r--libc-top-half/musl/arch/s390x/syscall_arch.h74
-rw-r--r--libc-top-half/musl/arch/sh/arch.mak1
-rw-r--r--libc-top-half/musl/arch/sh/atomic_arch.h48
-rw-r--r--libc-top-half/musl/arch/sh/bits/alltypes.h.in25
-rw-r--r--libc-top-half/musl/arch/sh/bits/fenv.h26
-rw-r--r--libc-top-half/musl/arch/sh/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/sh/bits/hwcap.h11
-rw-r--r--libc-top-half/musl/arch/sh/bits/ioctl.h112
-rw-r--r--libc-top-half/musl/arch/sh/bits/ipcstat.h1
-rw-r--r--libc-top-half/musl/arch/sh/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/sh/bits/msg.h18
-rw-r--r--libc-top-half/musl/arch/sh/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/sh/bits/ptrace.h5
-rw-r--r--libc-top-half/musl/arch/sh/bits/sem.h18
-rw-r--r--libc-top-half/musl/arch/sh/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/sh/bits/shm.h31
-rw-r--r--libc-top-half/musl/arch/sh/bits/signal.h96
-rw-r--r--libc-top-half/musl/arch/sh/bits/stat.h25
-rw-r--r--libc-top-half/musl/arch/sh/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/sh/bits/syscall.h.in412
-rw-r--r--libc-top-half/musl/arch/sh/bits/user.h51
-rw-r--r--libc-top-half/musl/arch/sh/crt_arch.h78
-rw-r--r--libc-top-half/musl/arch/sh/ksigaction.h10
-rw-r--r--libc-top-half/musl/arch/sh/kstat.h21
-rw-r--r--libc-top-half/musl/arch/sh/pthread_arch.h16
-rw-r--r--libc-top-half/musl/arch/sh/reloc.h52
-rw-r--r--libc-top-half/musl/arch/sh/syscall_arch.h93
-rw-r--r--libc-top-half/musl/arch/wasm32/atomic_arch.h7
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/alltypes.h.in58
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/dirent.h1
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/fcntl.h1
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/float.h16
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/ioctl.h1
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/reg.h2
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/signal.h40
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/stat.h1
-rw-r--r--libc-top-half/musl/arch/wasm32/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/wasm32/fp_arch.h25
-rw-r--r--libc-top-half/musl/arch/wasm32/pthread_arch.h5
-rw-r--r--libc-top-half/musl/arch/wasm32/reloc.h1
-rw-r--r--libc-top-half/musl/arch/wasm32/syscall_arch.h0
-rw-r--r--libc-top-half/musl/arch/x32/atomic_arch.h121
-rw-r--r--libc-top-half/musl/arch/x32/bits/alltypes.h.in24
-rw-r--r--libc-top-half/musl/arch/x32/bits/fcntl.h40
-rw-r--r--libc-top-half/musl/arch/x32/bits/fenv.h34
-rw-r--r--libc-top-half/musl/arch/x32/bits/float.h20
-rw-r--r--libc-top-half/musl/arch/x32/bits/io.h77
-rw-r--r--libc-top-half/musl/arch/x32/bits/ioctl_fix.h4
-rw-r--r--libc-top-half/musl/arch/x32/bits/ipc.h11
-rw-r--r--libc-top-half/musl/arch/x32/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/x32/bits/mman.h1
-rw-r--r--libc-top-half/musl/arch/x32/bits/msg.h15
-rw-r--r--libc-top-half/musl/arch/x32/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/x32/bits/ptrace.h13
-rw-r--r--libc-top-half/musl/arch/x32/bits/reg.h29
-rw-r--r--libc-top-half/musl/arch/x32/bits/sem.h11
-rw-r--r--libc-top-half/musl/arch/x32/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/x32/bits/shm.h32
-rw-r--r--libc-top-half/musl/arch/x32/bits/signal.h153
-rw-r--r--libc-top-half/musl/arch/x32/bits/socket.h5
-rw-r--r--libc-top-half/musl/arch/x32/bits/stat.h22
-rw-r--r--libc-top-half/musl/arch/x32/bits/statfs.h9
-rw-r--r--libc-top-half/musl/arch/x32/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/x32/bits/syscall.h.in349
-rw-r--r--libc-top-half/musl/arch/x32/bits/user.h41
-rw-r--r--libc-top-half/musl/arch/x32/crt_arch.h12
-rw-r--r--libc-top-half/musl/arch/x32/ksigaction.h11
-rw-r--r--libc-top-half/musl/arch/x32/kstat.h22
-rw-r--r--libc-top-half/musl/arch/x32/pthread_arch.h12
-rw-r--r--libc-top-half/musl/arch/x32/reloc.h31
-rw-r--r--libc-top-half/musl/arch/x32/syscall_arch.h93
-rw-r--r--libc-top-half/musl/arch/x86_64/atomic_arch.h123
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/alltypes.h.in20
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/fenv.h34
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/float.h20
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/io.h77
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/limits.h1
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/mman.h1
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/posix.h2
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/ptrace.h13
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/reg.h29
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/sem.h11
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/setjmp.h1
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/signal.h153
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/stat.h22
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/stdint.h20
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/syscall.h.in358
-rw-r--r--libc-top-half/musl/arch/x86_64/bits/user.h41
-rw-r--r--libc-top-half/musl/arch/x86_64/crt_arch.h12
-rw-r--r--libc-top-half/musl/arch/x86_64/ksigaction.h11
-rw-r--r--libc-top-half/musl/arch/x86_64/kstat.h22
-rw-r--r--libc-top-half/musl/arch/x86_64/pthread_arch.h8
-rw-r--r--libc-top-half/musl/arch/x86_64/reloc.h20
-rw-r--r--libc-top-half/musl/arch/x86_64/syscall_arch.h70
458 files changed, 19735 insertions, 0 deletions
diff --git a/libc-top-half/musl/arch/aarch64/atomic_arch.h b/libc-top-half/musl/arch/aarch64/atomic_arch.h
new file mode 100644
index 0000000..40fefc2
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/atomic_arch.h
@@ -0,0 +1,82 @@
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+ __asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p));
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+ __asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
+ return !r;
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("dmb ish" : : : "memory");
+}
+
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ int old;
+ do {
+ old = a_ll(p);
+ if (old != t) {
+ a_barrier();
+ break;
+ }
+ } while (!a_sc(p, s));
+ return old;
+}
+
+#define a_ll_p a_ll_p
+static inline void *a_ll_p(volatile void *p)
+{
+ void *v;
+ __asm__ __volatile__ ("ldaxr %0, %1" : "=r"(v) : "Q"(*(void *volatile *)p));
+ return v;
+}
+
+#define a_sc_p a_sc_p
+static inline int a_sc_p(volatile int *p, void *v)
+{
+ int r;
+ __asm__ __volatile__ ("stlxr %w0,%2,%1" : "=&r"(r), "=Q"(*(void *volatile *)p) : "r"(v) : "memory");
+ return !r;
+}
+
+#define a_cas_p a_cas_p
+static inline void *a_cas_p(volatile void *p, void *t, void *s)
+{
+ void *old;
+ do {
+ old = a_ll_p(p);
+ if (old != t) {
+ a_barrier();
+ break;
+ }
+ } while (!a_sc_p(p, s));
+ return old;
+}
+
+#define a_ctz_64 a_ctz_64
+static inline int a_ctz_64(uint64_t x)
+{
+ __asm__(
+ " rbit %0, %1\n"
+ " clz %0, %0\n"
+ : "=r"(x) : "r"(x));
+ return x;
+}
+
+#define a_clz_64 a_clz_64
+static inline int a_clz_64(uint64_t x)
+{
+ __asm__("clz %0, %1" : "=r"(x) : "r"(x));
+ return x;
+}
diff --git a/libc-top-half/musl/arch/aarch64/bits/alltypes.h.in b/libc-top-half/musl/arch/aarch64/bits/alltypes.h.in
new file mode 100644
index 0000000..c547ca0
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/alltypes.h.in
@@ -0,0 +1,24 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#if __AARCH64EB__
+#define __BYTE_ORDER 4321
+#else
+#define __BYTE_ORDER 1234
+#endif
+
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+TYPEDEF unsigned wchar_t;
+#endif
+TYPEDEF unsigned wint_t;
+
+TYPEDEF int blksize_t;
+TYPEDEF unsigned int nlink_t;
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/aarch64/bits/fcntl.h b/libc-top-half/musl/arch/aarch64/bits/fcntl.h
new file mode 100644
index 0000000..9278797
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/fcntl.h
@@ -0,0 +1,38 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 040000
+#define O_NOFOLLOW 0100000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 0200000
+#define O_LARGEFILE 0400000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020040000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/aarch64/bits/fenv.h b/libc-top-half/musl/arch/aarch64/bits/fenv.h
new file mode 100644
index 0000000..2f3279a
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/fenv.h
@@ -0,0 +1,19 @@
+#define FE_INVALID 1
+#define FE_DIVBYZERO 2
+#define FE_OVERFLOW 4
+#define FE_UNDERFLOW 8
+#define FE_INEXACT 16
+#define FE_ALL_EXCEPT 31
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 0x800000
+#define FE_UPWARD 0x400000
+#define FE_TOWARDZERO 0xc00000
+
+typedef unsigned int fexcept_t;
+
+typedef struct {
+ unsigned int __fpcr;
+ unsigned int __fpsr;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/aarch64/bits/float.h b/libc-top-half/musl/arch/aarch64/bits/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/libc-top-half/musl/arch/aarch64/bits/hwcap.h b/libc-top-half/musl/arch/aarch64/bits/hwcap.h
new file mode 100644
index 0000000..424cc4d
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/hwcap.h
@@ -0,0 +1,52 @@
+#define HWCAP_FP (1 << 0)
+#define HWCAP_ASIMD (1 << 1)
+#define HWCAP_EVTSTRM (1 << 2)
+#define HWCAP_AES (1 << 3)
+#define HWCAP_PMULL (1 << 4)
+#define HWCAP_SHA1 (1 << 5)
+#define HWCAP_SHA2 (1 << 6)
+#define HWCAP_CRC32 (1 << 7)
+#define HWCAP_ATOMICS (1 << 8)
+#define HWCAP_FPHP (1 << 9)
+#define HWCAP_ASIMDHP (1 << 10)
+#define HWCAP_CPUID (1 << 11)
+#define HWCAP_ASIMDRDM (1 << 12)
+#define HWCAP_JSCVT (1 << 13)
+#define HWCAP_FCMA (1 << 14)
+#define HWCAP_LRCPC (1 << 15)
+#define HWCAP_DCPOP (1 << 16)
+#define HWCAP_SHA3 (1 << 17)
+#define HWCAP_SM3 (1 << 18)
+#define HWCAP_SM4 (1 << 19)
+#define HWCAP_ASIMDDP (1 << 20)
+#define HWCAP_SHA512 (1 << 21)
+#define HWCAP_SVE (1 << 22)
+#define HWCAP_ASIMDFHM (1 << 23)
+#define HWCAP_DIT (1 << 24)
+#define HWCAP_USCAT (1 << 25)
+#define HWCAP_ILRCPC (1 << 26)
+#define HWCAP_FLAGM (1 << 27)
+#define HWCAP_SSBS (1 << 28)
+#define HWCAP_SB (1 << 29)
+#define HWCAP_PACA (1 << 30)
+#define HWCAP_PACG (1UL << 31)
+
+#define HWCAP2_DCPODP (1 << 0)
+#define HWCAP2_SVE2 (1 << 1)
+#define HWCAP2_SVEAES (1 << 2)
+#define HWCAP2_SVEPMULL (1 << 3)
+#define HWCAP2_SVEBITPERM (1 << 4)
+#define HWCAP2_SVESHA3 (1 << 5)
+#define HWCAP2_SVESM4 (1 << 6)
+#define HWCAP2_FLAGM2 (1 << 7)
+#define HWCAP2_FRINT (1 << 8)
+#define HWCAP2_SVEI8MM (1 << 9)
+#define HWCAP2_SVEF32MM (1 << 10)
+#define HWCAP2_SVEF64MM (1 << 11)
+#define HWCAP2_SVEBF16 (1 << 12)
+#define HWCAP2_I8MM (1 << 13)
+#define HWCAP2_BF16 (1 << 14)
+#define HWCAP2_DGH (1 << 15)
+#define HWCAP2_RNG (1 << 16)
+#define HWCAP2_BTI (1 << 17)
+#define HWCAP2_MTE (1 << 18)
diff --git a/libc-top-half/musl/arch/aarch64/bits/mman.h b/libc-top-half/musl/arch/aarch64/bits/mman.h
new file mode 100644
index 0000000..8fad5ce
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/mman.h
@@ -0,0 +1,2 @@
+#define PROT_BTI 0x10
+#define PROT_MTE 0x20
diff --git a/libc-top-half/musl/arch/aarch64/bits/posix.h b/libc-top-half/musl/arch/aarch64/bits/posix.h
new file mode 100644
index 0000000..c37b94c
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64 1
+#define _POSIX_V7_LP64_OFF64 1
diff --git a/libc-top-half/musl/arch/aarch64/bits/reg.h b/libc-top-half/musl/arch/aarch64/bits/reg.h
new file mode 100644
index 0000000..2633f39
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/libc-top-half/musl/arch/aarch64/bits/setjmp.h b/libc-top-half/musl/arch/aarch64/bits/setjmp.h
new file mode 100644
index 0000000..54bc261
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[22];
diff --git a/libc-top-half/musl/arch/aarch64/bits/signal.h b/libc-top-half/musl/arch/aarch64/bits/signal.h
new file mode 100644
index 0000000..5098c73
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/signal.h
@@ -0,0 +1,153 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 6144
+#define SIGSTKSZ 12288
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long greg_t;
+typedef unsigned long gregset_t[34];
+
+typedef struct {
+ __uint128_t vregs[32];
+ unsigned int fpsr;
+ unsigned int fpcr;
+} fpregset_t;
+typedef struct sigcontext {
+ unsigned long fault_address;
+ unsigned long regs[31];
+ unsigned long sp, pc, pstate;
+ long double __reserved[256];
+} mcontext_t;
+
+#define FPSIMD_MAGIC 0x46508001
+#define ESR_MAGIC 0x45535201
+#define EXTRA_MAGIC 0x45585401
+#define SVE_MAGIC 0x53564501
+struct _aarch64_ctx {
+ unsigned int magic;
+ unsigned int size;
+};
+struct fpsimd_context {
+ struct _aarch64_ctx head;
+ unsigned int fpsr;
+ unsigned int fpcr;
+ __uint128_t vregs[32];
+};
+struct esr_context {
+ struct _aarch64_ctx head;
+ unsigned long esr;
+};
+struct extra_context {
+ struct _aarch64_ctx head;
+ unsigned long datap;
+ unsigned int size;
+ unsigned int __reserved[3];
+};
+struct sve_context {
+ struct _aarch64_ctx head;
+ unsigned short vl;
+ unsigned short __reserved[3];
+};
+#define SVE_VQ_BYTES 16
+#define SVE_VQ_MIN 1
+#define SVE_VQ_MAX 512
+#define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
+#define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
+#define SVE_NUM_ZREGS 32
+#define SVE_NUM_PREGS 16
+#define sve_vl_valid(vl) \
+ ((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
+#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
+#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
+#define SVE_SIG_ZREG_SIZE(vq) ((unsigned)(vq) * SVE_VQ_BYTES)
+#define SVE_SIG_PREG_SIZE(vq) ((unsigned)(vq) * (SVE_VQ_BYTES / 8))
+#define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
+#define SVE_SIG_REGS_OFFSET \
+ ((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \
+ / SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
+#define SVE_SIG_ZREG_OFFSET(vq, n) \
+ (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
+#define SVE_SIG_ZREGS_SIZE(vq) \
+ (SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
+#define SVE_SIG_PREGS_OFFSET(vq) \
+ (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
+#define SVE_SIG_PREG_OFFSET(vq, n) \
+ (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
+#define SVE_SIG_PREGS_SIZE(vq) \
+ (SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
+#define SVE_SIG_FFR_OFFSET(vq) \
+ (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
+#define SVE_SIG_REGS_SIZE(vq) \
+ (SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
+#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
+#else
+typedef struct {
+ long double __regs[18+256];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/aarch64/bits/stat.h b/libc-top-half/musl/arch/aarch64/bits/stat.h
new file mode 100644
index 0000000..b7f4221
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/stat.h
@@ -0,0 +1,18 @@
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ unsigned long __pad;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ blkcnt_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/aarch64/bits/stdint.h b/libc-top-half/musl/arch/aarch64/bits/stdint.h
new file mode 100644
index 0000000..1bb147f
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#define SIZE_MAX UINT64_MAX
diff --git a/libc-top-half/musl/arch/aarch64/bits/syscall.h.in b/libc-top-half/musl/arch/aarch64/bits/syscall.h.in
new file mode 100644
index 0000000..5f420e6
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/syscall.h.in
@@ -0,0 +1,302 @@
+#define __NR_io_setup 0
+#define __NR_io_destroy 1
+#define __NR_io_submit 2
+#define __NR_io_cancel 3
+#define __NR_io_getevents 4
+#define __NR_setxattr 5
+#define __NR_lsetxattr 6
+#define __NR_fsetxattr 7
+#define __NR_getxattr 8
+#define __NR_lgetxattr 9
+#define __NR_fgetxattr 10
+#define __NR_listxattr 11
+#define __NR_llistxattr 12
+#define __NR_flistxattr 13
+#define __NR_removexattr 14
+#define __NR_lremovexattr 15
+#define __NR_fremovexattr 16
+#define __NR_getcwd 17
+#define __NR_lookup_dcookie 18
+#define __NR_eventfd2 19
+#define __NR_epoll_create1 20
+#define __NR_epoll_ctl 21
+#define __NR_epoll_pwait 22
+#define __NR_dup 23
+#define __NR_dup3 24
+#define __NR_fcntl 25
+#define __NR_inotify_init1 26
+#define __NR_inotify_add_watch 27
+#define __NR_inotify_rm_watch 28
+#define __NR_ioctl 29
+#define __NR_ioprio_set 30
+#define __NR_ioprio_get 31
+#define __NR_flock 32
+#define __NR_mknodat 33
+#define __NR_mkdirat 34
+#define __NR_unlinkat 35
+#define __NR_symlinkat 36
+#define __NR_linkat 37
+#define __NR_renameat 38
+#define __NR_umount2 39
+#define __NR_mount 40
+#define __NR_pivot_root 41
+#define __NR_nfsservctl 42
+#define __NR_statfs 43
+#define __NR_fstatfs 44
+#define __NR_truncate 45
+#define __NR_ftruncate 46
+#define __NR_fallocate 47
+#define __NR_faccessat 48
+#define __NR_chdir 49
+#define __NR_fchdir 50
+#define __NR_chroot 51
+#define __NR_fchmod 52
+#define __NR_fchmodat 53
+#define __NR_fchownat 54
+#define __NR_fchown 55
+#define __NR_openat 56
+#define __NR_close 57
+#define __NR_vhangup 58
+#define __NR_pipe2 59
+#define __NR_quotactl 60
+#define __NR_getdents64 61
+#define __NR_lseek 62
+#define __NR_read 63
+#define __NR_write 64
+#define __NR_readv 65
+#define __NR_writev 66
+#define __NR_pread64 67
+#define __NR_pwrite64 68
+#define __NR_preadv 69
+#define __NR_pwritev 70
+#define __NR_sendfile 71
+#define __NR_pselect6 72
+#define __NR_ppoll 73
+#define __NR_signalfd4 74
+#define __NR_vmsplice 75
+#define __NR_splice 76
+#define __NR_tee 77
+#define __NR_readlinkat 78
+#define __NR_newfstatat 79
+#define __NR_fstat 80
+#define __NR_sync 81
+#define __NR_fsync 82
+#define __NR_fdatasync 83
+#define __NR_sync_file_range 84
+#define __NR_timerfd_create 85
+#define __NR_timerfd_settime 86
+#define __NR_timerfd_gettime 87
+#define __NR_utimensat 88
+#define __NR_acct 89
+#define __NR_capget 90
+#define __NR_capset 91
+#define __NR_personality 92
+#define __NR_exit 93
+#define __NR_exit_group 94
+#define __NR_waitid 95
+#define __NR_set_tid_address 96
+#define __NR_unshare 97
+#define __NR_futex 98
+#define __NR_set_robust_list 99
+#define __NR_get_robust_list 100
+#define __NR_nanosleep 101
+#define __NR_getitimer 102
+#define __NR_setitimer 103
+#define __NR_kexec_load 104
+#define __NR_init_module 105
+#define __NR_delete_module 106
+#define __NR_timer_create 107
+#define __NR_timer_gettime 108
+#define __NR_timer_getoverrun 109
+#define __NR_timer_settime 110
+#define __NR_timer_delete 111
+#define __NR_clock_settime 112
+#define __NR_clock_gettime 113
+#define __NR_clock_getres 114
+#define __NR_clock_nanosleep 115
+#define __NR_syslog 116
+#define __NR_ptrace 117
+#define __NR_sched_setparam 118
+#define __NR_sched_setscheduler 119
+#define __NR_sched_getscheduler 120
+#define __NR_sched_getparam 121
+#define __NR_sched_setaffinity 122
+#define __NR_sched_getaffinity 123
+#define __NR_sched_yield 124
+#define __NR_sched_get_priority_max 125
+#define __NR_sched_get_priority_min 126
+#define __NR_sched_rr_get_interval 127
+#define __NR_restart_syscall 128
+#define __NR_kill 129
+#define __NR_tkill 130
+#define __NR_tgkill 131
+#define __NR_sigaltstack 132
+#define __NR_rt_sigsuspend 133
+#define __NR_rt_sigaction 134
+#define __NR_rt_sigprocmask 135
+#define __NR_rt_sigpending 136
+#define __NR_rt_sigtimedwait 137
+#define __NR_rt_sigqueueinfo 138
+#define __NR_rt_sigreturn 139
+#define __NR_setpriority 140
+#define __NR_getpriority 141
+#define __NR_reboot 142
+#define __NR_setregid 143
+#define __NR_setgid 144
+#define __NR_setreuid 145
+#define __NR_setuid 146
+#define __NR_setresuid 147
+#define __NR_getresuid 148
+#define __NR_setresgid 149
+#define __NR_getresgid 150
+#define __NR_setfsuid 151
+#define __NR_setfsgid 152
+#define __NR_times 153
+#define __NR_setpgid 154
+#define __NR_getpgid 155
+#define __NR_getsid 156
+#define __NR_setsid 157
+#define __NR_getgroups 158
+#define __NR_setgroups 159
+#define __NR_uname 160
+#define __NR_sethostname 161
+#define __NR_setdomainname 162
+#define __NR_getrlimit 163
+#define __NR_setrlimit 164
+#define __NR_getrusage 165
+#define __NR_umask 166
+#define __NR_prctl 167
+#define __NR_getcpu 168
+#define __NR_gettimeofday 169
+#define __NR_settimeofday 170
+#define __NR_adjtimex 171
+#define __NR_getpid 172
+#define __NR_getppid 173
+#define __NR_getuid 174
+#define __NR_geteuid 175
+#define __NR_getgid 176
+#define __NR_getegid 177
+#define __NR_gettid 178
+#define __NR_sysinfo 179
+#define __NR_mq_open 180
+#define __NR_mq_unlink 181
+#define __NR_mq_timedsend 182
+#define __NR_mq_timedreceive 183
+#define __NR_mq_notify 184
+#define __NR_mq_getsetattr 185
+#define __NR_msgget 186
+#define __NR_msgctl 187
+#define __NR_msgrcv 188
+#define __NR_msgsnd 189
+#define __NR_semget 190
+#define __NR_semctl 191
+#define __NR_semtimedop 192
+#define __NR_semop 193
+#define __NR_shmget 194
+#define __NR_shmctl 195
+#define __NR_shmat 196
+#define __NR_shmdt 197
+#define __NR_socket 198
+#define __NR_socketpair 199
+#define __NR_bind 200
+#define __NR_listen 201
+#define __NR_accept 202
+#define __NR_connect 203
+#define __NR_getsockname 204
+#define __NR_getpeername 205
+#define __NR_sendto 206
+#define __NR_recvfrom 207
+#define __NR_setsockopt 208
+#define __NR_getsockopt 209
+#define __NR_shutdown 210
+#define __NR_sendmsg 211
+#define __NR_recvmsg 212
+#define __NR_readahead 213
+#define __NR_brk 214
+#define __NR_munmap 215
+#define __NR_mremap 216
+#define __NR_add_key 217
+#define __NR_request_key 218
+#define __NR_keyctl 219
+#define __NR_clone 220
+#define __NR_execve 221
+#define __NR_mmap 222
+#define __NR_fadvise64 223
+#define __NR_swapon 224
+#define __NR_swapoff 225
+#define __NR_mprotect 226
+#define __NR_msync 227
+#define __NR_mlock 228
+#define __NR_munlock 229
+#define __NR_mlockall 230
+#define __NR_munlockall 231
+#define __NR_mincore 232
+#define __NR_madvise 233
+#define __NR_remap_file_pages 234
+#define __NR_mbind 235
+#define __NR_get_mempolicy 236
+#define __NR_set_mempolicy 237
+#define __NR_migrate_pages 238
+#define __NR_move_pages 239
+#define __NR_rt_tgsigqueueinfo 240
+#define __NR_perf_event_open 241
+#define __NR_accept4 242
+#define __NR_recvmmsg 243
+#define __NR_wait4 260
+#define __NR_prlimit64 261
+#define __NR_fanotify_init 262
+#define __NR_fanotify_mark 263
+#define __NR_name_to_handle_at 264
+#define __NR_open_by_handle_at 265
+#define __NR_clock_adjtime 266
+#define __NR_syncfs 267
+#define __NR_setns 268
+#define __NR_sendmmsg 269
+#define __NR_process_vm_readv 270
+#define __NR_process_vm_writev 271
+#define __NR_kcmp 272
+#define __NR_finit_module 273
+#define __NR_sched_setattr 274
+#define __NR_sched_getattr 275
+#define __NR_renameat2 276
+#define __NR_seccomp 277
+#define __NR_getrandom 278
+#define __NR_memfd_create 279
+#define __NR_bpf 280
+#define __NR_execveat 281
+#define __NR_userfaultfd 282
+#define __NR_membarrier 283
+#define __NR_mlock2 284
+#define __NR_copy_file_range 285
+#define __NR_preadv2 286
+#define __NR_pwritev2 287
+#define __NR_pkey_mprotect 288
+#define __NR_pkey_alloc 289
+#define __NR_pkey_free 290
+#define __NR_statx 291
+#define __NR_io_pgetevents 292
+#define __NR_rseq 293
+#define __NR_kexec_file_load 294
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/aarch64/bits/user.h b/libc-top-half/musl/arch/aarch64/bits/user.h
new file mode 100644
index 0000000..8a1002a
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/bits/user.h
@@ -0,0 +1,16 @@
+struct user_regs_struct {
+ unsigned long long regs[31];
+ unsigned long long sp;
+ unsigned long long pc;
+ unsigned long long pstate;
+};
+
+struct user_fpsimd_struct {
+ __uint128_t vregs[32];
+ unsigned int fpsr;
+ unsigned int fpcr;
+};
+
+#define ELF_NREG 34
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NREG];
+typedef struct user_fpsimd_struct elf_fpregset_t;
diff --git a/libc-top-half/musl/arch/aarch64/crt_arch.h b/libc-top-half/musl/arch/aarch64/crt_arch.h
new file mode 100644
index 0000000..b64fb3d
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/crt_arch.h
@@ -0,0 +1,15 @@
+__asm__(
+".text \n"
+".global " START "\n"
+".type " START ",%function\n"
+START ":\n"
+" mov x29, #0\n"
+" mov x30, #0\n"
+" mov x0, sp\n"
+".weak _DYNAMIC\n"
+".hidden _DYNAMIC\n"
+" adrp x1, _DYNAMIC\n"
+" add x1, x1, #:lo12:_DYNAMIC\n"
+" and sp, x0, #-16\n"
+" b " START "_c\n"
+);
diff --git a/libc-top-half/musl/arch/aarch64/fp_arch.h b/libc-top-half/musl/arch/aarch64/fp_arch.h
new file mode 100644
index 0000000..f3d445b
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/fp_arch.h
@@ -0,0 +1,25 @@
+#define fp_barrierf fp_barrierf
+static inline float fp_barrierf(float x)
+{
+ __asm__ __volatile__ ("" : "+w"(x));
+ return x;
+}
+
+#define fp_barrier fp_barrier
+static inline double fp_barrier(double x)
+{
+ __asm__ __volatile__ ("" : "+w"(x));
+ return x;
+}
+
+#define fp_force_evalf fp_force_evalf
+static inline void fp_force_evalf(float x)
+{
+ __asm__ __volatile__ ("" : "+w"(x));
+}
+
+#define fp_force_eval fp_force_eval
+static inline void fp_force_eval(double x)
+{
+ __asm__ __volatile__ ("" : "+w"(x));
+}
diff --git a/libc-top-half/musl/arch/aarch64/kstat.h b/libc-top-half/musl/arch/aarch64/kstat.h
new file mode 100644
index 0000000..92625f3
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ unsigned long __pad;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/aarch64/pthread_arch.h b/libc-top-half/musl/arch/aarch64/pthread_arch.h
new file mode 100644
index 0000000..3909616
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/pthread_arch.h
@@ -0,0 +1,11 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ("mrs %0,tpidr_el0" : "=r"(tp));
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 16
+
+#define MC_PC pc
diff --git a/libc-top-half/musl/arch/aarch64/reloc.h b/libc-top-half/musl/arch/aarch64/reloc.h
new file mode 100644
index 0000000..b1b68c7
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/reloc.h
@@ -0,0 +1,24 @@
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ENDIAN_SUFFIX "_be"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "aarch64" ENDIAN_SUFFIX
+
+#define NO_LEGACY_INITFINI
+
+#define TPOFF_K 0
+
+#define REL_SYMBOLIC R_AARCH64_ABS64
+#define REL_GOT R_AARCH64_GLOB_DAT
+#define REL_PLT R_AARCH64_JUMP_SLOT
+#define REL_RELATIVE R_AARCH64_RELATIVE
+#define REL_COPY R_AARCH64_COPY
+#define REL_DTPMOD R_AARCH64_TLS_DTPMOD64
+#define REL_DTPOFF R_AARCH64_TLS_DTPREL64
+#define REL_TPOFF R_AARCH64_TLS_TPREL64
+#define REL_TLSDESC R_AARCH64_TLSDESC
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov sp,%1 ; br %0" : : "r"(pc), "r"(sp) : "memory" )
diff --git a/libc-top-half/musl/arch/aarch64/syscall_arch.h b/libc-top-half/musl/arch/aarch64/syscall_arch.h
new file mode 100644
index 0000000..504983a
--- /dev/null
+++ b/libc-top-half/musl/arch/aarch64/syscall_arch.h
@@ -0,0 +1,78 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+#define __asm_syscall(...) do { \
+ __asm__ __volatile__ ( "svc 0" \
+ : "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \
+ return x0; \
+ } while (0)
+
+static inline long __syscall0(long n)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0");
+ __asm_syscall("r"(x8));
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0") = a;
+ __asm_syscall("r"(x8), "0"(x0));
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0") = a;
+ register long x1 __asm__("x1") = b;
+ __asm_syscall("r"(x8), "0"(x0), "r"(x1));
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0") = a;
+ register long x1 __asm__("x1") = b;
+ register long x2 __asm__("x2") = c;
+ __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2));
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0") = a;
+ register long x1 __asm__("x1") = b;
+ register long x2 __asm__("x2") = c;
+ register long x3 __asm__("x3") = d;
+ __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3));
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0") = a;
+ register long x1 __asm__("x1") = b;
+ register long x2 __asm__("x2") = c;
+ register long x3 __asm__("x3") = d;
+ register long x4 __asm__("x4") = e;
+ __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4));
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long x8 __asm__("x8") = n;
+ register long x0 __asm__("x0") = a;
+ register long x1 __asm__("x1") = b;
+ register long x2 __asm__("x2") = c;
+ register long x3 __asm__("x3") = d;
+ register long x4 __asm__("x4") = e;
+ register long x5 __asm__("x5") = f;
+ __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5));
+}
+
+#define VDSO_USEFUL
+#define VDSO_CGT_SYM "__kernel_clock_gettime"
+#define VDSO_CGT_VER "LINUX_2.6.39"
+
+#define IPC_64 0
diff --git a/libc-top-half/musl/arch/arm/arch.mak b/libc-top-half/musl/arch/arm/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/arm/atomic_arch.h b/libc-top-half/musl/arch/arm/atomic_arch.h
new file mode 100644
index 0000000..9e3937c
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/atomic_arch.h
@@ -0,0 +1,107 @@
+#include "libc.h"
+
+#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
+#define BLX "mov lr,pc\n\tbx"
+#else
+#define BLX "blx"
+#endif
+
+extern hidden uintptr_t __a_cas_ptr, __a_barrier_ptr;
+
+#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
+ || __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
+
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+ __asm__ __volatile__ ("ldrex %0, %1" : "=r"(v) : "Q"(*p));
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+ __asm__ __volatile__ ("strex %0,%2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
+ return !r;
+}
+
+#if __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("dmb ish" : : : "memory");
+}
+
+#endif
+
+#define a_pre_llsc a_barrier
+#define a_post_llsc a_barrier
+
+#else
+
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ for (;;) {
+ register int r0 __asm__("r0") = t;
+ register int r1 __asm__("r1") = s;
+ register volatile int *r2 __asm__("r2") = p;
+ register uintptr_t r3 __asm__("r3") = __a_cas_ptr;
+ int old;
+ __asm__ __volatile__ (
+ BLX " r3"
+ : "+r"(r0), "+r"(r3) : "r"(r1), "r"(r2)
+ : "memory", "lr", "ip", "cc" );
+ if (!r0) return t;
+ if ((old=*p)!=t) return old;
+ }
+}
+
+#endif
+
+#ifndef a_barrier
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ register uintptr_t ip __asm__("ip") = __a_barrier_ptr;
+ __asm__ __volatile__( BLX " ip" : "+r"(ip) : : "memory", "cc", "lr" );
+}
+#endif
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__(
+#ifndef __thumb__
+ ".word 0xe7f000f0"
+#else
+ ".short 0xdeff"
+#endif
+ : : : "memory");
+}
+
+#if __ARM_ARCH >= 5 && (!__thumb__ || __thumb2__)
+
+#define a_clz_32 a_clz_32
+static inline int a_clz_32(uint32_t x)
+{
+ __asm__ ("clz %0, %1" : "=r"(x) : "r"(x));
+ return x;
+}
+
+#if __ARM_ARCH_6T2__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
+
+#define a_ctz_32 a_ctz_32
+static inline int a_ctz_32(uint32_t x)
+{
+ uint32_t xr;
+ __asm__ ("rbit %0, %1" : "=r"(xr) : "r"(x));
+ return a_clz_32(xr);
+}
+
+#endif
+
+#endif
diff --git a/libc-top-half/musl/arch/arm/bits/alltypes.h.in b/libc-top-half/musl/arch/arm/bits/alltypes.h.in
new file mode 100644
index 0000000..d62bd7b
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/alltypes.h.in
@@ -0,0 +1,21 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#if __ARMEB__
+#define __BYTE_ORDER 4321
+#else
+#define __BYTE_ORDER 1234
+#endif
+
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+TYPEDEF unsigned wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/arm/bits/fcntl.h b/libc-top-half/musl/arch/arm/bits/fcntl.h
new file mode 100644
index 0000000..4cb1753
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 040000
+#define O_NOFOLLOW 0100000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 0200000
+#define O_LARGEFILE 0400000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020040000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/arm/bits/fenv.h b/libc-top-half/musl/arch/arm/bits/fenv.h
new file mode 100644
index 0000000..d85fc86
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/fenv.h
@@ -0,0 +1,23 @@
+#ifndef __ARM_PCS_VFP
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+#else
+#define FE_INVALID 1
+#define FE_DIVBYZERO 2
+#define FE_OVERFLOW 4
+#define FE_UNDERFLOW 8
+#define FE_INEXACT 16
+#define FE_ALL_EXCEPT 31
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 0x800000
+#define FE_UPWARD 0x400000
+#define FE_TOWARDZERO 0xc00000
+#endif
+
+typedef unsigned long fexcept_t;
+
+typedef struct {
+ unsigned long __cw;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/arm/bits/float.h b/libc-top-half/musl/arch/arm/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/arm/bits/hwcap.h b/libc-top-half/musl/arch/arm/bits/hwcap.h
new file mode 100644
index 0000000..a3d8731
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/hwcap.h
@@ -0,0 +1,53 @@
+#define HWCAP_SWP (1 << 0)
+#define HWCAP_HALF (1 << 1)
+#define HWCAP_THUMB (1 << 2)
+#define HWCAP_26BIT (1 << 3)
+#define HWCAP_FAST_MULT (1 << 4)
+#define HWCAP_FPA (1 << 5)
+#define HWCAP_VFP (1 << 6)
+#define HWCAP_EDSP (1 << 7)
+#define HWCAP_JAVA (1 << 8)
+#define HWCAP_IWMMXT (1 << 9)
+#define HWCAP_CRUNCH (1 << 10)
+#define HWCAP_THUMBEE (1 << 11)
+#define HWCAP_NEON (1 << 12)
+#define HWCAP_VFPv3 (1 << 13)
+#define HWCAP_VFPv3D16 (1 << 14)
+#define HWCAP_TLS (1 << 15)
+#define HWCAP_VFPv4 (1 << 16)
+#define HWCAP_IDIVA (1 << 17)
+#define HWCAP_IDIVT (1 << 18)
+#define HWCAP_VFPD32 (1 << 19)
+#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
+#define HWCAP_LPAE (1 << 20)
+#define HWCAP_EVTSTRM (1 << 21)
+
+#define HWCAP2_AES (1 << 0)
+#define HWCAP2_PMULL (1 << 1)
+#define HWCAP2_SHA1 (1 << 2)
+#define HWCAP2_SHA2 (1 << 3)
+#define HWCAP2_CRC32 (1 << 4)
+
+#define HWCAP_ARM_SWP (1 << 0)
+#define HWCAP_ARM_HALF (1 << 1)
+#define HWCAP_ARM_THUMB (1 << 2)
+#define HWCAP_ARM_26BIT (1 << 3)
+#define HWCAP_ARM_FAST_MULT (1 << 4)
+#define HWCAP_ARM_FPA (1 << 5)
+#define HWCAP_ARM_VFP (1 << 6)
+#define HWCAP_ARM_EDSP (1 << 7)
+#define HWCAP_ARM_JAVA (1 << 8)
+#define HWCAP_ARM_IWMMXT (1 << 9)
+#define HWCAP_ARM_CRUNCH (1 << 10)
+#define HWCAP_ARM_THUMBEE (1 << 11)
+#define HWCAP_ARM_NEON (1 << 12)
+#define HWCAP_ARM_VFPv3 (1 << 13)
+#define HWCAP_ARM_VFPv3D16 (1 << 14)
+#define HWCAP_ARM_TLS (1 << 15)
+#define HWCAP_ARM_VFPv4 (1 << 16)
+#define HWCAP_ARM_IDIVA (1 << 17)
+#define HWCAP_ARM_IDIVT (1 << 18)
+#define HWCAP_ARM_VFPD32 (1 << 19)
+#define HWCAP_ARM_IDIV (HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT)
+#define HWCAP_ARM_LPAE (1 << 20)
+#define HWCAP_ARM_EVTSTRM (1 << 21)
diff --git a/libc-top-half/musl/arch/arm/bits/ioctl_fix.h b/libc-top-half/musl/arch/arm/bits/ioctl_fix.h
new file mode 100644
index 0000000..ebb383d
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/ioctl_fix.h
@@ -0,0 +1,2 @@
+#undef FIOQSIZE
+#define FIOQSIZE 0x545e
diff --git a/libc-top-half/musl/arch/arm/bits/ipcstat.h b/libc-top-half/musl/arch/arm/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/arm/bits/msg.h b/libc-top-half/musl/arch/arm/bits/msg.h
new file mode 100644
index 0000000..7bbbb2b
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/arm/bits/posix.h b/libc-top-half/musl/arch/arm/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/arm/bits/ptrace.h b/libc-top-half/musl/arch/arm/bits/ptrace.h
new file mode 100644
index 0000000..9556ef4
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/ptrace.h
@@ -0,0 +1,25 @@
+#define PTRACE_GETWMMXREGS 18
+#define PTRACE_SETWMMXREGS 19
+#define PTRACE_GET_THREAD_AREA 22
+#define PTRACE_SET_SYSCALL 23
+#define PTRACE_GETCRUNCHREGS 25
+#define PTRACE_SETCRUNCHREGS 26
+#define PTRACE_GETVFPREGS 27
+#define PTRACE_SETVFPREGS 28
+#define PTRACE_GETHBPREGS 29
+#define PTRACE_SETHBPREGS 30
+#define PTRACE_GETFDPIC 31
+#define PTRACE_GETFDPIC_EXEC 0
+#define PTRACE_GETFDPIC_INTERP 1
+
+#define PT_GETWMMXREGS PTRACE_GETWMMXREGS
+#define PT_SETWMMXREGS PTRACE_SETWMMXREGS
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_SYSCALL PTRACE_SET_SYSCALL
+#define PT_GETCRUNCHREGS PTRACE_GETCRUNCHREGS
+#define PT_SETCRUNCHREGS PTRACE_SETCRUNCHREGS
+#define PT_GETVFPREGS PTRACE_GETVFPREGS
+#define PT_SETVFPREGS PTRACE_SETVFPREGS
+#define PT_GETHBPREGS PTRACE_GETHBPREGS
+#define PT_SETHBPREGS PTRACE_SETHBPREGS
+#define PT_GETFDPIC PTRACE_GETFDPIC
diff --git a/libc-top-half/musl/arch/arm/bits/reg.h b/libc-top-half/musl/arch/arm/bits/reg.h
new file mode 100644
index 0000000..0c7bffc
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/reg.h
@@ -0,0 +1,3 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+/* FIXME */
diff --git a/libc-top-half/musl/arch/arm/bits/sem.h b/libc-top-half/musl/arch/arm/bits/sem.h
new file mode 100644
index 0000000..544e3d2
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/sem.h
@@ -0,0 +1,18 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned long __sem_ctime_hi;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+#endif
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/arm/bits/setjmp.h b/libc-top-half/musl/arch/arm/bits/setjmp.h
new file mode 100644
index 0000000..55e3a95
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long __jmp_buf[32];
diff --git a/libc-top-half/musl/arch/arm/bits/shm.h b/libc-top-half/musl/arch/arm/bits/shm.h
new file mode 100644
index 0000000..725fb46
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __shm_ctime_hi;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+ unsigned long __pad3;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/arm/bits/signal.h b/libc-top-half/musl/arch/arm/bits/signal.h
new file mode 100644
index 0000000..3c78985
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/signal.h
@@ -0,0 +1,86 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef int greg_t, gregset_t[18];
+typedef struct sigcontext {
+ unsigned long trap_no, error_code, oldmask;
+ unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
+ unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
+ unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
+ unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
+ unsigned long arm_cpsr, fault_address;
+} mcontext_t;
+#else
+typedef struct {
+ unsigned long __regs[21];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ unsigned long long uc_regspace[64];
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/arm/bits/stat.h b/libc-top-half/musl/arch/arm/bits/stat.h
new file mode 100644
index 0000000..5d7828c
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ int __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ ino_t st_ino;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/arm/bits/stdint.h b/libc-top-half/musl/arch/arm/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/arm/bits/syscall.h.in b/libc-top-half/musl/arch/arm/bits/syscall.h.in
new file mode 100644
index 0000000..048fdea
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/syscall.h.in
@@ -0,0 +1,409 @@
+#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_creat 8
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_execve 11
+#define __NR_chdir 12
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_lchown 16
+#define __NR_lseek 19
+#define __NR_getpid 20
+#define __NR_mount 21
+#define __NR_setuid 23
+#define __NR_getuid 24
+#define __NR_ptrace 26
+#define __NR_pause 29
+#define __NR_access 33
+#define __NR_nice 34
+#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_brk 45
+#define __NR_setgid 46
+#define __NR_getgid 47
+#define __NR_geteuid 49
+#define __NR_getegid 50
+#define __NR_acct 51
+#define __NR_umount2 52
+#define __NR_ioctl 54
+#define __NR_fcntl 55
+#define __NR_setpgid 57
+#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_setreuid 70
+#define __NR_setregid 71
+#define __NR_sigsuspend 72
+#define __NR_sigpending 73
+#define __NR_sethostname 74
+#define __NR_setrlimit 75
+#define __NR_getrusage 77
+#define __NR_gettimeofday_time32 78
+#define __NR_settimeofday_time32 79
+#define __NR_getgroups 80
+#define __NR_setgroups 81
+#define __NR_symlink 83
+#define __NR_readlink 85
+#define __NR_uselib 86
+#define __NR_swapon 87
+#define __NR_reboot 88
+#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_statfs 99
+#define __NR_fstatfs 100
+#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_vhangup 111
+#define __NR_wait4 114
+#define __NR_swapoff 115
+#define __NR_sysinfo 116
+#define __NR_fsync 118
+#define __NR_sigreturn 119
+#define __NR_clone 120
+#define __NR_setdomainname 121
+#define __NR_uname 122
+#define __NR_adjtimex 124
+#define __NR_mprotect 125
+#define __NR_sigprocmask 126
+#define __NR_init_module 128
+#define __NR_delete_module 129
+#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_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_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_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_getdents64 217
+#define __NR_pivot_root 218
+#define __NR_mincore 219
+#define __NR_madvise 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_io_setup 243
+#define __NR_io_destroy 244
+#define __NR_io_getevents 245
+#define __NR_io_submit 246
+#define __NR_io_cancel 247
+#define __NR_exit_group 248
+#define __NR_lookup_dcookie 249
+#define __NR_epoll_create 250
+#define __NR_epoll_ctl 251
+#define __NR_epoll_wait 252
+#define __NR_remap_file_pages 253
+#define __NR_set_tid_address 256
+#define __NR_timer_create 257
+#define __NR_timer_settime32 258
+#define __NR_timer_gettime32 259
+#define __NR_timer_getoverrun 260
+#define __NR_timer_delete 261
+#define __NR_clock_settime32 262
+#define __NR_clock_gettime32 263
+#define __NR_clock_getres_time32 264
+#define __NR_clock_nanosleep_time32 265
+#define __NR_statfs64 266
+#define __NR_fstatfs64 267
+#define __NR_tgkill 268
+#define __NR_utimes 269
+#define __NR_fadvise64_64 270
+#define __NR_arm_fadvise64_64 270
+#define __NR_pciconfig_iobase 271
+#define __NR_pciconfig_read 272
+#define __NR_pciconfig_write 273
+#define __NR_mq_open 274
+#define __NR_mq_unlink 275
+#define __NR_mq_timedsend 276
+#define __NR_mq_timedreceive 277
+#define __NR_mq_notify 278
+#define __NR_mq_getsetattr 279
+#define __NR_waitid 280
+#define __NR_socket 281
+#define __NR_bind 282
+#define __NR_connect 283
+#define __NR_listen 284
+#define __NR_accept 285
+#define __NR_getsockname 286
+#define __NR_getpeername 287
+#define __NR_socketpair 288
+#define __NR_send 289
+#define __NR_sendto 290
+#define __NR_recv 291
+#define __NR_recvfrom 292
+#define __NR_shutdown 293
+#define __NR_setsockopt 294
+#define __NR_getsockopt 295
+#define __NR_sendmsg 296
+#define __NR_recvmsg 297
+#define __NR_semop 298
+#define __NR_semget 299
+#define __NR_semctl 300
+#define __NR_msgsnd 301
+#define __NR_msgrcv 302
+#define __NR_msgget 303
+#define __NR_msgctl 304
+#define __NR_shmat 305
+#define __NR_shmdt 306
+#define __NR_shmget 307
+#define __NR_shmctl 308
+#define __NR_add_key 309
+#define __NR_request_key 310
+#define __NR_keyctl 311
+#define __NR_semtimedop 312
+#define __NR_vserver 313
+#define __NR_ioprio_set 314
+#define __NR_ioprio_get 315
+#define __NR_inotify_init 316
+#define __NR_inotify_add_watch 317
+#define __NR_inotify_rm_watch 318
+#define __NR_mbind 319
+#define __NR_get_mempolicy 320
+#define __NR_set_mempolicy 321
+#define __NR_openat 322
+#define __NR_mkdirat 323
+#define __NR_mknodat 324
+#define __NR_fchownat 325
+#define __NR_futimesat 326
+#define __NR_fstatat64 327
+#define __NR_unlinkat 328
+#define __NR_renameat 329
+#define __NR_linkat 330
+#define __NR_symlinkat 331
+#define __NR_readlinkat 332
+#define __NR_fchmodat 333
+#define __NR_faccessat 334
+#define __NR_pselect6 335
+#define __NR_ppoll 336
+#define __NR_unshare 337
+#define __NR_set_robust_list 338
+#define __NR_get_robust_list 339
+#define __NR_splice 340
+#define __NR_sync_file_range2 341
+#define __NR_arm_sync_file_range 341
+#define __NR_tee 342
+#define __NR_vmsplice 343
+#define __NR_move_pages 344
+#define __NR_getcpu 345
+#define __NR_epoll_pwait 346
+#define __NR_kexec_load 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_settime32 353
+#define __NR_timerfd_gettime32 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
+#define __NR_preadv 361
+#define __NR_pwritev 362
+#define __NR_rt_tgsigqueueinfo 363
+#define __NR_perf_event_open 364
+#define __NR_recvmmsg 365
+#define __NR_accept4 366
+#define __NR_fanotify_init 367
+#define __NR_fanotify_mark 368
+#define __NR_prlimit64 369
+#define __NR_name_to_handle_at 370
+#define __NR_open_by_handle_at 371
+#define __NR_clock_adjtime 372
+#define __NR_syncfs 373
+#define __NR_sendmmsg 374
+#define __NR_setns 375
+#define __NR_process_vm_readv 376
+#define __NR_process_vm_writev 377
+#define __NR_kcmp 378
+#define __NR_finit_module 379
+#define __NR_sched_setattr 380
+#define __NR_sched_getattr 381
+#define __NR_renameat2 382
+#define __NR_seccomp 383
+#define __NR_getrandom 384
+#define __NR_memfd_create 385
+#define __NR_bpf 386
+#define __NR_execveat 387
+#define __NR_userfaultfd 388
+#define __NR_membarrier 389
+#define __NR_mlock2 390
+#define __NR_copy_file_range 391
+#define __NR_preadv2 392
+#define __NR_pwritev2 393
+#define __NR_pkey_mprotect 394
+#define __NR_pkey_alloc 395
+#define __NR_pkey_free 396
+#define __NR_statx 397
+#define __NR_rseq 398
+#define __NR_io_pgetevents 399
+#define __NR_migrate_pages 400
+#define __NR_kexec_file_load 401
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
+#define __ARM_NR_breakpoint 0x0f0001
+#define __ARM_NR_cacheflush 0x0f0002
+#define __ARM_NR_usr26 0x0f0003
+#define __ARM_NR_usr32 0x0f0004
+#define __ARM_NR_set_tls 0x0f0005
+#define __ARM_NR_get_tls 0x0f0006
+
diff --git a/libc-top-half/musl/arch/arm/bits/user.h b/libc-top-half/musl/arch/arm/bits/user.h
new file mode 100644
index 0000000..3e5a4d2
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/bits/user.h
@@ -0,0 +1,36 @@
+typedef struct user_fpregs {
+ struct fp_reg {
+ unsigned sign1:1;
+ unsigned unused:15;
+ unsigned sign2:1;
+ unsigned exponent:14;
+ unsigned j:1;
+ unsigned mantissa1:31;
+ unsigned mantissa0:32;
+ } fpregs[8];
+ unsigned fpsr:32;
+ unsigned fpcr:32;
+ unsigned char ftype[8];
+ unsigned int init_flag;
+} elf_fpregset_t;
+
+struct user_regs {
+ unsigned long uregs[18];
+};
+#define ELF_NGREG 18
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+ struct user_regs regs;
+ int u_fpvalid;
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long start_code, start_stack;
+ long signal;
+ int reserved;
+ struct user_regs *u_ar0;
+ unsigned long magic;
+ char u_comm[32];
+ int u_debugreg[8];
+ struct user_fpregs u_fp;
+ struct user_fpregs *u_fp0;
+};
diff --git a/libc-top-half/musl/arch/arm/crt_arch.h b/libc-top-half/musl/arch/arm/crt_arch.h
new file mode 100644
index 0000000..99508b1
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/crt_arch.h
@@ -0,0 +1,18 @@
+__asm__(
+".text \n"
+".global " START " \n"
+".type " START ",%function \n"
+START ": \n"
+" mov fp, #0 \n"
+" mov lr, #0 \n"
+" ldr a2, 1f \n"
+" add a2, pc, a2 \n"
+" mov a1, sp \n"
+"2: and ip, a1, #-16 \n"
+" mov sp, ip \n"
+" bl " START "_c \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+".align 2 \n"
+"1: .word _DYNAMIC-2b \n"
+);
diff --git a/libc-top-half/musl/arch/arm/kstat.h b/libc-top-half/musl/arch/arm/kstat.h
new file mode 100644
index 0000000..af449c9
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ int __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ ino_t st_ino;
+};
diff --git a/libc-top-half/musl/arch/arm/pthread_arch.h b/libc-top-half/musl/arch/arm/pthread_arch.h
new file mode 100644
index 0000000..157e2ea
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/pthread_arch.h
@@ -0,0 +1,32 @@
+#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
+ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
+
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(tp) );
+ return tp;
+}
+
+#else
+
+#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
+#define BLX "mov lr,pc\n\tbx"
+#else
+#define BLX "blx"
+#endif
+
+static inline uintptr_t __get_tp()
+{
+ extern hidden uintptr_t __a_gettp_ptr;
+ register uintptr_t tp __asm__("r0");
+ __asm__ ( BLX " %1" : "=r"(tp) : "r"(__a_gettp_ptr) : "cc", "lr" );
+ return tp;
+}
+
+#endif
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 8
+
+#define MC_PC arm_pc
diff --git a/libc-top-half/musl/arch/arm/reloc.h b/libc-top-half/musl/arch/arm/reloc.h
new file mode 100644
index 0000000..d091d2a
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/reloc.h
@@ -0,0 +1,32 @@
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ENDIAN_SUFFIX "eb"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#if __ARM_PCS_VFP
+#define FP_SUFFIX "hf"
+#else
+#define FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "arm" ENDIAN_SUFFIX FP_SUFFIX
+
+#define NO_LEGACY_INITFINI
+
+#define TPOFF_K 0
+
+#define REL_SYMBOLIC R_ARM_ABS32
+#define REL_GOT R_ARM_GLOB_DAT
+#define REL_PLT R_ARM_JUMP_SLOT
+#define REL_RELATIVE R_ARM_RELATIVE
+#define REL_COPY R_ARM_COPY
+#define REL_DTPMOD R_ARM_TLS_DTPMOD32
+#define REL_DTPOFF R_ARM_TLS_DTPOFF32
+#define REL_TPOFF R_ARM_TLS_TPOFF32
+#define REL_TLSDESC R_ARM_TLS_DESC
+
+#define TLSDESC_BACKWARDS
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
diff --git a/libc-top-half/musl/arch/arm/syscall_arch.h b/libc-top-half/musl/arch/arm/syscall_arch.h
new file mode 100644
index 0000000..a877b2c
--- /dev/null
+++ b/libc-top-half/musl/arch/arm/syscall_arch.h
@@ -0,0 +1,103 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
+
+#ifdef __thumb__
+
+/* Avoid use of r7 in asm constraints when producing thumb code,
+ * since it's reserved as frame pointer and might not be supported. */
+#define __ASM____R7__
+#define __asm_syscall(...) do { \
+ __asm__ __volatile__ ( "mov %1,r7 ; mov r7,%2 ; svc 0 ; mov r7,%1" \
+ : "=r"(r0), "=&r"((int){0}) : __VA_ARGS__ : "memory"); \
+ return r0; \
+ } while (0)
+
+#else
+
+#define __ASM____R7__ __asm__("r7")
+#define __asm_syscall(...) do { \
+ __asm__ __volatile__ ( "svc 0" \
+ : "=r"(r0) : __VA_ARGS__ : "memory"); \
+ return r0; \
+ } while (0)
+#endif
+
+/* For thumb2, we can allow 8-bit immediate syscall numbers, saving a
+ * register in the above dance around r7. Does not work for thumb1 where
+ * only movs, not mov, supports immediates, and we can't use movs because
+ * it doesn't support high regs. */
+#ifdef __thumb2__
+#define R7_OPERAND "rI"(r7)
+#else
+#define R7_OPERAND "r"(r7)
+#endif
+
+static inline long __syscall0(long n)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0");
+ __asm_syscall(R7_OPERAND);
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0") = a;
+ __asm_syscall(R7_OPERAND, "0"(r0));
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0") = a;
+ register long r1 __asm__("r1") = b;
+ __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1));
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0") = a;
+ register long r1 __asm__("r1") = b;
+ register long r2 __asm__("r2") = c;
+ __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2));
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0") = a;
+ register long r1 __asm__("r1") = b;
+ register long r2 __asm__("r2") = c;
+ register long r3 __asm__("r3") = d;
+ __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3));
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0") = a;
+ register long r1 __asm__("r1") = b;
+ register long r2 __asm__("r2") = c;
+ register long r3 __asm__("r3") = d;
+ register long r4 __asm__("r4") = e;
+ __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4));
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r7 __ASM____R7__ = n;
+ register long r0 __asm__("r0") = a;
+ register long r1 __asm__("r1") = b;
+ register long r2 __asm__("r2") = c;
+ register long r3 __asm__("r3") = d;
+ register long r4 __asm__("r4") = e;
+ register long r5 __asm__("r5") = f;
+ __asm_syscall(R7_OPERAND, "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5));
+}
+
+#define SYSCALL_FADVISE_6_ARG
+
+#define SYSCALL_IPC_BROKEN_MODE
diff --git a/libc-top-half/musl/arch/generic/bits/dirent.h b/libc-top-half/musl/arch/generic/bits/dirent.h
new file mode 100644
index 0000000..c845fe8
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/dirent.h
@@ -0,0 +1,11 @@
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+struct dirent {
+ ino_t d_ino;
+ off_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[256];
+};
diff --git a/libc-top-half/musl/arch/generic/bits/errno.h b/libc-top-half/musl/arch/generic/bits/errno.h
new file mode 100644
index 0000000..d2e1eee
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define EDEADLK 35
+#define ENAMETOOLONG 36
+#define ENOLCK 37
+#define ENOSYS 38
+#define ENOTEMPTY 39
+#define ELOOP 40
+#define EWOULDBLOCK EAGAIN
+#define ENOMSG 42
+#define EIDRM 43
+#define ECHRNG 44
+#define EL2NSYNC 45
+#define EL3HLT 46
+#define EL3RST 47
+#define ELNRNG 48
+#define EUNATCH 49
+#define ENOCSI 50
+#define EL2HLT 51
+#define EBADE 52
+#define EBADR 53
+#define EXFULL 54
+#define ENOANO 55
+#define EBADRQC 56
+#define EBADSLT 57
+#define EDEADLOCK EDEADLK
+#define EBFONT 59
+#define ENOSTR 60
+#define ENODATA 61
+#define ETIME 62
+#define ENOSR 63
+#define ENONET 64
+#define ENOPKG 65
+#define EREMOTE 66
+#define ENOLINK 67
+#define EADV 68
+#define ESRMNT 69
+#define ECOMM 70
+#define EPROTO 71
+#define EMULTIHOP 72
+#define EDOTDOT 73
+#define EBADMSG 74
+#define EOVERFLOW 75
+#define ENOTUNIQ 76
+#define EBADFD 77
+#define EREMCHG 78
+#define ELIBACC 79
+#define ELIBBAD 80
+#define ELIBSCN 81
+#define ELIBMAX 82
+#define ELIBEXEC 83
+#define EILSEQ 84
+#define ERESTART 85
+#define ESTRPIPE 86
+#define EUSERS 87
+#define ENOTSOCK 88
+#define EDESTADDRREQ 89
+#define EMSGSIZE 90
+#define EPROTOTYPE 91
+#define ENOPROTOOPT 92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP 95
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT 96
+#define EAFNOSUPPORT 97
+#define EADDRINUSE 98
+#define EADDRNOTAVAIL 99
+#define ENETDOWN 100
+#define ENETUNREACH 101
+#define ENETRESET 102
+#define ECONNABORTED 103
+#define ECONNRESET 104
+#define ENOBUFS 105
+#define EISCONN 106
+#define ENOTCONN 107
+#define ESHUTDOWN 108
+#define ETOOMANYREFS 109
+#define ETIMEDOUT 110
+#define ECONNREFUSED 111
+#define EHOSTDOWN 112
+#define EHOSTUNREACH 113
+#define EALREADY 114
+#define EINPROGRESS 115
+#define ESTALE 116
+#define EUCLEAN 117
+#define ENOTNAM 118
+#define ENAVAIL 119
+#define EISNAM 120
+#define EREMOTEIO 121
+#define EDQUOT 122
+#define ENOMEDIUM 123
+#define EMEDIUMTYPE 124
+#define ECANCELED 125
+#define ENOKEY 126
+#define EKEYEXPIRED 127
+#define EKEYREVOKED 128
+#define EKEYREJECTED 129
+#define EOWNERDEAD 130
+#define ENOTRECOVERABLE 131
+#define ERFKILL 132
+#define EHWPOISON 133
diff --git a/libc-top-half/musl/arch/generic/bits/fcntl.h b/libc-top-half/musl/arch/generic/bits/fcntl.h
new file mode 100644
index 0000000..730a98c
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/fcntl.h
@@ -0,0 +1,46 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 040000
+#define O_LARGEFILE 0100000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#if __LONG_MAX == 0x7fffffffL
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+#else
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+#endif
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/generic/bits/fenv.h b/libc-top-half/musl/arch/generic/bits/fenv.h
new file mode 100644
index 0000000..edbdea2
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/fenv.h
@@ -0,0 +1,10 @@
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+
+typedef unsigned long fexcept_t;
+
+typedef struct {
+ unsigned long __cw;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/generic/bits/hwcap.h b/libc-top-half/musl/arch/generic/bits/hwcap.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/hwcap.h
diff --git a/libc-top-half/musl/arch/generic/bits/io.h b/libc-top-half/musl/arch/generic/bits/io.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/io.h
diff --git a/libc-top-half/musl/arch/generic/bits/ioctl.h b/libc-top-half/musl/arch/generic/bits/ioctl.h
new file mode 100644
index 0000000..60ae8b8
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/ioctl.h
@@ -0,0 +1,115 @@
+#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETS 0x5401
+#define TCSETS 0x5402
+#define TCSETSW 0x5403
+#define TCSETSF 0x5404
+#define TCGETA 0x5405
+#define TCSETA 0x5406
+#define TCSETAW 0x5407
+#define TCSETAF 0x5408
+#define TCSBRK 0x5409
+#define TCXONC 0x540A
+#define TCFLSH 0x540B
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+#define TIOCGPGRP 0x540F
+#define TIOCSPGRP 0x5410
+#define TIOCOUTQ 0x5411
+#define TIOCSTI 0x5412
+#define TIOCGWINSZ 0x5413
+#define TIOCSWINSZ 0x5414
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define FIONREAD 0x541B
+#define TIOCINQ FIONREAD
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+#define FIONBIO 0x5421
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425
+#define TIOCSBRK 0x5427
+#define TIOCCBRK 0x5428
+#define TIOCGSID 0x5429
+#define TIOCGRS485 0x542E
+#define TIOCSRS485 0x542F
+#define TIOCGPTN 0x80045430
+#define TIOCSPTLCK 0x40045431
+#define TIOCGDEV 0x80045432
+#define TCGETX 0x5432
+#define TCSETX 0x5433
+#define TCSETXF 0x5434
+#define TCSETXW 0x5435
+#define TIOCSIG 0x40045436
+#define TIOCVHANGUP 0x5437
+#define TIOCGPKT 0x80045438
+#define TIOCGPTLCK 0x80045439
+#define TIOCGEXCL 0x80045440
+#define TIOCGPTPEER 0x5441
+#define TIOCGISO7816 0x80285442
+#define TIOCSISO7816 0xc0285443
+
+#define FIONCLEX 0x5450
+#define FIOCLEX 0x5451
+#define FIOASYNC 0x5452
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458
+#define TIOCSERGETLSR 0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT 0x545C
+#define TIOCGICOUNT 0x545D
+#define FIOQSIZE 0x5460
+
+#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
+
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#if __LONG_MAX == 0x7fffffff
+#define SIOCGSTAMP _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
+#else
+#define SIOCGSTAMP 0x8906
+#define SIOCGSTAMPNS 0x8907
+#endif
+
+#include <bits/ioctl_fix.h>
diff --git a/libc-top-half/musl/arch/generic/bits/ioctl_fix.h b/libc-top-half/musl/arch/generic/bits/ioctl_fix.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/ioctl_fix.h
diff --git a/libc-top-half/musl/arch/generic/bits/ipc.h b/libc-top-half/musl/arch/generic/bits/ipc.h
new file mode 100644
index 0000000..40d6f3a
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/ipc.h
@@ -0,0 +1,11 @@
+struct ipc_perm {
+ key_t __ipc_perm_key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ mode_t mode;
+ int __ipc_perm_seq;
+ long __pad1;
+ long __pad2;
+};
diff --git a/libc-top-half/musl/arch/generic/bits/ipcstat.h b/libc-top-half/musl/arch/generic/bits/ipcstat.h
new file mode 100644
index 0000000..0018ad1
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 2
diff --git a/libc-top-half/musl/arch/generic/bits/kd.h b/libc-top-half/musl/arch/generic/bits/kd.h
new file mode 100644
index 0000000..33b873f
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/kd.h
@@ -0,0 +1 @@
+#include <linux/kd.h>
diff --git a/libc-top-half/musl/arch/generic/bits/limits.h b/libc-top-half/musl/arch/generic/bits/limits.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/limits.h
diff --git a/libc-top-half/musl/arch/generic/bits/link.h b/libc-top-half/musl/arch/generic/bits/link.h
new file mode 100644
index 0000000..4a94d8f
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/link.h
@@ -0,0 +1 @@
+typedef uint32_t Elf_Symndx;
diff --git a/libc-top-half/musl/arch/generic/bits/mman.h b/libc-top-half/musl/arch/generic/bits/mman.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/mman.h
diff --git a/libc-top-half/musl/arch/generic/bits/msg.h b/libc-top-half/musl/arch/generic/bits/msg.h
new file mode 100644
index 0000000..2e23ca2
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/msg.h
@@ -0,0 +1,12 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+};
diff --git a/libc-top-half/musl/arch/generic/bits/poll.h b/libc-top-half/musl/arch/generic/bits/poll.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/poll.h
diff --git a/libc-top-half/musl/arch/generic/bits/ptrace.h b/libc-top-half/musl/arch/generic/bits/ptrace.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/ptrace.h
diff --git a/libc-top-half/musl/arch/generic/bits/resource.h b/libc-top-half/musl/arch/generic/bits/resource.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/resource.h
diff --git a/libc-top-half/musl/arch/generic/bits/sem.h b/libc-top-half/musl/arch/generic/bits/sem.h
new file mode 100644
index 0000000..5184eb5
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/sem.h
@@ -0,0 +1,14 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ time_t sem_otime;
+ time_t sem_ctime;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+#endif
+ long __unused3;
+ long __unused4;
+};
diff --git a/libc-top-half/musl/arch/generic/bits/shm.h b/libc-top-half/musl/arch/generic/bits/shm.h
new file mode 100644
index 0000000..8d19378
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/shm.h
@@ -0,0 +1,24 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/generic/bits/socket.h b/libc-top-half/musl/arch/generic/bits/socket.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/socket.h
diff --git a/libc-top-half/musl/arch/generic/bits/soundcard.h b/libc-top-half/musl/arch/generic/bits/soundcard.h
new file mode 100644
index 0000000..fade986
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/soundcard.h
@@ -0,0 +1 @@
+#include <linux/soundcard.h>
diff --git a/libc-top-half/musl/arch/generic/bits/statfs.h b/libc-top-half/musl/arch/generic/bits/statfs.h
new file mode 100644
index 0000000..f103f4e
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/statfs.h
@@ -0,0 +1,7 @@
+struct statfs {
+ unsigned long f_type, f_bsize;
+ fsblkcnt_t f_blocks, f_bfree, f_bavail;
+ fsfilcnt_t f_files, f_ffree;
+ fsid_t f_fsid;
+ unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
diff --git a/libc-top-half/musl/arch/generic/bits/termios.h b/libc-top-half/musl/arch/generic/bits/termios.h
new file mode 100644
index 0000000..124f71d
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/termios.h
@@ -0,0 +1,166 @@
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+ speed_t __c_ispeed;
+ speed_t __c_ospeed;
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define 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
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+#endif
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#define B0 0000000
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+
+#define ISIG 0000001
+#define ICANON 0000002
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#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
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA 0000016
+#define EXTB 0000017
+#define CBAUD 0010017
+#define CBAUDEX 0010000
+#define CIBAUD 002003600000
+#define CMSPAR 010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE 0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0010000
+#define PENDIN 0040000
+#define EXTPROC 0200000
+
+#define XTABS 0014000
+#endif
diff --git a/libc-top-half/musl/arch/generic/bits/vt.h b/libc-top-half/musl/arch/generic/bits/vt.h
new file mode 100644
index 0000000..834abfb
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/bits/vt.h
@@ -0,0 +1 @@
+#include <linux/vt.h>
diff --git a/libc-top-half/musl/arch/generic/fp_arch.h b/libc-top-half/musl/arch/generic/fp_arch.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/generic/fp_arch.h
diff --git a/libc-top-half/musl/arch/i386/arch.mak b/libc-top-half/musl/arch/i386/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/i386/atomic_arch.h b/libc-top-half/musl/arch/i386/atomic_arch.h
new file mode 100644
index 0000000..047fb68
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/atomic_arch.h
@@ -0,0 +1,108 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__ __volatile__ (
+ "lock ; cmpxchg %3, %1"
+ : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
+ return t;
+}
+
+#define a_swap a_swap
+static inline int a_swap(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "xchg %0, %1"
+ : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
+ return v;
+}
+
+#define a_fetch_add a_fetch_add
+static inline int a_fetch_add(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; xadd %0, %1"
+ : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
+ return v;
+}
+
+#define a_and a_and
+static inline void a_and(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; and %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_or a_or
+static inline void a_or(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; or %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_inc a_inc
+static inline void a_inc(volatile int *p)
+{
+ __asm__ __volatile__(
+ "lock ; incl %0"
+ : "=m"(*p) : "m"(*p) : "memory" );
+}
+
+#define a_dec a_dec
+static inline void a_dec(volatile int *p)
+{
+ __asm__ __volatile__(
+ "lock ; decl %0"
+ : "=m"(*p) : "m"(*p) : "memory" );
+}
+
+#define a_store a_store
+static inline void a_store(volatile int *p, int x)
+{
+ __asm__ __volatile__(
+ "mov %1, %0 ; lock ; orl $0,(%%esp)"
+ : "=m"(*p) : "r"(x) : "memory" );
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__( "" : : : "memory" );
+}
+
+#define a_spin a_spin
+static inline void a_spin()
+{
+ __asm__ __volatile__( "pause" : : : "memory" );
+}
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__( "hlt" : : : "memory" );
+}
+
+#define a_ctz_64 a_ctz_64
+static inline int a_ctz_64(uint64_t x)
+{
+ int r;
+ __asm__( "bsf %1,%0 ; jnz 1f ; bsf %2,%0 ; add $32,%0\n1:"
+ : "=&r"(r) : "r"((unsigned)x), "r"((unsigned)(x>>32)) );
+ return r;
+}
+
+#define a_ctz_32 a_ctz_32
+static inline int a_ctz_32(uint32_t x)
+{
+ int r;
+ __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
+ return r;
+}
+
+#define a_clz_32 a_clz_32
+static inline int a_clz_32(uint32_t x)
+{
+ __asm__( "bsr %1,%0 ; xor $31,%0" : "=r"(x) : "r"(x) );
+ return x;
+}
diff --git a/libc-top-half/musl/arch/i386/bits/alltypes.h.in b/libc-top-half/musl/arch/i386/bits/alltypes.h.in
new file mode 100644
index 0000000..6feb03a
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/alltypes.h.in
@@ -0,0 +1,31 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#define __BYTE_ORDER 1234
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+TYPEDEF __WCHAR_TYPE__ wchar_t;
+#else
+TYPEDEF long wchar_t;
+#endif
+#endif
+
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+#else
+TYPEDEF long double float_t;
+TYPEDEF long double double_t;
+#endif
+
+#if !defined(__cplusplus)
+TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
+#elif defined(__GNUC__)
+TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t;
+#else
+TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
+#endif
diff --git a/libc-top-half/musl/arch/i386/bits/fenv.h b/libc-top-half/musl/arch/i386/bits/fenv.h
new file mode 100644
index 0000000..4430009
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/fenv.h
@@ -0,0 +1,33 @@
+#define FE_INVALID 1
+#define __FE_DENORM 2
+#define FE_DIVBYZERO 4
+#define FE_OVERFLOW 8
+#define FE_UNDERFLOW 16
+#define FE_INEXACT 32
+
+#define FE_ALL_EXCEPT 63
+
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 0x400
+#define FE_UPWARD 0x800
+#define FE_TOWARDZERO 0xc00
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+ unsigned short __control_word;
+ unsigned short __unused1;
+ unsigned short __status_word;
+ unsigned short __unused2;
+ unsigned short __tags;
+ unsigned short __unused3;
+ unsigned int __eip;
+ unsigned short __cs_selector;
+ unsigned int __opcode:11;
+ unsigned int __unused4:5;
+ unsigned int __data_offset;
+ unsigned short __data_selector;
+ unsigned short __unused5;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/i386/bits/float.h b/libc-top-half/musl/arch/i386/bits/float.h
new file mode 100644
index 0000000..dd6e402
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 2
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN 3.3621031431120935063e-4932L
+#define LDBL_MAX 1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/libc-top-half/musl/arch/i386/bits/io.h b/libc-top-half/musl/arch/i386/bits/io.h
new file mode 100644
index 0000000..dd5bddc
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/io.h
@@ -0,0 +1,77 @@
+static __inline void outb(unsigned char __val, unsigned short __port)
+{
+ __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outw(unsigned short __val, unsigned short __port)
+{
+ __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outl(unsigned int __val, unsigned short __port)
+{
+ __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline unsigned char inb(unsigned short __port)
+{
+ unsigned char __val;
+ __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned short inw(unsigned short __port)
+{
+ unsigned short __val;
+ __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned int inl(unsigned short __port)
+{
+ unsigned int __val;
+ __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsb"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsw"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsl"
+ : "+S" (__buf), "+c"(__n)
+ : "d" (__port));
+}
+
+static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insb"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insw"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insl"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
diff --git a/libc-top-half/musl/arch/i386/bits/ipcstat.h b/libc-top-half/musl/arch/i386/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/i386/bits/limits.h b/libc-top-half/musl/arch/i386/bits/limits.h
new file mode 100644
index 0000000..07743b6
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/limits.h
@@ -0,0 +1 @@
+#define PAGESIZE 4096
diff --git a/libc-top-half/musl/arch/i386/bits/mman.h b/libc-top-half/musl/arch/i386/bits/mman.h
new file mode 100644
index 0000000..ba2d6f7
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/mman.h
@@ -0,0 +1 @@
+#define MAP_32BIT 0x40
diff --git a/libc-top-half/musl/arch/i386/bits/msg.h b/libc-top-half/musl/arch/i386/bits/msg.h
new file mode 100644
index 0000000..7bbbb2b
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/i386/bits/posix.h b/libc-top-half/musl/arch/i386/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/i386/bits/ptrace.h b/libc-top-half/musl/arch/i386/bits/ptrace.h
new file mode 100644
index 0000000..7d0efbf
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/ptrace.h
@@ -0,0 +1,11 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_SYSEMU 31
+#define PTRACE_SYSEMU_SINGLESTEP 32
+#define PTRACE_SINGLEBLOCK 33
+
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+#define PT_SYSEMU PTRACE_SYSEMU
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/libc-top-half/musl/arch/i386/bits/reg.h b/libc-top-half/musl/arch/i386/bits/reg.h
new file mode 100644
index 0000000..8bc2582
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/reg.h
@@ -0,0 +1,19 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+#define EBX 0
+#define ECX 1
+#define EDX 2
+#define ESI 3
+#define EDI 4
+#define EBP 5
+#define EAX 6
+#define DS 7
+#define ES 8
+#define FS 9
+#define GS 10
+#define ORIG_EAX 11
+#define EIP 12
+#define CS 13
+#define EFL 14
+#define UESP 15
+#define SS 16
diff --git a/libc-top-half/musl/arch/i386/bits/sem.h b/libc-top-half/musl/arch/i386/bits/sem.h
new file mode 100644
index 0000000..6566154
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/sem.h
@@ -0,0 +1,13 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned long __sem_ctime_hi;
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/i386/bits/setjmp.h b/libc-top-half/musl/arch/i386/bits/setjmp.h
new file mode 100644
index 0000000..decd26d
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[6];
diff --git a/libc-top-half/musl/arch/i386/bits/shm.h b/libc-top-half/musl/arch/i386/bits/shm.h
new file mode 100644
index 0000000..725fb46
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __shm_ctime_hi;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+ unsigned long __pad3;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/i386/bits/signal.h b/libc-top-half/musl/arch/i386/bits/signal.h
new file mode 100644
index 0000000..9931ee9
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/signal.h
@@ -0,0 +1,142 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#ifdef _GNU_SOURCE
+enum { REG_GS = 0 };
+#define REG_GS REG_GS
+enum { REG_FS = 1 };
+#define REG_FS REG_FS
+enum { REG_ES = 2 };
+#define REG_ES REG_ES
+enum { REG_DS = 3 };
+#define REG_DS REG_DS
+enum { REG_EDI = 4 };
+#define REG_EDI REG_EDI
+enum { REG_ESI = 5 };
+#define REG_ESI REG_ESI
+enum { REG_EBP = 6 };
+#define REG_EBP REG_EBP
+enum { REG_ESP = 7 };
+#define REG_ESP REG_ESP
+enum { REG_EBX = 8 };
+#define REG_EBX REG_EBX
+enum { REG_EDX = 9 };
+#define REG_EDX REG_EDX
+enum { REG_ECX = 10 };
+#define REG_ECX REG_ECX
+enum { REG_EAX = 11 };
+#define REG_EAX REG_EAX
+enum { REG_TRAPNO = 12 };
+#define REG_TRAPNO REG_TRAPNO
+enum { REG_ERR = 13 };
+#define REG_ERR REG_ERR
+enum { REG_EIP = 14 };
+#define REG_EIP REG_EIP
+enum { REG_CS = 15 };
+#define REG_CS REG_CS
+enum { REG_EFL = 16 };
+#define REG_EFL REG_EFL
+enum { REG_UESP = 17 };
+#define REG_UESP REG_UESP
+enum { REG_SS = 18 };
+#define REG_SS REG_SS
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef int greg_t, gregset_t[19];
+typedef struct _fpstate {
+ unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel;
+ struct {
+ unsigned short significand[4], exponent;
+ } _st[8];
+ unsigned long status;
+} *fpregset_t;
+struct sigcontext {
+ unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
+ unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
+ unsigned long trapno, err, eip;
+ unsigned short cs, __csh;
+ unsigned long eflags, esp_at_signal;
+ unsigned short ss, __ssh;
+ struct _fpstate *fpstate;
+ unsigned long oldmask, cr2;
+};
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ unsigned long oldmask, cr2;
+} mcontext_t;
+#else
+typedef struct {
+ unsigned __space[22];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ unsigned long __fpregs_mem[28];
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
+
diff --git a/libc-top-half/musl/arch/i386/bits/stat.h b/libc-top-half/musl/arch/i386/bits/stat.h
new file mode 100644
index 0000000..5d7828c
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ int __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ ino_t st_ino;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/i386/bits/stdint.h b/libc-top-half/musl/arch/i386/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/i386/bits/syscall.h.in b/libc-top-half/musl/arch/i386/bits/syscall.h.in
new file mode 100644
index 0000000..46ffe1d
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/syscall.h.in
@@ -0,0 +1,439 @@
+#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 /* Back compatible 2Gig limited rlimit */
+#define __NR_getrusage 77
+#define __NR_gettimeofday_time32 78
+#define __NR_settimeofday_time32 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_getpmsg 188
+#define __NR_putpmsg 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
+/* 223 is unused */
+#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
+/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
+#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_settime32 (__NR_timer_create+1)
+#define __NR_timer_gettime32 (__NR_timer_create+2)
+#define __NR_timer_getoverrun (__NR_timer_create+3)
+#define __NR_timer_delete (__NR_timer_create+4)
+#define __NR_clock_settime32 (__NR_timer_create+5)
+#define __NR_clock_gettime32 (__NR_timer_create+6)
+#define __NR_clock_getres_time32 (__NR_timer_create+7)
+#define __NR_clock_nanosleep_time32 (__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_sys_setaltroot 285 */
+#define __NR_add_key 286
+#define __NR_request_key 287
+#define __NR_keyctl 288
+#define __NR_ioprio_set 289
+#define __NR_ioprio_get 290
+#define __NR_inotify_init 291
+#define __NR_inotify_add_watch 292
+#define __NR_inotify_rm_watch 293
+#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_settime32 325
+#define __NR_timerfd_gettime32 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_preadv 333
+#define __NR_pwritev 334
+#define __NR_rt_tgsigqueueinfo 335
+#define __NR_perf_event_open 336
+#define __NR_recvmmsg 337
+#define __NR_fanotify_init 338
+#define __NR_fanotify_mark 339
+#define __NR_prlimit64 340
+#define __NR_name_to_handle_at 341
+#define __NR_open_by_handle_at 342
+#define __NR_clock_adjtime 343
+#define __NR_syncfs 344
+#define __NR_sendmmsg 345
+#define __NR_setns 346
+#define __NR_process_vm_readv 347
+#define __NR_process_vm_writev 348
+#define __NR_kcmp 349
+#define __NR_finit_module 350
+#define __NR_sched_setattr 351
+#define __NR_sched_getattr 352
+#define __NR_renameat2 353
+#define __NR_seccomp 354
+#define __NR_getrandom 355
+#define __NR_memfd_create 356
+#define __NR_bpf 357
+#define __NR_execveat 358
+#define __NR_socket 359
+#define __NR_socketpair 360
+#define __NR_bind 361
+#define __NR_connect 362
+#define __NR_listen 363
+#define __NR_accept4 364
+#define __NR_getsockopt 365
+#define __NR_setsockopt 366
+#define __NR_getsockname 367
+#define __NR_getpeername 368
+#define __NR_sendto 369
+#define __NR_sendmsg 370
+#define __NR_recvfrom 371
+#define __NR_recvmsg 372
+#define __NR_shutdown 373
+#define __NR_userfaultfd 374
+#define __NR_membarrier 375
+#define __NR_mlock2 376
+#define __NR_copy_file_range 377
+#define __NR_preadv2 378
+#define __NR_pwritev2 379
+#define __NR_pkey_mprotect 380
+#define __NR_pkey_alloc 381
+#define __NR_pkey_free 382
+#define __NR_statx 383
+#define __NR_arch_prctl 384
+#define __NR_io_pgetevents 385
+#define __NR_rseq 386
+#define __NR_semget 393
+#define __NR_semctl 394
+#define __NR_shmget 395
+#define __NR_shmctl 396
+#define __NR_shmat 397
+#define __NR_shmdt 398
+#define __NR_msgget 399
+#define __NR_msgsnd 400
+#define __NR_msgrcv 401
+#define __NR_msgctl 402
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/i386/bits/user.h b/libc-top-half/musl/arch/i386/bits/user.h
new file mode 100644
index 0000000..33fea98
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/bits/user.h
@@ -0,0 +1,44 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+
+typedef struct user_fpregs_struct {
+ long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
+} elf_fpregset_t;
+
+typedef struct user_fpxregs_struct {
+ unsigned short cwd, swd, twd, fop;
+ long fip, fcs, foo, fos, mxcsr, reserved;
+ long st_space[32], xmm_space[32], padding[56];
+} elf_fpxregset_t;
+
+struct user_regs_struct {
+ long ebx, ecx, edx, esi, edi, ebp, eax, xds, xes, xfs, xgs;
+ long orig_eax, eip, xcs, eflags, esp, xss;
+};
+
+#define ELF_NGREG 17
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+ struct user_regs_struct regs;
+ int u_fpvalid;
+ struct user_fpregs_struct i387;
+ unsigned long u_tsize;
+ unsigned long u_dsize;
+ unsigned long u_ssize;
+ unsigned long start_code;
+ unsigned long start_stack;
+ long signal;
+ int reserved;
+ struct user_regs_struct *u_ar0;
+ struct user_fpregs_struct *u_fpstate;
+ unsigned long magic;
+ char u_comm[32];
+ int u_debugreg[8];
+};
+
+#define PAGE_MASK (~(PAGESIZE-1))
+#define NBPG PAGESIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
diff --git a/libc-top-half/musl/arch/i386/crt_arch.h b/libc-top-half/musl/arch/i386/crt_arch.h
new file mode 100644
index 0000000..43c8477
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/crt_arch.h
@@ -0,0 +1,16 @@
+__asm__(
+".text\n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+".global " START "\n"
+START ":\n"
+" xor %ebp,%ebp \n"
+" mov %esp,%eax \n"
+" and $-16,%esp \n"
+" push %eax \n"
+" push %eax \n"
+" call 1f \n"
+"1: addl $_DYNAMIC-1b,(%esp) \n"
+" push %eax \n"
+" call " START "_c \n"
+);
diff --git a/libc-top-half/musl/arch/i386/kstat.h b/libc-top-half/musl/arch/i386/kstat.h
new file mode 100644
index 0000000..af449c9
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ int __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ ino_t st_ino;
+};
diff --git a/libc-top-half/musl/arch/i386/pthread_arch.h b/libc-top-half/musl/arch/i386/pthread_arch.h
new file mode 100644
index 0000000..a639c38
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/pthread_arch.h
@@ -0,0 +1,8 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ("movl %%gs:0,%0" : "=r" (tp) );
+ return tp;
+}
+
+#define MC_PC gregs[REG_EIP]
diff --git a/libc-top-half/musl/arch/i386/reloc.h b/libc-top-half/musl/arch/i386/reloc.h
new file mode 100644
index 0000000..032f454
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/reloc.h
@@ -0,0 +1,23 @@
+#define LDSO_ARCH "i386"
+
+#define REL_SYMBOLIC R_386_32
+#define REL_OFFSET R_386_PC32
+#define REL_GOT R_386_GLOB_DAT
+#define REL_PLT R_386_JMP_SLOT
+#define REL_RELATIVE R_386_RELATIVE
+#define REL_COPY R_386_COPY
+#define REL_DTPMOD R_386_TLS_DTPMOD32
+#define REL_DTPOFF R_386_TLS_DTPOFF32
+#define REL_TPOFF R_386_TLS_TPOFF
+#define REL_TPOFF_NEG R_386_TLS_TPOFF32
+#define REL_TLSDESC R_386_TLS_DESC
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov %1,%%esp ; jmp *%0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ " call 1f\n" \
+ "1: addl $" #sym "-.,(%%esp)\n" \
+ " pop %0" \
+ : "=r"(*fp) : : "memory" )
diff --git a/libc-top-half/musl/arch/i386/syscall_arch.h b/libc-top-half/musl/arch/i386/syscall_arch.h
new file mode 100644
index 0000000..f92b7aa
--- /dev/null
+++ b/libc-top-half/musl/arch/i386/syscall_arch.h
@@ -0,0 +1,89 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
+
+#if SYSCALL_NO_TLS
+#define SYSCALL_INSNS "int $128"
+#else
+#define SYSCALL_INSNS "call *%%gs:16"
+#endif
+
+#define SYSCALL_INSNS_12 "xchg %%ebx,%%edx ; " SYSCALL_INSNS " ; xchg %%ebx,%%edx"
+#define SYSCALL_INSNS_34 "xchg %%ebx,%%edi ; " SYSCALL_INSNS " ; xchg %%ebx,%%edi"
+
+static inline long __syscall0(long n)
+{
+ unsigned long __ret;
+ __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n) : "memory");
+ return __ret;
+}
+
+static inline long __syscall1(long n, long a1)
+{
+ unsigned long __ret;
+ __asm__ __volatile__ (SYSCALL_INSNS_12 : "=a"(__ret) : "a"(n), "d"(a1) : "memory");
+ return __ret;
+}
+
+static inline long __syscall2(long n, long a1, long a2)
+{
+ unsigned long __ret;
+ __asm__ __volatile__ (SYSCALL_INSNS_12 : "=a"(__ret) : "a"(n), "d"(a1), "c"(a2) : "memory");
+ return __ret;
+}
+
+static inline long __syscall3(long n, long a1, long a2, long a3)
+{
+ unsigned long __ret;
+#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM)
+ __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3) : "memory");
+#else
+ __asm__ __volatile__ (SYSCALL_INSNS_34 : "=a"(__ret) : "a"(n), "D"(a1), "c"(a2), "d"(a3) : "memory");
+#endif
+ return __ret;
+}
+
+static inline long __syscall4(long n, long a1, long a2, long a3, long a4)
+{
+ unsigned long __ret;
+#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM)
+ __asm__ __volatile__ (SYSCALL_INSNS : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4) : "memory");
+#else
+ __asm__ __volatile__ (SYSCALL_INSNS_34 : "=a"(__ret) : "a"(n), "D"(a1), "c"(a2), "d"(a3), "S"(a4) : "memory");
+#endif
+ return __ret;
+}
+
+static inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
+{
+ unsigned long __ret;
+#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM)
+ __asm__ __volatile__ (SYSCALL_INSNS
+ : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory");
+#else
+ __asm__ __volatile__ ("pushl %2 ; push %%ebx ; mov 4(%%esp),%%ebx ; " SYSCALL_INSNS " ; pop %%ebx ; add $4,%%esp"
+ : "=a"(__ret) : "a"(n), "g"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory");
+#endif
+ return __ret;
+}
+
+static inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
+{
+ unsigned long __ret;
+#if !defined(__PIC__) || !defined(BROKEN_EBX_ASM)
+ __asm__ __volatile__ ("pushl %7 ; push %%ebp ; mov 4(%%esp),%%ebp ; " SYSCALL_INSNS " ; pop %%ebp ; add $4,%%esp"
+ : "=a"(__ret) : "a"(n), "b"(a1), "c"(a2), "d"(a3), "S"(a4), "D"(a5), "g"(a6) : "memory");
+#else
+ unsigned long a1a6[2] = { a1, a6 };
+ __asm__ __volatile__ ("pushl %1 ; push %%ebx ; push %%ebp ; mov 8(%%esp),%%ebx ; mov 4(%%ebx),%%ebp ; mov (%%ebx),%%ebx ; " SYSCALL_INSNS " ; pop %%ebp ; pop %%ebx ; add $4,%%esp"
+ : "=a"(__ret) : "g"(&a1a6), "a"(n), "c"(a2), "d"(a3), "S"(a4), "D"(a5) : "memory");
+#endif
+ return __ret;
+}
+
+#define VDSO_USEFUL
+#define VDSO_CGT32_SYM "__vdso_clock_gettime"
+#define VDSO_CGT32_VER "LINUX_2.6"
+#define VDSO_CGT_SYM "__vdso_clock_gettime64"
+#define VDSO_CGT_VER "LINUX_2.6"
diff --git a/libc-top-half/musl/arch/m68k/arch.mak b/libc-top-half/musl/arch/m68k/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/m68k/atomic_arch.h b/libc-top-half/musl/arch/m68k/atomic_arch.h
new file mode 100644
index 0000000..b369649
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/atomic_arch.h
@@ -0,0 +1,8 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__ __volatile__ (
+ "cas.l %0, %2, (%1)"
+ : "+d"(t) : "a"(p), "d"(s) : "memory", "cc");
+ return t;
+}
diff --git a/libc-top-half/musl/arch/m68k/bits/alltypes.h.in b/libc-top-half/musl/arch/m68k/bits/alltypes.h.in
new file mode 100644
index 0000000..f564690
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/alltypes.h.in
@@ -0,0 +1,25 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#define __BYTE_ORDER 4321
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+TYPEDEF __WCHAR_TYPE__ wchar_t;
+#else
+TYPEDEF long wchar_t;
+#endif
+#endif
+
+#if __mcffpu__
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+#else
+TYPEDEF long double float_t;
+TYPEDEF long double double_t;
+#endif
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/m68k/bits/fcntl.h b/libc-top-half/musl/arch/m68k/bits/fcntl.h
new file mode 100644
index 0000000..f1c8400
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 040000
+#define O_NOFOLLOW 0100000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 0200000
+#define O_LARGEFILE 0400000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/m68k/bits/fenv.h b/libc-top-half/musl/arch/m68k/bits/fenv.h
new file mode 100644
index 0000000..c90a4a5
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/fenv.h
@@ -0,0 +1,29 @@
+#if __HAVE_68881__ || __mcffpu__
+
+#define FE_INEXACT 8
+#define FE_DIVBYZERO 16
+#define FE_UNDERFLOW 32
+#define FE_OVERFLOW 64
+#define FE_INVALID 128
+
+#define FE_ALL_EXCEPT 0xf8
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 16
+#define FE_DOWNWARD 32
+#define FE_UPWARD 48
+
+#else
+
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+
+#endif
+
+typedef unsigned fexcept_t;
+
+typedef struct {
+ unsigned __control_register, __status_register, __instruction_address;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/m68k/bits/float.h b/libc-top-half/musl/arch/m68k/bits/float.h
new file mode 100644
index 0000000..0e6899d
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/float.h
@@ -0,0 +1,39 @@
+#if !__mcffpu__
+
+#define FLT_EVAL_METHOD 2
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN 1.68105157155604675313e-4932L
+#define LDBL_MAX 1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16382)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
+
+#else
+
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
+
+#endif
diff --git a/libc-top-half/musl/arch/m68k/bits/ipcstat.h b/libc-top-half/musl/arch/m68k/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/m68k/bits/msg.h b/libc-top-half/musl/arch/m68k/bits/msg.h
new file mode 100644
index 0000000..7bbbb2b
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/m68k/bits/posix.h b/libc-top-half/musl/arch/m68k/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/m68k/bits/ptrace.h b/libc-top-half/musl/arch/m68k/bits/ptrace.h
new file mode 100644
index 0000000..da93e7a
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/ptrace.h
@@ -0,0 +1,2 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SINGLEBLOCK 33
diff --git a/libc-top-half/musl/arch/m68k/bits/reg.h b/libc-top-half/musl/arch/m68k/bits/reg.h
new file mode 100644
index 0000000..99201f7
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/reg.h
@@ -0,0 +1,45 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+#define PT_D1 0
+#define PT_D2 1
+#define PT_D3 2
+#define PT_D4 3
+#define PT_D5 4
+#define PT_D6 5
+#define PT_D7 6
+#define PT_A0 7
+#define PT_A1 8
+#define PT_A2 9
+#define PT_A3 10
+#define PT_A4 11
+#define PT_A5 12
+#define PT_A6 13
+#define PT_D0 14
+#define PT_USP 15
+#define PT_ORIG_D0 16
+#define PT_SR 17
+#define PT_PC 18
+
+#if __mcffpu__
+#define PT_FP0 21
+#define PT_FP1 23
+#define PT_FP2 25
+#define PT_FP3 27
+#define PT_FP4 29
+#define PT_FP5 31
+#define PT_FP6 33
+#define PT_FP7 35
+#else
+#define PT_FP0 21
+#define PT_FP1 24
+#define PT_FP2 27
+#define PT_FP3 30
+#define PT_FP4 33
+#define PT_FP5 36
+#define PT_FP6 39
+#define PT_FP7 42
+#endif
+
+#define PT_FPCR 45
+#define PT_FPSR 46
+#define PT_FPIAR 47
diff --git a/libc-top-half/musl/arch/m68k/bits/sem.h b/libc-top-half/musl/arch/m68k/bits/sem.h
new file mode 100644
index 0000000..d88338e
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/sem.h
@@ -0,0 +1,13 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned long __sem_ctime_hi;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/m68k/bits/setjmp.h b/libc-top-half/musl/arch/m68k/bits/setjmp.h
new file mode 100644
index 0000000..5e091fb
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[39];
diff --git a/libc-top-half/musl/arch/m68k/bits/shm.h b/libc-top-half/musl/arch/m68k/bits/shm.h
new file mode 100644
index 0000000..725fb46
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __shm_ctime_hi;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+ unsigned long __pad3;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/m68k/bits/signal.h b/libc-top-half/musl/arch/m68k/bits/signal.h
new file mode 100644
index 0000000..2c369ca
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/signal.h
@@ -0,0 +1,140 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#ifdef _GNU_SOURCE
+enum { R_D0 = 0 };
+#define R_D0 R_D0
+enum { R_D1 = 1 };
+#define R_D1 R_D1
+enum { R_D2 = 2 };
+#define R_D2 R_D2
+enum { R_D3 = 3 };
+#define R_D3 R_D3
+enum { R_D4 = 4 };
+#define R_D4 R_D4
+enum { R_D5 = 5 };
+#define R_D5 R_D5
+enum { R_D6 = 6 };
+#define R_D6 R_D6
+enum { R_D7 = 7 };
+#define R_D7 R_D7
+enum { R_A0 = 8 };
+#define R_A0 R_A0
+enum { R_A1 = 9 };
+#define R_A1 R_A1
+enum { R_A2 = 10 };
+#define R_A2 R_A2
+enum { R_A3 = 11 };
+#define R_A3 R_A3
+enum { R_A4 = 12 };
+#define R_A4 R_A4
+enum { R_A5 = 13 };
+#define R_A5 R_A5
+enum { R_A6 = 14 };
+#define R_A6 R_A6
+enum { R_A7 = 15 };
+#define R_A7 R_A7
+enum { R_SP = 15 };
+#define R_SP R_SP
+enum { R_PC = 16 };
+#define R_PC R_PC
+enum { R_PS = 17 };
+#define R_PS R_PS
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+struct sigcontext {
+ unsigned long sc_mask, sc_usp, sc_d0, sc_d1, sc_a0, sc_a1;
+ unsigned short sc_sr;
+ unsigned long sc_pc;
+ unsigned short sc_formatvec;
+ unsigned long sc_fpregs[6], sc_fpcntl[3];
+ unsigned char sc_fpstate[216];
+};
+
+typedef int greg_t, gregset_t[18];
+typedef struct {
+ int f_pcr, f_psr, f_fpiaddr, f_fpregs[8][3];
+} fpregset_t;
+
+typedef struct {
+ int version;
+ gregset_t gregs;
+ fpregset_t fpregs;
+} mcontext_t;
+#else
+typedef struct {
+ int __version;
+ int __gregs[18];
+ int __fpregs[27];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ long __reserved[80];
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/m68k/bits/stat.h b/libc-top-half/musl/arch/m68k/bits/stat.h
new file mode 100644
index 0000000..f876814
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ short __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ short __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ ino_t st_ino;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/m68k/bits/stdint.h b/libc-top-half/musl/arch/m68k/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/m68k/bits/syscall.h.in b/libc-top-half/musl/arch/m68k/bits/syscall.h.in
new file mode 100644
index 0000000..a0c6332
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/syscall.h.in
@@ -0,0 +1,418 @@
+#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_chown 16
+#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_access 33
+#define __NR_nice 34
+#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_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_ioctl 54
+#define __NR_fcntl 55
+#define __NR_setpgid 57
+#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_time32 78
+#define __NR_settimeofday_time32 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_statfs 99
+#define __NR_fstatfs 100
+#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_vhangup 111
+#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_cacheflush 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_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_getpagesize 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_lchown 182
+#define __NR_getcwd 183
+#define __NR_capget 184
+#define __NR_capset 185
+#define __NR_sigaltstack 186
+#define __NR_sendfile 187
+#define __NR_getpmsg 188
+#define __NR_putpmsg 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_chown32 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_lchown32 212
+#define __NR_setuid32 213
+#define __NR_setgid32 214
+#define __NR_setfsuid32 215
+#define __NR_setfsgid32 216
+#define __NR_pivot_root 217
+#define __NR_getdents64 220
+#define __NR_gettid 221
+#define __NR_tkill 222
+#define __NR_setxattr 223
+#define __NR_lsetxattr 224
+#define __NR_fsetxattr 225
+#define __NR_getxattr 226
+#define __NR_lgetxattr 227
+#define __NR_fgetxattr 228
+#define __NR_listxattr 229
+#define __NR_llistxattr 230
+#define __NR_flistxattr 231
+#define __NR_removexattr 232
+#define __NR_lremovexattr 233
+#define __NR_fremovexattr 234
+#define __NR_futex 235
+#define __NR_sendfile64 236
+#define __NR_mincore 237
+#define __NR_madvise 238
+#define __NR_fcntl64 239
+#define __NR_readahead 240
+#define __NR_io_setup 241
+#define __NR_io_destroy 242
+#define __NR_io_getevents 243
+#define __NR_io_submit 244
+#define __NR_io_cancel 245
+#define __NR_fadvise64 246
+#define __NR_exit_group 247
+#define __NR_lookup_dcookie 248
+#define __NR_epoll_create 249
+#define __NR_epoll_ctl 250
+#define __NR_epoll_wait 251
+#define __NR_remap_file_pages 252
+#define __NR_set_tid_address 253
+#define __NR_timer_create 254
+#define __NR_timer_settime32 255
+#define __NR_timer_gettime32 256
+#define __NR_timer_getoverrun 257
+#define __NR_timer_delete 258
+#define __NR_clock_settime32 259
+#define __NR_clock_gettime32 260
+#define __NR_clock_getres_time32 261
+#define __NR_clock_nanosleep_time32 262
+#define __NR_statfs64 263
+#define __NR_fstatfs64 264
+#define __NR_tgkill 265
+#define __NR_utimes 266
+#define __NR_fadvise64_64 267
+#define __NR_mbind 268
+#define __NR_get_mempolicy 269
+#define __NR_set_mempolicy 270
+#define __NR_mq_open 271
+#define __NR_mq_unlink 272
+#define __NR_mq_timedsend 273
+#define __NR_mq_timedreceive 274
+#define __NR_mq_notify 275
+#define __NR_mq_getsetattr 276
+#define __NR_waitid 277
+#define __NR_add_key 279
+#define __NR_request_key 280
+#define __NR_keyctl 281
+#define __NR_ioprio_set 282
+#define __NR_ioprio_get 283
+#define __NR_inotify_init 284
+#define __NR_inotify_add_watch 285
+#define __NR_inotify_rm_watch 286
+#define __NR_migrate_pages 287
+#define __NR_openat 288
+#define __NR_mkdirat 289
+#define __NR_mknodat 290
+#define __NR_fchownat 291
+#define __NR_futimesat 292
+#define __NR_fstatat64 293
+#define __NR_unlinkat 294
+#define __NR_renameat 295
+#define __NR_linkat 296
+#define __NR_symlinkat 297
+#define __NR_readlinkat 298
+#define __NR_fchmodat 299
+#define __NR_faccessat 300
+#define __NR_pselect6 301
+#define __NR_ppoll 302
+#define __NR_unshare 303
+#define __NR_set_robust_list 304
+#define __NR_get_robust_list 305
+#define __NR_splice 306
+#define __NR_sync_file_range 307
+#define __NR_tee 308
+#define __NR_vmsplice 309
+#define __NR_move_pages 310
+#define __NR_sched_setaffinity 311
+#define __NR_sched_getaffinity 312
+#define __NR_kexec_load 313
+#define __NR_getcpu 314
+#define __NR_epoll_pwait 315
+#define __NR_utimensat 316
+#define __NR_signalfd 317
+#define __NR_timerfd_create 318
+#define __NR_eventfd 319
+#define __NR_fallocate 320
+#define __NR_timerfd_settime32 321
+#define __NR_timerfd_gettime32 322
+#define __NR_signalfd4 323
+#define __NR_eventfd2 324
+#define __NR_epoll_create1 325
+#define __NR_dup3 326
+#define __NR_pipe2 327
+#define __NR_inotify_init1 328
+#define __NR_preadv 329
+#define __NR_pwritev 330
+#define __NR_rt_tgsigqueueinfo 331
+#define __NR_perf_event_open 332
+#define __NR_get_thread_area 333
+#define __NR_set_thread_area 334
+#define __NR_atomic_cmpxchg_32 335
+#define __NR_atomic_barrier 336
+#define __NR_fanotify_init 337
+#define __NR_fanotify_mark 338
+#define __NR_prlimit64 339
+#define __NR_name_to_handle_at 340
+#define __NR_open_by_handle_at 341
+#define __NR_clock_adjtime 342
+#define __NR_syncfs 343
+#define __NR_setns 344
+#define __NR_process_vm_readv 345
+#define __NR_process_vm_writev 346
+#define __NR_kcmp 347
+#define __NR_finit_module 348
+#define __NR_sched_setattr 349
+#define __NR_sched_getattr 350
+#define __NR_renameat2 351
+#define __NR_getrandom 352
+#define __NR_memfd_create 353
+#define __NR_bpf 354
+#define __NR_execveat 355
+#define __NR_socket 356
+#define __NR_socketpair 357
+#define __NR_bind 358
+#define __NR_connect 359
+#define __NR_listen 360
+#define __NR_accept4 361
+#define __NR_getsockopt 362
+#define __NR_setsockopt 363
+#define __NR_getsockname 364
+#define __NR_getpeername 365
+#define __NR_sendto 366
+#define __NR_sendmsg 367
+#define __NR_recvfrom 368
+#define __NR_recvmsg 369
+#define __NR_shutdown 370
+#define __NR_recvmmsg 371
+#define __NR_sendmmsg 372
+#define __NR_userfaultfd 373
+#define __NR_membarrier 374
+#define __NR_mlock2 375
+#define __NR_copy_file_range 376
+#define __NR_preadv2 377
+#define __NR_pwritev2 378
+#define __NR_statx 379
+#define __NR_seccomp 380
+#define __NR_pkey_mprotect 381
+#define __NR_pkey_alloc 382
+#define __NR_pkey_free 383
+#define __NR_rseq 384
+#define __NR_semget 393
+#define __NR_semctl 394
+#define __NR_shmget 395
+#define __NR_shmctl 396
+#define __NR_shmat 397
+#define __NR_shmdt 398
+#define __NR_msgget 399
+#define __NR_msgsnd 400
+#define __NR_msgrcv 401
+#define __NR_msgctl 402
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
diff --git a/libc-top-half/musl/arch/m68k/bits/user.h b/libc-top-half/musl/arch/m68k/bits/user.h
new file mode 100644
index 0000000..6a44391
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/bits/user.h
@@ -0,0 +1,38 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+
+struct user_m68kfp_struct {
+ unsigned long fpregs[24], fpcntl[3];
+};
+
+struct user_regs_struct {
+ long d1, d2, d3, d4, d5, d6, d7;
+ long a0, a1, a2, a3, a4, a5, a6;
+ long d0, usp, orig_d0;
+ short stkadj, sr;
+ long pc;
+ short fmtvec, __pad;
+};
+
+struct user {
+ struct user_regs_struct regs;
+ int u_fpvalid;
+ struct user_m68kfp_struct m68kfp;
+ unsigned long u_tsize, u_dsize, u_ssize, start_code, start_stack;
+ long signal;
+ int reserved;
+ unsigned long u_ar0;
+ struct user_m68kfp_struct *u_fpstate;
+ unsigned long magic;
+ char u_comm[32];
+};
+
+#define ELF_NGREG 20
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+typedef struct user_m68kfp_struct elf_fpregset_t;
+
+#define NBPG 4096
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
diff --git a/libc-top-half/musl/arch/m68k/crt_arch.h b/libc-top-half/musl/arch/m68k/crt_arch.h
new file mode 100644
index 0000000..48a42f2
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/crt_arch.h
@@ -0,0 +1,14 @@
+__asm__(
+".text\n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+".global " START "\n"
+START ":\n"
+" suba.l %fp,%fp \n"
+" movea.l %sp,%a0 \n"
+" lea _DYNAMIC-.-8,%a1 \n"
+" pea (%pc,%a1) \n"
+" pea (%a0) \n"
+" lea " START "_c-.-8,%a1 \n"
+" jsr (%pc,%a1) \n"
+);
diff --git a/libc-top-half/musl/arch/m68k/kstat.h b/libc-top-half/musl/arch/m68k/kstat.h
new file mode 100644
index 0000000..ac13e27
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ short __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ short __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ ino_t st_ino;
+};
diff --git a/libc-top-half/musl/arch/m68k/pthread_arch.h b/libc-top-half/musl/arch/m68k/pthread_arch.h
new file mode 100644
index 0000000..5bea4e1
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/pthread_arch.h
@@ -0,0 +1,12 @@
+static inline uintptr_t __get_tp()
+{
+ return __syscall(SYS_get_thread_area);
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+#define MC_PC gregs[R_PC]
diff --git a/libc-top-half/musl/arch/m68k/reloc.h b/libc-top-half/musl/arch/m68k/reloc.h
new file mode 100644
index 0000000..f920b39
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/reloc.h
@@ -0,0 +1,30 @@
+#if __HAVE_68881__
+#define FP_SUFFIX ""
+#elif __mcffpu__
+#define FP_SUFFIX "-fp64"
+#else
+#define FP_SUFFIX "-sf"
+#endif
+
+#define LDSO_ARCH "m68k" FP_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+#define REL_SYMBOLIC R_68K_32
+#define REL_OFFSET R_68K_PC32
+#define REL_GOT R_68K_GLOB_DAT
+#define REL_PLT R_68K_JMP_SLOT
+#define REL_RELATIVE R_68K_RELATIVE
+#define REL_COPY R_68K_COPY
+#define REL_DTPMOD R_68K_TLS_DTPMOD32
+#define REL_DTPOFF R_68K_TLS_DTPREL32
+#define REL_TPOFF R_68K_TLS_TPREL32
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "move.l %1,%%sp ; jmp (%0)" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ "lea " #sym "-.-8,%0 \n" \
+ "lea (%%pc,%0),%0 \n" \
+ : "=a"(*fp) : : "memory" )
diff --git a/libc-top-half/musl/arch/m68k/syscall_arch.h b/libc-top-half/musl/arch/m68k/syscall_arch.h
new file mode 100644
index 0000000..6a9d0ae
--- /dev/null
+++ b/libc-top-half/musl/arch/m68k/syscall_arch.h
@@ -0,0 +1,90 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
+
+static __inline long __syscall0(long n)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ :
+ : "memory");
+ return d0;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ register unsigned long d1 __asm__("d1") = a;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ : "r"(d1)
+ : "memory");
+ return d0;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ register unsigned long d1 __asm__("d1") = a;
+ register unsigned long d2 __asm__("d2") = b;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ : "r"(d1), "r"(d2)
+ : "memory");
+ return d0;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ register unsigned long d1 __asm__("d1") = a;
+ register unsigned long d2 __asm__("d2") = b;
+ register unsigned long d3 __asm__("d3") = c;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ : "r"(d1), "r"(d2), "r"(d3)
+ : "memory");
+ return d0;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ register unsigned long d1 __asm__("d1") = a;
+ register unsigned long d2 __asm__("d2") = b;
+ register unsigned long d3 __asm__("d3") = c;
+ register unsigned long d4 __asm__("d4") = d;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ : "r"(d1), "r"(d2), "r"(d3), "r"(d4)
+ : "memory");
+ return d0;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ register unsigned long d1 __asm__("d1") = a;
+ register unsigned long d2 __asm__("d2") = b;
+ register unsigned long d3 __asm__("d3") = c;
+ register unsigned long d4 __asm__("d4") = d;
+ register unsigned long d5 __asm__("d5") = e;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ : "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5)
+ : "memory");
+ return d0;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register unsigned long d0 __asm__("d0") = n;
+ register unsigned long d1 __asm__("d1") = a;
+ register unsigned long d2 __asm__("d2") = b;
+ register unsigned long d3 __asm__("d3") = c;
+ register unsigned long d4 __asm__("d4") = d;
+ register unsigned long d5 __asm__("d5") = e;
+ register unsigned long a0 __asm__("a0") = f;
+ __asm__ __volatile__ ("trap #0" : "+r"(d0)
+ : "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5), "r"(a0)
+ : "memory");
+ return d0;
+}
+
+#define SYSCALL_IPC_BROKEN_MODE
diff --git a/libc-top-half/musl/arch/microblaze/arch.mak b/libc-top-half/musl/arch/microblaze/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/microblaze/atomic_arch.h b/libc-top-half/musl/arch/microblaze/atomic_arch.h
new file mode 100644
index 0000000..1152e8c
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/atomic_arch.h
@@ -0,0 +1,53 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ register int old, tmp;
+ __asm__ __volatile__ (
+ " addi %0, r0, 0\n"
+ "1: lwx %0, %2, r0\n"
+ " rsubk %1, %0, %3\n"
+ " bnei %1, 1f\n"
+ " swx %4, %2, r0\n"
+ " addic %1, r0, 0\n"
+ " bnei %1, 1b\n"
+ "1: "
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(p), "r"(t), "r"(s)
+ : "cc", "memory" );
+ return old;
+}
+
+#define a_swap a_swap
+static inline int a_swap(volatile int *x, int v)
+{
+ register int old, tmp;
+ __asm__ __volatile__ (
+ " addi %0, r0, 0\n"
+ "1: lwx %0, %2, r0\n"
+ " swx %3, %2, r0\n"
+ " addic %1, r0, 0\n"
+ " bnei %1, 1b\n"
+ "1: "
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(x), "r"(v)
+ : "cc", "memory" );
+ return old;
+}
+
+#define a_fetch_add a_fetch_add
+static inline int a_fetch_add(volatile int *x, int v)
+{
+ register int new, tmp;
+ __asm__ __volatile__ (
+ " addi %0, r0, 0\n"
+ "1: lwx %0, %2, r0\n"
+ " addk %0, %0, %3\n"
+ " swx %0, %2, r0\n"
+ " addic %1, r0, 0\n"
+ " bnei %1, 1b\n"
+ "1: "
+ : "=&r"(new), "=&r"(tmp)
+ : "r"(x), "r"(v)
+ : "cc", "memory" );
+ return new-v;
+}
diff --git a/libc-top-half/musl/arch/microblaze/bits/alltypes.h.in b/libc-top-half/musl/arch/microblaze/bits/alltypes.h.in
new file mode 100644
index 0000000..9a4ce29
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/alltypes.h.in
@@ -0,0 +1,21 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#if __MICROBLAZEEL__
+#define __BYTE_ORDER 1234
+#else
+#define __BYTE_ORDER 4321
+#endif
+
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/microblaze/bits/float.h b/libc-top-half/musl/arch/microblaze/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/microblaze/bits/ipcstat.h b/libc-top-half/musl/arch/microblaze/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/microblaze/bits/msg.h b/libc-top-half/musl/arch/microblaze/bits/msg.h
new file mode 100644
index 0000000..7bbbb2b
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/microblaze/bits/posix.h b/libc-top-half/musl/arch/microblaze/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/microblaze/bits/reg.h b/libc-top-half/musl/arch/microblaze/bits/reg.h
new file mode 100644
index 0000000..0c7bffc
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/reg.h
@@ -0,0 +1,3 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+/* FIXME */
diff --git a/libc-top-half/musl/arch/microblaze/bits/sem.h b/libc-top-half/musl/arch/microblaze/bits/sem.h
new file mode 100644
index 0000000..544e3d2
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/sem.h
@@ -0,0 +1,18 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned long __sem_ctime_hi;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+#endif
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/microblaze/bits/setjmp.h b/libc-top-half/musl/arch/microblaze/bits/setjmp.h
new file mode 100644
index 0000000..b2bd974
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[18];
diff --git a/libc-top-half/musl/arch/microblaze/bits/shm.h b/libc-top-half/musl/arch/microblaze/bits/shm.h
new file mode 100644
index 0000000..725fb46
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __shm_ctime_hi;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+ unsigned long __pad3;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/microblaze/bits/signal.h b/libc-top-half/musl/arch/microblaze/bits/signal.h
new file mode 100644
index 0000000..490f83b
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/signal.h
@@ -0,0 +1,88 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long greg_t, gregset_t[38];
+typedef struct sigcontext {
+ struct {
+ unsigned long r0, r1, r2, r3, r4, r5, r6, r7;
+ unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
+ unsigned long r16, r17, r18, r19, r20, r21, r22, r23;
+ unsigned long r24, r25, r26, r27, r28, r29, r30, r31;
+ unsigned long pc, msr, ear, esr, fsr;
+ int pt_mode;
+ } regs;
+ unsigned long oldmask;
+} mcontext_t;
+#else
+typedef struct {
+ unsigned long __regs[39];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/microblaze/bits/stat.h b/libc-top-half/musl/arch/microblaze/bits/stat.h
new file mode 100644
index 0000000..8a4d509
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ long long __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __st_blksize_padding;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ unsigned __unused[2];
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/microblaze/bits/stdint.h b/libc-top-half/musl/arch/microblaze/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/microblaze/bits/syscall.h.in b/libc-top-half/musl/arch/microblaze/bits/syscall.h.in
new file mode 100644
index 0000000..931d791
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/syscall.h.in
@@ -0,0 +1,440 @@
+#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_time32 78
+#define __NR_settimeofday_time32 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_getpmsg 188
+#define __NR_putpmsg 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_settime32 260
+#define __NR_timer_gettime32 261
+#define __NR_timer_getoverrun 262
+#define __NR_timer_delete 263
+#define __NR_clock_settime32 264
+#define __NR_clock_gettime32 265
+#define __NR_clock_getres_time32 266
+#define __NR_clock_nanosleep_time32 267
+#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 278
+#define __NR_mq_timedsend 279
+#define __NR_mq_timedreceive 280
+#define __NR_mq_notify 281
+#define __NR_mq_getsetattr 282
+#define __NR_kexec_load 283
+#define __NR_waitid 284
+#define __NR_add_key 286
+#define __NR_request_key 287
+#define __NR_keyctl 288
+#define __NR_ioprio_set 289
+#define __NR_ioprio_get 290
+#define __NR_inotify_init 291
+#define __NR_inotify_add_watch 292
+#define __NR_inotify_rm_watch 293
+#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_semtimedop 325
+#define __NR_timerfd_settime32 326
+#define __NR_timerfd_gettime32 327
+#define __NR_semctl 328
+#define __NR_semget 329
+#define __NR_semop 330
+#define __NR_msgctl 331
+#define __NR_msgget 332
+#define __NR_msgrcv 333
+#define __NR_msgsnd 334
+#define __NR_shmat 335
+#define __NR_shmctl 336
+#define __NR_shmdt 337
+#define __NR_shmget 338
+#define __NR_signalfd4 339
+#define __NR_eventfd2 340
+#define __NR_epoll_create1 341
+#define __NR_dup3 342
+#define __NR_pipe2 343
+#define __NR_inotify_init1 344
+#define __NR_socket 345
+#define __NR_socketpair 346
+#define __NR_bind 347
+#define __NR_listen 348
+#define __NR_accept 349
+#define __NR_connect 350
+#define __NR_getsockname 351
+#define __NR_getpeername 352
+#define __NR_sendto 353
+#define __NR_send 354
+#define __NR_recvfrom 355
+#define __NR_recv 356
+#define __NR_setsockopt 357
+#define __NR_getsockopt 358
+#define __NR_shutdown 359
+#define __NR_sendmsg 360
+#define __NR_recvmsg 361
+#define __NR_accept4 362
+#define __NR_preadv 363
+#define __NR_pwritev 364
+#define __NR_rt_tgsigqueueinfo 365
+#define __NR_perf_event_open 366
+#define __NR_recvmmsg 367
+#define __NR_fanotify_init 368
+#define __NR_fanotify_mark 369
+#define __NR_prlimit64 370
+#define __NR_name_to_handle_at 371
+#define __NR_open_by_handle_at 372
+#define __NR_clock_adjtime 373
+#define __NR_syncfs 374
+#define __NR_setns 375
+#define __NR_sendmmsg 376
+#define __NR_process_vm_readv 377
+#define __NR_process_vm_writev 378
+#define __NR_kcmp 379
+#define __NR_finit_module 380
+#define __NR_sched_setattr 381
+#define __NR_sched_getattr 382
+#define __NR_renameat2 383
+#define __NR_seccomp 384
+#define __NR_getrandom 385
+#define __NR_memfd_create 386
+#define __NR_bpf 387
+#define __NR_execveat 388
+#define __NR_userfaultfd 389
+#define __NR_membarrier 390
+#define __NR_mlock2 391
+#define __NR_copy_file_range 392
+#define __NR_preadv2 393
+#define __NR_pwritev2 394
+#define __NR_pkey_mprotect 395
+#define __NR_pkey_alloc 396
+#define __NR_pkey_free 397
+#define __NR_statx 398
+#define __NR_io_pgetevents 399
+#define __NR_rseq 400
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/microblaze/bits/user.h b/libc-top-half/musl/arch/microblaze/bits/user.h
new file mode 100644
index 0000000..dbc25e0
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/bits/user.h
@@ -0,0 +1,25 @@
+struct user_fpregs_struct {
+ long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
+};
+
+struct user_regs_struct {
+ unsigned grp[32], pc, msr, ear, esr, fsr, btr, pvr[12];
+};
+
+struct user {
+ struct user_regs_struct regs;
+ int u_fpvalid;
+ struct user_fpregs_struct elf_fpregset_t;
+ unsigned long u_tsize, u_dsize, u_ssize, start_code, start_stack;
+ long signal;
+ int reserved;
+ struct user_regs_struct *u_ar0;
+ struct user_fpregs_struct *u_fpstate;
+ unsigned long magic;
+ char u_comm[32];
+ int u_debugreg[8];
+};
+
+#define ELF_NGREG 50
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef struct user_fpregs_struct elf_fpregset_t;
diff --git a/libc-top-half/musl/arch/microblaze/crt_arch.h b/libc-top-half/musl/arch/microblaze/crt_arch.h
new file mode 100644
index 0000000..bca78bf
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/crt_arch.h
@@ -0,0 +1,17 @@
+__asm__(
+".text \n"
+".global " START " \n"
+".align 2 \n"
+START ": \n"
+" add r19, r0, r0 \n"
+" ori r5, r1, 0 \n"
+"1: mfs r6, rpc \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" addik r6, r6, _GLOBAL_OFFSET_TABLE_+8 \n"
+" addik r6, r6, _DYNAMIC@GOTOFF \n"
+" andi r1, r1, -8 \n"
+" addik r1, r1, -8 \n"
+" bri " START "_c \n"
+" nop \n"
+);
diff --git a/libc-top-half/musl/arch/microblaze/kstat.h b/libc-top-half/musl/arch/microblaze/kstat.h
new file mode 100644
index 0000000..c144957
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ long long __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __st_blksize_padding;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/microblaze/pthread_arch.h b/libc-top-half/musl/arch/microblaze/pthread_arch.h
new file mode 100644
index 0000000..ff26624
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/pthread_arch.h
@@ -0,0 +1,8 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ("ori %0, r21, 0" : "=r" (tp) );
+ return tp;
+}
+
+#define MC_PC regs.pc
diff --git a/libc-top-half/musl/arch/microblaze/reloc.h b/libc-top-half/musl/arch/microblaze/reloc.h
new file mode 100644
index 0000000..6302c6e
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/reloc.h
@@ -0,0 +1,27 @@
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "el"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "microblaze" ENDIAN_SUFFIX
+
+#define TPOFF_K 0
+
+#define REL_SYMBOLIC R_MICROBLAZE_32
+#define REL_GOT R_MICROBLAZE_GLOB_DAT
+#define REL_PLT R_MICROBLAZE_JUMP_SLOT
+#define REL_RELATIVE R_MICROBLAZE_REL
+#define REL_COPY R_MICROBLAZE_COPY
+#define REL_DTPMOD R_MICROBLAZE_TLSDTPMOD32
+#define REL_DTPOFF R_MICROBLAZE_TLSDTPREL32
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "addik r1,%1,0 ; bra %0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym " \n" \
+ " mfs %0, rpc \n" \
+ " addik %0, %0, _GLOBAL_OFFSET_TABLE_+8 \n" \
+ " addik %0, %0, " #sym "@GOTOFF \n" \
+ : "=r"(*(fp)) : : "memory" )
diff --git a/libc-top-half/musl/arch/microblaze/syscall_arch.h b/libc-top-half/musl/arch/microblaze/syscall_arch.h
new file mode 100644
index 0000000..61d8248
--- /dev/null
+++ b/libc-top-half/musl/arch/microblaze/syscall_arch.h
@@ -0,0 +1,99 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
+
+static __inline long __syscall0(long n)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12)
+ : "memory", "r4");
+ return r3;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ register unsigned long r5 __asm__("r5") = a;
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12), "r"(r5)
+ : "memory", "r4");
+ return r3;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ register unsigned long r5 __asm__("r5") = a;
+ register unsigned long r6 __asm__("r6") = b;
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12), "r"(r5), "r"(r6)
+ : "memory", "r4");
+ return r3;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ register unsigned long r5 __asm__("r5") = a;
+ register unsigned long r6 __asm__("r6") = b;
+ register unsigned long r7 __asm__("r7") = c;
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12), "r"(r5), "r"(r6), "r"(r7)
+ : "memory", "r4");
+ return r3;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ register unsigned long r5 __asm__("r5") = a;
+ register unsigned long r6 __asm__("r6") = b;
+ register unsigned long r7 __asm__("r7") = c;
+ register unsigned long r8 __asm__("r8") = d;
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12), "r"(r5), "r"(r6), "r"(r7), "r"(r8)
+ : "memory", "r4");
+ return r3;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ register unsigned long r5 __asm__("r5") = a;
+ register unsigned long r6 __asm__("r6") = b;
+ register unsigned long r7 __asm__("r7") = c;
+ register unsigned long r8 __asm__("r8") = d;
+ register unsigned long r9 __asm__("r9") = e;
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12), "r"(r5), "r"(r6), "r"(r7), "r"(r8), "r"(r9)
+ : "memory", "r4");
+ return r3;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register unsigned long r12 __asm__("r12") = n;
+ register unsigned long r3 __asm__("r3");
+ register unsigned long r5 __asm__("r5") = a;
+ register unsigned long r6 __asm__("r6") = b;
+ register unsigned long r7 __asm__("r7") = c;
+ register unsigned long r8 __asm__("r8") = d;
+ register unsigned long r9 __asm__("r9") = e;
+ register unsigned long r10 __asm__("r10") = f;
+ __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
+ : "r"(r12), "r"(r5), "r"(r6), "r"(r7), "r"(r8), "r"(r9), "r"(r10)
+ : "memory", "r4");
+ return r3;
+}
+
+#define SYSCALL_IPC_BROKEN_MODE
+
+#undef SYS_socketcall
diff --git a/libc-top-half/musl/arch/mips/arch.mak b/libc-top-half/musl/arch/mips/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/mips/atomic_arch.h b/libc-top-half/musl/arch/mips/atomic_arch.h
new file mode 100644
index 0000000..1248d17
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/atomic_arch.h
@@ -0,0 +1,58 @@
+#if __mips_isa_rev < 6
+#define LLSC_M "m"
+#else
+#define LLSC_M "ZC"
+#endif
+
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+#if __mips < 2
+ __asm__ __volatile__ (
+ ".set push ; .set mips2\n\t"
+ "ll %0, %1"
+ "\n\t.set pop"
+ : "=r"(v) : "m"(*p));
+#else
+ __asm__ __volatile__ (
+ "ll %0, %1"
+ : "=r"(v) : LLSC_M(*p));
+#endif
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+#if __mips < 2
+ __asm__ __volatile__ (
+ ".set push ; .set mips2\n\t"
+ "sc %0, %1"
+ "\n\t.set pop"
+ : "=r"(r), "=m"(*p) : "0"(v) : "memory");
+#else
+ __asm__ __volatile__ (
+ "sc %0, %1"
+ : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory");
+#endif
+ return r;
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+#if __mips < 2
+ /* mips2 sync, but using too many directives causes
+ * gcc not to inline it, so encode with .long instead. */
+ __asm__ __volatile__ (".long 0xf" : : : "memory");
+#else
+ __asm__ __volatile__ ("sync" : : : "memory");
+#endif
+}
+
+#define a_pre_llsc a_barrier
+#define a_post_llsc a_barrier
+
+#undef LLSC_M
diff --git a/libc-top-half/musl/arch/mips/bits/alltypes.h.in b/libc-top-half/musl/arch/mips/bits/alltypes.h.in
new file mode 100644
index 0000000..ff934a4
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/alltypes.h.in
@@ -0,0 +1,21 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#if _MIPSEL || __MIPSEL || __MIPSEL__
+#define __BYTE_ORDER 1234
+#else
+#define __BYTE_ORDER 4321
+#endif
+
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/mips/bits/errno.h b/libc-top-half/musl/arch/mips/bits/errno.h
new file mode 100644
index 0000000..1bb91e3
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define ENOMSG 35
+#define EIDRM 36
+#define ECHRNG 37
+#define EL2NSYNC 38
+#define EL3HLT 39
+#define EL3RST 40
+#define ELNRNG 41
+#define EUNATCH 42
+#define ENOCSI 43
+#define EL2HLT 44
+#define EDEADLK 45
+#define ENOLCK 46
+#define EBADE 50
+#define EBADR 51
+#define EXFULL 52
+#define ENOANO 53
+#define EBADRQC 54
+#define EBADSLT 55
+#define EDEADLOCK 56
+#define EBFONT 59
+#define ENOSTR 60
+#define ENODATA 61
+#define ETIME 62
+#define ENOSR 63
+#define ENONET 64
+#define ENOPKG 65
+#define EREMOTE 66
+#define ENOLINK 67
+#define EADV 68
+#define ESRMNT 69
+#define ECOMM 70
+#define EPROTO 71
+#define EDOTDOT 73
+#define EMULTIHOP 74
+#define EBADMSG 77
+#define ENAMETOOLONG 78
+#define EOVERFLOW 79
+#define ENOTUNIQ 80
+#define EBADFD 81
+#define EREMCHG 82
+#define ELIBACC 83
+#define ELIBBAD 84
+#define ELIBSCN 85
+#define ELIBMAX 86
+#define ELIBEXEC 87
+#define EILSEQ 88
+#define ENOSYS 89
+#define ELOOP 90
+#define ERESTART 91
+#define ESTRPIPE 92
+#define ENOTEMPTY 93
+#define EUSERS 94
+#define ENOTSOCK 95
+#define EDESTADDRREQ 96
+#define EMSGSIZE 97
+#define EPROTOTYPE 98
+#define ENOPROTOOPT 99
+#define EPROTONOSUPPORT 120
+#define ESOCKTNOSUPPORT 121
+#define EOPNOTSUPP 122
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT 123
+#define EAFNOSUPPORT 124
+#define EADDRINUSE 125
+#define EADDRNOTAVAIL 126
+#define ENETDOWN 127
+#define ENETUNREACH 128
+#define ENETRESET 129
+#define ECONNABORTED 130
+#define ECONNRESET 131
+#define ENOBUFS 132
+#define EISCONN 133
+#define ENOTCONN 134
+#define EUCLEAN 135
+#define ENOTNAM 137
+#define ENAVAIL 138
+#define EISNAM 139
+#define EREMOTEIO 140
+#define ESHUTDOWN 143
+#define ETOOMANYREFS 144
+#define ETIMEDOUT 145
+#define ECONNREFUSED 146
+#define EHOSTDOWN 147
+#define EHOSTUNREACH 148
+#define EWOULDBLOCK EAGAIN
+#define EALREADY 149
+#define EINPROGRESS 150
+#define ESTALE 151
+#define ECANCELED 158
+#define ENOMEDIUM 159
+#define EMEDIUMTYPE 160
+#define ENOKEY 161
+#define EKEYEXPIRED 162
+#define EKEYREVOKED 163
+#define EKEYREJECTED 164
+#define EOWNERDEAD 165
+#define ENOTRECOVERABLE 166
+#define ERFKILL 167
+#define EHWPOISON 168
+#define EDQUOT 1133
diff --git a/libc-top-half/musl/arch/mips/bits/fcntl.h b/libc-top-half/musl/arch/mips/bits/fcntl.h
new file mode 100644
index 0000000..9fd8c23
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0400
+#define O_EXCL 02000
+#define O_NOCTTY 04000
+#define O_TRUNC 01000
+#define O_APPEND 0010
+#define O_NONBLOCK 0200
+#define O_DSYNC 0020
+#define O_SYNC 040020
+#define O_RSYNC 040020
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 010000
+#define O_DIRECT 0100000
+#define O_LARGEFILE 020000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 24
+#define F_GETOWN 23
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 33
+#define F_SETLK 34
+#define F_SETLKW 35
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/mips/bits/fenv.h b/libc-top-half/musl/arch/mips/bits/fenv.h
new file mode 100644
index 0000000..589e71c
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/fenv.h
@@ -0,0 +1,25 @@
+#ifdef __mips_soft_float
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+#else
+#define FE_INEXACT 4
+#define FE_UNDERFLOW 8
+#define FE_OVERFLOW 16
+#define FE_DIVBYZERO 32
+#define FE_INVALID 64
+
+#define FE_ALL_EXCEPT 124
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+#endif
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+ unsigned __cw;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/mips/bits/float.h b/libc-top-half/musl/arch/mips/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/mips/bits/hwcap.h b/libc-top-half/musl/arch/mips/bits/hwcap.h
new file mode 100644
index 0000000..7986deb
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/hwcap.h
@@ -0,0 +1,14 @@
+#define HWCAP_MIPS_R6 (1 << 0)
+#define HWCAP_MIPS_MSA (1 << 1)
+#define HWCAP_MIPS_CRC32 (1 << 2)
+#define HWCAP_MIPS_MIPS16 (1 << 3)
+#define HWCAP_MIPS_MDMX (1 << 4)
+#define HWCAP_MIPS_MIPS3D (1 << 5)
+#define HWCAP_MIPS_SMARTMIPS (1 << 6)
+#define HWCAP_MIPS_DSP (1 << 7)
+#define HWCAP_MIPS_DSP2 (1 << 8)
+#define HWCAP_MIPS_DSP3 (1 << 9)
+#define HWCAP_MIPS_MIPS16E2 (1 << 10)
+#define HWCAP_LOONGSON_MMI (1 << 11)
+#define HWCAP_LOONGSON_EXT (1 << 12)
+#define HWCAP_LOONGSON_EXT2 (1 << 13)
diff --git a/libc-top-half/musl/arch/mips/bits/ioctl.h b/libc-top-half/musl/arch/mips/bits/ioctl.h
new file mode 100644
index 0000000..e20bf19
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/ioctl.h
@@ -0,0 +1,114 @@
+#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETA 0x5401
+#define TCSETA 0x5402
+#define TCSETAW 0x5403
+#define TCSETAF 0x5404
+#define TCSBRK 0x5405
+#define TCXONC 0x5406
+#define TCFLSH 0x5407
+#define TCGETS 0x540D
+#define TCSETS 0x540E
+#define TCSETSW 0x540F
+#define TCSETSF 0x5410
+
+#define TIOCEXCL 0x740D
+#define TIOCNXCL 0x740E
+#define TIOCOUTQ 0x7472
+#define TIOCSTI 0x5472
+#define TIOCMGET 0x741D
+#define TIOCMBIS 0x741B
+#define TIOCMBIC 0x741C
+#define TIOCMSET 0x741A
+
+#define TIOCPKT 0x5470
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define TIOCNOTTY 0x5471
+#define TIOCSETD 0x7401
+#define TIOCGETD 0x7400
+
+#define FIOCLEX 0x6601
+#define FIONCLEX 0x6602
+#define FIOASYNC 0x667D
+#define FIONBIO 0x667E
+#define FIOQSIZE 0x667F
+
+#define TIOCGLTC 0x7474
+#define TIOCSLTC 0x7475
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+#define TIOCCONS _IOW('t', 120, int)
+
+#define FIONREAD 0x467F
+#define TIOCINQ FIONREAD
+
+#define TIOCGETP 0x7408
+#define TIOCSETP 0x7409
+#define TIOCSETN 0x740A
+
+#define TIOCSBRK 0x5427
+#define TIOCCBRK 0x5428
+#define TIOCGSID 0x7416
+#define TIOCGRS485 _IOR('T', 0x2E, char[32])
+#define TIOCSRS485 _IOWR('T', 0x2F, char[32])
+#define TIOCGPTN _IOR('T', 0x30, unsigned int)
+#define TIOCSPTLCK _IOW('T', 0x31, int)
+#define TIOCGDEV _IOR('T', 0x32, unsigned int)
+#define TIOCSIG _IOW('T', 0x36, int)
+#define TIOCVHANGUP 0x5437
+#define TIOCGPKT _IOR('T', 0x38, int)
+#define TIOCGPTLCK _IOR('T', 0x39, int)
+#define TIOCGEXCL _IOR('T', 0x40, int)
+#define TIOCGPTPEER _IO('T', 0x41)
+
+#define TIOCSCTTY 0x5480
+#define TIOCGSOFTCAR 0x5481
+#define TIOCSSOFTCAR 0x5482
+#define TIOCLINUX 0x5483
+#define TIOCGSERIAL 0x5484
+#define TIOCSSERIAL 0x5485
+#define TCSBRKP 0x5486
+
+#define TIOCSERCONFIG 0x5488
+#define TIOCSERGWILD 0x5489
+#define TIOCSERSWILD 0x548A
+#define TIOCGLCKTRMIOS 0x548B
+#define TIOCSLCKTRMIOS 0x548C
+#define TIOCSERGSTRUCT 0x548D
+#define TIOCSERGETLSR 0x548E
+#define TIOCSERGETMULTI 0x548F
+#define TIOCSERSETMULTI 0x5490
+#define TIOCMIWAIT 0x5491
+#define TIOCGICOUNT 0x5492
+
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x010
+#define TIOCM_SR 0x020
+#define TIOCM_CTS 0x040
+#define TIOCM_CAR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RNG 0x200
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_DSR 0x400
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+#define SIOCGSTAMP _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
diff --git a/libc-top-half/musl/arch/mips/bits/ipcstat.h b/libc-top-half/musl/arch/mips/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/mips/bits/mman.h b/libc-top-half/musl/arch/mips/bits/mman.h
new file mode 100644
index 0000000..9027bb6
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/mman.h
@@ -0,0 +1,25 @@
+#undef MAP_ANON
+#define MAP_ANON 0x800
+#undef MAP_NORESERVE
+#define MAP_NORESERVE 0x0400
+#undef MAP_GROWSDOWN
+#define MAP_GROWSDOWN 0x1000
+#undef MAP_DENYWRITE
+#define MAP_DENYWRITE 0x2000
+#undef MAP_EXECUTABLE
+#define MAP_EXECUTABLE 0x4000
+#undef MAP_LOCKED
+#define MAP_LOCKED 0x8000
+#undef MAP_POPULATE
+#define MAP_POPULATE 0x10000
+#undef MAP_NONBLOCK
+#define MAP_NONBLOCK 0x20000
+#undef MAP_STACK
+#define MAP_STACK 0x40000
+#undef MAP_HUGETLB
+#define MAP_HUGETLB 0x80000
+#undef MAP_SYNC
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#undef MADV_SOFT_OFFLINE
+#endif
diff --git a/libc-top-half/musl/arch/mips/bits/msg.h b/libc-top-half/musl/arch/mips/bits/msg.h
new file mode 100644
index 0000000..c734dbb
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/msg.h
@@ -0,0 +1,27 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+#if _MIPSEL || __MIPSEL || __MIPSEL__
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+#else
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long __msg_ctime_lo;
+#endif
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/mips/bits/poll.h b/libc-top-half/musl/arch/mips/bits/poll.h
new file mode 100644
index 0000000..b0b1ed6
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/poll.h
@@ -0,0 +1,2 @@
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND 0x100
diff --git a/libc-top-half/musl/arch/mips/bits/posix.h b/libc-top-half/musl/arch/mips/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/mips/bits/ptrace.h b/libc-top-half/musl/arch/mips/bits/ptrace.h
new file mode 100644
index 0000000..77a01c0
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/ptrace.h
@@ -0,0 +1,9 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_PEEKTEXT_3264 0xc0
+#define PTRACE_PEEKDATA_3264 0xc1
+#define PTRACE_POKETEXT_3264 0xc2
+#define PTRACE_POKEDATA_3264 0xc3
+#define PTRACE_GET_THREAD_AREA_3264 0xc4
+#define PTRACE_GET_WATCH_REGS 0xd0
+#define PTRACE_SET_WATCH_REGS 0xd1
diff --git a/libc-top-half/musl/arch/mips/bits/reg.h b/libc-top-half/musl/arch/mips/bits/reg.h
new file mode 100644
index 0000000..0c37098
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/reg.h
@@ -0,0 +1,47 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+
+#define EF_R0 6
+#define EF_R1 7
+#define EF_R2 8
+#define EF_R3 9
+#define EF_R4 10
+#define EF_R5 11
+#define EF_R6 12
+#define EF_R7 13
+#define EF_R8 14
+#define EF_R9 15
+#define EF_R10 16
+#define EF_R11 17
+#define EF_R12 18
+#define EF_R13 19
+#define EF_R14 20
+#define EF_R15 21
+#define EF_R16 22
+#define EF_R17 23
+#define EF_R18 24
+#define EF_R19 25
+#define EF_R20 26
+#define EF_R21 27
+#define EF_R22 28
+#define EF_R23 29
+#define EF_R24 30
+#define EF_R25 31
+
+#define EF_R26 32
+#define EF_R27 33
+#define EF_R28 34
+#define EF_R29 35
+#define EF_R30 36
+#define EF_R31 37
+
+#define EF_LO 38
+#define EF_HI 39
+
+#define EF_CP0_EPC 40
+#define EF_CP0_BADVADDR 41
+#define EF_CP0_STATUS 42
+#define EF_CP0_CAUSE 43
+#define EF_UNUSED0 44
+
+#define EF_SIZE 180
diff --git a/libc-top-half/musl/arch/mips/bits/resource.h b/libc-top-half/musl/arch/mips/bits/resource.h
new file mode 100644
index 0000000..414a405
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/resource.h
@@ -0,0 +1,5 @@
+#define RLIMIT_NOFILE 5
+#define RLIMIT_AS 6
+#define RLIMIT_RSS 7
+#define RLIMIT_NPROC 8
+#define RLIMIT_MEMLOCK 9
diff --git a/libc-top-half/musl/arch/mips/bits/sem.h b/libc-top-half/musl/arch/mips/bits/sem.h
new file mode 100644
index 0000000..fe6f094
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/sem.h
@@ -0,0 +1,16 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_ctime_lo;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+#endif
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_hi;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/mips/bits/setjmp.h b/libc-top-half/musl/arch/mips/bits/setjmp.h
new file mode 100644
index 0000000..30229a0
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long __jmp_buf[13];
diff --git a/libc-top-half/musl/arch/mips/bits/shm.h b/libc-top-half/musl/arch/mips/bits/shm.h
new file mode 100644
index 0000000..ab8c642
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/shm.h
@@ -0,0 +1,29 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_ctime_lo;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned short __shm_atime_hi;
+ unsigned short __shm_dtime_hi;
+ unsigned short __shm_ctime_hi;
+ unsigned short __pad1;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/mips/bits/signal.h b/libc-top-half/musl/arch/mips/bits/signal.h
new file mode 100644
index 0000000..1b69e76
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/signal.h
@@ -0,0 +1,124 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long long greg_t, gregset_t[32];
+typedef struct {
+ union {
+ double fp_dregs[32];
+ struct {
+ float _fp_fregs;
+ unsigned _fp_pad;
+ } fp_fregs[32];
+ } fp_r;
+} fpregset_t;
+struct sigcontext {
+ unsigned sc_regmask, sc_status;
+ unsigned long long sc_pc;
+ gregset_t sc_regs;
+ fpregset_t sc_fpregs;
+ unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
+ unsigned long long sc_mdhi, sc_mdlo;
+ unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3;
+};
+typedef struct {
+ unsigned regmask, status;
+ unsigned long long pc;
+ gregset_t gregs;
+ fpregset_t fpregs;
+ unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp;
+ unsigned long long mdhi, mdlo;
+ unsigned long hi1, lo1, hi2, lo2, hi3, lo3;
+} mcontext_t;
+#else
+typedef struct {
+ unsigned __mc1[2];
+ unsigned long long __mc2[65];
+ unsigned __mc3[5];
+ unsigned long long __mc4[2];
+ unsigned __mc5[6];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 0x10000
+#define SA_SIGINFO 8
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#undef SIG_BLOCK
+#undef SIG_UNBLOCK
+#undef SIG_SETMASK
+#define SIG_BLOCK 1
+#define SIG_UNBLOCK 2
+#define SIG_SETMASK 3
+
+#undef SI_ASYNCIO
+#undef SI_MESGQ
+#undef SI_TIMER
+#define SI_ASYNCIO (-2)
+#define SI_MESGQ (-4)
+#define SI_TIMER (-3)
+
+#define __SI_SWAP_ERRNO_CODE
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#define SIGEMT 7
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGBUS 10
+#define SIGSEGV 11
+#define SIGSYS 12
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGUSR1 16
+#define SIGUSR2 17
+#define SIGCHLD 18
+#define SIGPWR 19
+#define SIGWINCH 20
+#define SIGURG 21
+#define SIGIO 22
+#define SIGPOLL SIGIO
+#define SIGSTOP 23
+#define SIGTSTP 24
+#define SIGCONT 25
+#define SIGTTIN 26
+#define SIGTTOU 27
+#define SIGVTALRM 28
+#define SIGPROF 29
+#define SIGXCPU 30
+#define SIGXFSZ 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 128
diff --git a/libc-top-half/musl/arch/mips/bits/socket.h b/libc-top-half/musl/arch/mips/bits/socket.h
new file mode 100644
index 0000000..02fbb88
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/socket.h
@@ -0,0 +1,35 @@
+#define SOCK_STREAM 2
+#define SOCK_DGRAM 1
+
+#define SOL_SOCKET 65535
+
+#define SO_DEBUG 1
+
+#define SO_REUSEADDR 0x0004
+#define SO_KEEPALIVE 0x0008
+#define SO_DONTROUTE 0x0010
+#define SO_BROADCAST 0x0020
+#define SO_LINGER 0x0080
+#define SO_OOBINLINE 0x0100
+#define SO_REUSEPORT 0x0200
+#define SO_SNDBUF 0x1001
+#define SO_RCVBUF 0x1002
+#define SO_SNDLOWAT 0x1003
+#define SO_RCVLOWAT 0x1004
+#define SO_ERROR 0x1007
+#define SO_TYPE 0x1008
+#define SO_ACCEPTCONN 0x1009
+#define SO_PROTOCOL 0x1028
+#define SO_DOMAIN 0x1029
+
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_BSDCOMPAT 14
+#define SO_PASSCRED 17
+#define SO_PEERCRED 18
+#define SO_PEERSEC 30
+#define SO_SNDBUFFORCE 31
+#define SO_RCVBUFFORCE 33
+
+#define SOCK_NONBLOCK 0200
+#define SOCK_CLOEXEC 02000000
diff --git a/libc-top-half/musl/arch/mips/bits/stat.h b/libc-top-half/musl/arch/mips/bits/stat.h
new file mode 100644
index 0000000..48d4ac8
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/stat.h
@@ -0,0 +1,26 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ long __st_padding1[2];
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ long __st_padding2[2];
+ off_t st_size;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ blksize_t st_blksize;
+ long __st_padding3;
+ blkcnt_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ long __st_padding4[2];
+};
diff --git a/libc-top-half/musl/arch/mips/bits/statfs.h b/libc-top-half/musl/arch/mips/bits/statfs.h
new file mode 100644
index 0000000..a73bd54
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/statfs.h
@@ -0,0 +1,8 @@
+struct statfs {
+ unsigned long f_type, f_bsize, f_frsize;
+ fsblkcnt_t f_blocks, f_bfree;
+ fsfilcnt_t f_files, f_ffree;
+ fsblkcnt_t f_bavail;
+ fsid_t f_fsid;
+ unsigned long f_namelen, f_flags, f_spare[5];
+};
diff --git a/libc-top-half/musl/arch/mips/bits/stdint.h b/libc-top-half/musl/arch/mips/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/mips/bits/syscall.h.in b/libc-top-half/musl/arch/mips/bits/syscall.h.in
new file mode 100644
index 0000000..63e3503
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/syscall.h.in
@@ -0,0 +1,421 @@
+#define __NR_syscall 4000
+#define __NR_exit 4001
+#define __NR_fork 4002
+#define __NR_read 4003
+#define __NR_write 4004
+#define __NR_open 4005
+#define __NR_close 4006
+#define __NR_waitpid 4007
+#define __NR_creat 4008
+#define __NR_link 4009
+#define __NR_unlink 4010
+#define __NR_execve 4011
+#define __NR_chdir 4012
+#define __NR_time 4013
+#define __NR_mknod 4014
+#define __NR_chmod 4015
+#define __NR_lchown 4016
+#define __NR_break 4017
+#define __NR_unused18 4018
+#define __NR_lseek 4019
+#define __NR_getpid 4020
+#define __NR_mount 4021
+#define __NR_umount 4022
+#define __NR_setuid 4023
+#define __NR_getuid 4024
+#define __NR_stime 4025
+#define __NR_ptrace 4026
+#define __NR_alarm 4027
+#define __NR_unused28 4028
+#define __NR_pause 4029
+#define __NR_utime 4030
+#define __NR_stty 4031
+#define __NR_gtty 4032
+#define __NR_access 4033
+#define __NR_nice 4034
+#define __NR_ftime 4035
+#define __NR_sync 4036
+#define __NR_kill 4037
+#define __NR_rename 4038
+#define __NR_mkdir 4039
+#define __NR_rmdir 4040
+#define __NR_dup 4041
+#define __NR_pipe 4042
+#define __NR_times 4043
+#define __NR_prof 4044
+#define __NR_brk 4045
+#define __NR_setgid 4046
+#define __NR_getgid 4047
+#define __NR_signal 4048
+#define __NR_geteuid 4049
+#define __NR_getegid 4050
+#define __NR_acct 4051
+#define __NR_umount2 4052
+#define __NR_lock 4053
+#define __NR_ioctl 4054
+#define __NR_fcntl 4055
+#define __NR_mpx 4056
+#define __NR_setpgid 4057
+#define __NR_ulimit 4058
+#define __NR_unused59 4059
+#define __NR_umask 4060
+#define __NR_chroot 4061
+#define __NR_ustat 4062
+#define __NR_dup2 4063
+#define __NR_getppid 4064
+#define __NR_getpgrp 4065
+#define __NR_setsid 4066
+#define __NR_sigaction 4067
+#define __NR_sgetmask 4068
+#define __NR_ssetmask 4069
+#define __NR_setreuid 4070
+#define __NR_setregid 4071
+#define __NR_sigsuspend 4072
+#define __NR_sigpending 4073
+#define __NR_sethostname 4074
+#define __NR_setrlimit 4075
+#define __NR_getrlimit 4076
+#define __NR_getrusage 4077
+#define __NR_gettimeofday_time32 4078
+#define __NR_settimeofday_time32 4079
+#define __NR_getgroups 4080
+#define __NR_setgroups 4081
+#define __NR_reserved82 4082
+#define __NR_symlink 4083
+#define __NR_unused84 4084
+#define __NR_readlink 4085
+#define __NR_uselib 4086
+#define __NR_swapon 4087
+#define __NR_reboot 4088
+#define __NR_readdir 4089
+#define __NR_mmap 4090
+#define __NR_munmap 4091
+#define __NR_truncate 4092
+#define __NR_ftruncate 4093
+#define __NR_fchmod 4094
+#define __NR_fchown 4095
+#define __NR_getpriority 4096
+#define __NR_setpriority 4097
+#define __NR_profil 4098
+#define __NR_statfs 4099
+#define __NR_fstatfs 4100
+#define __NR_ioperm 4101
+#define __NR_socketcall 4102
+#define __NR_syslog 4103
+#define __NR_setitimer 4104
+#define __NR_getitimer 4105
+#define __NR_stat 4106
+#define __NR_lstat 4107
+#define __NR_fstat 4108
+#define __NR_unused109 4109
+#define __NR_iopl 4110
+#define __NR_vhangup 4111
+#define __NR_idle 4112
+#define __NR_vm86 4113
+#define __NR_wait4 4114
+#define __NR_swapoff 4115
+#define __NR_sysinfo 4116
+#define __NR_ipc 4117
+#define __NR_fsync 4118
+#define __NR_sigreturn 4119
+#define __NR_clone 4120
+#define __NR_setdomainname 4121
+#define __NR_uname 4122
+#define __NR_modify_ldt 4123
+#define __NR_adjtimex 4124
+#define __NR_mprotect 4125
+#define __NR_sigprocmask 4126
+#define __NR_create_module 4127
+#define __NR_init_module 4128
+#define __NR_delete_module 4129
+#define __NR_get_kernel_syms 4130
+#define __NR_quotactl 4131
+#define __NR_getpgid 4132
+#define __NR_fchdir 4133
+#define __NR_bdflush 4134
+#define __NR_sysfs 4135
+#define __NR_personality 4136
+#define __NR_afs_syscall 4137
+#define __NR_setfsuid 4138
+#define __NR_setfsgid 4139
+#define __NR__llseek 4140
+#define __NR_getdents 4141
+#define __NR__newselect 4142
+#define __NR_flock 4143
+#define __NR_msync 4144
+#define __NR_readv 4145
+#define __NR_writev 4146
+#define __NR_cacheflush 4147
+#define __NR_cachectl 4148
+#define __NR_sysmips 4149
+#define __NR_unused150 4150
+#define __NR_getsid 4151
+#define __NR_fdatasync 4152
+#define __NR__sysctl 4153
+#define __NR_mlock 4154
+#define __NR_munlock 4155
+#define __NR_mlockall 4156
+#define __NR_munlockall 4157
+#define __NR_sched_setparam 4158
+#define __NR_sched_getparam 4159
+#define __NR_sched_setscheduler 4160
+#define __NR_sched_getscheduler 4161
+#define __NR_sched_yield 4162
+#define __NR_sched_get_priority_max 4163
+#define __NR_sched_get_priority_min 4164
+#define __NR_sched_rr_get_interval 4165
+#define __NR_nanosleep 4166
+#define __NR_mremap 4167
+#define __NR_accept 4168
+#define __NR_bind 4169
+#define __NR_connect 4170
+#define __NR_getpeername 4171
+#define __NR_getsockname 4172
+#define __NR_getsockopt 4173
+#define __NR_listen 4174
+#define __NR_recv 4175
+#define __NR_recvfrom 4176
+#define __NR_recvmsg 4177
+#define __NR_send 4178
+#define __NR_sendmsg 4179
+#define __NR_sendto 4180
+#define __NR_setsockopt 4181
+#define __NR_shutdown 4182
+#define __NR_socket 4183
+#define __NR_socketpair 4184
+#define __NR_setresuid 4185
+#define __NR_getresuid 4186
+#define __NR_query_module 4187
+#define __NR_poll 4188
+#define __NR_nfsservctl 4189
+#define __NR_setresgid 4190
+#define __NR_getresgid 4191
+#define __NR_prctl 4192
+#define __NR_rt_sigreturn 4193
+#define __NR_rt_sigaction 4194
+#define __NR_rt_sigprocmask 4195
+#define __NR_rt_sigpending 4196
+#define __NR_rt_sigtimedwait 4197
+#define __NR_rt_sigqueueinfo 4198
+#define __NR_rt_sigsuspend 4199
+#define __NR_pread64 4200
+#define __NR_pwrite64 4201
+#define __NR_chown 4202
+#define __NR_getcwd 4203
+#define __NR_capget 4204
+#define __NR_capset 4205
+#define __NR_sigaltstack 4206
+#define __NR_sendfile 4207
+#define __NR_getpmsg 4208
+#define __NR_putpmsg 4209
+#define __NR_mmap2 4210
+#define __NR_truncate64 4211
+#define __NR_ftruncate64 4212
+#define __NR_stat64 4213
+#define __NR_lstat64 4214
+#define __NR_fstat64 4215
+#define __NR_pivot_root 4216
+#define __NR_mincore 4217
+#define __NR_madvise 4218
+#define __NR_getdents64 4219
+#define __NR_fcntl64 4220
+#define __NR_reserved221 4221
+#define __NR_gettid 4222
+#define __NR_readahead 4223
+#define __NR_setxattr 4224
+#define __NR_lsetxattr 4225
+#define __NR_fsetxattr 4226
+#define __NR_getxattr 4227
+#define __NR_lgetxattr 4228
+#define __NR_fgetxattr 4229
+#define __NR_listxattr 4230
+#define __NR_llistxattr 4231
+#define __NR_flistxattr 4232
+#define __NR_removexattr 4233
+#define __NR_lremovexattr 4234
+#define __NR_fremovexattr 4235
+#define __NR_tkill 4236
+#define __NR_sendfile64 4237
+#define __NR_futex 4238
+#define __NR_sched_setaffinity 4239
+#define __NR_sched_getaffinity 4240
+#define __NR_io_setup 4241
+#define __NR_io_destroy 4242
+#define __NR_io_getevents 4243
+#define __NR_io_submit 4244
+#define __NR_io_cancel 4245
+#define __NR_exit_group 4246
+#define __NR_lookup_dcookie 4247
+#define __NR_epoll_create 4248
+#define __NR_epoll_ctl 4249
+#define __NR_epoll_wait 4250
+#define __NR_remap_file_pages 4251
+#define __NR_set_tid_address 4252
+#define __NR_restart_syscall 4253
+#define __NR_fadvise64 4254
+#define __NR_statfs64 4255
+#define __NR_fstatfs64 4256
+#define __NR_timer_create 4257
+#define __NR_timer_settime32 4258
+#define __NR_timer_gettime32 4259
+#define __NR_timer_getoverrun 4260
+#define __NR_timer_delete 4261
+#define __NR_clock_settime32 4262
+#define __NR_clock_gettime32 4263
+#define __NR_clock_getres_time32 4264
+#define __NR_clock_nanosleep_time32 4265
+#define __NR_tgkill 4266
+#define __NR_utimes 4267
+#define __NR_mbind 4268
+#define __NR_get_mempolicy 4269
+#define __NR_set_mempolicy 4270
+#define __NR_mq_open 4271
+#define __NR_mq_unlink 4272
+#define __NR_mq_timedsend 4273
+#define __NR_mq_timedreceive 4274
+#define __NR_mq_notify 4275
+#define __NR_mq_getsetattr 4276
+#define __NR_vserver 4277
+#define __NR_waitid 4278
+#define __NR_add_key 4280
+#define __NR_request_key 4281
+#define __NR_keyctl 4282
+#define __NR_set_thread_area 4283
+#define __NR_inotify_init 4284
+#define __NR_inotify_add_watch 4285
+#define __NR_inotify_rm_watch 4286
+#define __NR_migrate_pages 4287
+#define __NR_openat 4288
+#define __NR_mkdirat 4289
+#define __NR_mknodat 4290
+#define __NR_fchownat 4291
+#define __NR_futimesat 4292
+#define __NR_fstatat64 4293
+#define __NR_unlinkat 4294
+#define __NR_renameat 4295
+#define __NR_linkat 4296
+#define __NR_symlinkat 4297
+#define __NR_readlinkat 4298
+#define __NR_fchmodat 4299
+#define __NR_faccessat 4300
+#define __NR_pselect6 4301
+#define __NR_ppoll 4302
+#define __NR_unshare 4303
+#define __NR_splice 4304
+#define __NR_sync_file_range 4305
+#define __NR_tee 4306
+#define __NR_vmsplice 4307
+#define __NR_move_pages 4308
+#define __NR_set_robust_list 4309
+#define __NR_get_robust_list 4310
+#define __NR_kexec_load 4311
+#define __NR_getcpu 4312
+#define __NR_epoll_pwait 4313
+#define __NR_ioprio_set 4314
+#define __NR_ioprio_get 4315
+#define __NR_utimensat 4316
+#define __NR_signalfd 4317
+#define __NR_timerfd 4318
+#define __NR_eventfd 4319
+#define __NR_fallocate 4320
+#define __NR_timerfd_create 4321
+#define __NR_timerfd_gettime32 4322
+#define __NR_timerfd_settime32 4323
+#define __NR_signalfd4 4324
+#define __NR_eventfd2 4325
+#define __NR_epoll_create1 4326
+#define __NR_dup3 4327
+#define __NR_pipe2 4328
+#define __NR_inotify_init1 4329
+#define __NR_preadv 4330
+#define __NR_pwritev 4331
+#define __NR_rt_tgsigqueueinfo 4332
+#define __NR_perf_event_open 4333
+#define __NR_accept4 4334
+#define __NR_recvmmsg 4335
+#define __NR_fanotify_init 4336
+#define __NR_fanotify_mark 4337
+#define __NR_prlimit64 4338
+#define __NR_name_to_handle_at 4339
+#define __NR_open_by_handle_at 4340
+#define __NR_clock_adjtime 4341
+#define __NR_syncfs 4342
+#define __NR_sendmmsg 4343
+#define __NR_setns 4344
+#define __NR_process_vm_readv 4345
+#define __NR_process_vm_writev 4346
+#define __NR_kcmp 4347
+#define __NR_finit_module 4348
+#define __NR_sched_setattr 4349
+#define __NR_sched_getattr 4350
+#define __NR_renameat2 4351
+#define __NR_seccomp 4352
+#define __NR_getrandom 4353
+#define __NR_memfd_create 4354
+#define __NR_bpf 4355
+#define __NR_execveat 4356
+#define __NR_userfaultfd 4357
+#define __NR_membarrier 4358
+#define __NR_mlock2 4359
+#define __NR_copy_file_range 4360
+#define __NR_preadv2 4361
+#define __NR_pwritev2 4362
+#define __NR_pkey_mprotect 4363
+#define __NR_pkey_alloc 4364
+#define __NR_pkey_free 4365
+#define __NR_statx 4366
+#define __NR_rseq 4367
+#define __NR_io_pgetevents 4368
+#define __NR_semget 4393
+#define __NR_semctl 4394
+#define __NR_shmget 4395
+#define __NR_shmctl 4396
+#define __NR_shmat 4397
+#define __NR_shmdt 4398
+#define __NR_msgget 4399
+#define __NR_msgsnd 4400
+#define __NR_msgrcv 4401
+#define __NR_msgctl 4402
+#define __NR_clock_gettime64 4403
+#define __NR_clock_settime64 4404
+#define __NR_clock_adjtime64 4405
+#define __NR_clock_getres_time64 4406
+#define __NR_clock_nanosleep_time64 4407
+#define __NR_timer_gettime64 4408
+#define __NR_timer_settime64 4409
+#define __NR_timerfd_gettime64 4410
+#define __NR_timerfd_settime64 4411
+#define __NR_utimensat_time64 4412
+#define __NR_pselect6_time64 4413
+#define __NR_ppoll_time64 4414
+#define __NR_io_pgetevents_time64 4416
+#define __NR_recvmmsg_time64 4417
+#define __NR_mq_timedsend_time64 4418
+#define __NR_mq_timedreceive_time64 4419
+#define __NR_semtimedop_time64 4420
+#define __NR_rt_sigtimedwait_time64 4421
+#define __NR_futex_time64 4422
+#define __NR_sched_rr_get_interval_time64 4423
+#define __NR_pidfd_send_signal 4424
+#define __NR_io_uring_setup 4425
+#define __NR_io_uring_enter 4426
+#define __NR_io_uring_register 4427
+#define __NR_open_tree 4428
+#define __NR_move_mount 4429
+#define __NR_fsopen 4430
+#define __NR_fsconfig 4431
+#define __NR_fsmount 4432
+#define __NR_fspick 4433
+#define __NR_pidfd_open 4434
+#define __NR_clone3 4435
+#define __NR_close_range 4436
+#define __NR_openat2 4437
+#define __NR_pidfd_getfd 4438
+#define __NR_faccessat2 4439
+#define __NR_process_madvise 4440
+#define __NR_epoll_pwait2 4441
+#define __NR_mount_setattr 4442
+#define __NR_landlock_create_ruleset 4444
+#define __NR_landlock_add_rule 4445
+#define __NR_landlock_restrict_self 4446
+
diff --git a/libc-top-half/musl/arch/mips/bits/termios.h b/libc-top-half/musl/arch/mips/bits/termios.h
new file mode 100644
index 0000000..9d571f7
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/termios.h
@@ -0,0 +1,169 @@
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+ speed_t __c_ispeed;
+ speed_t __c_ospeed;
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VMIN 4
+#define VTIME 5
+#define VEOL2 6
+#define VSWTC 7
+#define VSWTCH 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOF 16
+#define VEOL 17
+
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+#endif
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#define B0 0000000
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+
+#define ISIG 0000001
+#define ICANON 0000002
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define IEXTEN 0000400
+#define TOSTOP 0100000
+#define ITOSTOP 0100000
+
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA 0000016
+#define EXTB 0000017
+#define CBAUD 0010017
+#define CBAUDEX 0010000
+#define CIBAUD 002003600000
+#define CMSPAR 010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE 0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0020000
+#define PENDIN 0040000
+#define EXTPROC 0200000
+
+#define XTABS 0014000
+#define TIOCSER_TEMT 1
+#endif
diff --git a/libc-top-half/musl/arch/mips/bits/user.h b/libc-top-half/musl/arch/mips/bits/user.h
new file mode 100644
index 0000000..3e26249
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/bits/user.h
@@ -0,0 +1,13 @@
+struct user {
+ unsigned long regs[45+64];
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long start_code, start_data, start_stack;
+ long signal;
+ void *u_ar0;
+ unsigned long magic;
+ char u_comm[32];
+};
+#define ELF_NGREG 45
+#define ELF_NFPREG 33
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
diff --git a/libc-top-half/musl/arch/mips/crt_arch.h b/libc-top-half/musl/arch/mips/crt_arch.h
new file mode 100644
index 0000000..9fc50d7
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/crt_arch.h
@@ -0,0 +1,29 @@
+__asm__(
+".set push\n"
+".set noreorder\n"
+".text \n"
+".global _" START "\n"
+".global " START "\n"
+".type _" START ", @function\n"
+".type " START ", @function\n"
+"_" START ":\n"
+"" START ":\n"
+" bal 1f \n"
+" move $fp, $0 \n"
+" .gpword . \n"
+" .gpword " START "_c \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" .gpword _DYNAMIC \n"
+"1: lw $gp, 0($ra) \n"
+" subu $gp, $ra, $gp \n"
+" move $4, $sp \n"
+" lw $5, 8($ra) \n"
+" addu $5, $5, $gp \n"
+" lw $25, 4($ra) \n"
+" addu $25, $25, $gp \n"
+" and $sp, $sp, -8 \n"
+" jalr $25 \n"
+" subu $sp, $sp, 16 \n"
+".set pop \n"
+);
diff --git a/libc-top-half/musl/arch/mips/ksigaction.h b/libc-top-half/musl/arch/mips/ksigaction.h
new file mode 100644
index 0000000..63fdfab
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/ksigaction.h
@@ -0,0 +1,13 @@
+#include <features.h>
+
+struct k_sigaction {
+ unsigned flags;
+ void (*handler)(int);
+ unsigned long mask[4];
+ /* The following field is past the end of the structure the
+ * kernel will read or write, and exists only to avoid having
+ * mips-specific preprocessor conditionals in sigaction.c. */
+ void (*restorer)();
+};
+
+hidden void __restore(), __restore_rt();
diff --git a/libc-top-half/musl/arch/mips/kstat.h b/libc-top-half/musl/arch/mips/kstat.h
new file mode 100644
index 0000000..5e637ea
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/kstat.h
@@ -0,0 +1,22 @@
+struct kstat {
+ unsigned st_dev;
+ long __st_padding1[3];
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned st_rdev;
+ long __st_padding2[3];
+ off_t st_size;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ blksize_t st_blksize;
+ long __st_padding3;
+ blkcnt_t st_blocks;
+ long __st_padding4[14];
+};
diff --git a/libc-top-half/musl/arch/mips/pthread_arch.h b/libc-top-half/musl/arch/mips/pthread_arch.h
new file mode 100644
index 0000000..376b774
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/pthread_arch.h
@@ -0,0 +1,18 @@
+static inline uintptr_t __get_tp()
+{
+ register uintptr_t tp __asm__("$3");
+#if __mips_isa_rev < 2
+ __asm__ (".word 0x7c03e83b" : "=r" (tp) );
+#else
+ __asm__ ("rdhwr %0, $29" : "=r" (tp) );
+#endif
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+#define MC_PC pc
diff --git a/libc-top-half/musl/arch/mips/reloc.h b/libc-top-half/musl/arch/mips/reloc.h
new file mode 100644
index 0000000..88d2363
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/reloc.h
@@ -0,0 +1,50 @@
+#if __mips_isa_rev >= 6
+#define ISA_SUFFIX "r6"
+#else
+#define ISA_SUFFIX ""
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "el"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#ifdef __mips_soft_float
+#define FP_SUFFIX "-sf"
+#else
+#define FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "mips" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+#define REL_SYM_OR_REL R_MIPS_REL32
+#define REL_PLT R_MIPS_JUMP_SLOT
+#define REL_COPY R_MIPS_COPY
+#define REL_DTPMOD R_MIPS_TLS_DTPMOD32
+#define REL_DTPOFF R_MIPS_TLS_DTPREL32
+#define REL_TPOFF R_MIPS_TLS_TPREL32
+
+#define NEED_MIPS_GOT_RELOCS 1
+#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ ".set push \n" \
+ ".set noreorder \n" \
+ " bal 1f \n" \
+ " nop \n" \
+ " .gpword . \n" \
+ " .gpword " #sym " \n" \
+ "1: lw %0, ($ra) \n" \
+ " subu %0, $ra, %0 \n" \
+ " lw $ra, 4($ra) \n" \
+ " addu %0, %0, $ra \n" \
+ ".set pop \n" \
+ : "=r"(*(fp)) : : "memory", "ra" )
diff --git a/libc-top-half/musl/arch/mips/syscall_arch.h b/libc-top-half/musl/arch/mips/syscall_arch.h
new file mode 100644
index 0000000..5b7c38d
--- /dev/null
+++ b/libc-top-half/musl/arch/mips/syscall_arch.h
@@ -0,0 +1,153 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
+
+#define SYSCALL_RLIM_INFINITY (-1UL/2)
+
+#if __mips_isa_rev >= 6
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+#else
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+#endif
+
+static inline long __syscall0(long n)
+{
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "addu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r4 __asm__("$4") = a;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "addu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "addu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "addu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "addu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$8", "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "subu $sp,$sp,32 ; sw $8,16($sp) ; "
+ "addu $2,$0,%3 ; syscall ;"
+ "addu $sp,$sp,32"
+ : "=&r"(r2), "+r"(r7), "+r"(r8)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$9", "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r9 __asm__("$9") = f;
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; "
+ "addu $2,$0,%4 ; syscall ;"
+ "addu $sp,$sp,32"
+ : "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST, "$10");
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r9 __asm__("$9") = f;
+ register long r10 __asm__("$10") = g;
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "subu $sp,$sp,32 ; sw $8,16($sp) ; sw $9,20($sp) ; sw $10,24($sp) ; "
+ "addu $2,$0,%5 ; syscall ;"
+ "addu $sp,$sp,32"
+ : "=&r"(r2), "+r"(r7), "+r"(r8), "+r"(r9), "+r"(r10)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+#define VDSO_USEFUL
+#define VDSO_CGT32_SYM "__vdso_clock_gettime"
+#define VDSO_CGT32_VER "LINUX_2.6"
+#define VDSO_CGT_SYM "__vdso_clock_gettime64"
+#define VDSO_CGT_VER "LINUX_2.6"
+
+#define SO_SNDTIMEO_OLD 0x1005
+#define SO_RCVTIMEO_OLD 0x1006
+
+#undef SYS_socketcall
diff --git a/libc-top-half/musl/arch/mips64/atomic_arch.h b/libc-top-half/musl/arch/mips64/atomic_arch.h
new file mode 100644
index 0000000..d0f8b4a
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/atomic_arch.h
@@ -0,0 +1,56 @@
+#if __mips_isa_rev < 6
+#define LLSC_M "m"
+#else
+#define LLSC_M "ZC"
+#endif
+
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+ __asm__ __volatile__ (
+ "ll %0, %1"
+ : "=r"(v) : LLSC_M(*p));
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+ __asm__ __volatile__ (
+ "sc %0, %1"
+ : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory");
+ return r;
+}
+
+#define a_ll_p a_ll_p
+static inline void *a_ll_p(volatile void *p)
+{
+ void *v;
+ __asm__ __volatile__ (
+ "lld %0, %1"
+ : "=r"(v) : LLSC_M(*(void *volatile *)p));
+ return v;
+}
+
+#define a_sc_p a_sc_p
+static inline int a_sc_p(volatile void *p, void *v)
+{
+ long r;
+ __asm__ __volatile__ (
+ "scd %0, %1"
+ : "=r"(r), "="LLSC_M(*(void *volatile *)p) : "0"(v) : "memory");
+ return r;
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("sync" : : : "memory");
+}
+
+#define a_pre_llsc a_barrier
+#define a_post_llsc a_barrier
+
+#undef LLSC_M
diff --git a/libc-top-half/musl/arch/mips64/bits/alltypes.h.in b/libc-top-half/musl/arch/mips64/bits/alltypes.h.in
new file mode 100644
index 0000000..fcd61ee
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/alltypes.h.in
@@ -0,0 +1,22 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#if _MIPSEL || __MIPSEL || __MIPSEL__
+#define __BYTE_ORDER 1234
+#else
+#define __BYTE_ORDER 4321
+#endif
+
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
+
+TYPEDEF unsigned nlink_t;
diff --git a/libc-top-half/musl/arch/mips64/bits/errno.h b/libc-top-half/musl/arch/mips64/bits/errno.h
new file mode 100644
index 0000000..1bb91e3
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define ENOMSG 35
+#define EIDRM 36
+#define ECHRNG 37
+#define EL2NSYNC 38
+#define EL3HLT 39
+#define EL3RST 40
+#define ELNRNG 41
+#define EUNATCH 42
+#define ENOCSI 43
+#define EL2HLT 44
+#define EDEADLK 45
+#define ENOLCK 46
+#define EBADE 50
+#define EBADR 51
+#define EXFULL 52
+#define ENOANO 53
+#define EBADRQC 54
+#define EBADSLT 55
+#define EDEADLOCK 56
+#define EBFONT 59
+#define ENOSTR 60
+#define ENODATA 61
+#define ETIME 62
+#define ENOSR 63
+#define ENONET 64
+#define ENOPKG 65
+#define EREMOTE 66
+#define ENOLINK 67
+#define EADV 68
+#define ESRMNT 69
+#define ECOMM 70
+#define EPROTO 71
+#define EDOTDOT 73
+#define EMULTIHOP 74
+#define EBADMSG 77
+#define ENAMETOOLONG 78
+#define EOVERFLOW 79
+#define ENOTUNIQ 80
+#define EBADFD 81
+#define EREMCHG 82
+#define ELIBACC 83
+#define ELIBBAD 84
+#define ELIBSCN 85
+#define ELIBMAX 86
+#define ELIBEXEC 87
+#define EILSEQ 88
+#define ENOSYS 89
+#define ELOOP 90
+#define ERESTART 91
+#define ESTRPIPE 92
+#define ENOTEMPTY 93
+#define EUSERS 94
+#define ENOTSOCK 95
+#define EDESTADDRREQ 96
+#define EMSGSIZE 97
+#define EPROTOTYPE 98
+#define ENOPROTOOPT 99
+#define EPROTONOSUPPORT 120
+#define ESOCKTNOSUPPORT 121
+#define EOPNOTSUPP 122
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT 123
+#define EAFNOSUPPORT 124
+#define EADDRINUSE 125
+#define EADDRNOTAVAIL 126
+#define ENETDOWN 127
+#define ENETUNREACH 128
+#define ENETRESET 129
+#define ECONNABORTED 130
+#define ECONNRESET 131
+#define ENOBUFS 132
+#define EISCONN 133
+#define ENOTCONN 134
+#define EUCLEAN 135
+#define ENOTNAM 137
+#define ENAVAIL 138
+#define EISNAM 139
+#define EREMOTEIO 140
+#define ESHUTDOWN 143
+#define ETOOMANYREFS 144
+#define ETIMEDOUT 145
+#define ECONNREFUSED 146
+#define EHOSTDOWN 147
+#define EHOSTUNREACH 148
+#define EWOULDBLOCK EAGAIN
+#define EALREADY 149
+#define EINPROGRESS 150
+#define ESTALE 151
+#define ECANCELED 158
+#define ENOMEDIUM 159
+#define EMEDIUMTYPE 160
+#define ENOKEY 161
+#define EKEYEXPIRED 162
+#define EKEYREVOKED 163
+#define EKEYREJECTED 164
+#define EOWNERDEAD 165
+#define ENOTRECOVERABLE 166
+#define ERFKILL 167
+#define EHWPOISON 168
+#define EDQUOT 1133
diff --git a/libc-top-half/musl/arch/mips64/bits/fcntl.h b/libc-top-half/musl/arch/mips64/bits/fcntl.h
new file mode 100644
index 0000000..5da1eef
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0400
+#define O_EXCL 02000
+#define O_NOCTTY 04000
+#define O_TRUNC 01000
+#define O_APPEND 0010
+#define O_NONBLOCK 0200
+#define O_DSYNC 0020
+#define O_SYNC 040020
+#define O_RSYNC 040020
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 010000
+#define O_DIRECT 0100000
+#define O_LARGEFILE 020000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 24
+#define F_GETOWN 23
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 14
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/mips64/bits/fenv.h b/libc-top-half/musl/arch/mips64/bits/fenv.h
new file mode 100644
index 0000000..2762089
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/fenv.h
@@ -0,0 +1,25 @@
+#ifdef __mips_soft_float
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+#else
+#define FE_INEXACT 4
+#define FE_UNDERFLOW 8
+#define FE_OVERFLOW 16
+#define FE_DIVBYZERO 32
+#define FE_INVALID 64
+
+#define FE_ALL_EXCEPT 124
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+#endif
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+ unsigned __cw;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/mips64/bits/float.h b/libc-top-half/musl/arch/mips64/bits/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/libc-top-half/musl/arch/mips64/bits/hwcap.h b/libc-top-half/musl/arch/mips64/bits/hwcap.h
new file mode 100644
index 0000000..13e86fe
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/hwcap.h
@@ -0,0 +1,3 @@
+#define HWCAP_MIPS_R6 (1 << 0)
+#define HWCAP_MIPS_MSA (1 << 1)
+#define HWCAP_MIPS_CRC32 (1 << 2)
diff --git a/libc-top-half/musl/arch/mips64/bits/ioctl.h b/libc-top-half/musl/arch/mips64/bits/ioctl.h
new file mode 100644
index 0000000..e277c3f
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/ioctl.h
@@ -0,0 +1,114 @@
+#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETA 0x5401
+#define TCSETA 0x5402
+#define TCSETAW 0x5403
+#define TCSETAF 0x5404
+#define TCSBRK 0x5405
+#define TCXONC 0x5406
+#define TCFLSH 0x5407
+#define TCGETS 0x540D
+#define TCSETS 0x540E
+#define TCSETSW 0x540F
+#define TCSETSF 0x5410
+
+#define TIOCEXCL 0x740D
+#define TIOCNXCL 0x740E
+#define TIOCOUTQ 0x7472
+#define TIOCSTI 0x5472
+#define TIOCMGET 0x741D
+#define TIOCMBIS 0x741B
+#define TIOCMBIC 0x741C
+#define TIOCMSET 0x741A
+
+#define TIOCPKT 0x5470
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define TIOCNOTTY 0x5471
+#define TIOCSETD 0x7401
+#define TIOCGETD 0x7400
+
+#define FIOCLEX 0x6601
+#define FIONCLEX 0x6602
+#define FIOASYNC 0x667D
+#define FIONBIO 0x667E
+#define FIOQSIZE 0x667F
+
+#define TIOCGLTC 0x7474
+#define TIOCSLTC 0x7475
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+#define TIOCCONS _IOW('t', 120, int)
+
+#define FIONREAD 0x467F
+#define TIOCINQ FIONREAD
+
+#define TIOCGETP 0x7408
+#define TIOCSETP 0x7409
+#define TIOCSETN 0x740A
+
+#define TIOCSBRK 0x5427
+#define TIOCCBRK 0x5428
+#define TIOCGSID 0x7416
+#define TIOCGRS485 _IOR('T', 0x2E, char[32])
+#define TIOCSRS485 _IOWR('T', 0x2F, char[32])
+#define TIOCGPTN _IOR('T', 0x30, unsigned int)
+#define TIOCSPTLCK _IOW('T', 0x31, int)
+#define TIOCGDEV _IOR('T', 0x32, unsigned int)
+#define TIOCSIG _IOW('T', 0x36, int)
+#define TIOCVHANGUP 0x5437
+#define TIOCGPKT _IOR('T', 0x38, int)
+#define TIOCGPTLCK _IOR('T', 0x39, int)
+#define TIOCGEXCL _IOR('T', 0x40, int)
+#define TIOCGPTPEER _IO('T', 0x41)
+
+#define TIOCSCTTY 0x5480
+#define TIOCGSOFTCAR 0x5481
+#define TIOCSSOFTCAR 0x5482
+#define TIOCLINUX 0x5483
+#define TIOCGSERIAL 0x5484
+#define TIOCSSERIAL 0x5485
+#define TCSBRKP 0x5486
+
+#define TIOCSERCONFIG 0x5488
+#define TIOCSERGWILD 0x5489
+#define TIOCSERSWILD 0x548A
+#define TIOCGLCKTRMIOS 0x548B
+#define TIOCSLCKTRMIOS 0x548C
+#define TIOCSERGSTRUCT 0x548D
+#define TIOCSERGETLSR 0x548E
+#define TIOCSERGETMULTI 0x548F
+#define TIOCSERSETMULTI 0x5490
+#define TIOCMIWAIT 0x5491
+#define TIOCGICOUNT 0x5492
+
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x010
+#define TIOCM_SR 0x020
+#define TIOCM_CTS 0x040
+#define TIOCM_CAR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RNG 0x200
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_DSR 0x400
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+#define SIOCGSTAMP 0x8906
+#define SIOCGSTAMPNS 0x8907
diff --git a/libc-top-half/musl/arch/mips64/bits/ipc.h b/libc-top-half/musl/arch/mips64/bits/ipc.h
new file mode 100644
index 0000000..df22716
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/ipc.h
@@ -0,0 +1,12 @@
+struct ipc_perm {
+ key_t __ipc_perm_key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ mode_t mode;
+ int __ipc_perm_seq;
+ int __pad1;
+ unsigned long __unused1;
+ unsigned long __unused2;
+};
diff --git a/libc-top-half/musl/arch/mips64/bits/mman.h b/libc-top-half/musl/arch/mips64/bits/mman.h
new file mode 100644
index 0000000..9027bb6
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/mman.h
@@ -0,0 +1,25 @@
+#undef MAP_ANON
+#define MAP_ANON 0x800
+#undef MAP_NORESERVE
+#define MAP_NORESERVE 0x0400
+#undef MAP_GROWSDOWN
+#define MAP_GROWSDOWN 0x1000
+#undef MAP_DENYWRITE
+#define MAP_DENYWRITE 0x2000
+#undef MAP_EXECUTABLE
+#define MAP_EXECUTABLE 0x4000
+#undef MAP_LOCKED
+#define MAP_LOCKED 0x8000
+#undef MAP_POPULATE
+#define MAP_POPULATE 0x10000
+#undef MAP_NONBLOCK
+#define MAP_NONBLOCK 0x20000
+#undef MAP_STACK
+#define MAP_STACK 0x40000
+#undef MAP_HUGETLB
+#define MAP_HUGETLB 0x80000
+#undef MAP_SYNC
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#undef MADV_SOFT_OFFLINE
+#endif
diff --git a/libc-top-half/musl/arch/mips64/bits/poll.h b/libc-top-half/musl/arch/mips64/bits/poll.h
new file mode 100644
index 0000000..b0b1ed6
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/poll.h
@@ -0,0 +1,2 @@
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND 0x100
diff --git a/libc-top-half/musl/arch/mips64/bits/posix.h b/libc-top-half/musl/arch/mips64/bits/posix.h
new file mode 100644
index 0000000..acf4294
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFFBIG 1
+#define _POSIX_V7_LP64_OFFBIG 1
diff --git a/libc-top-half/musl/arch/mips64/bits/ptrace.h b/libc-top-half/musl/arch/mips64/bits/ptrace.h
new file mode 100644
index 0000000..77a01c0
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/ptrace.h
@@ -0,0 +1,9 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_PEEKTEXT_3264 0xc0
+#define PTRACE_PEEKDATA_3264 0xc1
+#define PTRACE_POKETEXT_3264 0xc2
+#define PTRACE_POKEDATA_3264 0xc3
+#define PTRACE_GET_THREAD_AREA_3264 0xc4
+#define PTRACE_GET_WATCH_REGS 0xd0
+#define PTRACE_SET_WATCH_REGS 0xd1
diff --git a/libc-top-half/musl/arch/mips64/bits/reg.h b/libc-top-half/musl/arch/mips64/bits/reg.h
new file mode 100644
index 0000000..a3f63ac
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/reg.h
@@ -0,0 +1,47 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+
+#define EF_R0 0
+#define EF_R1 1
+#define EF_R2 2
+#define EF_R3 3
+#define EF_R4 4
+#define EF_R5 5
+#define EF_R6 6
+#define EF_R7 7
+#define EF_R8 8
+#define EF_R9 9
+#define EF_R10 10
+#define EF_R11 11
+#define EF_R12 12
+#define EF_R13 13
+#define EF_R14 14
+#define EF_R15 15
+#define EF_R16 16
+#define EF_R17 17
+#define EF_R18 18
+#define EF_R19 19
+#define EF_R20 20
+#define EF_R21 21
+#define EF_R22 22
+#define EF_R23 23
+#define EF_R24 24
+#define EF_R25 25
+
+#define EF_R26 26
+#define EF_R27 27
+#define EF_R28 28
+#define EF_R29 29
+#define EF_R30 30
+#define EF_R31 31
+
+#define EF_LO 32
+#define EF_HI 33
+
+#define EF_CP0_EPC 34
+#define EF_CP0_BADVADDR 35
+#define EF_CP0_STATUS 36
+#define EF_CP0_CAUSE 37
+#define EF_UNUSED0 38
+
+#define EF_SIZE 304
diff --git a/libc-top-half/musl/arch/mips64/bits/resource.h b/libc-top-half/musl/arch/mips64/bits/resource.h
new file mode 100644
index 0000000..414a405
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/resource.h
@@ -0,0 +1,5 @@
+#define RLIMIT_NOFILE 5
+#define RLIMIT_AS 6
+#define RLIMIT_RSS 7
+#define RLIMIT_NPROC 8
+#define RLIMIT_MEMLOCK 9
diff --git a/libc-top-half/musl/arch/mips64/bits/setjmp.h b/libc-top-half/musl/arch/mips64/bits/setjmp.h
new file mode 100644
index 0000000..4d93267
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long __jmp_buf[23];
diff --git a/libc-top-half/musl/arch/mips64/bits/signal.h b/libc-top-half/musl/arch/mips64/bits/signal.h
new file mode 100644
index 0000000..4f91c9f
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/signal.h
@@ -0,0 +1,143 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long long greg_t, gregset_t[32];
+
+typedef struct {
+ union {
+ double fp_dregs[32];
+ struct {
+ float _fp_fregs;
+ unsigned _fp_pad;
+ } fp_fregs[32];
+ } fp_r;
+} fpregset_t;
+
+struct sigcontext {
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned long long sc_mdhi;
+ unsigned long long sc_hi1;
+ unsigned long long sc_hi2;
+ unsigned long long sc_hi3;
+ unsigned long long sc_mdlo;
+ unsigned long long sc_lo1;
+ unsigned long long sc_lo2;
+ unsigned long long sc_lo3;
+ unsigned long long sc_pc;
+ unsigned int sc_fpc_csr;
+ unsigned int sc_used_math;
+ unsigned int sc_dsp;
+ unsigned int sc_reserved;
+};
+
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ greg_t mdhi;
+ greg_t hi1;
+ greg_t hi2;
+ greg_t hi3;
+ greg_t mdlo;
+ greg_t lo1;
+ greg_t lo2;
+ greg_t lo3;
+ greg_t pc;
+ unsigned int fpc_csr;
+ unsigned int used_math;
+ unsigned int dsp;
+ unsigned int reserved;
+} mcontext_t;
+
+#else
+typedef struct {
+ unsigned long long __mc1[32];
+ double __mc2[32];
+ unsigned long long __mc3[9];
+ unsigned __mc4[4];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 0x10000
+#define SA_SIGINFO 8
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#undef SIG_BLOCK
+#undef SIG_UNBLOCK
+#undef SIG_SETMASK
+#define SIG_BLOCK 1
+#define SIG_UNBLOCK 2
+#define SIG_SETMASK 3
+
+#undef SI_ASYNCIO
+#undef SI_MESGQ
+#undef SI_TIMER
+#define SI_ASYNCIO (-2)
+#define SI_MESGQ (-4)
+#define SI_TIMER (-3)
+
+#define __SI_SWAP_ERRNO_CODE
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#define SIGEMT 7
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGBUS 10
+#define SIGSEGV 11
+#define SIGSYS 12
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGUSR1 16
+#define SIGUSR2 17
+#define SIGCHLD 18
+#define SIGPWR 19
+#define SIGWINCH 20
+#define SIGURG 21
+#define SIGIO 22
+#define SIGPOLL SIGIO
+#define SIGSTOP 23
+#define SIGTSTP 24
+#define SIGCONT 25
+#define SIGTTIN 26
+#define SIGTTOU 27
+#define SIGVTALRM 28
+#define SIGPROF 29
+#define SIGXCPU 30
+#define SIGXFSZ 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 128
diff --git a/libc-top-half/musl/arch/mips64/bits/socket.h b/libc-top-half/musl/arch/mips64/bits/socket.h
new file mode 100644
index 0000000..519b9c8
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/socket.h
@@ -0,0 +1,35 @@
+#define SOCK_STREAM 2
+#define SOCK_DGRAM 1
+#define SOL_SOCKET 65535
+#define SO_DEBUG 1
+
+#define SO_REUSEADDR 0x0004
+#define SO_KEEPALIVE 0x0008
+#define SO_DONTROUTE 0x0010
+#define SO_BROADCAST 0x0020
+#define SO_LINGER 0x0080
+#define SO_OOBINLINE 0x0100
+#define SO_REUSEPORT 0x0200
+#define SO_SNDBUF 0x1001
+#define SO_RCVBUF 0x1002
+#define SO_SNDLOWAT 0x1003
+#define SO_RCVLOWAT 0x1004
+#define SO_RCVTIMEO 0x1006
+#define SO_SNDTIMEO 0x1005
+#define SO_ERROR 0x1007
+#define SO_TYPE 0x1008
+#define SO_ACCEPTCONN 0x1009
+#define SO_PROTOCOL 0x1028
+#define SO_DOMAIN 0x1029
+
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_BSDCOMPAT 14
+#define SO_PASSCRED 17
+#define SO_PEERCRED 18
+#define SO_PEERSEC 30
+#define SO_SNDBUFFORCE 31
+#define SO_RCVBUFFORCE 33
+
+#define SOCK_NONBLOCK 0200
+#define SOCK_CLOEXEC 02000000
diff --git a/libc-top-half/musl/arch/mips64/bits/stat.h b/libc-top-half/musl/arch/mips64/bits/stat.h
new file mode 100644
index 0000000..b620e14
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/stat.h
@@ -0,0 +1,20 @@
+struct stat {
+ dev_t st_dev;
+ int __pad1[3];
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ unsigned int __pad2[2];
+ off_t st_size;
+ int __pad3;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ blksize_t st_blksize;
+ unsigned int __pad4;
+ blkcnt_t st_blocks;
+ int __pad5[14];
+};
diff --git a/libc-top-half/musl/arch/mips64/bits/statfs.h b/libc-top-half/musl/arch/mips64/bits/statfs.h
new file mode 100644
index 0000000..a73bd54
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/statfs.h
@@ -0,0 +1,8 @@
+struct statfs {
+ unsigned long f_type, f_bsize, f_frsize;
+ fsblkcnt_t f_blocks, f_bfree;
+ fsfilcnt_t f_files, f_ffree;
+ fsblkcnt_t f_bavail;
+ fsid_t f_fsid;
+ unsigned long f_namelen, f_flags, f_spare[5];
+};
diff --git a/libc-top-half/musl/arch/mips64/bits/stdint.h b/libc-top-half/musl/arch/mips64/bits/stdint.h
new file mode 100644
index 0000000..1bb147f
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#define SIZE_MAX UINT64_MAX
diff --git a/libc-top-half/musl/arch/mips64/bits/syscall.h.in b/libc-top-half/musl/arch/mips64/bits/syscall.h.in
new file mode 100644
index 0000000..b89965d
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/syscall.h.in
@@ -0,0 +1,351 @@
+#define __NR_read 5000
+#define __NR_write 5001
+#define __NR_open 5002
+#define __NR_close 5003
+#define __NR_stat 5004
+#define __NR_fstat 5005
+#define __NR_lstat 5006
+#define __NR_poll 5007
+#define __NR_lseek 5008
+#define __NR_mmap 5009
+#define __NR_mprotect 5010
+#define __NR_munmap 5011
+#define __NR_brk 5012
+#define __NR_rt_sigaction 5013
+#define __NR_rt_sigprocmask 5014
+#define __NR_ioctl 5015
+#define __NR_pread64 5016
+#define __NR_pwrite64 5017
+#define __NR_readv 5018
+#define __NR_writev 5019
+#define __NR_access 5020
+#define __NR_pipe 5021
+#define __NR__newselect 5022
+#define __NR_sched_yield 5023
+#define __NR_mremap 5024
+#define __NR_msync 5025
+#define __NR_mincore 5026
+#define __NR_madvise 5027
+#define __NR_shmget 5028
+#define __NR_shmat 5029
+#define __NR_shmctl 5030
+#define __NR_dup 5031
+#define __NR_dup2 5032
+#define __NR_pause 5033
+#define __NR_nanosleep 5034
+#define __NR_getitimer 5035
+#define __NR_setitimer 5036
+#define __NR_alarm 5037
+#define __NR_getpid 5038
+#define __NR_sendfile 5039
+#define __NR_socket 5040
+#define __NR_connect 5041
+#define __NR_accept 5042
+#define __NR_sendto 5043
+#define __NR_recvfrom 5044
+#define __NR_sendmsg 5045
+#define __NR_recvmsg 5046
+#define __NR_shutdown 5047
+#define __NR_bind 5048
+#define __NR_listen 5049
+#define __NR_getsockname 5050
+#define __NR_getpeername 5051
+#define __NR_socketpair 5052
+#define __NR_setsockopt 5053
+#define __NR_getsockopt 5054
+#define __NR_clone 5055
+#define __NR_fork 5056
+#define __NR_execve 5057
+#define __NR_exit 5058
+#define __NR_wait4 5059
+#define __NR_kill 5060
+#define __NR_uname 5061
+#define __NR_semget 5062
+#define __NR_semop 5063
+#define __NR_semctl 5064
+#define __NR_shmdt 5065
+#define __NR_msgget 5066
+#define __NR_msgsnd 5067
+#define __NR_msgrcv 5068
+#define __NR_msgctl 5069
+#define __NR_fcntl 5070
+#define __NR_flock 5071
+#define __NR_fsync 5072
+#define __NR_fdatasync 5073
+#define __NR_truncate 5074
+#define __NR_ftruncate 5075
+#define __NR_getdents 5076
+#define __NR_getcwd 5077
+#define __NR_chdir 5078
+#define __NR_fchdir 5079
+#define __NR_rename 5080
+#define __NR_mkdir 5081
+#define __NR_rmdir 5082
+#define __NR_creat 5083
+#define __NR_link 5084
+#define __NR_unlink 5085
+#define __NR_symlink 5086
+#define __NR_readlink 5087
+#define __NR_chmod 5088
+#define __NR_fchmod 5089
+#define __NR_chown 5090
+#define __NR_fchown 5091
+#define __NR_lchown 5092
+#define __NR_umask 5093
+#define __NR_gettimeofday 5094
+#define __NR_getrlimit 5095
+#define __NR_getrusage 5096
+#define __NR_sysinfo 5097
+#define __NR_times 5098
+#define __NR_ptrace 5099
+#define __NR_getuid 5100
+#define __NR_syslog 5101
+#define __NR_getgid 5102
+#define __NR_setuid 5103
+#define __NR_setgid 5104
+#define __NR_geteuid 5105
+#define __NR_getegid 5106
+#define __NR_setpgid 5107
+#define __NR_getppid 5108
+#define __NR_getpgrp 5109
+#define __NR_setsid 5110
+#define __NR_setreuid 5111
+#define __NR_setregid 5112
+#define __NR_getgroups 5113
+#define __NR_setgroups 5114
+#define __NR_setresuid 5115
+#define __NR_getresuid 5116
+#define __NR_setresgid 5117
+#define __NR_getresgid 5118
+#define __NR_getpgid 5119
+#define __NR_setfsuid 5120
+#define __NR_setfsgid 5121
+#define __NR_getsid 5122
+#define __NR_capget 5123
+#define __NR_capset 5124
+#define __NR_rt_sigpending 5125
+#define __NR_rt_sigtimedwait 5126
+#define __NR_rt_sigqueueinfo 5127
+#define __NR_rt_sigsuspend 5128
+#define __NR_sigaltstack 5129
+#define __NR_utime 5130
+#define __NR_mknod 5131
+#define __NR_personality 5132
+#define __NR_ustat 5133
+#define __NR_statfs 5134
+#define __NR_fstatfs 5135
+#define __NR_sysfs 5136
+#define __NR_getpriority 5137
+#define __NR_setpriority 5138
+#define __NR_sched_setparam 5139
+#define __NR_sched_getparam 5140
+#define __NR_sched_setscheduler 5141
+#define __NR_sched_getscheduler 5142
+#define __NR_sched_get_priority_max 5143
+#define __NR_sched_get_priority_min 5144
+#define __NR_sched_rr_get_interval 5145
+#define __NR_mlock 5146
+#define __NR_munlock 5147
+#define __NR_mlockall 5148
+#define __NR_munlockall 5149
+#define __NR_vhangup 5150
+#define __NR_pivot_root 5151
+#define __NR__sysctl 5152
+#define __NR_prctl 5153
+#define __NR_adjtimex 5154
+#define __NR_setrlimit 5155
+#define __NR_chroot 5156
+#define __NR_sync 5157
+#define __NR_acct 5158
+#define __NR_settimeofday 5159
+#define __NR_mount 5160
+#define __NR_umount2 5161
+#define __NR_swapon 5162
+#define __NR_swapoff 5163
+#define __NR_reboot 5164
+#define __NR_sethostname 5165
+#define __NR_setdomainname 5166
+#define __NR_create_module 5167
+#define __NR_init_module 5168
+#define __NR_delete_module 5169
+#define __NR_get_kernel_syms 5170
+#define __NR_query_module 5171
+#define __NR_quotactl 5172
+#define __NR_nfsservctl 5173
+#define __NR_getpmsg 5174
+#define __NR_putpmsg 5175
+#define __NR_afs_syscall 5176
+#define __NR_reserved177 5177
+#define __NR_gettid 5178
+#define __NR_readahead 5179
+#define __NR_setxattr 5180
+#define __NR_lsetxattr 5181
+#define __NR_fsetxattr 5182
+#define __NR_getxattr 5183
+#define __NR_lgetxattr 5184
+#define __NR_fgetxattr 5185
+#define __NR_listxattr 5186
+#define __NR_llistxattr 5187
+#define __NR_flistxattr 5188
+#define __NR_removexattr 5189
+#define __NR_lremovexattr 5190
+#define __NR_fremovexattr 5191
+#define __NR_tkill 5192
+#define __NR_reserved193 5193
+#define __NR_futex 5194
+#define __NR_sched_setaffinity 5195
+#define __NR_sched_getaffinity 5196
+#define __NR_cacheflush 5197
+#define __NR_cachectl 5198
+#define __NR_sysmips 5199
+#define __NR_io_setup 5200
+#define __NR_io_destroy 5201
+#define __NR_io_getevents 5202
+#define __NR_io_submit 5203
+#define __NR_io_cancel 5204
+#define __NR_exit_group 5205
+#define __NR_lookup_dcookie 5206
+#define __NR_epoll_create 5207
+#define __NR_epoll_ctl 5208
+#define __NR_epoll_wait 5209
+#define __NR_remap_file_pages 5210
+#define __NR_rt_sigreturn 5211
+#define __NR_set_tid_address 5212
+#define __NR_restart_syscall 5213
+#define __NR_semtimedop 5214
+#define __NR_fadvise64 5215
+#define __NR_timer_create 5216
+#define __NR_timer_settime 5217
+#define __NR_timer_gettime 5218
+#define __NR_timer_getoverrun 5219
+#define __NR_timer_delete 5220
+#define __NR_clock_settime 5221
+#define __NR_clock_gettime 5222
+#define __NR_clock_getres 5223
+#define __NR_clock_nanosleep 5224
+#define __NR_tgkill 5225
+#define __NR_utimes 5226
+#define __NR_mbind 5227
+#define __NR_get_mempolicy 5228
+#define __NR_set_mempolicy 5229
+#define __NR_mq_open 5230
+#define __NR_mq_unlink 5231
+#define __NR_mq_timedsend 5232
+#define __NR_mq_timedreceive 5233
+#define __NR_mq_notify 5234
+#define __NR_mq_getsetattr 5235
+#define __NR_vserver 5236
+#define __NR_waitid 5237
+#define __NR_add_key 5239
+#define __NR_request_key 5240
+#define __NR_keyctl 5241
+#define __NR_set_thread_area 5242
+#define __NR_inotify_init 5243
+#define __NR_inotify_add_watch 5244
+#define __NR_inotify_rm_watch 5245
+#define __NR_migrate_pages 5246
+#define __NR_openat 5247
+#define __NR_mkdirat 5248
+#define __NR_mknodat 5249
+#define __NR_fchownat 5250
+#define __NR_futimesat 5251
+#define __NR_newfstatat 5252
+#define __NR_unlinkat 5253
+#define __NR_renameat 5254
+#define __NR_linkat 5255
+#define __NR_symlinkat 5256
+#define __NR_readlinkat 5257
+#define __NR_fchmodat 5258
+#define __NR_faccessat 5259
+#define __NR_pselect6 5260
+#define __NR_ppoll 5261
+#define __NR_unshare 5262
+#define __NR_splice 5263
+#define __NR_sync_file_range 5264
+#define __NR_tee 5265
+#define __NR_vmsplice 5266
+#define __NR_move_pages 5267
+#define __NR_set_robust_list 5268
+#define __NR_get_robust_list 5269
+#define __NR_kexec_load 5270
+#define __NR_getcpu 5271
+#define __NR_epoll_pwait 5272
+#define __NR_ioprio_set 5273
+#define __NR_ioprio_get 5274
+#define __NR_utimensat 5275
+#define __NR_signalfd 5276
+#define __NR_timerfd 5277
+#define __NR_eventfd 5278
+#define __NR_fallocate 5279
+#define __NR_timerfd_create 5280
+#define __NR_timerfd_gettime 5281
+#define __NR_timerfd_settime 5282
+#define __NR_signalfd4 5283
+#define __NR_eventfd2 5284
+#define __NR_epoll_create1 5285
+#define __NR_dup3 5286
+#define __NR_pipe2 5287
+#define __NR_inotify_init1 5288
+#define __NR_preadv 5289
+#define __NR_pwritev 5290
+#define __NR_rt_tgsigqueueinfo 5291
+#define __NR_perf_event_open 5292
+#define __NR_accept4 5293
+#define __NR_recvmmsg 5294
+#define __NR_fanotify_init 5295
+#define __NR_fanotify_mark 5296
+#define __NR_prlimit64 5297
+#define __NR_name_to_handle_at 5298
+#define __NR_open_by_handle_at 5299
+#define __NR_clock_adjtime 5300
+#define __NR_syncfs 5301
+#define __NR_sendmmsg 5302
+#define __NR_setns 5303
+#define __NR_process_vm_readv 5304
+#define __NR_process_vm_writev 5305
+#define __NR_kcmp 5306
+#define __NR_finit_module 5307
+#define __NR_getdents64 5308
+#define __NR_sched_setattr 5309
+#define __NR_sched_getattr 5310
+#define __NR_renameat2 5311
+#define __NR_seccomp 5312
+#define __NR_getrandom 5313
+#define __NR_memfd_create 5314
+#define __NR_bpf 5315
+#define __NR_execveat 5316
+#define __NR_userfaultfd 5317
+#define __NR_membarrier 5318
+#define __NR_mlock2 5319
+#define __NR_copy_file_range 5320
+#define __NR_preadv2 5321
+#define __NR_pwritev2 5322
+#define __NR_pkey_mprotect 5323
+#define __NR_pkey_alloc 5324
+#define __NR_pkey_free 5325
+#define __NR_statx 5326
+#define __NR_rseq 5327
+#define __NR_io_pgetevents 5328
+#define __NR_pidfd_send_signal 5424
+#define __NR_io_uring_setup 5425
+#define __NR_io_uring_enter 5426
+#define __NR_io_uring_register 5427
+#define __NR_open_tree 5428
+#define __NR_move_mount 5429
+#define __NR_fsopen 5430
+#define __NR_fsconfig 5431
+#define __NR_fsmount 5432
+#define __NR_fspick 5433
+#define __NR_pidfd_open 5434
+#define __NR_clone3 5435
+#define __NR_close_range 5436
+#define __NR_openat2 5437
+#define __NR_pidfd_getfd 5438
+#define __NR_faccessat2 5439
+#define __NR_process_madvise 5440
+#define __NR_epoll_pwait2 5441
+#define __NR_mount_setattr 5442
+#define __NR_landlock_create_ruleset 5444
+#define __NR_landlock_add_rule 5445
+#define __NR_landlock_restrict_self 5446
+
diff --git a/libc-top-half/musl/arch/mips64/bits/termios.h b/libc-top-half/musl/arch/mips64/bits/termios.h
new file mode 100644
index 0000000..9d571f7
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/termios.h
@@ -0,0 +1,169 @@
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+ speed_t __c_ispeed;
+ speed_t __c_ospeed;
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VMIN 4
+#define VTIME 5
+#define VEOL2 6
+#define VSWTC 7
+#define VSWTCH 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOF 16
+#define VEOL 17
+
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+#endif
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#define B0 0000000
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+
+#define ISIG 0000001
+#define ICANON 0000002
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define IEXTEN 0000400
+#define TOSTOP 0100000
+#define ITOSTOP 0100000
+
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA 0000016
+#define EXTB 0000017
+#define CBAUD 0010017
+#define CBAUDEX 0010000
+#define CIBAUD 002003600000
+#define CMSPAR 010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE 0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0020000
+#define PENDIN 0040000
+#define EXTPROC 0200000
+
+#define XTABS 0014000
+#define TIOCSER_TEMT 1
+#endif
diff --git a/libc-top-half/musl/arch/mips64/bits/user.h b/libc-top-half/musl/arch/mips64/bits/user.h
new file mode 100644
index 0000000..60fa1fd
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/bits/user.h
@@ -0,0 +1,15 @@
+struct user {
+ unsigned long regs[102];
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long long start_code, start_data, start_stack;
+ long long signal;
+ unsigned long long *u_ar0;
+ unsigned long long magic;
+ char u_comm[32];
+};
+
+#define ELF_NGREG 45
+#define ELF_NFPREG 33
+
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
diff --git a/libc-top-half/musl/arch/mips64/crt_arch.h b/libc-top-half/musl/arch/mips64/crt_arch.h
new file mode 100644
index 0000000..d148f97
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/crt_arch.h
@@ -0,0 +1,33 @@
+__asm__(
+".set push\n"
+".set noreorder\n"
+".text \n"
+".global _" START "\n"
+".global " START "\n"
+".global " START "_data\n"
+".type _" START ", @function\n"
+".type " START ", @function\n"
+".type " START "_data, @function\n"
+"_" START ":\n"
+"" START ":\n"
+".align 8 \n"
+" bal 1f \n"
+" move $fp, $0 \n"
+"" START "_data: \n"
+" .gpdword " START "_data \n"
+" .gpdword " START "_c \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" .gpdword _DYNAMIC \n"
+"1: ld $gp, 0($ra) \n"
+" dsubu $gp, $ra, $gp \n"
+" move $4, $sp \n"
+" ld $5, 16($ra) \n"
+" daddu $5, $5, $gp \n"
+" ld $25, 8($ra) \n"
+" daddu $25, $25, $gp \n"
+" and $sp, $sp, -16 \n"
+" jalr $25 \n"
+" nop \n"
+".set pop \n"
+);
diff --git a/libc-top-half/musl/arch/mips64/ksigaction.h b/libc-top-half/musl/arch/mips64/ksigaction.h
new file mode 100644
index 0000000..c16e473
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/ksigaction.h
@@ -0,0 +1,10 @@
+#include <features.h>
+
+struct k_sigaction {
+ unsigned flags;
+ void (*handler)(int);
+ unsigned long mask[2];
+ void (*restorer)();
+};
+
+hidden void __restore(), __restore_rt();
diff --git a/libc-top-half/musl/arch/mips64/kstat.h b/libc-top-half/musl/arch/mips64/kstat.h
new file mode 100644
index 0000000..9a4468b
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ unsigned st_dev;
+ int __pad1[3];
+ ino_t st_ino;
+ mode_t st_mode;
+ unsigned st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned st_rdev;
+ int __pad2[3];
+ off_t st_size;
+ int st_atime_sec;
+ int st_atime_nsec;
+ int st_mtime_sec;
+ int st_mtime_nsec;
+ int st_ctime_sec;
+ int st_ctime_nsec;
+ unsigned st_blksize;
+ unsigned __pad3;
+ blkcnt_t st_blocks;
+};
diff --git a/libc-top-half/musl/arch/mips64/pthread_arch.h b/libc-top-half/musl/arch/mips64/pthread_arch.h
new file mode 100644
index 0000000..c45347a
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/pthread_arch.h
@@ -0,0 +1,19 @@
+static inline uintptr_t __get_tp()
+{
+#if __mips_isa_rev < 2
+ register uintptr_t tp __asm__("$3");
+ __asm__ (".word 0x7c03e83b" : "=r" (tp) );
+#else
+ uintptr_t tp;
+ __asm__ ("rdhwr %0, $29" : "=r" (tp) );
+#endif
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+#define MC_PC pc
diff --git a/libc-top-half/musl/arch/mips64/reloc.h b/libc-top-half/musl/arch/mips64/reloc.h
new file mode 100644
index 0000000..fdb5edc
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/reloc.h
@@ -0,0 +1,60 @@
+#if __mips_isa_rev >= 6
+#define ISA_SUFFIX "r6"
+#else
+#define ISA_SUFFIX ""
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "el"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#ifdef __mips_soft_float
+#define FP_SUFFIX "-sf"
+#else
+#define FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "mips64" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+#define REL_SYM_OR_REL 4611
+#define REL_PLT R_MIPS_JUMP_SLOT
+#define REL_COPY R_MIPS_COPY
+#define REL_DTPMOD R_MIPS_TLS_DTPMOD64
+#define REL_DTPOFF R_MIPS_TLS_DTPREL64
+#define REL_TPOFF R_MIPS_TLS_TPREL64
+
+#include <endian.h>
+
+#undef R_TYPE
+#undef R_SYM
+#undef R_INFO
+#define R_TYPE(x) (be64toh(x)&0x7fffffff)
+#define R_SYM(x) (be32toh(be64toh(x)>>32))
+#define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t))
+
+#define NEED_MIPS_GOT_RELOCS 1
+#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ ".set push \n" \
+ ".set noreorder \n" \
+ ".align 8 \n" \
+ " bal 1f \n" \
+ " nop \n" \
+ " .gpdword . \n" \
+ " .gpdword " #sym " \n" \
+ "1: ld %0, ($ra) \n" \
+ " dsubu %0, $ra, %0 \n" \
+ " ld $ra, 8($ra) \n" \
+ " daddu %0, %0, $ra \n" \
+ ".set pop \n" \
+ : "=r"(*(fp)) : : "memory", "ra" )
diff --git a/libc-top-half/musl/arch/mips64/syscall_arch.h b/libc-top-half/musl/arch/mips64/syscall_arch.h
new file mode 100644
index 0000000..ae6532f
--- /dev/null
+++ b/libc-top-half/musl/arch/mips64/syscall_arch.h
@@ -0,0 +1,128 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+#define SYSCALL_RLIM_INFINITY (-1UL/2)
+
+#if __mips_isa_rev >= 6
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+#else
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+#endif
+
+static inline long __syscall0(long n)
+{
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r4 __asm__("$4") = a;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r9 __asm__("$9") = f;
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+#define VDSO_USEFUL
+#define VDSO_CGT_SYM "__vdso_clock_gettime"
+#define VDSO_CGT_VER "LINUX_2.6"
+
+#define SO_SNDTIMEO_OLD 0x1005
+#define SO_RCVTIMEO_OLD 0x1006
diff --git a/libc-top-half/musl/arch/mipsn32/arch.mak b/libc-top-half/musl/arch/mipsn32/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/mipsn32/atomic_arch.h b/libc-top-half/musl/arch/mipsn32/atomic_arch.h
new file mode 100644
index 0000000..ccc3878
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/atomic_arch.h
@@ -0,0 +1,52 @@
+#if __mips_isa_rev < 6
+#define LLSC_M "m"
+#else
+#define LLSC_M "ZC"
+#endif
+
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+#if __mips < 2
+ __asm__ __volatile__ (
+ ".set push ; .set mips2\n\t"
+ "ll %0, %1"
+ "\n\t.set pop"
+ : "=r"(v) : "m"(*p));
+#else
+ __asm__ __volatile__ (
+ "ll %0, %1"
+ : "=r"(v) : LLSC_M(*p));
+#endif
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+#if __mips < 2
+ __asm__ __volatile__ (
+ ".set push ; .set mips2\n\t"
+ "sc %0, %1"
+ "\n\t.set pop"
+ : "=r"(r), "=m"(*p) : "0"(v) : "memory");
+#else
+ __asm__ __volatile__ (
+ "sc %0, %1"
+ : "=r"(r), "="LLSC_M(*p) : "0"(v) : "memory");
+#endif
+ return r;
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("sync" : : : "memory");
+}
+
+#define a_pre_llsc a_barrier
+#define a_post_llsc a_barrier
+
+#undef LLSC_M
diff --git a/libc-top-half/musl/arch/mipsn32/bits/alltypes.h.in b/libc-top-half/musl/arch/mipsn32/bits/alltypes.h.in
new file mode 100644
index 0000000..ff934a4
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/alltypes.h.in
@@ -0,0 +1,21 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#if _MIPSEL || __MIPSEL || __MIPSEL__
+#define __BYTE_ORDER 1234
+#else
+#define __BYTE_ORDER 4321
+#endif
+
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/mipsn32/bits/errno.h b/libc-top-half/musl/arch/mipsn32/bits/errno.h
new file mode 100644
index 0000000..1bb91e3
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define ENOMSG 35
+#define EIDRM 36
+#define ECHRNG 37
+#define EL2NSYNC 38
+#define EL3HLT 39
+#define EL3RST 40
+#define ELNRNG 41
+#define EUNATCH 42
+#define ENOCSI 43
+#define EL2HLT 44
+#define EDEADLK 45
+#define ENOLCK 46
+#define EBADE 50
+#define EBADR 51
+#define EXFULL 52
+#define ENOANO 53
+#define EBADRQC 54
+#define EBADSLT 55
+#define EDEADLOCK 56
+#define EBFONT 59
+#define ENOSTR 60
+#define ENODATA 61
+#define ETIME 62
+#define ENOSR 63
+#define ENONET 64
+#define ENOPKG 65
+#define EREMOTE 66
+#define ENOLINK 67
+#define EADV 68
+#define ESRMNT 69
+#define ECOMM 70
+#define EPROTO 71
+#define EDOTDOT 73
+#define EMULTIHOP 74
+#define EBADMSG 77
+#define ENAMETOOLONG 78
+#define EOVERFLOW 79
+#define ENOTUNIQ 80
+#define EBADFD 81
+#define EREMCHG 82
+#define ELIBACC 83
+#define ELIBBAD 84
+#define ELIBSCN 85
+#define ELIBMAX 86
+#define ELIBEXEC 87
+#define EILSEQ 88
+#define ENOSYS 89
+#define ELOOP 90
+#define ERESTART 91
+#define ESTRPIPE 92
+#define ENOTEMPTY 93
+#define EUSERS 94
+#define ENOTSOCK 95
+#define EDESTADDRREQ 96
+#define EMSGSIZE 97
+#define EPROTOTYPE 98
+#define ENOPROTOOPT 99
+#define EPROTONOSUPPORT 120
+#define ESOCKTNOSUPPORT 121
+#define EOPNOTSUPP 122
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT 123
+#define EAFNOSUPPORT 124
+#define EADDRINUSE 125
+#define EADDRNOTAVAIL 126
+#define ENETDOWN 127
+#define ENETUNREACH 128
+#define ENETRESET 129
+#define ECONNABORTED 130
+#define ECONNRESET 131
+#define ENOBUFS 132
+#define EISCONN 133
+#define ENOTCONN 134
+#define EUCLEAN 135
+#define ENOTNAM 137
+#define ENAVAIL 138
+#define EISNAM 139
+#define EREMOTEIO 140
+#define ESHUTDOWN 143
+#define ETOOMANYREFS 144
+#define ETIMEDOUT 145
+#define ECONNREFUSED 146
+#define EHOSTDOWN 147
+#define EHOSTUNREACH 148
+#define EWOULDBLOCK EAGAIN
+#define EALREADY 149
+#define EINPROGRESS 150
+#define ESTALE 151
+#define ECANCELED 158
+#define ENOMEDIUM 159
+#define EMEDIUMTYPE 160
+#define ENOKEY 161
+#define EKEYEXPIRED 162
+#define EKEYREVOKED 163
+#define EKEYREJECTED 164
+#define EOWNERDEAD 165
+#define ENOTRECOVERABLE 166
+#define ERFKILL 167
+#define EHWPOISON 168
+#define EDQUOT 1133
diff --git a/libc-top-half/musl/arch/mipsn32/bits/fcntl.h b/libc-top-half/musl/arch/mipsn32/bits/fcntl.h
new file mode 100644
index 0000000..9fd8c23
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0400
+#define O_EXCL 02000
+#define O_NOCTTY 04000
+#define O_TRUNC 01000
+#define O_APPEND 0010
+#define O_NONBLOCK 0200
+#define O_DSYNC 0020
+#define O_SYNC 040020
+#define O_RSYNC 040020
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 010000
+#define O_DIRECT 0100000
+#define O_LARGEFILE 020000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 24
+#define F_GETOWN 23
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 33
+#define F_SETLK 34
+#define F_SETLKW 35
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/mipsn32/bits/fenv.h b/libc-top-half/musl/arch/mipsn32/bits/fenv.h
new file mode 100644
index 0000000..589e71c
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/fenv.h
@@ -0,0 +1,25 @@
+#ifdef __mips_soft_float
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+#else
+#define FE_INEXACT 4
+#define FE_UNDERFLOW 8
+#define FE_OVERFLOW 16
+#define FE_DIVBYZERO 32
+#define FE_INVALID 64
+
+#define FE_ALL_EXCEPT 124
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+#endif
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+ unsigned __cw;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/mipsn32/bits/float.h b/libc-top-half/musl/arch/mipsn32/bits/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/libc-top-half/musl/arch/mipsn32/bits/hwcap.h b/libc-top-half/musl/arch/mipsn32/bits/hwcap.h
new file mode 100644
index 0000000..13e86fe
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/hwcap.h
@@ -0,0 +1,3 @@
+#define HWCAP_MIPS_R6 (1 << 0)
+#define HWCAP_MIPS_MSA (1 << 1)
+#define HWCAP_MIPS_CRC32 (1 << 2)
diff --git a/libc-top-half/musl/arch/mipsn32/bits/ioctl.h b/libc-top-half/musl/arch/mipsn32/bits/ioctl.h
new file mode 100644
index 0000000..e20bf19
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/ioctl.h
@@ -0,0 +1,114 @@
+#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETA 0x5401
+#define TCSETA 0x5402
+#define TCSETAW 0x5403
+#define TCSETAF 0x5404
+#define TCSBRK 0x5405
+#define TCXONC 0x5406
+#define TCFLSH 0x5407
+#define TCGETS 0x540D
+#define TCSETS 0x540E
+#define TCSETSW 0x540F
+#define TCSETSF 0x5410
+
+#define TIOCEXCL 0x740D
+#define TIOCNXCL 0x740E
+#define TIOCOUTQ 0x7472
+#define TIOCSTI 0x5472
+#define TIOCMGET 0x741D
+#define TIOCMBIS 0x741B
+#define TIOCMBIC 0x741C
+#define TIOCMSET 0x741A
+
+#define TIOCPKT 0x5470
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define TIOCNOTTY 0x5471
+#define TIOCSETD 0x7401
+#define TIOCGETD 0x7400
+
+#define FIOCLEX 0x6601
+#define FIONCLEX 0x6602
+#define FIOASYNC 0x667D
+#define FIONBIO 0x667E
+#define FIOQSIZE 0x667F
+
+#define TIOCGLTC 0x7474
+#define TIOCSLTC 0x7475
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+#define TIOCCONS _IOW('t', 120, int)
+
+#define FIONREAD 0x467F
+#define TIOCINQ FIONREAD
+
+#define TIOCGETP 0x7408
+#define TIOCSETP 0x7409
+#define TIOCSETN 0x740A
+
+#define TIOCSBRK 0x5427
+#define TIOCCBRK 0x5428
+#define TIOCGSID 0x7416
+#define TIOCGRS485 _IOR('T', 0x2E, char[32])
+#define TIOCSRS485 _IOWR('T', 0x2F, char[32])
+#define TIOCGPTN _IOR('T', 0x30, unsigned int)
+#define TIOCSPTLCK _IOW('T', 0x31, int)
+#define TIOCGDEV _IOR('T', 0x32, unsigned int)
+#define TIOCSIG _IOW('T', 0x36, int)
+#define TIOCVHANGUP 0x5437
+#define TIOCGPKT _IOR('T', 0x38, int)
+#define TIOCGPTLCK _IOR('T', 0x39, int)
+#define TIOCGEXCL _IOR('T', 0x40, int)
+#define TIOCGPTPEER _IO('T', 0x41)
+
+#define TIOCSCTTY 0x5480
+#define TIOCGSOFTCAR 0x5481
+#define TIOCSSOFTCAR 0x5482
+#define TIOCLINUX 0x5483
+#define TIOCGSERIAL 0x5484
+#define TIOCSSERIAL 0x5485
+#define TCSBRKP 0x5486
+
+#define TIOCSERCONFIG 0x5488
+#define TIOCSERGWILD 0x5489
+#define TIOCSERSWILD 0x548A
+#define TIOCGLCKTRMIOS 0x548B
+#define TIOCSLCKTRMIOS 0x548C
+#define TIOCSERGSTRUCT 0x548D
+#define TIOCSERGETLSR 0x548E
+#define TIOCSERGETMULTI 0x548F
+#define TIOCSERSETMULTI 0x5490
+#define TIOCMIWAIT 0x5491
+#define TIOCGICOUNT 0x5492
+
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x010
+#define TIOCM_SR 0x020
+#define TIOCM_CTS 0x040
+#define TIOCM_CAR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RNG 0x200
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_DSR 0x400
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+#define SIOCGSTAMP _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
diff --git a/libc-top-half/musl/arch/mipsn32/bits/ipcstat.h b/libc-top-half/musl/arch/mipsn32/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/mipsn32/bits/mman.h b/libc-top-half/musl/arch/mipsn32/bits/mman.h
new file mode 100644
index 0000000..9027bb6
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/mman.h
@@ -0,0 +1,25 @@
+#undef MAP_ANON
+#define MAP_ANON 0x800
+#undef MAP_NORESERVE
+#define MAP_NORESERVE 0x0400
+#undef MAP_GROWSDOWN
+#define MAP_GROWSDOWN 0x1000
+#undef MAP_DENYWRITE
+#define MAP_DENYWRITE 0x2000
+#undef MAP_EXECUTABLE
+#define MAP_EXECUTABLE 0x4000
+#undef MAP_LOCKED
+#define MAP_LOCKED 0x8000
+#undef MAP_POPULATE
+#define MAP_POPULATE 0x10000
+#undef MAP_NONBLOCK
+#define MAP_NONBLOCK 0x20000
+#undef MAP_STACK
+#define MAP_STACK 0x40000
+#undef MAP_HUGETLB
+#define MAP_HUGETLB 0x80000
+#undef MAP_SYNC
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#undef MADV_SOFT_OFFLINE
+#endif
diff --git a/libc-top-half/musl/arch/mipsn32/bits/msg.h b/libc-top-half/musl/arch/mipsn32/bits/msg.h
new file mode 100644
index 0000000..c734dbb
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/msg.h
@@ -0,0 +1,27 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+#if _MIPSEL || __MIPSEL || __MIPSEL__
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+#else
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long __msg_ctime_lo;
+#endif
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/mipsn32/bits/poll.h b/libc-top-half/musl/arch/mipsn32/bits/poll.h
new file mode 100644
index 0000000..b0b1ed6
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/poll.h
@@ -0,0 +1,2 @@
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND 0x100
diff --git a/libc-top-half/musl/arch/mipsn32/bits/posix.h b/libc-top-half/musl/arch/mipsn32/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/mipsn32/bits/ptrace.h b/libc-top-half/musl/arch/mipsn32/bits/ptrace.h
new file mode 100644
index 0000000..77a01c0
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/ptrace.h
@@ -0,0 +1,9 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_PEEKTEXT_3264 0xc0
+#define PTRACE_PEEKDATA_3264 0xc1
+#define PTRACE_POKETEXT_3264 0xc2
+#define PTRACE_POKEDATA_3264 0xc3
+#define PTRACE_GET_THREAD_AREA_3264 0xc4
+#define PTRACE_GET_WATCH_REGS 0xd0
+#define PTRACE_SET_WATCH_REGS 0xd1
diff --git a/libc-top-half/musl/arch/mipsn32/bits/reg.h b/libc-top-half/musl/arch/mipsn32/bits/reg.h
new file mode 100644
index 0000000..a3f63ac
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/reg.h
@@ -0,0 +1,47 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+
+#define EF_R0 0
+#define EF_R1 1
+#define EF_R2 2
+#define EF_R3 3
+#define EF_R4 4
+#define EF_R5 5
+#define EF_R6 6
+#define EF_R7 7
+#define EF_R8 8
+#define EF_R9 9
+#define EF_R10 10
+#define EF_R11 11
+#define EF_R12 12
+#define EF_R13 13
+#define EF_R14 14
+#define EF_R15 15
+#define EF_R16 16
+#define EF_R17 17
+#define EF_R18 18
+#define EF_R19 19
+#define EF_R20 20
+#define EF_R21 21
+#define EF_R22 22
+#define EF_R23 23
+#define EF_R24 24
+#define EF_R25 25
+
+#define EF_R26 26
+#define EF_R27 27
+#define EF_R28 28
+#define EF_R29 29
+#define EF_R30 30
+#define EF_R31 31
+
+#define EF_LO 32
+#define EF_HI 33
+
+#define EF_CP0_EPC 34
+#define EF_CP0_BADVADDR 35
+#define EF_CP0_STATUS 36
+#define EF_CP0_CAUSE 37
+#define EF_UNUSED0 38
+
+#define EF_SIZE 304
diff --git a/libc-top-half/musl/arch/mipsn32/bits/resource.h b/libc-top-half/musl/arch/mipsn32/bits/resource.h
new file mode 100644
index 0000000..414a405
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/resource.h
@@ -0,0 +1,5 @@
+#define RLIMIT_NOFILE 5
+#define RLIMIT_AS 6
+#define RLIMIT_RSS 7
+#define RLIMIT_NPROC 8
+#define RLIMIT_MEMLOCK 9
diff --git a/libc-top-half/musl/arch/mipsn32/bits/sem.h b/libc-top-half/musl/arch/mipsn32/bits/sem.h
new file mode 100644
index 0000000..fe6f094
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/sem.h
@@ -0,0 +1,16 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_ctime_lo;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+#endif
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_hi;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/mipsn32/bits/setjmp.h b/libc-top-half/musl/arch/mipsn32/bits/setjmp.h
new file mode 100644
index 0000000..4d93267
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long __jmp_buf[23];
diff --git a/libc-top-half/musl/arch/mipsn32/bits/shm.h b/libc-top-half/musl/arch/mipsn32/bits/shm.h
new file mode 100644
index 0000000..ab8c642
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/shm.h
@@ -0,0 +1,29 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_ctime_lo;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned short __shm_atime_hi;
+ unsigned short __shm_dtime_hi;
+ unsigned short __shm_ctime_hi;
+ unsigned short __pad1;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/mipsn32/bits/signal.h b/libc-top-half/musl/arch/mipsn32/bits/signal.h
new file mode 100644
index 0000000..4f91c9f
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/signal.h
@@ -0,0 +1,143 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long long greg_t, gregset_t[32];
+
+typedef struct {
+ union {
+ double fp_dregs[32];
+ struct {
+ float _fp_fregs;
+ unsigned _fp_pad;
+ } fp_fregs[32];
+ } fp_r;
+} fpregset_t;
+
+struct sigcontext {
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32];
+ unsigned long long sc_mdhi;
+ unsigned long long sc_hi1;
+ unsigned long long sc_hi2;
+ unsigned long long sc_hi3;
+ unsigned long long sc_mdlo;
+ unsigned long long sc_lo1;
+ unsigned long long sc_lo2;
+ unsigned long long sc_lo3;
+ unsigned long long sc_pc;
+ unsigned int sc_fpc_csr;
+ unsigned int sc_used_math;
+ unsigned int sc_dsp;
+ unsigned int sc_reserved;
+};
+
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ greg_t mdhi;
+ greg_t hi1;
+ greg_t hi2;
+ greg_t hi3;
+ greg_t mdlo;
+ greg_t lo1;
+ greg_t lo2;
+ greg_t lo3;
+ greg_t pc;
+ unsigned int fpc_csr;
+ unsigned int used_math;
+ unsigned int dsp;
+ unsigned int reserved;
+} mcontext_t;
+
+#else
+typedef struct {
+ unsigned long long __mc1[32];
+ double __mc2[32];
+ unsigned long long __mc3[9];
+ unsigned __mc4[4];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 0x10000
+#define SA_SIGINFO 8
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#undef SIG_BLOCK
+#undef SIG_UNBLOCK
+#undef SIG_SETMASK
+#define SIG_BLOCK 1
+#define SIG_UNBLOCK 2
+#define SIG_SETMASK 3
+
+#undef SI_ASYNCIO
+#undef SI_MESGQ
+#undef SI_TIMER
+#define SI_ASYNCIO (-2)
+#define SI_MESGQ (-4)
+#define SI_TIMER (-3)
+
+#define __SI_SWAP_ERRNO_CODE
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#define SIGEMT 7
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGBUS 10
+#define SIGSEGV 11
+#define SIGSYS 12
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGUSR1 16
+#define SIGUSR2 17
+#define SIGCHLD 18
+#define SIGPWR 19
+#define SIGWINCH 20
+#define SIGURG 21
+#define SIGIO 22
+#define SIGPOLL SIGIO
+#define SIGSTOP 23
+#define SIGTSTP 24
+#define SIGCONT 25
+#define SIGTTIN 26
+#define SIGTTOU 27
+#define SIGVTALRM 28
+#define SIGPROF 29
+#define SIGXCPU 30
+#define SIGXFSZ 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 128
diff --git a/libc-top-half/musl/arch/mipsn32/bits/socket.h b/libc-top-half/musl/arch/mipsn32/bits/socket.h
new file mode 100644
index 0000000..02fbb88
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/socket.h
@@ -0,0 +1,35 @@
+#define SOCK_STREAM 2
+#define SOCK_DGRAM 1
+
+#define SOL_SOCKET 65535
+
+#define SO_DEBUG 1
+
+#define SO_REUSEADDR 0x0004
+#define SO_KEEPALIVE 0x0008
+#define SO_DONTROUTE 0x0010
+#define SO_BROADCAST 0x0020
+#define SO_LINGER 0x0080
+#define SO_OOBINLINE 0x0100
+#define SO_REUSEPORT 0x0200
+#define SO_SNDBUF 0x1001
+#define SO_RCVBUF 0x1002
+#define SO_SNDLOWAT 0x1003
+#define SO_RCVLOWAT 0x1004
+#define SO_ERROR 0x1007
+#define SO_TYPE 0x1008
+#define SO_ACCEPTCONN 0x1009
+#define SO_PROTOCOL 0x1028
+#define SO_DOMAIN 0x1029
+
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_BSDCOMPAT 14
+#define SO_PASSCRED 17
+#define SO_PEERCRED 18
+#define SO_PEERSEC 30
+#define SO_SNDBUFFORCE 31
+#define SO_RCVBUFFORCE 33
+
+#define SOCK_NONBLOCK 0200
+#define SOCK_CLOEXEC 02000000
diff --git a/libc-top-half/musl/arch/mipsn32/bits/stat.h b/libc-top-half/musl/arch/mipsn32/bits/stat.h
new file mode 100644
index 0000000..6e2f280
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/stat.h
@@ -0,0 +1,23 @@
+struct stat {
+ dev_t st_dev;
+ long __pad1[2];
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ long __pad2[2];
+ off_t st_size;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ blksize_t st_blksize;
+ long __pad3;
+ blkcnt_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ long __pad4[2];
+};
diff --git a/libc-top-half/musl/arch/mipsn32/bits/statfs.h b/libc-top-half/musl/arch/mipsn32/bits/statfs.h
new file mode 100644
index 0000000..a73bd54
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/statfs.h
@@ -0,0 +1,8 @@
+struct statfs {
+ unsigned long f_type, f_bsize, f_frsize;
+ fsblkcnt_t f_blocks, f_bfree;
+ fsfilcnt_t f_files, f_ffree;
+ fsblkcnt_t f_bavail;
+ fsid_t f_fsid;
+ unsigned long f_namelen, f_flags, f_spare[5];
+};
diff --git a/libc-top-half/musl/arch/mipsn32/bits/stdint.h b/libc-top-half/musl/arch/mipsn32/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/mipsn32/bits/syscall.h.in b/libc-top-half/musl/arch/mipsn32/bits/syscall.h.in
new file mode 100644
index 0000000..bb2d04a
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/syscall.h.in
@@ -0,0 +1,375 @@
+#define __NR_read 6000
+#define __NR_write 6001
+#define __NR_open 6002
+#define __NR_close 6003
+#define __NR_stat 6004
+#define __NR_fstat 6005
+#define __NR_lstat 6006
+#define __NR_poll 6007
+#define __NR_lseek 6008
+#define __NR_mmap 6009
+#define __NR_mprotect 6010
+#define __NR_munmap 6011
+#define __NR_brk 6012
+#define __NR_rt_sigaction 6013
+#define __NR_rt_sigprocmask 6014
+#define __NR_ioctl 6015
+#define __NR_pread64 6016
+#define __NR_pwrite64 6017
+#define __NR_readv 6018
+#define __NR_writev 6019
+#define __NR_access 6020
+#define __NR_pipe 6021
+#define __NR__newselect 6022
+#define __NR_sched_yield 6023
+#define __NR_mremap 6024
+#define __NR_msync 6025
+#define __NR_mincore 6026
+#define __NR_madvise 6027
+#define __NR_shmget 6028
+#define __NR_shmat 6029
+#define __NR_shmctl 6030
+#define __NR_dup 6031
+#define __NR_dup2 6032
+#define __NR_pause 6033
+#define __NR_nanosleep 6034
+#define __NR_getitimer 6035
+#define __NR_setitimer 6036
+#define __NR_alarm 6037
+#define __NR_getpid 6038
+#define __NR_sendfile 6039
+#define __NR_socket 6040
+#define __NR_connect 6041
+#define __NR_accept 6042
+#define __NR_sendto 6043
+#define __NR_recvfrom 6044
+#define __NR_sendmsg 6045
+#define __NR_recvmsg 6046
+#define __NR_shutdown 6047
+#define __NR_bind 6048
+#define __NR_listen 6049
+#define __NR_getsockname 6050
+#define __NR_getpeername 6051
+#define __NR_socketpair 6052
+#define __NR_setsockopt 6053
+#define __NR_getsockopt 6054
+#define __NR_clone 6055
+#define __NR_fork 6056
+#define __NR_execve 6057
+#define __NR_exit 6058
+#define __NR_wait4 6059
+#define __NR_kill 6060
+#define __NR_uname 6061
+#define __NR_semget 6062
+#define __NR_semop 6063
+#define __NR_semctl 6064
+#define __NR_shmdt 6065
+#define __NR_msgget 6066
+#define __NR_msgsnd 6067
+#define __NR_msgrcv 6068
+#define __NR_msgctl 6069
+#define __NR_fcntl 6070
+#define __NR_flock 6071
+#define __NR_fsync 6072
+#define __NR_fdatasync 6073
+#define __NR_truncate 6074
+#define __NR_ftruncate 6075
+#define __NR_getdents 6076
+#define __NR_getcwd 6077
+#define __NR_chdir 6078
+#define __NR_fchdir 6079
+#define __NR_rename 6080
+#define __NR_mkdir 6081
+#define __NR_rmdir 6082
+#define __NR_creat 6083
+#define __NR_link 6084
+#define __NR_unlink 6085
+#define __NR_symlink 6086
+#define __NR_readlink 6087
+#define __NR_chmod 6088
+#define __NR_fchmod 6089
+#define __NR_chown 6090
+#define __NR_fchown 6091
+#define __NR_lchown 6092
+#define __NR_umask 6093
+#define __NR_gettimeofday_time32 6094
+#define __NR_getrlimit 6095
+#define __NR_getrusage 6096
+#define __NR_sysinfo 6097
+#define __NR_times 6098
+#define __NR_ptrace 6099
+#define __NR_getuid 6100
+#define __NR_syslog 6101
+#define __NR_getgid 6102
+#define __NR_setuid 6103
+#define __NR_setgid 6104
+#define __NR_geteuid 6105
+#define __NR_getegid 6106
+#define __NR_setpgid 6107
+#define __NR_getppid 6108
+#define __NR_getpgrp 6109
+#define __NR_setsid 6110
+#define __NR_setreuid 6111
+#define __NR_setregid 6112
+#define __NR_getgroups 6113
+#define __NR_setgroups 6114
+#define __NR_setresuid 6115
+#define __NR_getresuid 6116
+#define __NR_setresgid 6117
+#define __NR_getresgid 6118
+#define __NR_getpgid 6119
+#define __NR_setfsuid 6120
+#define __NR_setfsgid 6121
+#define __NR_getsid 6122
+#define __NR_capget 6123
+#define __NR_capset 6124
+#define __NR_rt_sigpending 6125
+#define __NR_rt_sigtimedwait 6126
+#define __NR_rt_sigqueueinfo 6127
+#define __NR_rt_sigsuspend 6128
+#define __NR_sigaltstack 6129
+#define __NR_utime 6130
+#define __NR_mknod 6131
+#define __NR_personality 6132
+#define __NR_ustat 6133
+#define __NR_statfs 6134
+#define __NR_fstatfs 6135
+#define __NR_sysfs 6136
+#define __NR_getpriority 6137
+#define __NR_setpriority 6138
+#define __NR_sched_setparam 6139
+#define __NR_sched_getparam 6140
+#define __NR_sched_setscheduler 6141
+#define __NR_sched_getscheduler 6142
+#define __NR_sched_get_priority_max 6143
+#define __NR_sched_get_priority_min 6144
+#define __NR_sched_rr_get_interval 6145
+#define __NR_mlock 6146
+#define __NR_munlock 6147
+#define __NR_mlockall 6148
+#define __NR_munlockall 6149
+#define __NR_vhangup 6150
+#define __NR_pivot_root 6151
+#define __NR__sysctl 6152
+#define __NR_prctl 6153
+#define __NR_adjtimex 6154
+#define __NR_setrlimit 6155
+#define __NR_chroot 6156
+#define __NR_sync 6157
+#define __NR_acct 6158
+#define __NR_settimeofday_time32 6159
+#define __NR_mount 6160
+#define __NR_umount2 6161
+#define __NR_swapon 6162
+#define __NR_swapoff 6163
+#define __NR_reboot 6164
+#define __NR_sethostname 6165
+#define __NR_setdomainname 6166
+#define __NR_create_module 6167
+#define __NR_init_module 6168
+#define __NR_delete_module 6169
+#define __NR_get_kernel_syms 6170
+#define __NR_query_module 6171
+#define __NR_quotactl 6172
+#define __NR_nfsservctl 6173
+#define __NR_getpmsg 6174
+#define __NR_putpmsg 6175
+#define __NR_afs_syscall 6176
+#define __NR_reserved177 6177
+#define __NR_gettid 6178
+#define __NR_readahead 6179
+#define __NR_setxattr 6180
+#define __NR_lsetxattr 6181
+#define __NR_fsetxattr 6182
+#define __NR_getxattr 6183
+#define __NR_lgetxattr 6184
+#define __NR_fgetxattr 6185
+#define __NR_listxattr 6186
+#define __NR_llistxattr 6187
+#define __NR_flistxattr 6188
+#define __NR_removexattr 6189
+#define __NR_lremovexattr 6190
+#define __NR_fremovexattr 6191
+#define __NR_tkill 6192
+#define __NR_reserved193 6193
+#define __NR_futex 6194
+#define __NR_sched_setaffinity 6195
+#define __NR_sched_getaffinity 6196
+#define __NR_cacheflush 6197
+#define __NR_cachectl 6198
+#define __NR_sysmips 6199
+#define __NR_io_setup 6200
+#define __NR_io_destroy 6201
+#define __NR_io_getevents 6202
+#define __NR_io_submit 6203
+#define __NR_io_cancel 6204
+#define __NR_exit_group 6205
+#define __NR_lookup_dcookie 6206
+#define __NR_epoll_create 6207
+#define __NR_epoll_ctl 6208
+#define __NR_epoll_wait 6209
+#define __NR_remap_file_pages 6210
+#define __NR_rt_sigreturn 6211
+#define __NR_fcntl64 6212
+#define __NR_set_tid_address 6213
+#define __NR_restart_syscall 6214
+#define __NR_semtimedop 6215
+#define __NR_fadvise64 6216
+#define __NR_statfs64 6217
+#define __NR_fstatfs64 6218
+#define __NR_sendfile64 6219
+#define __NR_timer_create 6220
+#define __NR_timer_settime32 6221
+#define __NR_timer_gettime32 6222
+#define __NR_timer_getoverrun 6223
+#define __NR_timer_delete 6224
+#define __NR_clock_settime32 6225
+#define __NR_clock_gettime32 6226
+#define __NR_clock_getres_time32 6227
+#define __NR_clock_nanosleep_time32 6228
+#define __NR_tgkill 6229
+#define __NR_utimes 6230
+#define __NR_mbind 6231
+#define __NR_get_mempolicy 6232
+#define __NR_set_mempolicy 6233
+#define __NR_mq_open 6234
+#define __NR_mq_unlink 6235
+#define __NR_mq_timedsend 6236
+#define __NR_mq_timedreceive 6237
+#define __NR_mq_notify 6238
+#define __NR_mq_getsetattr 6239
+#define __NR_vserver 6240
+#define __NR_waitid 6241
+#define __NR_add_key 6243
+#define __NR_request_key 6244
+#define __NR_keyctl 6245
+#define __NR_set_thread_area 6246
+#define __NR_inotify_init 6247
+#define __NR_inotify_add_watch 6248
+#define __NR_inotify_rm_watch 6249
+#define __NR_migrate_pages 6250
+#define __NR_openat 6251
+#define __NR_mkdirat 6252
+#define __NR_mknodat 6253
+#define __NR_fchownat 6254
+#define __NR_futimesat 6255
+#define __NR_newfstatat 6256
+#define __NR_unlinkat 6257
+#define __NR_renameat 6258
+#define __NR_linkat 6259
+#define __NR_symlinkat 6260
+#define __NR_readlinkat 6261
+#define __NR_fchmodat 6262
+#define __NR_faccessat 6263
+#define __NR_pselect6 6264
+#define __NR_ppoll 6265
+#define __NR_unshare 6266
+#define __NR_splice 6267
+#define __NR_sync_file_range 6268
+#define __NR_tee 6269
+#define __NR_vmsplice 6270
+#define __NR_move_pages 6271
+#define __NR_set_robust_list 6272
+#define __NR_get_robust_list 6273
+#define __NR_kexec_load 6274
+#define __NR_getcpu 6275
+#define __NR_epoll_pwait 6276
+#define __NR_ioprio_set 6277
+#define __NR_ioprio_get 6278
+#define __NR_utimensat 6279
+#define __NR_signalfd 6280
+#define __NR_timerfd 6281
+#define __NR_eventfd 6282
+#define __NR_fallocate 6283
+#define __NR_timerfd_create 6284
+#define __NR_timerfd_gettime32 6285
+#define __NR_timerfd_settime32 6286
+#define __NR_signalfd4 6287
+#define __NR_eventfd2 6288
+#define __NR_epoll_create1 6289
+#define __NR_dup3 6290
+#define __NR_pipe2 6291
+#define __NR_inotify_init1 6292
+#define __NR_preadv 6293
+#define __NR_pwritev 6294
+#define __NR_rt_tgsigqueueinfo 6295
+#define __NR_perf_event_open 6296
+#define __NR_accept4 6297
+#define __NR_recvmmsg 6298
+#define __NR_getdents64 6299
+#define __NR_fanotify_init 6300
+#define __NR_fanotify_mark 6301
+#define __NR_prlimit64 6302
+#define __NR_name_to_handle_at 6303
+#define __NR_open_by_handle_at 6304
+#define __NR_clock_adjtime 6305
+#define __NR_syncfs 6306
+#define __NR_sendmmsg 6307
+#define __NR_setns 6308
+#define __NR_process_vm_readv 6309
+#define __NR_process_vm_writev 6310
+#define __NR_kcmp 6311
+#define __NR_finit_module 6312
+#define __NR_sched_setattr 6313
+#define __NR_sched_getattr 6314
+#define __NR_renameat2 6315
+#define __NR_seccomp 6316
+#define __NR_getrandom 6317
+#define __NR_memfd_create 6318
+#define __NR_bpf 6319
+#define __NR_execveat 6320
+#define __NR_userfaultfd 6321
+#define __NR_membarrier 6322
+#define __NR_mlock2 6323
+#define __NR_copy_file_range 6324
+#define __NR_preadv2 6325
+#define __NR_pwritev2 6326
+#define __NR_pkey_mprotect 6327
+#define __NR_pkey_alloc 6328
+#define __NR_pkey_free 6329
+#define __NR_statx 6330
+#define __NR_rseq 6331
+#define __NR_io_pgetevents 6332
+#define __NR_clock_gettime64 6403
+#define __NR_clock_settime64 6404
+#define __NR_clock_adjtime64 6405
+#define __NR_clock_getres_time64 6406
+#define __NR_clock_nanosleep_time64 6407
+#define __NR_timer_gettime64 6408
+#define __NR_timer_settime64 6409
+#define __NR_timerfd_gettime64 6410
+#define __NR_timerfd_settime64 6411
+#define __NR_utimensat_time64 6412
+#define __NR_pselect6_time64 6413
+#define __NR_ppoll_time64 6414
+#define __NR_io_pgetevents_time64 6416
+#define __NR_recvmmsg_time64 6417
+#define __NR_mq_timedsend_time64 6418
+#define __NR_mq_timedreceive_time64 6419
+#define __NR_semtimedop_time64 6420
+#define __NR_rt_sigtimedwait_time64 6421
+#define __NR_futex_time64 6422
+#define __NR_sched_rr_get_interval_time64 6423
+#define __NR_pidfd_send_signal 6424
+#define __NR_io_uring_setup 6425
+#define __NR_io_uring_enter 6426
+#define __NR_io_uring_register 6427
+#define __NR_open_tree 6428
+#define __NR_move_mount 6429
+#define __NR_fsopen 6430
+#define __NR_fsconfig 6431
+#define __NR_fsmount 6432
+#define __NR_fspick 6433
+#define __NR_pidfd_open 6434
+#define __NR_clone3 6435
+#define __NR_close_range 6436
+#define __NR_openat2 6437
+#define __NR_pidfd_getfd 6438
+#define __NR_faccessat2 6439
+#define __NR_process_madvise 6440
+#define __NR_epoll_pwait2 6441
+#define __NR_mount_setattr 6442
+#define __NR_landlock_create_ruleset 6444
+#define __NR_landlock_add_rule 6445
+#define __NR_landlock_restrict_self 6446
+
diff --git a/libc-top-half/musl/arch/mipsn32/bits/termios.h b/libc-top-half/musl/arch/mipsn32/bits/termios.h
new file mode 100644
index 0000000..9d571f7
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/termios.h
@@ -0,0 +1,169 @@
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+ speed_t __c_ispeed;
+ speed_t __c_ospeed;
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VMIN 4
+#define VTIME 5
+#define VEOL2 6
+#define VSWTC 7
+#define VSWTCH 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOF 16
+#define VEOL 17
+
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+#endif
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#define B0 0000000
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+
+#define ISIG 0000001
+#define ICANON 0000002
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define IEXTEN 0000400
+#define TOSTOP 0100000
+#define ITOSTOP 0100000
+
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA 0000016
+#define EXTB 0000017
+#define CBAUD 0010017
+#define CBAUDEX 0010000
+#define CIBAUD 002003600000
+#define CMSPAR 010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE 0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0020000
+#define PENDIN 0040000
+#define EXTPROC 0200000
+
+#define XTABS 0014000
+#define TIOCSER_TEMT 1
+#endif
diff --git a/libc-top-half/musl/arch/mipsn32/bits/user.h b/libc-top-half/musl/arch/mipsn32/bits/user.h
new file mode 100644
index 0000000..60fa1fd
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/bits/user.h
@@ -0,0 +1,15 @@
+struct user {
+ unsigned long regs[102];
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long long start_code, start_data, start_stack;
+ long long signal;
+ unsigned long long *u_ar0;
+ unsigned long long magic;
+ char u_comm[32];
+};
+
+#define ELF_NGREG 45
+#define ELF_NFPREG 33
+
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
diff --git a/libc-top-half/musl/arch/mipsn32/crt_arch.h b/libc-top-half/musl/arch/mipsn32/crt_arch.h
new file mode 100644
index 0000000..eb5928c
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/crt_arch.h
@@ -0,0 +1,32 @@
+__asm__(
+".set push\n"
+".set noreorder\n"
+".text \n"
+".global _" START "\n"
+".global " START "\n"
+".global " START "_data\n"
+".type _" START ", @function\n"
+".type " START ", @function\n"
+".type " START "_data, @function\n"
+"_" START ":\n"
+"" START ":\n"
+" bal 1f \n"
+" move $fp, $0 \n"
+"" START "_data: \n"
+" .gpword " START "_data \n"
+" .gpword " START "_c \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" .gpword _DYNAMIC \n"
+"1: lw $gp, 0($ra) \n"
+" subu $gp, $ra, $gp \n"
+" move $4, $sp \n"
+" lw $5, 8($ra) \n"
+" addu $5, $5, $gp \n"
+" lw $25, 4($ra) \n"
+" addu $25, $25, $gp \n"
+" and $sp, $sp, -8 \n"
+" jalr $25 \n"
+" subu $sp, $sp, 16 \n"
+".set pop \n"
+);
diff --git a/libc-top-half/musl/arch/mipsn32/ksigaction.h b/libc-top-half/musl/arch/mipsn32/ksigaction.h
new file mode 100644
index 0000000..b565f1f
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/ksigaction.h
@@ -0,0 +1,10 @@
+#include <features.h>
+
+struct k_sigaction {
+ unsigned flags;
+ void (*handler)(int);
+ unsigned long mask[4];
+ void (*restorer)();
+};
+
+hidden void __restore(), __restore_rt();
diff --git a/libc-top-half/musl/arch/mipsn32/kstat.h b/libc-top-half/musl/arch/mipsn32/kstat.h
new file mode 100644
index 0000000..3841559
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/kstat.h
@@ -0,0 +1,22 @@
+struct kstat {
+ unsigned st_dev;
+ long __pad1[3];
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned st_rdev;
+ long __pad2[3];
+ off_t st_size;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ blksize_t st_blksize;
+ long __pad3;
+ blkcnt_t st_blocks;
+ long __pad4[14];
+};
diff --git a/libc-top-half/musl/arch/mipsn32/pthread_arch.h b/libc-top-half/musl/arch/mipsn32/pthread_arch.h
new file mode 100644
index 0000000..c45347a
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/pthread_arch.h
@@ -0,0 +1,19 @@
+static inline uintptr_t __get_tp()
+{
+#if __mips_isa_rev < 2
+ register uintptr_t tp __asm__("$3");
+ __asm__ (".word 0x7c03e83b" : "=r" (tp) );
+#else
+ uintptr_t tp;
+ __asm__ ("rdhwr %0, $29" : "=r" (tp) );
+#endif
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+#define MC_PC pc
diff --git a/libc-top-half/musl/arch/mipsn32/reloc.h b/libc-top-half/musl/arch/mipsn32/reloc.h
new file mode 100644
index 0000000..47c6e59
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/reloc.h
@@ -0,0 +1,50 @@
+#if __mips_isa_rev >= 6
+#define ISA_SUFFIX "r6"
+#else
+#define ISA_SUFFIX ""
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "el"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#ifdef __mips_soft_float
+#define FP_SUFFIX "-sf"
+#else
+#define FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "mipsn32" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+#define REL_SYM_OR_REL R_MIPS_REL32
+#define REL_PLT R_MIPS_JUMP_SLOT
+#define REL_COPY R_MIPS_COPY
+#define REL_DTPMOD R_MIPS_TLS_DTPMOD32
+#define REL_DTPOFF R_MIPS_TLS_DTPREL32
+#define REL_TPOFF R_MIPS_TLS_TPREL32
+
+#define NEED_MIPS_GOT_RELOCS 1
+#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ ".set push \n" \
+ ".set noreorder \n" \
+ " bal 1f \n" \
+ " nop \n" \
+ " .gpword . \n" \
+ " .gpword " #sym " \n" \
+ "1: lw %0, ($ra) \n" \
+ " subu %0, $ra, %0 \n" \
+ " lw $ra, 4($ra) \n" \
+ " addu %0, %0, $ra \n" \
+ ".set pop \n" \
+ : "=r"(*(fp)) : : "memory", "ra" )
diff --git a/libc-top-half/musl/arch/mipsn32/syscall_arch.h b/libc-top-half/musl/arch/mipsn32/syscall_arch.h
new file mode 100644
index 0000000..c681905
--- /dev/null
+++ b/libc-top-half/musl/arch/mipsn32/syscall_arch.h
@@ -0,0 +1,130 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+#define SYSCALL_RLIM_INFINITY (-1UL/2)
+
+#if __mips_isa_rev >= 6
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "memory"
+#else
+#define SYSCALL_CLOBBERLIST \
+ "$1", "$3", "$10", "$11", "$12", "$13", \
+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+#endif
+
+static inline long __syscall0(long n)
+{
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r4 __asm__("$4") = a;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7");
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "=r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r4 __asm__("$4") = a;
+ register long r5 __asm__("$5") = b;
+ register long r6 __asm__("$6") = c;
+ register long r7 __asm__("$7") = d;
+ register long r8 __asm__("$8") = e;
+ register long r9 __asm__("$9") = f;
+ register long r2 __asm__("$2");
+
+ __asm__ __volatile__ (
+ "daddu $2,$0,%2 ; syscall"
+ : "=&r"(r2), "+r"(r7)
+ : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
+ : SYSCALL_CLOBBERLIST);
+ return r7 && r2>0 ? -r2 : r2;
+}
+
+#define VDSO_USEFUL
+#define VDSO_CGT32_SYM "__vdso_clock_gettime"
+#define VDSO_CGT32_VER "LINUX_2.6"
+#define VDSO_CGT_SYM "__vdso_clock_gettime64"
+#define VDSO_CGT_VER "LINUX_2.6"
+
+#define SO_SNDTIMEO_OLD 0x1005
+#define SO_RCVTIMEO_OLD 0x1006
diff --git a/libc-top-half/musl/arch/or1k/arch.mak b/libc-top-half/musl/arch/or1k/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/or1k/atomic_arch.h b/libc-top-half/musl/arch/or1k/atomic_arch.h
new file mode 100644
index 0000000..11a5429
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/atomic_arch.h
@@ -0,0 +1,14 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__("1: l.lwa %0, %1\n"
+ " l.sfeq %0, %2\n"
+ " l.bnf 1f\n"
+ " l.nop\n"
+ " l.swa %1, %3\n"
+ " l.bnf 1b\n"
+ " l.nop\n"
+ "1: \n"
+ : "=&r"(t), "+m"(*p) : "r"(t), "r"(s) : "cc", "memory" );
+ return t;
+}
diff --git a/libc-top-half/musl/arch/or1k/bits/alltypes.h.in b/libc-top-half/musl/arch/or1k/bits/alltypes.h.in
new file mode 100644
index 0000000..7d3e291
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/alltypes.h.in
@@ -0,0 +1,16 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#define __BYTE_ORDER 4321
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+TYPEDEF unsigned wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/or1k/bits/float.h b/libc-top-half/musl/arch/or1k/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/or1k/bits/ipcstat.h b/libc-top-half/musl/arch/or1k/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/or1k/bits/limits.h b/libc-top-half/musl/arch/or1k/bits/limits.h
new file mode 100644
index 0000000..fac47aa
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/limits.h
@@ -0,0 +1 @@
+#define PAGESIZE 8192
diff --git a/libc-top-half/musl/arch/or1k/bits/msg.h b/libc-top-half/musl/arch/or1k/bits/msg.h
new file mode 100644
index 0000000..7bbbb2b
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/or1k/bits/posix.h b/libc-top-half/musl/arch/or1k/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/or1k/bits/reg.h b/libc-top-half/musl/arch/or1k/bits/reg.h
new file mode 100644
index 0000000..0c7bffc
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/reg.h
@@ -0,0 +1,3 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+/* FIXME */
diff --git a/libc-top-half/musl/arch/or1k/bits/sem.h b/libc-top-half/musl/arch/or1k/bits/sem.h
new file mode 100644
index 0000000..d88338e
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/sem.h
@@ -0,0 +1,13 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned long __sem_ctime_hi;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/or1k/bits/setjmp.h b/libc-top-half/musl/arch/or1k/bits/setjmp.h
new file mode 100644
index 0000000..bef7fe2
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[13];
diff --git a/libc-top-half/musl/arch/or1k/bits/shm.h b/libc-top-half/musl/arch/or1k/bits/shm.h
new file mode 100644
index 0000000..725fb46
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __shm_ctime_hi;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+ unsigned long __pad3;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/or1k/bits/signal.h b/libc-top-half/musl/arch/or1k/bits/signal.h
new file mode 100644
index 0000000..be576d1
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/signal.h
@@ -0,0 +1,85 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long greg_t, gregset_t[34];
+typedef struct sigcontext {
+ struct {
+ unsigned long gpr[32];
+ unsigned long pc;
+ unsigned long sr;
+ } regs;
+ unsigned long oldmask;
+} mcontext_t;
+#else
+typedef struct {
+ unsigned long __regs[35];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/or1k/bits/stat.h b/libc-top-half/musl/arch/or1k/bits/stat.h
new file mode 100644
index 0000000..cde3fd0
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ long long __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __st_blksize_padding;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ unsigned __unused[2];
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/or1k/bits/stdint.h b/libc-top-half/musl/arch/or1k/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/or1k/bits/syscall.h.in b/libc-top-half/musl/arch/or1k/bits/syscall.h.in
new file mode 100644
index 0000000..2b5f205
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/syscall.h.in
@@ -0,0 +1,324 @@
+#define __NR_io_setup 0
+#define __NR_io_destroy 1
+#define __NR_io_submit 2
+#define __NR_io_cancel 3
+#define __NR_io_getevents 4
+#define __NR_setxattr 5
+#define __NR_lsetxattr 6
+#define __NR_fsetxattr 7
+#define __NR_getxattr 8
+#define __NR_lgetxattr 9
+#define __NR_fgetxattr 10
+#define __NR_listxattr 11
+#define __NR_llistxattr 12
+#define __NR_flistxattr 13
+#define __NR_removexattr 14
+#define __NR_lremovexattr 15
+#define __NR_fremovexattr 16
+#define __NR_getcwd 17
+#define __NR_lookup_dcookie 18
+#define __NR_eventfd2 19
+#define __NR_epoll_create1 20
+#define __NR_epoll_ctl 21
+#define __NR_epoll_pwait 22
+#define __NR_dup 23
+#define __NR_dup3 24
+#define __NR_fcntl64 25
+#define __NR_inotify_init1 26
+#define __NR_inotify_add_watch 27
+#define __NR_inotify_rm_watch 28
+#define __NR_ioctl 29
+#define __NR_ioprio_set 30
+#define __NR_ioprio_get 31
+#define __NR_flock 32
+#define __NR_mknodat 33
+#define __NR_mkdirat 34
+#define __NR_unlinkat 35
+#define __NR_symlinkat 36
+#define __NR_linkat 37
+#define __NR_renameat 38
+#define __NR_umount2 39
+#define __NR_mount 40
+#define __NR_pivot_root 41
+#define __NR_nfsservctl 42
+#define __NR_statfs64 43
+#define __NR_fstatfs64 44
+#define __NR_truncate64 45
+#define __NR_ftruncate64 46
+#define __NR_fallocate 47
+#define __NR_faccessat 48
+#define __NR_chdir 49
+#define __NR_fchdir 50
+#define __NR_chroot 51
+#define __NR_fchmod 52
+#define __NR_fchmodat 53
+#define __NR_fchownat 54
+#define __NR_fchown 55
+#define __NR_openat 56
+#define __NR_close 57
+#define __NR_vhangup 58
+#define __NR_pipe2 59
+#define __NR_quotactl 60
+#define __NR_getdents64 61
+#define __NR__llseek 62
+#define __NR_llseek 62
+#define __NR_read 63
+#define __NR_write 64
+#define __NR_readv 65
+#define __NR_writev 66
+#define __NR_pread64 67
+#define __NR_pwrite64 68
+#define __NR_preadv 69
+#define __NR_pwritev 70
+#define __NR_sendfile64 71
+#define __NR_pselect6 72
+#define __NR_ppoll 73
+#define __NR_signalfd4 74
+#define __NR_vmsplice 75
+#define __NR_splice 76
+#define __NR_tee 77
+#define __NR_readlinkat 78
+#define __NR_fstatat64 79
+#define __NR_fstat64 80
+#define __NR_sync 81
+#define __NR_fsync 82
+#define __NR_fdatasync 83
+#define __NR_sync_file_range 84
+#define __NR_timerfd_create 85
+#define __NR_timerfd_settime32 86
+#define __NR_timerfd_gettime32 87
+#define __NR_utimensat 88
+#define __NR_acct 89
+#define __NR_capget 90
+#define __NR_capset 91
+#define __NR_personality 92
+#define __NR_exit 93
+#define __NR_exit_group 94
+#define __NR_waitid 95
+#define __NR_set_tid_address 96
+#define __NR_unshare 97
+#define __NR_futex 98
+#define __NR_set_robust_list 99
+#define __NR_get_robust_list 100
+#define __NR_nanosleep 101
+#define __NR_getitimer 102
+#define __NR_setitimer 103
+#define __NR_kexec_load 104
+#define __NR_init_module 105
+#define __NR_delete_module 106
+#define __NR_timer_create 107
+#define __NR_timer_gettime32 108
+#define __NR_timer_getoverrun 109
+#define __NR_timer_settime32 110
+#define __NR_timer_delete 111
+#define __NR_clock_settime32 112
+#define __NR_clock_gettime32 113
+#define __NR_clock_getres_time32 114
+#define __NR_clock_nanosleep_time32 115
+#define __NR_syslog 116
+#define __NR_ptrace 117
+#define __NR_sched_setparam 118
+#define __NR_sched_setscheduler 119
+#define __NR_sched_getscheduler 120
+#define __NR_sched_getparam 121
+#define __NR_sched_setaffinity 122
+#define __NR_sched_getaffinity 123
+#define __NR_sched_yield 124
+#define __NR_sched_get_priority_max 125
+#define __NR_sched_get_priority_min 126
+#define __NR_sched_rr_get_interval 127
+#define __NR_restart_syscall 128
+#define __NR_kill 129
+#define __NR_tkill 130
+#define __NR_tgkill 131
+#define __NR_sigaltstack 132
+#define __NR_rt_sigsuspend 133
+#define __NR_rt_sigaction 134
+#define __NR_rt_sigprocmask 135
+#define __NR_rt_sigpending 136
+#define __NR_rt_sigtimedwait 137
+#define __NR_rt_sigqueueinfo 138
+#define __NR_rt_sigreturn 139
+#define __NR_setpriority 140
+#define __NR_getpriority 141
+#define __NR_reboot 142
+#define __NR_setregid 143
+#define __NR_setgid 144
+#define __NR_setreuid 145
+#define __NR_setuid 146
+#define __NR_setresuid 147
+#define __NR_getresuid 148
+#define __NR_setresgid 149
+#define __NR_getresgid 150
+#define __NR_setfsuid 151
+#define __NR_setfsgid 152
+#define __NR_times 153
+#define __NR_setpgid 154
+#define __NR_getpgid 155
+#define __NR_getsid 156
+#define __NR_setsid 157
+#define __NR_getgroups 158
+#define __NR_setgroups 159
+#define __NR_uname 160
+#define __NR_sethostname 161
+#define __NR_setdomainname 162
+#define __NR_getrlimit 163
+#define __NR_setrlimit 164
+#define __NR_getrusage 165
+#define __NR_umask 166
+#define __NR_prctl 167
+#define __NR_getcpu 168
+#define __NR_gettimeofday_time32 169
+#define __NR_settimeofday_time32 170
+#define __NR_adjtimex 171
+#define __NR_getpid 172
+#define __NR_getppid 173
+#define __NR_getuid 174
+#define __NR_geteuid 175
+#define __NR_getgid 176
+#define __NR_getegid 177
+#define __NR_gettid 178
+#define __NR_sysinfo 179
+#define __NR_mq_open 180
+#define __NR_mq_unlink 181
+#define __NR_mq_timedsend 182
+#define __NR_mq_timedreceive 183
+#define __NR_mq_notify 184
+#define __NR_mq_getsetattr 185
+#define __NR_msgget 186
+#define __NR_msgctl 187
+#define __NR_msgrcv 188
+#define __NR_msgsnd 189
+#define __NR_semget 190
+#define __NR_semctl 191
+#define __NR_semtimedop 192
+#define __NR_semop 193
+#define __NR_shmget 194
+#define __NR_shmctl 195
+#define __NR_shmat 196
+#define __NR_shmdt 197
+#define __NR_socket 198
+#define __NR_socketpair 199
+#define __NR_bind 200
+#define __NR_listen 201
+#define __NR_accept 202
+#define __NR_connect 203
+#define __NR_getsockname 204
+#define __NR_getpeername 205
+#define __NR_sendto 206
+#define __NR_recvfrom 207
+#define __NR_setsockopt 208
+#define __NR_getsockopt 209
+#define __NR_shutdown 210
+#define __NR_sendmsg 211
+#define __NR_recvmsg 212
+#define __NR_readahead 213
+#define __NR_brk 214
+#define __NR_munmap 215
+#define __NR_mremap 216
+#define __NR_add_key 217
+#define __NR_request_key 218
+#define __NR_keyctl 219
+#define __NR_clone 220
+#define __NR_execve 221
+#define __NR_mmap2 222
+#define __NR_fadvise64_64 223
+#define __NR_swapon 224
+#define __NR_swapoff 225
+#define __NR_mprotect 226
+#define __NR_msync 227
+#define __NR_mlock 228
+#define __NR_munlock 229
+#define __NR_mlockall 230
+#define __NR_munlockall 231
+#define __NR_mincore 232
+#define __NR_madvise 233
+#define __NR_remap_file_pages 234
+#define __NR_mbind 235
+#define __NR_get_mempolicy 236
+#define __NR_set_mempolicy 237
+#define __NR_migrate_pages 238
+#define __NR_move_pages 239
+#define __NR_rt_tgsigqueueinfo 240
+#define __NR_perf_event_open 241
+#define __NR_accept4 242
+#define __NR_recvmmsg 243
+#define __NR_or1k_atomic 244
+#define __NR_wait4 260
+#define __NR_prlimit64 261
+#define __NR_fanotify_init 262
+#define __NR_fanotify_mark 263
+#define __NR_name_to_handle_at 264
+#define __NR_open_by_handle_at 265
+#define __NR_clock_adjtime 266
+#define __NR_syncfs 267
+#define __NR_setns 268
+#define __NR_sendmmsg 269
+#define __NR_process_vm_readv 270
+#define __NR_process_vm_writev 271
+#define __NR_kcmp 272
+#define __NR_finit_module 273
+#define __NR_sched_setattr 274
+#define __NR_sched_getattr 275
+#define __NR_renameat2 276
+#define __NR_seccomp 277
+#define __NR_getrandom 278
+#define __NR_memfd_create 279
+#define __NR_bpf 280
+#define __NR_execveat 281
+#define __NR_userfaultfd 282
+#define __NR_membarrier 283
+#define __NR_mlock2 284
+#define __NR_copy_file_range 285
+#define __NR_preadv2 286
+#define __NR_pwritev2 287
+#define __NR_pkey_mprotect 288
+#define __NR_pkey_alloc 289
+#define __NR_pkey_free 290
+#define __NR_statx 291
+#define __NR_io_pgetevents 292
+#define __NR_rseq 293
+#define __NR_kexec_file_load 294
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/or1k/bits/user.h b/libc-top-half/musl/arch/or1k/bits/user.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/bits/user.h
diff --git a/libc-top-half/musl/arch/or1k/crt_arch.h b/libc-top-half/musl/arch/or1k/crt_arch.h
new file mode 100644
index 0000000..9e310ca
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/crt_arch.h
@@ -0,0 +1,18 @@
+__asm__(
+".text \n"
+".global " START " \n"
+".align 4 \n"
+START ": \n"
+" l.jal 1f \n"
+" l.ori r3, r1, 0 \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" .word _DYNAMIC-. \n"
+"1: l.lwz r4, 0(r9) \n"
+" l.add r4, r4, r9 \n"
+" l.addi r2, r0, -8 \n"
+" l.and r1, r1, r2 \n"
+" l.addi r1, r1, -16 \n"
+" l.jal " START "_c \n"
+" l.ori r2, r0, 0 \n"
+);
diff --git a/libc-top-half/musl/arch/or1k/kstat.h b/libc-top-half/musl/arch/or1k/kstat.h
new file mode 100644
index 0000000..c144957
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ long long __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __st_blksize_padding;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/or1k/pthread_arch.h b/libc-top-half/musl/arch/or1k/pthread_arch.h
new file mode 100644
index 0000000..f75ea7e
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/pthread_arch.h
@@ -0,0 +1,16 @@
+static inline uintptr_t __get_tp()
+{
+#ifdef __clang__
+ uintptr_t tp;
+ __asm__ ("l.ori %0, r10, 0" : "=r" (tp) );
+#else
+ register uintptr_t tp __asm__("r10");
+ __asm__ ("" : "=r" (tp) );
+#endif
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define MC_PC regs.pc
diff --git a/libc-top-half/musl/arch/or1k/reloc.h b/libc-top-half/musl/arch/or1k/reloc.h
new file mode 100644
index 0000000..128089c
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/reloc.h
@@ -0,0 +1,24 @@
+#define LDSO_ARCH "or1k"
+
+#define TPOFF_K 0
+
+#define REL_SYMBOLIC R_OR1K_32
+#define REL_GOT R_OR1K_GLOB_DAT
+#define REL_PLT R_OR1K_JMP_SLOT
+#define REL_RELATIVE R_OR1K_RELATIVE
+#define REL_COPY R_OR1K_COPY
+#define REL_DTPMOD R_OR1K_TLS_DTPMOD
+#define REL_DTPOFF R_OR1K_TLS_DTPOFF
+#define REL_TPOFF R_OR1K_TLS_TPOFF
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "l.jr %0 ; l.ori r1,%1,0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym " \n" \
+ " l.jal 1f \n" \
+ " l.nop \n" \
+ " .word " #sym "-. \n" \
+ "1: l.lwz %0, 0(r9) \n" \
+ " l.add %0, %0, r9 \n" \
+ : "=r"(*(fp)) : : "memory", "r9" )
diff --git a/libc-top-half/musl/arch/or1k/syscall_arch.h b/libc-top-half/musl/arch/or1k/syscall_arch.h
new file mode 100644
index 0000000..21738ce
--- /dev/null
+++ b/libc-top-half/musl/arch/or1k/syscall_arch.h
@@ -0,0 +1,115 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
+
+#define SYSCALL_MMAP2_UNIT 8192ULL
+
+static __inline long __syscall0(long n)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11)
+ : "memory", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ register unsigned long r3 __asm__("r3") = a;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11), "r"(r3)
+ : "memory", "r4", "r5", "r6", "r7", "r8",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ register unsigned long r3 __asm__("r3") = a;
+ register unsigned long r4 __asm__("r4") = b;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11), "r"(r3), "r"(r4)
+ : "memory", "r5", "r6", "r7", "r8",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ register unsigned long r3 __asm__("r3") = a;
+ register unsigned long r4 __asm__("r4") = b;
+ register unsigned long r5 __asm__("r5") = c;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11), "r"(r3), "r"(r4), "r"(r5)
+ : "memory", "r6", "r7", "r8",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ register unsigned long r3 __asm__("r3") = a;
+ register unsigned long r4 __asm__("r4") = b;
+ register unsigned long r5 __asm__("r5") = c;
+ register unsigned long r6 __asm__("r6") = d;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11), "r"(r3), "r"(r4), "r"(r5), "r"(r6)
+ : "memory", "r7", "r8",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ register unsigned long r3 __asm__("r3") = a;
+ register unsigned long r4 __asm__("r4") = b;
+ register unsigned long r5 __asm__("r5") = c;
+ register unsigned long r6 __asm__("r6") = d;
+ register unsigned long r7 __asm__("r7") = e;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11), "r"(r3), "r"(r4), "r"(r5), "r"(r6),
+ "r"(r7)
+ : "memory", "r8",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register unsigned long r11 __asm__("r11") = n;
+ register unsigned long r3 __asm__("r3") = a;
+ register unsigned long r4 __asm__("r4") = b;
+ register unsigned long r5 __asm__("r5") = c;
+ register unsigned long r6 __asm__("r6") = d;
+ register unsigned long r7 __asm__("r7") = e;
+ register unsigned long r8 __asm__("r8") = f;
+ __asm__ __volatile__ ("l.sys 1"
+ : "=r"(r11)
+ : "r"(r11), "r"(r3), "r"(r4), "r"(r5), "r"(r6),
+ "r"(r7), "r"(r8)
+ : "memory",
+ "r12", "r13", "r15", "r17", "r19", "r21",
+ "r23", "r25", "r27", "r29", "r31");
+ return r11;
+}
+
+#define IPC_64 0
diff --git a/libc-top-half/musl/arch/powerpc/arch.mak b/libc-top-half/musl/arch/powerpc/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/powerpc/atomic_arch.h b/libc-top-half/musl/arch/powerpc/atomic_arch.h
new file mode 100644
index 0000000..c267391
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/atomic_arch.h
@@ -0,0 +1,38 @@
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+ __asm__ __volatile__ ("lwarx %0, 0, %2" : "=r"(v) : "m"(*p), "r"(p));
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+ __asm__ __volatile__ (
+ "stwcx. %2, 0, %3 ; mfcr %0"
+ : "=r"(r), "=m"(*p) : "r"(v), "r"(p) : "memory", "cc");
+ return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("sync" : : : "memory");
+}
+
+#define a_pre_llsc a_barrier
+
+#define a_post_llsc a_post_llsc
+static inline void a_post_llsc()
+{
+ __asm__ __volatile__ ("isync" : : : "memory");
+}
+
+#define a_clz_32 a_clz_32
+static inline int a_clz_32(uint32_t x)
+{
+ __asm__ ("cntlzw %0, %1" : "=r"(x) : "r"(x));
+ return x;
+}
diff --git a/libc-top-half/musl/arch/powerpc/bits/alltypes.h.in b/libc-top-half/musl/arch/powerpc/bits/alltypes.h.in
new file mode 100644
index 0000000..b48df6a
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/alltypes.h.in
@@ -0,0 +1,20 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#define __BYTE_ORDER 4321
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+TYPEDEF __WCHAR_TYPE__ wchar_t;
+#else
+TYPEDEF long wchar_t;
+#endif
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/powerpc/bits/errno.h b/libc-top-half/musl/arch/powerpc/bits/errno.h
new file mode 100644
index 0000000..cae3f38
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define EDEADLK 35
+#define ENAMETOOLONG 36
+#define ENOLCK 37
+#define ENOSYS 38
+#define ENOTEMPTY 39
+#define ELOOP 40
+#define EWOULDBLOCK EAGAIN
+#define ENOMSG 42
+#define EIDRM 43
+#define ECHRNG 44
+#define EL2NSYNC 45
+#define EL3HLT 46
+#define EL3RST 47
+#define ELNRNG 48
+#define EUNATCH 49
+#define ENOCSI 50
+#define EL2HLT 51
+#define EBADE 52
+#define EBADR 53
+#define EXFULL 54
+#define ENOANO 55
+#define EBADRQC 56
+#define EBADSLT 57
+#define EDEADLOCK 58
+#define EBFONT 59
+#define ENOSTR 60
+#define ENODATA 61
+#define ETIME 62
+#define ENOSR 63
+#define ENONET 64
+#define ENOPKG 65
+#define EREMOTE 66
+#define ENOLINK 67
+#define EADV 68
+#define ESRMNT 69
+#define ECOMM 70
+#define EPROTO 71
+#define EMULTIHOP 72
+#define EDOTDOT 73
+#define EBADMSG 74
+#define EOVERFLOW 75
+#define ENOTUNIQ 76
+#define EBADFD 77
+#define EREMCHG 78
+#define ELIBACC 79
+#define ELIBBAD 80
+#define ELIBSCN 81
+#define ELIBMAX 82
+#define ELIBEXEC 83
+#define EILSEQ 84
+#define ERESTART 85
+#define ESTRPIPE 86
+#define EUSERS 87
+#define ENOTSOCK 88
+#define EDESTADDRREQ 89
+#define EMSGSIZE 90
+#define EPROTOTYPE 91
+#define ENOPROTOOPT 92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP 95
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT 96
+#define EAFNOSUPPORT 97
+#define EADDRINUSE 98
+#define EADDRNOTAVAIL 99
+#define ENETDOWN 100
+#define ENETUNREACH 101
+#define ENETRESET 102
+#define ECONNABORTED 103
+#define ECONNRESET 104
+#define ENOBUFS 105
+#define EISCONN 106
+#define ENOTCONN 107
+#define ESHUTDOWN 108
+#define ETOOMANYREFS 109
+#define ETIMEDOUT 110
+#define ECONNREFUSED 111
+#define EHOSTDOWN 112
+#define EHOSTUNREACH 113
+#define EALREADY 114
+#define EINPROGRESS 115
+#define ESTALE 116
+#define EUCLEAN 117
+#define ENOTNAM 118
+#define ENAVAIL 119
+#define EISNAM 120
+#define EREMOTEIO 121
+#define EDQUOT 122
+#define ENOMEDIUM 123
+#define EMEDIUMTYPE 124
+#define ECANCELED 125
+#define ENOKEY 126
+#define EKEYEXPIRED 127
+#define EKEYREVOKED 128
+#define EKEYREJECTED 129
+#define EOWNERDEAD 130
+#define ENOTRECOVERABLE 131
+#define ERFKILL 132
+#define EHWPOISON 133
diff --git a/libc-top-half/musl/arch/powerpc/bits/fcntl.h b/libc-top-half/musl/arch/powerpc/bits/fcntl.h
new file mode 100644
index 0000000..c3f875e
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 040000
+#define O_NOFOLLOW 0100000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 0400000
+#define O_LARGEFILE 0200000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020040000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/powerpc/bits/fenv.h b/libc-top-half/musl/arch/powerpc/bits/fenv.h
new file mode 100644
index 0000000..5b15c69
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/fenv.h
@@ -0,0 +1,36 @@
+#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__)
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+#else
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+
+#define FE_INEXACT 0x02000000
+#define FE_DIVBYZERO 0x04000000
+#define FE_UNDERFLOW 0x08000000
+#define FE_OVERFLOW 0x10000000
+#define FE_INVALID 0x20000000
+
+#define FE_ALL_EXCEPT 0x3e000000
+
+#ifdef _GNU_SOURCE
+#define FE_INVALID_SNAN 0x01000000
+#define FE_INVALID_ISI 0x00800000
+#define FE_INVALID_IDI 0x00400000
+#define FE_INVALID_ZDZ 0x00200000
+#define FE_INVALID_IMZ 0x00100000
+#define FE_INVALID_COMPARE 0x00080000
+#define FE_INVALID_SOFTWARE 0x00000400
+#define FE_INVALID_SQRT 0x00000200
+#define FE_INVALID_INTEGER_CONVERSION 0x00000100
+
+#define FE_ALL_INVALID 0x01f80700
+#endif
+#endif
+
+typedef unsigned fexcept_t;
+typedef double fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *)-1)
diff --git a/libc-top-half/musl/arch/powerpc/bits/float.h b/libc-top-half/musl/arch/powerpc/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/powerpc/bits/hwcap.h b/libc-top-half/musl/arch/powerpc/bits/hwcap.h
new file mode 100644
index 0000000..803de9b
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/hwcap.h
@@ -0,0 +1,43 @@
+#define PPC_FEATURE_32 0x80000000
+#define PPC_FEATURE_64 0x40000000
+#define PPC_FEATURE_601_INSTR 0x20000000
+#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
+#define PPC_FEATURE_HAS_FPU 0x08000000
+#define PPC_FEATURE_HAS_MMU 0x04000000
+#define PPC_FEATURE_HAS_4xxMAC 0x02000000
+#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
+#define PPC_FEATURE_HAS_SPE 0x00800000
+#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
+#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
+#define PPC_FEATURE_NO_TB 0x00100000
+#define PPC_FEATURE_POWER4 0x00080000
+#define PPC_FEATURE_POWER5 0x00040000
+#define PPC_FEATURE_POWER5_PLUS 0x00020000
+#define PPC_FEATURE_CELL 0x00010000
+#define PPC_FEATURE_BOOKE 0x00008000
+#define PPC_FEATURE_SMT 0x00004000
+#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
+#define PPC_FEATURE_ARCH_2_05 0x00001000
+#define PPC_FEATURE_PA6T 0x00000800
+#define PPC_FEATURE_HAS_DFP 0x00000400
+#define PPC_FEATURE_POWER6_EXT 0x00000200
+#define PPC_FEATURE_ARCH_2_06 0x00000100
+#define PPC_FEATURE_HAS_VSX 0x00000080
+#define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040
+
+#define PPC_FEATURE_TRUE_LE 0x00000002
+#define PPC_FEATURE_PPC_LE 0x00000001
+
+#define PPC_FEATURE2_ARCH_2_07 0x80000000
+#define PPC_FEATURE2_HTM 0x40000000
+#define PPC_FEATURE2_DSCR 0x20000000
+#define PPC_FEATURE2_EBB 0x10000000
+#define PPC_FEATURE2_ISEL 0x08000000
+#define PPC_FEATURE2_TAR 0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
+#define PPC_FEATURE2_HTM_NOSC 0x01000000
+#define PPC_FEATURE2_ARCH_3_00 0x00800000
+#define PPC_FEATURE2_HAS_IEEE128 0x00400000
+#define PPC_FEATURE2_DARN 0x00200000
+#define PPC_FEATURE2_SCV 0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
diff --git a/libc-top-half/musl/arch/powerpc/bits/ioctl.h b/libc-top-half/musl/arch/powerpc/bits/ioctl.h
new file mode 100644
index 0000000..ac9bfd2
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/ioctl.h
@@ -0,0 +1,120 @@
+#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 1U
+#define _IOC_WRITE 4U
+#define _IOC_READ 2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define FIONCLEX _IO('f', 2)
+#define FIOCLEX _IO('f', 1)
+#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, char[8])
+#define TIOCGETP _IOR('t', 8, char[6])
+#define TIOCSETP _IOW('t', 9, char[6])
+#define TIOCSETN _IOW('t', 10, char[6])
+
+#define TIOCSETC _IOW('t', 17, char[6])
+#define TIOCGETC _IOR('t', 18, char[6])
+#define TCGETS _IOR('t', 19, char[44])
+#define TCSETS _IOW('t', 20, char[44])
+#define TCSETSW _IOW('t', 21, char[44])
+#define TCSETSF _IOW('t', 22, char[44])
+
+#define TCGETA _IOR('t', 23, char[20])
+#define TCSETA _IOW('t', 24, char[20])
+#define TCSETAW _IOW('t', 25, char[20])
+#define TCSETAF _IOW('t', 28, char[20])
+
+#define TCSBRK _IO('t', 29)
+#define TCXONC _IO('t', 30)
+#define TCFLSH _IO('t', 31)
+
+#define TIOCSWINSZ _IOW('t', 103, char[8])
+#define TIOCGWINSZ _IOR('t', 104, char[8])
+#define TIOCSTART _IO('t', 110)
+#define TIOCSTOP _IO('t', 111)
+
+#define TIOCOUTQ _IOR('t', 115, int)
+
+#define TIOCGLTC _IOR('t', 116, char[6])
+#define TIOCSLTC _IOW('t', 117, char[6])
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+
+#define TIOCSTI 0x5412
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#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
+
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425
+#define TIOCSBRK 0x5427
+#define TIOCCBRK 0x5428
+#define TIOCGSID 0x5429
+#define TIOCGRS485 0x542e
+#define TIOCSRS485 0x542f
+#define TIOCGPTN _IOR('T',0x30, unsigned int)
+#define TIOCSPTLCK _IOW('T',0x31, int)
+#define TIOCGDEV _IOR('T',0x32, unsigned int)
+#define TIOCSIG _IOW('T',0x36, int)
+#define TIOCVHANGUP 0x5437
+#define TIOCGPKT _IOR('T', 0x38, int)
+#define TIOCGPTLCK _IOR('T', 0x39, int)
+#define TIOCGEXCL _IOR('T', 0x40, int)
+#define TIOCGPTPEER _IO('T', 0x41)
+
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458
+#define TIOCSERGETLSR 0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT 0x545C
+#define TIOCGICOUNT 0x545D
+
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#define SIOCGSTAMP _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
diff --git a/libc-top-half/musl/arch/powerpc/bits/ipc.h b/libc-top-half/musl/arch/powerpc/bits/ipc.h
new file mode 100644
index 0000000..a388d56
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/ipc.h
@@ -0,0 +1,12 @@
+struct ipc_perm {
+ key_t __ipc_perm_key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ mode_t mode;
+ int __ipc_perm_seq;
+ int __pad1;
+ long long __pad2;
+ long long __pad3;
+};
diff --git a/libc-top-half/musl/arch/powerpc/bits/ipcstat.h b/libc-top-half/musl/arch/powerpc/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/powerpc/bits/mman.h b/libc-top-half/musl/arch/powerpc/bits/mman.h
new file mode 100644
index 0000000..95ec435
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/mman.h
@@ -0,0 +1,13 @@
+#define PROT_SAO 0x10
+
+#undef MAP_NORESERVE
+#define MAP_NORESERVE 0x40
+#undef MAP_LOCKED
+#define MAP_LOCKED 0x80
+
+#undef MCL_CURRENT
+#define MCL_CURRENT 0x2000
+#undef MCL_FUTURE
+#define MCL_FUTURE 0x4000
+#undef MCL_ONFAULT
+#define MCL_ONFAULT 0x8000
diff --git a/libc-top-half/musl/arch/powerpc/bits/msg.h b/libc-top-half/musl/arch/powerpc/bits/msg.h
new file mode 100644
index 0000000..9fb15dc
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/powerpc/bits/posix.h b/libc-top-half/musl/arch/powerpc/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/powerpc/bits/ptrace.h b/libc-top-half/musl/arch/powerpc/bits/ptrace.h
new file mode 100644
index 0000000..303a073
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/ptrace.h
@@ -0,0 +1,25 @@
+#define PTRACE_GETVRREGS 0x12
+#define PTRACE_SETVRREGS 0x13
+#define PTRACE_GETEVRREGS 0x14
+#define PTRACE_SETEVRREGS 0x15
+#define PTRACE_GETREGS64 0x16
+#define PTRACE_SETREGS64 0x17
+#define PTRACE_GET_DEBUGREG 0x19
+#define PTRACE_SET_DEBUGREG 0x1a
+#define PTRACE_GETVSRREGS 0x1b
+#define PTRACE_SETVSRREGS 0x1c
+#define PTRACE_SYSEMU 0x1d
+#define PTRACE_SYSEMU_SINGLESTEP 0x1e
+#define PTRACE_SINGLEBLOCK 0x100
+
+#define PT_GETVRREGS PTRACE_GETVRREGS
+#define PT_SETVRREGS PTRACE_SETVRREGS
+#define PT_GETEVRREGS PTRACE_GETEVRREGS
+#define PT_SETEVRREGS PTRACE_SETEVRREGS
+#define PT_GETREGS64 PTRACE_GETREGS64
+#define PT_SETREGS64 PTRACE_SETREGS64
+#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG
+#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG
+#define PT_GETVSRREGS PTRACE_GETVSRREGS
+#define PT_SETVSRREGS PTRACE_SETVSRREGS
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/libc-top-half/musl/arch/powerpc/bits/reg.h b/libc-top-half/musl/arch/powerpc/bits/reg.h
new file mode 100644
index 0000000..0c7bffc
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/reg.h
@@ -0,0 +1,3 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+/* FIXME */
diff --git a/libc-top-half/musl/arch/powerpc/bits/sem.h b/libc-top-half/musl/arch/powerpc/bits/sem.h
new file mode 100644
index 0000000..28be484
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/sem.h
@@ -0,0 +1,12 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_ctime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned short __sem_nsems_pad, sem_nsems;
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/powerpc/bits/setjmp.h b/libc-top-half/musl/arch/powerpc/bits/setjmp.h
new file mode 100644
index 0000000..1cb0f26
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long __jmp_buf[56];
diff --git a/libc-top-half/musl/arch/powerpc/bits/shm.h b/libc-top-half/musl/arch/powerpc/bits/shm.h
new file mode 100644
index 0000000..7f1ca17
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/shm.h
@@ -0,0 +1,30 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_ctime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __pad1;
+ size_t shm_segsz;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad2;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/powerpc/bits/signal.h b/libc-top-half/musl/arch/powerpc/bits/signal.h
new file mode 100644
index 0000000..c1bf3ca
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/signal.h
@@ -0,0 +1,119 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 4096
+#define SIGSTKSZ 10240
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+typedef unsigned long greg_t, gregset_t[48];
+
+typedef struct {
+ double fpregs[32];
+ double fpscr;
+ unsigned _pad[2];
+} fpregset_t;
+
+typedef struct {
+ unsigned vrregs[32][4];
+ unsigned vrsave;
+ unsigned _pad[2];
+ unsigned vscr;
+} vrregset_t;
+
+struct sigcontext {
+ unsigned long _unused[4];
+ int signal;
+ unsigned long handler;
+ unsigned long oldmask;
+ struct pt_regs *regs;
+};
+
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ vrregset_t vrregs
+#ifdef __GNUC__
+ __attribute__((__aligned__(16)))
+#endif
+ ;
+} mcontext_t;
+
+#else
+
+typedef struct {
+ long __regs[48+68+4*32+4]
+#ifdef __GNUC__
+ __attribute__((__aligned__(16)))
+#endif
+ ;
+} mcontext_t;
+
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ int uc_pad[7];
+ mcontext_t *uc_regs;
+ sigset_t uc_sigmask;
+ int uc_pad2[3];
+ mcontext_t uc_mcontext;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1U
+#define SA_NOCLDWAIT 2U
+#define SA_SIGINFO 4U
+#define SA_ONSTACK 0x08000000U
+#define SA_RESTART 0x10000000U
+#define SA_NODEFER 0x40000000U
+#define SA_RESETHAND 0x80000000U
+#define SA_RESTORER 0x04000000U
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/powerpc/bits/socket.h b/libc-top-half/musl/arch/powerpc/bits/socket.h
new file mode 100644
index 0000000..b19ed42
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/socket.h
@@ -0,0 +1,25 @@
+#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_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_REUSEPORT 15
+#define SO_RCVLOWAT 16
+#define SO_SNDLOWAT 17
+#define SO_PASSCRED 20
+#define SO_PEERCRED 21
+#define SO_ACCEPTCONN 30
+#define SO_PEERSEC 31
+#define SO_SNDBUFFORCE 32
+#define SO_RCVBUFFORCE 33
+#define SO_PROTOCOL 38
+#define SO_DOMAIN 39
diff --git a/libc-top-half/musl/arch/powerpc/bits/stat.h b/libc-top-half/musl/arch/powerpc/bits/stat.h
new file mode 100644
index 0000000..585d98e
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/stat.h
@@ -0,0 +1,24 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ short __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ unsigned __unused[2];
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/powerpc/bits/stdint.h b/libc-top-half/musl/arch/powerpc/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/powerpc/bits/syscall.h.in b/libc-top-half/musl/arch/powerpc/bits/syscall.h.in
new file mode 100644
index 0000000..b1605a5
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/syscall.h.in
@@ -0,0 +1,428 @@
+#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_time32 78
+#define __NR_settimeofday_time32 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_vm86 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_query_module 166
+#define __NR_poll 167
+#define __NR_nfsservctl 168
+#define __NR_setresgid 169
+#define __NR_getresgid 170
+#define __NR_prctl 171
+#define __NR_rt_sigreturn 172
+#define __NR_rt_sigaction 173
+#define __NR_rt_sigprocmask 174
+#define __NR_rt_sigpending 175
+#define __NR_rt_sigtimedwait 176
+#define __NR_rt_sigqueueinfo 177
+#define __NR_rt_sigsuspend 178
+#define __NR_pread64 179
+#define __NR_pwrite64 180
+#define __NR_chown 181
+#define __NR_getcwd 182
+#define __NR_capget 183
+#define __NR_capset 184
+#define __NR_sigaltstack 185
+#define __NR_sendfile 186
+#define __NR_getpmsg 187
+#define __NR_putpmsg 188
+#define __NR_vfork 189
+#define __NR_ugetrlimit 190
+#define __NR_readahead 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_pciconfig_read 198
+#define __NR_pciconfig_write 199
+#define __NR_pciconfig_iobase 200
+#define __NR_multiplexer 201
+#define __NR_getdents64 202
+#define __NR_pivot_root 203
+#define __NR_fcntl64 204
+#define __NR_madvise 205
+#define __NR_mincore 206
+#define __NR_gettid 207
+#define __NR_tkill 208
+#define __NR_setxattr 209
+#define __NR_lsetxattr 210
+#define __NR_fsetxattr 211
+#define __NR_getxattr 212
+#define __NR_lgetxattr 213
+#define __NR_fgetxattr 214
+#define __NR_listxattr 215
+#define __NR_llistxattr 216
+#define __NR_flistxattr 217
+#define __NR_removexattr 218
+#define __NR_lremovexattr 219
+#define __NR_fremovexattr 220
+#define __NR_futex 221
+#define __NR_sched_setaffinity 222
+#define __NR_sched_getaffinity 223
+#define __NR_tuxcall 225
+#define __NR_sendfile64 226
+#define __NR_io_setup 227
+#define __NR_io_destroy 228
+#define __NR_io_getevents 229
+#define __NR_io_submit 230
+#define __NR_io_cancel 231
+#define __NR_set_tid_address 232
+#define __NR_fadvise64 233
+#define __NR_exit_group 234
+#define __NR_lookup_dcookie 235
+#define __NR_epoll_create 236
+#define __NR_epoll_ctl 237
+#define __NR_epoll_wait 238
+#define __NR_remap_file_pages 239
+#define __NR_timer_create 240
+#define __NR_timer_settime32 241
+#define __NR_timer_gettime32 242
+#define __NR_timer_getoverrun 243
+#define __NR_timer_delete 244
+#define __NR_clock_settime32 245
+#define __NR_clock_gettime32 246
+#define __NR_clock_getres_time32 247
+#define __NR_clock_nanosleep_time32 248
+#define __NR_swapcontext 249
+#define __NR_tgkill 250
+#define __NR_utimes 251
+#define __NR_statfs64 252
+#define __NR_fstatfs64 253
+#define __NR_fadvise64_64 254
+#define __NR_rtas 255
+#define __NR_sys_debug_setcontext 256
+#define __NR_migrate_pages 258
+#define __NR_mbind 259
+#define __NR_get_mempolicy 260
+#define __NR_set_mempolicy 261
+#define __NR_mq_open 262
+#define __NR_mq_unlink 263
+#define __NR_mq_timedsend 264
+#define __NR_mq_timedreceive 265
+#define __NR_mq_notify 266
+#define __NR_mq_getsetattr 267
+#define __NR_kexec_load 268
+#define __NR_add_key 269
+#define __NR_request_key 270
+#define __NR_keyctl 271
+#define __NR_waitid 272
+#define __NR_ioprio_set 273
+#define __NR_ioprio_get 274
+#define __NR_inotify_init 275
+#define __NR_inotify_add_watch 276
+#define __NR_inotify_rm_watch 277
+#define __NR_spu_run 278
+#define __NR_spu_create 279
+#define __NR_pselect6 280
+#define __NR_ppoll 281
+#define __NR_unshare 282
+#define __NR_splice 283
+#define __NR_tee 284
+#define __NR_vmsplice 285
+#define __NR_openat 286
+#define __NR_mkdirat 287
+#define __NR_mknodat 288
+#define __NR_fchownat 289
+#define __NR_futimesat 290
+#define __NR_fstatat64 291
+#define __NR_unlinkat 292
+#define __NR_renameat 293
+#define __NR_linkat 294
+#define __NR_symlinkat 295
+#define __NR_readlinkat 296
+#define __NR_fchmodat 297
+#define __NR_faccessat 298
+#define __NR_get_robust_list 299
+#define __NR_set_robust_list 300
+#define __NR_move_pages 301
+#define __NR_getcpu 302
+#define __NR_epoll_pwait 303
+#define __NR_utimensat 304
+#define __NR_signalfd 305
+#define __NR_timerfd_create 306
+#define __NR_eventfd 307
+#define __NR_sync_file_range2 308
+#define __NR_fallocate 309
+#define __NR_subpage_prot 310
+#define __NR_timerfd_settime32 311
+#define __NR_timerfd_gettime32 312
+#define __NR_signalfd4 313
+#define __NR_eventfd2 314
+#define __NR_epoll_create1 315
+#define __NR_dup3 316
+#define __NR_pipe2 317
+#define __NR_inotify_init1 318
+#define __NR_perf_event_open 319
+#define __NR_preadv 320
+#define __NR_pwritev 321
+#define __NR_rt_tgsigqueueinfo 322
+#define __NR_fanotify_init 323
+#define __NR_fanotify_mark 324
+#define __NR_prlimit64 325
+#define __NR_socket 326
+#define __NR_bind 327
+#define __NR_connect 328
+#define __NR_listen 329
+#define __NR_accept 330
+#define __NR_getsockname 331
+#define __NR_getpeername 332
+#define __NR_socketpair 333
+#define __NR_send 334
+#define __NR_sendto 335
+#define __NR_recv 336
+#define __NR_recvfrom 337
+#define __NR_shutdown 338
+#define __NR_setsockopt 339
+#define __NR_getsockopt 340
+#define __NR_sendmsg 341
+#define __NR_recvmsg 342
+#define __NR_recvmmsg 343
+#define __NR_accept4 344
+#define __NR_name_to_handle_at 345
+#define __NR_open_by_handle_at 346
+#define __NR_clock_adjtime 347
+#define __NR_syncfs 348
+#define __NR_sendmmsg 349
+#define __NR_setns 350
+#define __NR_process_vm_readv 351
+#define __NR_process_vm_writev 352
+#define __NR_finit_module 353
+#define __NR_kcmp 354
+#define __NR_sched_setattr 355
+#define __NR_sched_getattr 356
+#define __NR_renameat2 357
+#define __NR_seccomp 358
+#define __NR_getrandom 359
+#define __NR_memfd_create 360
+#define __NR_bpf 361
+#define __NR_execveat 362
+#define __NR_switch_endian 363
+#define __NR_userfaultfd 364
+#define __NR_membarrier 365
+#define __NR_mlock2 378
+#define __NR_copy_file_range 379
+#define __NR_preadv2 380
+#define __NR_pwritev2 381
+#define __NR_kexec_file_load 382
+#define __NR_statx 383
+#define __NR_pkey_alloc 384
+#define __NR_pkey_free 385
+#define __NR_pkey_mprotect 386
+#define __NR_rseq 387
+#define __NR_io_pgetevents 388
+#define __NR_semget 393
+#define __NR_semctl 394
+#define __NR_shmget 395
+#define __NR_shmctl 396
+#define __NR_shmat 397
+#define __NR_shmdt 398
+#define __NR_msgget 399
+#define __NR_msgsnd 400
+#define __NR_msgrcv 401
+#define __NR_msgctl 402
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/powerpc/bits/termios.h b/libc-top-half/musl/arch/powerpc/bits/termios.h
new file mode 100644
index 0000000..da1f406
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/termios.h
@@ -0,0 +1,171 @@
+#undef NCCS
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_cc[NCCS];
+ cc_t c_line;
+ speed_t __c_ispeed;
+ speed_t __c_ospeed;
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VMIN 5
+#define VEOL 6
+#define VTIME 7
+#define VEOL2 8
+#define VSWTC 9
+#define VWERASE 10
+#define VREPRINT 11
+#define VSUSP 12
+#define VSTART 13
+#define VSTOP 14
+#define VLNEXT 15
+#define VDISCARD 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 IXON 0001000
+#define IXOFF 0002000
+#define IXANY 0004000
+#define IUCLC 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+#define OPOST 0000001
+#define ONLCR 0000002
+#define OLCUC 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY 0001400
+#define NL0 0000000
+#define NL1 0000400
+#define NL2 0001000
+#define NL3 0001400
+#define TABDLY 0006000
+#define TAB0 0000000
+#define TAB1 0002000
+#define TAB2 0004000
+#define TAB3 0006000
+#define CRDLY 0030000
+#define CR0 0000000
+#define CR1 0010000
+#define CR2 0020000
+#define CR3 0030000
+#define FFDLY 0040000
+#define FF0 0000000
+#define FF1 0040000
+#define BSDLY 0100000
+#define BS0 0000000
+#define BS1 0100000
+#endif
+
+#define VTDLY 0200000
+#define VT0 0000000
+#define VT1 0200000
+
+#define B0 0000000
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define B57600 00020
+#define B115200 00021
+#define B230400 00022
+#define B460800 00023
+#define B500000 00024
+#define B576000 00025
+#define B921600 00026
+#define B1000000 00027
+#define B1152000 00030
+#define B1500000 00031
+#define B2000000 00032
+#define B2500000 00033
+#define B3000000 00034
+#define B3500000 00035
+#define B4000000 00036
+
+#define CSIZE 00001400
+#define CS5 00000000
+#define CS6 00000400
+#define CS7 00001000
+#define CS8 00001400
+#define CSTOPB 00002000
+#define CREAD 00004000
+#define PARENB 00010000
+#define PARODD 00020000
+#define HUPCL 00040000
+#define CLOCAL 00100000
+
+#define ECHOE 0x00000002
+#define ECHOK 0x00000004
+#define ECHO 0x00000008
+#define ECHONL 0x00000010
+#define ISIG 0x00000080
+#define ICANON 0x00000100
+#define IEXTEN 0x00000400
+#define TOSTOP 0x00400000
+#define NOFLSH 0x80000000
+
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA 0000016
+#define EXTB 0000017
+#define CBAUD 00377
+#define CBAUDEX 0000020
+#define CIBAUD 077600000
+#define CMSPAR 010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE 0x00004000
+#define ECHOCTL 0x00000040
+#define ECHOPRT 0x00000020
+#define ECHOKE 0x00000001
+#define FLUSHO 0x00800000
+#define PENDIN 0x20000000
+#define EXTPROC 0x10000000
+
+#define XTABS 00006000
+#define TIOCSER_TEMT 1
+#endif
diff --git a/libc-top-half/musl/arch/powerpc/bits/user.h b/libc-top-half/musl/arch/powerpc/bits/user.h
new file mode 100644
index 0000000..7f52874
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/bits/user.h
@@ -0,0 +1,23 @@
+struct user {
+ struct {
+ unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq;
+ unsigned long trap, dar, dsisr, result;
+ } regs;
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long start_code, start_data, start_stack;
+ long signal;
+ void *u_ar0;
+ unsigned long magic;
+ char u_comm[32];
+};
+
+#define ELF_NGREG 48
+#define ELF_NFPREG 33
+#define ELF_NVRREG 33
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
+typedef struct { unsigned u[4]; }
+#ifdef __GNUC__
+__attribute__((__aligned__(16)))
+#endif
+ elf_vrreg_t, elf_vrregset_t[ELF_NVRREG];
diff --git a/libc-top-half/musl/arch/powerpc/crt_arch.h b/libc-top-half/musl/arch/powerpc/crt_arch.h
new file mode 100644
index 0000000..9b65886
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/crt_arch.h
@@ -0,0 +1,20 @@
+__asm__(
+".text \n"
+".global " START " \n"
+".type " START ", %function \n"
+START ": \n"
+" bl 1f \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" .long _DYNAMIC-. \n"
+"1: mflr 4 \n"
+" lwz 3, 0(4) \n"
+" add 4, 3, 4 \n"
+" mr 3, 1 \n"
+" clrrwi 1, 1, 4 \n"
+" li 0, 0 \n"
+" stwu 1, -16(1) \n"
+" mtlr 0 \n"
+" stw 0, 0(1) \n"
+" bl " START "_c \n"
+);
diff --git a/libc-top-half/musl/arch/powerpc/kstat.h b/libc-top-half/musl/arch/powerpc/kstat.h
new file mode 100644
index 0000000..5a611e7
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/kstat.h
@@ -0,0 +1,20 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ short __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/powerpc/pthread_arch.h b/libc-top-half/musl/arch/powerpc/pthread_arch.h
new file mode 100644
index 0000000..42e88b0
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/pthread_arch.h
@@ -0,0 +1,16 @@
+static inline uintptr_t __get_tp()
+{
+ register uintptr_t tp __asm__("r2");
+ __asm__ ("" : "=r" (tp) );
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+// the kernel calls the ip "nip", it's the first saved value after the 32
+// GPRs.
+#define MC_PC gregs[32]
diff --git a/libc-top-half/musl/arch/powerpc/reloc.h b/libc-top-half/musl/arch/powerpc/reloc.h
new file mode 100644
index 0000000..fdfbf82
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/reloc.h
@@ -0,0 +1,31 @@
+#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__)
+#define FP_SUFFIX "-sf"
+#else
+#define FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "powerpc" FP_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+#define REL_SYMBOLIC R_PPC_ADDR32
+#define REL_USYMBOLIC R_PPC_UADDR32
+#define REL_GOT R_PPC_GLOB_DAT
+#define REL_PLT R_PPC_JMP_SLOT
+#define REL_RELATIVE R_PPC_RELATIVE
+#define REL_COPY R_PPC_COPY
+#define REL_DTPMOD R_PPC_DTPMOD32
+#define REL_DTPOFF R_PPC_DTPREL32
+#define REL_TPOFF R_PPC_TPREL32
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mr 1,%1 ; mtlr %0 ; blr" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym " \n" \
+ " bl 1f \n" \
+ " .long " #sym "-. \n" \
+ "1: mflr %1 \n" \
+ " lwz %0, 0(%1) \n" \
+ " add %0, %0, %1 \n" \
+ : "=r"(*(fp)), "=r"((int){0}) : : "memory", "lr" )
diff --git a/libc-top-half/musl/arch/powerpc/syscall_arch.h b/libc-top-half/musl/arch/powerpc/syscall_arch.h
new file mode 100644
index 0000000..ede97c1
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc/syscall_arch.h
@@ -0,0 +1,94 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
+
+static inline long __syscall0(long n)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3");
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "=r"(r3)
+ :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3)
+ :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4)
+ :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
+ :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ register long r6 __asm__("r6") = d;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
+ :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ register long r6 __asm__("r6") = d;
+ register long r7 __asm__("r7") = e;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
+ :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ register long r6 __asm__("r6") = d;
+ register long r7 __asm__("r7") = e;
+ register long r8 __asm__("r8") = f;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
+ :: "memory", "cr0", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+#define SYSCALL_FADVISE_6_ARG
+
+#define SO_RCVTIMEO_OLD 18
+#define SO_SNDTIMEO_OLD 19
diff --git a/libc-top-half/musl/arch/powerpc64/atomic_arch.h b/libc-top-half/musl/arch/powerpc64/atomic_arch.h
new file mode 100644
index 0000000..2bed82b
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/atomic_arch.h
@@ -0,0 +1,62 @@
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+ __asm__ __volatile__ ("lwarx %0, 0, %2" : "=r"(v) : "m"(*p), "r"(p));
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+ __asm__ __volatile__ (
+ "stwcx. %2, 0, %3 ; mfcr %0"
+ : "=r"(r), "=m"(*p) : "r"(v), "r"(p) : "memory", "cc");
+ return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
+}
+
+#define a_ll_p a_ll_p
+static inline void *a_ll_p(volatile void *p)
+{
+ void *v;
+ __asm__ __volatile__ ("ldarx %0, 0, %2" : "=r"(v) : "m"(*(void *volatile *)p), "r"(p));
+ return v;
+}
+
+#define a_sc_p a_sc_p
+static inline int a_sc_p(volatile void *p, void *v)
+{
+ int r;
+ __asm__ __volatile__ (
+ "stdcx. %2, 0, %3 ; mfcr %0"
+ : "=r"(r), "=m"(*(void *volatile *)p) : "r"(v), "r"(p) : "memory", "cc");
+ return r & 0x20000000; /* "bit 2" of "cr0" (backwards bit order) */
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("sync" : : : "memory");
+}
+
+#define a_pre_llsc a_barrier
+
+#define a_post_llsc a_post_llsc
+static inline void a_post_llsc()
+{
+ __asm__ __volatile__ ("isync" : : : "memory");
+}
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__ (".long 0");
+}
+
+#define a_clz_64 a_clz_64
+static inline int a_clz_64(uint64_t x)
+{
+ __asm__ ("cntlzd %0, %1" : "=r"(x) : "r"(x));
+ return x;
+}
diff --git a/libc-top-half/musl/arch/powerpc64/bits/alltypes.h.in b/libc-top-half/musl/arch/powerpc64/bits/alltypes.h.in
new file mode 100644
index 0000000..143ffa8
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/alltypes.h.in
@@ -0,0 +1,20 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#if __BIG_ENDIAN__
+#define __BYTE_ORDER 4321
+#else
+#define __BYTE_ORDER 1234
+#endif
+
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/powerpc64/bits/errno.h b/libc-top-half/musl/arch/powerpc64/bits/errno.h
new file mode 100644
index 0000000..cae3f38
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define ENOTBLK 15
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define ETXTBSY 26
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define EDEADLK 35
+#define ENAMETOOLONG 36
+#define ENOLCK 37
+#define ENOSYS 38
+#define ENOTEMPTY 39
+#define ELOOP 40
+#define EWOULDBLOCK EAGAIN
+#define ENOMSG 42
+#define EIDRM 43
+#define ECHRNG 44
+#define EL2NSYNC 45
+#define EL3HLT 46
+#define EL3RST 47
+#define ELNRNG 48
+#define EUNATCH 49
+#define ENOCSI 50
+#define EL2HLT 51
+#define EBADE 52
+#define EBADR 53
+#define EXFULL 54
+#define ENOANO 55
+#define EBADRQC 56
+#define EBADSLT 57
+#define EDEADLOCK 58
+#define EBFONT 59
+#define ENOSTR 60
+#define ENODATA 61
+#define ETIME 62
+#define ENOSR 63
+#define ENONET 64
+#define ENOPKG 65
+#define EREMOTE 66
+#define ENOLINK 67
+#define EADV 68
+#define ESRMNT 69
+#define ECOMM 70
+#define EPROTO 71
+#define EMULTIHOP 72
+#define EDOTDOT 73
+#define EBADMSG 74
+#define EOVERFLOW 75
+#define ENOTUNIQ 76
+#define EBADFD 77
+#define EREMCHG 78
+#define ELIBACC 79
+#define ELIBBAD 80
+#define ELIBSCN 81
+#define ELIBMAX 82
+#define ELIBEXEC 83
+#define EILSEQ 84
+#define ERESTART 85
+#define ESTRPIPE 86
+#define EUSERS 87
+#define ENOTSOCK 88
+#define EDESTADDRREQ 89
+#define EMSGSIZE 90
+#define EPROTOTYPE 91
+#define ENOPROTOOPT 92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP 95
+#define ENOTSUP EOPNOTSUPP
+#define EPFNOSUPPORT 96
+#define EAFNOSUPPORT 97
+#define EADDRINUSE 98
+#define EADDRNOTAVAIL 99
+#define ENETDOWN 100
+#define ENETUNREACH 101
+#define ENETRESET 102
+#define ECONNABORTED 103
+#define ECONNRESET 104
+#define ENOBUFS 105
+#define EISCONN 106
+#define ENOTCONN 107
+#define ESHUTDOWN 108
+#define ETOOMANYREFS 109
+#define ETIMEDOUT 110
+#define ECONNREFUSED 111
+#define EHOSTDOWN 112
+#define EHOSTUNREACH 113
+#define EALREADY 114
+#define EINPROGRESS 115
+#define ESTALE 116
+#define EUCLEAN 117
+#define ENOTNAM 118
+#define ENAVAIL 119
+#define EISNAM 120
+#define EREMOTEIO 121
+#define EDQUOT 122
+#define ENOMEDIUM 123
+#define EMEDIUMTYPE 124
+#define ECANCELED 125
+#define ENOKEY 126
+#define EKEYEXPIRED 127
+#define EKEYREVOKED 128
+#define EKEYREJECTED 129
+#define EOWNERDEAD 130
+#define ENOTRECOVERABLE 131
+#define ERFKILL 132
+#define EHWPOISON 133
diff --git a/libc-top-half/musl/arch/powerpc64/bits/fcntl.h b/libc-top-half/musl/arch/powerpc64/bits/fcntl.h
new file mode 100644
index 0000000..6f20bac
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 040000
+#define O_NOFOLLOW 0100000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 0400000
+#define O_LARGEFILE 0200000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020040000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/powerpc64/bits/fenv.h b/libc-top-half/musl/arch/powerpc64/bits/fenv.h
new file mode 100644
index 0000000..2f722e6
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/fenv.h
@@ -0,0 +1,31 @@
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+
+#define FE_INEXACT 0x02000000
+#define FE_DIVBYZERO 0x04000000
+#define FE_UNDERFLOW 0x08000000
+#define FE_OVERFLOW 0x10000000
+#define FE_INVALID 0x20000000
+
+#define FE_ALL_EXCEPT 0x3e000000
+
+#ifdef _GNU_SOURCE
+#define FE_INVALID_SNAN 0x01000000
+#define FE_INVALID_ISI 0x00800000
+#define FE_INVALID_IDI 0x00400000
+#define FE_INVALID_ZDZ 0x00200000
+#define FE_INVALID_IMZ 0x00100000
+#define FE_INVALID_COMPARE 0x00080000
+#define FE_INVALID_SOFTWARE 0x00000400
+#define FE_INVALID_SQRT 0x00000200
+#define FE_INVALID_INTEGER_CONVERSION 0x00000100
+
+#define FE_ALL_INVALID 0x01f80700
+#endif
+
+typedef unsigned fexcept_t;
+typedef double fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *)-1)
diff --git a/libc-top-half/musl/arch/powerpc64/bits/float.h b/libc-top-half/musl/arch/powerpc64/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/powerpc64/bits/hwcap.h b/libc-top-half/musl/arch/powerpc64/bits/hwcap.h
new file mode 100644
index 0000000..803de9b
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/hwcap.h
@@ -0,0 +1,43 @@
+#define PPC_FEATURE_32 0x80000000
+#define PPC_FEATURE_64 0x40000000
+#define PPC_FEATURE_601_INSTR 0x20000000
+#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
+#define PPC_FEATURE_HAS_FPU 0x08000000
+#define PPC_FEATURE_HAS_MMU 0x04000000
+#define PPC_FEATURE_HAS_4xxMAC 0x02000000
+#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
+#define PPC_FEATURE_HAS_SPE 0x00800000
+#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000
+#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000
+#define PPC_FEATURE_NO_TB 0x00100000
+#define PPC_FEATURE_POWER4 0x00080000
+#define PPC_FEATURE_POWER5 0x00040000
+#define PPC_FEATURE_POWER5_PLUS 0x00020000
+#define PPC_FEATURE_CELL 0x00010000
+#define PPC_FEATURE_BOOKE 0x00008000
+#define PPC_FEATURE_SMT 0x00004000
+#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
+#define PPC_FEATURE_ARCH_2_05 0x00001000
+#define PPC_FEATURE_PA6T 0x00000800
+#define PPC_FEATURE_HAS_DFP 0x00000400
+#define PPC_FEATURE_POWER6_EXT 0x00000200
+#define PPC_FEATURE_ARCH_2_06 0x00000100
+#define PPC_FEATURE_HAS_VSX 0x00000080
+#define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040
+
+#define PPC_FEATURE_TRUE_LE 0x00000002
+#define PPC_FEATURE_PPC_LE 0x00000001
+
+#define PPC_FEATURE2_ARCH_2_07 0x80000000
+#define PPC_FEATURE2_HTM 0x40000000
+#define PPC_FEATURE2_DSCR 0x20000000
+#define PPC_FEATURE2_EBB 0x10000000
+#define PPC_FEATURE2_ISEL 0x08000000
+#define PPC_FEATURE2_TAR 0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
+#define PPC_FEATURE2_HTM_NOSC 0x01000000
+#define PPC_FEATURE2_ARCH_3_00 0x00800000
+#define PPC_FEATURE2_HAS_IEEE128 0x00400000
+#define PPC_FEATURE2_DARN 0x00200000
+#define PPC_FEATURE2_SCV 0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
diff --git a/libc-top-half/musl/arch/powerpc64/bits/ioctl.h b/libc-top-half/musl/arch/powerpc64/bits/ioctl.h
new file mode 100644
index 0000000..b6cbb18
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/ioctl.h
@@ -0,0 +1,120 @@
+#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 1U
+#define _IOC_WRITE 4U
+#define _IOC_READ 2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define FIONCLEX _IO('f', 2)
+#define FIOCLEX _IO('f', 1)
+#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, char[8])
+#define TIOCGETP _IOR('t', 8, char[6])
+#define TIOCSETP _IOW('t', 9, char[6])
+#define TIOCSETN _IOW('t', 10, char[6])
+
+#define TIOCSETC _IOW('t', 17, char[6])
+#define TIOCGETC _IOR('t', 18, char[6])
+#define TCGETS _IOR('t', 19, char[44])
+#define TCSETS _IOW('t', 20, char[44])
+#define TCSETSW _IOW('t', 21, char[44])
+#define TCSETSF _IOW('t', 22, char[44])
+
+#define TCGETA _IOR('t', 23, char[20])
+#define TCSETA _IOW('t', 24, char[20])
+#define TCSETAW _IOW('t', 25, char[20])
+#define TCSETAF _IOW('t', 28, char[20])
+
+#define TCSBRK _IO('t', 29)
+#define TCXONC _IO('t', 30)
+#define TCFLSH _IO('t', 31)
+
+#define TIOCSWINSZ _IOW('t', 103, char[8])
+#define TIOCGWINSZ _IOR('t', 104, char[8])
+#define TIOCSTART _IO('t', 110)
+#define TIOCSTOP _IO('t', 111)
+
+#define TIOCOUTQ _IOR('t', 115, int)
+
+#define TIOCGLTC _IOR('t', 116, char[6])
+#define TIOCSLTC _IOW('t', 117, char[6])
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+
+#define TIOCSTI 0x5412
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#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
+
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425
+#define TIOCSBRK 0x5427
+#define TIOCCBRK 0x5428
+#define TIOCGSID 0x5429
+#define TIOCGRS485 0x542e
+#define TIOCSRS485 0x542f
+#define TIOCGPTN _IOR('T',0x30, unsigned int)
+#define TIOCSPTLCK _IOW('T',0x31, int)
+#define TIOCGDEV _IOR('T',0x32, unsigned int)
+#define TIOCSIG _IOW('T',0x36, int)
+#define TIOCVHANGUP 0x5437
+#define TIOCGPKT _IOR('T', 0x38, int)
+#define TIOCGPTLCK _IOR('T', 0x39, int)
+#define TIOCGEXCL _IOR('T', 0x40, int)
+#define TIOCGPTPEER _IO('T', 0x41)
+
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458
+#define TIOCSERGETLSR 0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT 0x545C
+#define TIOCGICOUNT 0x545D
+
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#define SIOCGSTAMP 0x8906
+#define SIOCGSTAMPNS 0x8907
diff --git a/libc-top-half/musl/arch/powerpc64/bits/ipc.h b/libc-top-half/musl/arch/powerpc64/bits/ipc.h
new file mode 100644
index 0000000..a388d56
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/ipc.h
@@ -0,0 +1,12 @@
+struct ipc_perm {
+ key_t __ipc_perm_key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ mode_t mode;
+ int __ipc_perm_seq;
+ int __pad1;
+ long long __pad2;
+ long long __pad3;
+};
diff --git a/libc-top-half/musl/arch/powerpc64/bits/mman.h b/libc-top-half/musl/arch/powerpc64/bits/mman.h
new file mode 100644
index 0000000..95ec435
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/mman.h
@@ -0,0 +1,13 @@
+#define PROT_SAO 0x10
+
+#undef MAP_NORESERVE
+#define MAP_NORESERVE 0x40
+#undef MAP_LOCKED
+#define MAP_LOCKED 0x80
+
+#undef MCL_CURRENT
+#define MCL_CURRENT 0x2000
+#undef MCL_FUTURE
+#define MCL_FUTURE 0x4000
+#undef MCL_ONFAULT
+#define MCL_ONFAULT 0x8000
diff --git a/libc-top-half/musl/arch/powerpc64/bits/posix.h b/libc-top-half/musl/arch/powerpc64/bits/posix.h
new file mode 100644
index 0000000..c37b94c
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64 1
+#define _POSIX_V7_LP64_OFF64 1
diff --git a/libc-top-half/musl/arch/powerpc64/bits/ptrace.h b/libc-top-half/musl/arch/powerpc64/bits/ptrace.h
new file mode 100644
index 0000000..303a073
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/ptrace.h
@@ -0,0 +1,25 @@
+#define PTRACE_GETVRREGS 0x12
+#define PTRACE_SETVRREGS 0x13
+#define PTRACE_GETEVRREGS 0x14
+#define PTRACE_SETEVRREGS 0x15
+#define PTRACE_GETREGS64 0x16
+#define PTRACE_SETREGS64 0x17
+#define PTRACE_GET_DEBUGREG 0x19
+#define PTRACE_SET_DEBUGREG 0x1a
+#define PTRACE_GETVSRREGS 0x1b
+#define PTRACE_SETVSRREGS 0x1c
+#define PTRACE_SYSEMU 0x1d
+#define PTRACE_SYSEMU_SINGLESTEP 0x1e
+#define PTRACE_SINGLEBLOCK 0x100
+
+#define PT_GETVRREGS PTRACE_GETVRREGS
+#define PT_SETVRREGS PTRACE_SETVRREGS
+#define PT_GETEVRREGS PTRACE_GETEVRREGS
+#define PT_SETEVRREGS PTRACE_SETEVRREGS
+#define PT_GETREGS64 PTRACE_GETREGS64
+#define PT_SETREGS64 PTRACE_SETREGS64
+#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG
+#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG
+#define PT_GETVSRREGS PTRACE_GETVSRREGS
+#define PT_SETVSRREGS PTRACE_SETVSRREGS
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/libc-top-half/musl/arch/powerpc64/bits/reg.h b/libc-top-half/musl/arch/powerpc64/bits/reg.h
new file mode 100644
index 0000000..49382c8
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/reg.h
@@ -0,0 +1,3 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+/* FIXME */
diff --git a/libc-top-half/musl/arch/powerpc64/bits/setjmp.h b/libc-top-half/musl/arch/powerpc64/bits/setjmp.h
new file mode 100644
index 0000000..f7370e3
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned __int128 __jmp_buf[32];
diff --git a/libc-top-half/musl/arch/powerpc64/bits/shm.h b/libc-top-half/musl/arch/powerpc64/bits/shm.h
new file mode 100644
index 0000000..b7f73a8
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/shm.h
@@ -0,0 +1,23 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+ size_t shm_segsz;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __unused[2];
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/powerpc64/bits/signal.h b/libc-top-half/musl/arch/powerpc64/bits/signal.h
new file mode 100644
index 0000000..d5493b1
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/signal.h
@@ -0,0 +1,110 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 4096
+#define SIGSTKSZ 10240
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+typedef unsigned long greg_t, gregset_t[48];
+typedef double fpregset_t[33];
+
+typedef struct {
+#ifdef __GNUC__
+ __attribute__((__aligned__(16)))
+#endif
+ unsigned vrregs[32][4];
+ struct {
+#if __BIG_ENDIAN__
+ unsigned _pad[3], vscr_word;
+#else
+ unsigned vscr_word, _pad[3];
+#endif
+ } vscr;
+ unsigned vrsave, _pad[3];
+} vrregset_t;
+
+typedef struct sigcontext {
+ unsigned long _unused[4];
+ int signal;
+ int _pad0;
+ unsigned long handler;
+ unsigned long oldmask;
+ struct pt_regs *regs;
+ gregset_t gp_regs;
+ fpregset_t fp_regs;
+ vrregset_t *v_regs;
+ long vmx_reserve[34+34+32+1];
+} mcontext_t;
+
+#else
+
+typedef struct {
+ long __regs[4+4+48+33+1+34+34+32+1];
+} mcontext_t;
+
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1U
+#define SA_NOCLDWAIT 2U
+#define SA_SIGINFO 4U
+#define SA_ONSTACK 0x08000000U
+#define SA_RESTART 0x10000000U
+#define SA_NODEFER 0x40000000U
+#define SA_RESETHAND 0x80000000U
+#define SA_RESTORER 0x04000000U
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/powerpc64/bits/socket.h b/libc-top-half/musl/arch/powerpc64/bits/socket.h
new file mode 100644
index 0000000..557e324
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/socket.h
@@ -0,0 +1,27 @@
+#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_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_REUSEPORT 15
+#define SO_RCVLOWAT 16
+#define SO_SNDLOWAT 17
+#define SO_RCVTIMEO 18
+#define SO_SNDTIMEO 19
+#define SO_PASSCRED 20
+#define SO_PEERCRED 21
+#define SO_ACCEPTCONN 30
+#define SO_PEERSEC 31
+#define SO_SNDBUFFORCE 32
+#define SO_RCVBUFFORCE 33
+#define SO_PROTOCOL 38
+#define SO_DOMAIN 39
diff --git a/libc-top-half/musl/arch/powerpc64/bits/stat.h b/libc-top-half/musl/arch/powerpc64/bits/stat.h
new file mode 100644
index 0000000..320b49b
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/stat.h
@@ -0,0 +1,16 @@
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/powerpc64/bits/stdint.h b/libc-top-half/musl/arch/powerpc64/bits/stdint.h
new file mode 100644
index 0000000..1bb147f
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#define SIZE_MAX UINT64_MAX
diff --git a/libc-top-half/musl/arch/powerpc64/bits/syscall.h.in b/libc-top-half/musl/arch/powerpc64/bits/syscall.h.in
new file mode 100644
index 0000000..b3a8fba
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/syscall.h.in
@@ -0,0 +1,400 @@
+#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_vm86 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_query_module 166
+#define __NR_poll 167
+#define __NR_nfsservctl 168
+#define __NR_setresgid 169
+#define __NR_getresgid 170
+#define __NR_prctl 171
+#define __NR_rt_sigreturn 172
+#define __NR_rt_sigaction 173
+#define __NR_rt_sigprocmask 174
+#define __NR_rt_sigpending 175
+#define __NR_rt_sigtimedwait 176
+#define __NR_rt_sigqueueinfo 177
+#define __NR_rt_sigsuspend 178
+#define __NR_pread64 179
+#define __NR_pwrite64 180
+#define __NR_chown 181
+#define __NR_getcwd 182
+#define __NR_capget 183
+#define __NR_capset 184
+#define __NR_sigaltstack 185
+#define __NR_sendfile 186
+#define __NR_getpmsg 187
+#define __NR_putpmsg 188
+#define __NR_vfork 189
+#define __NR_ugetrlimit 190
+#define __NR_readahead 191
+#define __NR_pciconfig_read 198
+#define __NR_pciconfig_write 199
+#define __NR_pciconfig_iobase 200
+#define __NR_multiplexer 201
+#define __NR_getdents64 202
+#define __NR_pivot_root 203
+#define __NR_madvise 205
+#define __NR_mincore 206
+#define __NR_gettid 207
+#define __NR_tkill 208
+#define __NR_setxattr 209
+#define __NR_lsetxattr 210
+#define __NR_fsetxattr 211
+#define __NR_getxattr 212
+#define __NR_lgetxattr 213
+#define __NR_fgetxattr 214
+#define __NR_listxattr 215
+#define __NR_llistxattr 216
+#define __NR_flistxattr 217
+#define __NR_removexattr 218
+#define __NR_lremovexattr 219
+#define __NR_fremovexattr 220
+#define __NR_futex 221
+#define __NR_sched_setaffinity 222
+#define __NR_sched_getaffinity 223
+#define __NR_tuxcall 225
+#define __NR_io_setup 227
+#define __NR_io_destroy 228
+#define __NR_io_getevents 229
+#define __NR_io_submit 230
+#define __NR_io_cancel 231
+#define __NR_set_tid_address 232
+#define __NR_fadvise64 233
+#define __NR_exit_group 234
+#define __NR_lookup_dcookie 235
+#define __NR_epoll_create 236
+#define __NR_epoll_ctl 237
+#define __NR_epoll_wait 238
+#define __NR_remap_file_pages 239
+#define __NR_timer_create 240
+#define __NR_timer_settime 241
+#define __NR_timer_gettime 242
+#define __NR_timer_getoverrun 243
+#define __NR_timer_delete 244
+#define __NR_clock_settime 245
+#define __NR_clock_gettime 246
+#define __NR_clock_getres 247
+#define __NR_clock_nanosleep 248
+#define __NR_swapcontext 249
+#define __NR_tgkill 250
+#define __NR_utimes 251
+#define __NR_statfs64 252
+#define __NR_fstatfs64 253
+#define __NR_rtas 255
+#define __NR_sys_debug_setcontext 256
+#define __NR_migrate_pages 258
+#define __NR_mbind 259
+#define __NR_get_mempolicy 260
+#define __NR_set_mempolicy 261
+#define __NR_mq_open 262
+#define __NR_mq_unlink 263
+#define __NR_mq_timedsend 264
+#define __NR_mq_timedreceive 265
+#define __NR_mq_notify 266
+#define __NR_mq_getsetattr 267
+#define __NR_kexec_load 268
+#define __NR_add_key 269
+#define __NR_request_key 270
+#define __NR_keyctl 271
+#define __NR_waitid 272
+#define __NR_ioprio_set 273
+#define __NR_ioprio_get 274
+#define __NR_inotify_init 275
+#define __NR_inotify_add_watch 276
+#define __NR_inotify_rm_watch 277
+#define __NR_spu_run 278
+#define __NR_spu_create 279
+#define __NR_pselect6 280
+#define __NR_ppoll 281
+#define __NR_unshare 282
+#define __NR_splice 283
+#define __NR_tee 284
+#define __NR_vmsplice 285
+#define __NR_openat 286
+#define __NR_mkdirat 287
+#define __NR_mknodat 288
+#define __NR_fchownat 289
+#define __NR_futimesat 290
+#define __NR_newfstatat 291
+#define __NR_unlinkat 292
+#define __NR_renameat 293
+#define __NR_linkat 294
+#define __NR_symlinkat 295
+#define __NR_readlinkat 296
+#define __NR_fchmodat 297
+#define __NR_faccessat 298
+#define __NR_get_robust_list 299
+#define __NR_set_robust_list 300
+#define __NR_move_pages 301
+#define __NR_getcpu 302
+#define __NR_epoll_pwait 303
+#define __NR_utimensat 304
+#define __NR_signalfd 305
+#define __NR_timerfd_create 306
+#define __NR_eventfd 307
+#define __NR_sync_file_range2 308
+#define __NR_fallocate 309
+#define __NR_subpage_prot 310
+#define __NR_timerfd_settime 311
+#define __NR_timerfd_gettime 312
+#define __NR_signalfd4 313
+#define __NR_eventfd2 314
+#define __NR_epoll_create1 315
+#define __NR_dup3 316
+#define __NR_pipe2 317
+#define __NR_inotify_init1 318
+#define __NR_perf_event_open 319
+#define __NR_preadv 320
+#define __NR_pwritev 321
+#define __NR_rt_tgsigqueueinfo 322
+#define __NR_fanotify_init 323
+#define __NR_fanotify_mark 324
+#define __NR_prlimit64 325
+#define __NR_socket 326
+#define __NR_bind 327
+#define __NR_connect 328
+#define __NR_listen 329
+#define __NR_accept 330
+#define __NR_getsockname 331
+#define __NR_getpeername 332
+#define __NR_socketpair 333
+#define __NR_send 334
+#define __NR_sendto 335
+#define __NR_recv 336
+#define __NR_recvfrom 337
+#define __NR_shutdown 338
+#define __NR_setsockopt 339
+#define __NR_getsockopt 340
+#define __NR_sendmsg 341
+#define __NR_recvmsg 342
+#define __NR_recvmmsg 343
+#define __NR_accept4 344
+#define __NR_name_to_handle_at 345
+#define __NR_open_by_handle_at 346
+#define __NR_clock_adjtime 347
+#define __NR_syncfs 348
+#define __NR_sendmmsg 349
+#define __NR_setns 350
+#define __NR_process_vm_readv 351
+#define __NR_process_vm_writev 352
+#define __NR_finit_module 353
+#define __NR_kcmp 354
+#define __NR_sched_setattr 355
+#define __NR_sched_getattr 356
+#define __NR_renameat2 357
+#define __NR_seccomp 358
+#define __NR_getrandom 359
+#define __NR_memfd_create 360
+#define __NR_bpf 361
+#define __NR_execveat 362
+#define __NR_switch_endian 363
+#define __NR_userfaultfd 364
+#define __NR_membarrier 365
+#define __NR_mlock2 378
+#define __NR_copy_file_range 379
+#define __NR_preadv2 380
+#define __NR_pwritev2 381
+#define __NR_kexec_file_load 382
+#define __NR_statx 383
+#define __NR_pkey_alloc 384
+#define __NR_pkey_free 385
+#define __NR_pkey_mprotect 386
+#define __NR_rseq 387
+#define __NR_io_pgetevents 388
+#define __NR_semtimedop 392
+#define __NR_semget 393
+#define __NR_semctl 394
+#define __NR_shmget 395
+#define __NR_shmctl 396
+#define __NR_shmat 397
+#define __NR_shmdt 398
+#define __NR_msgget 399
+#define __NR_msgsnd 400
+#define __NR_msgrcv 401
+#define __NR_msgctl 402
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/powerpc64/bits/termios.h b/libc-top-half/musl/arch/powerpc64/bits/termios.h
new file mode 100644
index 0000000..da1f406
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/termios.h
@@ -0,0 +1,171 @@
+#undef NCCS
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_cc[NCCS];
+ cc_t c_line;
+ speed_t __c_ispeed;
+ speed_t __c_ospeed;
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VMIN 5
+#define VEOL 6
+#define VTIME 7
+#define VEOL2 8
+#define VSWTC 9
+#define VWERASE 10
+#define VREPRINT 11
+#define VSUSP 12
+#define VSTART 13
+#define VSTOP 14
+#define VLNEXT 15
+#define VDISCARD 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 IXON 0001000
+#define IXOFF 0002000
+#define IXANY 0004000
+#define IUCLC 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+#define OPOST 0000001
+#define ONLCR 0000002
+#define OLCUC 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY 0001400
+#define NL0 0000000
+#define NL1 0000400
+#define NL2 0001000
+#define NL3 0001400
+#define TABDLY 0006000
+#define TAB0 0000000
+#define TAB1 0002000
+#define TAB2 0004000
+#define TAB3 0006000
+#define CRDLY 0030000
+#define CR0 0000000
+#define CR1 0010000
+#define CR2 0020000
+#define CR3 0030000
+#define FFDLY 0040000
+#define FF0 0000000
+#define FF1 0040000
+#define BSDLY 0100000
+#define BS0 0000000
+#define BS1 0100000
+#endif
+
+#define VTDLY 0200000
+#define VT0 0000000
+#define VT1 0200000
+
+#define B0 0000000
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+
+#define B57600 00020
+#define B115200 00021
+#define B230400 00022
+#define B460800 00023
+#define B500000 00024
+#define B576000 00025
+#define B921600 00026
+#define B1000000 00027
+#define B1152000 00030
+#define B1500000 00031
+#define B2000000 00032
+#define B2500000 00033
+#define B3000000 00034
+#define B3500000 00035
+#define B4000000 00036
+
+#define CSIZE 00001400
+#define CS5 00000000
+#define CS6 00000400
+#define CS7 00001000
+#define CS8 00001400
+#define CSTOPB 00002000
+#define CREAD 00004000
+#define PARENB 00010000
+#define PARODD 00020000
+#define HUPCL 00040000
+#define CLOCAL 00100000
+
+#define ECHOE 0x00000002
+#define ECHOK 0x00000004
+#define ECHO 0x00000008
+#define ECHONL 0x00000010
+#define ISIG 0x00000080
+#define ICANON 0x00000100
+#define IEXTEN 0x00000400
+#define TOSTOP 0x00400000
+#define NOFLSH 0x80000000
+
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA 0000016
+#define EXTB 0000017
+#define CBAUD 00377
+#define CBAUDEX 0000020
+#define CIBAUD 077600000
+#define CMSPAR 010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE 0x00004000
+#define ECHOCTL 0x00000040
+#define ECHOPRT 0x00000020
+#define ECHOKE 0x00000001
+#define FLUSHO 0x00800000
+#define PENDIN 0x20000000
+#define EXTPROC 0x10000000
+
+#define XTABS 00006000
+#define TIOCSER_TEMT 1
+#endif
diff --git a/libc-top-half/musl/arch/powerpc64/bits/user.h b/libc-top-half/musl/arch/powerpc64/bits/user.h
new file mode 100644
index 0000000..7e75d20
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/bits/user.h
@@ -0,0 +1,23 @@
+struct user {
+ struct {
+ unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe;
+ unsigned long trap, dar, dsisr, result;
+ } regs;
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long start_code, start_data, start_stack;
+ long signal;
+ void *u_ar0;
+ unsigned long magic;
+ char u_comm[32];
+};
+
+#define ELF_NGREG 48
+#define ELF_NFPREG 33
+#define ELF_NVRREG 34
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
+typedef struct { unsigned u[4]; }
+#ifdef __GNUC__
+__attribute__((__aligned__(16)))
+#endif
+ elf_vrreg_t, elf_vrregset_t[ELF_NVRREG];
diff --git a/libc-top-half/musl/arch/powerpc64/crt_arch.h b/libc-top-half/musl/arch/powerpc64/crt_arch.h
new file mode 100644
index 0000000..168669a
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/crt_arch.h
@@ -0,0 +1,19 @@
+__asm__(
+".text \n"
+".global " START " \n"
+".type " START ", %function \n"
+START ": \n"
+" addis 2, 12, .TOC.-" START "@ha \n"
+" addi 2, 2, .TOC.-" START "@l \n"
+" lwz 4, 1f-" START "(12)\n"
+" add 4, 4, 12 \n"
+" mr 3, 1 \n"
+" clrrdi 1, 1, 4 \n"
+" li 0, 0 \n"
+" stdu 0, -32(1) \n"
+" mtlr 0 \n"
+" bl " START "_c \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+"1: .long _DYNAMIC-" START "\n"
+);
diff --git a/libc-top-half/musl/arch/powerpc64/kstat.h b/libc-top-half/musl/arch/powerpc64/kstat.h
new file mode 100644
index 0000000..887b3e2
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/kstat.h
@@ -0,0 +1,19 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ unsigned long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/powerpc64/pthread_arch.h b/libc-top-half/musl/arch/powerpc64/pthread_arch.h
new file mode 100644
index 0000000..1b7b907
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/pthread_arch.h
@@ -0,0 +1,16 @@
+static inline uintptr_t __get_tp()
+{
+ register uintptr_t tp __asm__("r13");
+ __asm__ ("" : "=r" (tp) );
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define TP_OFFSET 0x7000
+#define DTP_OFFSET 0x8000
+
+// the kernel calls the ip "nip", it's the first saved value after the 32
+// GPRs.
+#define MC_PC gp_regs[32]
diff --git a/libc-top-half/musl/arch/powerpc64/reloc.h b/libc-top-half/musl/arch/powerpc64/reloc.h
new file mode 100644
index 0000000..2f1bba0
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/reloc.h
@@ -0,0 +1,31 @@
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "le"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "powerpc64" ENDIAN_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+#define REL_SYMBOLIC R_PPC64_ADDR64
+#define REL_USYMBOLIC R_PPC64_UADDR64
+#define REL_GOT R_PPC64_GLOB_DAT
+#define REL_PLT R_PPC64_JMP_SLOT
+#define REL_RELATIVE R_PPC64_RELATIVE
+#define REL_COPY R_PPC64_COPY
+#define REL_DTPMOD R_PPC64_DTPMOD64
+#define REL_DTPOFF R_PPC64_DTPREL64
+#define REL_TPOFF R_PPC64_TPREL64
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mr 1,%1; mr 12,%0; mtctr 12; bctrl" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym " \n" \
+ " bl 1f \n" \
+ " .long " #sym "-. \n" \
+ "1: mflr %1 \n" \
+ " lwa %0, 0(%1) \n" \
+ " add %0, %0, %1 \n" \
+ : "=r"(*(fp)), "=r"((long){0}) : : "memory", "lr" )
diff --git a/libc-top-half/musl/arch/powerpc64/syscall_arch.h b/libc-top-half/musl/arch/powerpc64/syscall_arch.h
new file mode 100644
index 0000000..76b4e33
--- /dev/null
+++ b/libc-top-half/musl/arch/powerpc64/syscall_arch.h
@@ -0,0 +1,90 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+static inline long __syscall0(long n)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3");
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "=r"(r3)
+ :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3)
+ :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4)
+ :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
+ :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ register long r6 __asm__("r6") = d;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
+ :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ register long r6 __asm__("r6") = d;
+ register long r7 __asm__("r7") = e;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
+ :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r0 __asm__("r0") = n;
+ register long r3 __asm__("r3") = a;
+ register long r4 __asm__("r4") = b;
+ register long r5 __asm__("r5") = c;
+ register long r6 __asm__("r6") = d;
+ register long r7 __asm__("r7") = e;
+ register long r8 __asm__("r8") = f;
+ __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
+ : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
+ :: "memory", "cr0", "r9", "r10", "r11", "r12");
+ return r3;
+}
+
+#define SO_RCVTIMEO_OLD 18
+#define SO_SNDTIMEO_OLD 19
diff --git a/libc-top-half/musl/arch/riscv64/atomic_arch.h b/libc-top-half/musl/arch/riscv64/atomic_arch.h
new file mode 100644
index 0000000..0c38258
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/atomic_arch.h
@@ -0,0 +1,38 @@
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("fence rw,rw" : : : "memory");
+}
+
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ int old, tmp;
+ __asm__ __volatile__ (
+ "\n1: lr.w.aqrl %0, (%2)\n"
+ " bne %0, %3, 1f\n"
+ " sc.w.aqrl %1, %4, (%2)\n"
+ " bnez %1, 1b\n"
+ "1:"
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(p), "r"((long)t), "r"((long)s)
+ : "memory");
+ return old;
+}
+
+#define a_cas_p a_cas_p
+static inline void *a_cas_p(volatile void *p, void *t, void *s)
+{
+ void *old;
+ int tmp;
+ __asm__ __volatile__ (
+ "\n1: lr.d.aqrl %0, (%2)\n"
+ " bne %0, %3, 1f\n"
+ " sc.d.aqrl %1, %4, (%2)\n"
+ " bnez %1, 1b\n"
+ "1:"
+ : "=&r"(old), "=&r"(tmp)
+ : "r"(p), "r"(t), "r"(s)
+ : "memory");
+ return old;
+}
diff --git a/libc-top-half/musl/arch/riscv64/bits/alltypes.h.in b/libc-top-half/musl/arch/riscv64/bits/alltypes.h.in
new file mode 100644
index 0000000..4579d17
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/alltypes.h.in
@@ -0,0 +1,18 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#define __BYTE_ORDER 1234
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+TYPEDEF int blksize_t;
+TYPEDEF unsigned int nlink_t;
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/riscv64/bits/fenv.h b/libc-top-half/musl/arch/riscv64/bits/fenv.h
new file mode 100644
index 0000000..806ec40
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/fenv.h
@@ -0,0 +1,17 @@
+#define FE_INVALID 16
+#define FE_DIVBYZERO 8
+#define FE_OVERFLOW 4
+#define FE_UNDERFLOW 2
+#define FE_INEXACT 1
+
+#define FE_ALL_EXCEPT 31
+
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 2
+#define FE_UPWARD 3
+#define FE_TOWARDZERO 1
+
+typedef unsigned int fexcept_t;
+typedef unsigned int fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/riscv64/bits/float.h b/libc-top-half/musl/arch/riscv64/bits/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/libc-top-half/musl/arch/riscv64/bits/posix.h b/libc-top-half/musl/arch/riscv64/bits/posix.h
new file mode 100644
index 0000000..8068ce9
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64 1
+#define _POSIX_V7_LP64_OFF64 1
diff --git a/libc-top-half/musl/arch/riscv64/bits/reg.h b/libc-top-half/musl/arch/riscv64/bits/reg.h
new file mode 100644
index 0000000..2633f39
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/libc-top-half/musl/arch/riscv64/bits/setjmp.h b/libc-top-half/musl/arch/riscv64/bits/setjmp.h
new file mode 100644
index 0000000..ad7e401
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[26];
diff --git a/libc-top-half/musl/arch/riscv64/bits/signal.h b/libc-top-half/musl/arch/riscv64/bits/signal.h
new file mode 100644
index 0000000..287367d
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/signal.h
@@ -0,0 +1,118 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+# define MINSIGSTKSZ 2048
+# define SIGSTKSZ 8192
+#endif
+
+typedef unsigned long __riscv_mc_gp_state[32];
+
+struct __riscv_mc_f_ext_state {
+ unsigned int __f[32];
+ unsigned int __fcsr;
+};
+
+struct __riscv_mc_d_ext_state {
+ unsigned long long __f[32];
+ unsigned int __fcsr;
+};
+
+struct __riscv_mc_q_ext_state {
+ unsigned long long __f[64] __attribute__((aligned(16)));
+ unsigned int __fcsr;
+ unsigned int __reserved[3];
+};
+
+union __riscv_mc_fp_state {
+ struct __riscv_mc_f_ext_state __f;
+ struct __riscv_mc_d_ext_state __d;
+ struct __riscv_mc_q_ext_state __q;
+};
+
+typedef struct mcontext_t {
+ __riscv_mc_gp_state __gregs;
+ union __riscv_mc_fp_state __fpregs;
+} mcontext_t;
+
+#if defined(_GNU_SOURCE)
+#define REG_PC 0
+#define REG_RA 1
+#define REG_SP 2
+#define REG_TP 4
+#define REG_S0 8
+#define REG_A0 10
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long greg_t;
+typedef unsigned long gregset_t[32];
+typedef union __riscv_mc_fp_state fpregset_t;
+struct sigcontext {
+ gregset_t gregs;
+ fpregset_t fpregs;
+};
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext
+{
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/riscv64/bits/stat.h b/libc-top-half/musl/arch/riscv64/bits/stat.h
new file mode 100644
index 0000000..b7f4221
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/stat.h
@@ -0,0 +1,18 @@
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ unsigned long __pad;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ blkcnt_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/riscv64/bits/stdint.h b/libc-top-half/musl/arch/riscv64/bits/stdint.h
new file mode 100644
index 0000000..1bb147f
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#define SIZE_MAX UINT64_MAX
diff --git a/libc-top-half/musl/arch/riscv64/bits/syscall.h.in b/libc-top-half/musl/arch/riscv64/bits/syscall.h.in
new file mode 100644
index 0000000..b534afe
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/syscall.h.in
@@ -0,0 +1,304 @@
+#define __NR_io_setup 0
+#define __NR_io_destroy 1
+#define __NR_io_submit 2
+#define __NR_io_cancel 3
+#define __NR_io_getevents 4
+#define __NR_setxattr 5
+#define __NR_lsetxattr 6
+#define __NR_fsetxattr 7
+#define __NR_getxattr 8
+#define __NR_lgetxattr 9
+#define __NR_fgetxattr 10
+#define __NR_listxattr 11
+#define __NR_llistxattr 12
+#define __NR_flistxattr 13
+#define __NR_removexattr 14
+#define __NR_lremovexattr 15
+#define __NR_fremovexattr 16
+#define __NR_getcwd 17
+#define __NR_lookup_dcookie 18
+#define __NR_eventfd2 19
+#define __NR_epoll_create1 20
+#define __NR_epoll_ctl 21
+#define __NR_epoll_pwait 22
+#define __NR_dup 23
+#define __NR_dup3 24
+#define __NR_fcntl 25
+#define __NR_inotify_init1 26
+#define __NR_inotify_add_watch 27
+#define __NR_inotify_rm_watch 28
+#define __NR_ioctl 29
+#define __NR_ioprio_set 30
+#define __NR_ioprio_get 31
+#define __NR_flock 32
+#define __NR_mknodat 33
+#define __NR_mkdirat 34
+#define __NR_unlinkat 35
+#define __NR_symlinkat 36
+#define __NR_linkat 37
+#define __NR_umount2 39
+#define __NR_mount 40
+#define __NR_pivot_root 41
+#define __NR_nfsservctl 42
+#define __NR_statfs 43
+#define __NR_fstatfs 44
+#define __NR_truncate 45
+#define __NR_ftruncate 46
+#define __NR_fallocate 47
+#define __NR_faccessat 48
+#define __NR_chdir 49
+#define __NR_fchdir 50
+#define __NR_chroot 51
+#define __NR_fchmod 52
+#define __NR_fchmodat 53
+#define __NR_fchownat 54
+#define __NR_fchown 55
+#define __NR_openat 56
+#define __NR_close 57
+#define __NR_vhangup 58
+#define __NR_pipe2 59
+#define __NR_quotactl 60
+#define __NR_getdents64 61
+#define __NR_lseek 62
+#define __NR_read 63
+#define __NR_write 64
+#define __NR_readv 65
+#define __NR_writev 66
+#define __NR_pread64 67
+#define __NR_pwrite64 68
+#define __NR_preadv 69
+#define __NR_pwritev 70
+#define __NR_sendfile 71
+#define __NR_pselect6 72
+#define __NR_ppoll 73
+#define __NR_signalfd4 74
+#define __NR_vmsplice 75
+#define __NR_splice 76
+#define __NR_tee 77
+#define __NR_readlinkat 78
+#define __NR_newfstatat 79
+#define __NR_fstat 80
+#define __NR_sync 81
+#define __NR_fsync 82
+#define __NR_fdatasync 83
+#define __NR_sync_file_range 84
+#define __NR_timerfd_create 85
+#define __NR_timerfd_settime 86
+#define __NR_timerfd_gettime 87
+#define __NR_utimensat 88
+#define __NR_acct 89
+#define __NR_capget 90
+#define __NR_capset 91
+#define __NR_personality 92
+#define __NR_exit 93
+#define __NR_exit_group 94
+#define __NR_waitid 95
+#define __NR_set_tid_address 96
+#define __NR_unshare 97
+#define __NR_futex 98
+#define __NR_set_robust_list 99
+#define __NR_get_robust_list 100
+#define __NR_nanosleep 101
+#define __NR_getitimer 102
+#define __NR_setitimer 103
+#define __NR_kexec_load 104
+#define __NR_init_module 105
+#define __NR_delete_module 106
+#define __NR_timer_create 107
+#define __NR_timer_gettime 108
+#define __NR_timer_getoverrun 109
+#define __NR_timer_settime 110
+#define __NR_timer_delete 111
+#define __NR_clock_settime 112
+#define __NR_clock_gettime 113
+#define __NR_clock_getres 114
+#define __NR_clock_nanosleep 115
+#define __NR_syslog 116
+#define __NR_ptrace 117
+#define __NR_sched_setparam 118
+#define __NR_sched_setscheduler 119
+#define __NR_sched_getscheduler 120
+#define __NR_sched_getparam 121
+#define __NR_sched_setaffinity 122
+#define __NR_sched_getaffinity 123
+#define __NR_sched_yield 124
+#define __NR_sched_get_priority_max 125
+#define __NR_sched_get_priority_min 126
+#define __NR_sched_rr_get_interval 127
+#define __NR_restart_syscall 128
+#define __NR_kill 129
+#define __NR_tkill 130
+#define __NR_tgkill 131
+#define __NR_sigaltstack 132
+#define __NR_rt_sigsuspend 133
+#define __NR_rt_sigaction 134
+#define __NR_rt_sigprocmask 135
+#define __NR_rt_sigpending 136
+#define __NR_rt_sigtimedwait 137
+#define __NR_rt_sigqueueinfo 138
+#define __NR_rt_sigreturn 139
+#define __NR_setpriority 140
+#define __NR_getpriority 141
+#define __NR_reboot 142
+#define __NR_setregid 143
+#define __NR_setgid 144
+#define __NR_setreuid 145
+#define __NR_setuid 146
+#define __NR_setresuid 147
+#define __NR_getresuid 148
+#define __NR_setresgid 149
+#define __NR_getresgid 150
+#define __NR_setfsuid 151
+#define __NR_setfsgid 152
+#define __NR_times 153
+#define __NR_setpgid 154
+#define __NR_getpgid 155
+#define __NR_getsid 156
+#define __NR_setsid 157
+#define __NR_getgroups 158
+#define __NR_setgroups 159
+#define __NR_uname 160
+#define __NR_sethostname 161
+#define __NR_setdomainname 162
+#define __NR_getrlimit 163
+#define __NR_setrlimit 164
+#define __NR_getrusage 165
+#define __NR_umask 166
+#define __NR_prctl 167
+#define __NR_getcpu 168
+#define __NR_gettimeofday 169
+#define __NR_settimeofday 170
+#define __NR_adjtimex 171
+#define __NR_getpid 172
+#define __NR_getppid 173
+#define __NR_getuid 174
+#define __NR_geteuid 175
+#define __NR_getgid 176
+#define __NR_getegid 177
+#define __NR_gettid 178
+#define __NR_sysinfo 179
+#define __NR_mq_open 180
+#define __NR_mq_unlink 181
+#define __NR_mq_timedsend 182
+#define __NR_mq_timedreceive 183
+#define __NR_mq_notify 184
+#define __NR_mq_getsetattr 185
+#define __NR_msgget 186
+#define __NR_msgctl 187
+#define __NR_msgrcv 188
+#define __NR_msgsnd 189
+#define __NR_semget 190
+#define __NR_semctl 191
+#define __NR_semtimedop 192
+#define __NR_semop 193
+#define __NR_shmget 194
+#define __NR_shmctl 195
+#define __NR_shmat 196
+#define __NR_shmdt 197
+#define __NR_socket 198
+#define __NR_socketpair 199
+#define __NR_bind 200
+#define __NR_listen 201
+#define __NR_accept 202
+#define __NR_connect 203
+#define __NR_getsockname 204
+#define __NR_getpeername 205
+#define __NR_sendto 206
+#define __NR_recvfrom 207
+#define __NR_setsockopt 208
+#define __NR_getsockopt 209
+#define __NR_shutdown 210
+#define __NR_sendmsg 211
+#define __NR_recvmsg 212
+#define __NR_readahead 213
+#define __NR_brk 214
+#define __NR_munmap 215
+#define __NR_mremap 216
+#define __NR_add_key 217
+#define __NR_request_key 218
+#define __NR_keyctl 219
+#define __NR_clone 220
+#define __NR_execve 221
+#define __NR_mmap 222
+#define __NR_fadvise64 223
+#define __NR_swapon 224
+#define __NR_swapoff 225
+#define __NR_mprotect 226
+#define __NR_msync 227
+#define __NR_mlock 228
+#define __NR_munlock 229
+#define __NR_mlockall 230
+#define __NR_munlockall 231
+#define __NR_mincore 232
+#define __NR_madvise 233
+#define __NR_remap_file_pages 234
+#define __NR_mbind 235
+#define __NR_get_mempolicy 236
+#define __NR_set_mempolicy 237
+#define __NR_migrate_pages 238
+#define __NR_move_pages 239
+#define __NR_rt_tgsigqueueinfo 240
+#define __NR_perf_event_open 241
+#define __NR_accept4 242
+#define __NR_recvmmsg 243
+#define __NR_arch_specific_syscall 244
+#define __NR_wait4 260
+#define __NR_prlimit64 261
+#define __NR_fanotify_init 262
+#define __NR_fanotify_mark 263
+#define __NR_name_to_handle_at 264
+#define __NR_open_by_handle_at 265
+#define __NR_clock_adjtime 266
+#define __NR_syncfs 267
+#define __NR_setns 268
+#define __NR_sendmmsg 269
+#define __NR_process_vm_readv 270
+#define __NR_process_vm_writev 271
+#define __NR_kcmp 272
+#define __NR_finit_module 273
+#define __NR_sched_setattr 274
+#define __NR_sched_getattr 275
+#define __NR_renameat2 276
+#define __NR_seccomp 277
+#define __NR_getrandom 278
+#define __NR_memfd_create 279
+#define __NR_bpf 280
+#define __NR_execveat 281
+#define __NR_userfaultfd 282
+#define __NR_membarrier 283
+#define __NR_mlock2 284
+#define __NR_copy_file_range 285
+#define __NR_preadv2 286
+#define __NR_pwritev2 287
+#define __NR_pkey_mprotect 288
+#define __NR_pkey_alloc 289
+#define __NR_pkey_free 290
+#define __NR_statx 291
+#define __NR_io_pgetevents 292
+#define __NR_rseq 293
+#define __NR_kexec_file_load 294
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
+#define __NR_sysriscv __NR_arch_specific_syscall
+#define __NR_riscv_flush_icache (__NR_sysriscv + 15)
diff --git a/libc-top-half/musl/arch/riscv64/bits/user.h b/libc-top-half/musl/arch/riscv64/bits/user.h
new file mode 100644
index 0000000..0d37de0
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/bits/user.h
@@ -0,0 +1,6 @@
+#include <signal.h>
+
+#define ELF_NGREG 32
+#define ELF_NFPREG 33
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+typedef union __riscv_mc_fp_state elf_fpregset_t;
diff --git a/libc-top-half/musl/arch/riscv64/crt_arch.h b/libc-top-half/musl/arch/riscv64/crt_arch.h
new file mode 100644
index 0000000..6b93fcf
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/crt_arch.h
@@ -0,0 +1,19 @@
+__asm__(
+".section .sdata,\"aw\"\n"
+".text\n"
+".global " START "\n"
+".type " START ",%function\n"
+START ":\n"
+".weak __global_pointer$\n"
+".hidden __global_pointer$\n"
+".option push\n"
+".option norelax\n\t"
+"lla gp, __global_pointer$\n"
+".option pop\n\t"
+"mv a0, sp\n"
+".weak _DYNAMIC\n"
+".hidden _DYNAMIC\n\t"
+"lla a1, _DYNAMIC\n\t"
+"andi sp, sp, -16\n\t"
+"tail " START "_c"
+);
diff --git a/libc-top-half/musl/arch/riscv64/kstat.h b/libc-top-half/musl/arch/riscv64/kstat.h
new file mode 100644
index 0000000..92625f3
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ unsigned long __pad;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ unsigned __unused[2];
+};
diff --git a/libc-top-half/musl/arch/riscv64/pthread_arch.h b/libc-top-half/musl/arch/riscv64/pthread_arch.h
new file mode 100644
index 0000000..a20d7fb
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/pthread_arch.h
@@ -0,0 +1,13 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ __volatile__("mv %0, tp" : "=r"(tp));
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+
+#define DTP_OFFSET 0x800
+
+#define MC_PC __gregs[0]
diff --git a/libc-top-half/musl/arch/riscv64/reloc.h b/libc-top-half/musl/arch/riscv64/reloc.h
new file mode 100644
index 0000000..1ca1381
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/reloc.h
@@ -0,0 +1,22 @@
+#if defined __riscv_float_abi_soft
+#define RISCV_FP_SUFFIX "-sf"
+#elif defined __riscv_float_abi_single
+#define RISCV_FP_SUFFIX "-sp"
+#elif defined __riscv_float_abi_double
+#define RISCV_FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "riscv64" RISCV_FP_SUFFIX
+
+#define TPOFF_K 0
+
+#define REL_SYMBOLIC R_RISCV_64
+#define REL_PLT R_RISCV_JUMP_SLOT
+#define REL_RELATIVE R_RISCV_RELATIVE
+#define REL_COPY R_RISCV_COPY
+#define REL_DTPMOD R_RISCV_TLS_DTPMOD64
+#define REL_DTPOFF R_RISCV_TLS_DTPREL64
+#define REL_TPOFF R_RISCV_TLS_TPREL64
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mv sp, %1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
diff --git a/libc-top-half/musl/arch/riscv64/syscall_arch.h b/libc-top-half/musl/arch/riscv64/syscall_arch.h
new file mode 100644
index 0000000..7fd042c
--- /dev/null
+++ b/libc-top-half/musl/arch/riscv64/syscall_arch.h
@@ -0,0 +1,78 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+#define __asm_syscall(...) \
+ __asm__ __volatile__ ("ecall\n\t" \
+ : "=r"(a0) : __VA_ARGS__ : "memory"); \
+ return a0; \
+
+static inline long __syscall0(long n)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0");
+ __asm_syscall("r"(a7))
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0") = a;
+ __asm_syscall("r"(a7), "0"(a0))
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0") = a;
+ register long a1 __asm__("a1") = b;
+ __asm_syscall("r"(a7), "0"(a0), "r"(a1))
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0") = a;
+ register long a1 __asm__("a1") = b;
+ register long a2 __asm__("a2") = c;
+ __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2))
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0") = a;
+ register long a1 __asm__("a1") = b;
+ register long a2 __asm__("a2") = c;
+ register long a3 __asm__("a3") = d;
+ __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3))
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0") = a;
+ register long a1 __asm__("a1") = b;
+ register long a2 __asm__("a2") = c;
+ register long a3 __asm__("a3") = d;
+ register long a4 __asm__("a4") = e;
+ __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4))
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long a7 __asm__("a7") = n;
+ register long a0 __asm__("a0") = a;
+ register long a1 __asm__("a1") = b;
+ register long a2 __asm__("a2") = c;
+ register long a3 __asm__("a3") = d;
+ register long a4 __asm__("a4") = e;
+ register long a5 __asm__("a5") = f;
+ __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5))
+}
+
+#define VDSO_USEFUL
+/* We don't have a clock_gettime function.
+#define VDSO_CGT_SYM "__vdso_clock_gettime"
+#define VDSO_CGT_VER "LINUX_2.6" */
+
+#define IPC_64 0
diff --git a/libc-top-half/musl/arch/s390x/atomic_arch.h b/libc-top-half/musl/arch/s390x/atomic_arch.h
new file mode 100644
index 0000000..9b0e1df
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/atomic_arch.h
@@ -0,0 +1,30 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__ __volatile__ (
+ "cs %0, %2, %1"
+ : "+d"(t), "+Q"(*p) : "d"(s) : "memory", "cc");
+ return t;
+}
+
+#define a_cas_p a_cas_p
+static inline void *a_cas_p(volatile void *p, void *t, void *s)
+{
+ __asm__ __volatile__ (
+ "csg %0, %2, %1"
+ : "+d"(t), "+Q"(*(void *volatile *)p) : "d"(s)
+ : "memory", "cc");
+ return t;
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("bcr 15,0" : : : "memory");
+}
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__ (".insn e,0");
+}
diff --git a/libc-top-half/musl/arch/s390x/bits/alltypes.h.in b/libc-top-half/musl/arch/s390x/bits/alltypes.h.in
new file mode 100644
index 0000000..6c0eb7f
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/alltypes.h.in
@@ -0,0 +1,19 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#define __BYTE_ORDER 4321
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 1
+TYPEDEF double float_t;
+#else
+TYPEDEF float float_t;
+#endif
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/s390x/bits/fcntl.h b/libc-top-half/musl/arch/s390x/bits/fcntl.h
new file mode 100644
index 0000000..a231efb
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/fcntl.h
@@ -0,0 +1,43 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 040000
+#define O_LARGEFILE 0100000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED 6
+#define POSIX_FADV_NOREUSE 7
diff --git a/libc-top-half/musl/arch/s390x/bits/fenv.h b/libc-top-half/musl/arch/s390x/bits/fenv.h
new file mode 100644
index 0000000..773dad9
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/fenv.h
@@ -0,0 +1,17 @@
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_UPWARD 2
+#define FE_DOWNWARD 3
+
+#define FE_INEXACT 0x00080000
+#define FE_UNDERFLOW 0x00100000
+#define FE_OVERFLOW 0x00200000
+#define FE_DIVBYZERO 0x00400000
+#define FE_INVALID 0x00800000
+
+#define FE_ALL_EXCEPT 0x00f80000
+
+typedef unsigned fexcept_t;
+typedef unsigned fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *)-1)
diff --git a/libc-top-half/musl/arch/s390x/bits/float.h b/libc-top-half/musl/arch/s390x/bits/float.h
new file mode 100644
index 0000000..e188cb6
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 0
+#endif
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/libc-top-half/musl/arch/s390x/bits/hwcap.h b/libc-top-half/musl/arch/s390x/bits/hwcap.h
new file mode 100644
index 0000000..ecc6ce1
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/hwcap.h
@@ -0,0 +1,15 @@
+#define HWCAP_S390_ESAN3 1
+#define HWCAP_S390_ZARCH 2
+#define HWCAP_S390_STFLE 4
+#define HWCAP_S390_MSA 8
+#define HWCAP_S390_LDISP 16
+#define HWCAP_S390_EIMM 32
+#define HWCAP_S390_DFP 64
+#define HWCAP_S390_HPAGE 128
+#define HWCAP_S390_ETF3EH 256
+#define HWCAP_S390_HIGH_GPRS 512
+#define HWCAP_S390_TE 1024
+#define HWCAP_S390_VXRS 2048
+#define HWCAP_S390_VXRS_BCD 4096
+#define HWCAP_S390_VXRS_EXT 8192
+#define HWCAP_S390_GS 16384
diff --git a/libc-top-half/musl/arch/s390x/bits/ioctl_fix.h b/libc-top-half/musl/arch/s390x/bits/ioctl_fix.h
new file mode 100644
index 0000000..ebb383d
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/ioctl_fix.h
@@ -0,0 +1,2 @@
+#undef FIOQSIZE
+#define FIOQSIZE 0x545e
diff --git a/libc-top-half/musl/arch/s390x/bits/limits.h b/libc-top-half/musl/arch/s390x/bits/limits.h
new file mode 100644
index 0000000..07743b6
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/limits.h
@@ -0,0 +1 @@
+#define PAGESIZE 4096
diff --git a/libc-top-half/musl/arch/s390x/bits/link.h b/libc-top-half/musl/arch/s390x/bits/link.h
new file mode 100644
index 0000000..923aac5
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/link.h
@@ -0,0 +1 @@
+typedef uint64_t Elf_Symndx;
diff --git a/libc-top-half/musl/arch/s390x/bits/posix.h b/libc-top-half/musl/arch/s390x/bits/posix.h
new file mode 100644
index 0000000..c37b94c
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64 1
+#define _POSIX_V7_LP64_OFF64 1
diff --git a/libc-top-half/musl/arch/s390x/bits/ptrace.h b/libc-top-half/musl/arch/s390x/bits/ptrace.h
new file mode 100644
index 0000000..a06cb07
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/ptrace.h
@@ -0,0 +1,12 @@
+#define PTRACE_SINGLEBLOCK 12
+#define PTRACE_OLDSETOPTIONS 21
+#define PTRACE_SYSEMU 31
+#define PTRACE_SYSEMU_SINGLESTEP 32
+#define PTRACE_PEEKUSR_AREA 0x5000
+#define PTRACE_POKEUSR_AREA 0x5001
+#define PTRACE_GET_LAST_BREAK 0x5006
+#define PTRACE_ENABLE_TE 0x5009
+#define PTRACE_DISABLE_TE 0x5010
+#define PTRACE_TE_ABORT_RAND 0x5011
+
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/libc-top-half/musl/arch/s390x/bits/reg.h b/libc-top-half/musl/arch/s390x/bits/reg.h
new file mode 100644
index 0000000..2633f39
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/libc-top-half/musl/arch/s390x/bits/setjmp.h b/libc-top-half/musl/arch/s390x/bits/setjmp.h
new file mode 100644
index 0000000..b2bd974
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[18];
diff --git a/libc-top-half/musl/arch/s390x/bits/signal.h b/libc-top-half/musl/arch/s390x/bits/signal.h
new file mode 100644
index 0000000..e5aca4b
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/signal.h
@@ -0,0 +1,121 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 4096
+#define SIGSTKSZ 10240
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+typedef unsigned long greg_t, gregset_t[27];
+
+typedef struct {
+ unsigned long mask;
+ unsigned long addr;
+} __psw_t;
+
+typedef union {
+ double d;
+ float f;
+} fpreg_t;
+
+typedef struct {
+ unsigned fpc;
+ fpreg_t fprs[16];
+} fpregset_t;
+
+typedef struct
+{
+ __psw_t psw;
+ unsigned long gregs[16];
+ unsigned aregs[16];
+ fpregset_t fpregs;
+} mcontext_t;
+
+struct sigcontext {
+ unsigned long oldmask[1];
+ struct {
+ struct {
+ __psw_t psw;
+ unsigned long gprs[16];
+ unsigned acrs[16];
+ } regs;
+ struct {
+ unsigned fpc;
+ double fprs[16];
+ } fpregs;
+ } *sregs;
+};
+
+#else
+
+typedef struct {
+ unsigned long __regs1[18];
+ unsigned __regs2[18];
+ double __regs3[16];
+} mcontext_t;
+
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1U
+#define SA_NOCLDWAIT 2U
+#define SA_SIGINFO 4U
+#define SA_ONSTACK 0x08000000U
+#define SA_RESTART 0x10000000U
+#define SA_NODEFER 0x40000000U
+#define SA_RESETHAND 0x80000000U
+#define SA_RESTORER 0x04000000U
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/s390x/bits/stat.h b/libc-top-half/musl/arch/s390x/bits/stat.h
new file mode 100644
index 0000000..2db4ad0
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/stat.h
@@ -0,0 +1,16 @@
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ unsigned long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/s390x/bits/statfs.h b/libc-top-half/musl/arch/s390x/bits/statfs.h
new file mode 100644
index 0000000..6617358
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/statfs.h
@@ -0,0 +1,7 @@
+struct statfs {
+ unsigned f_type, f_bsize;
+ fsblkcnt_t f_blocks, f_bfree, f_bavail;
+ fsfilcnt_t f_files, f_ffree;
+ fsid_t f_fsid;
+ unsigned f_namelen, f_frsize, f_flags, f_spare[4];
+};
diff --git a/libc-top-half/musl/arch/s390x/bits/stdint.h b/libc-top-half/musl/arch/s390x/bits/stdint.h
new file mode 100644
index 0000000..1bb147f
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#define SIZE_MAX UINT64_MAX
diff --git a/libc-top-half/musl/arch/s390x/bits/syscall.h.in b/libc-top-half/musl/arch/s390x/bits/syscall.h.in
new file mode 100644
index 0000000..dfc3847
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/syscall.h.in
@@ -0,0 +1,365 @@
+#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_restart_syscall 7
+#define __NR_creat 8
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_execve 11
+#define __NR_chdir 12
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_lseek 19
+#define __NR_getpid 20
+#define __NR_mount 21
+#define __NR_umount 22
+#define __NR_ptrace 26
+#define __NR_alarm 27
+#define __NR_pause 29
+#define __NR_utime 30
+#define __NR_access 33
+#define __NR_nice 34
+#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_brk 45
+#define __NR_signal 48
+#define __NR_acct 51
+#define __NR_umount2 52
+#define __NR_ioctl 54
+#define __NR_fcntl 55
+#define __NR_setpgid 57
+#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_sigsuspend 72
+#define __NR_sigpending 73
+#define __NR_sethostname 74
+#define __NR_setrlimit 75
+#define __NR_getrusage 77
+#define __NR_gettimeofday 78
+#define __NR_settimeofday 79
+#define __NR_symlink 83
+#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_getpriority 96
+#define __NR_setpriority 97
+#define __NR_statfs 99
+#define __NR_fstatfs 100
+#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_lookup_dcookie 110
+#define __NR_vhangup 111
+#define __NR_idle 112
+#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_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_getdents 141
+#define __NR_select 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_query_module 167
+#define __NR_poll 168
+#define __NR_nfsservctl 169
+#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_getcwd 183
+#define __NR_capget 184
+#define __NR_capset 185
+#define __NR_sigaltstack 186
+#define __NR_sendfile 187
+#define __NR_getpmsg 188
+#define __NR_putpmsg 189
+#define __NR_vfork 190
+#define __NR_getrlimit 191
+#define __NR_lchown 198
+#define __NR_getuid 199
+#define __NR_getgid 200
+#define __NR_geteuid 201
+#define __NR_getegid 202
+#define __NR_setreuid 203
+#define __NR_setregid 204
+#define __NR_getgroups 205
+#define __NR_setgroups 206
+#define __NR_fchown 207
+#define __NR_setresuid 208
+#define __NR_getresuid 209
+#define __NR_setresgid 210
+#define __NR_getresgid 211
+#define __NR_chown 212
+#define __NR_setuid 213
+#define __NR_setgid 214
+#define __NR_setfsuid 215
+#define __NR_setfsgid 216
+#define __NR_pivot_root 217
+#define __NR_mincore 218
+#define __NR_madvise 219
+#define __NR_getdents64 220
+#define __NR_readahead 222
+#define __NR_setxattr 224
+#define __NR_lsetxattr 225
+#define __NR_fsetxattr 226
+#define __NR_getxattr 227
+#define __NR_lgetxattr 228
+#define __NR_fgetxattr 229
+#define __NR_listxattr 230
+#define __NR_llistxattr 231
+#define __NR_flistxattr 232
+#define __NR_removexattr 233
+#define __NR_lremovexattr 234
+#define __NR_fremovexattr 235
+#define __NR_gettid 236
+#define __NR_tkill 237
+#define __NR_futex 238
+#define __NR_sched_setaffinity 239
+#define __NR_sched_getaffinity 240
+#define __NR_tgkill 241
+#define __NR_io_setup 243
+#define __NR_io_destroy 244
+#define __NR_io_getevents 245
+#define __NR_io_submit 246
+#define __NR_io_cancel 247
+#define __NR_exit_group 248
+#define __NR_epoll_create 249
+#define __NR_epoll_ctl 250
+#define __NR_epoll_wait 251
+#define __NR_set_tid_address 252
+#define __NR_fadvise64 253
+#define __NR_timer_create 254
+#define __NR_timer_settime 255
+#define __NR_timer_gettime 256
+#define __NR_timer_getoverrun 257
+#define __NR_timer_delete 258
+#define __NR_clock_settime 259
+#define __NR_clock_gettime 260
+#define __NR_clock_getres 261
+#define __NR_clock_nanosleep 262
+#define __NR_statfs64 265
+#define __NR_fstatfs64 266
+#define __NR_remap_file_pages 267
+#define __NR_mbind 268
+#define __NR_get_mempolicy 269
+#define __NR_set_mempolicy 270
+#define __NR_mq_open 271
+#define __NR_mq_unlink 272
+#define __NR_mq_timedsend 273
+#define __NR_mq_timedreceive 274
+#define __NR_mq_notify 275
+#define __NR_mq_getsetattr 276
+#define __NR_kexec_load 277
+#define __NR_add_key 278
+#define __NR_request_key 279
+#define __NR_keyctl 280
+#define __NR_waitid 281
+#define __NR_ioprio_set 282
+#define __NR_ioprio_get 283
+#define __NR_inotify_init 284
+#define __NR_inotify_add_watch 285
+#define __NR_inotify_rm_watch 286
+#define __NR_migrate_pages 287
+#define __NR_openat 288
+#define __NR_mkdirat 289
+#define __NR_mknodat 290
+#define __NR_fchownat 291
+#define __NR_futimesat 292
+#define __NR_newfstatat 293
+#define __NR_unlinkat 294
+#define __NR_renameat 295
+#define __NR_linkat 296
+#define __NR_symlinkat 297
+#define __NR_readlinkat 298
+#define __NR_fchmodat 299
+#define __NR_faccessat 300
+#define __NR_pselect6 301
+#define __NR_ppoll 302
+#define __NR_unshare 303
+#define __NR_set_robust_list 304
+#define __NR_get_robust_list 305
+#define __NR_splice 306
+#define __NR_sync_file_range 307
+#define __NR_tee 308
+#define __NR_vmsplice 309
+#define __NR_move_pages 310
+#define __NR_getcpu 311
+#define __NR_epoll_pwait 312
+#define __NR_utimes 313
+#define __NR_fallocate 314
+#define __NR_utimensat 315
+#define __NR_signalfd 316
+#define __NR_timerfd 317
+#define __NR_eventfd 318
+#define __NR_timerfd_create 319
+#define __NR_timerfd_settime 320
+#define __NR_timerfd_gettime 321
+#define __NR_signalfd4 322
+#define __NR_eventfd2 323
+#define __NR_inotify_init1 324
+#define __NR_pipe2 325
+#define __NR_dup3 326
+#define __NR_epoll_create1 327
+#define __NR_preadv 328
+#define __NR_pwritev 329
+#define __NR_rt_tgsigqueueinfo 330
+#define __NR_perf_event_open 331
+#define __NR_fanotify_init 332
+#define __NR_fanotify_mark 333
+#define __NR_prlimit64 334
+#define __NR_name_to_handle_at 335
+#define __NR_open_by_handle_at 336
+#define __NR_clock_adjtime 337
+#define __NR_syncfs 338
+#define __NR_setns 339
+#define __NR_process_vm_readv 340
+#define __NR_process_vm_writev 341
+#define __NR_s390_runtime_instr 342
+#define __NR_kcmp 343
+#define __NR_finit_module 344
+#define __NR_sched_setattr 345
+#define __NR_sched_getattr 346
+#define __NR_renameat2 347
+#define __NR_seccomp 348
+#define __NR_getrandom 349
+#define __NR_memfd_create 350
+#define __NR_bpf 351
+#define __NR_s390_pci_mmio_write 352
+#define __NR_s390_pci_mmio_read 353
+#define __NR_execveat 354
+#define __NR_userfaultfd 355
+#define __NR_membarrier 356
+#define __NR_recvmmsg 357
+#define __NR_sendmmsg 358
+#define __NR_socket 359
+#define __NR_socketpair 360
+#define __NR_bind 361
+#define __NR_connect 362
+#define __NR_listen 363
+#define __NR_accept4 364
+#define __NR_getsockopt 365
+#define __NR_setsockopt 366
+#define __NR_getsockname 367
+#define __NR_getpeername 368
+#define __NR_sendto 369
+#define __NR_sendmsg 370
+#define __NR_recvfrom 371
+#define __NR_recvmsg 372
+#define __NR_shutdown 373
+#define __NR_mlock2 374
+#define __NR_copy_file_range 375
+#define __NR_preadv2 376
+#define __NR_pwritev2 377
+#define __NR_s390_guarded_storage 378
+#define __NR_statx 379
+#define __NR_s390_sthyi 380
+#define __NR_kexec_file_load 381
+#define __NR_io_pgetevents 382
+#define __NR_rseq 383
+#define __NR_pkey_mprotect 384
+#define __NR_pkey_alloc 385
+#define __NR_pkey_free 386
+#define __NR_semtimedop 392
+#define __NR_semget 393
+#define __NR_semctl 394
+#define __NR_shmget 395
+#define __NR_shmctl 396
+#define __NR_shmat 397
+#define __NR_shmdt 398
+#define __NR_msgget 399
+#define __NR_msgsnd 400
+#define __NR_msgrcv 401
+#define __NR_msgctl 402
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/s390x/bits/user.h b/libc-top-half/musl/arch/s390x/bits/user.h
new file mode 100644
index 0000000..ff3f048
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/bits/user.h
@@ -0,0 +1,62 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+
+typedef union {
+ double d;
+ float f;
+} elf_fpreg_t;
+
+typedef struct {
+ unsigned fpc;
+ elf_fpreg_t fprs[16];
+} elf_fpregset_t;
+
+#define ELF_NGREG 27
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct _user_psw_struct {
+ unsigned long mask, addr;
+};
+
+struct _user_fpregs_struct {
+ unsigned fpc;
+ double fprs[16];
+};
+
+struct _user_per_struct {
+ unsigned long control_regs[3];
+ unsigned single_step : 1;
+ unsigned instruction_fetch : 1;
+ unsigned : 30;
+ unsigned long starting_addr, ending_addr;
+ unsigned short perc_atmid;
+ unsigned long address;
+ unsigned char access_id;
+};
+
+struct _user_regs_struct {
+ struct _user_psw_struct psw;
+ unsigned long gprs[16];
+ unsigned acrs[16];
+ unsigned long orig_gpr2;
+ struct _user_fpregs_struct fp_regs;
+ struct _user_per_struct per_info;
+ unsigned long ieee_instruction_pointer;
+};
+
+struct user {
+ struct _user_regs_struct regs;
+ unsigned long u_tsize, u_dsize, u_ssize;
+ unsigned long start_code, start_stack;
+ long signal;
+ struct _user_regs_struct *u_ar0;
+ unsigned long magic;
+ char u_comm[32];
+};
+
+#define PAGE_MASK (~(PAGESIZE-1))
+#define NBPG PAGESIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
diff --git a/libc-top-half/musl/arch/s390x/crt_arch.h b/libc-top-half/musl/arch/s390x/crt_arch.h
new file mode 100644
index 0000000..92091a1
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/crt_arch.h
@@ -0,0 +1,17 @@
+__asm__(
+".text\n"
+".global " START "\n"
+".type " START ", %function\n"
+START ":\n"
+" lgr %r2, %r15\n"
+" larl %r3, 1f\n"
+" agf %r3, 0(%r3)\n"
+" aghi %r15, -160\n"
+" lghi %r0, 0\n"
+" stg %r0, 0(%r15)\n"
+" jg " START "_c\n"
+" .align 8\n"
+".weak _DYNAMIC\n"
+".hidden _DYNAMIC\n"
+"1: .long _DYNAMIC-.\n"
+);
diff --git a/libc-top-half/musl/arch/s390x/kstat.h b/libc-top-half/musl/arch/s390x/kstat.h
new file mode 100644
index 0000000..001c10b
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/kstat.h
@@ -0,0 +1,19 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ unsigned long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/s390x/pthread_arch.h b/libc-top-half/musl/arch/s390x/pthread_arch.h
new file mode 100644
index 0000000..e54fec3
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/pthread_arch.h
@@ -0,0 +1,12 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ (
+ "ear %0, %%a0\n"
+ "sllg %0, %0, 32\n"
+ "ear %0, %%a1\n"
+ : "=r"(tp));
+ return tp;
+}
+
+#define MC_PC psw.addr
diff --git a/libc-top-half/musl/arch/s390x/reloc.h b/libc-top-half/musl/arch/s390x/reloc.h
new file mode 100644
index 0000000..6e5c1fb
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/reloc.h
@@ -0,0 +1,13 @@
+#define LDSO_ARCH "s390x"
+
+#define REL_SYMBOLIC R_390_64
+#define REL_GOT R_390_GLOB_DAT
+#define REL_PLT R_390_JMP_SLOT
+#define REL_RELATIVE R_390_RELATIVE
+#define REL_COPY R_390_COPY
+#define REL_DTPMOD R_390_TLS_DTPMOD
+#define REL_DTPOFF R_390_TLS_DTPOFF
+#define REL_TPOFF R_390_TLS_TPOFF
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "lgr %%r15,%1; br %0" : : "r"(pc), "r"(sp) : "memory" )
diff --git a/libc-top-half/musl/arch/s390x/syscall_arch.h b/libc-top-half/musl/arch/s390x/syscall_arch.h
new file mode 100644
index 0000000..83cc9a2
--- /dev/null
+++ b/libc-top-half/musl/arch/s390x/syscall_arch.h
@@ -0,0 +1,74 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+#define __asm_syscall(ret, ...) do { \
+ __asm__ __volatile__ ("svc 0\n" \
+ : ret : __VA_ARGS__ : "memory"); \
+ return r2; \
+ } while (0)
+
+static inline long __syscall0(long n)
+{
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2");
+ __asm_syscall("=r"(r2), "r"(r1));
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2") = a;
+ __asm_syscall("+r"(r2), "r"(r1));
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2") = a;
+ register long r3 __asm__("r3") = b;
+ __asm_syscall("+r"(r2), "r"(r1), "r"(r3));
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2") = a;
+ register long r3 __asm__("r3") = b;
+ register long r4 __asm__("r4") = c;
+ __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4));
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2") = a;
+ register long r3 __asm__("r3") = b;
+ register long r4 __asm__("r4") = c;
+ register long r5 __asm__("r5") = d;
+ __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5));
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2") = a;
+ register long r3 __asm__("r3") = b;
+ register long r4 __asm__("r4") = c;
+ register long r5 __asm__("r5") = d;
+ register long r6 __asm__("r6") = e;
+ __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6));
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ if (n == SYS_mmap) return __syscall1(n, (long)(long[]){a,b,c,d,e,f});
+
+ register long r1 __asm__("r1") = n;
+ register long r2 __asm__("r2") = a;
+ register long r3 __asm__("r3") = b;
+ register long r4 __asm__("r4") = c;
+ register long r5 __asm__("r5") = d;
+ register long r6 __asm__("r6") = e;
+ register long r7 __asm__("r7") = f;
+ __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7));
+}
diff --git a/libc-top-half/musl/arch/sh/arch.mak b/libc-top-half/musl/arch/sh/arch.mak
new file mode 100644
index 0000000..aa4d05c
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/arch.mak
@@ -0,0 +1 @@
+COMPAT_SRC_DIRS = compat/time32
diff --git a/libc-top-half/musl/arch/sh/atomic_arch.h b/libc-top-half/musl/arch/sh/atomic_arch.h
new file mode 100644
index 0000000..0a4d0c1
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/atomic_arch.h
@@ -0,0 +1,48 @@
+#include "libc.h"
+
+#if defined(__SH4A__)
+
+#define a_ll a_ll
+static inline int a_ll(volatile int *p)
+{
+ int v;
+ __asm__ __volatile__ ("movli.l @%1, %0" : "=z"(v) : "r"(p), "m"(*p));
+ return v;
+}
+
+#define a_sc a_sc
+static inline int a_sc(volatile int *p, int v)
+{
+ int r;
+ __asm__ __volatile__ (
+ "movco.l %2, @%3 ; movt %0"
+ : "=r"(r), "=m"(*p) : "z"(v), "r"(p) : "memory", "cc");
+ return r;
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__ ("synco" ::: "memory");
+}
+
+#define a_pre_llsc a_barrier
+#define a_post_llsc a_barrier
+
+#else
+
+#define a_cas a_cas
+extern hidden const void *__sh_cas_ptr;
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ register int r1 __asm__("r1");
+ register int r2 __asm__("r2") = t;
+ register int r3 __asm__("r3") = s;
+ __asm__ __volatile__ (
+ "jsr @%4 ; nop"
+ : "=r"(r1), "+r"(r3) : "z"(p), "r"(r2), "r"(__sh_cas_ptr)
+ : "memory", "pr", "cc");
+ return r3;
+}
+
+#endif
diff --git a/libc-top-half/musl/arch/sh/bits/alltypes.h.in b/libc-top-half/musl/arch/sh/bits/alltypes.h.in
new file mode 100644
index 0000000..6a53835
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/alltypes.h.in
@@ -0,0 +1,25 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#if __BIG_ENDIAN__
+#define __BYTE_ORDER 4321
+#else
+#define __BYTE_ORDER 1234
+#endif
+
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+TYPEDEF __WCHAR_TYPE__ wchar_t;
+#else
+TYPEDEF long wchar_t;
+#endif
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/sh/bits/fenv.h b/libc-top-half/musl/arch/sh/bits/fenv.h
new file mode 100644
index 0000000..7f1b8b6
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/fenv.h
@@ -0,0 +1,26 @@
+#ifndef __SH_FPU_ANY__
+
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST 0
+
+#else
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+
+#define FE_INEXACT 0x04
+#define FE_UNDERFLOW 0x08
+#define FE_OVERFLOW 0x10
+#define FE_DIVBYZERO 0x20
+#define FE_INVALID 0x40
+#define FE_ALL_EXCEPT 0x7c
+
+#endif
+
+typedef unsigned long fexcept_t;
+
+typedef struct {
+ unsigned long __cw;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/sh/bits/float.h b/libc-top-half/musl/arch/sh/bits/float.h
new file mode 100644
index 0000000..c4a655e
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/libc-top-half/musl/arch/sh/bits/hwcap.h b/libc-top-half/musl/arch/sh/bits/hwcap.h
new file mode 100644
index 0000000..f85121d
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/hwcap.h
@@ -0,0 +1,11 @@
+#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
+#define CPU_HAS_PTEAEX 0x0200
+#define CPU_HAS_CAS_L 0x0400
diff --git a/libc-top-half/musl/arch/sh/bits/ioctl.h b/libc-top-half/musl/arch/sh/bits/ioctl.h
new file mode 100644
index 0000000..370b690
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/ioctl.h
@@ -0,0 +1,112 @@
+#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define 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, char[8])
+
+#define TCGETA _IOR('t', 23, char[18])
+#define TCSETA _IOW('t', 24, char[18])
+#define TCSETAW _IOW('t', 25, char[18])
+#define TCSETAF _IOW('t', 28, char[18])
+
+#define TCSBRK _IO('t', 29)
+#define TCXONC _IO('t', 30)
+#define TCFLSH _IO('t', 31)
+
+#define TIOCSWINSZ _IOW('t', 103, char[8])
+#define TIOCGWINSZ _IOR('t', 104, char[8])
+#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 TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+
+#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 _IOR('T', 30, char[60])
+#define TIOCSSERIAL _IOW('T', 31, char[60])
+#define TIOCPKT _IOW('T', 32, int)
+
+#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, int)
+#define TCGETS _IO('T', 1)
+#define TCSETS _IO('T', 2)
+#define TCSETSW _IO('T', 3)
+#define TCSETSF _IO('T', 4)
+#define TIOCGRS485 _IOR('T', 46, char[32])
+#define TIOCSRS485 _IOWR('T', 47, char[32])
+#define TIOCGPTN _IOR('T', 48, unsigned int)
+#define TIOCSPTLCK _IOW('T', 49, int)
+#define TIOCGDEV _IOR('T', 50, unsigned int)
+#define TIOCSIG _IOW('T', 54, int)
+#define TIOCVHANGUP _IO('T', 55)
+#define TIOCGPKT _IOR('T', 56, int)
+#define TIOCGPTLCK _IOR('T', 57, int)
+#define TIOCGEXCL _IOR('T', 64, int)
+#define TIOCGPTPEER _IO('T', 0x41)
+
+#define TIOCSERCONFIG _IO('T', 83)
+#define TIOCSERGWILD _IOR('T', 84, int)
+#define TIOCSERSWILD _IOW('T', 85, int)
+#define TIOCGLCKTRMIOS _IO('T', 86)
+#define TIOCSLCKTRMIOS _IO('T', 87)
+#define TIOCSERGSTRUCT _IOR('T', 88, char[216])
+#define TIOCSERGETLSR _IOR('T', 89, unsigned int)
+#define TIOCSERGETMULTI _IOR('T', 90, char[168])
+#define TIOCSERSETMULTI _IOW('T', 91, char[168])
+
+#define TIOCMIWAIT _IO('T', 92)
+#define TIOCGICOUNT _IO('T', 93)
+
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, int)
+#define SIOCGPGRP _IOW('s', 9, int)
+#define SIOCGSTAMP _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
diff --git a/libc-top-half/musl/arch/sh/bits/ipcstat.h b/libc-top-half/musl/arch/sh/bits/ipcstat.h
new file mode 100644
index 0000000..4f4fcb0
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/ipcstat.h
@@ -0,0 +1 @@
+#define IPC_STAT 0x102
diff --git a/libc-top-half/musl/arch/sh/bits/limits.h b/libc-top-half/musl/arch/sh/bits/limits.h
new file mode 100644
index 0000000..07743b6
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/limits.h
@@ -0,0 +1 @@
+#define PAGESIZE 4096
diff --git a/libc-top-half/musl/arch/sh/bits/msg.h b/libc-top-half/musl/arch/sh/bits/msg.h
new file mode 100644
index 0000000..7bbbb2b
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ unsigned long __msg_stime_lo;
+ unsigned long __msg_stime_hi;
+ unsigned long __msg_rtime_lo;
+ unsigned long __msg_rtime_hi;
+ unsigned long __msg_ctime_lo;
+ unsigned long __msg_ctime_hi;
+ unsigned long msg_cbytes;
+ msgqnum_t msg_qnum;
+ msglen_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long __unused[2];
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+};
diff --git a/libc-top-half/musl/arch/sh/bits/posix.h b/libc-top-half/musl/arch/sh/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/sh/bits/ptrace.h b/libc-top-half/musl/arch/sh/bits/ptrace.h
new file mode 100644
index 0000000..4435ca1
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/ptrace.h
@@ -0,0 +1,5 @@
+#define PTRACE_GETFDPIC 31
+#define PTRACE_GETFDPIC_EXEC 0
+#define PTRACE_GETFDPIC_INTERP 1
+#define PTRACE_GETDSPREGS 55
+#define PTRACE_SETDSPREGS 56
diff --git a/libc-top-half/musl/arch/sh/bits/sem.h b/libc-top-half/musl/arch/sh/bits/sem.h
new file mode 100644
index 0000000..544e3d2
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/sem.h
@@ -0,0 +1,18 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ unsigned long __sem_otime_lo;
+ unsigned long __sem_otime_hi;
+ unsigned long __sem_ctime_lo;
+ unsigned long __sem_ctime_hi;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ unsigned short sem_nsems;
+#endif
+ long __unused3;
+ long __unused4;
+ time_t sem_otime;
+ time_t sem_ctime;
+};
diff --git a/libc-top-half/musl/arch/sh/bits/setjmp.h b/libc-top-half/musl/arch/sh/bits/setjmp.h
new file mode 100644
index 0000000..05dbdc7
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[15];
diff --git a/libc-top-half/musl/arch/sh/bits/shm.h b/libc-top-half/musl/arch/sh/bits/shm.h
new file mode 100644
index 0000000..adc01e3
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 16384
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ unsigned long __shm_atime_lo;
+ unsigned long __shm_atime_hi;
+ unsigned long __shm_dtime_lo;
+ unsigned long __shm_dtime_hi;
+ unsigned long __shm_ctime_lo;
+ unsigned long __shm_ctime_hi;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad1;
+ unsigned long __pad2;
+ unsigned long __pad3;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+};
+
+struct shminfo {
+ unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ unsigned long shm_tot, shm_rss, shm_swp;
+ unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/libc-top-half/musl/arch/sh/bits/signal.h b/libc-top-half/musl/arch/sh/bits/signal.h
new file mode 100644
index 0000000..d0b1482
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/signal.h
@@ -0,0 +1,96 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef int greg_t, gregset_t[16];
+typedef int freg_t, fpregset_t[16];
+typedef struct {
+ unsigned long oldmask;
+ unsigned long gregs[16];
+ unsigned long pc, pr, sr;
+ unsigned long gbr, mach, macl;
+ unsigned long fpregs[16];
+ unsigned long xfpregs[16];
+ unsigned int fpscr, fpul, ownedfp;
+} mcontext_t;
+struct sigcontext {
+ unsigned long oldmask;
+ unsigned long sc_regs[16];
+ unsigned long sc_pc, sc_pr, sc_sr;
+ unsigned long sc_gbr, sc_mach, sc_macl;
+ unsigned long sc_fpregs[16];
+ unsigned long sc_xfpregs[16];
+ unsigned int sc_fpscr, sc_fpul, sc_ownedfp;
+};
+#else
+typedef struct {
+ unsigned long __regs[58];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/libc-top-half/musl/arch/sh/bits/stat.h b/libc-top-half/musl/arch/sh/bits/stat.h
new file mode 100644
index 0000000..5d7828c
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ int __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ struct {
+ long tv_sec;
+ long tv_nsec;
+ } __st_atim32, __st_mtim32, __st_ctim32;
+ ino_t st_ino;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
diff --git a/libc-top-half/musl/arch/sh/bits/stdint.h b/libc-top-half/musl/arch/sh/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/sh/bits/syscall.h.in b/libc-top-half/musl/arch/sh/bits/syscall.h.in
new file mode 100644
index 0000000..ff14f54
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/syscall.h.in
@@ -0,0 +1,412 @@
+#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_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_access 33
+#define __NR_nice 34
+#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_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_ioctl 54
+#define __NR_fcntl 55
+#define __NR_setpgid 57
+#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_time32 78
+#define __NR_settimeofday_time32 79
+#define __NR_getgroups 80
+#define __NR_setgroups 81
+#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_statfs 99
+#define __NR_fstatfs 100
+#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_vhangup 111
+#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_cacheflush 123
+#define __NR_adjtimex 124
+#define __NR_mprotect 125
+#define __NR_sigprocmask 126
+#define __NR_init_module 128
+#define __NR_delete_module 129
+#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_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_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_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_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_settime32 260
+#define __NR_timer_gettime32 261
+#define __NR_timer_getoverrun 262
+#define __NR_timer_delete 263
+#define __NR_clock_settime32 264
+#define __NR_clock_gettime32 265
+#define __NR_clock_getres_time32 266
+#define __NR_clock_nanosleep_time32 267
+#define __NR_statfs64 268
+#define __NR_fstatfs64 269
+#define __NR_tgkill 270
+#define __NR_utimes 271
+#define __NR_fadvise64_64 272
+#define __NR_mbind 274
+#define __NR_get_mempolicy 275
+#define __NR_set_mempolicy 276
+#define __NR_mq_open 277
+#define __NR_mq_unlink 278
+#define __NR_mq_timedsend 279
+#define __NR_mq_timedreceive 280
+#define __NR_mq_notify 281
+#define __NR_mq_getsetattr 282
+#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_settime32 325
+#define __NR_timerfd_gettime32 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_preadv 333
+#define __NR_pwritev 334
+#define __NR_rt_tgsigqueueinfo 335
+#define __NR_perf_event_open 336
+#define __NR_fanotify_init 337
+#define __NR_fanotify_mark 338
+#define __NR_prlimit64 339
+#define __NR_socket 340
+#define __NR_bind 341
+#define __NR_connect 342
+#define __NR_listen 343
+#define __NR_accept 344
+#define __NR_getsockname 345
+#define __NR_getpeername 346
+#define __NR_socketpair 347
+#define __NR_send 348
+#define __NR_sendto 349
+#define __NR_recv 350
+#define __NR_recvfrom 351
+#define __NR_shutdown 352
+#define __NR_setsockopt 353
+#define __NR_getsockopt 354
+#define __NR_sendmsg 355
+#define __NR_recvmsg 356
+#define __NR_recvmmsg 357
+#define __NR_accept4 358
+#define __NR_name_to_handle_at 359
+#define __NR_open_by_handle_at 360
+#define __NR_clock_adjtime 361
+#define __NR_syncfs 362
+#define __NR_sendmmsg 363
+#define __NR_setns 364
+#define __NR_process_vm_readv 365
+#define __NR_process_vm_writev 366
+#define __NR_kcmp 367
+#define __NR_finit_module 368
+#define __NR_sched_getattr 369
+#define __NR_sched_setattr 370
+#define __NR_renameat2 371
+#define __NR_seccomp 372
+#define __NR_getrandom 373
+#define __NR_memfd_create 374
+#define __NR_bpf 375
+#define __NR_execveat 376
+#define __NR_userfaultfd 377
+#define __NR_membarrier 378
+#define __NR_mlock2 379
+#define __NR_copy_file_range 380
+#define __NR_preadv2 381
+#define __NR_pwritev2 382
+#define __NR_statx 383
+#define __NR_pkey_mprotect 384
+#define __NR_pkey_alloc 385
+#define __NR_pkey_free 386
+#define __NR_rseq 387
+#define __NR_semget 393
+#define __NR_semctl 394
+#define __NR_shmget 395
+#define __NR_shmctl 396
+#define __NR_shmat 397
+#define __NR_shmdt 398
+#define __NR_msgget 399
+#define __NR_msgsnd 400
+#define __NR_msgrcv 401
+#define __NR_msgctl 402
+#define __NR_clock_gettime64 403
+#define __NR_clock_settime64 404
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64 408
+#define __NR_timer_settime64 409
+#define __NR_timerfd_gettime64 410
+#define __NR_timerfd_settime64 411
+#define __NR_utimensat_time64 412
+#define __NR_pselect6_time64 413
+#define __NR_ppoll_time64 414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64 417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64 420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64 422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/sh/bits/user.h b/libc-top-half/musl/arch/sh/bits/user.h
new file mode 100644
index 0000000..07fe843
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/bits/user.h
@@ -0,0 +1,51 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+
+#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 user_fpu_struct {
+ unsigned long fp_regs[16];
+ unsigned long xfp_regs[16];
+ unsigned long fpscr;
+ unsigned long fpul;
+};
+
+#define ELF_NGREG 23
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+typedef struct user_fpu_struct elf_fpregset_t;
+
+struct user {
+ struct {
+ unsigned long regs[16];
+ unsigned long pc, pr, sr, gbr, mach, macl;
+ long tra;
+ } regs;
+ struct user_fpu_struct fpu;
+ int u_fpvalid;
+ unsigned long u_tsize;
+ unsigned long u_dsize;
+ unsigned long 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];
+};
diff --git a/libc-top-half/musl/arch/sh/crt_arch.h b/libc-top-half/musl/arch/sh/crt_arch.h
new file mode 100644
index 0000000..f341c8f
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/crt_arch.h
@@ -0,0 +1,78 @@
+#ifdef __SH_FDPIC__
+
+__asm__(
+".text \n"
+".global " START " \n"
+START ": \n"
+" tst r8, r8 \n"
+" bf 1f \n"
+" mov #68, r3 \n"
+" add r3, r3 \n"
+" mov #8, r4 \n"
+" swap.w r4, r4 \n"
+" trapa #31 \n"
+" nop \n"
+" nop \n"
+" nop \n"
+" nop \n"
+"1: nop \n"
+#ifndef SHARED
+" mov r8, r4 \n"
+" mova 1f, r0 \n"
+" mov.l 1f, r5 \n"
+" mov.l 1f+4, r6 \n"
+" add r0, r5 \n"
+" mov.l 4f, r1 \n"
+"5: bsrf r1 \n"
+" add r0, r6 \n"
+" mov r0, r12 \n"
+#endif
+" mov r10, r5 \n"
+" mov r15, r4 \n"
+" mov.l r9, @-r15 \n"
+" mov.l r8, @-r15 \n"
+" mov #-16, r0 \n"
+" mov.l 2f, r1 \n"
+"3: bsrf r1 \n"
+" and r0, r15 \n"
+".align 2 \n"
+"1: .long __ROFIXUP_LIST__@PCREL \n"
+" .long __ROFIXUP_END__@PCREL + 4 \n"
+"2: .long " START "_c@PCREL - (3b+4-.) \n"
+#ifndef SHARED
+"4: .long __fdpic_fixup@PCREL - (5b+4-.) \n"
+#endif
+);
+
+#ifndef SHARED
+#include "fdpic_crt.h"
+#endif
+
+#else
+
+__asm__(
+".text \n"
+".global " START " \n"
+START ": \n"
+" mova 1f, r0 \n"
+" mov.l 1f, r5 \n"
+" add r0, r5 \n"
+" mov r15, r4 \n"
+" mov #-16, r0 \n"
+" mov.l 2f, r1 \n"
+"3: bsrf r1 \n"
+" and r0, r15 \n"
+".align 2 \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+"1: .long _DYNAMIC-. \n"
+"2: .long " START "_c@PCREL - (3b+4-.) \n"
+);
+
+#endif
+
+/* used by gcc for switching the FPU between single and double precision */
+#ifdef SHARED
+__attribute__((__visibility__("hidden")))
+#endif
+const unsigned long __fpscr_values[2] = { 0, 0x80000 };
diff --git a/libc-top-half/musl/arch/sh/ksigaction.h b/libc-top-half/musl/arch/sh/ksigaction.h
new file mode 100644
index 0000000..714ae61
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/ksigaction.h
@@ -0,0 +1,10 @@
+#include <features.h>
+
+struct k_sigaction {
+ void (*handler)(int);
+ unsigned long flags;
+ void *restorer;
+ unsigned mask[2];
+};
+
+extern hidden unsigned char __restore[], __restore_rt[];
diff --git a/libc-top-half/musl/arch/sh/kstat.h b/libc-top-half/musl/arch/sh/kstat.h
new file mode 100644
index 0000000..af449c9
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/kstat.h
@@ -0,0 +1,21 @@
+struct kstat {
+ dev_t st_dev;
+ int __st_dev_padding;
+ long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ ino_t st_ino;
+};
diff --git a/libc-top-half/musl/arch/sh/pthread_arch.h b/libc-top-half/musl/arch/sh/pthread_arch.h
new file mode 100644
index 0000000..199c2d5
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/pthread_arch.h
@@ -0,0 +1,16 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ("stc gbr,%0" : "=r" (tp) );
+ return tp;
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 8
+
+#define MC_PC pc
+
+#ifdef __FDPIC__
+#define MC_GOT gregs[12]
+#define CANCEL_GOT (*(uintptr_t *)((char *)__syscall_cp_asm+sizeof(uintptr_t)))
+#endif
diff --git a/libc-top-half/musl/arch/sh/reloc.h b/libc-top-half/musl/arch/sh/reloc.h
new file mode 100644
index 0000000..17b1a9a
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/reloc.h
@@ -0,0 +1,52 @@
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ENDIAN_SUFFIX "eb"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#if __SH_FPU_ANY__ || __SH4__
+#define FP_SUFFIX ""
+#else
+#define FP_SUFFIX "-nofpu"
+#endif
+
+#if __SH_FDPIC__
+#define ABI_SUFFIX "-fdpic"
+#else
+#define ABI_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX ABI_SUFFIX
+
+#define TPOFF_K 0
+
+#define REL_SYMBOLIC R_SH_DIR32
+#define REL_OFFSET R_SH_REL32
+#define REL_GOT R_SH_GLOB_DAT
+#define REL_PLT R_SH_JMP_SLOT
+#define REL_RELATIVE R_SH_RELATIVE
+#define REL_COPY R_SH_COPY
+#define REL_DTPMOD R_SH_TLS_DTPMOD32
+#define REL_DTPOFF R_SH_TLS_DTPOFF32
+#define REL_TPOFF R_SH_TLS_TPOFF32
+
+#define DL_NOMMU_SUPPORT 1
+
+#if __SH_FDPIC__
+#define REL_FUNCDESC R_SH_FUNCDESC
+#define REL_FUNCDESC_VAL R_SH_FUNCDESC_VALUE
+#undef REL_RELATIVE
+#define DL_FDPIC 1
+#define FDPIC_CONSTDISP_FLAG 0x100
+#define CRTJMP(pc,sp) do { \
+ register size_t r8 __asm__("r8") = ((size_t *)(sp))[-2]; \
+ __asm__ __volatile__( "jmp @%0 ; mov %1,r15" \
+ : : "r"(pc), "r"(sp), "r"(r8) : "memory" ); } while(0)
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ "mov.l 1f,%0 ; add %1,%0 ; bra 2f ; nop ; .align 2 \n" \
+ "1: .long " #sym "@GOTOFFFUNCDESC \n2:" \
+ : "=&r"(*fp) : "r"(got) : "memory" )
+#else
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "jmp @%0 ; mov %1,r15" : : "r"(pc), "r"(sp) : "memory" )
+#endif
diff --git a/libc-top-half/musl/arch/sh/syscall_arch.h b/libc-top-half/musl/arch/sh/syscall_arch.h
new file mode 100644
index 0000000..628d8d3
--- /dev/null
+++ b/libc-top-half/musl/arch/sh/syscall_arch.h
@@ -0,0 +1,93 @@
+#define __SYSCALL_LL_E(x) \
+((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
+((union { long long ll; long l[2]; }){ .ll = x }).l[1]
+#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
+#define __SYSCALL_LL_PRW(x) 0, __SYSCALL_LL_E((x))
+
+/* The extra OR instructions are to work around a hardware bug:
+ * http://documentation.renesas.com/doc/products/mpumcu/tu/tnsh7456ae.pdf
+ */
+#define __asm_syscall(trapno, ...) do { \
+ __asm__ __volatile__ ( \
+ "trapa #31\n" \
+ "or r0, r0\n" \
+ "or r0, r0\n" \
+ "or r0, r0\n" \
+ "or r0, r0\n" \
+ "or r0, r0\n" \
+ : "=r"(r0) : __VA_ARGS__ : "memory"); \
+ return r0; \
+ } while (0)
+
+static inline long __syscall0(long n)
+{
+ register long r3 __asm__("r3") = n;
+ register long r0 __asm__("r0");
+ __asm_syscall(16, "r"(r3));
+}
+
+static inline long __syscall1(long n, long a)
+{
+ register long r3 __asm__("r3") = n;
+ register long r4 __asm__("r4") = a;
+ register long r0 __asm__("r0");
+ __asm_syscall(17, "r"(r3), "r"(r4));
+}
+
+static inline long __syscall2(long n, long a, long b)
+{
+ register long r3 __asm__("r3") = n;
+ register long r4 __asm__("r4") = a;
+ register long r5 __asm__("r5") = b;
+ register long r0 __asm__("r0");
+ __asm_syscall(18, "r"(r3), "r"(r4), "r"(r5));
+}
+
+static inline long __syscall3(long n, long a, long b, long c)
+{
+ register long r3 __asm__("r3") = n;
+ register long r4 __asm__("r4") = a;
+ register long r5 __asm__("r5") = b;
+ register long r6 __asm__("r6") = c;
+ register long r0 __asm__("r0");
+ __asm_syscall(19, "r"(r3), "r"(r4), "r"(r5), "r"(r6));
+}
+
+static inline long __syscall4(long n, long a, long b, long c, long d)
+{
+ register long r3 __asm__("r3") = n;
+ register long r4 __asm__("r4") = a;
+ register long r5 __asm__("r5") = b;
+ register long r6 __asm__("r6") = c;
+ register long r7 __asm__("r7") = d;
+ register long r0 __asm__("r0");
+ __asm_syscall(20, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7));
+}
+
+static inline long __syscall5(long n, long a, long b, long c, long d, long e)
+{
+ register long r3 __asm__("r3") = n;
+ register long r4 __asm__("r4") = a;
+ register long r5 __asm__("r5") = b;
+ register long r6 __asm__("r6") = c;
+ register long r7 __asm__("r7") = d;
+ register long r0 __asm__("r0") = e;
+ __asm_syscall(21, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "0"(r0));
+}
+
+static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
+{
+ register long r3 __asm__("r3") = n;
+ register long r4 __asm__("r4") = a;
+ register long r5 __asm__("r5") = b;
+ register long r6 __asm__("r6") = c;
+ register long r7 __asm__("r7") = d;
+ register long r0 __asm__("r0") = e;
+ register long r1 __asm__("r1") = f;
+ __asm_syscall(22, "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "0"(r0), "r"(r1));
+}
+
+#define SYSCALL_IPC_BROKEN_MODE
+
+#define SIOCGSTAMP_OLD (2U<<30 | 's'<<8 | 100 | 8<<16)
+#define SIOCGSTAMPNS_OLD (2U<<30 | 's'<<8 | 101 | 8<<16)
diff --git a/libc-top-half/musl/arch/wasm32/atomic_arch.h b/libc-top-half/musl/arch/wasm32/atomic_arch.h
new file mode 100644
index 0000000..dd9428c
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/atomic_arch.h
@@ -0,0 +1,7 @@
+#define a_barrier() (__sync_synchronize())
+#define a_cas(p, t, s) (__sync_val_compare_and_swap((p), (t), (s)))
+#define a_crash() (__builtin_trap())
+#define a_clz_32 __builtin_clz
+#define a_clz_64 __builtin_clzll
+#define a_ctz_32 __builtin_ctz
+#define a_ctz_64 __builtin_ctzll
diff --git a/libc-top-half/musl/arch/wasm32/bits/alltypes.h.in b/libc-top-half/musl/arch/wasm32/bits/alltypes.h.in
new file mode 100644
index 0000000..5dcfc9a
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/alltypes.h.in
@@ -0,0 +1,58 @@
+#define _Addr long
+#define _Int64 long long
+#define _Reg long long
+
+#define __BYTE_ORDER __BYTE_ORDER__
+
+#define __LONG_MAX __LONG_MAX__
+
+/*
+ * Rather than define everything ourselves here in the musl layer, for
+ * WASI, reference the definitions in the lower layers.
+ */
+
+#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
+#define __need_wchar_t
+#include <stddef.h>
+#define __DEFINED_wchar_t
+#endif
+
+#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
+#define __need_wint_t
+#include <stddef.h>
+#define __DEFINED_wint_t
+#endif
+
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+#define __need_max_align_t
+#include <stddef.h>
+#define __DEFINED_max_align_t
+#endif
+
+#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
+#include <__typedef_time_t.h>
+#define __DEFINED_time_t
+#endif
+
+#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
+#include <__typedef_suseconds_t.h>
+#define __DEFINED_suseconds_t
+#endif
+
+#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
+#include <__typedef_clockid_t.h>
+#define __DEFINED_clockid_t
+#endif
+
+#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
+#include <__typedef_sigset_t.h>
+#define __DEFINED_sigset_t
+#endif
+
+#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
+#include <__typedef_clock_t.h>
+#define __DEFINED_clock_t
+#endif
diff --git a/libc-top-half/musl/arch/wasm32/bits/dirent.h b/libc-top-half/musl/arch/wasm32/bits/dirent.h
new file mode 100644
index 0000000..55f2bc9
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/dirent.h
@@ -0,0 +1 @@
+#include <__struct_dirent.h>
diff --git a/libc-top-half/musl/arch/wasm32/bits/fcntl.h b/libc-top-half/musl/arch/wasm32/bits/fcntl.h
new file mode 100644
index 0000000..a2f3341
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/fcntl.h
@@ -0,0 +1 @@
+/* Use the WASI libc fcntl implementation bits. */
diff --git a/libc-top-half/musl/arch/wasm32/bits/float.h b/libc-top-half/musl/arch/wasm32/bits/float.h
new file mode 100644
index 0000000..719c790
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/libc-top-half/musl/arch/wasm32/bits/ioctl.h b/libc-top-half/musl/arch/wasm32/bits/ioctl.h
new file mode 100644
index 0000000..b4bf7c7
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/ioctl.h
@@ -0,0 +1 @@
+/* Use the WASI libc ioctl implementation bits. */
diff --git a/libc-top-half/musl/arch/wasm32/bits/limits.h b/libc-top-half/musl/arch/wasm32/bits/limits.h
new file mode 100644
index 0000000..801bc48
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/limits.h
@@ -0,0 +1 @@
+#include <__macro_PAGESIZE.h>
diff --git a/libc-top-half/musl/arch/wasm32/bits/posix.h b/libc-top-half/musl/arch/wasm32/bits/posix.h
new file mode 100644
index 0000000..387a3e4
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG (1)
+#define _POSIX_V7_ILP32_OFFBIG (1)
diff --git a/libc-top-half/musl/arch/wasm32/bits/reg.h b/libc-top-half/musl/arch/wasm32/bits/reg.h
new file mode 100644
index 0000000..2633f39
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/libc-top-half/musl/arch/wasm32/bits/signal.h b/libc-top-half/musl/arch/wasm32/bits/signal.h
new file mode 100644
index 0000000..77e8d8c
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/signal.h
@@ -0,0 +1,40 @@
+#ifdef _WASI_EMULATED_SIGNAL
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
+
+#endif
diff --git a/libc-top-half/musl/arch/wasm32/bits/stat.h b/libc-top-half/musl/arch/wasm32/bits/stat.h
new file mode 100644
index 0000000..67a0e72
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/stat.h
@@ -0,0 +1 @@
+#include <__struct_stat.h>
diff --git a/libc-top-half/musl/arch/wasm32/bits/stdint.h b/libc-top-half/musl/arch/wasm32/bits/stdint.h
new file mode 100644
index 0000000..6e7c770
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/wasm32/fp_arch.h b/libc-top-half/musl/arch/wasm32/fp_arch.h
new file mode 100644
index 0000000..707d512
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/fp_arch.h
@@ -0,0 +1,25 @@
+// WebAssembly has no floating-point exceptions or alternate rounding modes,
+// so there's no need to prevent expressions from moving or force their
+// evaluation.
+
+#define fp_barrierf fp_barrierf
+static inline float fp_barrierf(float x)
+{
+ return x;
+}
+
+#define fp_barrier fp_barrier
+static inline double fp_barrier(double x)
+{
+ return x;
+}
+
+#define fp_force_evalf fp_force_evalf
+static inline void fp_force_evalf(float x)
+{
+}
+
+#define fp_force_eval fp_force_eval
+static inline void fp_force_eval(double x)
+{
+}
diff --git a/libc-top-half/musl/arch/wasm32/pthread_arch.h b/libc-top-half/musl/arch/wasm32/pthread_arch.h
new file mode 100644
index 0000000..58e76ab
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/pthread_arch.h
@@ -0,0 +1,5 @@
+extern _Thread_local struct __pthread __wasilibc_pthread_self;
+
+static inline uintptr_t __get_tp() {
+ return (uintptr_t)&__wasilibc_pthread_self;
+}
diff --git a/libc-top-half/musl/arch/wasm32/reloc.h b/libc-top-half/musl/arch/wasm32/reloc.h
new file mode 100644
index 0000000..91b4840
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/reloc.h
@@ -0,0 +1 @@
+#define LDSO_ARCH "wasm32"
diff --git a/libc-top-half/musl/arch/wasm32/syscall_arch.h b/libc-top-half/musl/arch/wasm32/syscall_arch.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libc-top-half/musl/arch/wasm32/syscall_arch.h
diff --git a/libc-top-half/musl/arch/x32/atomic_arch.h b/libc-top-half/musl/arch/x32/atomic_arch.h
new file mode 100644
index 0000000..918c2d4
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/atomic_arch.h
@@ -0,0 +1,121 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__ __volatile__ (
+ "lock ; cmpxchg %3, %1"
+ : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
+ return t;
+}
+
+#define a_swap a_swap
+static inline int a_swap(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "xchg %0, %1"
+ : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
+ return v;
+}
+
+#define a_fetch_add a_fetch_add
+static inline int a_fetch_add(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; xadd %0, %1"
+ : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
+ return v;
+}
+
+#define a_and a_and
+static inline void a_and(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; and %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_or a_or
+static inline void a_or(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; or %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_and_64 a_and_64
+static inline void a_and_64(volatile uint64_t *p, uint64_t v)
+{
+ __asm__ __volatile(
+ "lock ; and %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_or_64 a_or_64
+static inline void a_or_64(volatile uint64_t *p, uint64_t v)
+{
+ __asm__ __volatile__(
+ "lock ; or %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_inc a_inc
+static inline void a_inc(volatile int *p)
+{
+ __asm__ __volatile__(
+ "lock ; incl %0"
+ : "=m"(*p) : "m"(*p) : "memory" );
+}
+
+#define a_dec a_dec
+static inline void a_dec(volatile int *p)
+{
+ __asm__ __volatile__(
+ "lock ; decl %0"
+ : "=m"(*p) : "m"(*p) : "memory" );
+}
+
+#define a_store a_store
+static inline void a_store(volatile int *p, int x)
+{
+ __asm__ __volatile__(
+ "mov %1, %0 ; lock ; orl $0,(%%rsp)"
+ : "=m"(*p) : "r"(x) : "memory" );
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__( "" : : : "memory" );
+}
+
+#define a_spin a_spin
+static inline void a_spin()
+{
+ __asm__ __volatile__( "pause" : : : "memory" );
+}
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__( "hlt" : : : "memory" );
+}
+
+#define a_ctz_64 a_ctz_64
+static inline int a_ctz_64(uint64_t x)
+{
+ __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
+ return x;
+}
+
+#define a_ctz_32 a_ctz_32
+static inline int a_ctz_32(uint32_t x)
+{
+ __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
+ return x;
+}
+
+#define a_clz_64 a_clz_64
+static inline int a_clz_64(uint64_t x)
+{
+ __asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) );
+ return x;
+}
diff --git a/libc-top-half/musl/arch/x32/bits/alltypes.h.in b/libc-top-half/musl/arch/x32/bits/alltypes.h.in
new file mode 100644
index 0000000..9f9d241
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/alltypes.h.in
@@ -0,0 +1,24 @@
+#define _Addr int
+#define _Int64 long long
+#define _Reg long long
+
+#define __BYTE_ORDER 1234
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+TYPEDEF __WCHAR_TYPE__ wchar_t;
+#else
+TYPEDEF long wchar_t;
+#endif
+#endif
+
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
+TYPEDEF long double float_t;
+TYPEDEF long double double_t;
+#else
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+#endif
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/x32/bits/fcntl.h b/libc-top-half/musl/arch/x32/bits/fcntl.h
new file mode 100644
index 0000000..08627f8
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT 0100
+#define O_EXCL 0200
+#define O_NOCTTY 0400
+#define O_TRUNC 01000
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_DSYNC 010000
+#define O_SYNC 04010000
+#define O_RSYNC 04010000
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW 0400000
+#define O_CLOEXEC 02000000
+
+#define O_ASYNC 020000
+#define O_DIRECT 040000
+#define O_LARGEFILE 0100000
+#define O_NOATIME 01000000
+#define O_PATH 010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0
+#define F_GETFD 1
+#define F_SETFD 2
+#define F_GETFL 3
+#define F_SETFL 4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/libc-top-half/musl/arch/x32/bits/fenv.h b/libc-top-half/musl/arch/x32/bits/fenv.h
new file mode 100644
index 0000000..24df041
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/fenv.h
@@ -0,0 +1,34 @@
+#define FE_INVALID 1
+#define __FE_DENORM 2
+#define FE_DIVBYZERO 4
+#define FE_OVERFLOW 8
+#define FE_UNDERFLOW 16
+#define FE_INEXACT 32
+
+#define FE_ALL_EXCEPT 63
+
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 0x400
+#define FE_UPWARD 0x800
+#define FE_TOWARDZERO 0xc00
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+ unsigned short __control_word;
+ unsigned short __unused1;
+ unsigned short __status_word;
+ unsigned short __unused2;
+ unsigned short __tags;
+ unsigned short __unused3;
+ unsigned int __eip;
+ unsigned short __cs_selector;
+ unsigned int __opcode:11;
+ unsigned int __unused4:5;
+ unsigned int __data_offset;
+ unsigned short __data_selector;
+ unsigned short __unused5;
+ unsigned int __mxcsr;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/x32/bits/float.h b/libc-top-half/musl/arch/x32/bits/float.h
new file mode 100644
index 0000000..4d8e786
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 0
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN 3.3621031431120935063e-4932L
+#define LDBL_MAX 1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/libc-top-half/musl/arch/x32/bits/io.h b/libc-top-half/musl/arch/x32/bits/io.h
new file mode 100644
index 0000000..dd5bddc
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/io.h
@@ -0,0 +1,77 @@
+static __inline void outb(unsigned char __val, unsigned short __port)
+{
+ __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outw(unsigned short __val, unsigned short __port)
+{
+ __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outl(unsigned int __val, unsigned short __port)
+{
+ __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline unsigned char inb(unsigned short __port)
+{
+ unsigned char __val;
+ __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned short inw(unsigned short __port)
+{
+ unsigned short __val;
+ __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned int inl(unsigned short __port)
+{
+ unsigned int __val;
+ __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsb"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsw"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsl"
+ : "+S" (__buf), "+c"(__n)
+ : "d" (__port));
+}
+
+static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insb"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insw"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insl"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
diff --git a/libc-top-half/musl/arch/x32/bits/ioctl_fix.h b/libc-top-half/musl/arch/x32/bits/ioctl_fix.h
new file mode 100644
index 0000000..83b957b
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/ioctl_fix.h
@@ -0,0 +1,4 @@
+#undef SIOCGSTAMP
+#undef SIOCGSTAMPNS
+#define SIOCGSTAMP 0x8906
+#define SIOCGSTAMPNS 0x8907
diff --git a/libc-top-half/musl/arch/x32/bits/ipc.h b/libc-top-half/musl/arch/x32/bits/ipc.h
new file mode 100644
index 0000000..a12380f
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/ipc.h
@@ -0,0 +1,11 @@
+struct ipc_perm {
+ key_t __ipc_perm_key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ mode_t mode;
+ int __ipc_perm_seq;
+ long long __pad1;
+ long long __pad2;
+};
diff --git a/libc-top-half/musl/arch/x32/bits/limits.h b/libc-top-half/musl/arch/x32/bits/limits.h
new file mode 100644
index 0000000..07743b6
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/limits.h
@@ -0,0 +1 @@
+#define PAGESIZE 4096
diff --git a/libc-top-half/musl/arch/x32/bits/mman.h b/libc-top-half/musl/arch/x32/bits/mman.h
new file mode 100644
index 0000000..ba2d6f7
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/mman.h
@@ -0,0 +1 @@
+#define MAP_32BIT 0x40
diff --git a/libc-top-half/musl/arch/x32/bits/msg.h b/libc-top-half/musl/arch/x32/bits/msg.h
new file mode 100644
index 0000000..63ae987
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/msg.h
@@ -0,0 +1,15 @@
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ time_t msg_stime;
+ time_t msg_rtime;
+ time_t msg_ctime;
+ unsigned long msg_cbytes;
+ long __unused1;
+ msgqnum_t msg_qnum;
+ long __unused2;
+ msglen_t msg_qbytes;
+ long __unused3;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ unsigned long long __unused[2];
+};
diff --git a/libc-top-half/musl/arch/x32/bits/posix.h b/libc-top-half/musl/arch/x32/bits/posix.h
new file mode 100644
index 0000000..30a3871
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _POSIX_V7_ILP32_OFFBIG 1
diff --git a/libc-top-half/musl/arch/x32/bits/ptrace.h b/libc-top-half/musl/arch/x32/bits/ptrace.h
new file mode 100644
index 0000000..7f8a09b
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/ptrace.h
@@ -0,0 +1,13 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_ARCH_PRCTL 30
+#define PTRACE_SYSEMU 31
+#define PTRACE_SYSEMU_SINGLESTEP 32
+#define PTRACE_SINGLEBLOCK 33
+
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
+#define PT_SYSEMU PTRACE_SYSEMU
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/libc-top-half/musl/arch/x32/bits/reg.h b/libc-top-half/musl/arch/x32/bits/reg.h
new file mode 100644
index 0000000..5faaef1
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/reg.h
@@ -0,0 +1,29 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+#define R15 0
+#define R14 1
+#define R13 2
+#define R12 3
+#define RBP 4
+#define RBX 5
+#define R11 6
+#define R10 7
+#define R9 8
+#define R8 9
+#define RAX 10
+#define RCX 11
+#define RDX 12
+#define RSI 13
+#define RDI 14
+#define ORIG_RAX 15
+#define RIP 16
+#define CS 17
+#define EFLAGS 18
+#define RSP 19
+#define SS 20
+#define FS_BASE 21
+#define GS_BASE 22
+#define DS 23
+#define ES 24
+#define FS 25
+#define GS 26
diff --git a/libc-top-half/musl/arch/x32/bits/sem.h b/libc-top-half/musl/arch/x32/bits/sem.h
new file mode 100644
index 0000000..18745f4
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/sem.h
@@ -0,0 +1,11 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ time_t sem_otime;
+ long long __unused1;
+ time_t sem_ctime;
+ long long __unused2;
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long long)-sizeof(short)];
+ long long __unused3;
+ long long __unused4;
+};
diff --git a/libc-top-half/musl/arch/x32/bits/setjmp.h b/libc-top-half/musl/arch/x32/bits/setjmp.h
new file mode 100644
index 0000000..a9262a6
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long long __jmp_buf[8];
diff --git a/libc-top-half/musl/arch/x32/bits/shm.h b/libc-top-half/musl/arch/x32/bits/shm.h
new file mode 100644
index 0000000..fa88c1e
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/shm.h
@@ -0,0 +1,32 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+ struct ipc_perm shm_perm;
+ size_t shm_segsz;
+ time_t shm_atime;
+ time_t shm_dtime;
+ time_t shm_ctime;
+ pid_t shm_cpid;
+ pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __pad0;
+ unsigned long long __pad1;
+ unsigned long long __pad2;
+};
+
+struct shminfo {
+ unsigned long shmmax, __pad0, shmmin, __pad1, shmmni, __pad2,
+ shmseg, __pad3, shmall, __pad4;
+ unsigned long long __unused[4];
+};
+
+struct shm_info {
+ int __used_ids;
+ int __pad_ids;
+ unsigned long shm_tot, __pad0, shm_rss, __pad1, shm_swp, __pad2;
+ unsigned long __swap_attempts, __pad3, __swap_successes, __pad4;
+}
+#ifdef __GNUC__
+__attribute__((__aligned__(8)))
+#endif
+;
diff --git a/libc-top-half/musl/arch/x32/bits/signal.h b/libc-top-half/musl/arch/x32/bits/signal.h
new file mode 100644
index 0000000..097be6f
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/signal.h
@@ -0,0 +1,153 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#ifdef _GNU_SOURCE
+enum { REG_R8 = 0 };
+#define REG_R8 REG_R8
+enum { REG_R9 = 1 };
+#define REG_R9 REG_R9
+enum { REG_R10 = 2 };
+#define REG_R10 REG_R10
+enum { REG_R11 = 3 };
+#define REG_R11 REG_R11
+enum { REG_R12 = 4 };
+#define REG_R12 REG_R12
+enum { REG_R13 = 5 };
+#define REG_R13 REG_R13
+enum { REG_R14 = 6 };
+#define REG_R14 REG_R14
+enum { REG_R15 = 7 };
+#define REG_R15 REG_R15
+enum { REG_RDI = 8 };
+#define REG_RDI REG_RDI
+enum { REG_RSI = 9 };
+#define REG_RSI REG_RSI
+enum { REG_RBP = 10 };
+#define REG_RBP REG_RBP
+enum { REG_RBX = 11 };
+#define REG_RBX REG_RBX
+enum { REG_RDX = 12 };
+#define REG_RDX REG_RDX
+enum { REG_RAX = 13 };
+#define REG_RAX REG_RAX
+enum { REG_RCX = 14 };
+#define REG_RCX REG_RCX
+enum { REG_RSP = 15 };
+#define REG_RSP REG_RSP
+enum { REG_RIP = 16 };
+#define REG_RIP REG_RIP
+enum { REG_EFL = 17 };
+#define REG_EFL REG_EFL
+enum { REG_CSGSFS = 18 };
+#define REG_CSGSFS REG_CSGSFS
+enum { REG_ERR = 19 };
+#define REG_ERR REG_ERR
+enum { REG_TRAPNO = 20 };
+#define REG_TRAPNO REG_TRAPNO
+enum { REG_OLDMASK = 21 };
+#define REG_OLDMASK REG_OLDMASK
+enum { REG_CR2 = 22 };
+#define REG_CR2 REG_CR2
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef long long greg_t, gregset_t[23];
+typedef struct _fpstate {
+ unsigned short cwd, swd, ftw, fop;
+ unsigned long long rip, rdp;
+ unsigned mxcsr, mxcr_mask;
+ struct {
+ unsigned short significand[4], exponent, padding[3];
+ } _st[8];
+ struct {
+ unsigned element[4];
+ } _xmm[16];
+ unsigned padding[24];
+} *fpregset_t;
+struct sigcontext {
+ unsigned long long r8, r9, r10, r11, r12, r13, r14, r15;
+ unsigned long long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
+ unsigned short cs, gs, fs, __pad0;
+ unsigned long long err, trapno, oldmask, cr2;
+ struct _fpstate *fpstate;
+ unsigned long long __reserved1[8];
+};
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ unsigned long long __reserved1[8];
+} mcontext_t;
+#else
+typedef struct {
+ unsigned long long __space[32];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ unsigned long long __fpregs_mem[64];
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
+
diff --git a/libc-top-half/musl/arch/x32/bits/socket.h b/libc-top-half/musl/arch/x32/bits/socket.h
new file mode 100644
index 0000000..8d83001
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/socket.h
@@ -0,0 +1,5 @@
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
+#define SO_TIMESTAMP 29
+#define SO_TIMESTAMPNS 35
+#define SO_TIMESTAMPING 37
diff --git a/libc-top-half/musl/arch/x32/bits/stat.h b/libc-top-half/musl/arch/x32/bits/stat.h
new file mode 100644
index 0000000..1f3aa1e
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/stat.h
@@ -0,0 +1,22 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned int __pad0;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ long long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/x32/bits/statfs.h b/libc-top-half/musl/arch/x32/bits/statfs.h
new file mode 100644
index 0000000..79aec35
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/statfs.h
@@ -0,0 +1,9 @@
+struct statfs {
+ unsigned long f_type, __pad0, f_bsize, __pad1;
+ fsblkcnt_t f_blocks, f_bfree, f_bavail;
+ fsfilcnt_t f_files, f_ffree;
+ fsid_t f_fsid;
+ unsigned long f_namelen, __pad2, f_frsize, __pad3;
+ unsigned long f_flags, __pad4;
+ unsigned long long f_spare[4];
+};
diff --git a/libc-top-half/musl/arch/x32/bits/stdint.h b/libc-top-half/musl/arch/x32/bits/stdint.h
new file mode 100644
index 0000000..d1b2712
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#define SIZE_MAX UINT32_MAX
diff --git a/libc-top-half/musl/arch/x32/bits/syscall.h.in b/libc-top-half/musl/arch/x32/bits/syscall.h.in
new file mode 100644
index 0000000..5d22fa1
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/syscall.h.in
@@ -0,0 +1,349 @@
+#define __NR_read (0x40000000 + 0)
+#define __NR_write (0x40000000 + 1)
+#define __NR_open (0x40000000 + 2)
+#define __NR_close (0x40000000 + 3)
+#define __NR_stat (0x40000000 + 4)
+#define __NR_fstat (0x40000000 + 5)
+#define __NR_lstat (0x40000000 + 6)
+#define __NR_poll (0x40000000 + 7)
+#define __NR_lseek (0x40000000 + 8)
+#define __NR_mmap (0x40000000 + 9)
+#define __NR_mprotect (0x40000000 + 10)
+#define __NR_munmap (0x40000000 + 11)
+#define __NR_brk (0x40000000 + 12)
+#define __NR_rt_sigprocmask (0x40000000 + 14)
+#define __NR_pread64 (0x40000000 + 17)
+#define __NR_pwrite64 (0x40000000 + 18)
+#define __NR_access (0x40000000 + 21)
+#define __NR_pipe (0x40000000 + 22)
+#define __NR_select (0x40000000 + 23)
+#define __NR_sched_yield (0x40000000 + 24)
+#define __NR_mremap (0x40000000 + 25)
+#define __NR_msync (0x40000000 + 26)
+#define __NR_mincore (0x40000000 + 27)
+#define __NR_madvise (0x40000000 + 28)
+#define __NR_shmget (0x40000000 + 29)
+#define __NR_shmat (0x40000000 + 30)
+#define __NR_shmctl (0x40000000 + 31)
+#define __NR_dup (0x40000000 + 32)
+#define __NR_dup2 (0x40000000 + 33)
+#define __NR_pause (0x40000000 + 34)
+#define __NR_nanosleep (0x40000000 + 35)
+#define __NR_getitimer (0x40000000 + 36)
+#define __NR_alarm (0x40000000 + 37)
+#define __NR_setitimer (0x40000000 + 38)
+#define __NR_getpid (0x40000000 + 39)
+#define __NR_sendfile (0x40000000 + 40)
+#define __NR_socket (0x40000000 + 41)
+#define __NR_connect (0x40000000 + 42)
+#define __NR_accept (0x40000000 + 43)
+#define __NR_sendto (0x40000000 + 44)
+#define __NR_shutdown (0x40000000 + 48)
+#define __NR_bind (0x40000000 + 49)
+#define __NR_listen (0x40000000 + 50)
+#define __NR_getsockname (0x40000000 + 51)
+#define __NR_getpeername (0x40000000 + 52)
+#define __NR_socketpair (0x40000000 + 53)
+#define __NR_clone (0x40000000 + 56)
+#define __NR_fork (0x40000000 + 57)
+#define __NR_vfork (0x40000000 + 58)
+#define __NR_exit (0x40000000 + 60)
+#define __NR_wait4 (0x40000000 + 61)
+#define __NR_kill (0x40000000 + 62)
+#define __NR_uname (0x40000000 + 63)
+#define __NR_semget (0x40000000 + 64)
+#define __NR_semop (0x40000000 + 65)
+#define __NR_semctl (0x40000000 + 66)
+#define __NR_shmdt (0x40000000 + 67)
+#define __NR_msgget (0x40000000 + 68)
+#define __NR_msgsnd (0x40000000 + 69)
+#define __NR_msgrcv (0x40000000 + 70)
+#define __NR_msgctl (0x40000000 + 71)
+#define __NR_fcntl (0x40000000 + 72)
+#define __NR_flock (0x40000000 + 73)
+#define __NR_fsync (0x40000000 + 74)
+#define __NR_fdatasync (0x40000000 + 75)
+#define __NR_truncate (0x40000000 + 76)
+#define __NR_ftruncate (0x40000000 + 77)
+#define __NR_getdents (0x40000000 + 78)
+#define __NR_getcwd (0x40000000 + 79)
+#define __NR_chdir (0x40000000 + 80)
+#define __NR_fchdir (0x40000000 + 81)
+#define __NR_rename (0x40000000 + 82)
+#define __NR_mkdir (0x40000000 + 83)
+#define __NR_rmdir (0x40000000 + 84)
+#define __NR_creat (0x40000000 + 85)
+#define __NR_link (0x40000000 + 86)
+#define __NR_unlink (0x40000000 + 87)
+#define __NR_symlink (0x40000000 + 88)
+#define __NR_readlink (0x40000000 + 89)
+#define __NR_chmod (0x40000000 + 90)
+#define __NR_fchmod (0x40000000 + 91)
+#define __NR_chown (0x40000000 + 92)
+#define __NR_fchown (0x40000000 + 93)
+#define __NR_lchown (0x40000000 + 94)
+#define __NR_umask (0x40000000 + 95)
+#define __NR_gettimeofday (0x40000000 + 96)
+#define __NR_getrlimit (0x40000000 + 97)
+#define __NR_getrusage (0x40000000 + 98)
+#define __NR_sysinfo (0x40000000 + 99)
+#define __NR_times (0x40000000 + 100)
+#define __NR_getuid (0x40000000 + 102)
+#define __NR_syslog (0x40000000 + 103)
+#define __NR_getgid (0x40000000 + 104)
+#define __NR_setuid (0x40000000 + 105)
+#define __NR_setgid (0x40000000 + 106)
+#define __NR_geteuid (0x40000000 + 107)
+#define __NR_getegid (0x40000000 + 108)
+#define __NR_setpgid (0x40000000 + 109)
+#define __NR_getppid (0x40000000 + 110)
+#define __NR_getpgrp (0x40000000 + 111)
+#define __NR_setsid (0x40000000 + 112)
+#define __NR_setreuid (0x40000000 + 113)
+#define __NR_setregid (0x40000000 + 114)
+#define __NR_getgroups (0x40000000 + 115)
+#define __NR_setgroups (0x40000000 + 116)
+#define __NR_setresuid (0x40000000 + 117)
+#define __NR_getresuid (0x40000000 + 118)
+#define __NR_setresgid (0x40000000 + 119)
+#define __NR_getresgid (0x40000000 + 120)
+#define __NR_getpgid (0x40000000 + 121)
+#define __NR_setfsuid (0x40000000 + 122)
+#define __NR_setfsgid (0x40000000 + 123)
+#define __NR_getsid (0x40000000 + 124)
+#define __NR_capget (0x40000000 + 125)
+#define __NR_capset (0x40000000 + 126)
+#define __NR_rt_sigsuspend (0x40000000 + 130)
+#define __NR_utime (0x40000000 + 132)
+#define __NR_mknod (0x40000000 + 133)
+#define __NR_personality (0x40000000 + 135)
+#define __NR_ustat (0x40000000 + 136)
+#define __NR_statfs (0x40000000 + 137)
+#define __NR_fstatfs (0x40000000 + 138)
+#define __NR_sysfs (0x40000000 + 139)
+#define __NR_getpriority (0x40000000 + 140)
+#define __NR_setpriority (0x40000000 + 141)
+#define __NR_sched_setparam (0x40000000 + 142)
+#define __NR_sched_getparam (0x40000000 + 143)
+#define __NR_sched_setscheduler (0x40000000 + 144)
+#define __NR_sched_getscheduler (0x40000000 + 145)
+#define __NR_sched_get_priority_max (0x40000000 + 146)
+#define __NR_sched_get_priority_min (0x40000000 + 147)
+#define __NR_sched_rr_get_interval (0x40000000 + 148)
+#define __NR_mlock (0x40000000 + 149)
+#define __NR_munlock (0x40000000 + 150)
+#define __NR_mlockall (0x40000000 + 151)
+#define __NR_munlockall (0x40000000 + 152)
+#define __NR_vhangup (0x40000000 + 153)
+#define __NR_modify_ldt (0x40000000 + 154)
+#define __NR_pivot_root (0x40000000 + 155)
+#define __NR_prctl (0x40000000 + 157)
+#define __NR_arch_prctl (0x40000000 + 158)
+#define __NR_adjtimex (0x40000000 + 159)
+#define __NR_setrlimit (0x40000000 + 160)
+#define __NR_chroot (0x40000000 + 161)
+#define __NR_sync (0x40000000 + 162)
+#define __NR_acct (0x40000000 + 163)
+#define __NR_settimeofday (0x40000000 + 164)
+#define __NR_mount (0x40000000 + 165)
+#define __NR_umount2 (0x40000000 + 166)
+#define __NR_swapon (0x40000000 + 167)
+#define __NR_swapoff (0x40000000 + 168)
+#define __NR_reboot (0x40000000 + 169)
+#define __NR_sethostname (0x40000000 + 170)
+#define __NR_setdomainname (0x40000000 + 171)
+#define __NR_iopl (0x40000000 + 172)
+#define __NR_ioperm (0x40000000 + 173)
+#define __NR_init_module (0x40000000 + 175)
+#define __NR_delete_module (0x40000000 + 176)
+#define __NR_quotactl (0x40000000 + 179)
+#define __NR_getpmsg (0x40000000 + 181)
+#define __NR_putpmsg (0x40000000 + 182)
+#define __NR_afs_syscall (0x40000000 + 183)
+#define __NR_tuxcall (0x40000000 + 184)
+#define __NR_security (0x40000000 + 185)
+#define __NR_gettid (0x40000000 + 186)
+#define __NR_readahead (0x40000000 + 187)
+#define __NR_setxattr (0x40000000 + 188)
+#define __NR_lsetxattr (0x40000000 + 189)
+#define __NR_fsetxattr (0x40000000 + 190)
+#define __NR_getxattr (0x40000000 + 191)
+#define __NR_lgetxattr (0x40000000 + 192)
+#define __NR_fgetxattr (0x40000000 + 193)
+#define __NR_listxattr (0x40000000 + 194)
+#define __NR_llistxattr (0x40000000 + 195)
+#define __NR_flistxattr (0x40000000 + 196)
+#define __NR_removexattr (0x40000000 + 197)
+#define __NR_lremovexattr (0x40000000 + 198)
+#define __NR_fremovexattr (0x40000000 + 199)
+#define __NR_tkill (0x40000000 + 200)
+#define __NR_time (0x40000000 + 201)
+#define __NR_futex (0x40000000 + 202)
+#define __NR_sched_setaffinity (0x40000000 + 203)
+#define __NR_sched_getaffinity (0x40000000 + 204)
+#define __NR_io_destroy (0x40000000 + 207)
+#define __NR_io_getevents (0x40000000 + 208)
+#define __NR_io_cancel (0x40000000 + 210)
+#define __NR_lookup_dcookie (0x40000000 + 212)
+#define __NR_epoll_create (0x40000000 + 213)
+#define __NR_remap_file_pages (0x40000000 + 216)
+#define __NR_getdents64 (0x40000000 + 217)
+#define __NR_set_tid_address (0x40000000 + 218)
+#define __NR_restart_syscall (0x40000000 + 219)
+#define __NR_semtimedop (0x40000000 + 220)
+#define __NR_fadvise64 (0x40000000 + 221)
+#define __NR_timer_settime (0x40000000 + 223)
+#define __NR_timer_gettime (0x40000000 + 224)
+#define __NR_timer_getoverrun (0x40000000 + 225)
+#define __NR_timer_delete (0x40000000 + 226)
+#define __NR_clock_settime (0x40000000 + 227)
+#define __NR_clock_gettime (0x40000000 + 228)
+#define __NR_clock_getres (0x40000000 + 229)
+#define __NR_clock_nanosleep (0x40000000 + 230)
+#define __NR_exit_group (0x40000000 + 231)
+#define __NR_epoll_wait (0x40000000 + 232)
+#define __NR_epoll_ctl (0x40000000 + 233)
+#define __NR_tgkill (0x40000000 + 234)
+#define __NR_utimes (0x40000000 + 235)
+#define __NR_mbind (0x40000000 + 237)
+#define __NR_set_mempolicy (0x40000000 + 238)
+#define __NR_get_mempolicy (0x40000000 + 239)
+#define __NR_mq_open (0x40000000 + 240)
+#define __NR_mq_unlink (0x40000000 + 241)
+#define __NR_mq_timedsend (0x40000000 + 242)
+#define __NR_mq_timedreceive (0x40000000 + 243)
+#define __NR_mq_getsetattr (0x40000000 + 245)
+#define __NR_add_key (0x40000000 + 248)
+#define __NR_request_key (0x40000000 + 249)
+#define __NR_keyctl (0x40000000 + 250)
+#define __NR_ioprio_set (0x40000000 + 251)
+#define __NR_ioprio_get (0x40000000 + 252)
+#define __NR_inotify_init (0x40000000 + 253)
+#define __NR_inotify_add_watch (0x40000000 + 254)
+#define __NR_inotify_rm_watch (0x40000000 + 255)
+#define __NR_migrate_pages (0x40000000 + 256)
+#define __NR_openat (0x40000000 + 257)
+#define __NR_mkdirat (0x40000000 + 258)
+#define __NR_mknodat (0x40000000 + 259)
+#define __NR_fchownat (0x40000000 + 260)
+#define __NR_futimesat (0x40000000 + 261)
+#define __NR_newfstatat (0x40000000 + 262)
+#define __NR_unlinkat (0x40000000 + 263)
+#define __NR_renameat (0x40000000 + 264)
+#define __NR_linkat (0x40000000 + 265)
+#define __NR_symlinkat (0x40000000 + 266)
+#define __NR_readlinkat (0x40000000 + 267)
+#define __NR_fchmodat (0x40000000 + 268)
+#define __NR_faccessat (0x40000000 + 269)
+#define __NR_pselect6 (0x40000000 + 270)
+#define __NR_ppoll (0x40000000 + 271)
+#define __NR_unshare (0x40000000 + 272)
+#define __NR_splice (0x40000000 + 275)
+#define __NR_tee (0x40000000 + 276)
+#define __NR_sync_file_range (0x40000000 + 277)
+#define __NR_utimensat (0x40000000 + 280)
+#define __NR_epoll_pwait (0x40000000 + 281)
+#define __NR_signalfd (0x40000000 + 282)
+#define __NR_timerfd_create (0x40000000 + 283)
+#define __NR_eventfd (0x40000000 + 284)
+#define __NR_fallocate (0x40000000 + 285)
+#define __NR_timerfd_settime (0x40000000 + 286)
+#define __NR_timerfd_gettime (0x40000000 + 287)
+#define __NR_accept4 (0x40000000 + 288)
+#define __NR_signalfd4 (0x40000000 + 289)
+#define __NR_eventfd2 (0x40000000 + 290)
+#define __NR_epoll_create1 (0x40000000 + 291)
+#define __NR_dup3 (0x40000000 + 292)
+#define __NR_pipe2 (0x40000000 + 293)
+#define __NR_inotify_init1 (0x40000000 + 294)
+#define __NR_perf_event_open (0x40000000 + 298)
+#define __NR_fanotify_init (0x40000000 + 300)
+#define __NR_fanotify_mark (0x40000000 + 301)
+#define __NR_prlimit64 (0x40000000 + 302)
+#define __NR_name_to_handle_at (0x40000000 + 303)
+#define __NR_open_by_handle_at (0x40000000 + 304)
+#define __NR_clock_adjtime (0x40000000 + 305)
+#define __NR_syncfs (0x40000000 + 306)
+#define __NR_setns (0x40000000 + 308)
+#define __NR_getcpu (0x40000000 + 309)
+#define __NR_kcmp (0x40000000 + 312)
+#define __NR_finit_module (0x40000000 + 313)
+#define __NR_sched_setattr (0x40000000 + 314)
+#define __NR_sched_getattr (0x40000000 + 315)
+#define __NR_renameat2 (0x40000000 + 316)
+#define __NR_seccomp (0x40000000 + 317)
+#define __NR_getrandom (0x40000000 + 318)
+#define __NR_memfd_create (0x40000000 + 319)
+#define __NR_kexec_file_load (0x40000000 + 320)
+#define __NR_bpf (0x40000000 + 321)
+#define __NR_userfaultfd (0x40000000 + 323)
+#define __NR_membarrier (0x40000000 + 324)
+#define __NR_mlock2 (0x40000000 + 325)
+#define __NR_copy_file_range (0x40000000 + 326)
+#define __NR_pkey_mprotect (0x40000000 + 329)
+#define __NR_pkey_alloc (0x40000000 + 330)
+#define __NR_pkey_free (0x40000000 + 331)
+#define __NR_statx (0x40000000 + 332)
+#define __NR_io_pgetevents (0x40000000 + 333)
+#define __NR_rseq (0x40000000 + 334)
+#define __NR_pidfd_send_signal (0x40000000 + 424)
+#define __NR_io_uring_setup (0x40000000 + 425)
+#define __NR_io_uring_enter (0x40000000 + 426)
+#define __NR_io_uring_register (0x40000000 + 427)
+#define __NR_open_tree (0x40000000 + 428)
+#define __NR_move_mount (0x40000000 + 429)
+#define __NR_fsopen (0x40000000 + 430)
+#define __NR_fsconfig (0x40000000 + 431)
+#define __NR_fsmount (0x40000000 + 432)
+#define __NR_fspick (0x40000000 + 433)
+#define __NR_pidfd_open (0x40000000 + 434)
+#define __NR_clone3 (0x40000000 + 435)
+#define __NR_close_range (0x40000000 + 436)
+#define __NR_openat2 (0x40000000 + 437)
+#define __NR_pidfd_getfd (0x40000000 + 438)
+#define __NR_faccessat2 (0x40000000 + 439)
+#define __NR_process_madvise (0x40000000 + 440)
+#define __NR_epoll_pwait2 (0x40000000 + 441)
+#define __NR_mount_setattr (0x40000000 + 442)
+#define __NR_landlock_create_ruleset (0x40000000 + 444)
+#define __NR_landlock_add_rule (0x40000000 + 445)
+#define __NR_landlock_restrict_self (0x40000000 + 446)
+
+
+#define __NR_rt_sigaction (0x40000000 + 512)
+#define __NR_rt_sigreturn (0x40000000 + 513)
+#define __NR_ioctl (0x40000000 + 514)
+#define __NR_readv (0x40000000 + 515)
+#define __NR_writev (0x40000000 + 516)
+#define __NR_recvfrom (0x40000000 + 517)
+#define __NR_sendmsg (0x40000000 + 518)
+#define __NR_recvmsg (0x40000000 + 519)
+#define __NR_execve (0x40000000 + 520)
+#define __NR_ptrace (0x40000000 + 521)
+#define __NR_rt_sigpending (0x40000000 + 522)
+#define __NR_rt_sigtimedwait (0x40000000 + 523)
+#define __NR_rt_sigqueueinfo (0x40000000 + 524)
+#define __NR_sigaltstack (0x40000000 + 525)
+#define __NR_timer_create (0x40000000 + 526)
+#define __NR_mq_notify (0x40000000 + 527)
+#define __NR_kexec_load (0x40000000 + 528)
+#define __NR_waitid (0x40000000 + 529)
+#define __NR_set_robust_list (0x40000000 + 530)
+#define __NR_get_robust_list (0x40000000 + 531)
+#define __NR_vmsplice (0x40000000 + 532)
+#define __NR_move_pages (0x40000000 + 533)
+#define __NR_preadv (0x40000000 + 534)
+#define __NR_pwritev (0x40000000 + 535)
+#define __NR_rt_tgsigqueueinfo (0x40000000 + 536)
+#define __NR_recvmmsg (0x40000000 + 537)
+#define __NR_sendmmsg (0x40000000 + 538)
+#define __NR_process_vm_readv (0x40000000 + 539)
+#define __NR_process_vm_writev (0x40000000 + 540)
+#define __NR_setsockopt (0x40000000 + 541)
+#define __NR_getsockopt (0x40000000 + 542)
+#define __NR_io_setup (0x40000000 + 543)
+#define __NR_io_submit (0x40000000 + 544)
+#define __NR_execveat (0x40000000 + 545)
+#define __NR_preadv2 (0x40000000 + 546)
+#define __NR_pwritev2 (0x40000000 + 547)
+
diff --git a/libc-top-half/musl/arch/x32/bits/user.h b/libc-top-half/musl/arch/x32/bits/user.h
new file mode 100644
index 0000000..eac82a1
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/bits/user.h
@@ -0,0 +1,41 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+
+typedef struct user_fpregs_struct {
+ uint16_t cwd, swd, ftw, fop;
+ uint64_t rip, rdp;
+ uint32_t mxcsr, mxcr_mask;
+ uint32_t st_space[32], xmm_space[64], padding[24];
+} elf_fpregset_t;
+
+struct user_regs_struct {
+ unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
+ unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
+ unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
+};
+#define ELF_NGREG 27
+typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+ struct user_regs_struct regs;
+ int u_fpvalid;
+ struct user_fpregs_struct i387;
+ unsigned long u_tsize;
+ unsigned long u_dsize;
+ unsigned long u_ssize;
+ unsigned long start_code;
+ unsigned long start_stack;
+ long signal;
+ int reserved;
+ struct user_regs_struct *u_ar0;
+ struct user_fpregs_struct *u_fpstate;
+ unsigned long magic;
+ char u_comm[32];
+ unsigned long u_debugreg[8];
+};
+
+#define PAGE_MASK (~(PAGESIZE-1))
+#define NBPG PAGESIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
diff --git a/libc-top-half/musl/arch/x32/crt_arch.h b/libc-top-half/musl/arch/x32/crt_arch.h
new file mode 100644
index 0000000..3eec61b
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/crt_arch.h
@@ -0,0 +1,12 @@
+__asm__(
+".text \n"
+".global " START " \n"
+START ": \n"
+" xor %rbp,%rbp \n"
+" mov %rsp,%rdi \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" lea _DYNAMIC(%rip),%rsi \n"
+" andq $-16,%rsp \n"
+" call " START "_c \n"
+);
diff --git a/libc-top-half/musl/arch/x32/ksigaction.h b/libc-top-half/musl/arch/x32/ksigaction.h
new file mode 100644
index 0000000..c40e356
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/ksigaction.h
@@ -0,0 +1,11 @@
+#include <features.h>
+
+struct k_sigaction {
+ void (*handler)(int);
+ unsigned long flags;
+ void (*restorer)(void);
+ unsigned mask[2];
+};
+
+hidden void __restore_rt();
+#define __restore __restore_rt
diff --git a/libc-top-half/musl/arch/x32/kstat.h b/libc-top-half/musl/arch/x32/kstat.h
new file mode 100644
index 0000000..ce25fce
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/kstat.h
@@ -0,0 +1,22 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned int __pad0;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ long long st_atime_sec;
+ long st_atime_nsec;
+ long long st_mtime_sec;
+ long st_mtime_nsec;
+ long long st_ctime_sec;
+ long st_ctime_nsec;
+ long long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/x32/pthread_arch.h b/libc-top-half/musl/arch/x32/pthread_arch.h
new file mode 100644
index 0000000..c1e7716
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/pthread_arch.h
@@ -0,0 +1,12 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ("mov %%fs:0,%0" : "=r" (tp) );
+ return tp;
+}
+
+#define MC_PC gregs[REG_RIP]
+
+#define CANARY_PAD
+
+#define tls_mod_off_t unsigned long long
diff --git a/libc-top-half/musl/arch/x32/reloc.h b/libc-top-half/musl/arch/x32/reloc.h
new file mode 100644
index 0000000..dc039ad
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/reloc.h
@@ -0,0 +1,31 @@
+#define LDSO_ARCH "x32"
+
+/* FIXME: x32 is very strange in its use of 64-bit relocation types in
+ * a 32-bit environment. As long as the memory at reloc_addr is
+ * zero-filled prior to relocations, just treating 64-bit relocations
+ * as operating on 32-bit slots should be fine, but this should be
+ * checked. In particular, R_X86_64_64, R_X86_64_DTPOFF64, and
+ * R_X86_64_TPOFF64 may need checking. */
+
+/* The R_X86_64_64, R_X86_64_DTPOFF32, and R_X86_64_TPOFF32 reloc types
+ * were previously mapped in the switch table form of this file; however,
+ * they do not seem to be used/usable for anything. If needed, new
+ * mappings will have to be added. */
+
+#define REL_SYMBOLIC R_X86_64_32
+#define REL_OFFSET R_X86_64_PC32
+#define REL_GOT R_X86_64_GLOB_DAT
+#define REL_PLT R_X86_64_JUMP_SLOT
+#define REL_RELATIVE R_X86_64_RELATIVE
+#define REL_COPY R_X86_64_COPY
+#define REL_DTPMOD R_X86_64_DTPMOD64
+#define REL_DTPOFF R_X86_64_DTPOFF64
+#define REL_TPOFF R_X86_64_TPOFF64
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov %1,%%esp ; jmp *%0" : : "r"((uint64_t)(uintptr_t)pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ " lea " #sym "(%%rip),%0\n" \
+ : "=r"(*fp) : : "memory" )
diff --git a/libc-top-half/musl/arch/x32/syscall_arch.h b/libc-top-half/musl/arch/x32/syscall_arch.h
new file mode 100644
index 0000000..e0111cc
--- /dev/null
+++ b/libc-top-half/musl/arch/x32/syscall_arch.h
@@ -0,0 +1,93 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+#define __scc(X) sizeof(1?(X):0ULL) < 8 ? (unsigned long) (X) : (long long) (X)
+typedef long long syscall_arg_t;
+
+static __inline long __syscall0(long long n)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall1(long long n, long long a1)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall2(long long n, long long a1, long long a2)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
+ : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall3(long long n, long long a1, long long a2, long long a3)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall4(long long n, long long a1, long long a2, long long a3,
+ long long a4_)
+{
+ unsigned long ret;
+ register long long a4 __asm__("r10") = a4_;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3), "r"(a4): "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall5(long long n, long long a1, long long a2, long long a3,
+ long long a4_, long long a5_)
+{
+ unsigned long ret;
+ register long long a4 __asm__("r10") = a4_;
+ register long long a5 __asm__("r8") = a5_;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3), "r"(a4), "r"(a5) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall6(long long n, long long a1, long long a2, long long a3,
+ long long a4_, long long a5_, long long a6_)
+{
+ unsigned long ret;
+ register long long a4 __asm__("r10") = a4_;
+ register long long a5 __asm__("r8") = a5_;
+ register long long a6 __asm__("r9") = a6_;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3), "r"(a4), "r"(a5), "r"(a6) : "rcx", "r11", "memory");
+ return ret;
+}
+
+#undef SYS_futimesat
+
+#define SYS_clock_gettime64 SYS_clock_gettime
+#define SYS_clock_settime64 SYS_clock_settime
+#define SYS_clock_adjtime64 SYS_clock_adjtime
+#define SYS_clock_nanosleep_time64 SYS_clock_nanosleep
+#define SYS_timer_gettime64 SYS_timer_gettime
+#define SYS_timer_settime64 SYS_timer_settime
+#define SYS_timerfd_gettime64 SYS_timerfd_gettime
+#define SYS_timerfd_settime64 SYS_timerfd_settime
+#define SYS_utimensat_time64 SYS_utimensat
+#define SYS_pselect6_time64 SYS_pselect6
+#define SYS_ppoll_time64 SYS_ppoll
+#define SYS_recvmmsg_time64 SYS_recvmmsg
+#define SYS_mq_timedsend_time64 SYS_mq_timedsend
+#define SYS_mq_timedreceive_time64 SYS_mq_timedreceive
+#define SYS_semtimedop_time64 SYS_semtimedop
+#define SYS_rt_sigtimedwait_time64 SYS_rt_sigtimedwait
+#define SYS_futex_time64 SYS_futex
+#define SYS_sched_rr_get_interval_time64 SYS_sched_rr_get_interval
+#define SYS_getrusage_time64 SYS_getrusage
+#define SYS_wait4_time64 SYS_wait4
+
+#define IPC_64 0
diff --git a/libc-top-half/musl/arch/x86_64/atomic_arch.h b/libc-top-half/musl/arch/x86_64/atomic_arch.h
new file mode 100644
index 0000000..da4e203
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/atomic_arch.h
@@ -0,0 +1,123 @@
+#define a_cas a_cas
+static inline int a_cas(volatile int *p, int t, int s)
+{
+ __asm__ __volatile__ (
+ "lock ; cmpxchg %3, %1"
+ : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
+ return t;
+}
+
+#define a_cas_p a_cas_p
+static inline void *a_cas_p(volatile void *p, void *t, void *s)
+{
+ __asm__( "lock ; cmpxchg %3, %1"
+ : "=a"(t), "=m"(*(void *volatile *)p)
+ : "a"(t), "r"(s) : "memory" );
+ return t;
+}
+
+#define a_swap a_swap
+static inline int a_swap(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "xchg %0, %1"
+ : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
+ return v;
+}
+
+#define a_fetch_add a_fetch_add
+static inline int a_fetch_add(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; xadd %0, %1"
+ : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
+ return v;
+}
+
+#define a_and a_and
+static inline void a_and(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; and %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_or a_or
+static inline void a_or(volatile int *p, int v)
+{
+ __asm__ __volatile__(
+ "lock ; or %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_and_64 a_and_64
+static inline void a_and_64(volatile uint64_t *p, uint64_t v)
+{
+ __asm__ __volatile(
+ "lock ; and %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_or_64 a_or_64
+static inline void a_or_64(volatile uint64_t *p, uint64_t v)
+{
+ __asm__ __volatile__(
+ "lock ; or %1, %0"
+ : "=m"(*p) : "r"(v) : "memory" );
+}
+
+#define a_inc a_inc
+static inline void a_inc(volatile int *p)
+{
+ __asm__ __volatile__(
+ "lock ; incl %0"
+ : "=m"(*p) : "m"(*p) : "memory" );
+}
+
+#define a_dec a_dec
+static inline void a_dec(volatile int *p)
+{
+ __asm__ __volatile__(
+ "lock ; decl %0"
+ : "=m"(*p) : "m"(*p) : "memory" );
+}
+
+#define a_store a_store
+static inline void a_store(volatile int *p, int x)
+{
+ __asm__ __volatile__(
+ "mov %1, %0 ; lock ; orl $0,(%%rsp)"
+ : "=m"(*p) : "r"(x) : "memory" );
+}
+
+#define a_barrier a_barrier
+static inline void a_barrier()
+{
+ __asm__ __volatile__( "" : : : "memory" );
+}
+
+#define a_spin a_spin
+static inline void a_spin()
+{
+ __asm__ __volatile__( "pause" : : : "memory" );
+}
+
+#define a_crash a_crash
+static inline void a_crash()
+{
+ __asm__ __volatile__( "hlt" : : : "memory" );
+}
+
+#define a_ctz_64 a_ctz_64
+static inline int a_ctz_64(uint64_t x)
+{
+ __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
+ return x;
+}
+
+#define a_clz_64 a_clz_64
+static inline int a_clz_64(uint64_t x)
+{
+ __asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) );
+ return x;
+}
diff --git a/libc-top-half/musl/arch/x86_64/bits/alltypes.h.in b/libc-top-half/musl/arch/x86_64/bits/alltypes.h.in
new file mode 100644
index 0000000..5cd8a29
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/alltypes.h.in
@@ -0,0 +1,20 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#define __BYTE_ORDER 1234
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+TYPEDEF int wchar_t;
+#endif
+
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
+TYPEDEF long double float_t;
+TYPEDEF long double double_t;
+#else
+TYPEDEF float float_t;
+TYPEDEF double double_t;
+#endif
+
+TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
diff --git a/libc-top-half/musl/arch/x86_64/bits/fenv.h b/libc-top-half/musl/arch/x86_64/bits/fenv.h
new file mode 100644
index 0000000..24df041
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/fenv.h
@@ -0,0 +1,34 @@
+#define FE_INVALID 1
+#define __FE_DENORM 2
+#define FE_DIVBYZERO 4
+#define FE_OVERFLOW 8
+#define FE_UNDERFLOW 16
+#define FE_INEXACT 32
+
+#define FE_ALL_EXCEPT 63
+
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 0x400
+#define FE_UPWARD 0x800
+#define FE_TOWARDZERO 0xc00
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+ unsigned short __control_word;
+ unsigned short __unused1;
+ unsigned short __status_word;
+ unsigned short __unused2;
+ unsigned short __tags;
+ unsigned short __unused3;
+ unsigned int __eip;
+ unsigned short __cs_selector;
+ unsigned int __opcode:11;
+ unsigned int __unused4:5;
+ unsigned int __data_offset;
+ unsigned short __data_selector;
+ unsigned short __unused5;
+ unsigned int __mxcsr;
+} fenv_t;
+
+#define FE_DFL_ENV ((const fenv_t *) -1)
diff --git a/libc-top-half/musl/arch/x86_64/bits/float.h b/libc-top-half/musl/arch/x86_64/bits/float.h
new file mode 100644
index 0000000..4d8e786
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 0
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN 3.3621031431120935063e-4932L
+#define LDBL_MAX 1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/libc-top-half/musl/arch/x86_64/bits/io.h b/libc-top-half/musl/arch/x86_64/bits/io.h
new file mode 100644
index 0000000..dd5bddc
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/io.h
@@ -0,0 +1,77 @@
+static __inline void outb(unsigned char __val, unsigned short __port)
+{
+ __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outw(unsigned short __val, unsigned short __port)
+{
+ __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outl(unsigned int __val, unsigned short __port)
+{
+ __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline unsigned char inb(unsigned short __port)
+{
+ unsigned char __val;
+ __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned short inw(unsigned short __port)
+{
+ unsigned short __val;
+ __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline unsigned int inl(unsigned short __port)
+{
+ unsigned int __val;
+ __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
+ return __val;
+}
+
+static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsb"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsw"
+ : "+S" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; outsl"
+ : "+S" (__buf), "+c"(__n)
+ : "d" (__port));
+}
+
+static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insb"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insw"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
+
+static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
+{
+ __asm__ volatile ("cld; rep; insl"
+ : "+D" (__buf), "+c" (__n)
+ : "d" (__port));
+}
diff --git a/libc-top-half/musl/arch/x86_64/bits/limits.h b/libc-top-half/musl/arch/x86_64/bits/limits.h
new file mode 100644
index 0000000..07743b6
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/limits.h
@@ -0,0 +1 @@
+#define PAGESIZE 4096
diff --git a/libc-top-half/musl/arch/x86_64/bits/mman.h b/libc-top-half/musl/arch/x86_64/bits/mman.h
new file mode 100644
index 0000000..ba2d6f7
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/mman.h
@@ -0,0 +1 @@
+#define MAP_32BIT 0x40
diff --git a/libc-top-half/musl/arch/x86_64/bits/posix.h b/libc-top-half/musl/arch/x86_64/bits/posix.h
new file mode 100644
index 0000000..c37b94c
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64 1
+#define _POSIX_V7_LP64_OFF64 1
diff --git a/libc-top-half/musl/arch/x86_64/bits/ptrace.h b/libc-top-half/musl/arch/x86_64/bits/ptrace.h
new file mode 100644
index 0000000..7f8a09b
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/ptrace.h
@@ -0,0 +1,13 @@
+#define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_SET_THREAD_AREA 26
+#define PTRACE_ARCH_PRCTL 30
+#define PTRACE_SYSEMU 31
+#define PTRACE_SYSEMU_SINGLESTEP 32
+#define PTRACE_SINGLEBLOCK 33
+
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
+#define PT_SYSEMU PTRACE_SYSEMU
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/libc-top-half/musl/arch/x86_64/bits/reg.h b/libc-top-half/musl/arch/x86_64/bits/reg.h
new file mode 100644
index 0000000..a4df04c
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/reg.h
@@ -0,0 +1,29 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+#define R15 0
+#define R14 1
+#define R13 2
+#define R12 3
+#define RBP 4
+#define RBX 5
+#define R11 6
+#define R10 7
+#define R9 8
+#define R8 9
+#define RAX 10
+#define RCX 11
+#define RDX 12
+#define RSI 13
+#define RDI 14
+#define ORIG_RAX 15
+#define RIP 16
+#define CS 17
+#define EFLAGS 18
+#define RSP 19
+#define SS 20
+#define FS_BASE 21
+#define GS_BASE 22
+#define DS 23
+#define ES 24
+#define FS 25
+#define GS 26
diff --git a/libc-top-half/musl/arch/x86_64/bits/sem.h b/libc-top-half/musl/arch/x86_64/bits/sem.h
new file mode 100644
index 0000000..e61571c
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/sem.h
@@ -0,0 +1,11 @@
+struct semid_ds {
+ struct ipc_perm sem_perm;
+ time_t sem_otime;
+ long __unused1;
+ time_t sem_ctime;
+ long __unused2;
+ unsigned short sem_nsems;
+ char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+ long __unused3;
+ long __unused4;
+};
diff --git a/libc-top-half/musl/arch/x86_64/bits/setjmp.h b/libc-top-half/musl/arch/x86_64/bits/setjmp.h
new file mode 100644
index 0000000..63973a8
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/setjmp.h
@@ -0,0 +1 @@
+typedef unsigned long __jmp_buf[8];
diff --git a/libc-top-half/musl/arch/x86_64/bits/signal.h b/libc-top-half/musl/arch/x86_64/bits/signal.h
new file mode 100644
index 0000000..c99317d
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/signal.h
@@ -0,0 +1,153 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#ifdef _GNU_SOURCE
+enum { REG_R8 = 0 };
+#define REG_R8 REG_R8
+enum { REG_R9 = 1 };
+#define REG_R9 REG_R9
+enum { REG_R10 = 2 };
+#define REG_R10 REG_R10
+enum { REG_R11 = 3 };
+#define REG_R11 REG_R11
+enum { REG_R12 = 4 };
+#define REG_R12 REG_R12
+enum { REG_R13 = 5 };
+#define REG_R13 REG_R13
+enum { REG_R14 = 6 };
+#define REG_R14 REG_R14
+enum { REG_R15 = 7 };
+#define REG_R15 REG_R15
+enum { REG_RDI = 8 };
+#define REG_RDI REG_RDI
+enum { REG_RSI = 9 };
+#define REG_RSI REG_RSI
+enum { REG_RBP = 10 };
+#define REG_RBP REG_RBP
+enum { REG_RBX = 11 };
+#define REG_RBX REG_RBX
+enum { REG_RDX = 12 };
+#define REG_RDX REG_RDX
+enum { REG_RAX = 13 };
+#define REG_RAX REG_RAX
+enum { REG_RCX = 14 };
+#define REG_RCX REG_RCX
+enum { REG_RSP = 15 };
+#define REG_RSP REG_RSP
+enum { REG_RIP = 16 };
+#define REG_RIP REG_RIP
+enum { REG_EFL = 17 };
+#define REG_EFL REG_EFL
+enum { REG_CSGSFS = 18 };
+#define REG_CSGSFS REG_CSGSFS
+enum { REG_ERR = 19 };
+#define REG_ERR REG_ERR
+enum { REG_TRAPNO = 20 };
+#define REG_TRAPNO REG_TRAPNO
+enum { REG_OLDMASK = 21 };
+#define REG_OLDMASK REG_OLDMASK
+enum { REG_CR2 = 22 };
+#define REG_CR2 REG_CR2
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef long long greg_t, gregset_t[23];
+typedef struct _fpstate {
+ unsigned short cwd, swd, ftw, fop;
+ unsigned long long rip, rdp;
+ unsigned mxcsr, mxcr_mask;
+ struct {
+ unsigned short significand[4], exponent, padding[3];
+ } _st[8];
+ struct {
+ unsigned element[4];
+ } _xmm[16];
+ unsigned padding[24];
+} *fpregset_t;
+struct sigcontext {
+ unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
+ unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
+ unsigned short cs, gs, fs, __pad0;
+ unsigned long err, trapno, oldmask, cr2;
+ struct _fpstate *fpstate;
+ unsigned long __reserved1[8];
+};
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ unsigned long long __reserved1[8];
+} mcontext_t;
+#else
+typedef struct {
+ unsigned long __space[32];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+};
+
+typedef struct __ucontext {
+ unsigned long uc_flags;
+ struct __ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ unsigned long __fpregs_mem[64];
+} ucontext_t;
+
+#define SA_NOCLDSTOP 1
+#define SA_NOCLDWAIT 2
+#define SA_SIGINFO 4
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_RESTORER 0x04000000
+
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT SIGABRT
+#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 29
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
+
diff --git a/libc-top-half/musl/arch/x86_64/bits/stat.h b/libc-top-half/musl/arch/x86_64/bits/stat.h
new file mode 100644
index 0000000..081237c
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/stat.h
@@ -0,0 +1,22 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned int __pad0;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/x86_64/bits/stdint.h b/libc-top-half/musl/arch/x86_64/bits/stdint.h
new file mode 100644
index 0000000..1bb147f
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST16_MAX INT32_MAX
+#define INT_FAST32_MAX INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#define SIZE_MAX UINT64_MAX
diff --git a/libc-top-half/musl/arch/x86_64/bits/syscall.h.in b/libc-top-half/musl/arch/x86_64/bits/syscall.h.in
new file mode 100644
index 0000000..c3882de
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/syscall.h.in
@@ -0,0 +1,358 @@
+#define __NR_read 0
+#define __NR_write 1
+#define __NR_open 2
+#define __NR_close 3
+#define __NR_stat 4
+#define __NR_fstat 5
+#define __NR_lstat 6
+#define __NR_poll 7
+#define __NR_lseek 8
+#define __NR_mmap 9
+#define __NR_mprotect 10
+#define __NR_munmap 11
+#define __NR_brk 12
+#define __NR_rt_sigaction 13
+#define __NR_rt_sigprocmask 14
+#define __NR_rt_sigreturn 15
+#define __NR_ioctl 16
+#define __NR_pread64 17
+#define __NR_pwrite64 18
+#define __NR_readv 19
+#define __NR_writev 20
+#define __NR_access 21
+#define __NR_pipe 22
+#define __NR_select 23
+#define __NR_sched_yield 24
+#define __NR_mremap 25
+#define __NR_msync 26
+#define __NR_mincore 27
+#define __NR_madvise 28
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#define __NR_dup 32
+#define __NR_dup2 33
+#define __NR_pause 34
+#define __NR_nanosleep 35
+#define __NR_getitimer 36
+#define __NR_alarm 37
+#define __NR_setitimer 38
+#define __NR_getpid 39
+#define __NR_sendfile 40
+#define __NR_socket 41
+#define __NR_connect 42
+#define __NR_accept 43
+#define __NR_sendto 44
+#define __NR_recvfrom 45
+#define __NR_sendmsg 46
+#define __NR_recvmsg 47
+#define __NR_shutdown 48
+#define __NR_bind 49
+#define __NR_listen 50
+#define __NR_getsockname 51
+#define __NR_getpeername 52
+#define __NR_socketpair 53
+#define __NR_setsockopt 54
+#define __NR_getsockopt 55
+#define __NR_clone 56
+#define __NR_fork 57
+#define __NR_vfork 58
+#define __NR_execve 59
+#define __NR_exit 60
+#define __NR_wait4 61
+#define __NR_kill 62
+#define __NR_uname 63
+#define __NR_semget 64
+#define __NR_semop 65
+#define __NR_semctl 66
+#define __NR_shmdt 67
+#define __NR_msgget 68
+#define __NR_msgsnd 69
+#define __NR_msgrcv 70
+#define __NR_msgctl 71
+#define __NR_fcntl 72
+#define __NR_flock 73
+#define __NR_fsync 74
+#define __NR_fdatasync 75
+#define __NR_truncate 76
+#define __NR_ftruncate 77
+#define __NR_getdents 78
+#define __NR_getcwd 79
+#define __NR_chdir 80
+#define __NR_fchdir 81
+#define __NR_rename 82
+#define __NR_mkdir 83
+#define __NR_rmdir 84
+#define __NR_creat 85
+#define __NR_link 86
+#define __NR_unlink 87
+#define __NR_symlink 88
+#define __NR_readlink 89
+#define __NR_chmod 90
+#define __NR_fchmod 91
+#define __NR_chown 92
+#define __NR_fchown 93
+#define __NR_lchown 94
+#define __NR_umask 95
+#define __NR_gettimeofday 96
+#define __NR_getrlimit 97
+#define __NR_getrusage 98
+#define __NR_sysinfo 99
+#define __NR_times 100
+#define __NR_ptrace 101
+#define __NR_getuid 102
+#define __NR_syslog 103
+#define __NR_getgid 104
+#define __NR_setuid 105
+#define __NR_setgid 106
+#define __NR_geteuid 107
+#define __NR_getegid 108
+#define __NR_setpgid 109
+#define __NR_getppid 110
+#define __NR_getpgrp 111
+#define __NR_setsid 112
+#define __NR_setreuid 113
+#define __NR_setregid 114
+#define __NR_getgroups 115
+#define __NR_setgroups 116
+#define __NR_setresuid 117
+#define __NR_getresuid 118
+#define __NR_setresgid 119
+#define __NR_getresgid 120
+#define __NR_getpgid 121
+#define __NR_setfsuid 122
+#define __NR_setfsgid 123
+#define __NR_getsid 124
+#define __NR_capget 125
+#define __NR_capset 126
+#define __NR_rt_sigpending 127
+#define __NR_rt_sigtimedwait 128
+#define __NR_rt_sigqueueinfo 129
+#define __NR_rt_sigsuspend 130
+#define __NR_sigaltstack 131
+#define __NR_utime 132
+#define __NR_mknod 133
+#define __NR_uselib 134
+#define __NR_personality 135
+#define __NR_ustat 136
+#define __NR_statfs 137
+#define __NR_fstatfs 138
+#define __NR_sysfs 139
+#define __NR_getpriority 140
+#define __NR_setpriority 141
+#define __NR_sched_setparam 142
+#define __NR_sched_getparam 143
+#define __NR_sched_setscheduler 144
+#define __NR_sched_getscheduler 145
+#define __NR_sched_get_priority_max 146
+#define __NR_sched_get_priority_min 147
+#define __NR_sched_rr_get_interval 148
+#define __NR_mlock 149
+#define __NR_munlock 150
+#define __NR_mlockall 151
+#define __NR_munlockall 152
+#define __NR_vhangup 153
+#define __NR_modify_ldt 154
+#define __NR_pivot_root 155
+#define __NR__sysctl 156
+#define __NR_prctl 157
+#define __NR_arch_prctl 158
+#define __NR_adjtimex 159
+#define __NR_setrlimit 160
+#define __NR_chroot 161
+#define __NR_sync 162
+#define __NR_acct 163
+#define __NR_settimeofday 164
+#define __NR_mount 165
+#define __NR_umount2 166
+#define __NR_swapon 167
+#define __NR_swapoff 168
+#define __NR_reboot 169
+#define __NR_sethostname 170
+#define __NR_setdomainname 171
+#define __NR_iopl 172
+#define __NR_ioperm 173
+#define __NR_create_module 174
+#define __NR_init_module 175
+#define __NR_delete_module 176
+#define __NR_get_kernel_syms 177
+#define __NR_query_module 178
+#define __NR_quotactl 179
+#define __NR_nfsservctl 180
+#define __NR_getpmsg 181
+#define __NR_putpmsg 182
+#define __NR_afs_syscall 183
+#define __NR_tuxcall 184
+#define __NR_security 185
+#define __NR_gettid 186
+#define __NR_readahead 187
+#define __NR_setxattr 188
+#define __NR_lsetxattr 189
+#define __NR_fsetxattr 190
+#define __NR_getxattr 191
+#define __NR_lgetxattr 192
+#define __NR_fgetxattr 193
+#define __NR_listxattr 194
+#define __NR_llistxattr 195
+#define __NR_flistxattr 196
+#define __NR_removexattr 197
+#define __NR_lremovexattr 198
+#define __NR_fremovexattr 199
+#define __NR_tkill 200
+#define __NR_time 201
+#define __NR_futex 202
+#define __NR_sched_setaffinity 203
+#define __NR_sched_getaffinity 204
+#define __NR_set_thread_area 205
+#define __NR_io_setup 206
+#define __NR_io_destroy 207
+#define __NR_io_getevents 208
+#define __NR_io_submit 209
+#define __NR_io_cancel 210
+#define __NR_get_thread_area 211
+#define __NR_lookup_dcookie 212
+#define __NR_epoll_create 213
+#define __NR_epoll_ctl_old 214
+#define __NR_epoll_wait_old 215
+#define __NR_remap_file_pages 216
+#define __NR_getdents64 217
+#define __NR_set_tid_address 218
+#define __NR_restart_syscall 219
+#define __NR_semtimedop 220
+#define __NR_fadvise64 221
+#define __NR_timer_create 222
+#define __NR_timer_settime 223
+#define __NR_timer_gettime 224
+#define __NR_timer_getoverrun 225
+#define __NR_timer_delete 226
+#define __NR_clock_settime 227
+#define __NR_clock_gettime 228
+#define __NR_clock_getres 229
+#define __NR_clock_nanosleep 230
+#define __NR_exit_group 231
+#define __NR_epoll_wait 232
+#define __NR_epoll_ctl 233
+#define __NR_tgkill 234
+#define __NR_utimes 235
+#define __NR_vserver 236
+#define __NR_mbind 237
+#define __NR_set_mempolicy 238
+#define __NR_get_mempolicy 239
+#define __NR_mq_open 240
+#define __NR_mq_unlink 241
+#define __NR_mq_timedsend 242
+#define __NR_mq_timedreceive 243
+#define __NR_mq_notify 244
+#define __NR_mq_getsetattr 245
+#define __NR_kexec_load 246
+#define __NR_waitid 247
+#define __NR_add_key 248
+#define __NR_request_key 249
+#define __NR_keyctl 250
+#define __NR_ioprio_set 251
+#define __NR_ioprio_get 252
+#define __NR_inotify_init 253
+#define __NR_inotify_add_watch 254
+#define __NR_inotify_rm_watch 255
+#define __NR_migrate_pages 256
+#define __NR_openat 257
+#define __NR_mkdirat 258
+#define __NR_mknodat 259
+#define __NR_fchownat 260
+#define __NR_futimesat 261
+#define __NR_newfstatat 262
+#define __NR_unlinkat 263
+#define __NR_renameat 264
+#define __NR_linkat 265
+#define __NR_symlinkat 266
+#define __NR_readlinkat 267
+#define __NR_fchmodat 268
+#define __NR_faccessat 269
+#define __NR_pselect6 270
+#define __NR_ppoll 271
+#define __NR_unshare 272
+#define __NR_set_robust_list 273
+#define __NR_get_robust_list 274
+#define __NR_splice 275
+#define __NR_tee 276
+#define __NR_sync_file_range 277
+#define __NR_vmsplice 278
+#define __NR_move_pages 279
+#define __NR_utimensat 280
+#define __NR_epoll_pwait 281
+#define __NR_signalfd 282
+#define __NR_timerfd_create 283
+#define __NR_eventfd 284
+#define __NR_fallocate 285
+#define __NR_timerfd_settime 286
+#define __NR_timerfd_gettime 287
+#define __NR_accept4 288
+#define __NR_signalfd4 289
+#define __NR_eventfd2 290
+#define __NR_epoll_create1 291
+#define __NR_dup3 292
+#define __NR_pipe2 293
+#define __NR_inotify_init1 294
+#define __NR_preadv 295
+#define __NR_pwritev 296
+#define __NR_rt_tgsigqueueinfo 297
+#define __NR_perf_event_open 298
+#define __NR_recvmmsg 299
+#define __NR_fanotify_init 300
+#define __NR_fanotify_mark 301
+#define __NR_prlimit64 302
+#define __NR_name_to_handle_at 303
+#define __NR_open_by_handle_at 304
+#define __NR_clock_adjtime 305
+#define __NR_syncfs 306
+#define __NR_sendmmsg 307
+#define __NR_setns 308
+#define __NR_getcpu 309
+#define __NR_process_vm_readv 310
+#define __NR_process_vm_writev 311
+#define __NR_kcmp 312
+#define __NR_finit_module 313
+#define __NR_sched_setattr 314
+#define __NR_sched_getattr 315
+#define __NR_renameat2 316
+#define __NR_seccomp 317
+#define __NR_getrandom 318
+#define __NR_memfd_create 319
+#define __NR_kexec_file_load 320
+#define __NR_bpf 321
+#define __NR_execveat 322
+#define __NR_userfaultfd 323
+#define __NR_membarrier 324
+#define __NR_mlock2 325
+#define __NR_copy_file_range 326
+#define __NR_preadv2 327
+#define __NR_pwritev2 328
+#define __NR_pkey_mprotect 329
+#define __NR_pkey_alloc 330
+#define __NR_pkey_free 331
+#define __NR_statx 332
+#define __NR_io_pgetevents 333
+#define __NR_rseq 334
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree 428
+#define __NR_move_mount 429
+#define __NR_fsopen 430
+#define __NR_fsconfig 431
+#define __NR_fsmount 432
+#define __NR_fspick 433
+#define __NR_pidfd_open 434
+#define __NR_clone3 435
+#define __NR_close_range 436
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
+#define __NR_faccessat2 439
+#define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
+#define __NR_mount_setattr 442
+#define __NR_landlock_create_ruleset 444
+#define __NR_landlock_add_rule 445
+#define __NR_landlock_restrict_self 446
+
diff --git a/libc-top-half/musl/arch/x86_64/bits/user.h b/libc-top-half/musl/arch/x86_64/bits/user.h
new file mode 100644
index 0000000..4073cc0
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/bits/user.h
@@ -0,0 +1,41 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+
+typedef struct user_fpregs_struct {
+ uint16_t cwd, swd, ftw, fop;
+ uint64_t rip, rdp;
+ uint32_t mxcsr, mxcr_mask;
+ uint32_t st_space[32], xmm_space[64], padding[24];
+} elf_fpregset_t;
+
+struct user_regs_struct {
+ unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
+ unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
+ unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
+};
+#define ELF_NGREG 27
+typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+ struct user_regs_struct regs;
+ int u_fpvalid;
+ struct user_fpregs_struct i387;
+ unsigned long u_tsize;
+ unsigned long u_dsize;
+ unsigned long u_ssize;
+ unsigned long start_code;
+ unsigned long start_stack;
+ long signal;
+ int reserved;
+ struct user_regs_struct *u_ar0;
+ struct user_fpregs_struct *u_fpstate;
+ unsigned long magic;
+ char u_comm[32];
+ unsigned long u_debugreg[8];
+};
+
+#define PAGE_MASK (~(PAGESIZE-1))
+#define NBPG PAGESIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
diff --git a/libc-top-half/musl/arch/x86_64/crt_arch.h b/libc-top-half/musl/arch/x86_64/crt_arch.h
new file mode 100644
index 0000000..3eec61b
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/crt_arch.h
@@ -0,0 +1,12 @@
+__asm__(
+".text \n"
+".global " START " \n"
+START ": \n"
+" xor %rbp,%rbp \n"
+" mov %rsp,%rdi \n"
+".weak _DYNAMIC \n"
+".hidden _DYNAMIC \n"
+" lea _DYNAMIC(%rip),%rsi \n"
+" andq $-16,%rsp \n"
+" call " START "_c \n"
+);
diff --git a/libc-top-half/musl/arch/x86_64/ksigaction.h b/libc-top-half/musl/arch/x86_64/ksigaction.h
new file mode 100644
index 0000000..c40e356
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/ksigaction.h
@@ -0,0 +1,11 @@
+#include <features.h>
+
+struct k_sigaction {
+ void (*handler)(int);
+ unsigned long flags;
+ void (*restorer)(void);
+ unsigned mask[2];
+};
+
+hidden void __restore_rt();
+#define __restore __restore_rt
diff --git a/libc-top-half/musl/arch/x86_64/kstat.h b/libc-top-half/musl/arch/x86_64/kstat.h
new file mode 100644
index 0000000..5976c04
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/kstat.h
@@ -0,0 +1,22 @@
+struct kstat {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ unsigned int __pad0;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ long st_atime_sec;
+ long st_atime_nsec;
+ long st_mtime_sec;
+ long st_mtime_nsec;
+ long st_ctime_sec;
+ long st_ctime_nsec;
+ long __unused[3];
+};
diff --git a/libc-top-half/musl/arch/x86_64/pthread_arch.h b/libc-top-half/musl/arch/x86_64/pthread_arch.h
new file mode 100644
index 0000000..c8c63f2
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/pthread_arch.h
@@ -0,0 +1,8 @@
+static inline uintptr_t __get_tp()
+{
+ uintptr_t tp;
+ __asm__ ("mov %%fs:0,%0" : "=r" (tp) );
+ return tp;
+}
+
+#define MC_PC gregs[REG_RIP]
diff --git a/libc-top-half/musl/arch/x86_64/reloc.h b/libc-top-half/musl/arch/x86_64/reloc.h
new file mode 100644
index 0000000..fac0c0a
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/reloc.h
@@ -0,0 +1,20 @@
+#define LDSO_ARCH "x86_64"
+
+#define REL_SYMBOLIC R_X86_64_64
+#define REL_OFFSET32 R_X86_64_PC32
+#define REL_GOT R_X86_64_GLOB_DAT
+#define REL_PLT R_X86_64_JUMP_SLOT
+#define REL_RELATIVE R_X86_64_RELATIVE
+#define REL_COPY R_X86_64_COPY
+#define REL_DTPMOD R_X86_64_DTPMOD64
+#define REL_DTPOFF R_X86_64_DTPOFF64
+#define REL_TPOFF R_X86_64_TPOFF64
+#define REL_TLSDESC R_X86_64_TLSDESC
+
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov %1,%%rsp ; jmp *%0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ " lea " #sym "(%%rip),%0\n" \
+ : "=r"(*fp) : : "memory" )
diff --git a/libc-top-half/musl/arch/x86_64/syscall_arch.h b/libc-top-half/musl/arch/x86_64/syscall_arch.h
new file mode 100644
index 0000000..92d5c17
--- /dev/null
+++ b/libc-top-half/musl/arch/x86_64/syscall_arch.h
@@ -0,0 +1,70 @@
+#define __SYSCALL_LL_E(x) (x)
+#define __SYSCALL_LL_O(x) (x)
+
+static __inline long __syscall0(long n)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall1(long n, long a1)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall2(long n, long a1, long a2)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
+ : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall3(long n, long a1, long a2, long a3)
+{
+ unsigned long ret;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
+{
+ unsigned long ret;
+ register long r10 __asm__("r10") = a4;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3), "r"(r10): "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, long a5)
+{
+ unsigned long ret;
+ register long r10 __asm__("r10") = a4;
+ register long r8 __asm__("r8") = a5;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3), "r"(r10), "r"(r8) : "rcx", "r11", "memory");
+ return ret;
+}
+
+static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a5, long a6)
+{
+ unsigned long ret;
+ register long r10 __asm__("r10") = a4;
+ register long r8 __asm__("r8") = a5;
+ register long r9 __asm__("r9") = a6;
+ __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
+ "d"(a3), "r"(r10), "r"(r8), "r"(r9) : "rcx", "r11", "memory");
+ return ret;
+}
+
+#define VDSO_USEFUL
+#define VDSO_CGT_SYM "__vdso_clock_gettime"
+#define VDSO_CGT_VER "LINUX_2.6"
+#define VDSO_GETCPU_SYM "__vdso_getcpu"
+#define VDSO_GETCPU_VER "LINUX_2.6"
+
+#define IPC_64 0