Merge "Remove _FORTIFY_SOURCE in implementation files."
diff --git a/libc/Android.mk b/libc/Android.mk
index f685565..f3a4dcf 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -80,11 +80,9 @@
bionic/err.c \
bionic/ether_aton.c \
bionic/ether_ntoa.c \
- bionic/fcntl.c \
bionic/fdprintf.c \
bionic/flockfile.c \
bionic/fork.c \
- bionic/fstatfs.c \
bionic/ftime.c \
bionic/ftok.c \
bionic/fts.c \
@@ -133,9 +131,7 @@
bionic/signal.c \
bionic/signame.c \
bionic/sigsetmask.c \
- bionic/sigsuspend.c \
bionic/sleep.c \
- bionic/statfs.c \
bionic/strndup.c \
bionic/strntoimax.c \
bionic/strntoumax.c \
@@ -180,6 +176,16 @@
netbsd/nameser/ns_print.c \
netbsd/nameser/ns_samedomain.c \
+# These are shared by all the 32-bit targets, but not the 64-bit ones.
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
+libc_common_src_files += \
+ bionic/fcntl.c \
+ bionic/fstatfs.c \
+ bionic/sigsuspend.c \
+ bionic/statfs.c \
+
+endif
+
# Fortify implementations of libc functions.
libc_common_src_files += \
bionic/__fgets_chk.cpp \
@@ -214,7 +220,6 @@
bionic/libc_init_common.cpp \
bionic/libc_logging.cpp \
bionic/libgen.cpp \
- bionic/mmap.cpp \
bionic/pthread_attr.cpp \
bionic/pthread_detach.cpp \
bionic/pthread_equal.cpp \
@@ -246,6 +251,13 @@
bionic/wait.cpp \
bionic/wchar.cpp \
+# These are shared by all the 32-bit targets, but not the 64-bit ones.
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
+libc_bionic_src_files += \
+ bionic/mmap.cpp \
+
+endif
+
libc_tzcode_src_files := \
tzcode/asctime.c \
tzcode/difftime.c \
@@ -360,39 +372,41 @@
upstream-netbsd/libc/string/strxfrm.c \
upstream-netbsd/libc/unistd/killpg.c \
+
# Architecture specific source files go here
# =========================================================
ifeq ($(TARGET_ARCH),arm)
libc_common_src_files += \
- bionic/memmove.c.arm \
- string/bcopy.c \
- string/strncmp.c \
- string/strncat.c \
- string/strncpy.c \
- bionic/strchr.cpp \
- string/strrchr.c \
bionic/memchr.c \
+ bionic/memmove.c.arm \
bionic/memrchr.c \
- string/index.c \
+ bionic/strchr.cpp \
bionic/strnlen.c \
+ string/bcopy.c \
+ string/index.c \
string/strlcat.c \
string/strlcpy.c \
+ string/strncat.c \
+ string/strncmp.c \
+ string/strncpy.c \
+ string/strrchr.c \
+ upstream-freebsd/lib/libc/string/wcscat.c \
upstream-freebsd/lib/libc/string/wcschr.c \
- upstream-freebsd/lib/libc/string/wcsrchr.c \
upstream-freebsd/lib/libc/string/wcscmp.c \
upstream-freebsd/lib/libc/string/wcscpy.c \
- upstream-freebsd/lib/libc/string/wmemcmp.c \
upstream-freebsd/lib/libc/string/wcslen.c \
- upstream-freebsd/lib/libc/string/wcscat.c
+ upstream-freebsd/lib/libc/string/wcsrchr.c \
+ upstream-freebsd/lib/libc/string/wmemcmp.c \
# These files need to be arm so that gdbserver
# can set breakpoints in them without messing
# up any thumb code.
+# TODO: is this actually necessary?
libc_common_src_files += \
- bionic/pthread-atfork.c.arm \
- bionic/pthread-rwlocks.c.arm \
- bionic/pthread-timers.c.arm \
- bionic/ptrace.c.arm
+ bionic/pthread-atfork.c.arm \
+ bionic/pthread-rwlocks.c.arm \
+ bionic/pthread-timers.c.arm \
+ bionic/ptrace.c.arm \
libc_static_common_src_files += \
bionic/pthread.c.arm \
@@ -415,31 +429,72 @@
endif # x86
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86_64))
+libc_common_src_files += \
+ bionic/memchr.c \
+ bionic/memcmp.c \
+ bionic/memcpy.c \
+ bionic/memmove.c \
+ bionic/memrchr.c \
+ bionic/memset.c \
+ bionic/pthread-atfork.c \
+ bionic/pthread-rwlocks.c \
+ bionic/pthread-timers.c \
+ bionic/ptrace.c \
+ bionic/strchr.cpp \
+ bionic/strnlen.c \
+ string/bcopy.c \
+ string/index.c \
+ string/strcat.c \
+ string/strcmp.c \
+ string/strcpy.c \
+ string/strlcat.c \
+ string/strlcpy.c \
+ string/strlen.c \
+ string/strncat.c \
+ string/strncmp.c \
+ string/strncpy.c \
+ string/strrchr.c \
+ upstream-freebsd/lib/libc/string/wcscat.c \
+ upstream-freebsd/lib/libc/string/wcschr.c \
+ upstream-freebsd/lib/libc/string/wcscmp.c \
+ upstream-freebsd/lib/libc/string/wcscpy.c \
+ upstream-freebsd/lib/libc/string/wcslen.c \
+ upstream-freebsd/lib/libc/string/wcsrchr.c \
+ upstream-freebsd/lib/libc/string/wmemcmp.c \
+
+libc_static_common_src_files += \
+ bionic/pthread.c \
+ bionic/pthread_create.cpp \
+ bionic/pthread_key.cpp \
+
+endif # x86_64
+
ifeq ($(TARGET_ARCH),mips)
libc_common_src_files += \
+ bionic/memchr.c \
bionic/memcmp.c \
+ bionic/memrchr.c \
+ bionic/strchr.cpp \
+ bionic/strnlen.c \
string/bcopy.c \
+ string/index.c \
+ string/strcat.c \
string/strcmp.c \
string/strcpy.c \
- string/strncmp.c \
- string/strcat.c \
- string/strncat.c \
- string/strncpy.c \
- bionic/strchr.cpp \
- string/strrchr.c \
- bionic/memchr.c \
- bionic/memrchr.c \
- string/index.c \
- bionic/strnlen.c \
string/strlcat.c \
string/strlcpy.c \
+ string/strncat.c \
+ string/strncmp.c \
+ string/strncpy.c \
+ string/strrchr.c \
+ upstream-freebsd/lib/libc/string/wcscat.c \
upstream-freebsd/lib/libc/string/wcschr.c \
- upstream-freebsd/lib/libc/string/wcsrchr.c \
upstream-freebsd/lib/libc/string/wcscmp.c \
upstream-freebsd/lib/libc/string/wcscpy.c \
- upstream-freebsd/lib/libc/string/wmemcmp.c \
upstream-freebsd/lib/libc/string/wcslen.c \
- upstream-freebsd/lib/libc/string/wcscat.c
+ upstream-freebsd/lib/libc/string/wcsrchr.c \
+ upstream-freebsd/lib/libc/string/wmemcmp.c \
libc_common_src_files += \
bionic/pthread-atfork.c \
@@ -516,16 +571,23 @@
endif # !arm
ifeq ($(TARGET_ARCH),x86)
- libc_common_cflags += -DSOFTFLOAT
libc_crt_target_cflags := -m32
libc_crt_target_ldflags := -melf_i386
+endif
+ifeq ($(TARGET_ARCH),x86_64)
+ libc_crt_target_cflags := -m64
+ libc_crt_target_ldflags := -melf_x86_64
+endif
+
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
+ libc_common_cflags += -DSOFTFLOAT
ifeq ($(ARCH_X86_HAVE_SSE2),true)
libc_crt_target_cflags += -DUSE_SSE2=1
endif
ifeq ($(ARCH_X86_HAVE_SSSE3),true)
libc_crt_target_cflags += -DUSE_SSSE3=1
endif
-endif # x86
+endif
ifeq ($(TARGET_ARCH),mips)
ifneq ($(ARCH_MIPS_HAS_FPU),true)
@@ -581,7 +643,7 @@
ifeq ($(TARGET_ARCH),mips)
libc_crt_target_so_cflags := -fPIC
endif
-ifeq ($(TARGET_ARCH),x86)
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
libc_crt_target_so_cflags := -fPIC
endif
libc_crt_target_so_cflags += $(libc_crt_target_cflags)
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 86b164a..6465de4 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -6,7 +6,7 @@
#
# where:
# arch_list ::= "all" | "custom" | arch+
-# arch ::= "arm" | "mips" | "x86"
+# arch ::= "arm" | "mips" | "x86" | "x86_64"
#
# Note:
# - syscall_name corresponds to the name of the syscall, which may differ from
@@ -40,60 +40,61 @@
int execve(const char*, char* const*, char* const*) all
int __setuid:setuid32(uid_t) arm,x86
-int __setuid:setuid(uid_t) mips
+int __setuid:setuid(uid_t) mips,x86_64
uid_t getuid:getuid32() arm,x86
-uid_t getuid:getuid() mips
+uid_t getuid:getuid() mips,x86_64
gid_t getgid:getgid32() arm,x86
-gid_t getgid:getgid() mips
+gid_t getgid:getgid() mips,x86_64
uid_t geteuid:geteuid32() arm,x86
-uid_t geteuid:geteuid() mips
+uid_t geteuid:geteuid() mips,x86_64
gid_t getegid:getegid32() arm,x86
-gid_t getegid:getegid() mips
+gid_t getegid:getegid() mips,x86_64
uid_t getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid) arm,x86
-uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) mips
+uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) mips,x86_64
gid_t getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid) arm,x86
-gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) mips
+gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) mips,x86_64
pid_t gettid() all
ssize_t readahead(int, off64_t, size_t) all
int getgroups:getgroups32(int, gid_t*) arm,x86
-int getgroups:getgroups(int, gid_t*) mips
+int getgroups:getgroups(int, gid_t*) mips,x86_64
pid_t getpgid(pid_t) all
pid_t getppid() all
pid_t getsid(pid_t) all
pid_t setsid() all
int setgid:setgid32(gid_t) arm,x86
-int setgid:setgid(gid_t) mips
+int setgid:setgid(gid_t) mips,x86_64
int seteuid:seteuid32(uid_t) custom
int __setreuid:setreuid32(uid_t, uid_t) arm,x86
-int __setreuid:setreuid(uid_t, uid_t) mips
+int __setreuid:setreuid(uid_t, uid_t) mips,x86_64
int __setresuid:setresuid32(uid_t, uid_t, uid_t) arm,x86
-int __setresuid:setresuid(uid_t, uid_t, uid_t) mips
+int __setresuid:setresuid(uid_t, uid_t, uid_t) mips,x86_64
int setresgid:setresgid32(gid_t, gid_t, gid_t) arm,x86
-int setresgid:setresgid(gid_t, gid_t, gid_t) mips
+int setresgid:setresgid(gid_t, gid_t, gid_t) mips,x86_64
void* __brk:brk(void*) all
# See comments in kill.S to understand why we don't generate ARM stubs for kill/tkill/tgkill.
-int kill(pid_t, int) mips,x86
-int tkill(pid_t tid, int sig) mips,x86
-int tgkill(pid_t tgid, pid_t tid, int sig) mips,x86
+int kill(pid_t, int) mips,x86,x86_64
+int tkill(pid_t tid, int sig) mips,x86,x86_64
+int tgkill(pid_t tgid, pid_t tid, int sig) mips,x86,x86_64
int __ptrace:ptrace(int request, int pid, void* addr, void* data) all
int __set_thread_area:set_thread_area(void* user_desc) mips,x86
int __getpriority:getpriority(int, int) all
int setpriority(int, int, int) all
int setrlimit(int resource, const struct rlimit* rlp) all
int getrlimit:ugetrlimit(int resource, struct rlimit* rlp) arm,x86
-int getrlimit:getrlimit(int resource, struct rlimit* rlp) mips
+int getrlimit:getrlimit(int resource, struct rlimit* rlp) mips,x86_64
int getrusage(int who, struct rusage* r_usage) all
int setgroups:setgroups32(int, const gid_t*) arm,x86
-int setgroups:setgroups(int, const gid_t*) mips
+int setgroups:setgroups(int, const gid_t*) mips,x86_64
pid_t getpgrp(void) custom
int setpgid(pid_t, pid_t) all
-pid_t vfork(void) arm
+pid_t vfork(void) arm,x86_64
int setregid:setregid32(gid_t, gid_t) arm,x86
-int setregid:setregid(gid_t, gid_t) mips
+int setregid:setregid(gid_t, gid_t) mips,x86_64
int chroot(const char*) all
# IMPORTANT: Even though <sys/prctl.h> declares prctl(int, ...), the syscall stub must take 6 arguments
# to match the kernel implementation.
int prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) all
+long arch_prctl(int, unsigned long) x86_64
int capget(cap_user_header_t header, cap_user_data_t data) all
int capset(cap_user_header_t header, const cap_user_data_t data) all
int sigaltstack(const stack_t*, stack_t*) all
@@ -109,10 +110,10 @@
int close(int) all
int creat(const char*, mode_t) custom
off_t lseek(int, off_t, int) all
-int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) all
+int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86,mips
pid_t getpid() all
-void* mmap(void*, size_t, int, int, int, long) custom
-void* __mmap2:mmap2(void*, size_t, int, int, int, long) all
+void* mmap(void*, size_t, int, int, int, long) x86_64
+void* __mmap2:mmap2(void*, size_t, int, int, int, long) arm,x86,mips
int munmap(void*, size_t) all
void* mremap(void*, size_t, size_t, unsigned long) all
int msync(const void*, size_t, int) all
@@ -126,27 +127,30 @@
int __ioctl:ioctl(int, int, void*) all
int readv(int, const struct iovec*, int) all
int writev(int, const struct iovec*, int) all
-int __fcntl:fcntl(int, int, void*) all
+int __fcntl:fcntl(int, int, void*) arm,x86,mips
+int fcntl(int, void*) x86_64
int flock(int, int) all
int fchmod(int, mode_t) all
int dup(int) all
-int pipe(int*) arm,x86
+int pipe(int*) arm,x86,x86_64
int pipe2(int*, int) all
int dup2(int, int) all
-int select:_newselect(int, struct fd_set*, struct fd_set*, struct fd_set*, struct timeval*) all
+int select:_newselect(int, struct fd_set*, struct fd_set*, struct fd_set*, struct timeval*) arm,x86,mips
+int select(int, struct fd_set*, struct fd_set*, struct fd_set*, struct timeval*) x86_64
int ftruncate(int, off_t) all
-int ftruncate64(int, off64_t) all
+int ftruncate64(int, off64_t) arm,x86,mips
int getdents:getdents64(unsigned int, struct dirent*, unsigned int) all
int fsync(int) all
int fdatasync(int) all
int fchown:fchown32(int, uid_t, gid_t) arm,x86
-int fchown:fchown(int, uid_t, gid_t) mips
+int fchown:fchown(int, uid_t, gid_t) mips,x86_64
void sync(void) all
-int __fcntl64:fcntl64(int, int, void*) all
-int __fstatfs64:fstatfs64(int, size_t, struct statfs*) all
+int __fcntl64:fcntl64(int, int, void*) arm,x86,mips
+int __fstatfs64:fstatfs64(int, size_t, struct statfs*) arm,x86,mips
+int fstatfs(int, struct statfs*) x86_64
ssize_t sendfile(int out_fd, int in_fd, off_t* offset, size_t count) all
-ssize_t sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count) all
-int fstatat:fstatat64(int dirfd, const char* path, struct stat* buf, int flags) all
+ssize_t sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count) arm,x86,mips
+int fstatat:fstatat64(int dirfd, const char* path, struct stat* buf, int flags) arm,x86,mips
int mkdirat(int dirfd, const char* pathname, mode_t mode) all
int fchownat(int dirfd, const char* path, uid_t owner, gid_t group, int flags) all
int fchmodat(int dirfd, const char* path, mode_t mode, int flags) all
@@ -164,15 +168,18 @@
int mknod(const char*, mode_t, dev_t) all
int chmod(const char*, mode_t) all
int chown:chown32(const char*, uid_t, gid_t) arm,x86
-int chown:chown(const char*, uid_t, gid_t) mips
+int chown:chown(const char*, uid_t, gid_t) mips,x86_64
int lchown:lchown32(const char*, uid_t, gid_t) arm,x86
-int lchown:lchown(const char*, uid_t, gid_t) mips
+int lchown:lchown(const char*, uid_t, gid_t) mips,x86_64
int mount(const char*, const char*, const char*, unsigned long, const void*) all
int umount(const char*) custom
int umount2(const char*, int) all
-int fstat:fstat64(int, struct stat*) all
-int stat:stat64(const char*, struct stat*) all
-int lstat:lstat64(const char*, struct stat*) all
+int fstat:fstat64(int, struct stat*) arm,x86,mips
+int fstat(int, struct stat*) x86_64
+int stat:stat64(const char*, struct stat*) arm,x86,mips
+int stat(const char*, struct stat*) x86_64
+int lstat:lstat64(const char*, struct stat*) arm,x86,mips
+int lstat(const char*, struct stat*) x86_64
int mkdir(const char*, mode_t) all
int readlink(const char*, char*, size_t) all
int rmdir(const char*) all
@@ -183,7 +190,7 @@
int symlink(const char*, const char*) all
int fchdir(int) all
int truncate(const char*, off_t) all
-int truncate64(const char*, off64_t) all
+int truncate64(const char*, off64_t) arm,x86,mips
int setxattr(const char*, const char*, const void*, size_t, int) all
int lsetxattr(const char*, const char*, const void*, size_t, int) all
ssize_t getxattr(const char*, const char*, void*, size_t) all
@@ -192,7 +199,8 @@
ssize_t llistxattr(const char*, char*, size_t) all
int removexattr(const char*, const char*) all
int lremovexattr(const char*, const char*) all
-int __statfs64:statfs64(const char*, size_t, struct statfs*) all
+int __statfs64:statfs64(const char*, size_t, struct statfs*) arm,x86,mips
+int statfs(const char*, struct statfs*) x86_64
long unshare(unsigned long) all
int swapon(const char*, int) all
int swapoff(const char*) all
@@ -221,32 +229,33 @@
int timerfd_gettime(int, struct itimerspec*) all
# signals
-int sigaction(int, const struct sigaction*, struct sigaction*) all
-int sigprocmask(int, const sigset_t*, sigset_t*) all
+int sigaction(int, const struct sigaction*, struct sigaction*) arm,x86,mips
+int sigprocmask(int, const sigset_t*, sigset_t*) arm,x86,mips
int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) arm,x86
int __sigsuspend:sigsuspend(const sigset_t* mask) mips
+int __rt_sigsuspend:rt_sigsuspend(const sigset_t *unewset, size_t sigset_size) x86_64
int __rt_sigaction:rt_sigaction(int sig, const struct sigaction* act, struct sigaction* oact, size_t sigsetsize) all
int __rt_sigprocmask:rt_sigprocmask(int how, const sigset_t* set, sigset_t* oset, size_t sigsetsize) all
int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t* set, struct siginfo_t* info, struct timespec_t* timeout, size_t sigset_size) all
-int sigpending(sigset_t*) all
+int sigpending(sigset_t*) arm,x86,mips
int signalfd4(int fd, const sigset_t* mask, size_t sizemask, int flags) all
# sockets
-int socket(int, int, int) arm,mips
-int socketpair(int, int, int, int*) arm,mips
-int bind(int, struct sockaddr*, int) arm,mips
-int connect(int, struct sockaddr*, socklen_t) arm,mips
-int listen(int, int) arm,mips
-int accept(int, struct sockaddr*, socklen_t*) arm,mips
-int getsockname(int, struct sockaddr*, socklen_t*) arm,mips
-int getpeername(int, struct sockaddr*, socklen_t*) arm,mips
-int sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,mips
-int recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) arm,mips
-int shutdown(int, int) arm,mips
-int setsockopt(int, int, int, const void*, socklen_t) arm,mips
-int getsockopt(int, int, int, void*, socklen_t*) arm,mips
-int sendmsg(int, const struct msghdr*, unsigned int) arm,mips
-int recvmsg(int, struct msghdr*, unsigned int) arm,mips
+int socket(int, int, int) arm,mips,x86_64
+int socketpair(int, int, int, int*) arm,mips,x86_64
+int bind(int, struct sockaddr*, int) arm,mips,x86_64
+int connect(int, struct sockaddr*, socklen_t) arm,mips,x86_64
+int listen(int, int) arm,mips,x86_64
+int accept(int, struct sockaddr*, socklen_t*) arm,mips,x86_64
+int getsockname(int, struct sockaddr*, socklen_t*) arm,mips,x86_64
+int getpeername(int, struct sockaddr*, socklen_t*) arm,mips,x86_64
+int sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,mips,x86_64
+int recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) arm,mips,x86_64
+int shutdown(int, int) arm,mips,x86_64
+int setsockopt(int, int, int, const void*, socklen_t) arm,mips,x86_64
+int getsockopt(int, int, int, void*, socklen_t*) arm,mips,x86_64
+int sendmsg(int, const struct msghdr*, unsigned int) arm,mips,x86_64
+int recvmsg(int, struct msghdr*, unsigned int) arm,mips,x86_64
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
int socket:socketcall:1(int, int, int) x86
diff --git a/libc/arch-x86/include/machine/kernel.h b/libc/arch-x86/include/machine/kernel.h
index 19d1577..d5df7a01 100644
--- a/libc/arch-x86/include/machine/kernel.h
+++ b/libc/arch-x86/include/machine/kernel.h
@@ -1,5 +1,4 @@
-/* bionic/arch-arm/include/machine/kernel.h
-**
+/*
** Copyright 2006-2008, The Android Open Source Project
**
** Redistribution and use in source and binary forms, with or without
diff --git a/libc/arch-x86/syscalls/__brk.S b/libc/arch-x86/syscalls/__brk.S
index b26e187..e3e8bfd 100644
--- a/libc/arch-x86/syscalls/__brk.S
+++ b/libc/arch-x86/syscalls/__brk.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__brk)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__fcntl.S b/libc/arch-x86/syscalls/__fcntl.S
index 328df24..3492b3b 100644
--- a/libc/arch-x86/syscalls/__fcntl.S
+++ b/libc/arch-x86/syscalls/__fcntl.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__fcntl)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__fcntl64.S b/libc/arch-x86/syscalls/__fcntl64.S
index b0fb981..0fc5f21 100644
--- a/libc/arch-x86/syscalls/__fcntl64.S
+++ b/libc/arch-x86/syscalls/__fcntl64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__fcntl64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__fork.S b/libc/arch-x86/syscalls/__fork.S
index 98e00c8..1a20645 100644
--- a/libc/arch-x86/syscalls/__fork.S
+++ b/libc/arch-x86/syscalls/__fork.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__fork)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__fstatfs64.S b/libc/arch-x86/syscalls/__fstatfs64.S
index aeb6863..1e3487f 100644
--- a/libc/arch-x86/syscalls/__fstatfs64.S
+++ b/libc/arch-x86/syscalls/__fstatfs64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__fstatfs64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__getcpu.S b/libc/arch-x86/syscalls/__getcpu.S
index f50782c..159acfc 100644
--- a/libc/arch-x86/syscalls/__getcpu.S
+++ b/libc/arch-x86/syscalls/__getcpu.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__getcpu)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__getcwd.S b/libc/arch-x86/syscalls/__getcwd.S
index 9337342..5479dbf 100644
--- a/libc/arch-x86/syscalls/__getcwd.S
+++ b/libc/arch-x86/syscalls/__getcwd.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__getcwd)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__getpriority.S b/libc/arch-x86/syscalls/__getpriority.S
index 60fa3bb..5d67dbc 100644
--- a/libc/arch-x86/syscalls/__getpriority.S
+++ b/libc/arch-x86/syscalls/__getpriority.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__getpriority)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__ioctl.S b/libc/arch-x86/syscalls/__ioctl.S
index 0e8d189..485d0eb 100644
--- a/libc/arch-x86/syscalls/__ioctl.S
+++ b/libc/arch-x86/syscalls/__ioctl.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__ioctl)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__llseek.S b/libc/arch-x86/syscalls/__llseek.S
index b347886..1f1721e 100644
--- a/libc/arch-x86/syscalls/__llseek.S
+++ b/libc/arch-x86/syscalls/__llseek.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__llseek)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__mmap2.S b/libc/arch-x86/syscalls/__mmap2.S
index 010a989..f97ec38 100644
--- a/libc/arch-x86/syscalls/__mmap2.S
+++ b/libc/arch-x86/syscalls/__mmap2.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__mmap2)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__open.S b/libc/arch-x86/syscalls/__open.S
index 87cda45..f386cae 100644
--- a/libc/arch-x86/syscalls/__open.S
+++ b/libc/arch-x86/syscalls/__open.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__open)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__openat.S b/libc/arch-x86/syscalls/__openat.S
index 31db1dc..335bf3c 100644
--- a/libc/arch-x86/syscalls/__openat.S
+++ b/libc/arch-x86/syscalls/__openat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__openat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__ptrace.S b/libc/arch-x86/syscalls/__ptrace.S
index 1f143cc..ff376a4 100644
--- a/libc/arch-x86/syscalls/__ptrace.S
+++ b/libc/arch-x86/syscalls/__ptrace.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__ptrace)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__reboot.S b/libc/arch-x86/syscalls/__reboot.S
index a32e8a8..cd6ef55 100644
--- a/libc/arch-x86/syscalls/__reboot.S
+++ b/libc/arch-x86/syscalls/__reboot.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__reboot)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__rt_sigaction.S b/libc/arch-x86/syscalls/__rt_sigaction.S
index 957bca1..7eeb922 100644
--- a/libc/arch-x86/syscalls/__rt_sigaction.S
+++ b/libc/arch-x86/syscalls/__rt_sigaction.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__rt_sigaction)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__rt_sigprocmask.S b/libc/arch-x86/syscalls/__rt_sigprocmask.S
index a23e079..111943d 100644
--- a/libc/arch-x86/syscalls/__rt_sigprocmask.S
+++ b/libc/arch-x86/syscalls/__rt_sigprocmask.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__rt_sigprocmask)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__rt_sigtimedwait.S b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
index cf2b2a2..0e23113 100644
--- a/libc/arch-x86/syscalls/__rt_sigtimedwait.S
+++ b/libc/arch-x86/syscalls/__rt_sigtimedwait.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__rt_sigtimedwait)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__sched_getaffinity.S b/libc/arch-x86/syscalls/__sched_getaffinity.S
index da9f08a..5293efd 100644
--- a/libc/arch-x86/syscalls/__sched_getaffinity.S
+++ b/libc/arch-x86/syscalls/__sched_getaffinity.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__sched_getaffinity)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__set_thread_area.S b/libc/arch-x86/syscalls/__set_thread_area.S
index 37f41d0..95f1a5f 100644
--- a/libc/arch-x86/syscalls/__set_thread_area.S
+++ b/libc/arch-x86/syscalls/__set_thread_area.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__set_thread_area)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__setresuid.S b/libc/arch-x86/syscalls/__setresuid.S
index c16d2fb..537c897 100644
--- a/libc/arch-x86/syscalls/__setresuid.S
+++ b/libc/arch-x86/syscalls/__setresuid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__setresuid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__setreuid.S b/libc/arch-x86/syscalls/__setreuid.S
index 2ba521d..bc6cd25 100644
--- a/libc/arch-x86/syscalls/__setreuid.S
+++ b/libc/arch-x86/syscalls/__setreuid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__setreuid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__setuid.S b/libc/arch-x86/syscalls/__setuid.S
index 092ceb0..5a5ff6d 100644
--- a/libc/arch-x86/syscalls/__setuid.S
+++ b/libc/arch-x86/syscalls/__setuid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__setuid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__sigsuspend.S b/libc/arch-x86/syscalls/__sigsuspend.S
index c69665f..6a5c6aa 100644
--- a/libc/arch-x86/syscalls/__sigsuspend.S
+++ b/libc/arch-x86/syscalls/__sigsuspend.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__sigsuspend)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__statfs64.S b/libc/arch-x86/syscalls/__statfs64.S
index 58785ad..f909cda 100644
--- a/libc/arch-x86/syscalls/__statfs64.S
+++ b/libc/arch-x86/syscalls/__statfs64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__statfs64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__sys_clone.S b/libc/arch-x86/syscalls/__sys_clone.S
index 17e7c3b..2a61970 100644
--- a/libc/arch-x86/syscalls/__sys_clone.S
+++ b/libc/arch-x86/syscalls/__sys_clone.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__sys_clone)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__syslog.S b/libc/arch-x86/syscalls/__syslog.S
index 1216d75..2672790 100644
--- a/libc/arch-x86/syscalls/__syslog.S
+++ b/libc/arch-x86/syscalls/__syslog.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__syslog)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__timer_create.S b/libc/arch-x86/syscalls/__timer_create.S
index 1817afc..7bb27ca 100644
--- a/libc/arch-x86/syscalls/__timer_create.S
+++ b/libc/arch-x86/syscalls/__timer_create.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__timer_create)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__timer_delete.S b/libc/arch-x86/syscalls/__timer_delete.S
index 1472a99..9b7ef37 100644
--- a/libc/arch-x86/syscalls/__timer_delete.S
+++ b/libc/arch-x86/syscalls/__timer_delete.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__timer_delete)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__timer_getoverrun.S b/libc/arch-x86/syscalls/__timer_getoverrun.S
index 2204682..e3fb9bb 100644
--- a/libc/arch-x86/syscalls/__timer_getoverrun.S
+++ b/libc/arch-x86/syscalls/__timer_getoverrun.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__timer_getoverrun)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__timer_gettime.S b/libc/arch-x86/syscalls/__timer_gettime.S
index e45e4ef..e409b43 100644
--- a/libc/arch-x86/syscalls/__timer_gettime.S
+++ b/libc/arch-x86/syscalls/__timer_gettime.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__timer_gettime)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__timer_settime.S b/libc/arch-x86/syscalls/__timer_settime.S
index 71a9182..00078e7 100644
--- a/libc/arch-x86/syscalls/__timer_settime.S
+++ b/libc/arch-x86/syscalls/__timer_settime.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__timer_settime)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/__waitid.S b/libc/arch-x86/syscalls/__waitid.S
index 2588b26..65b86fc 100644
--- a/libc/arch-x86/syscalls/__waitid.S
+++ b/libc/arch-x86/syscalls/__waitid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(__waitid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/_exit.S b/libc/arch-x86/syscalls/_exit.S
index 9ce3e71..1c43c75 100644
--- a/libc/arch-x86/syscalls/_exit.S
+++ b/libc/arch-x86/syscalls/_exit.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(_exit)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/_exit_thread.S b/libc/arch-x86/syscalls/_exit_thread.S
index cc12916..e05abca 100644
--- a/libc/arch-x86/syscalls/_exit_thread.S
+++ b/libc/arch-x86/syscalls/_exit_thread.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(_exit_thread)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/_waitpid.S b/libc/arch-x86/syscalls/_waitpid.S
index 8ed7898..d2486d5 100644
--- a/libc/arch-x86/syscalls/_waitpid.S
+++ b/libc/arch-x86/syscalls/_waitpid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(_waitpid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/accept.S b/libc/arch-x86/syscalls/accept.S
index 5678205..6183a08 100644
--- a/libc/arch-x86/syscalls/accept.S
+++ b/libc/arch-x86/syscalls/accept.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(accept)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/access.S b/libc/arch-x86/syscalls/access.S
index a21ec43..50bb47b 100644
--- a/libc/arch-x86/syscalls/access.S
+++ b/libc/arch-x86/syscalls/access.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(access)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/acct.S b/libc/arch-x86/syscalls/acct.S
index d5d2a1a..713c288 100644
--- a/libc/arch-x86/syscalls/acct.S
+++ b/libc/arch-x86/syscalls/acct.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(acct)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/bind.S b/libc/arch-x86/syscalls/bind.S
index 77a4f12..3c6e1bd 100644
--- a/libc/arch-x86/syscalls/bind.S
+++ b/libc/arch-x86/syscalls/bind.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(bind)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/capget.S b/libc/arch-x86/syscalls/capget.S
index f563ce6..69bff27 100644
--- a/libc/arch-x86/syscalls/capget.S
+++ b/libc/arch-x86/syscalls/capget.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(capget)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/capset.S b/libc/arch-x86/syscalls/capset.S
index 7ab426b..0d92ff6 100644
--- a/libc/arch-x86/syscalls/capset.S
+++ b/libc/arch-x86/syscalls/capset.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(capset)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/chdir.S b/libc/arch-x86/syscalls/chdir.S
index bab9614..b408329 100644
--- a/libc/arch-x86/syscalls/chdir.S
+++ b/libc/arch-x86/syscalls/chdir.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(chdir)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/chmod.S b/libc/arch-x86/syscalls/chmod.S
index a3d22c7..348fc7e 100644
--- a/libc/arch-x86/syscalls/chmod.S
+++ b/libc/arch-x86/syscalls/chmod.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(chmod)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/chown.S b/libc/arch-x86/syscalls/chown.S
index 48c2b23..d33e4c7 100644
--- a/libc/arch-x86/syscalls/chown.S
+++ b/libc/arch-x86/syscalls/chown.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(chown)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/chroot.S b/libc/arch-x86/syscalls/chroot.S
index ea640e6..66d47b1 100644
--- a/libc/arch-x86/syscalls/chroot.S
+++ b/libc/arch-x86/syscalls/chroot.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(chroot)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/clock_getres.S b/libc/arch-x86/syscalls/clock_getres.S
index 806b7e4..003e8f6 100644
--- a/libc/arch-x86/syscalls/clock_getres.S
+++ b/libc/arch-x86/syscalls/clock_getres.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(clock_getres)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/clock_gettime.S b/libc/arch-x86/syscalls/clock_gettime.S
index 2f87d12..64b852b 100644
--- a/libc/arch-x86/syscalls/clock_gettime.S
+++ b/libc/arch-x86/syscalls/clock_gettime.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(clock_gettime)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/clock_nanosleep.S b/libc/arch-x86/syscalls/clock_nanosleep.S
index d691301..1090a4a 100644
--- a/libc/arch-x86/syscalls/clock_nanosleep.S
+++ b/libc/arch-x86/syscalls/clock_nanosleep.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(clock_nanosleep)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/clock_settime.S b/libc/arch-x86/syscalls/clock_settime.S
index a13b20a..f4595e7 100644
--- a/libc/arch-x86/syscalls/clock_settime.S
+++ b/libc/arch-x86/syscalls/clock_settime.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(clock_settime)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/close.S b/libc/arch-x86/syscalls/close.S
index 0e80403..93fb7b5 100644
--- a/libc/arch-x86/syscalls/close.S
+++ b/libc/arch-x86/syscalls/close.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(close)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/connect.S b/libc/arch-x86/syscalls/connect.S
index f55d31c..92dd853 100644
--- a/libc/arch-x86/syscalls/connect.S
+++ b/libc/arch-x86/syscalls/connect.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(connect)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/delete_module.S b/libc/arch-x86/syscalls/delete_module.S
index a319310..8957eb1 100644
--- a/libc/arch-x86/syscalls/delete_module.S
+++ b/libc/arch-x86/syscalls/delete_module.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(delete_module)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/dup.S b/libc/arch-x86/syscalls/dup.S
index 7304681..1ac329b 100644
--- a/libc/arch-x86/syscalls/dup.S
+++ b/libc/arch-x86/syscalls/dup.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(dup)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/dup2.S b/libc/arch-x86/syscalls/dup2.S
index d6cee81..3e0dd38 100644
--- a/libc/arch-x86/syscalls/dup2.S
+++ b/libc/arch-x86/syscalls/dup2.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(dup2)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/epoll_create.S b/libc/arch-x86/syscalls/epoll_create.S
index 061f173..4dae863 100644
--- a/libc/arch-x86/syscalls/epoll_create.S
+++ b/libc/arch-x86/syscalls/epoll_create.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(epoll_create)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/epoll_ctl.S b/libc/arch-x86/syscalls/epoll_ctl.S
index 5228da3..0a367f2 100644
--- a/libc/arch-x86/syscalls/epoll_ctl.S
+++ b/libc/arch-x86/syscalls/epoll_ctl.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(epoll_ctl)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/epoll_wait.S b/libc/arch-x86/syscalls/epoll_wait.S
index e395a5e..c1f30a6 100644
--- a/libc/arch-x86/syscalls/epoll_wait.S
+++ b/libc/arch-x86/syscalls/epoll_wait.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(epoll_wait)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/eventfd.S b/libc/arch-x86/syscalls/eventfd.S
index 4e96a7b..d74f628 100644
--- a/libc/arch-x86/syscalls/eventfd.S
+++ b/libc/arch-x86/syscalls/eventfd.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(eventfd)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/execve.S b/libc/arch-x86/syscalls/execve.S
index 3028e8f..117e71a 100644
--- a/libc/arch-x86/syscalls/execve.S
+++ b/libc/arch-x86/syscalls/execve.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(execve)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/faccessat.S b/libc/arch-x86/syscalls/faccessat.S
index c7c3b20..3aab3f3 100644
--- a/libc/arch-x86/syscalls/faccessat.S
+++ b/libc/arch-x86/syscalls/faccessat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(faccessat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fchdir.S b/libc/arch-x86/syscalls/fchdir.S
index 2d6a4fd..1aa07c7 100644
--- a/libc/arch-x86/syscalls/fchdir.S
+++ b/libc/arch-x86/syscalls/fchdir.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fchdir)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fchmod.S b/libc/arch-x86/syscalls/fchmod.S
index d1e2b1b..6ab69d9 100644
--- a/libc/arch-x86/syscalls/fchmod.S
+++ b/libc/arch-x86/syscalls/fchmod.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fchmod)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fchmodat.S b/libc/arch-x86/syscalls/fchmodat.S
index b46522b..9830895 100644
--- a/libc/arch-x86/syscalls/fchmodat.S
+++ b/libc/arch-x86/syscalls/fchmodat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fchmodat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fchown.S b/libc/arch-x86/syscalls/fchown.S
index d09f965..f12d047 100644
--- a/libc/arch-x86/syscalls/fchown.S
+++ b/libc/arch-x86/syscalls/fchown.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fchown)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fchownat.S b/libc/arch-x86/syscalls/fchownat.S
index ad958db..d87654d 100644
--- a/libc/arch-x86/syscalls/fchownat.S
+++ b/libc/arch-x86/syscalls/fchownat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fchownat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fdatasync.S b/libc/arch-x86/syscalls/fdatasync.S
index 7b912aa..9c340d7 100644
--- a/libc/arch-x86/syscalls/fdatasync.S
+++ b/libc/arch-x86/syscalls/fdatasync.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fdatasync)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fgetxattr.S b/libc/arch-x86/syscalls/fgetxattr.S
index e81c257..5eb5426 100644
--- a/libc/arch-x86/syscalls/fgetxattr.S
+++ b/libc/arch-x86/syscalls/fgetxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fgetxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/flistxattr.S b/libc/arch-x86/syscalls/flistxattr.S
index 2d398d1..1ffcbfc 100644
--- a/libc/arch-x86/syscalls/flistxattr.S
+++ b/libc/arch-x86/syscalls/flistxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(flistxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/flock.S b/libc/arch-x86/syscalls/flock.S
index cad1420..55cf6d7 100644
--- a/libc/arch-x86/syscalls/flock.S
+++ b/libc/arch-x86/syscalls/flock.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(flock)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fremovexattr.S b/libc/arch-x86/syscalls/fremovexattr.S
index 837efb8..8869a74 100644
--- a/libc/arch-x86/syscalls/fremovexattr.S
+++ b/libc/arch-x86/syscalls/fremovexattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fremovexattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fsetxattr.S b/libc/arch-x86/syscalls/fsetxattr.S
index ae0e0f8..4af3c61 100644
--- a/libc/arch-x86/syscalls/fsetxattr.S
+++ b/libc/arch-x86/syscalls/fsetxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fsetxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fstat.S b/libc/arch-x86/syscalls/fstat.S
index 4fd1d5a..8a6a5a7 100644
--- a/libc/arch-x86/syscalls/fstat.S
+++ b/libc/arch-x86/syscalls/fstat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fstat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fstatat.S b/libc/arch-x86/syscalls/fstatat.S
index f07b405..5dc6d34 100644
--- a/libc/arch-x86/syscalls/fstatat.S
+++ b/libc/arch-x86/syscalls/fstatat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fstatat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/fsync.S b/libc/arch-x86/syscalls/fsync.S
index f9e4bc3..6671c07 100644
--- a/libc/arch-x86/syscalls/fsync.S
+++ b/libc/arch-x86/syscalls/fsync.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(fsync)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/ftruncate.S b/libc/arch-x86/syscalls/ftruncate.S
index 9d27c14..36e1158 100644
--- a/libc/arch-x86/syscalls/ftruncate.S
+++ b/libc/arch-x86/syscalls/ftruncate.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(ftruncate)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/ftruncate64.S b/libc/arch-x86/syscalls/ftruncate64.S
index a121add..9b3f00e 100644
--- a/libc/arch-x86/syscalls/ftruncate64.S
+++ b/libc/arch-x86/syscalls/ftruncate64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(ftruncate64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/futex.S b/libc/arch-x86/syscalls/futex.S
index 7f0684f..f76a4dc 100644
--- a/libc/arch-x86/syscalls/futex.S
+++ b/libc/arch-x86/syscalls/futex.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(futex)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getdents.S b/libc/arch-x86/syscalls/getdents.S
index c17a5a7..ffd6019 100644
--- a/libc/arch-x86/syscalls/getdents.S
+++ b/libc/arch-x86/syscalls/getdents.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getdents)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getegid.S b/libc/arch-x86/syscalls/getegid.S
index 0f055e1..78bb02d 100644
--- a/libc/arch-x86/syscalls/getegid.S
+++ b/libc/arch-x86/syscalls/getegid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getegid)
movl $__NR_getegid32, %eax
diff --git a/libc/arch-x86/syscalls/geteuid.S b/libc/arch-x86/syscalls/geteuid.S
index a308137..b62ada1 100644
--- a/libc/arch-x86/syscalls/geteuid.S
+++ b/libc/arch-x86/syscalls/geteuid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(geteuid)
movl $__NR_geteuid32, %eax
diff --git a/libc/arch-x86/syscalls/getgid.S b/libc/arch-x86/syscalls/getgid.S
index 0b43991..2d20e62 100644
--- a/libc/arch-x86/syscalls/getgid.S
+++ b/libc/arch-x86/syscalls/getgid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getgid)
movl $__NR_getgid32, %eax
diff --git a/libc/arch-x86/syscalls/getgroups.S b/libc/arch-x86/syscalls/getgroups.S
index c92a692..e7a1ef5 100644
--- a/libc/arch-x86/syscalls/getgroups.S
+++ b/libc/arch-x86/syscalls/getgroups.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getgroups)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getitimer.S b/libc/arch-x86/syscalls/getitimer.S
index 04f01c0..56a2bbf 100644
--- a/libc/arch-x86/syscalls/getitimer.S
+++ b/libc/arch-x86/syscalls/getitimer.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getitimer)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getpeername.S b/libc/arch-x86/syscalls/getpeername.S
index 1a385ad..c94e1cf 100644
--- a/libc/arch-x86/syscalls/getpeername.S
+++ b/libc/arch-x86/syscalls/getpeername.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getpeername)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getpgid.S b/libc/arch-x86/syscalls/getpgid.S
index d1a8d26..98a5816 100644
--- a/libc/arch-x86/syscalls/getpgid.S
+++ b/libc/arch-x86/syscalls/getpgid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getpgid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getpid.S b/libc/arch-x86/syscalls/getpid.S
index f9e3613..15cbe48 100644
--- a/libc/arch-x86/syscalls/getpid.S
+++ b/libc/arch-x86/syscalls/getpid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getpid)
movl $__NR_getpid, %eax
diff --git a/libc/arch-x86/syscalls/getppid.S b/libc/arch-x86/syscalls/getppid.S
index afbc81a..5c5fcfc 100644
--- a/libc/arch-x86/syscalls/getppid.S
+++ b/libc/arch-x86/syscalls/getppid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getppid)
movl $__NR_getppid, %eax
diff --git a/libc/arch-x86/syscalls/getresgid.S b/libc/arch-x86/syscalls/getresgid.S
index c1adb5c..4cef66c 100644
--- a/libc/arch-x86/syscalls/getresgid.S
+++ b/libc/arch-x86/syscalls/getresgid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getresgid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getresuid.S b/libc/arch-x86/syscalls/getresuid.S
index 4bbf637..039d188 100644
--- a/libc/arch-x86/syscalls/getresuid.S
+++ b/libc/arch-x86/syscalls/getresuid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getresuid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getrlimit.S b/libc/arch-x86/syscalls/getrlimit.S
index 09b2fd5..3cfbfb7 100644
--- a/libc/arch-x86/syscalls/getrlimit.S
+++ b/libc/arch-x86/syscalls/getrlimit.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getrlimit)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getrusage.S b/libc/arch-x86/syscalls/getrusage.S
index f180213..8bf1501 100644
--- a/libc/arch-x86/syscalls/getrusage.S
+++ b/libc/arch-x86/syscalls/getrusage.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getrusage)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getsid.S b/libc/arch-x86/syscalls/getsid.S
index 5b1a32f..e04f035 100644
--- a/libc/arch-x86/syscalls/getsid.S
+++ b/libc/arch-x86/syscalls/getsid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getsid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getsockname.S b/libc/arch-x86/syscalls/getsockname.S
index 9e7cec1..330e0ec 100644
--- a/libc/arch-x86/syscalls/getsockname.S
+++ b/libc/arch-x86/syscalls/getsockname.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getsockname)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getsockopt.S b/libc/arch-x86/syscalls/getsockopt.S
index c210749..931d715 100644
--- a/libc/arch-x86/syscalls/getsockopt.S
+++ b/libc/arch-x86/syscalls/getsockopt.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getsockopt)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/gettid.S b/libc/arch-x86/syscalls/gettid.S
index d14f320..a2cb813 100644
--- a/libc/arch-x86/syscalls/gettid.S
+++ b/libc/arch-x86/syscalls/gettid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(gettid)
movl $__NR_gettid, %eax
diff --git a/libc/arch-x86/syscalls/gettimeofday.S b/libc/arch-x86/syscalls/gettimeofday.S
index 2fa118d..bdffd67 100644
--- a/libc/arch-x86/syscalls/gettimeofday.S
+++ b/libc/arch-x86/syscalls/gettimeofday.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(gettimeofday)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/getuid.S b/libc/arch-x86/syscalls/getuid.S
index 08b9cce..ab44d51 100644
--- a/libc/arch-x86/syscalls/getuid.S
+++ b/libc/arch-x86/syscalls/getuid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getuid)
movl $__NR_getuid32, %eax
diff --git a/libc/arch-x86/syscalls/getxattr.S b/libc/arch-x86/syscalls/getxattr.S
index 64990ef..e99efa1 100644
--- a/libc/arch-x86/syscalls/getxattr.S
+++ b/libc/arch-x86/syscalls/getxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(getxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/init_module.S b/libc/arch-x86/syscalls/init_module.S
index 9d1daad..a006cff 100644
--- a/libc/arch-x86/syscalls/init_module.S
+++ b/libc/arch-x86/syscalls/init_module.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(init_module)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/inotify_add_watch.S b/libc/arch-x86/syscalls/inotify_add_watch.S
index fc9c087..5401e66 100644
--- a/libc/arch-x86/syscalls/inotify_add_watch.S
+++ b/libc/arch-x86/syscalls/inotify_add_watch.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(inotify_add_watch)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/inotify_init.S b/libc/arch-x86/syscalls/inotify_init.S
index ffc4a2a..254bc06 100644
--- a/libc/arch-x86/syscalls/inotify_init.S
+++ b/libc/arch-x86/syscalls/inotify_init.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(inotify_init)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/inotify_rm_watch.S b/libc/arch-x86/syscalls/inotify_rm_watch.S
index 08d208c..7b173f9 100644
--- a/libc/arch-x86/syscalls/inotify_rm_watch.S
+++ b/libc/arch-x86/syscalls/inotify_rm_watch.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(inotify_rm_watch)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/ioprio_get.S b/libc/arch-x86/syscalls/ioprio_get.S
index 63f1111..de356a6 100644
--- a/libc/arch-x86/syscalls/ioprio_get.S
+++ b/libc/arch-x86/syscalls/ioprio_get.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(ioprio_get)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/ioprio_set.S b/libc/arch-x86/syscalls/ioprio_set.S
index 2b4d87e..98dbf5d 100644
--- a/libc/arch-x86/syscalls/ioprio_set.S
+++ b/libc/arch-x86/syscalls/ioprio_set.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(ioprio_set)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/kill.S b/libc/arch-x86/syscalls/kill.S
index 260fe73..4153ef2 100644
--- a/libc/arch-x86/syscalls/kill.S
+++ b/libc/arch-x86/syscalls/kill.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(kill)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/klogctl.S b/libc/arch-x86/syscalls/klogctl.S
index 32db1af..a923fd7 100644
--- a/libc/arch-x86/syscalls/klogctl.S
+++ b/libc/arch-x86/syscalls/klogctl.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(klogctl)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/lchown.S b/libc/arch-x86/syscalls/lchown.S
index 9bd1c9a..9318a64 100644
--- a/libc/arch-x86/syscalls/lchown.S
+++ b/libc/arch-x86/syscalls/lchown.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(lchown)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/lgetxattr.S b/libc/arch-x86/syscalls/lgetxattr.S
index bb5a7ba..3fb0609 100644
--- a/libc/arch-x86/syscalls/lgetxattr.S
+++ b/libc/arch-x86/syscalls/lgetxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(lgetxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/link.S b/libc/arch-x86/syscalls/link.S
index 4419149..661adf9 100644
--- a/libc/arch-x86/syscalls/link.S
+++ b/libc/arch-x86/syscalls/link.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(link)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/listen.S b/libc/arch-x86/syscalls/listen.S
index 0c4d6b0..4eda67c 100644
--- a/libc/arch-x86/syscalls/listen.S
+++ b/libc/arch-x86/syscalls/listen.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(listen)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/listxattr.S b/libc/arch-x86/syscalls/listxattr.S
index 059c2aa..456f2dd 100644
--- a/libc/arch-x86/syscalls/listxattr.S
+++ b/libc/arch-x86/syscalls/listxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(listxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/llistxattr.S b/libc/arch-x86/syscalls/llistxattr.S
index a6023eb..5892afa 100644
--- a/libc/arch-x86/syscalls/llistxattr.S
+++ b/libc/arch-x86/syscalls/llistxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(llistxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/lremovexattr.S b/libc/arch-x86/syscalls/lremovexattr.S
index 2bfd91b..1a110ab 100644
--- a/libc/arch-x86/syscalls/lremovexattr.S
+++ b/libc/arch-x86/syscalls/lremovexattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(lremovexattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/lseek.S b/libc/arch-x86/syscalls/lseek.S
index d7b3b19..03d9ee7 100644
--- a/libc/arch-x86/syscalls/lseek.S
+++ b/libc/arch-x86/syscalls/lseek.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(lseek)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/lsetxattr.S b/libc/arch-x86/syscalls/lsetxattr.S
index 05790e7..4468df8 100644
--- a/libc/arch-x86/syscalls/lsetxattr.S
+++ b/libc/arch-x86/syscalls/lsetxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(lsetxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/lstat.S b/libc/arch-x86/syscalls/lstat.S
index 7b8187e..bae1089 100644
--- a/libc/arch-x86/syscalls/lstat.S
+++ b/libc/arch-x86/syscalls/lstat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(lstat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/madvise.S b/libc/arch-x86/syscalls/madvise.S
index bf8b518..8326429 100644
--- a/libc/arch-x86/syscalls/madvise.S
+++ b/libc/arch-x86/syscalls/madvise.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(madvise)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mincore.S b/libc/arch-x86/syscalls/mincore.S
index 42a612a..3229042 100644
--- a/libc/arch-x86/syscalls/mincore.S
+++ b/libc/arch-x86/syscalls/mincore.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mincore)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mkdir.S b/libc/arch-x86/syscalls/mkdir.S
index d8cdbd4..ce0707a 100644
--- a/libc/arch-x86/syscalls/mkdir.S
+++ b/libc/arch-x86/syscalls/mkdir.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mkdir)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mkdirat.S b/libc/arch-x86/syscalls/mkdirat.S
index 844a2b9..85d48aa 100644
--- a/libc/arch-x86/syscalls/mkdirat.S
+++ b/libc/arch-x86/syscalls/mkdirat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mkdirat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mknod.S b/libc/arch-x86/syscalls/mknod.S
index eebef21..5e1e7ad 100644
--- a/libc/arch-x86/syscalls/mknod.S
+++ b/libc/arch-x86/syscalls/mknod.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mknod)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mlock.S b/libc/arch-x86/syscalls/mlock.S
index 9c91682..8ee3b19 100644
--- a/libc/arch-x86/syscalls/mlock.S
+++ b/libc/arch-x86/syscalls/mlock.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mlock)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mlockall.S b/libc/arch-x86/syscalls/mlockall.S
index 6bf571b..253dc67 100644
--- a/libc/arch-x86/syscalls/mlockall.S
+++ b/libc/arch-x86/syscalls/mlockall.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mlockall)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mount.S b/libc/arch-x86/syscalls/mount.S
index 255f223..b5b7c8b 100644
--- a/libc/arch-x86/syscalls/mount.S
+++ b/libc/arch-x86/syscalls/mount.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mount)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mprotect.S b/libc/arch-x86/syscalls/mprotect.S
index c2b6a0f..db8ea5d 100644
--- a/libc/arch-x86/syscalls/mprotect.S
+++ b/libc/arch-x86/syscalls/mprotect.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mprotect)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/mremap.S b/libc/arch-x86/syscalls/mremap.S
index 6c366dc..d2868b4 100644
--- a/libc/arch-x86/syscalls/mremap.S
+++ b/libc/arch-x86/syscalls/mremap.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(mremap)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/msync.S b/libc/arch-x86/syscalls/msync.S
index 15b052d..b19741c 100644
--- a/libc/arch-x86/syscalls/msync.S
+++ b/libc/arch-x86/syscalls/msync.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(msync)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/munlock.S b/libc/arch-x86/syscalls/munlock.S
index 1c7db58..506538b 100644
--- a/libc/arch-x86/syscalls/munlock.S
+++ b/libc/arch-x86/syscalls/munlock.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(munlock)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/munlockall.S b/libc/arch-x86/syscalls/munlockall.S
index 9e38a91..940a11a 100644
--- a/libc/arch-x86/syscalls/munlockall.S
+++ b/libc/arch-x86/syscalls/munlockall.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(munlockall)
movl $__NR_munlockall, %eax
diff --git a/libc/arch-x86/syscalls/munmap.S b/libc/arch-x86/syscalls/munmap.S
index a62eb92..7fbb0bf 100644
--- a/libc/arch-x86/syscalls/munmap.S
+++ b/libc/arch-x86/syscalls/munmap.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(munmap)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/nanosleep.S b/libc/arch-x86/syscalls/nanosleep.S
index 8cf0d8f..fb834d2 100644
--- a/libc/arch-x86/syscalls/nanosleep.S
+++ b/libc/arch-x86/syscalls/nanosleep.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(nanosleep)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/pause.S b/libc/arch-x86/syscalls/pause.S
index ff9d76c..018208e 100644
--- a/libc/arch-x86/syscalls/pause.S
+++ b/libc/arch-x86/syscalls/pause.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(pause)
movl $__NR_pause, %eax
diff --git a/libc/arch-x86/syscalls/perf_event_open.S b/libc/arch-x86/syscalls/perf_event_open.S
index fa39a2a..353ae93 100644
--- a/libc/arch-x86/syscalls/perf_event_open.S
+++ b/libc/arch-x86/syscalls/perf_event_open.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(perf_event_open)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/personality.S b/libc/arch-x86/syscalls/personality.S
index 045f3de..00c048b 100644
--- a/libc/arch-x86/syscalls/personality.S
+++ b/libc/arch-x86/syscalls/personality.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(personality)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/pipe.S b/libc/arch-x86/syscalls/pipe.S
index b906e6d..10ecee1 100644
--- a/libc/arch-x86/syscalls/pipe.S
+++ b/libc/arch-x86/syscalls/pipe.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(pipe)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/pipe2.S b/libc/arch-x86/syscalls/pipe2.S
index bf3ccf6..eaa4c5a 100644
--- a/libc/arch-x86/syscalls/pipe2.S
+++ b/libc/arch-x86/syscalls/pipe2.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(pipe2)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/poll.S b/libc/arch-x86/syscalls/poll.S
index 3261857..4678292 100644
--- a/libc/arch-x86/syscalls/poll.S
+++ b/libc/arch-x86/syscalls/poll.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(poll)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/prctl.S b/libc/arch-x86/syscalls/prctl.S
index bcaf2d8..9fa9fbb 100644
--- a/libc/arch-x86/syscalls/prctl.S
+++ b/libc/arch-x86/syscalls/prctl.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(prctl)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/pread64.S b/libc/arch-x86/syscalls/pread64.S
index b9fcb54..6f79216 100644
--- a/libc/arch-x86/syscalls/pread64.S
+++ b/libc/arch-x86/syscalls/pread64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(pread64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/pwrite64.S b/libc/arch-x86/syscalls/pwrite64.S
index f689cc6..ca71e0a 100644
--- a/libc/arch-x86/syscalls/pwrite64.S
+++ b/libc/arch-x86/syscalls/pwrite64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(pwrite64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/read.S b/libc/arch-x86/syscalls/read.S
index bccc1bb..d817191 100644
--- a/libc/arch-x86/syscalls/read.S
+++ b/libc/arch-x86/syscalls/read.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(read)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/readahead.S b/libc/arch-x86/syscalls/readahead.S
index e72cc7a..0c51042 100644
--- a/libc/arch-x86/syscalls/readahead.S
+++ b/libc/arch-x86/syscalls/readahead.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(readahead)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/readlink.S b/libc/arch-x86/syscalls/readlink.S
index 7444728..298b58e 100644
--- a/libc/arch-x86/syscalls/readlink.S
+++ b/libc/arch-x86/syscalls/readlink.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(readlink)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/readv.S b/libc/arch-x86/syscalls/readv.S
index 6ff3002..ff8f15c 100644
--- a/libc/arch-x86/syscalls/readv.S
+++ b/libc/arch-x86/syscalls/readv.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(readv)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/recvfrom.S b/libc/arch-x86/syscalls/recvfrom.S
index f3d9d6a..fe42037 100644
--- a/libc/arch-x86/syscalls/recvfrom.S
+++ b/libc/arch-x86/syscalls/recvfrom.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(recvfrom)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/recvmsg.S b/libc/arch-x86/syscalls/recvmsg.S
index 9c4f9e2..da7a938 100644
--- a/libc/arch-x86/syscalls/recvmsg.S
+++ b/libc/arch-x86/syscalls/recvmsg.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(recvmsg)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/removexattr.S b/libc/arch-x86/syscalls/removexattr.S
index a086eb7..f61c1d2 100644
--- a/libc/arch-x86/syscalls/removexattr.S
+++ b/libc/arch-x86/syscalls/removexattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(removexattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/rename.S b/libc/arch-x86/syscalls/rename.S
index 9f40818..a3d2931 100644
--- a/libc/arch-x86/syscalls/rename.S
+++ b/libc/arch-x86/syscalls/rename.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(rename)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/renameat.S b/libc/arch-x86/syscalls/renameat.S
index e3ffe7b..f08d89d 100644
--- a/libc/arch-x86/syscalls/renameat.S
+++ b/libc/arch-x86/syscalls/renameat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(renameat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/rmdir.S b/libc/arch-x86/syscalls/rmdir.S
index 627c41a..e4cb7be 100644
--- a/libc/arch-x86/syscalls/rmdir.S
+++ b/libc/arch-x86/syscalls/rmdir.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(rmdir)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_get_priority_max.S b/libc/arch-x86/syscalls/sched_get_priority_max.S
index fb696cc..dd02198 100644
--- a/libc/arch-x86/syscalls/sched_get_priority_max.S
+++ b/libc/arch-x86/syscalls/sched_get_priority_max.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_get_priority_max)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_get_priority_min.S b/libc/arch-x86/syscalls/sched_get_priority_min.S
index f1884f1..4baddce 100644
--- a/libc/arch-x86/syscalls/sched_get_priority_min.S
+++ b/libc/arch-x86/syscalls/sched_get_priority_min.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_get_priority_min)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_getparam.S b/libc/arch-x86/syscalls/sched_getparam.S
index 0214c6c..bc54f24 100644
--- a/libc/arch-x86/syscalls/sched_getparam.S
+++ b/libc/arch-x86/syscalls/sched_getparam.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_getparam)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_getscheduler.S b/libc/arch-x86/syscalls/sched_getscheduler.S
index aaba953..d117a7b 100644
--- a/libc/arch-x86/syscalls/sched_getscheduler.S
+++ b/libc/arch-x86/syscalls/sched_getscheduler.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_getscheduler)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_rr_get_interval.S b/libc/arch-x86/syscalls/sched_rr_get_interval.S
index c2745c7..c6ca520 100644
--- a/libc/arch-x86/syscalls/sched_rr_get_interval.S
+++ b/libc/arch-x86/syscalls/sched_rr_get_interval.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_rr_get_interval)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_setaffinity.S b/libc/arch-x86/syscalls/sched_setaffinity.S
index 40f09f2..39dadb9 100644
--- a/libc/arch-x86/syscalls/sched_setaffinity.S
+++ b/libc/arch-x86/syscalls/sched_setaffinity.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_setaffinity)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_setparam.S b/libc/arch-x86/syscalls/sched_setparam.S
index b3c2c1f..d0700cd 100644
--- a/libc/arch-x86/syscalls/sched_setparam.S
+++ b/libc/arch-x86/syscalls/sched_setparam.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_setparam)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_setscheduler.S b/libc/arch-x86/syscalls/sched_setscheduler.S
index c57ed7b..ee3bd8e 100644
--- a/libc/arch-x86/syscalls/sched_setscheduler.S
+++ b/libc/arch-x86/syscalls/sched_setscheduler.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_setscheduler)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sched_yield.S b/libc/arch-x86/syscalls/sched_yield.S
index e40e2da..7bd58a8 100644
--- a/libc/arch-x86/syscalls/sched_yield.S
+++ b/libc/arch-x86/syscalls/sched_yield.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sched_yield)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/select.S b/libc/arch-x86/syscalls/select.S
index 1f19918..821ff4d 100644
--- a/libc/arch-x86/syscalls/select.S
+++ b/libc/arch-x86/syscalls/select.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(select)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sendfile.S b/libc/arch-x86/syscalls/sendfile.S
index fed0456..f85fb13 100644
--- a/libc/arch-x86/syscalls/sendfile.S
+++ b/libc/arch-x86/syscalls/sendfile.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sendfile)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sendfile64.S b/libc/arch-x86/syscalls/sendfile64.S
index 9731806..49b14f8 100644
--- a/libc/arch-x86/syscalls/sendfile64.S
+++ b/libc/arch-x86/syscalls/sendfile64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sendfile64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sendmsg.S b/libc/arch-x86/syscalls/sendmsg.S
index 9b9dee1..dd087ef 100644
--- a/libc/arch-x86/syscalls/sendmsg.S
+++ b/libc/arch-x86/syscalls/sendmsg.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sendmsg)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sendto.S b/libc/arch-x86/syscalls/sendto.S
index 315ed4c..9b820ff 100644
--- a/libc/arch-x86/syscalls/sendto.S
+++ b/libc/arch-x86/syscalls/sendto.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sendto)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setgid.S b/libc/arch-x86/syscalls/setgid.S
index 4704047..534f170 100644
--- a/libc/arch-x86/syscalls/setgid.S
+++ b/libc/arch-x86/syscalls/setgid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setgid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setgroups.S b/libc/arch-x86/syscalls/setgroups.S
index f55d84f..3c9e621 100644
--- a/libc/arch-x86/syscalls/setgroups.S
+++ b/libc/arch-x86/syscalls/setgroups.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setgroups)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setitimer.S b/libc/arch-x86/syscalls/setitimer.S
index 713c5c6..0da630e 100644
--- a/libc/arch-x86/syscalls/setitimer.S
+++ b/libc/arch-x86/syscalls/setitimer.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setitimer)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setpgid.S b/libc/arch-x86/syscalls/setpgid.S
index f90001a..ed388ab 100644
--- a/libc/arch-x86/syscalls/setpgid.S
+++ b/libc/arch-x86/syscalls/setpgid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setpgid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setpriority.S b/libc/arch-x86/syscalls/setpriority.S
index 973302e..5a32678 100644
--- a/libc/arch-x86/syscalls/setpriority.S
+++ b/libc/arch-x86/syscalls/setpriority.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setpriority)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setregid.S b/libc/arch-x86/syscalls/setregid.S
index 6842540..3d54ab4 100644
--- a/libc/arch-x86/syscalls/setregid.S
+++ b/libc/arch-x86/syscalls/setregid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setregid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setresgid.S b/libc/arch-x86/syscalls/setresgid.S
index ce598c1..ee1fb72 100644
--- a/libc/arch-x86/syscalls/setresgid.S
+++ b/libc/arch-x86/syscalls/setresgid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setresgid)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setrlimit.S b/libc/arch-x86/syscalls/setrlimit.S
index 0c11b75..ace57ac 100644
--- a/libc/arch-x86/syscalls/setrlimit.S
+++ b/libc/arch-x86/syscalls/setrlimit.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setrlimit)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setsid.S b/libc/arch-x86/syscalls/setsid.S
index 235b4fb..f26e95d 100644
--- a/libc/arch-x86/syscalls/setsid.S
+++ b/libc/arch-x86/syscalls/setsid.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setsid)
movl $__NR_setsid, %eax
diff --git a/libc/arch-x86/syscalls/setsockopt.S b/libc/arch-x86/syscalls/setsockopt.S
index 6219859..128b69e 100644
--- a/libc/arch-x86/syscalls/setsockopt.S
+++ b/libc/arch-x86/syscalls/setsockopt.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setsockopt)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/settimeofday.S b/libc/arch-x86/syscalls/settimeofday.S
index f06aee7..8d27b7d 100644
--- a/libc/arch-x86/syscalls/settimeofday.S
+++ b/libc/arch-x86/syscalls/settimeofday.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(settimeofday)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/setxattr.S b/libc/arch-x86/syscalls/setxattr.S
index f6110cc..0786530 100644
--- a/libc/arch-x86/syscalls/setxattr.S
+++ b/libc/arch-x86/syscalls/setxattr.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(setxattr)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/shutdown.S b/libc/arch-x86/syscalls/shutdown.S
index 997138c..456f7ab 100644
--- a/libc/arch-x86/syscalls/shutdown.S
+++ b/libc/arch-x86/syscalls/shutdown.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(shutdown)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sigaction.S b/libc/arch-x86/syscalls/sigaction.S
index 499c821..842f574 100644
--- a/libc/arch-x86/syscalls/sigaction.S
+++ b/libc/arch-x86/syscalls/sigaction.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sigaction)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sigaltstack.S b/libc/arch-x86/syscalls/sigaltstack.S
index 7cdd1eb..346ff07 100644
--- a/libc/arch-x86/syscalls/sigaltstack.S
+++ b/libc/arch-x86/syscalls/sigaltstack.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sigaltstack)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/signalfd4.S b/libc/arch-x86/syscalls/signalfd4.S
index 399ad35..0e9ed71 100644
--- a/libc/arch-x86/syscalls/signalfd4.S
+++ b/libc/arch-x86/syscalls/signalfd4.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(signalfd4)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sigpending.S b/libc/arch-x86/syscalls/sigpending.S
index e26f189..70c3ec4 100644
--- a/libc/arch-x86/syscalls/sigpending.S
+++ b/libc/arch-x86/syscalls/sigpending.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sigpending)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sigprocmask.S b/libc/arch-x86/syscalls/sigprocmask.S
index fb12ea2..0ac052e 100644
--- a/libc/arch-x86/syscalls/sigprocmask.S
+++ b/libc/arch-x86/syscalls/sigprocmask.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sigprocmask)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/socket.S b/libc/arch-x86/syscalls/socket.S
index b7a20de..d1bb6ac 100644
--- a/libc/arch-x86/syscalls/socket.S
+++ b/libc/arch-x86/syscalls/socket.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(socket)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/socketpair.S b/libc/arch-x86/syscalls/socketpair.S
index 02c02ac..14931f7 100644
--- a/libc/arch-x86/syscalls/socketpair.S
+++ b/libc/arch-x86/syscalls/socketpair.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(socketpair)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/stat.S b/libc/arch-x86/syscalls/stat.S
index 2cdf1a0..07cbbf4 100644
--- a/libc/arch-x86/syscalls/stat.S
+++ b/libc/arch-x86/syscalls/stat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(stat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/swapoff.S b/libc/arch-x86/syscalls/swapoff.S
index f2d6ddb..203e324 100644
--- a/libc/arch-x86/syscalls/swapoff.S
+++ b/libc/arch-x86/syscalls/swapoff.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(swapoff)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/swapon.S b/libc/arch-x86/syscalls/swapon.S
index 08602fb..b1b7c8c 100644
--- a/libc/arch-x86/syscalls/swapon.S
+++ b/libc/arch-x86/syscalls/swapon.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(swapon)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/symlink.S b/libc/arch-x86/syscalls/symlink.S
index 6c27dc1..d787593 100644
--- a/libc/arch-x86/syscalls/symlink.S
+++ b/libc/arch-x86/syscalls/symlink.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(symlink)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sync.S b/libc/arch-x86/syscalls/sync.S
index d2a4691..9e6d43d 100644
--- a/libc/arch-x86/syscalls/sync.S
+++ b/libc/arch-x86/syscalls/sync.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sync)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/sysinfo.S b/libc/arch-x86/syscalls/sysinfo.S
index b0fcd1d..5e53621 100644
--- a/libc/arch-x86/syscalls/sysinfo.S
+++ b/libc/arch-x86/syscalls/sysinfo.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(sysinfo)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/tgkill.S b/libc/arch-x86/syscalls/tgkill.S
index ac8e7f6..b2467a0 100644
--- a/libc/arch-x86/syscalls/tgkill.S
+++ b/libc/arch-x86/syscalls/tgkill.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(tgkill)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/timerfd_create.S b/libc/arch-x86/syscalls/timerfd_create.S
index 801f8a7..09e5b49 100644
--- a/libc/arch-x86/syscalls/timerfd_create.S
+++ b/libc/arch-x86/syscalls/timerfd_create.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(timerfd_create)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/timerfd_gettime.S b/libc/arch-x86/syscalls/timerfd_gettime.S
index fde17be..3f81098 100644
--- a/libc/arch-x86/syscalls/timerfd_gettime.S
+++ b/libc/arch-x86/syscalls/timerfd_gettime.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(timerfd_gettime)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/timerfd_settime.S b/libc/arch-x86/syscalls/timerfd_settime.S
index 5a5f3e4..367f652 100644
--- a/libc/arch-x86/syscalls/timerfd_settime.S
+++ b/libc/arch-x86/syscalls/timerfd_settime.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(timerfd_settime)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/times.S b/libc/arch-x86/syscalls/times.S
index 62f3039..04514dd 100644
--- a/libc/arch-x86/syscalls/times.S
+++ b/libc/arch-x86/syscalls/times.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(times)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/tkill.S b/libc/arch-x86/syscalls/tkill.S
index 38a7a80..9237e0a 100644
--- a/libc/arch-x86/syscalls/tkill.S
+++ b/libc/arch-x86/syscalls/tkill.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(tkill)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/truncate.S b/libc/arch-x86/syscalls/truncate.S
index ace7128..442e08c 100644
--- a/libc/arch-x86/syscalls/truncate.S
+++ b/libc/arch-x86/syscalls/truncate.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(truncate)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/truncate64.S b/libc/arch-x86/syscalls/truncate64.S
index f9118bb..04f794a 100644
--- a/libc/arch-x86/syscalls/truncate64.S
+++ b/libc/arch-x86/syscalls/truncate64.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(truncate64)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/umask.S b/libc/arch-x86/syscalls/umask.S
index f238975..4be0b47 100644
--- a/libc/arch-x86/syscalls/umask.S
+++ b/libc/arch-x86/syscalls/umask.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(umask)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/umount2.S b/libc/arch-x86/syscalls/umount2.S
index 3bc04c8..2540ac8 100644
--- a/libc/arch-x86/syscalls/umount2.S
+++ b/libc/arch-x86/syscalls/umount2.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(umount2)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/uname.S b/libc/arch-x86/syscalls/uname.S
index 00c1a0c..ef27a6d 100644
--- a/libc/arch-x86/syscalls/uname.S
+++ b/libc/arch-x86/syscalls/uname.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(uname)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/unlink.S b/libc/arch-x86/syscalls/unlink.S
index 60e7b47..fe63fe4 100644
--- a/libc/arch-x86/syscalls/unlink.S
+++ b/libc/arch-x86/syscalls/unlink.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(unlink)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/unlinkat.S b/libc/arch-x86/syscalls/unlinkat.S
index 2e1a04f..e17fb50 100644
--- a/libc/arch-x86/syscalls/unlinkat.S
+++ b/libc/arch-x86/syscalls/unlinkat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(unlinkat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/unshare.S b/libc/arch-x86/syscalls/unshare.S
index f5b9a44..aea9fba 100644
--- a/libc/arch-x86/syscalls/unshare.S
+++ b/libc/arch-x86/syscalls/unshare.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(unshare)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/utimensat.S b/libc/arch-x86/syscalls/utimensat.S
index ab31922..1318091 100644
--- a/libc/arch-x86/syscalls/utimensat.S
+++ b/libc/arch-x86/syscalls/utimensat.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(utimensat)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/utimes.S b/libc/arch-x86/syscalls/utimes.S
index 4ca4a8d..4eafb88 100644
--- a/libc/arch-x86/syscalls/utimes.S
+++ b/libc/arch-x86/syscalls/utimes.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(utimes)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/wait4.S b/libc/arch-x86/syscalls/wait4.S
index 9de704a..d9d3ff4 100644
--- a/libc/arch-x86/syscalls/wait4.S
+++ b/libc/arch-x86/syscalls/wait4.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(wait4)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/write.S b/libc/arch-x86/syscalls/write.S
index 11d0c72..e0cac67 100644
--- a/libc/arch-x86/syscalls/write.S
+++ b/libc/arch-x86/syscalls/write.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(write)
pushl %ebx
diff --git a/libc/arch-x86/syscalls/writev.S b/libc/arch-x86/syscalls/writev.S
index a158a14..e8dab42 100644
--- a/libc/arch-x86/syscalls/writev.S
+++ b/libc/arch-x86/syscalls/writev.S
@@ -1,7 +1,7 @@
/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
#include <linux/err.h>
#include <machine/asm.h>
-#include <asm/unistd.h>
ENTRY(writev)
pushl %ebx
diff --git a/libc/arch-x86_64/syscalls.mk b/libc/arch-x86_64/syscalls.mk
new file mode 100644
index 0000000..5a7a880
--- /dev/null
+++ b/libc/arch-x86_64/syscalls.mk
@@ -0,0 +1,203 @@
+# Auto-generated by gensyscalls.py. Do not edit.
+syscall_src :=
+syscall_src += arch-x86_64/syscalls/_exit.S
+syscall_src += arch-x86_64/syscalls/_exit_thread.S
+syscall_src += arch-x86_64/syscalls/__fork.S
+syscall_src += arch-x86_64/syscalls/__waitid.S
+syscall_src += arch-x86_64/syscalls/wait4.S
+syscall_src += arch-x86_64/syscalls/__sys_clone.S
+syscall_src += arch-x86_64/syscalls/execve.S
+syscall_src += arch-x86_64/syscalls/__setuid.S
+syscall_src += arch-x86_64/syscalls/getuid.S
+syscall_src += arch-x86_64/syscalls/getgid.S
+syscall_src += arch-x86_64/syscalls/geteuid.S
+syscall_src += arch-x86_64/syscalls/getegid.S
+syscall_src += arch-x86_64/syscalls/getresuid.S
+syscall_src += arch-x86_64/syscalls/getresgid.S
+syscall_src += arch-x86_64/syscalls/gettid.S
+syscall_src += arch-x86_64/syscalls/readahead.S
+syscall_src += arch-x86_64/syscalls/getgroups.S
+syscall_src += arch-x86_64/syscalls/getpgid.S
+syscall_src += arch-x86_64/syscalls/getppid.S
+syscall_src += arch-x86_64/syscalls/getsid.S
+syscall_src += arch-x86_64/syscalls/setsid.S
+syscall_src += arch-x86_64/syscalls/setgid.S
+syscall_src += arch-x86_64/syscalls/__setreuid.S
+syscall_src += arch-x86_64/syscalls/__setresuid.S
+syscall_src += arch-x86_64/syscalls/setresgid.S
+syscall_src += arch-x86_64/syscalls/__brk.S
+syscall_src += arch-x86_64/syscalls/kill.S
+syscall_src += arch-x86_64/syscalls/tkill.S
+syscall_src += arch-x86_64/syscalls/tgkill.S
+syscall_src += arch-x86_64/syscalls/__ptrace.S
+syscall_src += arch-x86_64/syscalls/__getpriority.S
+syscall_src += arch-x86_64/syscalls/setpriority.S
+syscall_src += arch-x86_64/syscalls/setrlimit.S
+syscall_src += arch-x86_64/syscalls/getrlimit.S
+syscall_src += arch-x86_64/syscalls/getrusage.S
+syscall_src += arch-x86_64/syscalls/setgroups.S
+syscall_src += arch-x86_64/syscalls/setpgid.S
+syscall_src += arch-x86_64/syscalls/vfork.S
+syscall_src += arch-x86_64/syscalls/setregid.S
+syscall_src += arch-x86_64/syscalls/chroot.S
+syscall_src += arch-x86_64/syscalls/prctl.S
+syscall_src += arch-x86_64/syscalls/arch_prctl.S
+syscall_src += arch-x86_64/syscalls/capget.S
+syscall_src += arch-x86_64/syscalls/capset.S
+syscall_src += arch-x86_64/syscalls/sigaltstack.S
+syscall_src += arch-x86_64/syscalls/acct.S
+syscall_src += arch-x86_64/syscalls/read.S
+syscall_src += arch-x86_64/syscalls/write.S
+syscall_src += arch-x86_64/syscalls/pread64.S
+syscall_src += arch-x86_64/syscalls/pwrite64.S
+syscall_src += arch-x86_64/syscalls/__open.S
+syscall_src += arch-x86_64/syscalls/__openat.S
+syscall_src += arch-x86_64/syscalls/close.S
+syscall_src += arch-x86_64/syscalls/lseek.S
+syscall_src += arch-x86_64/syscalls/getpid.S
+syscall_src += arch-x86_64/syscalls/mmap.S
+syscall_src += arch-x86_64/syscalls/munmap.S
+syscall_src += arch-x86_64/syscalls/mremap.S
+syscall_src += arch-x86_64/syscalls/msync.S
+syscall_src += arch-x86_64/syscalls/mprotect.S
+syscall_src += arch-x86_64/syscalls/madvise.S
+syscall_src += arch-x86_64/syscalls/mlock.S
+syscall_src += arch-x86_64/syscalls/munlock.S
+syscall_src += arch-x86_64/syscalls/mlockall.S
+syscall_src += arch-x86_64/syscalls/munlockall.S
+syscall_src += arch-x86_64/syscalls/mincore.S
+syscall_src += arch-x86_64/syscalls/__ioctl.S
+syscall_src += arch-x86_64/syscalls/readv.S
+syscall_src += arch-x86_64/syscalls/writev.S
+syscall_src += arch-x86_64/syscalls/fcntl.S
+syscall_src += arch-x86_64/syscalls/flock.S
+syscall_src += arch-x86_64/syscalls/fchmod.S
+syscall_src += arch-x86_64/syscalls/dup.S
+syscall_src += arch-x86_64/syscalls/pipe.S
+syscall_src += arch-x86_64/syscalls/pipe2.S
+syscall_src += arch-x86_64/syscalls/dup2.S
+syscall_src += arch-x86_64/syscalls/select.S
+syscall_src += arch-x86_64/syscalls/ftruncate.S
+syscall_src += arch-x86_64/syscalls/getdents.S
+syscall_src += arch-x86_64/syscalls/fsync.S
+syscall_src += arch-x86_64/syscalls/fdatasync.S
+syscall_src += arch-x86_64/syscalls/fchown.S
+syscall_src += arch-x86_64/syscalls/sync.S
+syscall_src += arch-x86_64/syscalls/fstatfs.S
+syscall_src += arch-x86_64/syscalls/sendfile.S
+syscall_src += arch-x86_64/syscalls/mkdirat.S
+syscall_src += arch-x86_64/syscalls/fchownat.S
+syscall_src += arch-x86_64/syscalls/fchmodat.S
+syscall_src += arch-x86_64/syscalls/renameat.S
+syscall_src += arch-x86_64/syscalls/fsetxattr.S
+syscall_src += arch-x86_64/syscalls/fgetxattr.S
+syscall_src += arch-x86_64/syscalls/flistxattr.S
+syscall_src += arch-x86_64/syscalls/fremovexattr.S
+syscall_src += arch-x86_64/syscalls/link.S
+syscall_src += arch-x86_64/syscalls/unlink.S
+syscall_src += arch-x86_64/syscalls/unlinkat.S
+syscall_src += arch-x86_64/syscalls/chdir.S
+syscall_src += arch-x86_64/syscalls/mknod.S
+syscall_src += arch-x86_64/syscalls/chmod.S
+syscall_src += arch-x86_64/syscalls/chown.S
+syscall_src += arch-x86_64/syscalls/lchown.S
+syscall_src += arch-x86_64/syscalls/mount.S
+syscall_src += arch-x86_64/syscalls/umount2.S
+syscall_src += arch-x86_64/syscalls/fstat.S
+syscall_src += arch-x86_64/syscalls/stat.S
+syscall_src += arch-x86_64/syscalls/lstat.S
+syscall_src += arch-x86_64/syscalls/mkdir.S
+syscall_src += arch-x86_64/syscalls/readlink.S
+syscall_src += arch-x86_64/syscalls/rmdir.S
+syscall_src += arch-x86_64/syscalls/rename.S
+syscall_src += arch-x86_64/syscalls/__getcwd.S
+syscall_src += arch-x86_64/syscalls/access.S
+syscall_src += arch-x86_64/syscalls/faccessat.S
+syscall_src += arch-x86_64/syscalls/symlink.S
+syscall_src += arch-x86_64/syscalls/fchdir.S
+syscall_src += arch-x86_64/syscalls/truncate.S
+syscall_src += arch-x86_64/syscalls/setxattr.S
+syscall_src += arch-x86_64/syscalls/lsetxattr.S
+syscall_src += arch-x86_64/syscalls/getxattr.S
+syscall_src += arch-x86_64/syscalls/lgetxattr.S
+syscall_src += arch-x86_64/syscalls/listxattr.S
+syscall_src += arch-x86_64/syscalls/llistxattr.S
+syscall_src += arch-x86_64/syscalls/removexattr.S
+syscall_src += arch-x86_64/syscalls/lremovexattr.S
+syscall_src += arch-x86_64/syscalls/statfs.S
+syscall_src += arch-x86_64/syscalls/unshare.S
+syscall_src += arch-x86_64/syscalls/swapon.S
+syscall_src += arch-x86_64/syscalls/swapoff.S
+syscall_src += arch-x86_64/syscalls/pause.S
+syscall_src += arch-x86_64/syscalls/gettimeofday.S
+syscall_src += arch-x86_64/syscalls/settimeofday.S
+syscall_src += arch-x86_64/syscalls/times.S
+syscall_src += arch-x86_64/syscalls/nanosleep.S
+syscall_src += arch-x86_64/syscalls/clock_gettime.S
+syscall_src += arch-x86_64/syscalls/clock_settime.S
+syscall_src += arch-x86_64/syscalls/clock_getres.S
+syscall_src += arch-x86_64/syscalls/clock_nanosleep.S
+syscall_src += arch-x86_64/syscalls/getitimer.S
+syscall_src += arch-x86_64/syscalls/setitimer.S
+syscall_src += arch-x86_64/syscalls/__timer_create.S
+syscall_src += arch-x86_64/syscalls/__timer_settime.S
+syscall_src += arch-x86_64/syscalls/__timer_gettime.S
+syscall_src += arch-x86_64/syscalls/__timer_getoverrun.S
+syscall_src += arch-x86_64/syscalls/__timer_delete.S
+syscall_src += arch-x86_64/syscalls/utimes.S
+syscall_src += arch-x86_64/syscalls/utimensat.S
+syscall_src += arch-x86_64/syscalls/timerfd_create.S
+syscall_src += arch-x86_64/syscalls/timerfd_settime.S
+syscall_src += arch-x86_64/syscalls/timerfd_gettime.S
+syscall_src += arch-x86_64/syscalls/__rt_sigsuspend.S
+syscall_src += arch-x86_64/syscalls/__rt_sigaction.S
+syscall_src += arch-x86_64/syscalls/__rt_sigprocmask.S
+syscall_src += arch-x86_64/syscalls/__rt_sigtimedwait.S
+syscall_src += arch-x86_64/syscalls/signalfd4.S
+syscall_src += arch-x86_64/syscalls/socket.S
+syscall_src += arch-x86_64/syscalls/socketpair.S
+syscall_src += arch-x86_64/syscalls/bind.S
+syscall_src += arch-x86_64/syscalls/connect.S
+syscall_src += arch-x86_64/syscalls/listen.S
+syscall_src += arch-x86_64/syscalls/accept.S
+syscall_src += arch-x86_64/syscalls/getsockname.S
+syscall_src += arch-x86_64/syscalls/getpeername.S
+syscall_src += arch-x86_64/syscalls/sendto.S
+syscall_src += arch-x86_64/syscalls/recvfrom.S
+syscall_src += arch-x86_64/syscalls/shutdown.S
+syscall_src += arch-x86_64/syscalls/setsockopt.S
+syscall_src += arch-x86_64/syscalls/getsockopt.S
+syscall_src += arch-x86_64/syscalls/sendmsg.S
+syscall_src += arch-x86_64/syscalls/recvmsg.S
+syscall_src += arch-x86_64/syscalls/sched_setscheduler.S
+syscall_src += arch-x86_64/syscalls/sched_getscheduler.S
+syscall_src += arch-x86_64/syscalls/sched_yield.S
+syscall_src += arch-x86_64/syscalls/sched_setparam.S
+syscall_src += arch-x86_64/syscalls/sched_getparam.S
+syscall_src += arch-x86_64/syscalls/sched_get_priority_max.S
+syscall_src += arch-x86_64/syscalls/sched_get_priority_min.S
+syscall_src += arch-x86_64/syscalls/sched_rr_get_interval.S
+syscall_src += arch-x86_64/syscalls/sched_setaffinity.S
+syscall_src += arch-x86_64/syscalls/__sched_getaffinity.S
+syscall_src += arch-x86_64/syscalls/__getcpu.S
+syscall_src += arch-x86_64/syscalls/ioprio_set.S
+syscall_src += arch-x86_64/syscalls/ioprio_get.S
+syscall_src += arch-x86_64/syscalls/uname.S
+syscall_src += arch-x86_64/syscalls/umask.S
+syscall_src += arch-x86_64/syscalls/__reboot.S
+syscall_src += arch-x86_64/syscalls/__syslog.S
+syscall_src += arch-x86_64/syscalls/init_module.S
+syscall_src += arch-x86_64/syscalls/delete_module.S
+syscall_src += arch-x86_64/syscalls/klogctl.S
+syscall_src += arch-x86_64/syscalls/sysinfo.S
+syscall_src += arch-x86_64/syscalls/personality.S
+syscall_src += arch-x86_64/syscalls/perf_event_open.S
+syscall_src += arch-x86_64/syscalls/futex.S
+syscall_src += arch-x86_64/syscalls/epoll_create.S
+syscall_src += arch-x86_64/syscalls/epoll_ctl.S
+syscall_src += arch-x86_64/syscalls/epoll_wait.S
+syscall_src += arch-x86_64/syscalls/inotify_init.S
+syscall_src += arch-x86_64/syscalls/inotify_add_watch.S
+syscall_src += arch-x86_64/syscalls/inotify_rm_watch.S
+syscall_src += arch-x86_64/syscalls/poll.S
+syscall_src += arch-x86_64/syscalls/eventfd.S
diff --git a/libc/arch-x86_64/syscalls/__brk.S b/libc/arch-x86_64/syscalls/__brk.S
new file mode 100644
index 0000000..ea5b9cf
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__brk.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__brk)
+ movl $__NR_brk, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__brk)
diff --git a/libc/arch-x86_64/syscalls/__fork.S b/libc/arch-x86_64/syscalls/__fork.S
new file mode 100644
index 0000000..75f2ed7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__fork.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__fork)
+ movl $__NR_fork, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__fork)
diff --git a/libc/arch-x86_64/syscalls/__getcpu.S b/libc/arch-x86_64/syscalls/__getcpu.S
new file mode 100644
index 0000000..47d5350
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getcpu.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__getcpu)
+ movl $__NR_getcpu, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__getcpu)
diff --git a/libc/arch-x86_64/syscalls/__getcwd.S b/libc/arch-x86_64/syscalls/__getcwd.S
new file mode 100644
index 0000000..2a274a9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getcwd.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__getcwd)
+ movl $__NR_getcwd, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__getcwd)
diff --git a/libc/arch-x86_64/syscalls/__getpriority.S b/libc/arch-x86_64/syscalls/__getpriority.S
new file mode 100644
index 0000000..6d8d6f7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__getpriority.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__getpriority)
+ movl $__NR_getpriority, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__getpriority)
diff --git a/libc/arch-x86_64/syscalls/__ioctl.S b/libc/arch-x86_64/syscalls/__ioctl.S
new file mode 100644
index 0000000..e9b3afa
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__ioctl.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__ioctl)
+ movl $__NR_ioctl, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__ioctl)
diff --git a/libc/arch-x86_64/syscalls/__open.S b/libc/arch-x86_64/syscalls/__open.S
new file mode 100644
index 0000000..ef106e3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__open.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__open)
+ movl $__NR_open, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__open)
diff --git a/libc/arch-x86_64/syscalls/__openat.S b/libc/arch-x86_64/syscalls/__openat.S
new file mode 100644
index 0000000..adb2e1a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__openat.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__openat)
+ movq %rcx, %r10
+ movl $__NR_openat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__openat)
diff --git a/libc/arch-x86_64/syscalls/__ptrace.S b/libc/arch-x86_64/syscalls/__ptrace.S
new file mode 100644
index 0000000..75586bd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__ptrace.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__ptrace)
+ movq %rcx, %r10
+ movl $__NR_ptrace, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__ptrace)
diff --git a/libc/arch-x86_64/syscalls/__reboot.S b/libc/arch-x86_64/syscalls/__reboot.S
new file mode 100644
index 0000000..46588c2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__reboot.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__reboot)
+ movq %rcx, %r10
+ movl $__NR_reboot, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__reboot)
diff --git a/libc/arch-x86_64/syscalls/__rt_sigaction.S b/libc/arch-x86_64/syscalls/__rt_sigaction.S
new file mode 100644
index 0000000..90129d7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigaction.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__rt_sigaction)
+ movq %rcx, %r10
+ movl $__NR_rt_sigaction, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__rt_sigaction)
diff --git a/libc/arch-x86_64/syscalls/__rt_sigprocmask.S b/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
new file mode 100644
index 0000000..dc3c1fc
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigprocmask.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__rt_sigprocmask)
+ movq %rcx, %r10
+ movl $__NR_rt_sigprocmask, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__rt_sigprocmask)
diff --git a/libc/arch-x86_64/syscalls/__rt_sigsuspend.S b/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
new file mode 100644
index 0000000..0efbd07
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigsuspend.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__rt_sigsuspend)
+ movl $__NR_rt_sigsuspend, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__rt_sigsuspend)
diff --git a/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S b/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
new file mode 100644
index 0000000..3907d25
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__rt_sigtimedwait.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__rt_sigtimedwait)
+ movq %rcx, %r10
+ movl $__NR_rt_sigtimedwait, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__rt_sigtimedwait)
diff --git a/libc/arch-x86_64/syscalls/__sched_getaffinity.S b/libc/arch-x86_64/syscalls/__sched_getaffinity.S
new file mode 100644
index 0000000..c783bc3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__sched_getaffinity.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__sched_getaffinity)
+ movl $__NR_sched_getaffinity, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__sched_getaffinity)
diff --git a/libc/arch-x86_64/syscalls/__setresuid.S b/libc/arch-x86_64/syscalls/__setresuid.S
new file mode 100644
index 0000000..e4ca4b8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__setresuid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__setresuid)
+ movl $__NR_setresuid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__setresuid)
diff --git a/libc/arch-x86_64/syscalls/__setreuid.S b/libc/arch-x86_64/syscalls/__setreuid.S
new file mode 100644
index 0000000..89d2aad
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__setreuid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__setreuid)
+ movl $__NR_setreuid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__setreuid)
diff --git a/libc/arch-x86_64/syscalls/__setuid.S b/libc/arch-x86_64/syscalls/__setuid.S
new file mode 100644
index 0000000..20b5089
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__setuid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__setuid)
+ movl $__NR_setuid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__setuid)
diff --git a/libc/arch-x86_64/syscalls/__sys_clone.S b/libc/arch-x86_64/syscalls/__sys_clone.S
new file mode 100644
index 0000000..557a681
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__sys_clone.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__sys_clone)
+ movq %rcx, %r10
+ movl $__NR_clone, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__sys_clone)
diff --git a/libc/arch-x86_64/syscalls/__syslog.S b/libc/arch-x86_64/syscalls/__syslog.S
new file mode 100644
index 0000000..4b76ad2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__syslog.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__syslog)
+ movl $__NR_syslog, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__syslog)
diff --git a/libc/arch-x86_64/syscalls/__timer_create.S b/libc/arch-x86_64/syscalls/__timer_create.S
new file mode 100644
index 0000000..cb46a1b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_create.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__timer_create)
+ movl $__NR_timer_create, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__timer_create)
diff --git a/libc/arch-x86_64/syscalls/__timer_delete.S b/libc/arch-x86_64/syscalls/__timer_delete.S
new file mode 100644
index 0000000..785f4ef
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_delete.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__timer_delete)
+ movl $__NR_timer_delete, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__timer_delete)
diff --git a/libc/arch-x86_64/syscalls/__timer_getoverrun.S b/libc/arch-x86_64/syscalls/__timer_getoverrun.S
new file mode 100644
index 0000000..bc5383f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_getoverrun.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__timer_getoverrun)
+ movl $__NR_timer_getoverrun, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__timer_getoverrun)
diff --git a/libc/arch-x86_64/syscalls/__timer_gettime.S b/libc/arch-x86_64/syscalls/__timer_gettime.S
new file mode 100644
index 0000000..29577cb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_gettime.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__timer_gettime)
+ movl $__NR_timer_gettime, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__timer_gettime)
diff --git a/libc/arch-x86_64/syscalls/__timer_settime.S b/libc/arch-x86_64/syscalls/__timer_settime.S
new file mode 100644
index 0000000..1f79eca
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__timer_settime.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__timer_settime)
+ movq %rcx, %r10
+ movl $__NR_timer_settime, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__timer_settime)
diff --git a/libc/arch-x86_64/syscalls/__waitid.S b/libc/arch-x86_64/syscalls/__waitid.S
new file mode 100644
index 0000000..7e278a5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/__waitid.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(__waitid)
+ movq %rcx, %r10
+ movl $__NR_waitid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(__waitid)
diff --git a/libc/arch-x86_64/syscalls/_exit.S b/libc/arch-x86_64/syscalls/_exit.S
new file mode 100644
index 0000000..6628ac9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/_exit.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(_exit)
+ movl $__NR_exit_group, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(_exit)
diff --git a/libc/arch-x86_64/syscalls/_exit_thread.S b/libc/arch-x86_64/syscalls/_exit_thread.S
new file mode 100644
index 0000000..0992af4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/_exit_thread.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(_exit_thread)
+ movl $__NR_exit, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(_exit_thread)
diff --git a/libc/arch-x86_64/syscalls/accept.S b/libc/arch-x86_64/syscalls/accept.S
new file mode 100644
index 0000000..688637a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/accept.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(accept)
+ movl $__NR_accept, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(accept)
diff --git a/libc/arch-x86_64/syscalls/access.S b/libc/arch-x86_64/syscalls/access.S
new file mode 100644
index 0000000..fc4d620
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/access.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(access)
+ movl $__NR_access, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(access)
diff --git a/libc/arch-x86_64/syscalls/acct.S b/libc/arch-x86_64/syscalls/acct.S
new file mode 100644
index 0000000..fac8a26
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/acct.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(acct)
+ movl $__NR_acct, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(acct)
diff --git a/libc/arch-x86_64/syscalls/arch_prctl.S b/libc/arch-x86_64/syscalls/arch_prctl.S
new file mode 100644
index 0000000..eaf9494
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/arch_prctl.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(arch_prctl)
+ movl $__NR_arch_prctl, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(arch_prctl)
diff --git a/libc/arch-x86_64/syscalls/bind.S b/libc/arch-x86_64/syscalls/bind.S
new file mode 100644
index 0000000..c9bb7fe
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/bind.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(bind)
+ movl $__NR_bind, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(bind)
diff --git a/libc/arch-x86_64/syscalls/capget.S b/libc/arch-x86_64/syscalls/capget.S
new file mode 100644
index 0000000..a043647
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/capget.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(capget)
+ movl $__NR_capget, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(capget)
diff --git a/libc/arch-x86_64/syscalls/capset.S b/libc/arch-x86_64/syscalls/capset.S
new file mode 100644
index 0000000..fba3d24
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/capset.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(capset)
+ movl $__NR_capset, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(capset)
diff --git a/libc/arch-x86_64/syscalls/chdir.S b/libc/arch-x86_64/syscalls/chdir.S
new file mode 100644
index 0000000..8eb4949
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/chdir.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(chdir)
+ movl $__NR_chdir, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(chdir)
diff --git a/libc/arch-x86_64/syscalls/chmod.S b/libc/arch-x86_64/syscalls/chmod.S
new file mode 100644
index 0000000..069aae1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/chmod.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(chmod)
+ movl $__NR_chmod, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(chmod)
diff --git a/libc/arch-x86_64/syscalls/chown.S b/libc/arch-x86_64/syscalls/chown.S
new file mode 100644
index 0000000..0281659
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/chown.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(chown)
+ movl $__NR_chown, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(chown)
diff --git a/libc/arch-x86_64/syscalls/chroot.S b/libc/arch-x86_64/syscalls/chroot.S
new file mode 100644
index 0000000..2f303ee
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/chroot.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(chroot)
+ movl $__NR_chroot, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(chroot)
diff --git a/libc/arch-x86_64/syscalls/clock_getres.S b/libc/arch-x86_64/syscalls/clock_getres.S
new file mode 100644
index 0000000..38ff52a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/clock_getres.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(clock_getres)
+ movl $__NR_clock_getres, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(clock_getres)
diff --git a/libc/arch-x86_64/syscalls/clock_gettime.S b/libc/arch-x86_64/syscalls/clock_gettime.S
new file mode 100644
index 0000000..f299fb1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/clock_gettime.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(clock_gettime)
+ movl $__NR_clock_gettime, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(clock_gettime)
diff --git a/libc/arch-x86_64/syscalls/clock_nanosleep.S b/libc/arch-x86_64/syscalls/clock_nanosleep.S
new file mode 100644
index 0000000..f61f364
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/clock_nanosleep.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(clock_nanosleep)
+ movq %rcx, %r10
+ movl $__NR_clock_nanosleep, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(clock_nanosleep)
diff --git a/libc/arch-x86_64/syscalls/clock_settime.S b/libc/arch-x86_64/syscalls/clock_settime.S
new file mode 100644
index 0000000..520c81c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/clock_settime.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(clock_settime)
+ movl $__NR_clock_settime, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(clock_settime)
diff --git a/libc/arch-x86_64/syscalls/close.S b/libc/arch-x86_64/syscalls/close.S
new file mode 100644
index 0000000..596e9d7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/close.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(close)
+ movl $__NR_close, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(close)
diff --git a/libc/arch-x86_64/syscalls/connect.S b/libc/arch-x86_64/syscalls/connect.S
new file mode 100644
index 0000000..45ab826
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/connect.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(connect)
+ movl $__NR_connect, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(connect)
diff --git a/libc/arch-x86_64/syscalls/delete_module.S b/libc/arch-x86_64/syscalls/delete_module.S
new file mode 100644
index 0000000..f5e1fc8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/delete_module.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(delete_module)
+ movl $__NR_delete_module, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(delete_module)
diff --git a/libc/arch-x86_64/syscalls/dup.S b/libc/arch-x86_64/syscalls/dup.S
new file mode 100644
index 0000000..fdb0cf0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/dup.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(dup)
+ movl $__NR_dup, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(dup)
diff --git a/libc/arch-x86_64/syscalls/dup2.S b/libc/arch-x86_64/syscalls/dup2.S
new file mode 100644
index 0000000..cc6f65b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/dup2.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(dup2)
+ movl $__NR_dup2, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(dup2)
diff --git a/libc/arch-x86_64/syscalls/epoll_create.S b/libc/arch-x86_64/syscalls/epoll_create.S
new file mode 100644
index 0000000..af5b6a5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/epoll_create.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(epoll_create)
+ movl $__NR_epoll_create, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(epoll_create)
diff --git a/libc/arch-x86_64/syscalls/epoll_ctl.S b/libc/arch-x86_64/syscalls/epoll_ctl.S
new file mode 100644
index 0000000..df9f561
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/epoll_ctl.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(epoll_ctl)
+ movq %rcx, %r10
+ movl $__NR_epoll_ctl, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(epoll_ctl)
diff --git a/libc/arch-x86_64/syscalls/epoll_wait.S b/libc/arch-x86_64/syscalls/epoll_wait.S
new file mode 100644
index 0000000..04cd25a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/epoll_wait.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(epoll_wait)
+ movq %rcx, %r10
+ movl $__NR_epoll_wait, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(epoll_wait)
diff --git a/libc/arch-x86_64/syscalls/eventfd.S b/libc/arch-x86_64/syscalls/eventfd.S
new file mode 100644
index 0000000..a005323
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/eventfd.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(eventfd)
+ movl $__NR_eventfd2, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(eventfd)
diff --git a/libc/arch-x86_64/syscalls/execve.S b/libc/arch-x86_64/syscalls/execve.S
new file mode 100644
index 0000000..dd00ae5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/execve.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(execve)
+ movl $__NR_execve, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(execve)
diff --git a/libc/arch-x86_64/syscalls/faccessat.S b/libc/arch-x86_64/syscalls/faccessat.S
new file mode 100644
index 0000000..75de9c8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/faccessat.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(faccessat)
+ movq %rcx, %r10
+ movl $__NR_faccessat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(faccessat)
diff --git a/libc/arch-x86_64/syscalls/fchdir.S b/libc/arch-x86_64/syscalls/fchdir.S
new file mode 100644
index 0000000..a669808
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchdir.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fchdir)
+ movl $__NR_fchdir, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fchdir)
diff --git a/libc/arch-x86_64/syscalls/fchmod.S b/libc/arch-x86_64/syscalls/fchmod.S
new file mode 100644
index 0000000..c20073d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchmod.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fchmod)
+ movl $__NR_fchmod, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fchmod)
diff --git a/libc/arch-x86_64/syscalls/fchmodat.S b/libc/arch-x86_64/syscalls/fchmodat.S
new file mode 100644
index 0000000..afc67fe
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchmodat.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fchmodat)
+ movq %rcx, %r10
+ movl $__NR_fchmodat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fchmodat)
diff --git a/libc/arch-x86_64/syscalls/fchown.S b/libc/arch-x86_64/syscalls/fchown.S
new file mode 100644
index 0000000..4411cbf
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchown.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fchown)
+ movl $__NR_fchown, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fchown)
diff --git a/libc/arch-x86_64/syscalls/fchownat.S b/libc/arch-x86_64/syscalls/fchownat.S
new file mode 100644
index 0000000..da2f5da
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fchownat.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fchownat)
+ movq %rcx, %r10
+ movl $__NR_fchownat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fchownat)
diff --git a/libc/arch-x86_64/syscalls/fcntl.S b/libc/arch-x86_64/syscalls/fcntl.S
new file mode 100644
index 0000000..dd3b940
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fcntl.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fcntl)
+ movl $__NR_fcntl, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fcntl)
diff --git a/libc/arch-x86_64/syscalls/fdatasync.S b/libc/arch-x86_64/syscalls/fdatasync.S
new file mode 100644
index 0000000..55777b9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fdatasync.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fdatasync)
+ movl $__NR_fdatasync, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fdatasync)
diff --git a/libc/arch-x86_64/syscalls/fgetxattr.S b/libc/arch-x86_64/syscalls/fgetxattr.S
new file mode 100644
index 0000000..92e4cf8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fgetxattr.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fgetxattr)
+ movq %rcx, %r10
+ movl $__NR_fgetxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fgetxattr)
diff --git a/libc/arch-x86_64/syscalls/flistxattr.S b/libc/arch-x86_64/syscalls/flistxattr.S
new file mode 100644
index 0000000..8b0053b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/flistxattr.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(flistxattr)
+ movl $__NR_flistxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(flistxattr)
diff --git a/libc/arch-x86_64/syscalls/flock.S b/libc/arch-x86_64/syscalls/flock.S
new file mode 100644
index 0000000..fb8b69d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/flock.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(flock)
+ movl $__NR_flock, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(flock)
diff --git a/libc/arch-x86_64/syscalls/fremovexattr.S b/libc/arch-x86_64/syscalls/fremovexattr.S
new file mode 100644
index 0000000..5bf5d0d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fremovexattr.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fremovexattr)
+ movl $__NR_fremovexattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fremovexattr)
diff --git a/libc/arch-x86_64/syscalls/fsetxattr.S b/libc/arch-x86_64/syscalls/fsetxattr.S
new file mode 100644
index 0000000..15b1643
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fsetxattr.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fsetxattr)
+ movq %rcx, %r10
+ movl $__NR_fsetxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fsetxattr)
diff --git a/libc/arch-x86_64/syscalls/fstat.S b/libc/arch-x86_64/syscalls/fstat.S
new file mode 100644
index 0000000..18d3649
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fstat.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fstat)
+ movl $__NR_fstat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fstat)
diff --git a/libc/arch-x86_64/syscalls/fstatfs.S b/libc/arch-x86_64/syscalls/fstatfs.S
new file mode 100644
index 0000000..8ae21e7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fstatfs.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fstatfs)
+ movl $__NR_fstatfs, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fstatfs)
diff --git a/libc/arch-x86_64/syscalls/fsync.S b/libc/arch-x86_64/syscalls/fsync.S
new file mode 100644
index 0000000..80a45f3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/fsync.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(fsync)
+ movl $__NR_fsync, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(fsync)
diff --git a/libc/arch-x86_64/syscalls/ftruncate.S b/libc/arch-x86_64/syscalls/ftruncate.S
new file mode 100644
index 0000000..97c7be9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/ftruncate.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(ftruncate)
+ movl $__NR_ftruncate, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(ftruncate)
diff --git a/libc/arch-x86_64/syscalls/futex.S b/libc/arch-x86_64/syscalls/futex.S
new file mode 100644
index 0000000..b9e61af
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/futex.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(futex)
+ movq %rcx, %r10
+ movl $__NR_futex, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(futex)
diff --git a/libc/arch-x86_64/syscalls/getdents.S b/libc/arch-x86_64/syscalls/getdents.S
new file mode 100644
index 0000000..b92d18d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getdents.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getdents)
+ movl $__NR_getdents64, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getdents)
diff --git a/libc/arch-x86_64/syscalls/getegid.S b/libc/arch-x86_64/syscalls/getegid.S
new file mode 100644
index 0000000..47bb072
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getegid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getegid)
+ movl $__NR_getegid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getegid)
diff --git a/libc/arch-x86_64/syscalls/geteuid.S b/libc/arch-x86_64/syscalls/geteuid.S
new file mode 100644
index 0000000..779b5eb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/geteuid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(geteuid)
+ movl $__NR_geteuid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(geteuid)
diff --git a/libc/arch-x86_64/syscalls/getgid.S b/libc/arch-x86_64/syscalls/getgid.S
new file mode 100644
index 0000000..30fabb7
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getgid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getgid)
+ movl $__NR_getgid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getgid)
diff --git a/libc/arch-x86_64/syscalls/getgroups.S b/libc/arch-x86_64/syscalls/getgroups.S
new file mode 100644
index 0000000..edd0019
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getgroups.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getgroups)
+ movl $__NR_getgroups, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getgroups)
diff --git a/libc/arch-x86_64/syscalls/getitimer.S b/libc/arch-x86_64/syscalls/getitimer.S
new file mode 100644
index 0000000..f39873f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getitimer.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getitimer)
+ movl $__NR_getitimer, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getitimer)
diff --git a/libc/arch-x86_64/syscalls/getpeername.S b/libc/arch-x86_64/syscalls/getpeername.S
new file mode 100644
index 0000000..53a5029
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getpeername.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getpeername)
+ movl $__NR_getpeername, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getpeername)
diff --git a/libc/arch-x86_64/syscalls/getpgid.S b/libc/arch-x86_64/syscalls/getpgid.S
new file mode 100644
index 0000000..3d44627
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getpgid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getpgid)
+ movl $__NR_getpgid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getpgid)
diff --git a/libc/arch-x86_64/syscalls/getpid.S b/libc/arch-x86_64/syscalls/getpid.S
new file mode 100644
index 0000000..cddf9e9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getpid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getpid)
+ movl $__NR_getpid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getpid)
diff --git a/libc/arch-x86_64/syscalls/getppid.S b/libc/arch-x86_64/syscalls/getppid.S
new file mode 100644
index 0000000..03555f2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getppid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getppid)
+ movl $__NR_getppid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getppid)
diff --git a/libc/arch-x86_64/syscalls/getresgid.S b/libc/arch-x86_64/syscalls/getresgid.S
new file mode 100644
index 0000000..ef17b8c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getresgid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getresgid)
+ movl $__NR_getresgid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getresgid)
diff --git a/libc/arch-x86_64/syscalls/getresuid.S b/libc/arch-x86_64/syscalls/getresuid.S
new file mode 100644
index 0000000..fd3f62d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getresuid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getresuid)
+ movl $__NR_getresuid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getresuid)
diff --git a/libc/arch-x86_64/syscalls/getrlimit.S b/libc/arch-x86_64/syscalls/getrlimit.S
new file mode 100644
index 0000000..eb1241d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getrlimit.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getrlimit)
+ movl $__NR_getrlimit, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getrlimit)
diff --git a/libc/arch-x86_64/syscalls/getrusage.S b/libc/arch-x86_64/syscalls/getrusage.S
new file mode 100644
index 0000000..89eacfd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getrusage.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getrusage)
+ movl $__NR_getrusage, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getrusage)
diff --git a/libc/arch-x86_64/syscalls/getsid.S b/libc/arch-x86_64/syscalls/getsid.S
new file mode 100644
index 0000000..fa09d5b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getsid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getsid)
+ movl $__NR_getsid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getsid)
diff --git a/libc/arch-x86_64/syscalls/getsockname.S b/libc/arch-x86_64/syscalls/getsockname.S
new file mode 100644
index 0000000..8206df2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getsockname.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getsockname)
+ movl $__NR_getsockname, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getsockname)
diff --git a/libc/arch-x86_64/syscalls/getsockopt.S b/libc/arch-x86_64/syscalls/getsockopt.S
new file mode 100644
index 0000000..14a156f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getsockopt.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getsockopt)
+ movq %rcx, %r10
+ movl $__NR_getsockopt, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getsockopt)
diff --git a/libc/arch-x86_64/syscalls/gettid.S b/libc/arch-x86_64/syscalls/gettid.S
new file mode 100644
index 0000000..5491bef
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/gettid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(gettid)
+ movl $__NR_gettid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(gettid)
diff --git a/libc/arch-x86_64/syscalls/gettimeofday.S b/libc/arch-x86_64/syscalls/gettimeofday.S
new file mode 100644
index 0000000..7bf251a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/gettimeofday.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(gettimeofday)
+ movl $__NR_gettimeofday, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(gettimeofday)
diff --git a/libc/arch-x86_64/syscalls/getuid.S b/libc/arch-x86_64/syscalls/getuid.S
new file mode 100644
index 0000000..cdfd108
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getuid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getuid)
+ movl $__NR_getuid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getuid)
diff --git a/libc/arch-x86_64/syscalls/getxattr.S b/libc/arch-x86_64/syscalls/getxattr.S
new file mode 100644
index 0000000..f1a513d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/getxattr.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(getxattr)
+ movq %rcx, %r10
+ movl $__NR_getxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(getxattr)
diff --git a/libc/arch-x86_64/syscalls/init_module.S b/libc/arch-x86_64/syscalls/init_module.S
new file mode 100644
index 0000000..4e54b7f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/init_module.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(init_module)
+ movl $__NR_init_module, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(init_module)
diff --git a/libc/arch-x86_64/syscalls/inotify_add_watch.S b/libc/arch-x86_64/syscalls/inotify_add_watch.S
new file mode 100644
index 0000000..0a2d8f1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/inotify_add_watch.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(inotify_add_watch)
+ movl $__NR_inotify_add_watch, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(inotify_add_watch)
diff --git a/libc/arch-x86_64/syscalls/inotify_init.S b/libc/arch-x86_64/syscalls/inotify_init.S
new file mode 100644
index 0000000..0d20efc
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/inotify_init.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(inotify_init)
+ movl $__NR_inotify_init, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(inotify_init)
diff --git a/libc/arch-x86_64/syscalls/inotify_rm_watch.S b/libc/arch-x86_64/syscalls/inotify_rm_watch.S
new file mode 100644
index 0000000..9f53e64
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/inotify_rm_watch.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(inotify_rm_watch)
+ movl $__NR_inotify_rm_watch, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(inotify_rm_watch)
diff --git a/libc/arch-x86_64/syscalls/ioprio_get.S b/libc/arch-x86_64/syscalls/ioprio_get.S
new file mode 100644
index 0000000..6523bc9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/ioprio_get.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(ioprio_get)
+ movl $__NR_ioprio_get, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(ioprio_get)
diff --git a/libc/arch-x86_64/syscalls/ioprio_set.S b/libc/arch-x86_64/syscalls/ioprio_set.S
new file mode 100644
index 0000000..bdbf559
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/ioprio_set.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(ioprio_set)
+ movl $__NR_ioprio_set, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(ioprio_set)
diff --git a/libc/arch-x86_64/syscalls/kill.S b/libc/arch-x86_64/syscalls/kill.S
new file mode 100644
index 0000000..d2773c6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/kill.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(kill)
+ movl $__NR_kill, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(kill)
diff --git a/libc/arch-x86_64/syscalls/klogctl.S b/libc/arch-x86_64/syscalls/klogctl.S
new file mode 100644
index 0000000..8e1f8ba
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/klogctl.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(klogctl)
+ movl $__NR_syslog, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(klogctl)
diff --git a/libc/arch-x86_64/syscalls/lchown.S b/libc/arch-x86_64/syscalls/lchown.S
new file mode 100644
index 0000000..36a6f7a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lchown.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(lchown)
+ movl $__NR_lchown, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(lchown)
diff --git a/libc/arch-x86_64/syscalls/lgetxattr.S b/libc/arch-x86_64/syscalls/lgetxattr.S
new file mode 100644
index 0000000..bc7d5f1
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lgetxattr.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(lgetxattr)
+ movq %rcx, %r10
+ movl $__NR_lgetxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(lgetxattr)
diff --git a/libc/arch-x86_64/syscalls/link.S b/libc/arch-x86_64/syscalls/link.S
new file mode 100644
index 0000000..fa4b7d5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/link.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(link)
+ movl $__NR_link, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(link)
diff --git a/libc/arch-x86_64/syscalls/listen.S b/libc/arch-x86_64/syscalls/listen.S
new file mode 100644
index 0000000..09111d4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/listen.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(listen)
+ movl $__NR_listen, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(listen)
diff --git a/libc/arch-x86_64/syscalls/listxattr.S b/libc/arch-x86_64/syscalls/listxattr.S
new file mode 100644
index 0000000..726e3f6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/listxattr.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(listxattr)
+ movl $__NR_listxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(listxattr)
diff --git a/libc/arch-x86_64/syscalls/llistxattr.S b/libc/arch-x86_64/syscalls/llistxattr.S
new file mode 100644
index 0000000..7714588
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/llistxattr.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(llistxattr)
+ movl $__NR_llistxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(llistxattr)
diff --git a/libc/arch-x86_64/syscalls/lremovexattr.S b/libc/arch-x86_64/syscalls/lremovexattr.S
new file mode 100644
index 0000000..cdaed46
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lremovexattr.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(lremovexattr)
+ movl $__NR_lremovexattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(lremovexattr)
diff --git a/libc/arch-x86_64/syscalls/lseek.S b/libc/arch-x86_64/syscalls/lseek.S
new file mode 100644
index 0000000..9756315
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lseek.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(lseek)
+ movl $__NR_lseek, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(lseek)
diff --git a/libc/arch-x86_64/syscalls/lsetxattr.S b/libc/arch-x86_64/syscalls/lsetxattr.S
new file mode 100644
index 0000000..4ef43b9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lsetxattr.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(lsetxattr)
+ movq %rcx, %r10
+ movl $__NR_lsetxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(lsetxattr)
diff --git a/libc/arch-x86_64/syscalls/lstat.S b/libc/arch-x86_64/syscalls/lstat.S
new file mode 100644
index 0000000..425a0fa
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/lstat.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(lstat)
+ movl $__NR_lstat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(lstat)
diff --git a/libc/arch-x86_64/syscalls/madvise.S b/libc/arch-x86_64/syscalls/madvise.S
new file mode 100644
index 0000000..927b7a6
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/madvise.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(madvise)
+ movl $__NR_madvise, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(madvise)
diff --git a/libc/arch-x86_64/syscalls/mincore.S b/libc/arch-x86_64/syscalls/mincore.S
new file mode 100644
index 0000000..577e41f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mincore.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mincore)
+ movl $__NR_mincore, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mincore)
diff --git a/libc/arch-x86_64/syscalls/mkdir.S b/libc/arch-x86_64/syscalls/mkdir.S
new file mode 100644
index 0000000..7ce8e7f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mkdir.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mkdir)
+ movl $__NR_mkdir, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mkdir)
diff --git a/libc/arch-x86_64/syscalls/mkdirat.S b/libc/arch-x86_64/syscalls/mkdirat.S
new file mode 100644
index 0000000..3424611
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mkdirat.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mkdirat)
+ movl $__NR_mkdirat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mkdirat)
diff --git a/libc/arch-x86_64/syscalls/mknod.S b/libc/arch-x86_64/syscalls/mknod.S
new file mode 100644
index 0000000..a435592
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mknod.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mknod)
+ movl $__NR_mknod, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mknod)
diff --git a/libc/arch-x86_64/syscalls/mlock.S b/libc/arch-x86_64/syscalls/mlock.S
new file mode 100644
index 0000000..af2e72f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mlock.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mlock)
+ movl $__NR_mlock, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mlock)
diff --git a/libc/arch-x86_64/syscalls/mlockall.S b/libc/arch-x86_64/syscalls/mlockall.S
new file mode 100644
index 0000000..f9fd0e0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mlockall.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mlockall)
+ movl $__NR_mlockall, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mlockall)
diff --git a/libc/arch-x86_64/syscalls/mmap.S b/libc/arch-x86_64/syscalls/mmap.S
new file mode 100644
index 0000000..4bf7d94
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mmap.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mmap)
+ movq %rcx, %r10
+ movl $__NR_mmap, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mmap)
diff --git a/libc/arch-x86_64/syscalls/mount.S b/libc/arch-x86_64/syscalls/mount.S
new file mode 100644
index 0000000..d09ca36
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mount.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mount)
+ movq %rcx, %r10
+ movl $__NR_mount, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mount)
diff --git a/libc/arch-x86_64/syscalls/mprotect.S b/libc/arch-x86_64/syscalls/mprotect.S
new file mode 100644
index 0000000..17dac16
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mprotect.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mprotect)
+ movl $__NR_mprotect, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mprotect)
diff --git a/libc/arch-x86_64/syscalls/mremap.S b/libc/arch-x86_64/syscalls/mremap.S
new file mode 100644
index 0000000..e8d4192
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/mremap.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(mremap)
+ movq %rcx, %r10
+ movl $__NR_mremap, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(mremap)
diff --git a/libc/arch-x86_64/syscalls/msync.S b/libc/arch-x86_64/syscalls/msync.S
new file mode 100644
index 0000000..6ea8de3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/msync.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(msync)
+ movl $__NR_msync, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(msync)
diff --git a/libc/arch-x86_64/syscalls/munlock.S b/libc/arch-x86_64/syscalls/munlock.S
new file mode 100644
index 0000000..47a5308
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/munlock.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(munlock)
+ movl $__NR_munlock, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(munlock)
diff --git a/libc/arch-x86_64/syscalls/munlockall.S b/libc/arch-x86_64/syscalls/munlockall.S
new file mode 100644
index 0000000..f89ee71
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/munlockall.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(munlockall)
+ movl $__NR_munlockall, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(munlockall)
diff --git a/libc/arch-x86_64/syscalls/munmap.S b/libc/arch-x86_64/syscalls/munmap.S
new file mode 100644
index 0000000..5734dc3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/munmap.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(munmap)
+ movl $__NR_munmap, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(munmap)
diff --git a/libc/arch-x86_64/syscalls/nanosleep.S b/libc/arch-x86_64/syscalls/nanosleep.S
new file mode 100644
index 0000000..0accaf4
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/nanosleep.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(nanosleep)
+ movl $__NR_nanosleep, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(nanosleep)
diff --git a/libc/arch-x86_64/syscalls/pause.S b/libc/arch-x86_64/syscalls/pause.S
new file mode 100644
index 0000000..118521f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pause.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(pause)
+ movl $__NR_pause, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(pause)
diff --git a/libc/arch-x86_64/syscalls/perf_event_open.S b/libc/arch-x86_64/syscalls/perf_event_open.S
new file mode 100644
index 0000000..4cc6dea
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/perf_event_open.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(perf_event_open)
+ movq %rcx, %r10
+ movl $__NR_perf_event_open, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(perf_event_open)
diff --git a/libc/arch-x86_64/syscalls/personality.S b/libc/arch-x86_64/syscalls/personality.S
new file mode 100644
index 0000000..b98f1b9
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/personality.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(personality)
+ movl $__NR_personality, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(personality)
diff --git a/libc/arch-x86_64/syscalls/pipe.S b/libc/arch-x86_64/syscalls/pipe.S
new file mode 100644
index 0000000..3279a80
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pipe.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(pipe)
+ movl $__NR_pipe, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(pipe)
diff --git a/libc/arch-x86_64/syscalls/pipe2.S b/libc/arch-x86_64/syscalls/pipe2.S
new file mode 100644
index 0000000..569df4f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pipe2.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(pipe2)
+ movl $__NR_pipe2, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(pipe2)
diff --git a/libc/arch-x86_64/syscalls/poll.S b/libc/arch-x86_64/syscalls/poll.S
new file mode 100644
index 0000000..48462bd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/poll.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(poll)
+ movl $__NR_poll, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(poll)
diff --git a/libc/arch-x86_64/syscalls/prctl.S b/libc/arch-x86_64/syscalls/prctl.S
new file mode 100644
index 0000000..712c556
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/prctl.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(prctl)
+ movq %rcx, %r10
+ movl $__NR_prctl, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(prctl)
diff --git a/libc/arch-x86_64/syscalls/pread64.S b/libc/arch-x86_64/syscalls/pread64.S
new file mode 100644
index 0000000..26c2522
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pread64.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(pread64)
+ movq %rcx, %r10
+ movl $__NR_pread64, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(pread64)
diff --git a/libc/arch-x86_64/syscalls/pwrite64.S b/libc/arch-x86_64/syscalls/pwrite64.S
new file mode 100644
index 0000000..0d8d851
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/pwrite64.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(pwrite64)
+ movq %rcx, %r10
+ movl $__NR_pwrite64, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(pwrite64)
diff --git a/libc/arch-x86_64/syscalls/read.S b/libc/arch-x86_64/syscalls/read.S
new file mode 100644
index 0000000..51ba898
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/read.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(read)
+ movl $__NR_read, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(read)
diff --git a/libc/arch-x86_64/syscalls/readahead.S b/libc/arch-x86_64/syscalls/readahead.S
new file mode 100644
index 0000000..6eb6084
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readahead.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(readahead)
+ movl $__NR_readahead, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(readahead)
diff --git a/libc/arch-x86_64/syscalls/readlink.S b/libc/arch-x86_64/syscalls/readlink.S
new file mode 100644
index 0000000..3183c77
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readlink.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(readlink)
+ movl $__NR_readlink, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(readlink)
diff --git a/libc/arch-x86_64/syscalls/readv.S b/libc/arch-x86_64/syscalls/readv.S
new file mode 100644
index 0000000..3d9dfab
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/readv.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(readv)
+ movl $__NR_readv, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(readv)
diff --git a/libc/arch-x86_64/syscalls/recvfrom.S b/libc/arch-x86_64/syscalls/recvfrom.S
new file mode 100644
index 0000000..7f4aab2
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/recvfrom.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(recvfrom)
+ movq %rcx, %r10
+ movl $__NR_recvfrom, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(recvfrom)
diff --git a/libc/arch-x86_64/syscalls/recvmsg.S b/libc/arch-x86_64/syscalls/recvmsg.S
new file mode 100644
index 0000000..759b5b5
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/recvmsg.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(recvmsg)
+ movl $__NR_recvmsg, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(recvmsg)
diff --git a/libc/arch-x86_64/syscalls/removexattr.S b/libc/arch-x86_64/syscalls/removexattr.S
new file mode 100644
index 0000000..4c73eaf
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/removexattr.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(removexattr)
+ movl $__NR_removexattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(removexattr)
diff --git a/libc/arch-x86_64/syscalls/rename.S b/libc/arch-x86_64/syscalls/rename.S
new file mode 100644
index 0000000..c1704db
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/rename.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(rename)
+ movl $__NR_rename, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(rename)
diff --git a/libc/arch-x86_64/syscalls/renameat.S b/libc/arch-x86_64/syscalls/renameat.S
new file mode 100644
index 0000000..a68d2cf
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/renameat.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(renameat)
+ movq %rcx, %r10
+ movl $__NR_renameat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(renameat)
diff --git a/libc/arch-x86_64/syscalls/rmdir.S b/libc/arch-x86_64/syscalls/rmdir.S
new file mode 100644
index 0000000..6cfcb71
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/rmdir.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(rmdir)
+ movl $__NR_rmdir, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(rmdir)
diff --git a/libc/arch-x86_64/syscalls/sched_get_priority_max.S b/libc/arch-x86_64/syscalls/sched_get_priority_max.S
new file mode 100644
index 0000000..d2ce51f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_get_priority_max.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_get_priority_max)
+ movl $__NR_sched_get_priority_max, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_get_priority_max)
diff --git a/libc/arch-x86_64/syscalls/sched_get_priority_min.S b/libc/arch-x86_64/syscalls/sched_get_priority_min.S
new file mode 100644
index 0000000..743503b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_get_priority_min.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_get_priority_min)
+ movl $__NR_sched_get_priority_min, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_get_priority_min)
diff --git a/libc/arch-x86_64/syscalls/sched_getparam.S b/libc/arch-x86_64/syscalls/sched_getparam.S
new file mode 100644
index 0000000..6aa0a08
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_getparam.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_getparam)
+ movl $__NR_sched_getparam, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_getparam)
diff --git a/libc/arch-x86_64/syscalls/sched_getscheduler.S b/libc/arch-x86_64/syscalls/sched_getscheduler.S
new file mode 100644
index 0000000..57e4400
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_getscheduler.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_getscheduler)
+ movl $__NR_sched_getscheduler, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_getscheduler)
diff --git a/libc/arch-x86_64/syscalls/sched_rr_get_interval.S b/libc/arch-x86_64/syscalls/sched_rr_get_interval.S
new file mode 100644
index 0000000..d46c054
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_rr_get_interval.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_rr_get_interval)
+ movl $__NR_sched_rr_get_interval, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_rr_get_interval)
diff --git a/libc/arch-x86_64/syscalls/sched_setaffinity.S b/libc/arch-x86_64/syscalls/sched_setaffinity.S
new file mode 100644
index 0000000..d3fb89b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_setaffinity.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_setaffinity)
+ movl $__NR_sched_setaffinity, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_setaffinity)
diff --git a/libc/arch-x86_64/syscalls/sched_setparam.S b/libc/arch-x86_64/syscalls/sched_setparam.S
new file mode 100644
index 0000000..c5dd029
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_setparam.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_setparam)
+ movl $__NR_sched_setparam, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_setparam)
diff --git a/libc/arch-x86_64/syscalls/sched_setscheduler.S b/libc/arch-x86_64/syscalls/sched_setscheduler.S
new file mode 100644
index 0000000..90d013d
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_setscheduler.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_setscheduler)
+ movl $__NR_sched_setscheduler, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_setscheduler)
diff --git a/libc/arch-x86_64/syscalls/sched_yield.S b/libc/arch-x86_64/syscalls/sched_yield.S
new file mode 100644
index 0000000..5191560
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sched_yield.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sched_yield)
+ movl $__NR_sched_yield, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sched_yield)
diff --git a/libc/arch-x86_64/syscalls/select.S b/libc/arch-x86_64/syscalls/select.S
new file mode 100644
index 0000000..91c3a72
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/select.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(select)
+ movq %rcx, %r10
+ movl $__NR_select, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(select)
diff --git a/libc/arch-x86_64/syscalls/sendfile.S b/libc/arch-x86_64/syscalls/sendfile.S
new file mode 100644
index 0000000..37a7bcd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendfile.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sendfile)
+ movq %rcx, %r10
+ movl $__NR_sendfile, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sendfile)
diff --git a/libc/arch-x86_64/syscalls/sendmsg.S b/libc/arch-x86_64/syscalls/sendmsg.S
new file mode 100644
index 0000000..24c5534
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendmsg.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sendmsg)
+ movl $__NR_sendmsg, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sendmsg)
diff --git a/libc/arch-x86_64/syscalls/sendto.S b/libc/arch-x86_64/syscalls/sendto.S
new file mode 100644
index 0000000..a03094c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sendto.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sendto)
+ movq %rcx, %r10
+ movl $__NR_sendto, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sendto)
diff --git a/libc/arch-x86_64/syscalls/setgid.S b/libc/arch-x86_64/syscalls/setgid.S
new file mode 100644
index 0000000..5b0cb6c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setgid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setgid)
+ movl $__NR_setgid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setgid)
diff --git a/libc/arch-x86_64/syscalls/setgroups.S b/libc/arch-x86_64/syscalls/setgroups.S
new file mode 100644
index 0000000..e797bae
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setgroups.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setgroups)
+ movl $__NR_setgroups, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setgroups)
diff --git a/libc/arch-x86_64/syscalls/setitimer.S b/libc/arch-x86_64/syscalls/setitimer.S
new file mode 100644
index 0000000..3227745
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setitimer.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setitimer)
+ movl $__NR_setitimer, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setitimer)
diff --git a/libc/arch-x86_64/syscalls/setpgid.S b/libc/arch-x86_64/syscalls/setpgid.S
new file mode 100644
index 0000000..2e9ed27
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setpgid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setpgid)
+ movl $__NR_setpgid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setpgid)
diff --git a/libc/arch-x86_64/syscalls/setpriority.S b/libc/arch-x86_64/syscalls/setpriority.S
new file mode 100644
index 0000000..98048ae
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setpriority.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setpriority)
+ movl $__NR_setpriority, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setpriority)
diff --git a/libc/arch-x86_64/syscalls/setregid.S b/libc/arch-x86_64/syscalls/setregid.S
new file mode 100644
index 0000000..713dd68
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setregid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setregid)
+ movl $__NR_setregid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setregid)
diff --git a/libc/arch-x86_64/syscalls/setresgid.S b/libc/arch-x86_64/syscalls/setresgid.S
new file mode 100644
index 0000000..eadc312
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setresgid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setresgid)
+ movl $__NR_setresgid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setresgid)
diff --git a/libc/arch-x86_64/syscalls/setrlimit.S b/libc/arch-x86_64/syscalls/setrlimit.S
new file mode 100644
index 0000000..cee2451
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setrlimit.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setrlimit)
+ movl $__NR_setrlimit, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setrlimit)
diff --git a/libc/arch-x86_64/syscalls/setsid.S b/libc/arch-x86_64/syscalls/setsid.S
new file mode 100644
index 0000000..882b8ee
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setsid.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setsid)
+ movl $__NR_setsid, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setsid)
diff --git a/libc/arch-x86_64/syscalls/setsockopt.S b/libc/arch-x86_64/syscalls/setsockopt.S
new file mode 100644
index 0000000..37de9c0
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setsockopt.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setsockopt)
+ movq %rcx, %r10
+ movl $__NR_setsockopt, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setsockopt)
diff --git a/libc/arch-x86_64/syscalls/settimeofday.S b/libc/arch-x86_64/syscalls/settimeofday.S
new file mode 100644
index 0000000..d5644bd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/settimeofday.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(settimeofday)
+ movl $__NR_settimeofday, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(settimeofday)
diff --git a/libc/arch-x86_64/syscalls/setxattr.S b/libc/arch-x86_64/syscalls/setxattr.S
new file mode 100644
index 0000000..ffc3b1c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/setxattr.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(setxattr)
+ movq %rcx, %r10
+ movl $__NR_setxattr, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setxattr)
diff --git a/libc/arch-x86_64/syscalls/shutdown.S b/libc/arch-x86_64/syscalls/shutdown.S
new file mode 100644
index 0000000..471593b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/shutdown.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(shutdown)
+ movl $__NR_shutdown, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(shutdown)
diff --git a/libc/arch-x86_64/syscalls/sigaltstack.S b/libc/arch-x86_64/syscalls/sigaltstack.S
new file mode 100644
index 0000000..71fd066
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sigaltstack.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sigaltstack)
+ movl $__NR_sigaltstack, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sigaltstack)
diff --git a/libc/arch-x86_64/syscalls/signalfd4.S b/libc/arch-x86_64/syscalls/signalfd4.S
new file mode 100644
index 0000000..545b957
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/signalfd4.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(signalfd4)
+ movq %rcx, %r10
+ movl $__NR_signalfd4, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(signalfd4)
diff --git a/libc/arch-x86_64/syscalls/socket.S b/libc/arch-x86_64/syscalls/socket.S
new file mode 100644
index 0000000..7407a40
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/socket.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(socket)
+ movl $__NR_socket, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(socket)
diff --git a/libc/arch-x86_64/syscalls/socketpair.S b/libc/arch-x86_64/syscalls/socketpair.S
new file mode 100644
index 0000000..06bb137
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/socketpair.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(socketpair)
+ movq %rcx, %r10
+ movl $__NR_socketpair, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(socketpair)
diff --git a/libc/arch-x86_64/syscalls/stat.S b/libc/arch-x86_64/syscalls/stat.S
new file mode 100644
index 0000000..c71d1be
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/stat.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(stat)
+ movl $__NR_stat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(stat)
diff --git a/libc/arch-x86_64/syscalls/statfs.S b/libc/arch-x86_64/syscalls/statfs.S
new file mode 100644
index 0000000..b0c3861
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/statfs.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(statfs)
+ movl $__NR_statfs, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(statfs)
diff --git a/libc/arch-x86_64/syscalls/swapoff.S b/libc/arch-x86_64/syscalls/swapoff.S
new file mode 100644
index 0000000..75a7a82
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/swapoff.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(swapoff)
+ movl $__NR_swapoff, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(swapoff)
diff --git a/libc/arch-x86_64/syscalls/swapon.S b/libc/arch-x86_64/syscalls/swapon.S
new file mode 100644
index 0000000..bd2aa08
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/swapon.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(swapon)
+ movl $__NR_swapon, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(swapon)
diff --git a/libc/arch-x86_64/syscalls/symlink.S b/libc/arch-x86_64/syscalls/symlink.S
new file mode 100644
index 0000000..285b680
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/symlink.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(symlink)
+ movl $__NR_symlink, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(symlink)
diff --git a/libc/arch-x86_64/syscalls/sync.S b/libc/arch-x86_64/syscalls/sync.S
new file mode 100644
index 0000000..d1f632f
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sync.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sync)
+ movl $__NR_sync, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sync)
diff --git a/libc/arch-x86_64/syscalls/sysinfo.S b/libc/arch-x86_64/syscalls/sysinfo.S
new file mode 100644
index 0000000..5f852bd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/sysinfo.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(sysinfo)
+ movl $__NR_sysinfo, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(sysinfo)
diff --git a/libc/arch-x86_64/syscalls/tgkill.S b/libc/arch-x86_64/syscalls/tgkill.S
new file mode 100644
index 0000000..f494098
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/tgkill.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(tgkill)
+ movl $__NR_tgkill, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(tgkill)
diff --git a/libc/arch-x86_64/syscalls/timerfd_create.S b/libc/arch-x86_64/syscalls/timerfd_create.S
new file mode 100644
index 0000000..98d4ec3
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/timerfd_create.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(timerfd_create)
+ movl $__NR_timerfd_create, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(timerfd_create)
diff --git a/libc/arch-x86_64/syscalls/timerfd_gettime.S b/libc/arch-x86_64/syscalls/timerfd_gettime.S
new file mode 100644
index 0000000..75f7eff
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/timerfd_gettime.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(timerfd_gettime)
+ movl $__NR_timerfd_gettime, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(timerfd_gettime)
diff --git a/libc/arch-x86_64/syscalls/timerfd_settime.S b/libc/arch-x86_64/syscalls/timerfd_settime.S
new file mode 100644
index 0000000..3c3d7bb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/timerfd_settime.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(timerfd_settime)
+ movq %rcx, %r10
+ movl $__NR_timerfd_settime, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(timerfd_settime)
diff --git a/libc/arch-x86_64/syscalls/times.S b/libc/arch-x86_64/syscalls/times.S
new file mode 100644
index 0000000..a4a76ac
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/times.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(times)
+ movl $__NR_times, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(times)
diff --git a/libc/arch-x86_64/syscalls/tkill.S b/libc/arch-x86_64/syscalls/tkill.S
new file mode 100644
index 0000000..6289479
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/tkill.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(tkill)
+ movl $__NR_tkill, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(tkill)
diff --git a/libc/arch-x86_64/syscalls/truncate.S b/libc/arch-x86_64/syscalls/truncate.S
new file mode 100644
index 0000000..0e1571b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/truncate.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(truncate)
+ movl $__NR_truncate, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(truncate)
diff --git a/libc/arch-x86_64/syscalls/umask.S b/libc/arch-x86_64/syscalls/umask.S
new file mode 100644
index 0000000..e301c71
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/umask.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(umask)
+ movl $__NR_umask, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(umask)
diff --git a/libc/arch-x86_64/syscalls/umount2.S b/libc/arch-x86_64/syscalls/umount2.S
new file mode 100644
index 0000000..c2c0e4c
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/umount2.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(umount2)
+ movl $__NR_umount2, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(umount2)
diff --git a/libc/arch-x86_64/syscalls/uname.S b/libc/arch-x86_64/syscalls/uname.S
new file mode 100644
index 0000000..829963a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/uname.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(uname)
+ movl $__NR_uname, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(uname)
diff --git a/libc/arch-x86_64/syscalls/unlink.S b/libc/arch-x86_64/syscalls/unlink.S
new file mode 100644
index 0000000..033828b
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/unlink.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(unlink)
+ movl $__NR_unlink, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(unlink)
diff --git a/libc/arch-x86_64/syscalls/unlinkat.S b/libc/arch-x86_64/syscalls/unlinkat.S
new file mode 100644
index 0000000..54ac28a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/unlinkat.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(unlinkat)
+ movl $__NR_unlinkat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(unlinkat)
diff --git a/libc/arch-x86_64/syscalls/unshare.S b/libc/arch-x86_64/syscalls/unshare.S
new file mode 100644
index 0000000..706e31a
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/unshare.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(unshare)
+ movl $__NR_unshare, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(unshare)
diff --git a/libc/arch-x86_64/syscalls/utimensat.S b/libc/arch-x86_64/syscalls/utimensat.S
new file mode 100644
index 0000000..426f7fd
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/utimensat.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(utimensat)
+ movq %rcx, %r10
+ movl $__NR_utimensat, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(utimensat)
diff --git a/libc/arch-x86_64/syscalls/utimes.S b/libc/arch-x86_64/syscalls/utimes.S
new file mode 100644
index 0000000..5eef3eb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/utimes.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(utimes)
+ movl $__NR_utimes, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(utimes)
diff --git a/libc/arch-x86_64/syscalls/vfork.S b/libc/arch-x86_64/syscalls/vfork.S
new file mode 100644
index 0000000..eb69562
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/vfork.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(vfork)
+ movl $__NR_vfork, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(vfork)
diff --git a/libc/arch-x86_64/syscalls/wait4.S b/libc/arch-x86_64/syscalls/wait4.S
new file mode 100644
index 0000000..1608a59
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/wait4.S
@@ -0,0 +1,18 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(wait4)
+ movq %rcx, %r10
+ movl $__NR_wait4, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(wait4)
diff --git a/libc/arch-x86_64/syscalls/write.S b/libc/arch-x86_64/syscalls/write.S
new file mode 100644
index 0000000..f1d18cb
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/write.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(write)
+ movl $__NR_write, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(write)
diff --git a/libc/arch-x86_64/syscalls/writev.S b/libc/arch-x86_64/syscalls/writev.S
new file mode 100644
index 0000000..c4727f8
--- /dev/null
+++ b/libc/arch-x86_64/syscalls/writev.S
@@ -0,0 +1,17 @@
+/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(writev)
+ movl $__NR_writev, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(writev)
diff --git a/libc/arch-x86_64/x86_64.mk b/libc/arch-x86_64/x86_64.mk
new file mode 100644
index 0000000..6a2bb9c
--- /dev/null
+++ b/libc/arch-x86_64/x86_64.mk
@@ -0,0 +1,19 @@
+_LIBC_ARCH_COMMON_SRC_FILES := \
+ arch-x86_64/bionic/__get_sp.S \
+ arch-x86_64/bionic/__get_tls.c \
+ arch-x86_64/bionic/__set_tls.c \
+ arch-x86_64/bionic/clone.S \
+ arch-x86_64/bionic/_exit_with_stack_teardown.S \
+ arch-x86_64/bionic/futex_x86_64.S \
+ arch-x86_64/bionic/setjmp.S \
+ arch-x86_64/bionic/_setjmp.S \
+ arch-x86_64/bionic/sigsetjmp.S \
+ arch-x86_64/bionic/syscall.S \
+ arch-x86_64/bionic/sigprocmask.c \
+ arch-x86_64/bionic/sigaction.c \
+ arch-x86_64/bionic/sigsuspend.c \
+
+_LIBC_ARCH_STATIC_SRC_FILES := \
+ bionic/dl_iterate_phdr_static.c \
+
+_LIBC_ARCH_DYNAMIC_SRC_FILES :=
diff --git a/libc/bionic/debug_stacktrace.cpp b/libc/bionic/debug_stacktrace.cpp
index fb933e6..0f93b26 100644
--- a/libc/bionic/debug_stacktrace.cpp
+++ b/libc/bionic/debug_stacktrace.cpp
@@ -80,6 +80,18 @@
}
};
+#if defined(__arm__) && !defined(_Unwind_GetIP)
+// Older versions of Clang don't provide a definition of _Unwind_GetIP(), so
+// we include an appropriate version of our own. Once we have updated to
+// Clang 3.4, this code can be removed.
+static __inline__
+uintptr_t _Unwind_GetIP(struct _Unwind_Context *__context) {
+ uintptr_t __ip = 0;
+ _Unwind_VRS_Get(__context, _UVRSC_CORE, 15, _UVRSD_UINT32, &__ip);
+ return __ip & ~0x1;
+}
+#endif
+
static _Unwind_Reason_Code trace_function(__unwind_context* context, void* arg) {
stack_crawl_state_t* state = static_cast<stack_crawl_state_t*>(arg);
diff --git a/libc/bionic/dl_iterate_phdr_static.c b/libc/bionic/dl_iterate_phdr_static.c
index fc79ce5..d03d3d2 100644
--- a/libc/bionic/dl_iterate_phdr_static.c
+++ b/libc/bionic/dl_iterate_phdr_static.c
@@ -35,7 +35,7 @@
extern void* __executable_start;
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data), void* data) {
- Elf32_Ehdr* ehdr = (Elf32_Ehdr*) &__executable_start;
+ Elf_Ehdr* ehdr = (Elf_Ehdr*) &__executable_start;
// TODO: again, copied from linker.c. Find a better home for this later.
if (ehdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
@@ -51,7 +51,7 @@
struct dl_phdr_info exe_info;
exe_info.dlpi_addr = 0;
exe_info.dlpi_name = NULL;
- exe_info.dlpi_phdr = (Elf32_Phdr*) ((unsigned long) ehdr + ehdr->e_phoff);
+ exe_info.dlpi_phdr = (Elf_Phdr*) ((unsigned long) ehdr + ehdr->e_phoff);
exe_info.dlpi_phnum = ehdr->e_phnum;
#ifdef AT_SYSINFO_EHDR
@@ -62,15 +62,15 @@
}
// Try the VDSO if that didn't work.
- Elf32_Ehdr* ehdr_vdso = (Elf32_Ehdr*) getauxval(AT_SYSINFO_EHDR);
+ Elf_Ehdr* ehdr_vdso = (Elf_Ehdr*) getauxval(AT_SYSINFO_EHDR);
struct dl_phdr_info vdso_info;
vdso_info.dlpi_addr = 0;
vdso_info.dlpi_name = NULL;
- vdso_info.dlpi_phdr = (Elf32_Phdr*) ((char*) ehdr_vdso + ehdr_vdso->e_phoff);
+ vdso_info.dlpi_phdr = (Elf_Phdr*) ((char*) ehdr_vdso + ehdr_vdso->e_phoff);
vdso_info.dlpi_phnum = ehdr_vdso->e_phnum;
for (size_t i = 0; i < vdso_info.dlpi_phnum; ++i) {
if (vdso_info.dlpi_phdr[i].p_type == PT_LOAD) {
- vdso_info.dlpi_addr = (Elf32_Addr) ehdr_vdso - vdso_info.dlpi_phdr[i].p_vaddr;
+ vdso_info.dlpi_addr = (Elf_Addr) ehdr_vdso - vdso_info.dlpi_phdr[i].p_vaddr;
break;
}
}
diff --git a/libc/bionic/getauxval.cpp b/libc/bionic/getauxval.cpp
index fd225e0..3ee31d6 100644
--- a/libc/bionic/getauxval.cpp
+++ b/libc/bionic/getauxval.cpp
@@ -32,10 +32,10 @@
#include <private/bionic_auxv.h>
#include <elf.h>
-__LIBC_HIDDEN__ Elf32_auxv_t* __libc_auxv = NULL;
+__LIBC_HIDDEN__ Elf_auxv_t* __libc_auxv = NULL;
extern "C" unsigned long int getauxval(unsigned long int type) {
- for (Elf32_auxv_t* v = __libc_auxv; v->a_type != AT_NULL; ++v) {
+ for (Elf_auxv_t* v = __libc_auxv; v->a_type != AT_NULL; ++v) {
if (v->a_type == type) {
return v->a_un.a_val;
}
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index a6b20eb..a60e414 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -67,16 +67,16 @@
}
static void apply_gnu_relro() {
- Elf32_Phdr* phdr_start = reinterpret_cast<Elf32_Phdr*>(getauxval(AT_PHDR));
+ Elf_Phdr* phdr_start = reinterpret_cast<Elf_Phdr*>(getauxval(AT_PHDR));
unsigned long int phdr_ct = getauxval(AT_PHNUM);
- for (Elf32_Phdr* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) {
+ for (Elf_Phdr* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) {
if (phdr->p_type != PT_GNU_RELRO) {
continue;
}
- Elf32_Addr seg_page_start = PAGE_START(phdr->p_vaddr);
- Elf32_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz);
+ Elf_Addr seg_page_start = PAGE_START(phdr->p_vaddr);
+ Elf_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz);
// Check return value here? What do we do if we fail?
mprotect(reinterpret_cast<void*>(seg_page_start), seg_page_end - seg_page_start, PROT_READ);
diff --git a/libc/bionic/malloc_debug_qemu.cpp b/libc/bionic/malloc_debug_qemu.cpp
index 4c666a9..1f64aa8 100644
--- a/libc/bionic/malloc_debug_qemu.cpp
+++ b/libc/bionic/malloc_debug_qemu.cpp
@@ -684,7 +684,7 @@
desc.suffix_size = DEFAULT_SUFFIX_SIZE;
desc.ptr = dlmalloc(mallocdesc_alloc_size(&desc));
if (desc.ptr == NULL) {
- qemu_error_log("<libc_pid=%03u, pid=%03u> malloc(%u): dlmalloc(%u) failed.",
+ qemu_error_log("<libc_pid=%03u, pid=%03u> malloc(%zd): dlmalloc(%u) failed.",
malloc_pid, getpid(), bytes, mallocdesc_alloc_size(&desc));
return NULL;
}
@@ -699,7 +699,7 @@
#if TEST_ACCESS_VIOLATIONS
test_access_violation(&desc);
#endif // TEST_ACCESS_VIOLATIONS
- log_mdesc(info, &desc, "+++ <libc_pid=%03u, pid=%03u> malloc(%u) -> ",
+ log_mdesc(info, &desc, "+++ <libc_pid=%03u, pid=%03u> malloc(%zd) -> ",
malloc_pid, getpid(), bytes);
return mallocdesc_user_ptr(&desc);
}
@@ -797,14 +797,14 @@
}
desc.ptr = dlcalloc(total_elements, elem_size);
if (desc.ptr == NULL) {
- error_log("<libc_pid=%03u, pid=%03u> calloc: dlcalloc(%u(%u), %u) (prx=%u, sfx=%u) failed.",
+ error_log("<libc_pid=%03u, pid=%03u> calloc: dlcalloc(%zd(%zd), %zd) (prx=%u, sfx=%u) failed.",
malloc_pid, getpid(), n_elements, total_elements, elem_size,
desc.prefix_size, desc.suffix_size);
return NULL;
}
if (notify_qemu_malloc(&desc)) {
- log_mdesc(error, &desc, "<libc_pid=%03u, pid=%03u>: calloc(%u(%u), %u): notify_malloc failed for ",
+ log_mdesc(error, &desc, "<libc_pid=%03u, pid=%03u>: calloc(%zd(%zd), %zd): notify_malloc failed for ",
malloc_pid, getpid(), n_elements, total_elements, elem_size);
dlfree(desc.ptr);
return NULL;
@@ -812,7 +812,7 @@
#if TEST_ACCESS_VIOLATIONS
test_access_violation(&desc);
#endif // TEST_ACCESS_VIOLATIONS
- log_mdesc(info, &desc, "### <libc_pid=%03u, pid=%03u> calloc(%u(%u), %u) -> ",
+ log_mdesc(info, &desc, "### <libc_pid=%03u, pid=%03u> calloc(%zd(%zd), %zd) -> ",
malloc_pid, getpid(), n_elements, total_elements, elem_size);
return mallocdesc_user_ptr(&desc);
}
@@ -832,14 +832,14 @@
if (mem == NULL) {
// Nothing to realloc. just do regular malloc.
- qemu_info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %u) redir to malloc",
+ qemu_info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %zd) redir to malloc",
malloc_pid, getpid(), mem, bytes);
return qemu_instrumented_malloc(bytes);
}
if (bytes == 0) {
// This is a "free" condition.
- qemu_info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %u) redir to free and malloc",
+ qemu_info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %zd) redir to free and malloc",
malloc_pid, getpid(), mem, bytes);
qemu_instrumented_free(mem);
@@ -850,7 +850,7 @@
// Query emulator for the reallocating block information.
if (query_qemu_malloc_info(mem, &cur_desc, 2)) {
// Note that this violation should be already caught in the emulator.
- error_log("<libc_pid=%03u, pid=%03u>: realloc(%p, %u) query_info failed.",
+ error_log("<libc_pid=%03u, pid=%03u>: realloc(%p, %zd) query_info failed.",
malloc_pid, getpid(), mem, bytes);
return NULL;
}
@@ -863,7 +863,7 @@
* for this memory block. Note that this violation should be already caught
* in the emulator.*/
if (mem != mallocdesc_user_ptr(&cur_desc)) {
- log_mdesc(error, &cur_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %u) is invalid for ",
+ log_mdesc(error, &cur_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %zd) is invalid for ",
malloc_pid, getpid(), mem, bytes);
return NULL;
}
@@ -879,7 +879,7 @@
new_desc.suffix_size = DEFAULT_SUFFIX_SIZE;
new_desc.ptr = dlmalloc(mallocdesc_alloc_size(&new_desc));
if (new_desc.ptr == NULL) {
- log_mdesc(error, &cur_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %u): dlmalloc(%u) failed on ",
+ log_mdesc(error, &cur_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %zd): dlmalloc(%u) failed on ",
malloc_pid, getpid(), mem, bytes,
mallocdesc_alloc_size(&new_desc));
return NULL;
@@ -895,7 +895,7 @@
// Register new block with emulator.
if (notify_qemu_malloc(&new_desc)) {
- log_mdesc(error, &new_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %u) notify_malloc failed -> ",
+ log_mdesc(error, &new_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %zd) notify_malloc failed -> ",
malloc_pid, getpid(), mem, bytes);
log_mdesc(error, &cur_desc, " <- ");
dlfree(new_desc.ptr);
@@ -908,7 +908,7 @@
// Free old block.
if (notify_qemu_free(mem)) {
- log_mdesc(error, &cur_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %u): notify_free failed for ",
+ log_mdesc(error, &cur_desc, "<libc_pid=%03u, pid=%03u>: realloc(%p, %zd): notify_free failed for ",
malloc_pid, getpid(), mem, bytes);
/* Since we registered new decriptor with the emulator, we need
* to unregister it before freeing newly allocated block. */
@@ -918,7 +918,7 @@
}
dlfree(cur_desc.ptr);
- log_mdesc(info, &new_desc, "=== <libc_pid=%03u, pid=%03u>: realloc(%p, %u) -> ",
+ log_mdesc(info, &new_desc, "=== <libc_pid=%03u, pid=%03u>: realloc(%p, %zd) -> ",
malloc_pid, getpid(), mem, bytes);
log_mdesc(info, &cur_desc, " <- ");
@@ -933,7 +933,7 @@
if (bytes == 0) {
// Just let go zero bytes allocation.
- qemu_info_log("::: <libc_pid=%03u, pid=%03u>: memalign(%X, %u) redir to malloc",
+ qemu_info_log("::: <libc_pid=%03u, pid=%03u>: memalign(%zx, %zd) redir to malloc",
malloc_pid, getpid(), alignment, bytes);
return qemu_instrumented_malloc(0);
}
@@ -948,13 +948,13 @@
desc.suffix_size = DEFAULT_SUFFIX_SIZE;
desc.ptr = dlmemalign(desc.prefix_size, mallocdesc_alloc_size(&desc));
if (desc.ptr == NULL) {
- error_log("<libc_pid=%03u, pid=%03u> memalign(%X, %u): dlmalloc(%u) failed.",
+ error_log("<libc_pid=%03u, pid=%03u> memalign(%zx, %zd): dlmalloc(%u) failed.",
malloc_pid, getpid(), alignment, bytes,
mallocdesc_alloc_size(&desc));
return NULL;
}
if (notify_qemu_malloc(&desc)) {
- log_mdesc(error, &desc, "<libc_pid=%03u, pid=%03u>: memalign(%X, %u): notify_malloc failed for ",
+ log_mdesc(error, &desc, "<libc_pid=%03u, pid=%03u>: memalign(%zx, %zd): notify_malloc failed for ",
malloc_pid, getpid(), alignment, bytes);
dlfree(desc.ptr);
return NULL;
@@ -964,7 +964,7 @@
test_access_violation(&desc);
#endif // TEST_ACCESS_VIOLATIONS
- log_mdesc(info, &desc, "@@@ <libc_pid=%03u, pid=%03u> memalign(%X, %u) -> ",
+ log_mdesc(info, &desc, "@@@ <libc_pid=%03u, pid=%03u> memalign(%zx, %zd) -> ",
malloc_pid, getpid(), alignment, bytes);
return mallocdesc_user_ptr(&desc);
}
diff --git a/libc/bionic/pthread_attr.cpp b/libc/bionic/pthread_attr.cpp
index 2763b0c..dfb740d 100644
--- a/libc/bionic/pthread_attr.cpp
+++ b/libc/bionic/pthread_attr.cpp
@@ -111,7 +111,7 @@
if ((stack_size & (PAGE_SIZE - 1) || stack_size < PTHREAD_STACK_MIN)) {
return EINVAL;
}
- if ((uint32_t)stack_base & (PAGE_SIZE - 1)) {
+ if (reinterpret_cast<uintptr_t>(stack_base) & (PAGE_SIZE - 1)) {
return EINVAL;
}
attr->stack_base = stack_base;
diff --git a/libc/bionic/pthread_key.cpp b/libc/bionic/pthread_key.cpp
index 2ae6519..7e8b4cd 100644
--- a/libc/bionic/pthread_key.cpp
+++ b/libc/bionic/pthread_key.cpp
@@ -239,7 +239,8 @@
// to check that the key is properly allocated. If the key was not
// allocated, the value read from the TLS should always be NULL
// due to pthread_key_delete() clearing the values for all threads.
- return (void *)(((unsigned *)__get_tls())[key]);
+ uintptr_t address = reinterpret_cast<volatile uintptr_t*>(__get_tls())[key];
+ return reinterpret_cast<void*>(address);
}
int pthread_setspecific(pthread_key_t key, const void* ptr) {
@@ -249,6 +250,6 @@
return EINVAL;
}
- ((uint32_t *)__get_tls())[key] = (uint32_t)ptr;
+ reinterpret_cast<volatile uintptr_t*>(__get_tls())[key] = reinterpret_cast<uintptr_t>(ptr);
return 0;
}
diff --git a/libc/bionic/statvfs.cpp b/libc/bionic/statvfs.cpp
index 5d42aaa..5d58281 100644
--- a/libc/bionic/statvfs.cpp
+++ b/libc/bionic/statvfs.cpp
@@ -23,10 +23,6 @@
#define ST_VALID 0x0020
-#if defined(__mips__)
-#define __val val
-#endif
-
static void __statfs_to_statvfs(const struct statfs& in, struct statvfs* out) {
out->f_bsize = in.f_bsize;
out->f_frsize = in.f_frsize;
diff --git a/libc/bionic/tcgetpgrp.c b/libc/bionic/tcgetpgrp.c
index 4355014..ebff66a 100644
--- a/libc/bionic/tcgetpgrp.c
+++ b/libc/bionic/tcgetpgrp.c
@@ -1,5 +1,4 @@
-/* bionic/unistd/tcgetpgrp.c
-**
+/*
** Copyright 2006, The Android Open Source Project
**
** Redistribution and use in source and binary forms, with or without
diff --git a/libc/bionic/tcsetpgrp.c b/libc/bionic/tcsetpgrp.c
index b83b997..06d9cd0 100644
--- a/libc/bionic/tcsetpgrp.c
+++ b/libc/bionic/tcsetpgrp.c
@@ -1,5 +1,4 @@
-/* bionic/unistd/tcsetpgrp.c
-**
+/*
** Copyright 2006, The Android Open Source Project
**
** Redistribution and use in source and binary forms, with or without
diff --git a/libc/include/asm/page.h b/libc/include/asm/page.h
new file mode 100644
index 0000000..d401a3f
--- /dev/null
+++ b/libc/include/asm/page.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ASM_PAGE_H
+#define __ASM_PAGE_H
+
+/* New code should use sysconf(_SC_PAGESIZE) instead. */
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1ULL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE - 1))
+
+#endif
diff --git a/libc/include/elf.h b/libc/include/elf.h
index ac0f1d2..285eb7d 100644
--- a/libc/include/elf.h
+++ b/libc/include/elf.h
@@ -46,5 +46,10 @@
} a_un;
} Elf64_auxv_t;
-#endif /* _ELF_H */
+#ifdef __LP64__
+# define Elf_auxv_t Elf64_auxv_t
+#else
+# define Elf_auxv_t Elf32_auxv_t
+#endif
+#endif /* _ELF_H */
diff --git a/libc/include/link.h b/libc/include/link.h
index 0edf5df..341fbf1 100644
--- a/libc/include/link.h
+++ b/libc/include/link.h
@@ -33,8 +33,7 @@
__BEGIN_DECLS
-/* bionic is currently only 32-bit. */
-#define ElfW(type) Elf32_##type
+#define ElfW(type) Elf_##type
struct dl_phdr_info {
ElfW(Addr) dlpi_addr;
diff --git a/libc/include/sys/glibc-syscalls.h b/libc/include/sys/glibc-syscalls.h
index 44f37c8..8a88c75 100644
--- a/libc/include/sys/glibc-syscalls.h
+++ b/libc/include/sys/glibc-syscalls.h
@@ -1046,5 +1046,317 @@
#define SYS_waitpid __NR_waitpid
#define SYS_write __NR_write
#define SYS_writev __NR_writev
+#elif defined(__x86_64__)
+#define SYS_accept __NR_accept
+#define SYS_accept4 __NR_accept4
+#define SYS_access __NR_access
+#define SYS_acct __NR_acct
+#define SYS_add_key __NR_add_key
+#define SYS_adjtimex __NR_adjtimex
+#define SYS_afs_syscall __NR_afs_syscall
+#define SYS_alarm __NR_alarm
+#define SYS_arch_prctl __NR_arch_prctl
+#define SYS_bind __NR_bind
+#define SYS_brk __NR_brk
+#define SYS_capget __NR_capget
+#define SYS_capset __NR_capset
+#define SYS_chdir __NR_chdir
+#define SYS_chmod __NR_chmod
+#define SYS_chown __NR_chown
+#define SYS_chroot __NR_chroot
+#define SYS_clock_adjtime __NR_clock_adjtime
+#define SYS_clock_getres __NR_clock_getres
+#define SYS_clock_gettime __NR_clock_gettime
+#define SYS_clock_nanosleep __NR_clock_nanosleep
+#define SYS_clock_settime __NR_clock_settime
+#define SYS_clone __NR_clone
+#define SYS_close __NR_close
+#define SYS_connect __NR_connect
+#define SYS_creat __NR_creat
+#define SYS_create_module __NR_create_module
+#define SYS_delete_module __NR_delete_module
+#define SYS_dup __NR_dup
+#define SYS_dup2 __NR_dup2
+#define SYS_dup3 __NR_dup3
+#define SYS_epoll_create __NR_epoll_create
+#define SYS_epoll_create1 __NR_epoll_create1
+#define SYS_epoll_ctl __NR_epoll_ctl
+#define SYS_epoll_ctl_old __NR_epoll_ctl_old
+#define SYS_epoll_pwait __NR_epoll_pwait
+#define SYS_epoll_wait __NR_epoll_wait
+#define SYS_epoll_wait_old __NR_epoll_wait_old
+#define SYS_eventfd __NR_eventfd
+#define SYS_eventfd2 __NR_eventfd2
+#define SYS_execve __NR_execve
+#define SYS_exit __NR_exit
+#define SYS_exit_group __NR_exit_group
+#define SYS_faccessat __NR_faccessat
+#define SYS_fadvise64 __NR_fadvise64
+#define SYS_fallocate __NR_fallocate
+#define SYS_fanotify_init __NR_fanotify_init
+#define SYS_fanotify_mark __NR_fanotify_mark
+#define SYS_fchdir __NR_fchdir
+#define SYS_fchmod __NR_fchmod
+#define SYS_fchmodat __NR_fchmodat
+#define SYS_fchown __NR_fchown
+#define SYS_fchownat __NR_fchownat
+#define SYS_fcntl __NR_fcntl
+#define SYS_fdatasync __NR_fdatasync
+#define SYS_fgetxattr __NR_fgetxattr
+#define SYS_flistxattr __NR_flistxattr
+#define SYS_flock __NR_flock
+#define SYS_fork __NR_fork
+#define SYS_fremovexattr __NR_fremovexattr
+#define SYS_fsetxattr __NR_fsetxattr
+#define SYS_fstat __NR_fstat
+#define SYS_fstatfs __NR_fstatfs
+#define SYS_fsync __NR_fsync
+#define SYS_ftruncate __NR_ftruncate
+#define SYS_futex __NR_futex
+#define SYS_futimesat __NR_futimesat
+#define SYS_get_kernel_syms __NR_get_kernel_syms
+#define SYS_get_mempolicy __NR_get_mempolicy
+#define SYS_get_robust_list __NR_get_robust_list
+#define SYS_get_thread_area __NR_get_thread_area
+#define SYS_getcpu __NR_getcpu
+#define SYS_getcwd __NR_getcwd
+#define SYS_getdents __NR_getdents
+#define SYS_getdents64 __NR_getdents64
+#define SYS_getegid __NR_getegid
+#define SYS_geteuid __NR_geteuid
+#define SYS_getgid __NR_getgid
+#define SYS_getgroups __NR_getgroups
+#define SYS_getitimer __NR_getitimer
+#define SYS_getpeername __NR_getpeername
+#define SYS_getpgid __NR_getpgid
+#define SYS_getpgrp __NR_getpgrp
+#define SYS_getpid __NR_getpid
+#define SYS_getpmsg __NR_getpmsg
+#define SYS_getppid __NR_getppid
+#define SYS_getpriority __NR_getpriority
+#define SYS_getresgid __NR_getresgid
+#define SYS_getresuid __NR_getresuid
+#define SYS_getrlimit __NR_getrlimit
+#define SYS_getrusage __NR_getrusage
+#define SYS_getsid __NR_getsid
+#define SYS_getsockname __NR_getsockname
+#define SYS_getsockopt __NR_getsockopt
+#define SYS_gettid __NR_gettid
+#define SYS_gettimeofday __NR_gettimeofday
+#define SYS_getuid __NR_getuid
+#define SYS_getxattr __NR_getxattr
+#define SYS_init_module __NR_init_module
+#define SYS_inotify_add_watch __NR_inotify_add_watch
+#define SYS_inotify_init __NR_inotify_init
+#define SYS_inotify_init1 __NR_inotify_init1
+#define SYS_inotify_rm_watch __NR_inotify_rm_watch
+#define SYS_io_cancel __NR_io_cancel
+#define SYS_io_destroy __NR_io_destroy
+#define SYS_io_getevents __NR_io_getevents
+#define SYS_io_setup __NR_io_setup
+#define SYS_io_submit __NR_io_submit
+#define SYS_ioctl __NR_ioctl
+#define SYS_ioperm __NR_ioperm
+#define SYS_iopl __NR_iopl
+#define SYS_ioprio_get __NR_ioprio_get
+#define SYS_ioprio_set __NR_ioprio_set
+#define SYS_kexec_load __NR_kexec_load
+#define SYS_keyctl __NR_keyctl
+#define SYS_kill __NR_kill
+#define SYS_lchown __NR_lchown
+#define SYS_lgetxattr __NR_lgetxattr
+#define SYS_link __NR_link
+#define SYS_linkat __NR_linkat
+#define SYS_listen __NR_listen
+#define SYS_listxattr __NR_listxattr
+#define SYS_llistxattr __NR_llistxattr
+#define SYS_lookup_dcookie __NR_lookup_dcookie
+#define SYS_lremovexattr __NR_lremovexattr
+#define SYS_lseek __NR_lseek
+#define SYS_lsetxattr __NR_lsetxattr
+#define SYS_lstat __NR_lstat
+#define SYS_madvise __NR_madvise
+#define SYS_mbind __NR_mbind
+#define SYS_migrate_pages __NR_migrate_pages
+#define SYS_mincore __NR_mincore
+#define SYS_mkdir __NR_mkdir
+#define SYS_mkdirat __NR_mkdirat
+#define SYS_mknod __NR_mknod
+#define SYS_mknodat __NR_mknodat
+#define SYS_mlock __NR_mlock
+#define SYS_mlockall __NR_mlockall
+#define SYS_mmap __NR_mmap
+#define SYS_modify_ldt __NR_modify_ldt
+#define SYS_mount __NR_mount
+#define SYS_move_pages __NR_move_pages
+#define SYS_mprotect __NR_mprotect
+#define SYS_mq_getsetattr __NR_mq_getsetattr
+#define SYS_mq_notify __NR_mq_notify
+#define SYS_mq_open __NR_mq_open
+#define SYS_mq_timedreceive __NR_mq_timedreceive
+#define SYS_mq_timedsend __NR_mq_timedsend
+#define SYS_mq_unlink __NR_mq_unlink
+#define SYS_mremap __NR_mremap
+#define SYS_msgctl __NR_msgctl
+#define SYS_msgget __NR_msgget
+#define SYS_msgrcv __NR_msgrcv
+#define SYS_msgsnd __NR_msgsnd
+#define SYS_msync __NR_msync
+#define SYS_munlock __NR_munlock
+#define SYS_munlockall __NR_munlockall
+#define SYS_munmap __NR_munmap
+#define SYS_name_to_handle_at __NR_name_to_handle_at
+#define SYS_nanosleep __NR_nanosleep
+#define SYS_newfstatat __NR_newfstatat
+#define SYS_nfsservctl __NR_nfsservctl
+#define SYS_open __NR_open
+#define SYS_open_by_handle_at __NR_open_by_handle_at
+#define SYS_openat __NR_openat
+#define SYS_pause __NR_pause
+#define SYS_perf_event_open __NR_perf_event_open
+#define SYS_personality __NR_personality
+#define SYS_pipe __NR_pipe
+#define SYS_pipe2 __NR_pipe2
+#define SYS_pivot_root __NR_pivot_root
+#define SYS_poll __NR_poll
+#define SYS_ppoll __NR_ppoll
+#define SYS_prctl __NR_prctl
+#define SYS_pread64 __NR_pread64
+#define SYS_preadv __NR_preadv
+#define SYS_prlimit64 __NR_prlimit64
+#define SYS_process_vm_readv __NR_process_vm_readv
+#define SYS_process_vm_writev __NR_process_vm_writev
+#define SYS_pselect6 __NR_pselect6
+#define SYS_ptrace __NR_ptrace
+#define SYS_putpmsg __NR_putpmsg
+#define SYS_pwrite64 __NR_pwrite64
+#define SYS_pwritev __NR_pwritev
+#define SYS_query_module __NR_query_module
+#define SYS_quotactl __NR_quotactl
+#define SYS_read __NR_read
+#define SYS_readahead __NR_readahead
+#define SYS_readlink __NR_readlink
+#define SYS_readlinkat __NR_readlinkat
+#define SYS_readv __NR_readv
+#define SYS_reboot __NR_reboot
+#define SYS_recvfrom __NR_recvfrom
+#define SYS_recvmmsg __NR_recvmmsg
+#define SYS_recvmsg __NR_recvmsg
+#define SYS_remap_file_pages __NR_remap_file_pages
+#define SYS_removexattr __NR_removexattr
+#define SYS_rename __NR_rename
+#define SYS_renameat __NR_renameat
+#define SYS_request_key __NR_request_key
+#define SYS_restart_syscall __NR_restart_syscall
+#define SYS_rmdir __NR_rmdir
+#define SYS_rt_sigaction __NR_rt_sigaction
+#define SYS_rt_sigpending __NR_rt_sigpending
+#define SYS_rt_sigprocmask __NR_rt_sigprocmask
+#define SYS_rt_sigqueueinfo __NR_rt_sigqueueinfo
+#define SYS_rt_sigreturn __NR_rt_sigreturn
+#define SYS_rt_sigsuspend __NR_rt_sigsuspend
+#define SYS_rt_sigtimedwait __NR_rt_sigtimedwait
+#define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
+#define SYS_sched_get_priority_max __NR_sched_get_priority_max
+#define SYS_sched_get_priority_min __NR_sched_get_priority_min
+#define SYS_sched_getaffinity __NR_sched_getaffinity
+#define SYS_sched_getparam __NR_sched_getparam
+#define SYS_sched_getscheduler __NR_sched_getscheduler
+#define SYS_sched_rr_get_interval __NR_sched_rr_get_interval
+#define SYS_sched_setaffinity __NR_sched_setaffinity
+#define SYS_sched_setparam __NR_sched_setparam
+#define SYS_sched_setscheduler __NR_sched_setscheduler
+#define SYS_sched_yield __NR_sched_yield
+#define SYS_security __NR_security
+#define SYS_select __NR_select
+#define SYS_semctl __NR_semctl
+#define SYS_semget __NR_semget
+#define SYS_semop __NR_semop
+#define SYS_semtimedop __NR_semtimedop
+#define SYS_sendfile __NR_sendfile
+#define SYS_sendmmsg __NR_sendmmsg
+#define SYS_sendmsg __NR_sendmsg
+#define SYS_sendto __NR_sendto
+#define SYS_set_mempolicy __NR_set_mempolicy
+#define SYS_set_robust_list __NR_set_robust_list
+#define SYS_set_thread_area __NR_set_thread_area
+#define SYS_set_tid_address __NR_set_tid_address
+#define SYS_setdomainname __NR_setdomainname
+#define SYS_setfsgid __NR_setfsgid
+#define SYS_setfsuid __NR_setfsuid
+#define SYS_setgid __NR_setgid
+#define SYS_setgroups __NR_setgroups
+#define SYS_sethostname __NR_sethostname
+#define SYS_setitimer __NR_setitimer
+#define SYS_setns __NR_setns
+#define SYS_setpgid __NR_setpgid
+#define SYS_setpriority __NR_setpriority
+#define SYS_setregid __NR_setregid
+#define SYS_setresgid __NR_setresgid
+#define SYS_setresuid __NR_setresuid
+#define SYS_setreuid __NR_setreuid
+#define SYS_setrlimit __NR_setrlimit
+#define SYS_setsid __NR_setsid
+#define SYS_setsockopt __NR_setsockopt
+#define SYS_settimeofday __NR_settimeofday
+#define SYS_setuid __NR_setuid
+#define SYS_setxattr __NR_setxattr
+#define SYS_shmat __NR_shmat
+#define SYS_shmctl __NR_shmctl
+#define SYS_shmdt __NR_shmdt
+#define SYS_shmget __NR_shmget
+#define SYS_shutdown __NR_shutdown
+#define SYS_sigaltstack __NR_sigaltstack
+#define SYS_signalfd __NR_signalfd
+#define SYS_signalfd4 __NR_signalfd4
+#define SYS_socket __NR_socket
+#define SYS_socketpair __NR_socketpair
+#define SYS_splice __NR_splice
+#define SYS_stat __NR_stat
+#define SYS_statfs __NR_statfs
+#define SYS_swapoff __NR_swapoff
+#define SYS_swapon __NR_swapon
+#define SYS_symlink __NR_symlink
+#define SYS_symlinkat __NR_symlinkat
+#define SYS_sync __NR_sync
+#define SYS_sync_file_range __NR_sync_file_range
+#define SYS_syncfs __NR_syncfs
+#define SYS_sysfs __NR_sysfs
+#define SYS_sysinfo __NR_sysinfo
+#define SYS_syslog __NR_syslog
+#define SYS_tee __NR_tee
+#define SYS_tgkill __NR_tgkill
+#define SYS_time __NR_time
+#define SYS_timer_create __NR_timer_create
+#define SYS_timer_delete __NR_timer_delete
+#define SYS_timer_getoverrun __NR_timer_getoverrun
+#define SYS_timer_gettime __NR_timer_gettime
+#define SYS_timer_settime __NR_timer_settime
+#define SYS_timerfd_create __NR_timerfd_create
+#define SYS_timerfd_gettime __NR_timerfd_gettime
+#define SYS_timerfd_settime __NR_timerfd_settime
+#define SYS_times __NR_times
+#define SYS_tkill __NR_tkill
+#define SYS_truncate __NR_truncate
+#define SYS_tuxcall __NR_tuxcall
+#define SYS_umask __NR_umask
+#define SYS_umount2 __NR_umount2
+#define SYS_uname __NR_uname
+#define SYS_unlink __NR_unlink
+#define SYS_unlinkat __NR_unlinkat
+#define SYS_unshare __NR_unshare
+#define SYS_uselib __NR_uselib
+#define SYS_ustat __NR_ustat
+#define SYS_utime __NR_utime
+#define SYS_utimensat __NR_utimensat
+#define SYS_utimes __NR_utimes
+#define SYS_vfork __NR_vfork
+#define SYS_vhangup __NR_vhangup
+#define SYS_vmsplice __NR_vmsplice
+#define SYS_vserver __NR_vserver
+#define SYS_wait4 __NR_wait4
+#define SYS_waitid __NR_waitid
+#define SYS_write __NR_write
+#define SYS_writev __NR_writev
#endif
#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 9d11ee8..8d77957 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -35,11 +35,28 @@
__BEGIN_DECLS
-typedef __kernel_fd_set fd_set;
+#define __FD_SETSIZE 1024
+#define __NFDBITS (8 * sizeof(unsigned long))
+#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS)
-extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-extern int pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *errfds,
- const struct timespec *timeout, const sigset_t *sigmask);
+typedef struct {
+ unsigned long fds_bits[__FDSET_LONGS];
+} fd_set;
+
+#define __FDELT(fd) ((fd) / __NFDBITS)
+#define __FDMASK(fd) (1UL << ((fd) % __NFDBITS))
+#define __FDS_BITS(set) (((fd_set*)(set))->fds_bits)
+
+#define __FD_CLR(fd, set) (__FDS_BITS(set)[__FDELT(fd)] &= ~__FDMASK(fd))
+#define __FD_SET(fd, set) (__FDS_BITS(set)[__FDELT(fd)] |= __FDMASK(fd))
+
+#define __FD_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
+
+#define __FD_ZERO(set) (__builtin_memset(set, 0, sizeof(*(fd_set*)(set))))
+
+extern int select(int, fd_set*, fd_set*, fd_set*, struct timeval*);
+extern int pselect(int n, fd_set* read_fds, fd_set* write_fds, fd_set* err_fds,
+ const struct timespec * timeout, const sigset_t* sigmask);
__END_DECLS
diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h
index 6a55c99..6fce3b4 100644
--- a/libc/include/sys/vfs.h
+++ b/libc/include/sys/vfs.h
@@ -34,40 +34,51 @@
__BEGIN_DECLS
-/* These correspond to the kernel's statfs64 type. */
+/* The kernel's __kernel_fsid_t has a 'val' member but glibc uses '__val'. */
+typedef struct { int __val[2]; } __fsid_t;
+
+/* Our struct statfs corresponds to the kernel's statfs64 type. */
#ifdef __mips__
struct statfs {
- uint32_t f_type;
- uint32_t f_bsize;
- uint32_t f_frsize;
- uint32_t __pad;
- uint64_t f_blocks;
- uint64_t f_bfree;
- uint64_t f_files;
- uint64_t f_ffree;
- uint64_t f_bavail;
- __kernel_fsid_t f_fsid;
- uint32_t f_namelen;
- uint32_t f_flags;
- uint32_t f_spare[5];
+ uint32_t f_type;
+ uint32_t f_bsize;
+ uint32_t f_frsize;
+ uint32_t __pad;
+ uint64_t f_blocks;
+ uint64_t f_bfree;
+ uint64_t f_files;
+ uint64_t f_ffree;
+ uint64_t f_bavail;
+ __fsid_t f_fsid;
+ uint32_t f_namelen;
+ uint32_t f_flags;
+ uint32_t f_spare[5];
};
#else
struct statfs {
- uint32_t f_type;
- uint32_t f_bsize;
- uint64_t f_blocks;
- uint64_t f_bfree;
- uint64_t f_bavail;
- uint64_t f_files;
- uint64_t f_ffree;
- __kernel_fsid_t f_fsid;
- uint32_t f_namelen;
- uint32_t f_frsize;
- uint32_t f_flags;
- uint32_t f_spare[4];
+ uint32_t f_type;
+ uint32_t f_bsize;
+ uint64_t f_blocks;
+ uint64_t f_bfree;
+ uint64_t f_bavail;
+ uint64_t f_files;
+ uint64_t f_ffree;
+ __fsid_t f_fsid;
+ uint32_t f_namelen;
+ uint32_t f_frsize;
+ uint32_t f_flags;
+ uint32_t f_spare[4];
};
#endif
+/* Source compatibility with glibc. */
+#define statfs64 statfs
+
+/* Declare that we have the f_namelen, f_frsize, and f_flags fields. */
+#define _STATFS_F_NAMELEN
+#define _STATFS_F_FRSIZE
+#define _STATFS_F_FLAGS
+
#define ADFS_SUPER_MAGIC 0xadf5
#define AFFS_SUPER_MAGIC 0xADFF
#define BEFS_SUPER_MAGIC 0x42465331
@@ -113,8 +124,8 @@
#define XFS_SUPER_MAGIC 0x58465342
#define _XIAFS_SUPER_MAGIC 0x012FD16D
-extern int statfs(const char *, struct statfs *);
-extern int fstatfs(int, struct statfs *);
+extern int statfs(const char*, struct statfs*) __nonnull((1, 2));
+extern int fstatfs(int, struct statfs*) __nonnull((2));
__END_DECLS
diff --git a/libc/kernel/README.TXT b/libc/kernel/README.TXT
index 7d24fe9..e4c11a1 100644
--- a/libc/kernel/README.TXT
+++ b/libc/kernel/README.TXT
@@ -177,94 +177,3 @@
prepended to each generated header, contains a message like
"do not edit directly - file was auto-generated by ...."
-
-
-RATIONALE:
-==========
-
-OVERVIEW OF THE CURRENT KERNEL HEADER MESS:
--------------------------------------------
-
-The original kernel headers are not easily usable from userland applications.
-they contain many declarations and construct that will result in a compilation
-failure or even worse, incorrect behaviour. for example:
-
-- some headers try to define Posix types (e.g. size_t, ssize_t) that can
- conflict with the corresponding definitions provided by your C library.
-
-- some headers use constructs that cannot be compiled in ANSI C mode.
-
-- some headers use constructs do not compile with C++ at all.
-
-- some headers contain invalid "legacy" definitions for the benefit of old
- C libraries (e.g. glibc5) but result in incorrect behaviour if used
- directly.
-
- e.g. gid_t being defined in <linux/types.h> as a 16-bit type while the
- kernel uses 32-bit ids. this results in problems when getgroups() or
- setgroups() are called, since they operate on gid_t arrays.
-
-unfortunately, these headers are also the only source of some really extensive
-constant and type definitions that are required by userland applications.
-think any library/program that need to access ALSA, or Video4Linux, or
-anything related to a specific device or Linux-specific system interface
-(e.g. IOCTLS, etc...)
-
-As a consequence, every Linux distribution provides a set of patched kernel
-headers to be used by userland applications (which installs in
-/usr/include/linux/, /usr/include/asm/, etc...). these are manually maintained
-by distribution packagers, and generated either manually or with various
-scripts. these headers are also tailored to GNU LibC and cannot be reused
-easily by Bionic.
-
-for a really long period, the kernel authors have stated that they don't want
-to fix the problem, even when someone proposed a patch to start cleaning the
-official headers. from their point of view this is purely a library author
-problem.
-
-fortunately, enlightnment happened, and the kernel now provides a way to
-install a set of "user-friendly" headers that are generated from the official
-ones by stripping the __KERNEL__ protected declarations.
-
-unfortunately, this is not enough for Bionic because the result still contains
-a few broken declarations that are difficult to route around. (see below for
-a little bit of details).
-
-we plan to be able to support these kernel-generated user-land headers in the
-future, but the priority on this issue is very low.
-
-
-WHAT WE DO:
------------
-
-so we're doomed to repeat the same effort than anyone else. the big difference
-here is that we want to automate as much as possible the generation of the
-clean headers to easily support additional architectures in the future,
-and keep current with upstream changes in the header definitions with the
-least possible hassle.
-
-of course, this is only a race to the bottom. the kernel maintainers still
-feel free to randomly break the structure of their headers (e.g. moving the
-location of some files) occasionally, so we'll need to keep up with that by
-updating our build script/original headers as these cases happen.
-
-what we do is keep a set of "original" kernel headers, and process them
-automatically to generate a set of "clean" headers that can be used from
-userland and the C library.
-
-note that the "original" headers can be tweaked a little to avoid some subtle
-issues. for example:
-
-- when the location of various USB-related headers changes in the kernel
- source tree, we want to keep them at the same location in our generated
- headers (there is no reason to break the userland API for something
- like that).
-
-- sometimes, we prefer to take certain things out of blocks guarded by a
- #ifdef __KERNEL__ .. #endif. for example, on recent kernels <linux/wireless.h>
- only includes <linux/if.h> when in kernel mode. we make it available to
- userland as well since some code out there assumes that this is the case.
-
-- sometimes, the header is simply incorrect (e.g. it uses a type without
- including the header that defines it before-hand)
-
diff --git a/libc/kernel/arch-x86/asm/acpi.h b/libc/kernel/arch-x86/asm/acpi.h
index 92e6b7d..74843c3 100644
--- a/libc/kernel/arch-x86/asm/acpi.h
+++ b/libc/kernel/arch-x86/asm/acpi.h
@@ -18,7 +18,12 @@
****************************************************************************/
#ifndef _ASM_X86_ACPI_H
#define _ASM_X86_ACPI_H
+#ifdef __i386__
#include "acpi_32.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#include "acpi_64.h"
+#endif
#include <asm/processor.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/kernel/arch-x86/asm/alternative.h b/libc/kernel/arch-x86/asm/alternative.h
index 107f551..35cd4f4 100644
--- a/libc/kernel/arch-x86/asm/alternative.h
+++ b/libc/kernel/arch-x86/asm/alternative.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "alternative_32.h"
+#else
+#include "alternative_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/apic.h b/libc/kernel/arch-x86/asm/apic.h
index bf6ac72..3885108 100644
--- a/libc/kernel/arch-x86/asm/apic.h
+++ b/libc/kernel/arch-x86/asm/apic.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "apic_32.h"
+#else
+#include "apic_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/apicdef.h b/libc/kernel/arch-x86/asm/apicdef.h
index af5b074..b1e0af0 100644
--- a/libc/kernel/arch-x86/asm/apicdef.h
+++ b/libc/kernel/arch-x86/asm/apicdef.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "apicdef_32.h"
+#else
+#include "apicdef_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/atomic.h b/libc/kernel/arch-x86/asm/atomic.h
index 9c65347..68d8a45 100644
--- a/libc/kernel/arch-x86/asm/atomic.h
+++ b/libc/kernel/arch-x86/asm/atomic.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "atomic_32.h"
+#else
+#include "atomic_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/auxvec.h b/libc/kernel/arch-x86/asm/auxvec.h
index 6a5978e..3ff7f71 100644
--- a/libc/kernel/arch-x86/asm/auxvec.h
+++ b/libc/kernel/arch-x86/asm/auxvec.h
@@ -18,8 +18,11 @@
****************************************************************************/
#ifndef _ASM_X86_AUXVEC_H
#define _ASM_X86_AUXVEC_H
+#ifdef __i386__
#define AT_SYSINFO 32
-#define AT_SYSINFO_EHDR 33
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#define AT_SYSINFO_EHDR 33
#define AT_VECTOR_SIZE_ARCH 2
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-x86/asm/bitops.h b/libc/kernel/arch-x86/asm/bitops.h
index 491b611..a4a540d 100644
--- a/libc/kernel/arch-x86/asm/bitops.h
+++ b/libc/kernel/arch-x86/asm/bitops.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "bitops_32.h"
+#else
+#include "bitops_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/page.h b/libc/kernel/arch-x86/asm/bitsperlong.h
similarity index 85%
copy from libc/kernel/arch-mips/asm/page.h
copy to libc/kernel/arch-x86/asm/bitsperlong.h
index 93eb390..2deae24 100644
--- a/libc/kernel/arch-mips/asm/page.h
+++ b/libc/kernel/arch-x86/asm/bitsperlong.h
@@ -16,13 +16,14 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_PAGE_H
-#define _ASM_PAGE_H
-#ifndef PAGE_SHIFT
-#define PAGE_SHIFT 12
+#ifndef __ASM_X86_BITSPERLONG_H
+#define __ASM_X86_BITSPERLONG_H
+#ifdef __x86_64__
+#define __BITS_PER_LONG 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#define __BITS_PER_LONG 32
+#endif
+#include <asm-generic/bitsperlong.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
-#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-x86/asm/byteorder.h b/libc/kernel/arch-x86/asm/byteorder.h
index 74dc9d6..98fc6b1 100644
--- a/libc/kernel/arch-x86/asm/byteorder.h
+++ b/libc/kernel/arch-x86/asm/byteorder.h
@@ -22,37 +22,53 @@
#include <linux/compiler.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifdef __GNUC__
+#ifdef __i386__
static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
{
- __asm__("xchgb %b0,%h0\n\t"
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __asm__("xchgb %b0,%h0\n\t"
"rorl $16,%0\n\t"
"xchgb %b0,%h0"
:"=q" (x)
- : "0" (x));
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ : "0" (x));
return x;
}
static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
-{
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+{
union {
struct { __u32 a,b; } s;
__u64 u;
- } v;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } v;
v.u = val;
v.s.a = ___arch__swab32(v.s.a);
v.s.b = ___arch__swab32(v.s.b);
- __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
return v.u;
}
-#define __arch__swab64(x) ___arch__swab64(x)
-#define __arch__swab32(x) ___arch__swab32(x)
+#else
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
+{
+ __asm__("bswapq %0" : "=r" (x) : "0" (x));
+ return x;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+}
+static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+{
+ __asm__("bswapl %0" : "=r" (x) : "0" (x));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ return x;
+}
+#endif
+#define __arch__swab64(x) ___arch__swab64(x)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __arch__swab32(x) ___arch__swab32(x)
#define __BYTEORDER_HAS_U64__
#endif
#include <linux/byteorder/little_endian.h>
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/cmpxchg.h b/libc/kernel/arch-x86/asm/cmpxchg.h
index 9447850..c26890c 100644
--- a/libc/kernel/arch-x86/asm/cmpxchg.h
+++ b/libc/kernel/arch-x86/asm/cmpxchg.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "cmpxchg_32.h"
+#else
+#include "cmpxchg_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/cpufeature.h b/libc/kernel/arch-x86/asm/cpufeature.h
index 7fcfacf..71f5220 100644
--- a/libc/kernel/arch-x86/asm/cpufeature.h
+++ b/libc/kernel/arch-x86/asm/cpufeature.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "cpufeature_32.h"
+#else
+#include "cpufeature_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/current.h b/libc/kernel/arch-x86/asm/current.h
index da85169..2f80cc2 100644
--- a/libc/kernel/arch-x86/asm/current.h
+++ b/libc/kernel/arch-x86/asm/current.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "current_32.h"
+#else
+#include "current_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/desc.h b/libc/kernel/arch-x86/asm/desc.h
index b60787e..d2d29a9 100644
--- a/libc/kernel/arch-x86/asm/desc.h
+++ b/libc/kernel/arch-x86/asm/desc.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "desc_32.h"
+#else
+#include "desc_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/div64.h b/libc/kernel/arch-x86/asm/div64.h
index 420d9e3..4621ca7 100644
--- a/libc/kernel/arch-x86/asm/div64.h
+++ b/libc/kernel/arch-x86/asm/div64.h
@@ -18,8 +18,13 @@
****************************************************************************/
#ifndef _ASM_X86_DIV64_H
#define _ASM_X86_DIV64_H
+#ifdef __i386__
#include <linux/types.h>
-#define do_div(n,base) ({ unsigned long __upper, __low, __high, __mod, __base; __base = (base); asm("":"=a" (__low), "=d" (__high):"A" (n)); __upper = __high; if (__high) { __upper = __high % (__base); __high = __high / (__base); } asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); asm("":"=A" (n):"a" (__low),"d" (__high)); __mod; })
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define do_div(n,base) ({ unsigned long __upper, __low, __high, __mod, __base; __base = (base); asm("":"=a" (__low), "=d" (__high):"A" (n)); __upper = __high; if (__high) { __upper = __high % (__base); __high = __high / (__base); } asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); asm("":"=A" (n):"a" (__low),"d" (__high)); __mod; })
#define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c)
+#else
+#include <asm-generic/div64.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
#endif
diff --git a/libc/kernel/arch-x86/asm/dma-mapping.h b/libc/kernel/arch-x86/asm/dma-mapping.h
index 0a9d23b..467d076 100644
--- a/libc/kernel/arch-x86/asm/dma-mapping.h
+++ b/libc/kernel/arch-x86/asm/dma-mapping.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "dma-mapping_32.h"
+#else
+#include "dma-mapping_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/dma.h b/libc/kernel/arch-x86/asm/dma.h
index 1e96d90..6b9c8a8 100644
--- a/libc/kernel/arch-x86/asm/dma.h
+++ b/libc/kernel/arch-x86/asm/dma.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "dma_32.h"
+#else
+#include "dma_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/dwarf2.h b/libc/kernel/arch-x86/asm/dwarf2.h
index 916bcb8..93df067 100644
--- a/libc/kernel/arch-x86/asm/dwarf2.h
+++ b/libc/kernel/arch-x86/asm/dwarf2.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "dwarf2_32.h"
+#else
+#include "dwarf2_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/fixmap.h b/libc/kernel/arch-x86/asm/fixmap.h
index f8a1d18..e4fd99a 100644
--- a/libc/kernel/arch-x86/asm/fixmap.h
+++ b/libc/kernel/arch-x86/asm/fixmap.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "fixmap_32.h"
+#else
+#include "fixmap_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/genapic.h b/libc/kernel/arch-x86/asm/genapic.h
index 3dc5e45..b55a8c1 100644
--- a/libc/kernel/arch-x86/asm/genapic.h
+++ b/libc/kernel/arch-x86/asm/genapic.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "genapic_32.h"
+#else
+#include "genapic_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/hardirq.h b/libc/kernel/arch-x86/asm/hardirq.h
index 4e3b8c1..a4b0fe3 100644
--- a/libc/kernel/arch-x86/asm/hardirq.h
+++ b/libc/kernel/arch-x86/asm/hardirq.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "hardirq_32.h"
+#else
+#include "hardirq_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/hw_irq.h b/libc/kernel/arch-x86/asm/hw_irq.h
index d69d8e9..1f7eca7 100644
--- a/libc/kernel/arch-x86/asm/hw_irq.h
+++ b/libc/kernel/arch-x86/asm/hw_irq.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "hw_irq_32.h"
+#else
+#include "hw_irq_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/i387.h b/libc/kernel/arch-x86/asm/i387.h
index 9333051..47f138a 100644
--- a/libc/kernel/arch-x86/asm/i387.h
+++ b/libc/kernel/arch-x86/asm/i387.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "i387_32.h"
+#else
+#include "i387_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/io.h b/libc/kernel/arch-x86/asm/io.h
index 4e81b8c..5ea43c2 100644
--- a/libc/kernel/arch-x86/asm/io.h
+++ b/libc/kernel/arch-x86/asm/io.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "io_32.h"
+#else
+#include "io_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/io_apic.h b/libc/kernel/arch-x86/asm/io_apic.h
index 54bf23a..26d5db0 100644
--- a/libc/kernel/arch-x86/asm/io_apic.h
+++ b/libc/kernel/arch-x86/asm/io_apic.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "io_apic_32.h"
+#else
+#include "io_apic_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/irq.h b/libc/kernel/arch-x86/asm/irq.h
index eaa65db..92a421e 100644
--- a/libc/kernel/arch-x86/asm/irq.h
+++ b/libc/kernel/arch-x86/asm/irq.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "irq_32.h"
+#else
+#include "irq_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/irqflags.h b/libc/kernel/arch-x86/asm/irqflags.h
index 4136598..f987af5 100644
--- a/libc/kernel/arch-x86/asm/irqflags.h
+++ b/libc/kernel/arch-x86/asm/irqflags.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "irqflags_32.h"
+#else
+#include "irqflags_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/kmap_types.h b/libc/kernel/arch-x86/asm/kmap_types.h
index ba6af93..5eec06a 100644
--- a/libc/kernel/arch-x86/asm/kmap_types.h
+++ b/libc/kernel/arch-x86/asm/kmap_types.h
@@ -18,7 +18,12 @@
****************************************************************************/
#ifndef _ASM_X86_KMAP_TYPES_H
#define _ASM_X86_KMAP_TYPES_H
+#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM)
+#define D(n) __KM_FENCE_##n ,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
#define D(n)
+#endif
enum km_type {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
D(0) KM_BOUNCE_READ,
diff --git a/libc/kernel/arch-x86/asm/linkage.h b/libc/kernel/arch-x86/asm/linkage.h
index 3aae43d..6eb2ce0 100644
--- a/libc/kernel/arch-x86/asm/linkage.h
+++ b/libc/kernel/arch-x86/asm/linkage.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "linkage_32.h"
+#else
+#include "linkage_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/local.h b/libc/kernel/arch-x86/asm/local.h
index 99acf6d..6e5419b 100644
--- a/libc/kernel/arch-x86/asm/local.h
+++ b/libc/kernel/arch-x86/asm/local.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "local_32.h"
+#else
+#include "local_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/mc146818rtc.h b/libc/kernel/arch-x86/asm/mc146818rtc.h
index f7e8781..34c3aa9 100644
--- a/libc/kernel/arch-x86/asm/mc146818rtc.h
+++ b/libc/kernel/arch-x86/asm/mc146818rtc.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "mc146818rtc_32.h"
+#else
+#include "mc146818rtc_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/module.h b/libc/kernel/arch-x86/asm/module.h
index 296ed2b..454fc22 100644
--- a/libc/kernel/arch-x86/asm/module.h
+++ b/libc/kernel/arch-x86/asm/module.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "module_32.h"
+#else
+#include "module_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/mpspec.h b/libc/kernel/arch-x86/asm/mpspec.h
index 217a7d4..2c80358 100644
--- a/libc/kernel/arch-x86/asm/mpspec.h
+++ b/libc/kernel/arch-x86/asm/mpspec.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "mpspec_32.h"
+#else
+#include "mpspec_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/msgbuf.h b/libc/kernel/arch-x86/asm/msgbuf.h
index 99caf76..7580210 100644
--- a/libc/kernel/arch-x86/asm/msgbuf.h
+++ b/libc/kernel/arch-x86/asm/msgbuf.h
@@ -22,20 +22,28 @@
struct ipc64_perm msg_perm;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__kernel_time_t msg_stime;
+#ifdef __i386__
unsigned long __unused1;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__kernel_time_t msg_rtime;
+#ifdef __i386__
unsigned long __unused2;
+#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__kernel_time_t msg_ctime;
+#ifdef __i386__
unsigned long __unused3;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long msg_cbytes;
unsigned long msg_qnum;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long msg_qbytes;
__kernel_pid_t msg_lspid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__kernel_pid_t msg_lrpid;
unsigned long __unused4;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused5;
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/kernel/arch-x86/asm/msr.h b/libc/kernel/arch-x86/asm/msr.h
index 00fb800..63da0cc 100644
--- a/libc/kernel/arch-x86/asm/msr.h
+++ b/libc/kernel/arch-x86/asm/msr.h
@@ -23,4 +23,27 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <linux/types.h>
#endif
+#ifdef __i386__
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __ASSEMBLY__
+#include <linux/errno.h>
+#define rdmsr(msr,val1,val2) __asm__ __volatile__("rdmsr" : "=a" (val1), "=d" (val2) : "c" (msr))
+#define rdmsrl(msr,val) do { unsigned long a__,b__; __asm__ __volatile__("rdmsr" : "=a" (a__), "=d" (b__) : "c" (msr)); val = a__ | (b__<<32); } while(0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define wrmsr(msr,val1,val2) __asm__ __volatile__("wrmsr" : : "c" (msr), "a" (val1), "d" (val2))
+#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32)
+#define rdtsc(low,high) __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
+#define rdtscl(low) __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define rdtscp(low,high,aux) __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
+#define rdtscll(val) do { unsigned int __a,__d; __asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); } while(0)
+#define rdtscpll(val, aux) do { unsigned long __a, __d; __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); (val) = (__d << 32) | __a; } while (0)
+#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0)
+#define rdpmc(counter,low,high) __asm__ __volatile__("rdpmc" : "=a" (low), "=d" (high) : "c" (counter))
+#endif
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/kernel/arch-x86/asm/page.h b/libc/kernel/arch-x86/asm/page.h
deleted file mode 100644
index 3b45383..0000000
--- a/libc/kernel/arch-x86/asm/page.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#include "page_32.h"
diff --git a/libc/kernel/arch-x86/asm/percpu.h b/libc/kernel/arch-x86/asm/percpu.h
index 607b92e..2c50ffd 100644
--- a/libc/kernel/arch-x86/asm/percpu.h
+++ b/libc/kernel/arch-x86/asm/percpu.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "percpu_32.h"
+#else
+#include "percpu_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/pgalloc.h b/libc/kernel/arch-x86/asm/pgalloc.h
index 9175367..a531e2d 100644
--- a/libc/kernel/arch-x86/asm/pgalloc.h
+++ b/libc/kernel/arch-x86/asm/pgalloc.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "pgalloc_32.h"
+#else
+#include "pgalloc_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/pgtable.h b/libc/kernel/arch-x86/asm/pgtable.h
index a9bed6b..7ad9d3a 100644
--- a/libc/kernel/arch-x86/asm/pgtable.h
+++ b/libc/kernel/arch-x86/asm/pgtable.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "pgtable_32.h"
+#else
+#include "pgtable_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/posix_types.h b/libc/kernel/arch-x86/asm/posix_types.h
index 4e26788..43aaaea 100644
--- a/libc/kernel/arch-x86/asm/posix_types.h
+++ b/libc/kernel/arch-x86/asm/posix_types.h
@@ -16,4 +16,11 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "posix_types_32.h"
+#elif defined(__ILP32__)
+#include "posix_types_x32.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#include "posix_types_64.h"
+#endif
diff --git a/libc/kernel/arch-x86/asm/posix_types_32.h b/libc/kernel/arch-x86/asm/posix_types_32.h
index 90136d2..f625905 100644
--- a/libc/kernel/arch-x86/asm/posix_types_32.h
+++ b/libc/kernel/arch-x86/asm/posix_types_32.h
@@ -16,63 +16,21 @@
***
****************************************************************************
****************************************************************************/
-#ifndef __ARCH_I386_POSIX_TYPES_H
-#define __ARCH_I386_POSIX_TYPES_H
-typedef unsigned long __kernel_ino_t;
+#ifndef _ASM_X86_POSIX_TYPES_32_H
+#define _ASM_X86_POSIX_TYPES_32_H
typedef unsigned short __kernel_mode_t;
+#define __kernel_mode_t __kernel_mode_t
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef unsigned short __kernel_nlink_t;
-typedef long __kernel_off_t;
-typedef int __kernel_pid_t;
+#define __kernel_nlink_t __kernel_nlink_t
typedef unsigned short __kernel_ipc_pid_t;
+#define __kernel_ipc_pid_t __kernel_ipc_pid_t
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
-typedef unsigned int __kernel_size_t;
-typedef int __kernel_ssize_t;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef int __kernel_ptrdiff_t;
-typedef long __kernel_time_t;
-typedef long __kernel_suseconds_t;
-typedef long __kernel_clock_t;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef int __kernel_timer_t;
-typedef int __kernel_clockid_t;
-typedef int __kernel_daddr_t;
-typedef char * __kernel_caddr_t;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef unsigned short __kernel_uid16_t;
-typedef unsigned short __kernel_gid16_t;
-typedef unsigned int __kernel_uid32_t;
-typedef unsigned int __kernel_gid32_t;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef unsigned short __kernel_old_uid_t;
-typedef unsigned short __kernel_old_gid_t;
+#define __kernel_uid_t __kernel_uid_t
typedef unsigned short __kernel_old_dev_t;
-#ifdef __GNUC__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-typedef long long __kernel_loff_t;
+#define __kernel_old_dev_t __kernel_old_dev_t
+#include <asm-generic/posix_types.h>
#endif
-typedef struct {
-#ifdef __USE_ALL
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int val[2];
-#else
- int __val[2];
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-} __kernel_fsid_t;
-#if !defined(__GLIBC__) || __GLIBC__ < 2
-#undef __FD_SET
-#define __FD_SET(fd,fdsetp) __asm__ __volatile__("btsl %1,%0": "+m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd)))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#undef __FD_CLR
-#define __FD_CLR(fd,fdsetp) __asm__ __volatile__("btrl %1,%0": "+m" (*(__kernel_fd_set *) (fdsetp)):"r" ((int) (fd)))
-#undef __FD_ISSET
-#define __FD_ISSET(fd,fdsetp) (__extension__ ({ unsigned char __result; __asm__ __volatile__("btl %1,%2 ; setb %0" :"=q" (__result) :"r" ((int) (fd)), "m" (*(__kernel_fd_set *) (fdsetp))); __result; }))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#undef __FD_ZERO
-#define __FD_ZERO(fdsetp) do { int __d0, __d1; __asm__ __volatile__("cld ; rep ; stosl" :"=m" (*(__kernel_fd_set *) (fdsetp)), "=&c" (__d0), "=&D" (__d1) :"a" (0), "1" (__FDSET_LONGS), "2" ((__kernel_fd_set *) (fdsetp)) : "memory"); } while (0)
-#endif
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-x86/asm/page_32.h b/libc/kernel/arch-x86/asm/posix_types_64.h
similarity index 77%
rename from libc/kernel/arch-x86/asm/page_32.h
rename to libc/kernel/arch-x86/asm/posix_types_64.h
index 5e864ad..e35b769 100644
--- a/libc/kernel/arch-x86/asm/page_32.h
+++ b/libc/kernel/arch-x86/asm/posix_types_64.h
@@ -16,13 +16,14 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _I386_PAGE_H
-#define _I386_PAGE_H
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#ifndef _ASM_X86_POSIX_TYPES_64_H
+#define _ASM_X86_POSIX_TYPES_64_H
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PAGE_MASK (~(PAGE_SIZE-1))
-#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
-#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
+#define __kernel_old_uid_t __kernel_old_uid_t
+typedef unsigned long __kernel_old_dev_t;
+#define __kernel_old_dev_t __kernel_old_dev_t
+#include <asm-generic/posix_types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-x86/asm/processor.h b/libc/kernel/arch-x86/asm/processor.h
index e9eaec8..f23b921 100644
--- a/libc/kernel/arch-x86/asm/processor.h
+++ b/libc/kernel/arch-x86/asm/processor.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "processor_32.h"
+#else
+#include "processor_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/ptrace-abi.h b/libc/kernel/arch-x86/asm/ptrace-abi.h
index bbc7e86..85306ea 100644
--- a/libc/kernel/arch-x86/asm/ptrace-abi.h
+++ b/libc/kernel/arch-x86/asm/ptrace-abi.h
@@ -18,28 +18,63 @@
****************************************************************************/
#ifndef _ASM_X86_PTRACE_ABI_H
#define _ASM_X86_PTRACE_ABI_H
+#ifdef __i386__
#define EBX 0
-#define ECX 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ECX 1
#define EDX 2
#define ESI 3
#define EDI 4
-#define EBP 5
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define EBP 5
#define EAX 6
#define DS 7
#define ES 8
-#define FS 9
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FS 9
#define GS 10
#define ORIG_EAX 11
#define EIP 12
-#define CS 13
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CS 13
#define EFL 14
#define UESP 15
#define SS 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FRAME_SIZE 17
+#else
+#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
+#define R15 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R14 8
+#define R13 16
+#define R12 24
+#define RBP 32
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RBX 40
+#define R11 48
+#define R10 56
+#define R9 64
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define R8 72
+#define RAX 80
+#define RCX 88
+#define RDX 96
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RSI 104
+#define RDI 112
+#define ORIG_RAX 120
+#define RIP 128
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CS 136
+#define EFLAGS 144
+#define RSP 152
+#define SS 160
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define ARGOFFSET R11
+#endif
+#define FRAME_SIZE 168
+#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PTRACE_GETREGS 12
#define PTRACE_SETREGS 13
diff --git a/libc/kernel/arch-x86/asm/ptrace.h b/libc/kernel/arch-x86/asm/ptrace.h
index 2914411..2cb1c8f 100644
--- a/libc/kernel/arch-x86/asm/ptrace.h
+++ b/libc/kernel/arch-x86/asm/ptrace.h
@@ -22,28 +22,60 @@
#include <asm/ptrace-abi.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef __ASSEMBLY__
+#ifdef __i386__
struct pt_regs {
long ebx;
- long ecx;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long ecx;
long edx;
long esi;
long edi;
- long ebp;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long ebp;
long eax;
int xds;
int xes;
- int xfs;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int xfs;
long orig_eax;
long eip;
int xcs;
- long eflags;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long eflags;
long esp;
int xss;
};
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+struct pt_regs {
+ unsigned long r15;
+ unsigned long r14;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long r13;
+ unsigned long r12;
+ unsigned long rbp;
+ unsigned long rbx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long r11;
+ unsigned long r10;
+ unsigned long r9;
+ unsigned long r8;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long rax;
+ unsigned long rcx;
+ unsigned long rdx;
+ unsigned long rsi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long rdi;
+ unsigned long orig_rax;
+ unsigned long rip;
+ unsigned long cs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long eflags;
+ unsigned long rsp;
+ unsigned long ss;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
#endif
diff --git a/libc/kernel/arch-x86/asm/scatterlist.h b/libc/kernel/arch-x86/asm/scatterlist.h
index b691d08..1754cbb 100644
--- a/libc/kernel/arch-x86/asm/scatterlist.h
+++ b/libc/kernel/arch-x86/asm/scatterlist.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "scatterlist_32.h"
+#else
+#include "scatterlist_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/segment.h b/libc/kernel/arch-x86/asm/segment.h
index 145e21d..b3be77c 100644
--- a/libc/kernel/arch-x86/asm/segment.h
+++ b/libc/kernel/arch-x86/asm/segment.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "segment_32.h"
+#else
+#include "segment_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/semaphore.h b/libc/kernel/arch-x86/asm/semaphore.h
index 7a2223e..ee4f48e 100644
--- a/libc/kernel/arch-x86/asm/semaphore.h
+++ b/libc/kernel/arch-x86/asm/semaphore.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "semaphore_32.h"
+#else
+#include "semaphore_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/shmbuf.h b/libc/kernel/arch-x86/asm/shmbuf.h
index 5ecfe08..81cce3e 100644
--- a/libc/kernel/arch-x86/asm/shmbuf.h
+++ b/libc/kernel/arch-x86/asm/shmbuf.h
@@ -23,32 +23,39 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
size_t shm_segsz;
__kernel_time_t shm_atime;
+#ifdef __i386__
unsigned long __unused1;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
__kernel_time_t shm_dtime;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __i386__
unsigned long __unused2;
- __kernel_time_t shm_ctime;
- unsigned long __unused3;
- __kernel_pid_t shm_cpid;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+ __kernel_time_t shm_ctime;
+#ifdef __i386__
+ unsigned long __unused3;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+ __kernel_pid_t shm_cpid;
__kernel_pid_t shm_lpid;
unsigned long shm_nattch;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused4;
unsigned long __unused5;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct shminfo64 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long shmmax;
unsigned long shmmin;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long shmmni;
unsigned long shmseg;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long shmall;
unsigned long __unused1;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused2;
unsigned long __unused3;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused4;
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/kernel/arch-x86/asm/sigcontext.h b/libc/kernel/arch-x86/asm/sigcontext.h
index 390189f..b0b5fd4 100644
--- a/libc/kernel/arch-x86/asm/sigcontext.h
+++ b/libc/kernel/arch-x86/asm/sigcontext.h
@@ -21,73 +21,130 @@
#include <linux/compiler.h>
#include <asm/types.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __i386__
struct _fpreg {
unsigned short significand[4];
unsigned short exponent;
-};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
struct _fpxreg {
unsigned short significand[4];
unsigned short exponent;
- unsigned short padding[3];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short padding[3];
};
struct _xmmreg {
unsigned long element[4];
-};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
struct _fpstate {
unsigned long cw;
unsigned long sw;
- unsigned long tag;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long tag;
unsigned long ipoff;
unsigned long cssel;
unsigned long dataoff;
- unsigned long datasel;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long datasel;
struct _fpreg _st[8];
unsigned short status;
unsigned short magic;
- unsigned long _fxsr_env[6];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long _fxsr_env[6];
unsigned long mxcsr;
unsigned long reserved;
struct _fpxreg _fxsr_st[8];
- struct _xmmreg _xmm[8];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct _xmmreg _xmm[8];
unsigned long padding[56];
};
#define X86_FXSR_MAGIC 0x0000
-struct sigcontext {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct sigcontext {
unsigned short gs, __gsh;
unsigned short fs, __fsh;
unsigned short es, __esh;
- unsigned short ds, __dsh;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short ds, __dsh;
unsigned long edi;
unsigned long esi;
unsigned long ebp;
- unsigned long esp;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long esp;
unsigned long ebx;
unsigned long edx;
unsigned long ecx;
- unsigned long eax;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long eax;
unsigned long trapno;
unsigned long err;
unsigned long eip;
- unsigned short cs, __csh;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short cs, __csh;
unsigned long eflags;
unsigned long esp_at_signal;
unsigned short ss, __ssh;
- struct _fpstate __user * fpstate;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct _fpstate __user * fpstate;
unsigned long oldmask;
unsigned long cr2;
};
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+struct _fpstate {
+ __u16 cwd;
+ __u16 swd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u16 twd;
+ __u16 fop;
+ __u64 rip;
+ __u64 rdp;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 mxcsr;
+ __u32 mxcsr_mask;
+ __u32 st_space[32];
+ __u32 xmm_space[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 reserved2[24];
+};
+struct sigcontext {
+ unsigned long r8;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long r9;
+ unsigned long r10;
+ unsigned long r11;
+ unsigned long r12;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long r13;
+ unsigned long r14;
+ unsigned long r15;
+ unsigned long rdi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long rsi;
+ unsigned long rbp;
+ unsigned long rbx;
+ unsigned long rdx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long rax;
+ unsigned long rcx;
+ unsigned long rsp;
+ unsigned long rip;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long eflags;
+ unsigned short cs;
+ unsigned short gs;
+ unsigned short fs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short __pad0;
+ unsigned long err;
+ unsigned long trapno;
+ unsigned long oldmask;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cr2;
+ struct _fpstate __user *fpstate;
+ unsigned long reserved1[8];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-x86/asm/signal.h b/libc/kernel/arch-x86/asm/signal.h
index 1c8f2f6..a15028c 100644
--- a/libc/kernel/arch-x86/asm/signal.h
+++ b/libc/kernel/arch-x86/asm/signal.h
@@ -93,20 +93,35 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm-generic/signal.h>
#ifndef __ASSEMBLY__
+#ifdef __i386__
struct sigaction {
- union {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
__sighandler_t _sa_handler;
void (*_sa_sigaction)(int, struct siginfo *, void *);
} _u;
- sigset_t sa_mask;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sigset_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
};
-#define sa_handler _u._sa_handler
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
+#else
+struct sigaction {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __sighandler_t sa_handler;
+ unsigned long sa_flags;
+ __sigrestore_t sa_restorer;
+ sigset_t sa_mask;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct k_sigaction {
+ struct sigaction sa;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
typedef struct sigaltstack {
void __user *ss_sp;
int ss_flags;
diff --git a/libc/kernel/arch-x86/asm/smp.h b/libc/kernel/arch-x86/asm/smp.h
index 4e439d5..276475d 100644
--- a/libc/kernel/arch-x86/asm/smp.h
+++ b/libc/kernel/arch-x86/asm/smp.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "smp_32.h"
+#else
+#include "smp_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/spinlock.h b/libc/kernel/arch-x86/asm/spinlock.h
index 286bf86..e15abda 100644
--- a/libc/kernel/arch-x86/asm/spinlock.h
+++ b/libc/kernel/arch-x86/asm/spinlock.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "spinlock_32.h"
+#else
+#include "spinlock_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/stat.h b/libc/kernel/arch-x86/asm/stat.h
index 3878c88..97de74b 100644
--- a/libc/kernel/arch-x86/asm/stat.h
+++ b/libc/kernel/arch-x86/asm/stat.h
@@ -19,73 +19,111 @@
#ifndef _ASM_X86_STAT_H
#define _ASM_X86_STAT_H
#define STAT_HAVE_NSEC 1
+#ifdef __i386__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct stat {
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned short st_mode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned long st_rdev;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_ctime_nsec;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STAT64_HAS_BROKEN_ST_INO 1
+struct stat64 {
+ unsigned long long st_dev;
+ unsigned char __pad0[4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned long st_uid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_gid;
+ unsigned long long st_rdev;
+ unsigned char __pad3[4];
+ long long st_size;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_blksize;
+ unsigned long long st_blocks;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_mtime;
+ unsigned int st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long long st_ino;
+};
+#else
struct stat {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long st_dev;
unsigned long st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
+ unsigned long st_nlink;
+ unsigned int st_mode;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned short st_uid;
- unsigned short st_gid;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int __pad0;
unsigned long st_rdev;
- unsigned long st_size;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned long st_blksize;
- unsigned long st_blocks;
+ long st_size;
+ long st_blksize;
+ long st_blocks;
unsigned long st_atime;
- unsigned long st_atime_nsec;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long st_ctime_nsec;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned long __unused4;
- unsigned long __unused5;
+ long __linux_unused[3];
};
-#define STAT64_HAS_BROKEN_ST_INO 1
+#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct stat64 {
- unsigned long long st_dev;
- unsigned char __pad0[4];
- unsigned long __st_ino;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int st_mode;
- unsigned int st_nlink;
- unsigned long st_uid;
- unsigned long st_gid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned long long st_rdev;
- unsigned char __pad3[4];
- long long st_size;
- unsigned long st_blksize;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned long long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
- unsigned long st_mtime;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- unsigned int st_mtime_nsec;
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
- unsigned long long st_ino;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
struct __old_kernel_stat {
unsigned short st_dev;
unsigned short st_ino;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned short st_mode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned short st_rdev;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifdef __i386__
unsigned long st_size;
unsigned long st_atime;
unsigned long st_mtime;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long st_ctime;
+#else
+ unsigned int st_size;
+ unsigned int st_atime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned int st_mtime;
+ unsigned int st_ctime;
+#endif
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/kernel/arch-x86/asm/statfs.h b/libc/kernel/arch-x86/asm/statfs.h
index 7472605..f137d17 100644
--- a/libc/kernel/arch-x86/asm/statfs.h
+++ b/libc/kernel/arch-x86/asm/statfs.h
@@ -18,6 +18,58 @@
****************************************************************************/
#ifndef _ASM_X86_STATFS_H
#define _ASM_X86_STATFS_H
+#ifdef __i386__
#include <asm-generic/statfs.h>
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+struct statfs {
+ long f_type;
+ long f_bsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_blocks;
+ long f_bfree;
+ long f_bavail;
+ long f_files;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_ffree;
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+ long f_frsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_spare[5];
+};
+struct statfs64 {
+ long f_type;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_bsize;
+ long f_blocks;
+ long f_bfree;
+ long f_bavail;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_files;
+ long f_ffree;
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long f_frsize;
+ long f_spare[5];
+};
+struct compat_statfs64 {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 f_type;
+ __u32 f_bsize;
+ __u64 f_blocks;
+ __u64 f_bfree;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 f_bavail;
+ __u64 f_files;
+ __u64 f_ffree;
+ __kernel_fsid_t f_fsid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 f_namelen;
+ __u32 f_frsize;
+ __u32 f_spare[5];
+} __attribute__((packed));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
diff --git a/libc/kernel/arch-x86/asm/string.h b/libc/kernel/arch-x86/asm/string.h
index 874b2f0..ae9e3b4 100644
--- a/libc/kernel/arch-x86/asm/string.h
+++ b/libc/kernel/arch-x86/asm/string.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "string_32.h"
+#else
+#include "string_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/system.h b/libc/kernel/arch-x86/asm/system.h
index 12767cd..bdf9b0f 100644
--- a/libc/kernel/arch-x86/asm/system.h
+++ b/libc/kernel/arch-x86/asm/system.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "system_32.h"
+#else
+#include "system_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/thread_info.h b/libc/kernel/arch-x86/asm/thread_info.h
index d15e362..18c3f8d 100644
--- a/libc/kernel/arch-x86/asm/thread_info.h
+++ b/libc/kernel/arch-x86/asm/thread_info.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "thread_info_32.h"
+#else
+#include "thread_info_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/tlbflush.h b/libc/kernel/arch-x86/asm/tlbflush.h
index fd576df..5a4b110 100644
--- a/libc/kernel/arch-x86/asm/tlbflush.h
+++ b/libc/kernel/arch-x86/asm/tlbflush.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "tlbflush_32.h"
+#else
+#include "tlbflush_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/types.h b/libc/kernel/arch-x86/asm/types.h
index b71d89b..f5aa99e 100644
--- a/libc/kernel/arch-x86/asm/types.h
+++ b/libc/kernel/arch-x86/asm/types.h
@@ -28,11 +28,17 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef __signed__ int __s32;
typedef unsigned int __u32;
+#ifdef __i386__
#ifdef __GNUC__
-__extension__ typedef __signed__ long long __s64;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#endif
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
#endif
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/uaccess.h b/libc/kernel/arch-x86/asm/uaccess.h
index b167f6d..23da5d2 100644
--- a/libc/kernel/arch-x86/asm/uaccess.h
+++ b/libc/kernel/arch-x86/asm/uaccess.h
@@ -16,4 +16,9 @@
***
****************************************************************************
****************************************************************************/
+#ifdef __i386__
#include "uaccess_32.h"
+#else
+#include "uaccess_64.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-x86/asm/unistd.h b/libc/kernel/arch-x86/asm/unistd.h
index d109f5f..3e8df69 100644
--- a/libc/kernel/arch-x86/asm/unistd.h
+++ b/libc/kernel/arch-x86/asm/unistd.h
@@ -16,4 +16,16 @@
***
****************************************************************************
****************************************************************************/
-#include "unistd_32.h"
+#ifndef _ASM_X86_UNISTD_H
+#define _ASM_X86_UNISTD_H 1
+#define __X32_SYSCALL_BIT 0x40000000
+#ifdef __i386__
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/unistd_32.h>
+#elif defined(__ILP32__)
+#include <asm/unistd_x32.h>
+#else
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/unistd_64.h>
+#endif
+#endif
diff --git a/libc/kernel/arch-x86/asm/unistd_64.h b/libc/kernel/arch-x86/asm/unistd_64.h
new file mode 100644
index 0000000..169e9ea
--- /dev/null
+++ b/libc/kernel/arch-x86/asm/unistd_64.h
@@ -0,0 +1,411 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_X86_UNISTD_64_H
+#define _ASM_X86_UNISTD_64_H 1
+#define __NR_read 0
+#define __NR_write 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_open 2
+#define __NR_close 3
+#define __NR_stat 4
+#define __NR_fstat 5
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lstat 6
+#define __NR_poll 7
+#define __NR_lseek 8
+#define __NR_mmap 9
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mprotect 10
+#define __NR_munmap 11
+#define __NR_brk 12
+#define __NR_rt_sigaction 13
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigprocmask 14
+#define __NR_rt_sigreturn 15
+#define __NR_ioctl 16
+#define __NR_pread64 17
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pwrite64 18
+#define __NR_readv 19
+#define __NR_writev 20
+#define __NR_access 21
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pipe 22
+#define __NR_select 23
+#define __NR_sched_yield 24
+#define __NR_mremap 25
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_msync 26
+#define __NR_mincore 27
+#define __NR_madvise 28
+#define __NR_shmget 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#define __NR_dup 32
+#define __NR_dup2 33
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pause 34
+#define __NR_nanosleep 35
+#define __NR_getitimer 36
+#define __NR_alarm 37
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setitimer 38
+#define __NR_getpid 39
+#define __NR_sendfile 40
+#define __NR_socket 41
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_connect 42
+#define __NR_accept 43
+#define __NR_sendto 44
+#define __NR_recvfrom 45
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendmsg 46
+#define __NR_recvmsg 47
+#define __NR_shutdown 48
+#define __NR_bind 49
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_listen 50
+#define __NR_getsockname 51
+#define __NR_getpeername 52
+#define __NR_socketpair 53
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setsockopt 54
+#define __NR_getsockopt 55
+#define __NR_clone 56
+#define __NR_fork 57
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_vfork 58
+#define __NR_execve 59
+#define __NR_exit 60
+#define __NR_wait4 61
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_kill 62
+#define __NR_uname 63
+#define __NR_semget 64
+#define __NR_semop 65
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_semctl 66
+#define __NR_shmdt 67
+#define __NR_msgget 68
+#define __NR_msgsnd 69
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_msgrcv 70
+#define __NR_msgctl 71
+#define __NR_fcntl 72
+#define __NR_flock 73
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fsync 74
+#define __NR_fdatasync 75
+#define __NR_truncate 76
+#define __NR_ftruncate 77
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getdents 78
+#define __NR_getcwd 79
+#define __NR_chdir 80
+#define __NR_fchdir 81
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rename 82
+#define __NR_mkdir 83
+#define __NR_rmdir 84
+#define __NR_creat 85
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_link 86
+#define __NR_unlink 87
+#define __NR_symlink 88
+#define __NR_readlink 89
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_chmod 90
+#define __NR_fchmod 91
+#define __NR_chown 92
+#define __NR_fchown 93
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lchown 94
+#define __NR_umask 95
+#define __NR_gettimeofday 96
+#define __NR_getrlimit 97
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getrusage 98
+#define __NR_sysinfo 99
+#define __NR_times 100
+#define __NR_ptrace 101
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getuid 102
+#define __NR_syslog 103
+#define __NR_getgid 104
+#define __NR_setuid 105
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setgid 106
+#define __NR_geteuid 107
+#define __NR_getegid 108
+#define __NR_setpgid 109
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getppid 110
+#define __NR_getpgrp 111
+#define __NR_setsid 112
+#define __NR_setreuid 113
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setregid 114
+#define __NR_getgroups 115
+#define __NR_setgroups 116
+#define __NR_setresuid 117
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_getresuid 118
+#define __NR_setresgid 119
+#define __NR_getresgid 120
+#define __NR_getpgid 121
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_setfsuid 122
+#define __NR_setfsgid 123
+#define __NR_getsid 124
+#define __NR_capget 125
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_capset 126
+#define __NR_rt_sigpending 127
+#define __NR_rt_sigtimedwait 128
+#define __NR_rt_sigqueueinfo 129
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_rt_sigsuspend 130
+#define __NR_sigaltstack 131
+#define __NR_utime 132
+#define __NR_mknod 133
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_uselib 134
+#define __NR_personality 135
+#define __NR_ustat 136
+#define __NR_statfs 137
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fstatfs 138
+#define __NR_sysfs 139
+#define __NR_getpriority 140
+#define __NR_setpriority 141
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sched_setparam 142
+#define __NR_sched_getparam 143
+#define __NR_sched_setscheduler 144
+#define __NR_sched_getscheduler 145
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#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
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_munlock 150
+#define __NR_mlockall 151
+#define __NR_munlockall 152
+#define __NR_vhangup 153
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_modify_ldt 154
+#define __NR_pivot_root 155
+#define __NR__sysctl 156
+#define __NR_prctl 157
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_arch_prctl 158
+#define __NR_adjtimex 159
+#define __NR_setrlimit 160
+#define __NR_chroot 161
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sync 162
+#define __NR_acct 163
+#define __NR_settimeofday 164
+#define __NR_mount 165
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_umount2 166
+#define __NR_swapon 167
+#define __NR_swapoff 168
+#define __NR_reboot 169
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sethostname 170
+#define __NR_setdomainname 171
+#define __NR_iopl 172
+#define __NR_ioperm 173
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_create_module 174
+#define __NR_init_module 175
+#define __NR_delete_module 176
+#define __NR_get_kernel_syms 177
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_query_module 178
+#define __NR_quotactl 179
+#define __NR_nfsservctl 180
+#define __NR_getpmsg 181
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_putpmsg 182
+#define __NR_afs_syscall 183
+#define __NR_tuxcall 184
+#define __NR_security 185
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_gettid 186
+#define __NR_readahead 187
+#define __NR_setxattr 188
+#define __NR_lsetxattr 189
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_fsetxattr 190
+#define __NR_getxattr 191
+#define __NR_lgetxattr 192
+#define __NR_fgetxattr 193
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_listxattr 194
+#define __NR_llistxattr 195
+#define __NR_flistxattr 196
+#define __NR_removexattr 197
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_lremovexattr 198
+#define __NR_fremovexattr 199
+#define __NR_tkill 200
+#define __NR_time 201
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_futex 202
+#define __NR_sched_setaffinity 203
+#define __NR_sched_getaffinity 204
+#define __NR_set_thread_area 205
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_setup 206
+#define __NR_io_destroy 207
+#define __NR_io_getevents 208
+#define __NR_io_submit 209
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_io_cancel 210
+#define __NR_get_thread_area 211
+#define __NR_lookup_dcookie 212
+#define __NR_epoll_create 213
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_ctl_old 214
+#define __NR_epoll_wait_old 215
+#define __NR_remap_file_pages 216
+#define __NR_getdents64 217
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_set_tid_address 218
+#define __NR_restart_syscall 219
+#define __NR_semtimedop 220
+#define __NR_fadvise64 221
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_create 222
+#define __NR_timer_settime 223
+#define __NR_timer_gettime 224
+#define __NR_timer_getoverrun 225
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timer_delete 226
+#define __NR_clock_settime 227
+#define __NR_clock_gettime 228
+#define __NR_clock_getres 229
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_clock_nanosleep 230
+#define __NR_exit_group 231
+#define __NR_epoll_wait 232
+#define __NR_epoll_ctl 233
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_tgkill 234
+#define __NR_utimes 235
+#define __NR_vserver 236
+#define __NR_mbind 237
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_set_mempolicy 238
+#define __NR_get_mempolicy 239
+#define __NR_mq_open 240
+#define __NR_mq_unlink 241
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mq_timedsend 242
+#define __NR_mq_timedreceive 243
+#define __NR_mq_notify 244
+#define __NR_mq_getsetattr 245
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_kexec_load 246
+#define __NR_waitid 247
+#define __NR_add_key 248
+#define __NR_request_key 249
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_keyctl 250
+#define __NR_ioprio_set 251
+#define __NR_ioprio_get 252
+#define __NR_inotify_init 253
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_add_watch 254
+#define __NR_inotify_rm_watch 255
+#define __NR_migrate_pages 256
+#define __NR_openat 257
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_mkdirat 258
+#define __NR_mknodat 259
+#define __NR_fchownat 260
+#define __NR_futimesat 261
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_newfstatat 262
+#define __NR_unlinkat 263
+#define __NR_renameat 264
+#define __NR_linkat 265
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_symlinkat 266
+#define __NR_readlinkat 267
+#define __NR_fchmodat 268
+#define __NR_faccessat 269
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_pselect6 270
+#define __NR_ppoll 271
+#define __NR_unshare 272
+#define __NR_set_robust_list 273
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_get_robust_list 274
+#define __NR_splice 275
+#define __NR_tee 276
+#define __NR_sync_file_range 277
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_vmsplice 278
+#define __NR_move_pages 279
+#define __NR_utimensat 280
+#define __NR_epoll_pwait 281
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_signalfd 282
+#define __NR_timerfd_create 283
+#define __NR_eventfd 284
+#define __NR_fallocate 285
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_timerfd_settime 286
+#define __NR_timerfd_gettime 287
+#define __NR_accept4 288
+#define __NR_signalfd4 289
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_eventfd2 290
+#define __NR_epoll_create1 291
+#define __NR_dup3 292
+#define __NR_pipe2 293
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_inotify_init1 294
+#define __NR_preadv 295
+#define __NR_pwritev 296
+#define __NR_rt_tgsigqueueinfo 297
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_perf_event_open 298
+#define __NR_recvmmsg 299
+#define __NR_fanotify_init 300
+#define __NR_fanotify_mark 301
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_prlimit64 302
+#define __NR_name_to_handle_at 303
+#define __NR_open_by_handle_at 304
+#define __NR_clock_adjtime 305
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_syncfs 306
+#define __NR_sendmmsg 307
+#define __NR_setns 308
+#define __NR_getcpu 309
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_process_vm_readv 310
+#define __NR_process_vm_writev 311
+#endif
diff --git a/libc/kernel/arch-x86/asm/user.h b/libc/kernel/arch-x86/asm/user.h
index 054182e..066bf4e 100644
--- a/libc/kernel/arch-x86/asm/user.h
+++ b/libc/kernel/arch-x86/asm/user.h
@@ -16,4 +16,36 @@
***
****************************************************************************
****************************************************************************/
+#ifndef _ASM_X86_USER_H
+#define _ASM_X86_USER_H
+#ifdef __i386__
#include "user_32.h"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+#include "user_64.h"
+#endif
+#include <asm/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct user_ymmh_regs {
+ __u32 ymmh_space[64];
+};
+struct user_xsave_hdr {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 xstate_bv;
+ __u64 reserved1[2];
+ __u64 reserved2[5];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define USER_XSTATE_FX_SW_WORDS 6
+#define USER_XSTATE_XCR0_WORD 0
+struct user_xstateregs {
+ struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u64 fpx_space[58];
+ __u64 xstate_fx_sw[USER_XSTATE_FX_SW_WORDS];
+ } i387;
+ struct user_xsave_hdr xsave_hdr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct user_ymmh_regs ymmh;
+};
+#endif
diff --git a/libc/kernel/arch-x86/asm/user_32.h b/libc/kernel/arch-x86/asm/user_32.h
index 6825b35..7be3118 100644
--- a/libc/kernel/arch-x86/asm/user_32.h
+++ b/libc/kernel/arch-x86/asm/user_32.h
@@ -16,8 +16,8 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _I386_USER_H
-#define _I386_USER_H
+#ifndef _ASM_X86_USER_32_H
+#define _ASM_X86_USER_32_H
#include <asm/page.h>
struct user_i387_struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -52,40 +52,53 @@
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct user_regs_struct {
- long ebx, ecx, edx, esi, edi, ebp, eax;
- unsigned short ds, __ds, es, __es;
- unsigned short fs, __fs, gs, __gs;
+ unsigned long bx;
+ unsigned long cx;
+ unsigned long dx;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- long orig_eax, eip;
- unsigned short cs, __cs;
- long eflags, esp;
- unsigned short ss, __ss;
+ unsigned long si;
+ unsigned long di;
+ unsigned long bp;
+ unsigned long ax;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long ds;
+ unsigned long es;
+ unsigned long fs;
+ unsigned long gs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long orig_ax;
+ unsigned long ip;
+ unsigned long cs;
+ unsigned long flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long sp;
+ unsigned long ss;
};
struct user{
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct user_regs_struct regs;
int u_fpvalid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct user_i387_struct i387;
unsigned long int u_tsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long int u_dsize;
unsigned long int u_ssize;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long start_code;
unsigned long start_stack;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
long int signal;
int reserved;
+ unsigned long u_ar0;
+ struct user_i387_struct *u_fpstate;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- struct user_pt_regs * u_ar0;
- struct user_i387_struct* u_fpstate;
unsigned long magic;
char u_comm[32];
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int u_debugreg[8];
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define NBPG PAGE_SIZE
#define UPAGES 1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/kernel/arch-x86/asm/user_64.h b/libc/kernel/arch-x86/asm/user_64.h
new file mode 100644
index 0000000..7c5bf01
--- /dev/null
+++ b/libc/kernel/arch-x86/asm/user_64.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_X86_USER_64_H
+#define _ASM_X86_USER_64_H
+#include <asm/types.h>
+#include <asm/page.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct user_i387_struct {
+ unsigned short cwd;
+ unsigned short swd;
+ unsigned short twd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned short fop;
+ __u64 rip;
+ __u64 rdp;
+ __u32 mxcsr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 mxcsr_mask;
+ __u32 st_space[32];
+ __u32 xmm_space[64];
+ __u32 padding[24];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct user_regs_struct {
+ unsigned long r15;
+ unsigned long r14;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long r13;
+ unsigned long r12;
+ unsigned long bp;
+ unsigned long bx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long r11;
+ unsigned long r10;
+ unsigned long r9;
+ unsigned long r8;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long ax;
+ unsigned long cx;
+ unsigned long dx;
+ unsigned long si;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long di;
+ unsigned long orig_ax;
+ unsigned long ip;
+ unsigned long cs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long flags;
+ unsigned long sp;
+ unsigned long ss;
+ unsigned long fs_base;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long gs_base;
+ unsigned long ds;
+ unsigned long es;
+ unsigned long fs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long gs;
+};
+struct user {
+ struct user_regs_struct regs;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int u_fpvalid;
+ int pad0;
+ struct user_i387_struct i387;
+ unsigned long int u_tsize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long int u_dsize;
+ unsigned long int u_ssize;
+ unsigned long start_code;
+ unsigned long start_stack;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ long int signal;
+ int reserved;
+ int pad1;
+ unsigned long u_ar0;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct user_i387_struct *u_fpstate;
+ unsigned long magic;
+ char u_comm[32];
+ unsigned long u_debugreg[8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long error_code;
+ unsigned long fault_address;
+};
+#define NBPG PAGE_SIZE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-x86_64 b/libc/kernel/arch-x86_64
new file mode 120000
index 0000000..fb7033c
--- /dev/null
+++ b/libc/kernel/arch-x86_64
@@ -0,0 +1 @@
+arch-x86
\ No newline at end of file
diff --git a/libc/kernel/arch-arm/asm/page.h b/libc/kernel/common/asm-generic/bitsperlong.h
similarity index 87%
rename from libc/kernel/arch-arm/asm/page.h
rename to libc/kernel/common/asm-generic/bitsperlong.h
index 3c45724..6f50133 100644
--- a/libc/kernel/arch-arm/asm/page.h
+++ b/libc/kernel/common/asm-generic/bitsperlong.h
@@ -16,10 +16,10 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASMARM_PAGE_H
-#define _ASMARM_PAGE_H
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#ifndef __ASM_GENERIC_BITS_PER_LONG
+#define __ASM_GENERIC_BITS_PER_LONG
+#ifndef __BITS_PER_LONG
+#define __BITS_PER_LONG 32
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PAGE_MASK (~(PAGE_SIZE-1))
+#endif
#endif
diff --git a/libc/kernel/common/asm-generic/posix_types.h b/libc/kernel/common/asm-generic/posix_types.h
new file mode 100644
index 0000000..a64a7e2
--- /dev/null
+++ b/libc/kernel/common/asm-generic/posix_types.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_GENERIC_POSIX_TYPES_H
+#define __ASM_GENERIC_POSIX_TYPES_H
+#include <asm/bitsperlong.h>
+#ifndef __kernel_long_t
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef long __kernel_long_t;
+typedef unsigned long __kernel_ulong_t;
+#endif
+#ifndef __kernel_ino_t
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef __kernel_ulong_t __kernel_ino_t;
+#endif
+#ifndef __kernel_mode_t
+typedef unsigned int __kernel_mode_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef __kernel_nlink_t
+typedef __kernel_ulong_t __kernel_nlink_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __kernel_pid_t
+typedef int __kernel_pid_t;
+#endif
+#ifndef __kernel_ipc_pid_t
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef int __kernel_ipc_pid_t;
+#endif
+#ifndef __kernel_uid_t
+typedef unsigned int __kernel_uid_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned int __kernel_gid_t;
+#endif
+#ifndef __kernel_suseconds_t
+typedef __kernel_long_t __kernel_suseconds_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef __kernel_daddr_t
+typedef int __kernel_daddr_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __kernel_uid32_t
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __kernel_old_uid_t
+typedef __kernel_uid_t __kernel_old_uid_t;
+typedef __kernel_gid_t __kernel_old_gid_t;
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef __kernel_old_dev_t
+typedef unsigned int __kernel_old_dev_t;
+#endif
+#ifndef __kernel_size_t
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#if __BITS_PER_LONG != 64
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#else
+typedef __kernel_ulong_t __kernel_size_t;
+typedef __kernel_long_t __kernel_ssize_t;
+typedef __kernel_long_t __kernel_ptrdiff_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#endif
+#ifndef __kernel_fsid_t
+typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int val[2];
+} __kernel_fsid_t;
+#endif
+typedef __kernel_long_t __kernel_off_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef long long __kernel_loff_t;
+typedef __kernel_long_t __kernel_time_t;
+typedef __kernel_long_t __kernel_clock_t;
+typedef int __kernel_timer_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef int __kernel_clockid_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/page.h b/libc/kernel/common/linux/const.h
similarity index 85%
rename from libc/kernel/arch-mips/asm/page.h
rename to libc/kernel/common/linux/const.h
index 93eb390..d348300 100644
--- a/libc/kernel/arch-mips/asm/page.h
+++ b/libc/kernel/common/linux/const.h
@@ -16,13 +16,16 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _ASM_PAGE_H
-#define _ASM_PAGE_H
-#ifndef PAGE_SHIFT
-#define PAGE_SHIFT 12
+#ifndef _LINUX_CONST_H
+#define _LINUX_CONST_H
+#ifdef __ASSEMBLY__
+#define _AC(X,Y) X
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
-#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
-#endif
+#define _AT(T,X) X
+#else
+#define __AC(X,Y) (X##Y)
+#define _AC(X,Y) __AC(X,Y)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define _AT(T,X) ((T)(X))
+#endif
+#endif
diff --git a/libc/kernel/common/linux/posix_types.h b/libc/kernel/common/linux/posix_types.h
index d629e22..c197519 100644
--- a/libc/kernel/common/linux/posix_types.h
+++ b/libc/kernel/common/linux/posix_types.h
@@ -19,21 +19,11 @@
#ifndef _LINUX_POSIX_TYPES_H
#define _LINUX_POSIX_TYPES_H
#include <linux/stddef.h>
-#undef __NFDBITS
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __NFDBITS (8 * sizeof(unsigned long))
#undef __FD_SETSIZE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __FD_SETSIZE 1024
-#undef __FDSET_LONGS
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS)
-#undef __FDELT
-#define __FDELT(d) ((d) / __NFDBITS)
-#undef __FDMASK
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __FDMASK(d) (1UL << ((d) % __NFDBITS))
typedef struct {
- unsigned long fds_bits [__FDSET_LONGS];
+ unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))];
} __kernel_fd_set;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef void (*__kernel_sighandler_t)(int);
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index b8aa775..e3a9038 100644
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -1345,7 +1345,11 @@
if macros[name] == kCppUndefinedMacro:
return ("int", 0)
else:
- return ("int", 1)
+ try:
+ value = int(macros[name])
+ return ("int", value)
+ except:
+ return ("defined", macros[name])
if kernel_remove_config_macros and name.startswith("CONFIG_"):
return ("int", 0)
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index da02481..77bfc47 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -7,7 +7,7 @@
# the list of supported architectures
#
-kernel_archs = [ 'arm', 'x86', 'mips' ]
+kernel_archs = [ 'arm', 'mips', 'x86' ]
# the list of include directories that belong to the kernel
# tree. used when looking for sources...
@@ -33,6 +33,7 @@
"__KERNEL_STRICT_NAMES":"1",
"__CHECKER__": kCppUndefinedMacro,
"__CHECK_ENDIAN__": kCppUndefinedMacro,
+ "CONFIG_X86_32": "__i386__",
}
# define to true if you want to remove all defined(CONFIG_FOO) tests
@@ -44,14 +45,14 @@
# toolchain preprocessor
kernel_default_arch_macros = {
"arm": {},
- "x86": {"__i386__": "1", "CONFIG_X86_32": "1"},
"mips": {"CONFIG_32BIT":"1"},
+ "x86": {},
}
kernel_arch_token_replacements = {
"arm": {},
- "x86": {},
"mips": {"off_t":"__kernel_off_t"},
+ "x86": {},
}
# Replace tokens in the output according to this mapping
kernel_token_replacements = {
@@ -63,13 +64,7 @@
# in the final ARM headers. this is only used to keep optimized byteswapping
# static functions and stuff like that.
kernel_known_arm_statics = set(
- [ "___arch__swab32", # asm-arm/byteorder.h
- ]
- )
-
-kernel_known_x86_statics = set(
- [ "___arch__swab32", # asm-x86/byteorder.h
- "___arch__swab64", # asm-x86/byteorder.h
+ [ "___arch__swab32", # asm-arm/byteorder.h
]
)
@@ -78,6 +73,12 @@
]
)
+kernel_known_x86_statics = set(
+ [ "___arch__swab32", # asm-x86/byteorder.h
+ "___arch__swab64", # asm-x86/byteorder.h
+ ]
+ )
+
kernel_known_generic_statics = set(
[ "__invalid_size_argument_for_IOC", # asm-generic/ioctl.h
"__cmsg_nxthdr", # linux/socket.h
@@ -92,8 +93,8 @@
#
kernel_known_statics = {
"arm" : kernel_known_arm_statics,
+ "mips" : kernel_known_mips_statics,
"x86" : kernel_known_x86_statics,
- "mips" : kernel_known_mips_statics
}
# this is a list of macros which we want to specifically exclude from
diff --git a/libc/private/KernelArgumentBlock.h b/libc/private/KernelArgumentBlock.h
index 14eca06..105965e 100644
--- a/libc/private/KernelArgumentBlock.h
+++ b/libc/private/KernelArgumentBlock.h
@@ -30,7 +30,7 @@
class KernelArgumentBlock {
public:
KernelArgumentBlock(void* raw_args) {
- uint32_t* args = reinterpret_cast<uint32_t*>(raw_args);
+ uintptr_t* args = reinterpret_cast<uintptr_t*>(raw_args);
argc = static_cast<int>(*args);
argv = reinterpret_cast<char**>(args + 1);
envp = argv + argc + 1;
@@ -43,14 +43,14 @@
}
++p; // Skip second NULL;
- auxv = reinterpret_cast<Elf32_auxv_t*>(p);
+ auxv = reinterpret_cast<Elf_auxv_t*>(p);
}
// Similar to ::getauxval but doesn't require the libc global variables to be set up,
// so it's safe to call this really early on. This function also lets you distinguish
// between the inability to find the given type and its value just happening to be 0.
unsigned long getauxval(unsigned long type, bool* found_match = NULL) {
- for (Elf32_auxv_t* v = auxv; v->a_type != AT_NULL; ++v) {
+ for (Elf_auxv_t* v = auxv; v->a_type != AT_NULL; ++v) {
if (v->a_type == type) {
if (found_match != NULL) {
*found_match = true;
@@ -67,7 +67,7 @@
int argc;
char** argv;
char** envp;
- Elf32_auxv_t* auxv;
+ Elf_auxv_t* auxv;
abort_msg_t** abort_message_ptr;
diff --git a/libc/private/bionic_auxv.h b/libc/private/bionic_auxv.h
index 23b2e37..69c5341 100644
--- a/libc/private/bionic_auxv.h
+++ b/libc/private/bionic_auxv.h
@@ -33,7 +33,7 @@
__BEGIN_DECLS
-extern Elf32_auxv_t* __libc_auxv;
+extern Elf_auxv_t* __libc_auxv;
__END_DECLS
diff --git a/libc/tools/bionic_utils.py b/libc/tools/bionic_utils.py
index eed9001..a00080d 100644
--- a/libc/tools/bionic_utils.py
+++ b/libc/tools/bionic_utils.py
@@ -2,7 +2,7 @@
import sys, os, commands, string
-all_arches = [ "arm", "mips", "x86" ]
+all_arches = [ "arm", "mips", "x86", "x86_64" ]
# basic debugging trace support
# call D_setlevel to set the verbosity level
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index ea60eec..a3c8450 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -1,12 +1,10 @@
#!/usr/bin/python
-#
-# this tool is used to generate the syscall assembler templates
-# to be placed into arch-{arm,x86,mips}/syscalls, as well as the content
-# of arch-{arm,x86,mips}/linux/_syscalls.h
-#
+
+# This tool is used to generate the assembler system call stubs,
+# the header files listing all available system calls, and the
+# makefiles used to build all the stubs.
import sys, os.path, glob, re, commands, filecmp, shutil
-import getpass
from bionic_utils import *
@@ -15,7 +13,9 @@
# temp directory where we store all intermediate files
bionic_temp = "/tmp/bionic_gensyscalls/"
-def make_dir( path ):
+DRY_RUN = False
+
+def make_dir(path):
path = os.path.abspath(path)
if not os.path.exists(path):
parent = os.path.dirname(path)
@@ -23,23 +23,25 @@
make_dir(parent)
os.mkdir(path)
-def create_file( relpath ):
- dir = os.path.dirname( bionic_temp + relpath )
+def create_file(relpath):
+ dir = os.path.dirname(bionic_temp + relpath)
make_dir(dir)
- return open( bionic_temp + relpath, "w" )
+ return open(bionic_temp + relpath, "w")
+
+
+syscall_stub_header = """/* autogenerated by gensyscalls.py */
+#include <asm/unistd.h>
+#include <linux/err.h>
+#include <machine/asm.h>
+
+ENTRY(%(fname)s)
+"""
+
#
# x86 assembler templates for each syscall stub
#
-x86_header = """/* autogenerated by gensyscalls.py */
-#include <linux/err.h>
-#include <machine/asm.h>
-#include <asm/unistd.h>
-
-ENTRY(%(fname)s)
-"""
-
x86_registers = [ "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp" ]
x86_call = """ movl $%(idname)s, %%eax
@@ -59,18 +61,27 @@
"""
#
+# x86_64 assembler templates for each syscall stub
+#
+
+x86_64_call = """ movl $%(idname)s, %%eax
+ syscall
+ cmpq $-MAX_ERRNO, %%rax
+ jb 1f
+ negl %%eax
+ movl %%eax, %%edi
+ call __set_errno
+ orq $-1, %%rax
+1:
+ ret
+END(%(fname)s)
+"""
+
+#
# ARM assembler templates for each syscall stub
#
-arm_header = """/* autogenerated by gensyscalls.py */
-#include <asm/unistd.h>
-#include <linux/err.h>
-#include <machine/asm.h>
-
-ENTRY(%(fname)s)
-"""
-
-arm_eabi_call_default = arm_header + """\
+arm_eabi_call_default = syscall_stub_header + """\
mov ip, r7
ldr r7, =%(idname)s
swi #0
@@ -82,7 +93,7 @@
END(%(fname)s)
"""
-arm_eabi_call_long = arm_header + """\
+arm_eabi_call_long = syscall_stub_header + """\
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
@@ -178,6 +189,12 @@
count += 1
return count
+def count_generic_param_registers64(params):
+ count = 0
+ for param in params:
+ count += 1
+ return count
+
# This lets us support regular system calls like __NR_write and also weird
# ones like __ARM_NR_cacheflush, where the NR doesn't come at the start.
def make__NR_name(name):
@@ -193,11 +210,22 @@
self.other_files = []
self.syscalls = []
+ def x86_64_genstub(self, fname, numparams, idname):
+ t = { "fname" : fname, "idname" : idname }
+
+ result = syscall_stub_header % t
+ # rcx is used as 4th argument. Kernel wants it at r10.
+ if (numparams > 3):
+ result += " movq %rcx, %r10\n"
+
+ result += x86_64_call % t
+ return result
+
def x86_genstub(self, fname, numparams, idname):
t = { "fname" : fname,
"idname" : idname }
- result = x86_header % t
+ result = syscall_stub_header % t
stack_bias = 4
for r in range(numparams):
result += " pushl " + x86_registers[r] + "\n"
@@ -222,7 +250,7 @@
t = { "fname" : fname,
"idname" : idname }
- result = x86_header % t
+ result = syscall_stub_header % t
stack_bias = 4
# save the regs we need
@@ -294,6 +322,9 @@
if t.has_key("mips"):
t["asm-mips"] = self.mips_genstub(syscall_func, make__NR_name(syscall_name))
+ if t.has_key("x86_64"):
+ num_regs = count_generic_param_registers64(syscall_params)
+ t["asm-x86_64"] = self.x86_64_genstub(syscall_func, num_regs, __NR_name)
# Scan a Linux kernel asm/unistd.h file containing __NR_* constants
# and write out equivalent SYS_* constants for glibc source compatibility.
@@ -323,6 +354,8 @@
self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-mips/asm/unistd.h")
glibc_fp.write("#elif defined(__i386__)\n")
self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-x86/asm/unistd_32.h")
+ glibc_fp.write("#elif defined(__x86_64__)\n")
+ self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-x86/asm/unistd_64.h")
glibc_fp.write("#endif\n")
glibc_fp.write("#endif /* _BIONIC_GLIBC_SYSCALLS_H_ */\n")
@@ -358,63 +391,62 @@
def regenerate(self):
- D( "scanning for existing architecture-specific stub files" )
+ D("scanning for existing architecture-specific stub files...")
bionic_libc_root_len = len(bionic_libc_root)
for arch in all_arches:
arch_path = bionic_libc_root + "arch-" + arch
- D( "scanning " + arch_path )
- files = glob.glob( arch_path + "/syscalls/*.S" )
+ D("scanning " + arch_path)
+ files = glob.glob(arch_path + "/syscalls/*.S")
for f in files:
- self.old_stubs.append( f[bionic_libc_root_len:] )
+ self.old_stubs.append(f[bionic_libc_root_len:])
- D( "found %d stub files" % len(self.old_stubs) )
+ D("found %d stub files" % len(self.old_stubs))
- if not os.path.exists( bionic_temp ):
- D( "creating %s" % bionic_temp )
- make_dir( bionic_temp )
+ if not os.path.exists(bionic_temp):
+ D("creating %s..." % bionic_temp)
+ make_dir(bionic_temp)
- D( "re-generating stubs and support files" )
+ D("re-generating stubs and support files...")
self.gen_glibc_syscalls_h()
for arch in all_arches:
self.gen_arch_syscalls_mk(arch)
self.gen_syscall_stubs()
- D( "comparing files" )
+ D("comparing files...")
adds = []
edits = []
for stub in self.new_stubs + self.other_files:
- if not os.path.exists( bionic_libc_root + stub ):
+ if not os.path.exists(bionic_libc_root + stub):
# new file, git add it
- D( "new file: " + stub)
- adds.append( bionic_libc_root + stub )
- shutil.copyfile( bionic_temp + stub, bionic_libc_root + stub )
+ D("new file: " + stub)
+ adds.append(bionic_libc_root + stub)
+ shutil.copyfile(bionic_temp + stub, bionic_libc_root + stub)
- elif not filecmp.cmp( bionic_temp + stub, bionic_libc_root + stub ):
- D( "changed file: " + stub)
- edits.append( stub )
+ elif not filecmp.cmp(bionic_temp + stub, bionic_libc_root + stub):
+ D("changed file: " + stub)
+ edits.append(stub)
deletes = []
for stub in self.old_stubs:
if not stub in self.new_stubs:
- D( "deleted file: " + stub)
- deletes.append( bionic_libc_root + stub )
+ D("deleted file: " + stub)
+ deletes.append(bionic_libc_root + stub)
+ if not DRY_RUN:
+ if adds:
+ commands.getoutput("git add " + " ".join(adds))
+ if deletes:
+ commands.getoutput("git rm " + " ".join(deletes))
+ if edits:
+ for file in edits:
+ shutil.copyfile(bionic_temp + file, bionic_libc_root + file)
+ commands.getoutput("git add " + " ".join((bionic_libc_root + file) for file in edits))
- if adds:
- commands.getoutput("git add " + " ".join(adds))
- if deletes:
- commands.getoutput("git rm " + " ".join(deletes))
- if edits:
- for file in edits:
- shutil.copyfile( bionic_temp + file, bionic_libc_root + file )
- commands.getoutput("git add " +
- " ".join((bionic_libc_root + file) for file in edits))
-
- commands.getoutput("git add %s%s" % (bionic_libc_root,"SYSCALLS.TXT"))
+ commands.getoutput("git add %s%s" % (bionic_libc_root,"SYSCALLS.TXT"))
if (not adds) and (not deletes) and (not edits):
D("no changes detected!")
diff --git a/libdl/Android.mk b/libdl/Android.mk
index e6c6bf4..9d1e1e0 100644
--- a/libdl/Android.mk
+++ b/libdl/Android.mk
@@ -18,7 +18,7 @@
LOCAL_LDFLAGS := -Wl,--exclude-libs=libgcc.a
# for x86, exclude libgcc_eh.a for the same reasons as above
-ifeq ($(TARGET_ARCH),x86)
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
LOCAL_LDFLAGS += -Wl,--exclude-libs=libgcc_eh.a
endif
diff --git a/libm/Android.mk b/libm/Android.mk
index 0d2c843..1d87dc2 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -217,7 +217,7 @@
# TODO: re-enable i387/e_sqrtf.S for x86, and maybe others.
-libm_common_cflags := -DFLT_EVAL_METHOD=0
+libm_common_cflags := -DFLT_EVAL_METHOD=0 -std=c99
libm_common_includes := $(LOCAL_PATH)/upstream-freebsd/lib/msun/src/
libm_arm_includes := $(LOCAL_PATH)/arm
@@ -226,6 +226,9 @@
libm_x86_includes := $(LOCAL_PATH)/i386 $(LOCAL_PATH)/i387
libm_x86_src_files := i387/fenv.c
+libm_x86_64_includes := $(LOCAL_PATH)/amd64
+libm_x86_64_src_files := amd64/fenv.c
+
libm_mips_cflags := -fno-builtin-rintf -fno-builtin-rint
libm_mips_includes := $(LOCAL_PATH)/mips
libm_mips_src_files := mips/fenv.c
diff --git a/libm/amd64/_fpmath.h b/libm/amd64/_fpmath.h
new file mode 100755
index 0000000..c2a7384
--- /dev/null
+++ b/libm/amd64/_fpmath.h
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+union IEEEl2bits {
+ long double e;
+ struct {
+ unsigned int manl :32;
+ unsigned int manh :32;
+ unsigned int exp :15;
+ unsigned int sign :1;
+ unsigned int junkl :16;
+ unsigned int junkh :32;
+ } bits;
+ struct {
+ unsigned long man :64;
+ unsigned int expsign :16;
+ unsigned long junk :48;
+ } xbits;
+};
+
+#define LDBL_NBIT 0x80000000
+#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT)
+
+#define LDBL_MANH_SIZE 32
+#define LDBL_MANL_SIZE 32
+
+#define LDBL_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)(u).bits.manh; \
+} while (0)
diff --git a/libm/amd64/fenv.c b/libm/amd64/fenv.c
new file mode 100755
index 0000000..7ad3be7
--- /dev/null
+++ b/libm/amd64/fenv.c
@@ -0,0 +1,408 @@
+/* $OpenBSD: fenv.c,v 1.3 2012/12/05 23:20:02 deraadt Exp $ */
+/* $NetBSD: fenv.c,v 1.1 2010/07/31 21:47:53 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fenv.h>
+#include <machine/fpu.h>
+
+/*
+ * The following constant represents the default floating-point environment
+ * (that is, the one installed at program startup) and has type pointer to
+ * const-qualified fenv_t.
+ *
+ * It can be used as an argument to the functions within the <fenv.h> header
+ * that manage the floating-point environment, namely fesetenv() and
+ * feupdateenv().
+ *
+ * x87 fpu registers are 16bit wide. The upper bits, 31-16, are marked as
+ * RESERVED.
+ */
+fenv_t __fe_dfl_env = {
+ {
+ 0xffff0000 | __INITIAL_NPXCW__, /* Control word register */
+ 0xffff0000, /* Status word register */
+ 0xffffffff, /* Tag word register */
+ {
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xffff0000
+ }
+ },
+ __INITIAL_MXCSR__ /* MXCSR register */
+};
+
+
+/*
+ * The feclearexcept() function clears the supported floating-point exceptions
+ * represented by `excepts'.
+ */
+int
+feclearexcept(int excepts)
+{
+ fenv_t fenv;
+ unsigned int mxcsr;
+
+ excepts &= FE_ALL_EXCEPT;
+
+ /* Store the current x87 floating-point environment */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (fenv));
+
+ /* Clear the requested floating-point exceptions */
+ fenv.__x87.__status &= ~excepts;
+
+ /* Load the x87 floating-point environent */
+ __asm__ __volatile__ ("fldenv %0" : : "m" (fenv));
+
+ /* Same for SSE environment */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+ mxcsr &= ~excepts;
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (mxcsr));
+
+ return (0);
+}
+
+/*
+ * The fegetexceptflag() function stores an implementation-defined
+ * representation of the states of the floating-point status flags indicated by
+ * the argument excepts in the object pointed to by the argument flagp.
+ */
+int
+fegetexceptflag(fexcept_t *flagp, int excepts)
+{
+ unsigned short status;
+ unsigned int mxcsr;
+
+ excepts &= FE_ALL_EXCEPT;
+
+ /* Store the current x87 status register */
+ __asm__ __volatile__ ("fnstsw %0" : "=am" (status));
+
+ /* Store the MXCSR register */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+
+ /* Store the results in flagp */
+ *flagp = (status | mxcsr) & excepts;
+
+ return (0);
+}
+
+/*
+ * The feraiseexcept() function raises the supported floating-point exceptions
+ * represented by the argument `excepts'.
+ *
+ * The standard explicitly allows us to execute an instruction that has the
+ * exception as a side effect, but we choose to manipulate the status register
+ * directly.
+ *
+ * The validation of input is being deferred to fesetexceptflag().
+ */
+int
+feraiseexcept(int excepts)
+{
+ excepts &= FE_ALL_EXCEPT;
+
+ fesetexceptflag((fexcept_t *)&excepts, excepts);
+ __asm__ __volatile__ ("fwait");
+
+ return (0);
+}
+
+/*
+ * This function sets the floating-point status flags indicated by the argument
+ * `excepts' to the states stored in the object pointed to by `flagp'. It does
+ * NOT raise any floating-point exceptions, but only sets the state of the flags.
+ */
+int
+fesetexceptflag(const fexcept_t *flagp, int excepts)
+{
+ fenv_t fenv;
+ unsigned int mxcsr;
+
+ excepts &= FE_ALL_EXCEPT;
+
+ /* Store the current x87 floating-point environment */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (fenv));
+
+ /* Set the requested status flags */
+ fenv.__x87.__status &= ~excepts;
+ fenv.__x87.__status |= *flagp & excepts;
+
+ /* Load the x87 floating-point environent */
+ __asm__ __volatile__ ("fldenv %0" : : "m" (fenv));
+
+ /* Same for SSE environment */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+ mxcsr &= ~excepts;
+ mxcsr |= *flagp & excepts;
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (mxcsr));
+
+ return (0);
+}
+
+/*
+ * The fetestexcept() function determines which of a specified subset of the
+ * floating-point exception flags are currently set. The `excepts' argument
+ * specifies the floating-point status flags to be queried.
+ */
+int
+fetestexcept(int excepts)
+{
+ unsigned short status;
+ unsigned int mxcsr;
+
+ excepts &= FE_ALL_EXCEPT;
+
+ /* Store the current x87 status register */
+ __asm__ __volatile__ ("fnstsw %0" : "=am" (status));
+
+ /* Store the MXCSR register state */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+
+ return ((status | mxcsr) & excepts);
+}
+
+/*
+ * The fegetround() function gets the current rounding direction.
+ */
+int
+fegetround(void)
+{
+ unsigned short control;
+
+ /*
+ * We assume that the x87 and the SSE unit agree on the
+ * rounding mode. Reading the control word on the x87 turns
+ * out to be about 5 times faster than reading it on the SSE
+ * unit on an Opteron 244.
+ */
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
+
+ return (control & _X87_ROUND_MASK);
+}
+
+/*
+ * The fesetround() function establishes the rounding direction represented by
+ * its argument `round'. If the argument is not equal to the value of a rounding
+ * direction macro, the rounding direction is not changed.
+ */
+int
+fesetround(int round)
+{
+ unsigned short control;
+ unsigned int mxcsr;
+
+ /* Check whether requested rounding direction is supported */
+ if (round & ~_X87_ROUND_MASK)
+ return (-1);
+
+ /* Store the current x87 control word register */
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
+
+ /* Set the rounding direction */
+ control &= ~_X87_ROUND_MASK;
+ control |= round;
+
+ /* Load the x87 control word register */
+ __asm__ __volatile__ ("fldcw %0" : : "m" (control));
+
+ /* Same for the SSE environment */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+ mxcsr &= ~(_X87_ROUND_MASK << _SSE_ROUND_SHIFT);
+ mxcsr |= round << _SSE_ROUND_SHIFT;
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (mxcsr));
+
+ return (0);
+}
+
+/*
+ * The fegetenv() function attempts to store the current floating-point
+ * environment in the object pointed to by envp.
+ */
+int
+fegetenv(fenv_t *envp)
+{
+ /* Store the current x87 floating-point environment */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (*envp));
+
+ /* Store the MXCSR register state */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (envp->__mxcsr));
+
+ /*
+ * When an FNSTENV instruction is executed, all pending exceptions are
+ * essentially lost (either the x87 FPU status register is cleared or
+ * all exceptions are masked).
+ *
+ * 8.6 X87 FPU EXCEPTION SYNCHRONIZATION -
+ * Intel(R) 64 and IA-32 Architectures Softare Developer's Manual - Vol1
+ */
+ __asm__ __volatile__ ("fldcw %0" : : "m" (envp->__x87.__control));
+
+ return (0);
+}
+
+/*
+ * The feholdexcept() function saves the current floating-point environment
+ * in the object pointed to by envp, clears the floating-point status flags, and
+ * then installs a non-stop (continue on floating-point exceptions) mode, if
+ * available, for all floating-point exceptions.
+ */
+int
+feholdexcept(fenv_t *envp)
+{
+ unsigned int mxcsr;
+
+ /* Store the current x87 floating-point environment */
+ __asm__ __volatile__ ("fnstenv %0" : "=m" (*envp));
+
+ /* Clear all exception flags in FPU */
+ __asm__ __volatile__ ("fnclex");
+
+ /* Store the MXCSR register state */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (envp->__mxcsr));
+
+ /* Clear exception flags in MXCSR */
+ mxcsr = envp->__mxcsr;
+ mxcsr &= ~FE_ALL_EXCEPT;
+
+ /* Mask all exceptions */
+ mxcsr |= FE_ALL_EXCEPT << _SSE_MASK_SHIFT;
+
+ /* Store the MXCSR register */
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (mxcsr));
+
+ return (0);
+}
+
+/*
+ * The fesetenv() function attempts to establish the floating-point environment
+ * represented by the object pointed to by envp. The argument `envp' points
+ * to an object set by a call to fegetenv() or feholdexcept(), or equal a
+ * floating-point environment macro. The fesetenv() function does not raise
+ * floating-point exceptions, but only installs the state of the floating-point
+ * status flags represented through its argument.
+ */
+int
+fesetenv(const fenv_t *envp)
+{
+ /* Load the x87 floating-point environent */
+ __asm__ __volatile__ ("fldenv %0" : : "m" (*envp));
+
+ /* Store the MXCSR register */
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (envp->__mxcsr));
+
+ return (0);
+}
+
+/*
+ * The feupdateenv() function saves the currently raised floating-point
+ * exceptions in its automatic storage, installs the floating-point environment
+ * represented by the object pointed to by `envp', and then raises the saved
+ * floating-point exceptions. The argument `envp' shall point to an object set
+ * by a call to feholdexcept() or fegetenv(), or equal a floating-point
+ * environment macro.
+ */
+int
+feupdateenv(const fenv_t *envp)
+{
+ unsigned short status;
+ unsigned int mxcsr;
+
+ /* Store the x87 status register */
+ __asm__ __volatile__ ("fnstsw %0" : "=am" (status));
+
+ /* Store the MXCSR register */
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+
+ /* Install new floating-point environment */
+ fesetenv(envp);
+
+ /* Raise any previously accumulated exceptions */
+ feraiseexcept(status | mxcsr);
+
+ return (0);
+}
+
+/*
+ * The following functions are extentions to the standard
+ */
+int
+feenableexcept(int mask)
+{
+ unsigned int mxcsr, omask;
+ unsigned short control;
+
+ mask &= FE_ALL_EXCEPT;
+
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+
+ omask = ~(control | (mxcsr >> _SSE_MASK_SHIFT)) & FE_ALL_EXCEPT;
+ control &= ~mask;
+ __asm__ __volatile__ ("fldcw %0" : : "m" (control));
+
+ mxcsr &= ~(mask << _SSE_MASK_SHIFT);
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (mxcsr));
+
+ return (omask);
+}
+
+int
+fedisableexcept(int mask)
+{
+ unsigned int mxcsr, omask;
+ unsigned short control;
+
+ mask &= FE_ALL_EXCEPT;
+
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
+ __asm__ __volatile__ ("stmxcsr %0" : "=m" (mxcsr));
+
+ omask = ~(control | (mxcsr >> _SSE_MASK_SHIFT)) & FE_ALL_EXCEPT;
+ control |= mask;
+ __asm__ __volatile__ ("fldcw %0" : : "m" (control));
+
+ mxcsr |= mask << _SSE_MASK_SHIFT;
+ __asm__ __volatile__ ("ldmxcsr %0" : : "m" (mxcsr));
+
+ return (omask);
+}
+
+int
+fegetexcept(void)
+{
+ unsigned short control;
+
+ /*
+ * We assume that the masks for the x87 and the SSE unit are
+ * the same.
+ */
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (control));
+
+ return (~control & FE_ALL_EXCEPT);
+}
diff --git a/libm/include/amd64/fenv.h b/libm/include/amd64/fenv.h
new file mode 100644
index 0000000..037778e
--- /dev/null
+++ b/libm/include/amd64/fenv.h
@@ -0,0 +1,117 @@
+/* $OpenBSD: fenv.h,v 1.4 2011/05/25 21:46:49 martynas Exp $ */
+/* $NetBSD: fenv.h,v 1.1 2010/07/31 21:47:54 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _AMD64_FENV_H_
+#define _AMD64_FENV_H_
+
+#include <sys/types.h>
+
+/*
+ * Each symbol representing a floating point exception expands to an integer
+ * constant expression with values, such that bitwise-inclusive ORs of _all
+ * combinations_ of the constants result in distinct values.
+ *
+ * We use such values that allow direct bitwise operations on FPU/SSE registers.
+ */
+#define FE_INVALID 0x01
+#define FE_DENORMAL 0x02
+#define FE_DIVBYZERO 0x04
+#define FE_OVERFLOW 0x08
+#define FE_UNDERFLOW 0x10
+#define FE_INEXACT 0x20
+
+/*
+ * The following symbol is simply the bitwise-inclusive OR of all floating-point
+ * exception constants defined above.
+ */
+#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO | \
+ FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
+#define _SSE_MASK_SHIFT 7
+
+/*
+ * Each symbol representing the rounding direction, expands to an integer
+ * constant expression whose value is distinct non-negative value.
+ *
+ * We use such values that allow direct bitwise operations on FPU/SSE registers.
+ */
+#define FE_TONEAREST 0x000
+#define FE_DOWNWARD 0x400
+#define FE_UPWARD 0x800
+#define FE_TOWARDZERO 0xc00
+
+/*
+ * The following symbol is simply the bitwise-inclusive OR of all floating-point
+ * rounding direction constants defined above.
+ */
+#define _X87_ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | \
+ FE_TOWARDZERO)
+#define _SSE_ROUND_SHIFT 3
+
+/*
+ * fenv_t represents the entire floating-point environment.
+ */
+typedef struct {
+ struct {
+ unsigned int __control; /* Control word register */
+ unsigned int __status; /* Status word register */
+ unsigned int __tag; /* Tag word register */
+ unsigned int __others[4]; /* EIP, Pointer Selector, etc */
+ } __x87;
+ unsigned int __mxcsr; /* Control, status register */
+} fenv_t;
+
+/*
+ * The following constant represents the default floating-point environment
+ * (that is, the one installed at program startup) and has type pointer to
+ * const-qualified fenv_t.
+ *
+ * It can be used as an argument to the functions within the <fenv.h> header
+ * that manage the floating-point environment, namely fesetenv() and
+ * feupdateenv().
+ */
+__BEGIN_DECLS
+extern fenv_t __fe_dfl_env;
+__END_DECLS
+#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env)
+
+/*
+ * fexcept_t represents the floating-point status flags collectively, including
+ * any status the implementation associates with the flags.
+ *
+ * A floating-point status flag is a system variable whose value is set (but
+ * never cleared) when a floating-point exception is raised, which occurs as a
+ * side effect of exceptional floating-point arithmetic to provide auxiliary
+ * information.
+ *
+ * A floating-point control mode is a system variable whose value may be set by
+ * the user to affect the subsequent behavior of floating-point arithmetic.
+ */
+typedef unsigned int fexcept_t;
+
+#endif /* !_AMD64_FENV_H_ */
diff --git a/linker/debugger.cpp b/linker/debugger.cpp
index d72aa39..c947522 100644
--- a/linker/debugger.cpp
+++ b/linker/debugger.cpp
@@ -137,9 +137,9 @@
// "info" will be NULL if the siginfo_t information was not available.
if (info != NULL) {
__libc_format_log(ANDROID_LOG_FATAL, "libc",
- "Fatal signal %d (%s) at 0x%08x (code=%d), thread %d (%s)",
- signum, signal_name, reinterpret_cast<uintptr_t>(info->si_addr),
- info->si_code, gettid(), thread_name);
+ "Fatal signal %d (%s) at %p (code=%d), thread %d (%s)",
+ signum, signal_name, info->si_addr, info->si_code,
+ gettid(), thread_name);
} else {
__libc_format_log(ANDROID_LOG_FATAL, "libc",
"Fatal signal %d (%s), thread %d (%s)",
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 946f79e..b438f00 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -83,7 +83,7 @@
}
soinfo* found = NULL;
- Elf32_Sym* sym = NULL;
+ Elf_Sym* sym = NULL;
if (handle == RTLD_DEFAULT) {
sym = dlsym_linear_lookup(symbol, &found, NULL);
} else if (handle == RTLD_NEXT) {
@@ -131,7 +131,7 @@
info->dli_fbase = (void*) si->base;
// Determine if any symbol in the library contains the specified address.
- Elf32_Sym *sym = dladdr_find_symbol(si, addr);
+ Elf_Sym *sym = dladdr_find_symbol(si, addr);
if (sym != NULL) {
info->dli_sname = si->strtab + sym->st_name;
info->dli_saddr = (void*)(si->load_bias + sym->st_value);
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 0f20181..983d0a0 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -437,15 +437,15 @@
return rv;
}
-static Elf32_Sym* soinfo_elf_lookup(soinfo* si, unsigned hash, const char* name) {
- Elf32_Sym* symtab = si->symtab;
+static Elf_Sym* soinfo_elf_lookup(soinfo* si, unsigned hash, const char* name) {
+ Elf_Sym* symtab = si->symtab;
const char* strtab = si->strtab;
- TRACE_TYPE(LOOKUP, "SEARCH %s in %s@0x%08x %08x %d",
+ TRACE_TYPE(LOOKUP, "SEARCH %s in %s@0x%08x %08x %zd",
name, si->name, si->base, hash, hash % si->nbucket);
for (unsigned n = si->bucket[hash % si->nbucket]; n != 0; n = si->chain[n]) {
- Elf32_Sym* s = symtab + n;
+ Elf_Sym* s = symtab + n;
if (strcmp(strtab + s->st_name, name)) continue;
/* only concern ourselves with global and weak symbol definitions */
@@ -478,9 +478,9 @@
return h;
}
-static Elf32_Sym* soinfo_do_lookup(soinfo* si, const char* name, soinfo** lsi, soinfo* needed[]) {
+static Elf_Sym* soinfo_do_lookup(soinfo* si, const char* name, soinfo** lsi, soinfo* needed[]) {
unsigned elf_hash = elfhash(name);
- Elf32_Sym* s = NULL;
+ Elf_Sym* s = NULL;
if (si != NULL && somain != NULL) {
@@ -587,8 +587,7 @@
Binary Interface) where in Chapter 5 it discuss resolving "Shared
Object Dependencies" in breadth first search order.
*/
-Elf32_Sym* dlsym_handle_lookup(soinfo* si, const char* name)
-{
+Elf_Sym* dlsym_handle_lookup(soinfo* si, const char* name) {
return soinfo_elf_lookup(si, elfhash(name), name);
}
@@ -597,14 +596,14 @@
beginning of the global solist. Otherwise the search starts at the
specified soinfo (for RTLD_NEXT).
*/
-Elf32_Sym* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start) {
+Elf_Sym* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start) {
unsigned elf_hash = elfhash(name);
if (start == NULL) {
start = solist;
}
- Elf32_Sym* s = NULL;
+ Elf_Sym* s = NULL;
for (soinfo* si = start; (s == NULL) && (si != NULL); si = si->next) {
s = soinfo_elf_lookup(si, elf_hash, name);
if (s != NULL) {
@@ -622,7 +621,7 @@
}
soinfo* find_containing_library(const void* p) {
- Elf32_Addr address = reinterpret_cast<Elf32_Addr>(p);
+ Elf_Addr address = reinterpret_cast<Elf_Addr>(p);
for (soinfo* si = solist; si != NULL; si = si->next) {
if (address >= si->base && address - si->base < si->size) {
return si;
@@ -631,13 +630,13 @@
return NULL;
}
-Elf32_Sym* dladdr_find_symbol(soinfo* si, const void* addr) {
- Elf32_Addr soaddr = reinterpret_cast<Elf32_Addr>(addr) - si->base;
+Elf_Sym* dladdr_find_symbol(soinfo* si, const void* addr) {
+ Elf_Addr soaddr = reinterpret_cast<Elf_Addr>(addr) - si->base;
// Search the library's symbol table for any defined symbol which
// contains this address.
for (size_t i = 0; i < si->nchain; ++i) {
- Elf32_Sym* sym = &si->symtab[i];
+ Elf_Sym* sym = &si->symtab[i];
if (sym->st_shndx != SHN_UNDEF &&
soaddr >= sym->st_value &&
soaddr < sym->st_value + sym->st_size) {
@@ -651,7 +650,7 @@
#if 0
static void dump(soinfo* si)
{
- Elf32_Sym* s = si->symtab;
+ Elf_Sym* s = si->symtab;
for (unsigned n = 0; n < si->nchain; n++) {
TRACE("%04d> %08x: %02x %04x %08x %08x %s", n, s,
s->st_info, s->st_shndx, s->st_value, s->st_size,
@@ -793,7 +792,7 @@
TRACE("unloading '%s'", si->name);
si->CallDestructors();
- for (Elf32_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
+ for (Elf_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
if (d->d_tag == DT_NEEDED) {
const char* library_name = si->strtab + d->d_un.d_val;
TRACE("%s needs to unload %s", si->name, library_name);
@@ -807,7 +806,7 @@
si->ref_count = 0;
} else {
si->ref_count--;
- TRACE("not unloading '%s', decrementing ref_count to %d", si->name, si->ref_count);
+ TRACE("not unloading '%s', decrementing ref_count to %zd", si->name, si->ref_count);
}
return 0;
}
@@ -840,26 +839,26 @@
}
/* TODO: don't use unsigned for addrs below. It works, but is not
- * ideal. They should probably be either uint32_t, Elf32_Addr, or unsigned
+ * ideal. They should probably be either uint32_t, Elf_Addr, or unsigned
* long.
*/
-static int soinfo_relocate(soinfo* si, Elf32_Rel* rel, unsigned count,
+static int soinfo_relocate(soinfo* si, Elf_Rel* rel, unsigned count,
soinfo* needed[])
{
- Elf32_Sym* symtab = si->symtab;
+ Elf_Sym* symtab = si->symtab;
const char* strtab = si->strtab;
- Elf32_Sym* s;
- Elf32_Rel* start = rel;
+ Elf_Sym* s;
+ Elf_Rel* start = rel;
soinfo* lsi;
for (size_t idx = 0; idx < count; ++idx, ++rel) {
unsigned type = ELF32_R_TYPE(rel->r_info);
unsigned sym = ELF32_R_SYM(rel->r_info);
- Elf32_Addr reloc = static_cast<Elf32_Addr>(rel->r_offset + si->load_bias);
- Elf32_Addr sym_addr = 0;
+ Elf_Addr reloc = static_cast<Elf_Addr>(rel->r_offset + si->load_bias);
+ Elf_Addr sym_addr = 0;
char* sym_name = NULL;
- DEBUG("Processing '%s' relocation at index %d", si->name, idx);
+ DEBUG("Processing '%s' relocation at index %zd", si->name, idx);
if (type == 0) { // R_*_NONE
continue;
}
@@ -931,7 +930,7 @@
return -1;
}
#endif
- sym_addr = static_cast<Elf32_Addr>(s->st_value + lsi->load_bias);
+ sym_addr = static_cast<Elf_Addr>(s->st_value + lsi->load_bias);
}
count_relocation(kRelocSymbol);
} else {
@@ -947,39 +946,39 @@
count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO JMP_SLOT %08x <- %08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) = sym_addr;
break;
case R_ARM_GLOB_DAT:
count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO GLOB_DAT %08x <- %08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) = sym_addr;
break;
case R_ARM_ABS32:
count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO ABS %08x <- %08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) += sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) += sym_addr;
break;
case R_ARM_REL32:
count_relocation(kRelocRelative);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO REL32 %08x <- %08x - %08x %s",
reloc, sym_addr, rel->r_offset, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) += sym_addr - rel->r_offset;
+ *reinterpret_cast<Elf_Addr*>(reloc) += sym_addr - rel->r_offset;
break;
#elif defined(ANDROID_X86_LINKER)
case R_386_JMP_SLOT:
count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO JMP_SLOT %08x <- %08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) = sym_addr;
break;
case R_386_GLOB_DAT:
count_relocation(kRelocAbsolute);
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO GLOB_DAT %08x <- %08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) = sym_addr;
break;
#elif defined(ANDROID_MIPS_LINKER)
case R_MIPS_REL32:
@@ -988,9 +987,9 @@
TRACE_TYPE(RELO, "RELO REL32 %08x <- %08x %s",
reloc, sym_addr, (sym_name) ? sym_name : "*SECTIONHDR*");
if (s) {
- *reinterpret_cast<Elf32_Addr*>(reloc) += sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) += sym_addr;
} else {
- *reinterpret_cast<Elf32_Addr*>(reloc) += si->base;
+ *reinterpret_cast<Elf_Addr*>(reloc) += si->base;
}
break;
#endif /* ANDROID_*_LINKER */
@@ -1007,7 +1006,7 @@
return -1;
}
TRACE_TYPE(RELO, "RELO RELATIVE %08x <- +%08x", reloc, si->base);
- *reinterpret_cast<Elf32_Addr*>(reloc) += si->base;
+ *reinterpret_cast<Elf_Addr*>(reloc) += si->base;
break;
#if defined(ANDROID_X86_LINKER)
@@ -1016,7 +1015,7 @@
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO R_386_32 %08x <- +%08x %s", reloc, sym_addr, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) += sym_addr;
+ *reinterpret_cast<Elf_Addr*>(reloc) += sym_addr;
break;
case R_386_PC32:
@@ -1024,7 +1023,7 @@
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO R_386_PC32 %08x <- +%08x (%08x - %08x) %s",
reloc, (sym_addr - reloc), sym_addr, reloc, sym_name);
- *reinterpret_cast<Elf32_Addr*>(reloc) += (sym_addr - reloc);
+ *reinterpret_cast<Elf_Addr*>(reloc) += (sym_addr - reloc);
break;
#endif /* ANDROID_X86_LINKER */
@@ -1049,7 +1048,7 @@
MARK(rel->r_offset);
TRACE_TYPE(RELO, "RELO %08x <- %d @ %08x %s", reloc, s->st_size, sym_addr, sym_name);
if (reloc == sym_addr) {
- Elf32_Sym *src = soinfo_do_lookup(NULL, sym_name, &lsi, needed);
+ Elf_Sym *src = soinfo_do_lookup(NULL, sym_name, &lsi, needed);
if (src == NULL) {
DL_ERR("%s R_ARM_COPY relocation source cannot be resolved", si->name);
@@ -1091,7 +1090,7 @@
unsigned local_gotno = si->mips_local_gotno;
unsigned gotsym = si->mips_gotsym;
unsigned symtabno = si->mips_symtabno;
- Elf32_Sym* symtab = si->symtab;
+ Elf_Sym* symtab = si->symtab;
/*
* got[0] is address of lazy resolver function
@@ -1116,11 +1115,11 @@
}
/* Now for the global GOT entries */
- Elf32_Sym* sym = symtab + gotsym;
+ Elf_Sym* sym = symtab + gotsym;
got = si->plt_got + local_gotno;
for (size_t g = gotsym; g < symtabno; g++, sym++, got++) {
const char* sym_name;
- Elf32_Sym* s;
+ Elf_Sym* s;
soinfo* lsi;
/* This is an undefined reference... try to locate it */
@@ -1153,7 +1152,7 @@
return;
}
- TRACE("[ Calling %s (size %d) @ %p for '%s' ]", array_name, count, functions, name);
+ TRACE("[ Calling %s (size %zd) @ %p for '%s' ]", array_name, count, functions, name);
int begin = reverse ? (count - 1) : 0;
int end = reverse ? -1 : count;
@@ -1206,12 +1205,12 @@
if ((flags & FLAG_EXE) == 0 && preinit_array != NULL) {
// The GNU dynamic linker silently ignores these, but we warn the developer.
- PRINT("\"%s\": ignoring %d-entry DT_PREINIT_ARRAY in shared library!",
+ PRINT("\"%s\": ignoring %zd-entry DT_PREINIT_ARRAY in shared library!",
name, preinit_array_count);
}
if (dynamic != NULL) {
- for (Elf32_Dyn* d = dynamic; d->d_tag != DT_NULL; ++d) {
+ for (Elf_Dyn* d = dynamic; d->d_tag != DT_NULL; ++d) {
if (d->d_tag == DT_NEEDED) {
const char* library_name = strtab + d->d_un.d_val;
TRACE("\"%s\": calling constructors in DT_NEEDED \"%s\"", name, library_name);
@@ -1300,8 +1299,8 @@
static bool soinfo_link_image(soinfo* si) {
/* "base" might wrap around UINT32_MAX. */
- Elf32_Addr base = si->load_bias;
- const Elf32_Phdr *phdr = si->phdr;
+ Elf_Addr base = si->load_bias;
+ const Elf_Phdr *phdr = si->phdr;
int phnum = si->phnum;
bool relocating_linker = (si->flags & FLAG_LINKER) != 0;
@@ -1313,7 +1312,7 @@
/* Extract dynamic section */
size_t dynamic_count;
- Elf32_Word dynamic_flags;
+ Elf_Word dynamic_flags;
phdr_table_get_dynamic_section(phdr, phnum, base, &si->dynamic,
&dynamic_count, &dynamic_flags);
if (si->dynamic == NULL) {
@@ -1334,7 +1333,7 @@
// Extract useful information from dynamic section.
uint32_t needed_count = 0;
- for (Elf32_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
+ for (Elf_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
DEBUG("d = %p, d[0](tag) = 0x%08x d[1](val) = 0x%08x", d, d->d_tag, d->d_un.d_val);
switch(d->d_tag){
case DT_HASH:
@@ -1347,7 +1346,7 @@
si->strtab = (const char *) (base + d->d_un.d_ptr);
break;
case DT_SYMTAB:
- si->symtab = (Elf32_Sym *) (base + d->d_un.d_ptr);
+ si->symtab = (Elf_Sym *) (base + d->d_un.d_ptr);
break;
case DT_PLTREL:
if (d->d_un.d_val != DT_REL) {
@@ -1356,16 +1355,16 @@
}
break;
case DT_JMPREL:
- si->plt_rel = (Elf32_Rel*) (base + d->d_un.d_ptr);
+ si->plt_rel = (Elf_Rel*) (base + d->d_un.d_ptr);
break;
case DT_PLTRELSZ:
- si->plt_rel_count = d->d_un.d_val / sizeof(Elf32_Rel);
+ si->plt_rel_count = d->d_un.d_val / sizeof(Elf_Rel);
break;
case DT_REL:
- si->rel = (Elf32_Rel*) (base + d->d_un.d_ptr);
+ si->rel = (Elf_Rel*) (base + d->d_un.d_ptr);
break;
case DT_RELSZ:
- si->rel_count = d->d_un.d_val / sizeof(Elf32_Rel);
+ si->rel_count = d->d_un.d_val / sizeof(Elf_Rel);
break;
case DT_PLTGOT:
/* Save this in case we decide to do lazy binding. We don't yet. */
@@ -1375,7 +1374,7 @@
// Set the DT_DEBUG entry to the address of _r_debug for GDB
// if the dynamic table is writable
if ((dynamic_flags & PF_W) != 0) {
- d->d_un.d_val = (int) &_r_debug;
+ d->d_un.d_val = reinterpret_cast<uintptr_t>(&_r_debug);
}
break;
case DT_RELA:
@@ -1394,21 +1393,21 @@
DEBUG("%s constructors (DT_INIT_ARRAY) found at %p", si->name, si->init_array);
break;
case DT_INIT_ARRAYSZ:
- si->init_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf32_Addr);
+ si->init_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf_Addr);
break;
case DT_FINI_ARRAY:
si->fini_array = reinterpret_cast<linker_function_t*>(base + d->d_un.d_ptr);
DEBUG("%s destructors (DT_FINI_ARRAY) found at %p", si->name, si->fini_array);
break;
case DT_FINI_ARRAYSZ:
- si->fini_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf32_Addr);
+ si->fini_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf_Addr);
break;
case DT_PREINIT_ARRAY:
si->preinit_array = reinterpret_cast<linker_function_t*>(base + d->d_un.d_ptr);
DEBUG("%s constructors (DT_PREINIT_ARRAY) found at %p", si->name, si->preinit_array);
break;
case DT_PREINIT_ARRAYSZ:
- si->preinit_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf32_Addr);
+ si->preinit_array_count = ((unsigned)d->d_un.d_val) / sizeof(Elf_Addr);
break;
case DT_TEXTREL:
si->has_text_relocations = true;
@@ -1507,7 +1506,7 @@
soinfo** needed = (soinfo**) alloca((1 + needed_count) * sizeof(soinfo*));
soinfo** pneeded = needed;
- for (Elf32_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
+ for (Elf_Dyn* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
if (d->d_tag == DT_NEEDED) {
const char* library_name = si->strtab + d->d_un.d_val;
DEBUG("%s needs %s", si->name, library_name);
@@ -1588,15 +1587,15 @@
*/
static void add_vdso(KernelArgumentBlock& args UNUSED) {
#ifdef AT_SYSINFO_EHDR
- Elf32_Ehdr* ehdr_vdso = reinterpret_cast<Elf32_Ehdr*>(args.getauxval(AT_SYSINFO_EHDR));
+ Elf_Ehdr* ehdr_vdso = reinterpret_cast<Elf_Ehdr*>(args.getauxval(AT_SYSINFO_EHDR));
soinfo* si = soinfo_alloc("[vdso]");
- si->phdr = reinterpret_cast<Elf32_Phdr*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff);
+ si->phdr = reinterpret_cast<Elf_Phdr*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff);
si->phnum = ehdr_vdso->e_phnum;
si->link_map.l_name = si->name;
for (size_t i = 0; i < si->phnum; ++i) {
if (si->phdr[i].p_type == PT_LOAD) {
- si->link_map.l_addr = reinterpret_cast<Elf32_Addr>(ehdr_vdso) - si->phdr[i].p_vaddr;
+ si->link_map.l_addr = reinterpret_cast<Elf_Addr>(ehdr_vdso) - si->phdr[i].p_vaddr;
break;
}
}
@@ -1608,7 +1607,7 @@
* fixed it's own GOT. It is safe to make references to externs
* and other non-local data at this point.
*/
-static Elf32_Addr __linker_init_post_relocation(KernelArgumentBlock& args, Elf32_Addr linker_base) {
+static Elf_Addr __linker_init_post_relocation(KernelArgumentBlock& args, Elf_Addr linker_base) {
/* NOTE: we store the args pointer on a special location
* of the temporary TLS area in order to pass it to
* the C Library's runtime initializer.
@@ -1688,15 +1687,15 @@
* warning: .dynamic section for "/system/bin/linker" is not at the
* expected address (wrong library or version mismatch?)
*/
- Elf32_Ehdr *elf_hdr = (Elf32_Ehdr *) linker_base;
- Elf32_Phdr *phdr = (Elf32_Phdr*)((unsigned char*) linker_base + elf_hdr->e_phoff);
+ Elf_Ehdr *elf_hdr = (Elf_Ehdr *) linker_base;
+ Elf_Phdr *phdr = (Elf_Phdr*)((unsigned char*) linker_base + elf_hdr->e_phoff);
phdr_table_get_dynamic_section(phdr, elf_hdr->e_phnum, linker_base,
&linker_soinfo.dynamic, NULL, NULL);
insert_soinfo_into_debug_map(&linker_soinfo);
}
// Extract information passed from the kernel.
- si->phdr = reinterpret_cast<Elf32_Phdr*>(args.getauxval(AT_PHDR));
+ si->phdr = reinterpret_cast<Elf_Phdr*>(args.getauxval(AT_PHDR));
si->phnum = args.getauxval(AT_PHNUM);
si->entry = args.getauxval(AT_ENTRY);
@@ -1709,8 +1708,8 @@
si->load_bias = 0;
for (size_t i = 0; i < si->phnum; ++i) {
if (si->phdr[i].p_type == PT_PHDR) {
- si->load_bias = reinterpret_cast<Elf32_Addr>(si->phdr) - si->phdr[i].p_vaddr;
- si->base = reinterpret_cast<Elf32_Addr>(si->phdr) - si->phdr[i].p_offset;
+ si->load_bias = reinterpret_cast<Elf_Addr>(si->phdr) - si->phdr[i].p_vaddr;
+ si->base = reinterpret_cast<Elf_Addr>(si->phdr) - si->phdr[i].p_offset;
break;
}
}
@@ -1796,14 +1795,14 @@
* load bias, i.e. add the value of any p_vaddr in the file to get
* the corresponding address in memory.
*/
-static Elf32_Addr get_elf_exec_load_bias(const Elf32_Ehdr* elf) {
- Elf32_Addr offset = elf->e_phoff;
- const Elf32_Phdr* phdr_table = (const Elf32_Phdr*)((char*)elf + offset);
- const Elf32_Phdr* phdr_end = phdr_table + elf->e_phnum;
+static Elf_Addr get_elf_exec_load_bias(const Elf_Ehdr* elf) {
+ Elf_Addr offset = elf->e_phoff;
+ const Elf_Phdr* phdr_table = (const Elf_Phdr*)((char*)elf + offset);
+ const Elf_Phdr* phdr_end = phdr_table + elf->e_phnum;
- for (const Elf32_Phdr* phdr = phdr_table; phdr < phdr_end; phdr++) {
+ for (const Elf_Phdr* phdr = phdr_table; phdr < phdr_end; phdr++) {
if (phdr->p_type == PT_LOAD) {
- return reinterpret_cast<Elf32_Addr>(elf) + phdr->p_offset - phdr->p_vaddr;
+ return reinterpret_cast<Elf_Addr>(elf) + phdr->p_offset - phdr->p_vaddr;
}
}
return 0;
@@ -1818,13 +1817,13 @@
* relocations, any attempt to reference an extern variable, extern
* function, or other GOT reference will generate a segfault.
*/
-extern "C" Elf32_Addr __linker_init(void* raw_args) {
+extern "C" Elf_Addr __linker_init(void* raw_args) {
KernelArgumentBlock args(raw_args);
- Elf32_Addr linker_addr = args.getauxval(AT_BASE);
+ Elf_Addr linker_addr = args.getauxval(AT_BASE);
- Elf32_Ehdr* elf_hdr = (Elf32_Ehdr*) linker_addr;
- Elf32_Phdr* phdr = (Elf32_Phdr*)((unsigned char*) linker_addr + elf_hdr->e_phoff);
+ Elf_Ehdr* elf_hdr = reinterpret_cast<Elf_Ehdr*>(linker_addr);
+ Elf_Phdr* phdr = (Elf_Phdr*)((unsigned char*) linker_addr + elf_hdr->e_phoff);
soinfo linker_so;
memset(&linker_so, 0, sizeof(soinfo));
@@ -1850,7 +1849,7 @@
// We have successfully fixed our own relocations. It's safe to run
// the main part of the linker now.
args.abort_message_ptr = &gAbortMessage;
- Elf32_Addr start_address = __linker_init_post_relocation(args, linker_addr);
+ Elf_Addr start_address = __linker_init_post_relocation(args, linker_addr);
set_soinfo_pool_protection(PROT_READ);
diff --git a/linker/linker.h b/linker/linker.h
index 200a682..ac7b9fe 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -100,24 +100,28 @@
struct soinfo {
public:
char name[SOINFO_NAME_LEN];
- const Elf32_Phdr* phdr;
+ const Elf_Phdr* phdr;
size_t phnum;
- Elf32_Addr entry;
- Elf32_Addr base;
+ Elf_Addr entry;
+ Elf_Addr base;
unsigned size;
+#ifndef __LP64__
uint32_t unused1; // DO NOT USE, maintained for compatibility.
+#endif
- Elf32_Dyn* dynamic;
+ Elf_Dyn* dynamic;
+#ifndef __LP64__
uint32_t unused2; // DO NOT USE, maintained for compatibility
uint32_t unused3; // DO NOT USE, maintained for compatibility
+#endif
soinfo* next;
unsigned flags;
const char* strtab;
- Elf32_Sym* symtab;
+ Elf_Sym* symtab;
size_t nbucket;
size_t nchain;
@@ -126,10 +130,10 @@
unsigned* plt_got;
- Elf32_Rel* plt_rel;
+ Elf_Rel* plt_rel;
size_t plt_rel_count;
- Elf32_Rel* rel;
+ Elf_Rel* rel;
size_t rel_count;
linker_function_t* preinit_array;
@@ -160,7 +164,7 @@
// When you read a virtual address from the ELF file, add this
// value to get the corresponding address in the process' address space.
- Elf32_Addr load_bias;
+ Elf_Addr load_bias;
bool has_text_relocations;
bool has_DT_SYMBOLIC;
@@ -188,11 +192,11 @@
soinfo* do_dlopen(const char* name, int flags);
int do_dlclose(soinfo* si);
-Elf32_Sym* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start);
+Elf_Sym* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start);
soinfo* find_containing_library(const void* addr);
-Elf32_Sym* dladdr_find_symbol(soinfo* si, const void* addr);
-Elf32_Sym* dlsym_handle_lookup(soinfo* si, const char* name);
+Elf_Sym* dladdr_find_symbol(soinfo* si, const void* addr);
+Elf_Sym* dlsym_handle_lookup(soinfo* si, const char* name);
void debuggerd_init();
extern "C" abort_msg_t* gAbortMessage;
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 0940305..bf2cc19 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -49,7 +49,7 @@
p_vaddr -> segment's virtual address
p_flags -> segment flags (e.g. readable, writable, executable)
- We will ignore the p_paddr and p_align fields of Elf32_Phdr for now.
+ We will ignore the p_paddr and p_align fields of Elf_Phdr for now.
The loadable segments can be seen as a list of [p_vaddr ... p_vaddr+p_memsz)
ranges of virtual addresses. A few rules apply:
@@ -147,8 +147,8 @@
return false;
}
if (rc != sizeof(header_)) {
- DL_ERR("\"%s\" is too small to be an ELF executable. Expected at least %d bytes, only found %d bytes.",
- name_, sizeof(header_), rc);
+ DL_ERR("\"%s\" is too small to be an ELF executable: only found %zd bytes", name_,
+ static_cast<size_t>(rc));
return false;
}
return true;
@@ -205,14 +205,14 @@
// Like the kernel, we only accept program header tables that
// are smaller than 64KiB.
- if (phdr_num_ < 1 || phdr_num_ > 65536/sizeof(Elf32_Phdr)) {
- DL_ERR("\"%s\" has invalid e_phnum: %d", name_, phdr_num_);
+ if (phdr_num_ < 1 || phdr_num_ > 65536/sizeof(Elf_Phdr)) {
+ DL_ERR("\"%s\" has invalid e_phnum: %zd", name_, phdr_num_);
return false;
}
- Elf32_Addr page_min = PAGE_START(header_.e_phoff);
- Elf32_Addr page_max = PAGE_END(header_.e_phoff + (phdr_num_ * sizeof(Elf32_Phdr)));
- Elf32_Addr page_offset = PAGE_OFFSET(header_.e_phoff);
+ Elf_Addr page_min = PAGE_START(header_.e_phoff);
+ Elf_Addr page_max = PAGE_END(header_.e_phoff + (phdr_num_ * sizeof(Elf_Phdr)));
+ Elf_Addr page_offset = PAGE_OFFSET(header_.e_phoff);
phdr_size_ = page_max - page_min;
@@ -223,7 +223,7 @@
}
phdr_mmap_ = mmap_result;
- phdr_table_ = reinterpret_cast<Elf32_Phdr*>(reinterpret_cast<char*>(mmap_result) + page_offset);
+ phdr_table_ = reinterpret_cast<Elf_Phdr*>(reinterpret_cast<char*>(mmap_result) + page_offset);
return true;
}
@@ -237,17 +237,15 @@
* set to the minimum and maximum addresses of pages to be reserved,
* or 0 if there is nothing to load.
*/
-size_t phdr_table_get_load_size(const Elf32_Phdr* phdr_table,
- size_t phdr_count,
- Elf32_Addr* out_min_vaddr,
- Elf32_Addr* out_max_vaddr)
-{
- Elf32_Addr min_vaddr = 0xFFFFFFFFU;
- Elf32_Addr max_vaddr = 0x00000000U;
+size_t phdr_table_get_load_size(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr* out_min_vaddr,
+ Elf_Addr* out_max_vaddr) {
+ Elf_Addr min_vaddr = 0xFFFFFFFFU;
+ Elf_Addr max_vaddr = 0x00000000U;
bool found_pt_load = false;
for (size_t i = 0; i < phdr_count; ++i) {
- const Elf32_Phdr* phdr = &phdr_table[i];
+ const Elf_Phdr* phdr = &phdr_table[i];
if (phdr->p_type != PT_LOAD) {
continue;
@@ -282,7 +280,7 @@
// segments of a program header table. This is done by creating a
// private anonymous mmap() with PROT_NONE.
bool ElfReader::ReserveAddressSpace() {
- Elf32_Addr min_vaddr;
+ Elf_Addr min_vaddr;
load_size_ = phdr_table_get_load_size(phdr_table_, phdr_num_, &min_vaddr);
if (load_size_ == 0) {
DL_ERR("\"%s\" has no loadable segments", name_);
@@ -308,27 +306,27 @@
// TODO: assert assumption.
bool ElfReader::LoadSegments() {
for (size_t i = 0; i < phdr_num_; ++i) {
- const Elf32_Phdr* phdr = &phdr_table_[i];
+ const Elf_Phdr* phdr = &phdr_table_[i];
if (phdr->p_type != PT_LOAD) {
continue;
}
// Segment addresses in memory.
- Elf32_Addr seg_start = phdr->p_vaddr + load_bias_;
- Elf32_Addr seg_end = seg_start + phdr->p_memsz;
+ Elf_Addr seg_start = phdr->p_vaddr + load_bias_;
+ Elf_Addr seg_end = seg_start + phdr->p_memsz;
- Elf32_Addr seg_page_start = PAGE_START(seg_start);
- Elf32_Addr seg_page_end = PAGE_END(seg_end);
+ Elf_Addr seg_page_start = PAGE_START(seg_start);
+ Elf_Addr seg_page_end = PAGE_END(seg_end);
- Elf32_Addr seg_file_end = seg_start + phdr->p_filesz;
+ Elf_Addr seg_file_end = seg_start + phdr->p_filesz;
// File offsets.
- Elf32_Addr file_start = phdr->p_offset;
- Elf32_Addr file_end = file_start + phdr->p_filesz;
+ Elf_Addr file_start = phdr->p_offset;
+ Elf_Addr file_end = file_start + phdr->p_filesz;
- Elf32_Addr file_page_start = PAGE_START(file_start);
- Elf32_Addr file_length = file_end - file_page_start;
+ Elf_Addr file_page_start = PAGE_START(file_start);
+ Elf_Addr file_length = file_end - file_page_start;
if (file_length != 0) {
void* seg_addr = mmap((void*)seg_page_start,
@@ -338,7 +336,7 @@
fd_,
file_page_start);
if (seg_addr == MAP_FAILED) {
- DL_ERR("couldn't map \"%s\" segment %d: %s", name_, i, strerror(errno));
+ DL_ERR("couldn't map \"%s\" segment %zd: %s", name_, i, strerror(errno));
return false;
}
}
@@ -375,21 +373,17 @@
* with optional extra flags (i.e. really PROT_WRITE). Used by
* phdr_table_protect_segments and phdr_table_unprotect_segments.
*/
-static int
-_phdr_table_set_load_prot(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias,
- int extra_prot_flags)
-{
- const Elf32_Phdr* phdr = phdr_table;
- const Elf32_Phdr* phdr_limit = phdr + phdr_count;
+static int _phdr_table_set_load_prot(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr load_bias, int extra_prot_flags) {
+ const Elf_Phdr* phdr = phdr_table;
+ const Elf_Phdr* phdr_limit = phdr + phdr_count;
for (; phdr < phdr_limit; phdr++) {
if (phdr->p_type != PT_LOAD || (phdr->p_flags & PF_W) != 0)
continue;
- Elf32_Addr seg_page_start = PAGE_START(phdr->p_vaddr) + load_bias;
- Elf32_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz) + load_bias;
+ Elf_Addr seg_page_start = PAGE_START(phdr->p_vaddr) + load_bias;
+ Elf_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz) + load_bias;
int ret = mprotect((void*)seg_page_start,
seg_page_end - seg_page_start,
@@ -412,13 +406,8 @@
* Return:
* 0 on error, -1 on failure (error code in errno).
*/
-int
-phdr_table_protect_segments(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias)
-{
- return _phdr_table_set_load_prot(phdr_table, phdr_count,
- load_bias, 0);
+int phdr_table_protect_segments(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias) {
+ return _phdr_table_set_load_prot(phdr_table, phdr_count, load_bias, 0);
}
/* Change the protection of all loaded segments in memory to writable.
@@ -437,26 +426,17 @@
* Return:
* 0 on error, -1 on failure (error code in errno).
*/
-int
-phdr_table_unprotect_segments(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias)
-{
- return _phdr_table_set_load_prot(phdr_table, phdr_count,
- load_bias, PROT_WRITE);
+int phdr_table_unprotect_segments(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias) {
+ return _phdr_table_set_load_prot(phdr_table, phdr_count, load_bias, PROT_WRITE);
}
/* Used internally by phdr_table_protect_gnu_relro and
* phdr_table_unprotect_gnu_relro.
*/
-static int
-_phdr_table_set_gnu_relro_prot(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias,
- int prot_flags)
-{
- const Elf32_Phdr* phdr = phdr_table;
- const Elf32_Phdr* phdr_limit = phdr + phdr_count;
+static int _phdr_table_set_gnu_relro_prot(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr load_bias, int prot_flags) {
+ const Elf_Phdr* phdr = phdr_table;
+ const Elf_Phdr* phdr_limit = phdr + phdr_count;
for (phdr = phdr_table; phdr < phdr_limit; phdr++) {
if (phdr->p_type != PT_GNU_RELRO)
@@ -479,8 +459,8 @@
* linker must only emit a PT_GNU_RELRO segment if it ensures
* that it starts on a page boundary.
*/
- Elf32_Addr seg_page_start = PAGE_START(phdr->p_vaddr) + load_bias;
- Elf32_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz) + load_bias;
+ Elf_Addr seg_page_start = PAGE_START(phdr->p_vaddr) + load_bias;
+ Elf_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz) + load_bias;
int ret = mprotect((void*)seg_page_start,
seg_page_end - seg_page_start,
@@ -508,15 +488,8 @@
* Return:
* 0 on error, -1 on failure (error code in errno).
*/
-int
-phdr_table_protect_gnu_relro(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias)
-{
- return _phdr_table_set_gnu_relro_prot(phdr_table,
- phdr_count,
- load_bias,
- PROT_READ);
+int phdr_table_protect_gnu_relro(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias) {
+ return _phdr_table_set_gnu_relro_prot(phdr_table, phdr_count, load_bias, PROT_READ);
}
#ifdef ANDROID_ARM_LINKER
@@ -538,21 +511,17 @@
* Return:
* 0 on error, -1 on failure (_no_ error code in errno)
*/
-int
-phdr_table_get_arm_exidx(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias,
- Elf32_Addr** arm_exidx,
- unsigned* arm_exidx_count)
-{
- const Elf32_Phdr* phdr = phdr_table;
- const Elf32_Phdr* phdr_limit = phdr + phdr_count;
+int phdr_table_get_arm_exidx(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr load_bias,
+ Elf_Addr** arm_exidx, unsigned* arm_exidx_count) {
+ const Elf_Phdr* phdr = phdr_table;
+ const Elf_Phdr* phdr_limit = phdr + phdr_count;
for (phdr = phdr_table; phdr < phdr_limit; phdr++) {
if (phdr->p_type != PT_ARM_EXIDX)
continue;
- *arm_exidx = (Elf32_Addr*)(load_bias + phdr->p_vaddr);
+ *arm_exidx = (Elf_Addr*)(load_bias + phdr->p_vaddr);
*arm_exidx_count = (unsigned)(phdr->p_memsz / 8);
return 0;
}
@@ -576,23 +545,18 @@
* Return:
* void
*/
-void
-phdr_table_get_dynamic_section(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias,
- Elf32_Dyn** dynamic,
- size_t* dynamic_count,
- Elf32_Word* dynamic_flags)
-{
- const Elf32_Phdr* phdr = phdr_table;
- const Elf32_Phdr* phdr_limit = phdr + phdr_count;
+void phdr_table_get_dynamic_section(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr load_bias,
+ Elf_Dyn** dynamic, size_t* dynamic_count, Elf_Word* dynamic_flags) {
+ const Elf_Phdr* phdr = phdr_table;
+ const Elf_Phdr* phdr_limit = phdr + phdr_count;
for (phdr = phdr_table; phdr < phdr_limit; phdr++) {
if (phdr->p_type != PT_DYNAMIC) {
continue;
}
- *dynamic = reinterpret_cast<Elf32_Dyn*>(load_bias + phdr->p_vaddr);
+ *dynamic = reinterpret_cast<Elf_Dyn*>(load_bias + phdr->p_vaddr);
if (dynamic_count) {
*dynamic_count = (unsigned)(phdr->p_memsz / 8);
}
@@ -611,10 +575,10 @@
// segments in memory. This is in contrast with 'phdr_table_' which
// is temporary and will be released before the library is relocated.
bool ElfReader::FindPhdr() {
- const Elf32_Phdr* phdr_limit = phdr_table_ + phdr_num_;
+ const Elf_Phdr* phdr_limit = phdr_table_ + phdr_num_;
// If there is a PT_PHDR, use it directly.
- for (const Elf32_Phdr* phdr = phdr_table_; phdr < phdr_limit; ++phdr) {
+ for (const Elf_Phdr* phdr = phdr_table_; phdr < phdr_limit; ++phdr) {
if (phdr->p_type == PT_PHDR) {
return CheckPhdr(load_bias_ + phdr->p_vaddr);
}
@@ -623,13 +587,13 @@
// Otherwise, check the first loadable segment. If its file offset
// is 0, it starts with the ELF header, and we can trivially find the
// loaded program header from it.
- for (const Elf32_Phdr* phdr = phdr_table_; phdr < phdr_limit; ++phdr) {
+ for (const Elf_Phdr* phdr = phdr_table_; phdr < phdr_limit; ++phdr) {
if (phdr->p_type == PT_LOAD) {
if (phdr->p_offset == 0) {
- Elf32_Addr elf_addr = load_bias_ + phdr->p_vaddr;
- const Elf32_Ehdr* ehdr = (const Elf32_Ehdr*)(void*)elf_addr;
- Elf32_Addr offset = ehdr->e_phoff;
- return CheckPhdr((Elf32_Addr)ehdr + offset);
+ Elf_Addr elf_addr = load_bias_ + phdr->p_vaddr;
+ const Elf_Ehdr* ehdr = (const Elf_Ehdr*)(void*)elf_addr;
+ Elf_Addr offset = ehdr->e_phoff;
+ return CheckPhdr((Elf_Addr)ehdr + offset);
}
break;
}
@@ -642,17 +606,17 @@
// Ensures that our program header is actually within a loadable
// segment. This should help catch badly-formed ELF files that
// would cause the linker to crash later when trying to access it.
-bool ElfReader::CheckPhdr(Elf32_Addr loaded) {
- const Elf32_Phdr* phdr_limit = phdr_table_ + phdr_num_;
- Elf32_Addr loaded_end = loaded + (phdr_num_ * sizeof(Elf32_Phdr));
- for (Elf32_Phdr* phdr = phdr_table_; phdr < phdr_limit; ++phdr) {
+bool ElfReader::CheckPhdr(Elf_Addr loaded) {
+ const Elf_Phdr* phdr_limit = phdr_table_ + phdr_num_;
+ Elf_Addr loaded_end = loaded + (phdr_num_ * sizeof(Elf_Phdr));
+ for (Elf_Phdr* phdr = phdr_table_; phdr < phdr_limit; ++phdr) {
if (phdr->p_type != PT_LOAD) {
continue;
}
- Elf32_Addr seg_start = phdr->p_vaddr + load_bias_;
- Elf32_Addr seg_end = phdr->p_filesz + seg_start;
+ Elf_Addr seg_start = phdr->p_vaddr + load_bias_;
+ Elf_Addr seg_end = phdr->p_filesz + seg_start;
if (seg_start <= loaded && loaded_end <= seg_end) {
- loaded_phdr_ = reinterpret_cast<const Elf32_Phdr*>(loaded);
+ loaded_phdr_ = reinterpret_cast<const Elf_Phdr*>(loaded);
return true;
}
}
diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h
index 992d95e..28d8b39 100644
--- a/linker/linker_phdr.h
+++ b/linker/linker_phdr.h
@@ -45,10 +45,10 @@
bool Load();
size_t phdr_count() { return phdr_num_; }
- Elf32_Addr load_start() { return reinterpret_cast<Elf32_Addr>(load_start_); }
- Elf32_Addr load_size() { return load_size_; }
- Elf32_Addr load_bias() { return load_bias_; }
- const Elf32_Phdr* loaded_phdr() { return loaded_phdr_; }
+ Elf_Addr load_start() { return reinterpret_cast<Elf_Addr>(load_start_); }
+ Elf_Addr load_size() { return load_size_; }
+ Elf_Addr load_bias() { return load_bias_; }
+ const Elf_Phdr* loaded_phdr() { return loaded_phdr_; }
private:
bool ReadElfHeader();
@@ -57,66 +57,46 @@
bool ReserveAddressSpace();
bool LoadSegments();
bool FindPhdr();
- bool CheckPhdr(Elf32_Addr);
+ bool CheckPhdr(Elf_Addr);
const char* name_;
int fd_;
- Elf32_Ehdr header_;
+ Elf_Ehdr header_;
size_t phdr_num_;
void* phdr_mmap_;
- Elf32_Phdr* phdr_table_;
- Elf32_Addr phdr_size_;
+ Elf_Phdr* phdr_table_;
+ Elf_Addr phdr_size_;
// First page of reserved address space.
void* load_start_;
// Size in bytes of reserved address space.
- Elf32_Addr load_size_;
+ Elf_Addr load_size_;
// Load bias.
- Elf32_Addr load_bias_;
+ Elf_Addr load_bias_;
// Loaded phdr.
- const Elf32_Phdr* loaded_phdr_;
+ const Elf_Phdr* loaded_phdr_;
};
-size_t
-phdr_table_get_load_size(const Elf32_Phdr* phdr_table,
- size_t phdr_count,
- Elf32_Addr* min_vaddr = NULL,
- Elf32_Addr* max_vaddr = NULL);
+size_t phdr_table_get_load_size(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr* min_vaddr = NULL, Elf_Addr* max_vaddr = NULL);
-int
-phdr_table_protect_segments(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias);
+int phdr_table_protect_segments(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias);
-int
-phdr_table_unprotect_segments(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias);
+int phdr_table_unprotect_segments(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias);
-int
-phdr_table_protect_gnu_relro(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias);
+int phdr_table_protect_gnu_relro(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias);
#ifdef ANDROID_ARM_LINKER
-int
-phdr_table_get_arm_exidx(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias,
- Elf32_Addr** arm_exidx,
- unsigned* arm_exidix_count);
+int phdr_table_get_arm_exidx(const Elf_Phdr* phdr_table, size_t phdr_count, Elf_Addr load_bias,
+ Elf_Addr** arm_exidx, unsigned* arm_exidix_count);
#endif
-void
-phdr_table_get_dynamic_section(const Elf32_Phdr* phdr_table,
- int phdr_count,
- Elf32_Addr load_bias,
- Elf32_Dyn** dynamic,
- size_t* dynamic_count,
- Elf32_Word* dynamic_flags);
+void phdr_table_get_dynamic_section(const Elf_Phdr* phdr_table, size_t phdr_count,
+ Elf_Addr load_bias,
+ Elf_Dyn** dynamic, size_t* dynamic_count, Elf_Word* dynamic_flags);
#endif /* LINKER_PHDR_H */