summaryrefslogtreecommitdiff
path: root/libc/ports/sysdeps/unix/sysv
diff options
context:
space:
mode:
Diffstat (limited to 'libc/ports/sysdeps/unix/sysv')
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/aarch64/sigaction.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/fdatasync.c1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h25
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/semctl.c6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/am33/brk.c2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/am33/clone.S7
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/Makefile2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/clone.S4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/getcontext.S2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h28
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h314
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/pread.c5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/pread64.c5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/pwrite.c5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/pwrite64.c5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/readelflib.c6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/setcontext.S4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/sigaction.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h183
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/truncate64.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c12
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/sigaction.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/sigpending.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/sigprocmask.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/umount.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h20
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/not-cancel.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/syscalls.list1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/brk.c13
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/clone.S20
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/getcontext.S12
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/makecontext.S7
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile13
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions6
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h89
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c30
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c32
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c32
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c32
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c32
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c33
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c33
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c33
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist21
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h204
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c7
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h266
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h266
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/semctl.c5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/syscall.S8
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h30
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/pread.c10
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/pread64.c10
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/pwrite.c10
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/pwrite64.c10
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/setcontext.S9
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/sigaction.c4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/swapcontext.S7
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/ustat.c3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/vfork.S13
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/nptl/lowlevellock.h28
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist3
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist3
96 files changed, 1409 insertions, 701 deletions
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/libc/ports/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
index 1da284dec..4d1ec3b10 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
@@ -22,7 +22,6 @@
#undef __gettimeofday
#include <bits/libc-vdso.h>
-#include <bp-checks.h>
/* Get the current time of day and timezone information,
putting it into *tv and *tz. If tz is null, *tz is not filled.
@@ -32,7 +31,7 @@ __gettimeofday (tv, tz)
struct timeval *tv;
struct timezone *tz;
{
- return INLINE_VSYSCALL (gettimeofday, 2, CHECK_1 (tv), CHECK_1 (tz));
+ return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
}
libc_hidden_def (__gettimeofday)
weak_alias (__gettimeofday, gettimeofday)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
index f83e8806a..b04a761fe 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
@@ -2077,3 +2077,6 @@ GLIBC_2.17
xencrypt F
xprt_register F
xprt_unregister F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigaction.c b/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigaction.c
index 74b667564..dbaa2246b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigaction.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/aarch64/sigaction.c
@@ -51,8 +51,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
}
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
+ act ? &kact : NULL,
+ oact ? &koact : NULL, _NSIG / 8);
if (result >= 0 || errno != ENOSYS)
{
if (oact && result >= 0)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/fdatasync.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/fdatasync.c
index 190674172..fdcad0bfb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/fdatasync.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/fdatasync.c
@@ -23,7 +23,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <kernel-features.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c
index d6439505e..48f3cec9d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c
@@ -22,14 +22,13 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
int
__gethostname (char *name, size_t len)
{
int result;
- result = INLINE_SYSCALL (gethostname, 2, CHECK_N (name, len), len);
+ result = INLINE_SYSCALL (gethostname, 2, name, len);
if (result == 0
/* See whether the string is terminated. If not we will return
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c
index b4633f413..dbd03c1b2 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c
@@ -21,13 +21,12 @@
#include <ipc_priv.h>
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
int
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
{
- return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, CHECK_1 (buf));
+ return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
}
#include <shlib-compat.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
index 1d0cc7ec3..980e08857 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
@@ -1819,6 +1819,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
index e50324cdd..cf6b8bfd9 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
@@ -38,6 +38,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -143,8 +145,31 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ })
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
static inline int __attribute__((always_inline))
__lll_trylock(int *futex)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/semctl.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/semctl.c
index c18c695e3..31278a06c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/semctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/semctl.c
@@ -33,10 +33,6 @@ union semun
struct seminfo *__buf; /* buffer for IPC_INFO */
};
-#include <bp-checks.h>
-#include <bp-semctl.h>
-
-
int
__new_semctl (int semid, int semnum, int cmd, ...)
{
@@ -51,7 +47,7 @@ __new_semctl (int semid, int semnum, int cmd, ...)
va_end (ap);
return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
- CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)->array);
+ arg.array);
}
#include <shlib-compat.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c
index 5e5220044..f2217a2b5 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c
@@ -22,13 +22,12 @@
#include <sysdep.h>
#include <sys/syscall.h>
#include <bits/wordsize.h>
-#include <bp-checks.h>
int
__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
- return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, CHECK_1 (buf));
+ return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
}
#include <shlib-compat.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c b/libc/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c
index 77c0115c4..ad3860dfc 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c
@@ -32,7 +32,7 @@
: INLINE_SYSCALL1(name, nr, args))
struct kernel_sigaction;
-extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t);
+extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
+ struct kernel_sigaction *, size_t);
#include <sysdeps/unix/sysv/linux/sigaction.c>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/am33/brk.c b/libc/ports/sysdeps/unix/sysv/linux/am33/brk.c
index 51b59adc9..8fd2ff01d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/am33/brk.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/am33/brk.c
@@ -30,7 +30,7 @@ __brk (void *addr)
{
void *newbrk;
- newbrk = INLINE_SYSCALL (brk, 1, __ptrvalue (addr));
+ newbrk = INLINE_SYSCALL (brk, 1, addr);
__curbrk = newbrk;
diff --git a/libc/ports/sysdeps/unix/sysv/linux/am33/clone.S b/libc/ports/sysdeps/unix/sysv/linux/am33/clone.S
index 151950c5d..cece99bf3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/am33/clone.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/am33/clone.S
@@ -24,12 +24,11 @@
#define _ERRNO_H 1
#include <bits/errno.h>
#include <asm-syntax.h>
-#include <bp-sym.h>
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
.text
-ENTRY (BP_SYM (__clone))
+ENTRY (__clone)
/* Sanity check arguments. */
cmp 0,d0 /* no NULL function pointers */
beq L(error_inval)
@@ -75,6 +74,6 @@ L(here):
#endif
call JUMPTARGET (_exit),[],0
-PSEUDO_END (BP_SYM (__clone))
+PSEUDO_END (__clone)
-weak_alias (BP_SYM (__clone), BP_SYM (clone))
+weak_alias (__clone, clone)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile b/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile
index be7946e96..56ef15967 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/Makefile
@@ -10,7 +10,7 @@ shared-only-routines += libc-aeabi_read_tp
endif
ifeq ($(subdir),elf)
-sysdep-rtld-routines += aeabi_read_tp
+sysdep-rtld-routines += aeabi_read_tp libc-do-syscall
endif
ifeq ($(subdir),misc)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S b/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
index bdcfa206e..29edec69d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
@@ -15,6 +15,8 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+/* ??? Needs more rearrangement for the LDM to handle thumb mode. */
+#define NO_THUMB
#include <sysdep.h>
.section .rodata.str1.1,"aMS",%progbits,1
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S b/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S
index de25db160..732a3ffd0 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/clone.S
@@ -33,6 +33,7 @@
ENTRY(__clone)
@ sanity check args
cmp r0, #0
+ ite ne
cmpne r1, #0
moveq r0, #-EINVAL
beq PLTJMP(syscall_error)
@@ -78,8 +79,9 @@ PSEUDO_END (__clone)
sub pc, r0, #31
mov r1, r0
tst ip, #CLONE_VM
- movne r0, #-1
ldr r7, =SYS_ify(getpid)
+ ite ne
+ movne r0, #-1
swieq 0x0
str r0, [r1, #PID_OFFSET]
str r0, [r1, #TID_OFFSET]
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h b/libc/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h
index acc4f2864..504fecab5 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/dl-cache.h
@@ -18,12 +18,17 @@
#include <ldconfig.h>
+/* In order to support the transition from unmarked objects
+ to marked objects we must treat unmarked objects as
+ compatible with either FLAG_ARM_LIBHF or FLAG_ARM_LIBSF. */
#ifdef __ARM_PCS_VFP
# define _dl_cache_check_flags(flags) \
- ((flags) == (FLAG_ARM_LIBHF | FLAG_ELF_LIBC6))
+ ((flags) == (FLAG_ARM_LIBHF | FLAG_ELF_LIBC6) \
+ || (flags) == FLAG_ELF_LIBC6)
#else
# define _dl_cache_check_flags(flags) \
- ((flags) == FLAG_ELF_LIBC6)
+ ((flags) == (FLAG_ARM_LIBSF | FLAG_ELF_LIBC6) \
+ || (flags) == FLAG_ELF_LIBC6)
#endif
#include_next <dl-cache.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/getcontext.S b/libc/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
index f7857c199..fa00c0b78 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/getcontext.S
@@ -103,7 +103,7 @@ ENTRY(__getcontext)
END(__getcontext)
#ifdef PIC
-1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8
+1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
.Lrtld_global_ro:
.long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
#else
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S
index fa8a2b86c..68560b065 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -51,6 +51,7 @@ ENTRY (__mmap)
cfi_restore (r5)
cmn r0, $4096
+ it cc
RETINSTR(cc, lr)
b PLTJMP(syscall_error)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
index 2eafd1b41..dcbab3aed 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
@@ -17,6 +17,8 @@
#include <sysdep.h>
+ .syntax unified
+
#define EINVAL 22
#ifdef __ARMEB__
@@ -42,7 +44,8 @@ ENTRY (__mmap64)
cfi_remember_state
movs r4, ip, lsl $20 @ check that offset is page-aligned
mov ip, ip, lsr $12
- moveqs r4, r5, lsr $12 @ check for overflow
+ it eq
+ movseq r4, r5, lsr $12 @ check for overflow
bne .Linval
ldr r4, [sp, $8] @ load fd
orr r5, ip, r5, lsl $20 @ compose page offset
@@ -52,6 +55,7 @@ ENTRY (__mmap64)
cfi_adjust_cfa_offset (-8)
cfi_restore (r4)
cfi_restore (r5)
+ it cc
RETINSTR(cc, lr)
b PLTJMP(syscall_error)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
index ceab6b2cd..ce45208b5 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
@@ -86,6 +86,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.4
GLIBC_2.4 A
_Exit F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
index 0278812f7..fe21cdaf2 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
@@ -36,6 +36,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -141,6 +143,32 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
#define lll_trylock(lock) \
atomic_compare_and_exchange_val_acq(&(lock), 1, 0)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
index 1b0a2447f..df85d5199 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
@@ -30,161 +30,157 @@
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
- PSEUDO_PROLOGUE; \
- .type __##syscall_name##_nocancel,%function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- .cfi_sections .debug_frame; \
- cfi_startproc; \
- DO_CALL (syscall_name, args); \
- cmn r0, $4096; \
- PSEUDO_RET; \
- cfi_endproc; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
+ .text; \
+ PSEUDO_PROLOGUE; \
+ ENTRY (__##syscall_name##_nocancel); \
+ CFI_SECTIONS; \
+ DO_CALL (syscall_name, args); \
+ cmn r0, $4096; \
+ PSEUDO_RET; \
+ END (__##syscall_name##_nocancel); \
ENTRY (name); \
- SINGLE_THREAD_P; \
- DOARGS_##args; \
- bne .Lpseudo_cancel; \
- cfi_remember_state; \
- ldr r7, =SYS_ify (syscall_name); \
- swi 0x0; \
- UNDOARGS_##args; \
- cmn r0, $4096; \
- PSEUDO_RET; \
- cfi_restore_state; \
+ SINGLE_THREAD_P; \
+ DOARGS_##args; \
+ bne .Lpseudo_cancel; \
+ cfi_remember_state; \
+ ldr r7, =SYS_ify (syscall_name); \
+ swi 0x0; \
+ UNDOARGS_##args; \
+ cmn r0, $4096; \
+ PSEUDO_RET; \
+ cfi_restore_state; \
.Lpseudo_cancel: \
- .fnstart; /* matched by the .fnend in UNDOARGS below. */ \
- DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \
- CENABLE; \
- mov ip, r0; /* put mask in safe place. */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- ldr r7, =SYS_ify (syscall_name); \
- swi 0x0; /* do the call. */ \
- mov r7, r0; /* save syscall return value. */ \
- mov r0, ip; /* get mask back. */ \
- CDISABLE; \
- mov r0, r7; /* retrieve return value. */ \
- RESTORE_LR_##args; \
- UNDOARGS_##args; \
- cmn r0, $4096
+ .fnstart; /* matched by the .fnend in UNDOARGS below. */ \
+ DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \
+ CENABLE; \
+ mov ip, r0; /* put mask in safe place. */ \
+ UNDOCARGS_##args; /* restore syscall args. */ \
+ ldr r7, =SYS_ify (syscall_name); \
+ swi 0x0; /* do the call. */ \
+ mov r7, r0; /* save syscall return value. */ \
+ mov r0, ip; /* get mask back. */ \
+ CDISABLE; \
+ mov r0, r7; /* retrieve return value. */ \
+ RESTORE_LR_##args; \
+ UNDOARGS_##args; \
+ cmn r0, $4096
/* DOARGS pushes eight bytes on the stack for five arguments, twelve bytes for
six arguments, and four bytes for fewer. In order to preserve doubleword
alignment, sometimes we must save an extra register. */
-# define RESTART_UNWIND \
- .fnend; \
- .fnstart; \
- .save {r7}; \
- .save {lr}
-
-# define DOCARGS_0 \
- .save {r7}; \
- str lr, [sp, #-4]!; \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (lr, 0); \
- .save {lr}
+# define RESTART_UNWIND \
+ .fnend; \
+ .fnstart; \
+ .save {r7}; \
+ .save {lr}
+
+# define DOCARGS_0 \
+ .save {r7}; \
+ str lr, [sp, #-4]!; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (lr, 0); \
+ .save {lr}
# define UNDOCARGS_0
-# define RESTORE_LR_0 \
- ldr lr, [sp], #4; \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (lr)
-
-# define DOCARGS_1 \
- .save {r7}; \
- stmfd sp!, {r0, r1, lr}; \
- cfi_adjust_cfa_offset (12); \
- cfi_rel_offset (lr, 8); \
- .save {lr}; \
- .pad #8
-# define UNDOCARGS_1 \
- ldr r0, [sp], #8; \
- cfi_adjust_cfa_offset (-8); \
- RESTART_UNWIND
-# define RESTORE_LR_1 \
- RESTORE_LR_0
-
-# define DOCARGS_2 \
- .save {r7}; \
- stmfd sp!, {r0, r1, lr}; \
- cfi_adjust_cfa_offset (12); \
- cfi_rel_offset (lr, 8); \
- .save {lr}; \
- .pad #8
-# define UNDOCARGS_2 \
- ldmfd sp!, {r0, r1}; \
- cfi_adjust_cfa_offset (-8); \
- RESTART_UNWIND
-# define RESTORE_LR_2 \
- RESTORE_LR_0
-
-# define DOCARGS_3 \
- .save {r7}; \
- stmfd sp!, {r0, r1, r2, r3, lr}; \
- cfi_adjust_cfa_offset (20); \
- cfi_rel_offset (lr, 16); \
- .save {lr}; \
- .pad #16
-# define UNDOCARGS_3 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- RESTART_UNWIND
-# define RESTORE_LR_3 \
- RESTORE_LR_0
-
-# define DOCARGS_4 \
- .save {r7}; \
- stmfd sp!, {r0, r1, r2, r3, lr}; \
- cfi_adjust_cfa_offset (20); \
- cfi_rel_offset (lr, 16); \
- .save {lr}; \
- .pad #16
-# define UNDOCARGS_4 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- RESTART_UNWIND
-# define RESTORE_LR_4 \
- RESTORE_LR_0
+# define RESTORE_LR_0 \
+ ldr lr, [sp], #4; \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (lr)
+
+# define DOCARGS_1 \
+ .save {r7}; \
+ stmfd sp!, {r0, r1, lr}; \
+ cfi_adjust_cfa_offset (12); \
+ cfi_rel_offset (lr, 8); \
+ .save {lr}; \
+ .pad #8
+# define UNDOCARGS_1 \
+ ldr r0, [sp], #8; \
+ cfi_adjust_cfa_offset (-8); \
+ RESTART_UNWIND
+# define RESTORE_LR_1 \
+ RESTORE_LR_0
+
+# define DOCARGS_2 \
+ .save {r7}; \
+ stmfd sp!, {r0, r1, lr}; \
+ cfi_adjust_cfa_offset (12); \
+ cfi_rel_offset (lr, 8); \
+ .save {lr}; \
+ .pad #8
+# define UNDOCARGS_2 \
+ ldmfd sp!, {r0, r1}; \
+ cfi_adjust_cfa_offset (-8); \
+ RESTART_UNWIND
+# define RESTORE_LR_2 \
+ RESTORE_LR_0
+
+# define DOCARGS_3 \
+ .save {r7}; \
+ stmfd sp!, {r0, r1, r2, r3, lr}; \
+ cfi_adjust_cfa_offset (20); \
+ cfi_rel_offset (lr, 16); \
+ .save {lr}; \
+ .pad #16
+# define UNDOCARGS_3 \
+ ldmfd sp!, {r0, r1, r2, r3}; \
+ cfi_adjust_cfa_offset (-16); \
+ RESTART_UNWIND
+# define RESTORE_LR_3 \
+ RESTORE_LR_0
+
+# define DOCARGS_4 \
+ .save {r7}; \
+ stmfd sp!, {r0, r1, r2, r3, lr}; \
+ cfi_adjust_cfa_offset (20); \
+ cfi_rel_offset (lr, 16); \
+ .save {lr}; \
+ .pad #16
+# define UNDOCARGS_4 \
+ ldmfd sp!, {r0, r1, r2, r3}; \
+ cfi_adjust_cfa_offset (-16); \
+ RESTART_UNWIND
+# define RESTORE_LR_4 \
+ RESTORE_LR_0
/* r4 is only stmfd'ed for correct stack alignment. */
-# define DOCARGS_5 \
- .save {r4, r7}; \
- stmfd sp!, {r0, r1, r2, r3, r4, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (lr, 20); \
- .save {lr}; \
- .pad #20
-# define UNDOCARGS_5 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- .fnend; \
- .fnstart; \
- .save {r4, r7}; \
- .save {lr}; \
- .pad #4
-# define RESTORE_LR_5 \
- ldmfd sp!, {r4, lr}; \
- cfi_adjust_cfa_offset (-8); \
- /* r4 will be marked as restored later. */ \
- cfi_restore (lr)
-
-# define DOCARGS_6 \
- .save {r4, r5, r7}; \
- stmfd sp!, {r0, r1, r2, r3, lr}; \
- cfi_adjust_cfa_offset (20); \
- cfi_rel_offset (lr, 16); \
- .save {lr}; \
- .pad #16
-# define UNDOCARGS_6 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- .fnend; \
- .fnstart; \
- .save {r4, r5, r7}; \
- .save {lr};
-# define RESTORE_LR_6 \
- RESTORE_LR_0
+# define DOCARGS_5 \
+ .save {r4, r7}; \
+ stmfd sp!, {r0, r1, r2, r3, r4, lr}; \
+ cfi_adjust_cfa_offset (24); \
+ cfi_rel_offset (lr, 20); \
+ .save {lr}; \
+ .pad #20
+# define UNDOCARGS_5 \
+ ldmfd sp!, {r0, r1, r2, r3}; \
+ cfi_adjust_cfa_offset (-16); \
+ .fnend; \
+ .fnstart; \
+ .save {r4, r7}; \
+ .save {lr}; \
+ .pad #4
+# define RESTORE_LR_5 \
+ ldmfd sp!, {r4, lr}; \
+ cfi_adjust_cfa_offset (-8); \
+ /* r4 will be marked as restored later. */ \
+ cfi_restore (lr)
+
+# define DOCARGS_6 \
+ .save {r4, r5, r7}; \
+ stmfd sp!, {r0, r1, r2, r3, lr}; \
+ cfi_adjust_cfa_offset (20); \
+ cfi_rel_offset (lr, 16); \
+ .save {lr}; \
+ .pad #16
+# define UNDOCARGS_6 \
+ ldmfd sp!, {r0, r1, r2, r3}; \
+ cfi_adjust_cfa_offset (-16); \
+ .fnend; \
+ .fnstart; \
+ .save {r4, r5, r7}; \
+ .save {lr};
+# define RESTORE_LR_6 \
+ RESTORE_LR_0
# ifdef IS_IN_libpthread
# define CENABLE bl PLTJMP(__pthread_enable_asynccancel)
@@ -207,12 +203,12 @@ extern int __local_multiple_threads attribute_hidden;
# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
# define SINGLE_THREAD_P \
- ldr ip, 1b; \
-2: \
- ldr ip, [pc, ip]; \
- teq ip, #0;
+ ldr ip, 1b; \
+ 2: \
+ ldr ip, [pc, ip]; \
+ teq ip, #0;
# define PSEUDO_PROLOGUE \
- 1: .word __local_multiple_threads - 2f - 8;
+ 1: .word __local_multiple_threads - 2f - PC_OFS;
# endif
# else
/* There is no __local_multiple_threads for librt, so use the TCB. */
@@ -223,15 +219,15 @@ extern int __local_multiple_threads attribute_hidden;
# else
# define PSEUDO_PROLOGUE
# define SINGLE_THREAD_P \
- stmfd sp!, {r0, lr}; \
- cfi_adjust_cfa_offset (8); \
- cfi_rel_offset (lr, 4); \
- bl __aeabi_read_tp; \
- ldr ip, [r0, #MULTIPLE_THREADS_OFFSET]; \
- ldmfd sp!, {r0, lr}; \
- cfi_adjust_cfa_offset (-8); \
- cfi_restore (lr); \
- teq ip, #0
+ stmfd sp!, {r0, lr}; \
+ cfi_adjust_cfa_offset (8); \
+ cfi_rel_offset (lr, 4); \
+ bl __aeabi_read_tp; \
+ ldr ip, [r0, #MULTIPLE_THREADS_OFFSET]; \
+ ldmfd sp!, {r0, lr}; \
+ cfi_adjust_cfa_offset (-8); \
+ cfi_restore (lr); \
+ teq ip, #0
# define SINGLE_THREAD_P_PIC(x) SINGLE_THREAD_P
# endif
# endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
index 58ca9acf6..caa6a2626 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-forcedunwind.c
@@ -84,6 +84,9 @@ __unwind_freeres (void)
ARM unwinder relies on register state at entrance. So we write this in
assembly. */
+#define STR1(S) #S
+#define STR(S) STR1(S)
+
asm (
" .globl _Unwind_Resume\n"
" .type _Unwind_Resume, %function\n"
@@ -118,11 +121,7 @@ asm (
" b 5b\n"
" " CFI_ENDPROC "\n"
" .align 2\n"
-#ifdef __thumb2__
-"1: .word _GLOBAL_OFFSET_TABLE_ - 3b - 4\n"
-#else
-"1: .word _GLOBAL_OFFSET_TABLE_ - 3b - 8\n"
-#endif
+"1: .word _GLOBAL_OFFSET_TABLE_ - 3b - " STR (PC_OFS) "\n"
"2: .word libgcc_s_resume(GOTOFF)\n"
" .size _Unwind_Resume, .-_Unwind_Resume\n"
);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
index 0a3ad953b..121159913 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/unwind-resume.c
@@ -47,6 +47,9 @@ init (void)
ARM unwinder relies on register state at entrance. So we write this in
assembly. */
+#define STR1(S) #S
+#define STR(S) STR1(S)
+
asm (
" .globl _Unwind_Resume\n"
" .type _Unwind_Resume, %function\n"
@@ -81,11 +84,7 @@ asm (
" b 5b\n"
" " CFI_ENDPROC "\n"
" .align 2\n"
-#ifdef __thumb2__
-"1: .word _GLOBAL_OFFSET_TABLE_ - 3b - 4\n"
-#else
-"1: .word _GLOBAL_OFFSET_TABLE_ - 3b - 8\n"
-#endif
+"1: .word _GLOBAL_OFFSET_TABLE_ - 3b - " STR (PC_OFS) "\n"
"2: .word libgcc_s_resume(GOTOFF)\n"
" .size _Unwind_Resume, .-_Unwind_Resume\n"
);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/pread.c b/libc/ports/sysdeps/unix/sysv/linux/arm/pread.c
index dafee3d55..e178402a8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/pread.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/pread.c
@@ -22,7 +22,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
ssize_t
__libc_pread (fd, buf, count, offset)
@@ -37,7 +36,7 @@ __libc_pread (fd, buf, count, offset)
{
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pread64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
return result;
@@ -47,7 +46,7 @@ __libc_pread (fd, buf, count, offset)
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pread64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
LIBC_CANCEL_RESET (oldtype);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/pread64.c b/libc/ports/sysdeps/unix/sysv/linux/arm/pread64.c
index 6d1d9148a..c7863a35c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/pread64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/pread64.c
@@ -22,7 +22,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
ssize_t
__libc_pread64 (fd, buf, count, offset)
@@ -37,7 +36,7 @@ __libc_pread64 (fd, buf, count, offset)
{
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pread64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
@@ -48,7 +47,7 @@ __libc_pread64 (fd, buf, count, offset)
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pread64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite.c b/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite.c
index f188950af..4ae2e8330 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite.c
@@ -22,7 +22,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
ssize_t
__libc_pwrite (fd, buf, count, offset)
@@ -37,7 +36,7 @@ __libc_pwrite (fd, buf, count, offset)
{
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pwrite64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
return result;
@@ -47,7 +46,7 @@ __libc_pwrite (fd, buf, count, offset)
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pwrite64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
LIBC_CANCEL_RESET (oldtype);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite64.c b/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite64.c
index 29c63ee33..bd6fca583 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/pwrite64.c
@@ -22,7 +22,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
ssize_t
__libc_pwrite64 (fd, buf, count, offset)
@@ -37,7 +36,7 @@ __libc_pwrite64 (fd, buf, count, offset)
{
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pwrite64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
@@ -48,7 +47,7 @@ __libc_pwrite64 (fd, buf, count, offset)
/* In the ARM EABI, 64-bit values are aligned to even/odd register
pairs for syscalls. */
- result = INLINE_SYSCALL (pwrite64, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/readelflib.c b/libc/ports/sysdeps/unix/sysv/linux/arm/readelflib.c
index 81e5ccb55..3efb6134c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/readelflib.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/readelflib.c
@@ -46,6 +46,12 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD)
*flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;
else if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_SOFT)
+ *flag = FLAG_ARM_LIBSF|FLAG_ELF_LIBC6;
+ else
+ /* We must assume the unmarked objects are compatible
+ with all ABI variants. Such objects may have been
+ generated in a transitional period when the ABI
+ tags were not added to all objects. */
*flag = FLAG_ELF_LIBC6;
}
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/setcontext.S b/libc/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
index 8e71f5b4e..b3148c894 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/setcontext.S
@@ -15,6 +15,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+/* ??? Needs more rearrangement for the LDM to handle thumb mode. */
+#define NO_THUMB
#include <sysdep.h>
#include <rtld-global-offsets.h>
@@ -93,7 +95,7 @@ ENTRY(__startcontext)
END(__startcontext)
#ifdef PIC
-1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8
+1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
.Lrtld_global_ro:
.long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
#else
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/sigaction.c b/libc/ports/sysdeps/unix/sysv/linux/arm/sigaction.c
index c039b857f..21bf506ef 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/sigaction.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/sigaction.c
@@ -83,8 +83,8 @@ __libc_sigaction (sig, act, oact)
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
+ act ? &kact : NULL,
+ oact ? &koact : NULL, _NSIG / 8);
if (oact && result >= 0)
{
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S b/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S
index c6dd57d69..665ecb4de 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/syscall.S
@@ -42,6 +42,7 @@ ENTRY (syscall)
cfi_restore (r6)
cfi_restore (r7)
cmn r0, #4096
+ it cc
RETINSTR(cc, lr)
b PLTJMP(syscall_error)
PSEUDO_END (syscall)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
index 6b5bb14c9..f40cb95e8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -57,49 +57,50 @@
test with -4095. */
#undef PSEUDO
-#define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name); \
- DO_CALL (syscall_name, args); \
- cmn r0, $4096;
-
-#define PSEUDO_RET \
- RETINSTR(cc, lr); \
- b PLTJMP(SYSCALL_ERROR)
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name); \
+ DO_CALL (syscall_name, args); \
+ cmn r0, $4096;
+
+#define PSEUDO_RET \
+ it cc; \
+ RETINSTR(cc, lr); \
+ b PLTJMP(SYSCALL_ERROR)
#undef ret
#define ret PSEUDO_RET
#undef PSEUDO_END
-#define PSEUDO_END(name) \
- SYSCALL_ERROR_HANDLER; \
+#define PSEUDO_END(name) \
+ SYSCALL_ERROR_HANDLER; \
END (name)
#undef PSEUDO_NOERRNO
-#define PSEUDO_NOERRNO(name, syscall_name, args) \
- .text; \
- ENTRY (name); \
- DO_CALL (syscall_name, args);
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name); \
+ DO_CALL (syscall_name, args);
-#define PSEUDO_RET_NOERRNO \
- DO_RET (lr);
+#define PSEUDO_RET_NOERRNO \
+ DO_RET (lr);
#undef ret_NOERRNO
#define ret_NOERRNO PSEUDO_RET_NOERRNO
#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name) \
+#define PSEUDO_END_NOERRNO(name) \
END (name)
/* The function has to return the error code. */
#undef PSEUDO_ERRVAL
-#define PSEUDO_ERRVAL(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- DO_CALL (syscall_name, args); \
- rsb r0, r0, #0
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ rsb r0, r0, #0
#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name) \
+#define PSEUDO_END_ERRVAL(name) \
END (name)
#define ret_ERRVAL PSEUDO_RET_NOERRNO
@@ -114,7 +115,7 @@ __local_syscall_error: \
0: str r0, [pc, r1]; \
mvn r0, #0; \
DO_RET(lr); \
-1: .word C_SYMBOL_NAME(rtld_errno) - 0b - 8;
+1: .word C_SYMBOL_NAME(rtld_errno) - 0b - PC_OFS;
# else
# if defined(__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
# define POP_PC \
@@ -192,19 +193,19 @@ __local_syscall_error: \
syscalls. */
#undef DO_CALL
-#define DO_CALL(syscall_name, args) \
- DOARGS_##args; \
- ldr r7, =SYS_ify (syscall_name); \
- swi 0x0; \
- UNDOARGS_##args
+#define DO_CALL(syscall_name, args) \
+ DOARGS_##args; \
+ ldr r7, =SYS_ify (syscall_name); \
+ swi 0x0; \
+ UNDOARGS_##args
#undef DOARGS_0
-#define DOARGS_0 \
- .fnstart; \
- str r7, [sp, #-4]!; \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (r7, 0); \
- .save { r7 }
+#define DOARGS_0 \
+ .fnstart; \
+ str r7, [sp, #-4]!; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (r7, 0); \
+ .save { r7 }
#undef DOARGS_1
#define DOARGS_1 DOARGS_0
#undef DOARGS_2
@@ -214,44 +215,44 @@ __local_syscall_error: \
#undef DOARGS_4
#define DOARGS_4 DOARGS_0
#undef DOARGS_5
-#define DOARGS_5 \
- .fnstart; \
- stmfd sp!, {r4, r7}; \
- cfi_adjust_cfa_offset (8); \
- cfi_rel_offset (r4, 0); \
- cfi_rel_offset (r7, 4); \
- .save { r4, r7 }; \
- ldr r4, [sp, #8]
+#define DOARGS_5 \
+ .fnstart; \
+ stmfd sp!, {r4, r7}; \
+ cfi_adjust_cfa_offset (8); \
+ cfi_rel_offset (r4, 0); \
+ cfi_rel_offset (r7, 4); \
+ .save { r4, r7 }; \
+ ldr r4, [sp, #8]
#undef DOARGS_6
-#define DOARGS_6 \
- .fnstart; \
- mov ip, sp; \
- stmfd sp!, {r4, r5, r7}; \
- cfi_adjust_cfa_offset (12); \
- cfi_rel_offset (r4, 0); \
- cfi_rel_offset (r5, 4); \
- cfi_rel_offset (r7, 8); \
- .save { r4, r5, r7 }; \
- ldmia ip, {r4, r5}
+#define DOARGS_6 \
+ .fnstart; \
+ mov ip, sp; \
+ stmfd sp!, {r4, r5, r7}; \
+ cfi_adjust_cfa_offset (12); \
+ cfi_rel_offset (r4, 0); \
+ cfi_rel_offset (r5, 4); \
+ cfi_rel_offset (r7, 8); \
+ .save { r4, r5, r7 }; \
+ ldmia ip, {r4, r5}
#undef DOARGS_7
-#define DOARGS_7 \
- .fnstart; \
- mov ip, sp; \
- stmfd sp!, {r4, r5, r6, r7}; \
- cfi_adjust_cfa_offset (16); \
- cfi_rel_offset (r4, 0); \
- cfi_rel_offset (r5, 4); \
- cfi_rel_offset (r6, 8); \
- cfi_rel_offset (r7, 12); \
- .save { r4, r5, r6, r7 }; \
- ldmia ip, {r4, r5, r6}
+#define DOARGS_7 \
+ .fnstart; \
+ mov ip, sp; \
+ stmfd sp!, {r4, r5, r6, r7}; \
+ cfi_adjust_cfa_offset (16); \
+ cfi_rel_offset (r4, 0); \
+ cfi_rel_offset (r5, 4); \
+ cfi_rel_offset (r6, 8); \
+ cfi_rel_offset (r7, 12); \
+ .save { r4, r5, r6, r7 }; \
+ ldmia ip, {r4, r5, r6}
#undef UNDOARGS_0
-#define UNDOARGS_0 \
- ldr r7, [sp], #4; \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (r7); \
- .fnend
+#define UNDOARGS_0 \
+ ldr r7, [sp], #4; \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (r7); \
+ .fnend
#undef UNDOARGS_1
#define UNDOARGS_1 UNDOARGS_0
#undef UNDOARGS_2
@@ -261,29 +262,29 @@ __local_syscall_error: \
#undef UNDOARGS_4
#define UNDOARGS_4 UNDOARGS_0
#undef UNDOARGS_5
-#define UNDOARGS_5 \
- ldmfd sp!, {r4, r7}; \
- cfi_adjust_cfa_offset (-8); \
- cfi_restore (r4); \
- cfi_restore (r7); \
- .fnend
+#define UNDOARGS_5 \
+ ldmfd sp!, {r4, r7}; \
+ cfi_adjust_cfa_offset (-8); \
+ cfi_restore (r4); \
+ cfi_restore (r7); \
+ .fnend
#undef UNDOARGS_6
-#define UNDOARGS_6 \
- ldmfd sp!, {r4, r5, r7}; \
- cfi_adjust_cfa_offset (-12); \
- cfi_restore (r4); \
- cfi_restore (r5); \
- cfi_restore (r7); \
- .fnend
+#define UNDOARGS_6 \
+ ldmfd sp!, {r4, r5, r7}; \
+ cfi_adjust_cfa_offset (-12); \
+ cfi_restore (r4); \
+ cfi_restore (r5); \
+ cfi_restore (r7); \
+ .fnend
#undef UNDOARGS_7
-#define UNDOARGS_7 \
- ldmfd sp!, {r4, r5, r6, r7}; \
- cfi_adjust_cfa_offset (-16); \
- cfi_restore (r4); \
- cfi_restore (r5); \
- cfi_restore (r6); \
- cfi_restore (r7); \
- .fnend
+#define UNDOARGS_7 \
+ ldmfd sp!, {r4, r5, r6, r7}; \
+ cfi_adjust_cfa_offset (-16); \
+ cfi_restore (r4); \
+ cfi_restore (r5); \
+ cfi_restore (r6); \
+ cfi_restore (r7); \
+ .fnend
#else /* not __ASSEMBLER__ */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/truncate64.c b/libc/ports/sysdeps/unix/sysv/linux/arm/truncate64.c
index 4367d1efe..6e52e3263 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/truncate64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/truncate64.c
@@ -22,7 +22,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
/* Truncate the file FD refers to to LENGTH bytes. */
int
@@ -30,7 +29,7 @@ truncate64 (const char *path, off64_t length)
{
unsigned int low = length & 0xffffffff;
unsigned int high = length >> 32;
- int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
+ int result = INLINE_SYSCALL (truncate64, 4, path, 0,
__LONG_LONG_PAIR (high, low));
return result;
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S b/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S
index 4f84c57f2..ae931f79c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -51,6 +51,7 @@ ENTRY (__vfork)
RESTORE_PID
#endif
cmn a1, #4096
+ it cc
RETINSTR(cc, lr)
b PLTJMP(SYSCALL_ERROR)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c
index 618edf7bc..af63e1b9a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.c
@@ -87,17 +87,6 @@ __lll_timedlock_wait (lll_lock_t *futex, const struct timespec *abstime, int pri
/* These don't get included in libc.so */
#ifdef IS_IN_libpthread
int
-lll_unlock_wake_cb (lll_lock_t *futex)
-{
- int val = atomic_exchange_rel (futex, 0);
-
- if (__builtin_expect (val > 1, 0))
- lll_private_futex_wake (futex, 1);
- return 0;
-}
-
-
-int
__lll_timedwait_tid (int *tidp, const struct timespec *abstime)
{
int tid;
@@ -134,6 +123,5 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime)
return 0;
}
-
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
index f37a7bbd7..b88703fba 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
@@ -317,8 +317,6 @@ __lll_robust_timedlock (int *futex, const struct timespec *abstime,
#define THREAD_INIT_LOCK(PD, LOCK) \
(PD)->LOCK = LLL_LOCK_INITIALIZER
-extern int lll_unlock_wake_cb (lll_lock_t *__futex) attribute_hidden;
-
/* The kernel notifies a process which uses CLONE_CHILD_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
index b3510fe2a..067552d17 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
@@ -86,6 +86,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/sigaction.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/sigaction.c
index b41c6c3a7..664d0e12b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/sigaction.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/sigaction.c
@@ -26,7 +26,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. This is the definition. */
@@ -42,8 +41,7 @@ __libc_sigaction (sig, act, oact)
{
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigaction, 4, sig,
- CHECK_1_NULL_OK (act), CHECK_1_NULL_OK (oact), _NSIG / 8);
+ return INLINE_SYSCALL (rt_sigaction, 4, sig, act, oact, _NSIG / 8);
}
libc_hidden_def (__libc_sigaction)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/sigpending.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/sigpending.c
index 9aac2b75c..42fce5022 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/sigpending.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/sigpending.c
@@ -24,7 +24,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
/* Change the set of blocked signals to SET,
wait until a signal arrives, and restore the set of blocked signals. */
@@ -34,5 +33,5 @@ sigpending (set)
{
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigpending, 2, CHECK_SIGSET (set), _NSIG / 8);
+ return INLINE_SYSCALL (rt_sigpending, 2, set, _NSIG / 8);
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/sigprocmask.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
index f074abc8a..53b85800b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
@@ -26,7 +26,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
/* Get and/or change the set of blocked signals. */
int
@@ -38,7 +37,6 @@ __sigprocmask (how, set, oset)
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigprocmask, 4, how, CHECK_SIGSET (set),
- CHECK_SIGSET_NULL_OK (oset), _NSIG / 8);
+ return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
weak_alias (__sigprocmask, sigprocmask)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/umount.c b/libc/ports/sysdeps/unix/sysv/linux/ia64/umount.c
index a15a71686..a3df7863f 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/umount.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/umount.c
@@ -20,11 +20,10 @@
#include <errno.h>
#include <sysdep.h>
-#include <bp-checks.h>
/* Unmount a filesystem. */
int
umount (const char *special_file)
{
- return INLINE_SYSCALL (umount, 2, CHECK_STRING (special_file), 0);
+ return INLINE_SYSCALL (umount, 2, special_file, 0);
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
index 3c40379aa..f06cc8ef8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
@@ -87,6 +87,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.4
GLIBC_2.4 A
_Exit F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index bf8ace7a1..31a8c3c8c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -20,6 +20,26 @@
/* Many syscalls were added in 2.6.10 for m68k. */
#define __ASSUME_UTIMES 1
+/* Support for various CLOEXEC and NONBLOCK flags was added 2.6.23. */
+#if __LINUX_KERNEL_VERSION >= 0x020617
+# define __ASSUME_O_CLOEXEC 1
+#endif
+
+/* Support for various CLOEXEC and NONBLOCK flags was added in 2.6.27. */
+#if __LINUX_KERNEL_VERSION >= 0x02061b
+# define __ASSUME_SOCK_CLOEXEC 1
+# define __ASSUME_IN_NONBLOCK 1
+# define __ASSUME_PIPE2 1
+# define __ASSUME_EVENTFD2 1
+# define __ASSUME_SIGNALFD4 1
+# define __ASSUME_DUP3 1
+#endif
+
+/* Support for the accept4 syscall was added in 2.6.28. */
+#if __LINUX_KERNEL_VERSION >= 0x02061c
+# define __ASSUME_ACCEPT4 1
+#endif
+
#include_next <kernel-features.h>
/* These syscalls were added only in 3.0 for m68k. */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
index f998b1b27..9010ea733 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
@@ -1775,6 +1775,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/not-cancel.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/not-cancel.h
new file mode 100644
index 000000000..e6a0d135c
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/nptl/not-cancel.h
@@ -0,0 +1 @@
+#include <nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/syscalls.list b/libc/ports/sysdeps/unix/sysv/linux/m68k/syscalls.list
index 1e27d8de7..aee1011a6 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -1,6 +1,7 @@
# File name Caller Syscall name Args Strong name Weak names
chown - chown32 i:sii __chown chown
+waitpid - waitpid Ci:ipi __waitpid waitpid __libc_waitpid
cacheflush EXTRA cacheflush i:iiii __cacheflush cacheflush
prlimit64 EXTRA prlimit64 i:iipp prlimit64
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/brk.c b/libc/ports/sysdeps/unix/sysv/linux/mips/brk.c
index 9bd6d94bd..07c8a9649 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/brk.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/brk.c
@@ -30,19 +30,10 @@ weak_alias (__curbrk, ___brk_addr)
int
__brk (void *addr)
{
+ INTERNAL_SYSCALL_DECL (err);
void *newbrk;
- {
- register long int res __asm__ ("$2");
-
- asm ("move\t$4,%2\n\t"
- "li\t%0,%1\n\t"
- "syscall" /* Perform the system call. */
- : "=r" (res)
- : "I" (SYS_ify (brk)), "r" (addr)
- : "$4", "$7", __SYSCALL_CLOBBERS);
- newbrk = (void *) res;
- }
+ newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
__curbrk = newbrk;
if (newbrk < addr)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/clone.S b/libc/ports/sysdeps/unix/sysv/linux/mips/clone.S
index 72360f962..f6f2f0565 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/clone.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/clone.S
@@ -34,6 +34,7 @@
void *parent_tidptr, void *tls, void *child_tidptr) */
.text
+ .set nomips16
#if _MIPS_SIM == _ABIO32
# define EXTRA_LOCALS 1
#else
@@ -47,7 +48,8 @@ NESTED(__clone,4*SZREG,sp)
SETUP_GP
#endif
PTR_SUBU sp, FRAMESZ
- SETUP_GP64 (GPOFF, __clone)
+ cfi_adjust_cfa_offset (FRAMESZ)
+ SETUP_GP64_STACK (GPOFF, __clone)
#ifdef __PIC__
SAVE_GP (GPOFF)
#endif
@@ -88,26 +90,35 @@ NESTED(__clone,4*SZREG,sp)
/* Do the system call */
li v0,__NR_clone
+ cfi_endproc
syscall
bnez a3,L(error)
beqz v0,L(thread_start)
/* Successful return from the parent */
- RESTORE_GP64
+ cfi_startproc
+ cfi_adjust_cfa_offset (FRAMESZ)
+ SETUP_GP64_STACK_CFI (GPOFF)
+ cfi_remember_state
+ RESTORE_GP64_STACK
PTR_ADDU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
ret
/* Something bad happened -- no child created */
L(error):
+ cfi_restore_state
#ifdef __PIC__
PTR_LA t9,__syscall_error
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
jr t9
#else
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
j __syscall_error
#endif
END(__clone)
@@ -118,6 +129,7 @@ L(error):
ENTRY(__thread_start)
L(thread_start):
+ cfi_undefined ($31)
/* cp is already loaded. */
SAVE_GP (GPOFF)
/* The stackframe has been created on entry of clone(). */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/getcontext.S b/libc/ports/sysdeps/unix/sysv/linux/mips/getcontext.S
index 0e3d35b54..268098c0b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/getcontext.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/getcontext.S
@@ -27,6 +27,7 @@
/* int getcontext (ucontext_t *ucp) */
.text
+ .set nomips16
LOCALSZ = 0
MASK = 0x00000000
#ifdef __PIC__
@@ -54,7 +55,8 @@ NESTED (__getcontext, FRAMESZ, ra)
# endif
PTR_ADDIU sp, -FRAMESZ
- SETUP_GP64 (GPOFF, __getcontext)
+ cfi_adjust_cfa_offset (FRAMESZ)
+ SETUP_GP64_STACK (GPOFF, __getcontext)
SAVE_GP (GPOFF)
#else /* ! __PIC__ */
@@ -124,19 +126,23 @@ NESTED (__getcontext, FRAMESZ, ra)
li v0, SYS_ify (rt_sigprocmask)
syscall
bnez a3, 99f
+ cfi_remember_state
#ifdef __PIC__
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDIU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
#endif
move v0, zero
jr ra
99:
+ cfi_restore_state
#ifdef __PIC__
PTR_LA t9, JUMPTARGET (__syscall_error)
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDIU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
jr t9
#else /* ! __PIC__ */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/makecontext.S b/libc/ports/sysdeps/unix/sysv/linux/mips/makecontext.S
index 65f1a6aaa..a8bbebbcc 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/makecontext.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/makecontext.S
@@ -27,6 +27,7 @@
/* int makecontext (ucontext_t *ucp, (void *func) (), int argc, ...) */
.text
+ .set nomips16
LOCALSZ = 0
ARGSZ = 0
MASK = 0x00000000
@@ -63,9 +64,10 @@ NESTED (__makecontext, FRAMESZ, ra)
#endif
PTR_ADDIU sp, -FRAMESZ
+ cfi_adjust_cfa_offset (FRAMESZ)
#ifdef __PIC__
- SETUP_GP64 (GPOFF, __makecontext)
+ SETUP_GP64_STACK (GPOFF, __makecontext)
SAVE_GP (GPOFF)
#endif
@@ -145,8 +147,9 @@ NESTED (__makecontext, FRAMESZ, ra)
REG_S a1, MCONTEXT_PC(a0)
#ifdef __PIC__
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDIU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
#endif
jr ra
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile
new file mode 100644
index 000000000..fa9fcb7e6
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile
@@ -0,0 +1,13 @@
+ifeq ($(subdir),misc)
+sysdep_routines += mips16-syscall0 mips16-syscall1 mips16-syscall2
+sysdep_routines += mips16-syscall3 mips16-syscall4 mips16-syscall5
+sysdep_routines += mips16-syscall6 mips16-syscall7
+CFLAGS-mips16-syscall0.c += -fexceptions
+CFLAGS-mips16-syscall1.c += -fexceptions
+CFLAGS-mips16-syscall2.c += -fexceptions
+CFLAGS-mips16-syscall3.c += -fexceptions
+CFLAGS-mips16-syscall4.c += -fexceptions
+CFLAGS-mips16-syscall5.c += -fexceptions
+CFLAGS-mips16-syscall6.c += -fexceptions
+CFLAGS-mips16-syscall7.c += -fexceptions
+endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions
new file mode 100644
index 000000000..73bcfb566
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions
@@ -0,0 +1,6 @@
+libc {
+ GLIBC_PRIVATE {
+ __mips16_syscall0; __mips16_syscall1; __mips16_syscall2; __mips16_syscall3;
+ __mips16_syscall4; __mips16_syscall5; __mips16_syscall6; __mips16_syscall7;
+ }
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h
new file mode 100644
index 000000000..8449836d3
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h
@@ -0,0 +1,89 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef MIPS16_SYSCALL_H
+#define MIPS16_SYSCALL_H 1
+
+#define __nomips16 __attribute__ ((nomips16))
+
+union __mips16_syscall_return
+ {
+ long long val;
+ struct
+ {
+ long v0;
+ long v1;
+ }
+ reg;
+ };
+
+long long __nomips16 __mips16_syscall0 (long number);
+#define __mips16_syscall0(dummy, number) \
+ __mips16_syscall0 ((long) (number))
+
+long long __nomips16 __mips16_syscall1 (long a0,
+ long number);
+#define __mips16_syscall1(a0, number) \
+ __mips16_syscall1 ((long) (a0), \
+ (long) (number))
+
+long long __nomips16 __mips16_syscall2 (long a0, long a1,
+ long number);
+#define __mips16_syscall2(a0, a1, number) \
+ __mips16_syscall2 ((long) (a0), (long) (a1), \
+ (long) (number))
+
+long long __nomips16 __mips16_syscall3 (long a0, long a1, long a2,
+ long number);
+#define __mips16_syscall3(a0, a1, a2, number) \
+ __mips16_syscall3 ((long) (a0), (long) (a1), (long) (a2), \
+ (long) (number))
+
+long long __nomips16 __mips16_syscall4 (long a0, long a1, long a2, long a3,
+ long number);
+#define __mips16_syscall4(a0, a1, a2, a3, number) \
+ __mips16_syscall4 ((long) (a0), (long) (a1), (long) (a2), \
+ (long) (a3), \
+ (long) (number))
+
+long long __nomips16 __mips16_syscall5 (long a0, long a1, long a2, long a3,
+ long a4,
+ long number);
+#define __mips16_syscall5(a0, a1, a2, a3, a4, number) \
+ __mips16_syscall5 ((long) (a0), (long) (a1), (long) (a2), \
+ (long) (a3), (long) (a4), \
+ (long) (number))
+
+long long __nomips16 __mips16_syscall6 (long a0, long a1, long a2, long a3,
+ long a4, long a5,
+ long number);
+#define __mips16_syscall6(a0, a1, a2, a3, a4, a5, number) \
+ __mips16_syscall6 ((long) (a0), (long) (a1), (long) (a2), \
+ (long) (a3), (long) (a4), (long) (a5), \
+ (long) (number))
+
+long long __nomips16 __mips16_syscall7 (long a0, long a1, long a2, long a3,
+ long a4, long a5, long a6,
+ long number);
+#define __mips16_syscall7(a0, a1, a2, a3, a4, a5, a6, number) \
+ __mips16_syscall7 ((long) (a0), (long) (a1), (long) (a2), \
+ (long) (a3), (long) (a4), (long) (a5), \
+ (long) (a6), \
+ (long) (number))
+
+#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c
new file mode 100644
index 000000000..0cdf94c22
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c
@@ -0,0 +1,30 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall0
+
+long long __nomips16
+__mips16_syscall0 (long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 0);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c
new file mode 100644
index 000000000..5e60a59d5
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c
@@ -0,0 +1,32 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall1
+
+long long __nomips16
+__mips16_syscall1 (long a0,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 1,
+ a0);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c
new file mode 100644
index 000000000..7750c519c
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c
@@ -0,0 +1,32 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall2
+
+long long __nomips16
+__mips16_syscall2 (long a0, long a1,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 2,
+ a0, a1);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c
new file mode 100644
index 000000000..7fc1c4e43
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c
@@ -0,0 +1,32 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall3
+
+long long __nomips16
+__mips16_syscall3 (long a0, long a1, long a2,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 3,
+ a0, a1, a2);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c
new file mode 100644
index 000000000..b8b4198c7
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c
@@ -0,0 +1,32 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall4
+
+long long __nomips16
+__mips16_syscall4 (long a0, long a1, long a2, long a3,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 4,
+ a0, a1, a2, a3);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c
new file mode 100644
index 000000000..e1322d107
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c
@@ -0,0 +1,33 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall5
+
+long long __nomips16
+__mips16_syscall5 (long a0, long a1, long a2, long a3,
+ long a4,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 5,
+ a0, a1, a2, a3, a4);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c
new file mode 100644
index 000000000..a9e5cd9df
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c
@@ -0,0 +1,33 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall6
+
+long long __nomips16
+__mips16_syscall6 (long a0, long a1, long a2, long a3,
+ long a4, long a5,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 6,
+ a0, a1, a2, a3, a4, a5);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c
new file mode 100644
index 000000000..d87b5ba5a
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c
@@ -0,0 +1,33 @@
+/* MIPS16 syscall wrappers.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <mips16-syscall.h>
+
+#undef __mips16_syscall7
+
+long long __nomips16
+__mips16_syscall7 (long a0, long a1, long a2, long a3,
+ long a4, long a5, long a6,
+ long number)
+{
+ union __mips16_syscall_return ret;
+ ret.reg.v0 = INTERNAL_SYSCALL_MIPS16 (number, ret.reg.v1, 7,
+ a0, a1, a2, a3, a4, a5, a6);
+ return ret.val;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
index 737886923..f01278e4a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
@@ -1390,6 +1390,19 @@ GLIBC_2.16
mbrtoc16 F
mbrtoc32 F
timespec_get F
+GLIBC_2.17
+ GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
+ secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
+ __mips_fpu_getcw F
+ __mips_fpu_setcw F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
@@ -2242,11 +2255,3 @@ GLIBC_2.9
pipe2 F
_gp_disp
_gp_disp A
-GLIBC_2.17
- GLIBC_2.17 A
- clock_getcpuclockid F
- clock_getres F
- clock_gettime F
- clock_nanosleep F
- clock_settime F
- secure_getenv F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
index e79fda937..0faf68c4f 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -67,25 +67,86 @@
#undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
- "i" (SYS_ify (name)), err, args)
+/* Note that the original Linux syscall restart convention required the
+ instruction immediately preceding SYSCALL to initialize $v0 with the
+ syscall number. Then if a restart triggered, $v0 would have been
+ clobbered by the syscall interrupted, and needed to be reinititalized.
+ The kernel would decrement the PC by 4 before switching back to the
+ user mode so that $v0 had been reloaded before SYSCALL was executed
+ again. This implied the place $v0 was loaded from must have been
+ preserved across a syscall, e.g. an immediate, static register, stack
+ slot, etc.
+
+ The convention was relaxed in Linux with a change applied to the kernel
+ GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
+ first appeared in the 2.6.36 release. Since then the kernel has had
+ code that reloads $v0 upon syscall restart and resumes right at the
+ SYSCALL instruction, so no special arrangement is needed anymore.
+
+ For backwards compatibility with existing kernel binaries we support
+ the old convention by choosing the instruction preceding SYSCALL
+ carefully. This also means we have to force a 32-bit encoding of the
+ microMIPS MOVE instruction if one is used. */
+
+#ifdef __mips_micromips
+# define MOVE32 "move32"
+#else
+# define MOVE32 "move"
+#endif
+#undef INTERNAL_SYSCALL
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (= number, , "r" (__v0), err, args)
-#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
+#ifdef __mips16
+/* There's no MIPS16 syscall instruction, so we go through out-of-line
+ standard MIPS wrappers. These do use inline snippets below though,
+ through INTERNAL_SYSCALL_MIPS16. Spilling the syscall number to
+ memory gives the best code in that case, avoiding the need to save
+ and restore a static register. */
+
+# include <mips16-syscall.h>
+
+# define INTERNAL_SYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args)
+
+# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+({ \
+ union __mips16_syscall_return ret; \
+ ret.val = __mips16_syscall##nr (args, number); \
+ err = ret.reg.v1; \
+ ret.reg.v0; \
+})
+
+# define INTERNAL_SYSCALL_MIPS16(number, err, nr, args...) \
+ internal_syscall##nr ("lw\t%0, %2\n\t", \
+ "R" (number), \
+ 0, err, args)
+
+#else /* !__mips16 */
+# define INTERNAL_SYSCALL(name, err, nr, args...) \
+ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
+ "IK" (SYS_ify (name)), \
+ 0, err, args)
+
+# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
+ "r" (__s0), \
+ number, err, args)
+
+#endif /* !__mips16 */
+
+#define internal_syscall0(v0_init, input, number, err, dummy...) \
({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a3 asm("$7"); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
".set reorder" \
: "=r" (__v0), "=r" (__a3) \
@@ -97,17 +158,19 @@
_sys_result; \
})
-#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
+#define internal_syscall1(v0_init, input, number, err, arg1) \
({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a3 asm("$7"); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
".set reorder" \
: "=r" (__v0), "=r" (__a3) \
@@ -119,20 +182,22 @@
_sys_result; \
})
-#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
+#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a3 asm("$7"); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
- ".set\treorder" \
+ ".set\treorder" \
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1) \
: __SYSCALL_CLOBBERS); \
@@ -142,21 +207,24 @@
_sys_result; \
})
-#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3)\
+#define internal_syscall3(v0_init, input, number, err, \
+ arg1, arg2, arg3) \
({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7"); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
- ".set\treorder" \
+ ".set\treorder" \
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
@@ -166,21 +234,24 @@
_sys_result; \
})
-#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4)\
+#define internal_syscall4(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4) \
({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
- ".set\treorder" \
+ ".set\treorder" \
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
@@ -197,25 +268,28 @@
#define FORCE_FRAME_POINTER \
void *volatile __fp_force __attribute__ ((unused)) = alloca (4)
-#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5)\
+#define internal_syscall5(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5) \
({ \
long _sys_result; \
\
FORCE_FRAME_POINTER; \
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
"subu\t$29, 32\n\t" \
"sw\t%6, 16($29)\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
"addiu\t$29, 32\n\t" \
- ".set\treorder" \
+ ".set\treorder" \
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), \
"r" ((long) (arg5)) \
@@ -226,26 +300,29 @@
_sys_result; \
})
-#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6)\
+#define internal_syscall6(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
long _sys_result; \
\
FORCE_FRAME_POINTER; \
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
"subu\t$29, 32\n\t" \
"sw\t%6, 16($29)\n\t" \
"sw\t%7, 20($29)\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
"addiu\t$29, 32\n\t" \
- ".set\treorder" \
+ ".set\treorder" \
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), \
"r" ((long) (arg5)), "r" ((long) (arg6)) \
@@ -256,27 +333,30 @@
_sys_result; \
})
-#define internal_syscall7(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
+#define internal_syscall7(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
({ \
long _sys_result; \
\
FORCE_FRAME_POINTER; \
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
"subu\t$29, 32\n\t" \
"sw\t%6, 16($29)\n\t" \
"sw\t%7, 20($29)\n\t" \
"sw\t%8, 24($29)\n\t" \
- cs_init \
+ v0_init \
"syscall\n\t" \
"addiu\t$29, 32\n\t" \
- ".set\treorder" \
+ ".set\treorder" \
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), \
"r" ((long) (arg5)), "r" ((long) (arg6)), "r" ((long) (arg7)) \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c
index 4367d1efe..6e52e3263 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c
@@ -22,7 +22,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
/* Truncate the file FD refers to to LENGTH bytes. */
int
@@ -30,7 +29,7 @@ truncate64 (const char *path, off64_t length)
{
unsigned int low = length & 0xffffffff;
unsigned int high = length >> 32;
- int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
+ int result = INLINE_SYSCALL (truncate64, 4, path, 0,
__LONG_LONG_PAIR (high, low));
return result;
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c
index 017b39d60..624994022 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c
@@ -23,7 +23,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <xstatconv.h>
@@ -35,7 +34,7 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
int result;
struct kernel_stat kbuf;
- result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf));
+ result = INLINE_SYSCALL (fstat, 2, fd, &kbuf);
if (result == 0)
result = __xstat64_conv (vers, &kbuf, buf);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
index 32571e717..ca2f2f615 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
@@ -25,7 +25,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <kernel-features.h>
@@ -96,11 +95,9 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
}
if (flag & AT_SYMLINK_NOFOLLOW)
- result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
- __ptrvalue (&kst));
+ result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
else
- result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
- __ptrvalue (&kst));
+ result = INTERNAL_SYSCALL (stat, err, 2, file, &kst);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat64_conv (vers, &kst, st);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c
index 106271f75..b01204deb 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c
@@ -23,7 +23,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <xstatconv.h>
@@ -34,7 +33,7 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf)
int result;
struct kernel_stat kbuf;
- result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf));
+ result = INLINE_SYSCALL (lstat, 2, name, &kbuf);
if (result == 0)
result = __xstat64_conv (vers, &kbuf, buf);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
index b8905edd7..3b94b1bef 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
@@ -20,14 +20,12 @@
#include <ipc_priv.h>
#include <sysdep.h>
-#include <bp-checks.h>
-
int __msgctl (int msqid, int cmd, struct msqid_ds *buf);
int
__msgctl (int msqid, int cmd, struct msqid_ds *buf)
{
- return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, CHECK_1 (buf));
+ return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
}
#include <shlib-compat.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
index df2e63728..9dbbd97c8 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
@@ -1398,6 +1398,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
index 73cc8479a..452c2c70e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
@@ -52,14 +52,14 @@
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
+#define INLINE_SYSCALL(name, nr, args...) \
({ INTERNAL_SYSCALL_DECL(err); \
- long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
- if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
- result_var = -1L; \
- } \
+ long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
+ if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
+ result_var = -1L; \
+ } \
result_var; })
#undef INTERNAL_SYSCALL_DECL
@@ -71,175 +71,223 @@
#undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
+/* Note that the original Linux syscall restart convention required the
+ instruction immediately preceding SYSCALL to initialize $v0 with the
+ syscall number. Then if a restart triggered, $v0 would have been
+ clobbered by the syscall interrupted, and needed to be reinititalized.
+ The kernel would decrement the PC by 4 before switching back to the
+ user mode so that $v0 had been reloaded before SYSCALL was executed
+ again. This implied the place $v0 was loaded from must have been
+ preserved across a syscall, e.g. an immediate, static register, stack
+ slot, etc.
+
+ The convention was relaxed in Linux with a change applied to the kernel
+ GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
+ first appeared in the 2.6.36 release. Since then the kernel has had
+ code that reloads $v0 upon syscall restart and resumes right at the
+ SYSCALL instruction, so no special arrangement is needed anymore.
+
+ For backwards compatibility with existing kernel binaries we support
+ the old convention by choosing the instruction preceding SYSCALL
+ carefully. This also means we have to force a 32-bit encoding of the
+ microMIPS MOVE instruction if one is used. */
+
+#ifdef __mips_micromips
+# define MOVE32 "move32"
+#else
+# define MOVE32 "move"
+#endif
+
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
- "i" (SYS_ify (name)), err, args)
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
+ "IK" (SYS_ify (name)), \
+ 0, err, args)
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (= number, , "r" (__v0), err, args)
+#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
+ "r" (__s0), \
+ number, err, args)
-#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
-({ \
+#define internal_syscall0(v0_init, input, number, err, dummy...) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set reorder" \
+ : "=r" (__v0), "=r" (__a3) \
: input \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
-({ \
+#define internal_syscall1(v0_init, input, number, err, arg1) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a0 asm("$4") = ARGIFY (arg1); \
- register long long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0) \
- : __SYSCALL_CLOBBERS); \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a0 asm ("$4") = ARGIFY (arg1); \
+ register long long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set reorder" \
+ : "=r" (__v0), "=r" (__a3) \
+ : input, "r" (__a0) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
-({ \
+#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a0 asm("$4") = ARGIFY (arg1); \
- register long long __a1 asm("$5") = ARGIFY (arg2); \
- register long long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a0 asm ("$4") = ARGIFY (arg1); \
+ register long long __a1 asm ("$5") = ARGIFY (arg2); \
+ register long long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3) \
-({ \
+#define internal_syscall3(v0_init, input, number, err, \
+ arg1, arg2, arg3) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a0 asm("$4") = ARGIFY (arg1); \
- register long long __a1 asm("$5") = ARGIFY (arg2); \
- register long long __a2 asm("$6") = ARGIFY (arg3); \
- register long long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a0 asm ("$4") = ARGIFY (arg1); \
+ register long long __a1 asm ("$5") = ARGIFY (arg2); \
+ register long long __a2 asm ("$6") = ARGIFY (arg3); \
+ register long long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4) \
-({ \
+#define internal_syscall4(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a0 asm("$4") = ARGIFY (arg1); \
- register long long __a1 asm("$5") = ARGIFY (arg2); \
- register long long __a2 asm("$6") = ARGIFY (arg3); \
- register long long __a3 asm("$7") = ARGIFY (arg4); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a0 asm ("$4") = ARGIFY (arg1); \
+ register long long __a1 asm ("$5") = ARGIFY (arg2); \
+ register long long __a2 asm ("$6") = ARGIFY (arg3); \
+ register long long __a3 asm ("$7") = ARGIFY (arg4); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \
-({ \
+#define internal_syscall5(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a0 asm("$4") = ARGIFY (arg1); \
- register long long __a1 asm("$5") = ARGIFY (arg2); \
- register long long __a2 asm("$6") = ARGIFY (arg3); \
- register long long __a3 asm("$7") = ARGIFY (arg4); \
- register long long __a4 asm("$8") = ARGIFY (arg5); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a0 asm ("$4") = ARGIFY (arg1); \
+ register long long __a1 asm ("$5") = ARGIFY (arg2); \
+ register long long __a2 asm ("$6") = ARGIFY (arg3); \
+ register long long __a3 asm ("$7") = ARGIFY (arg4); \
+ register long long __a4 asm ("$8") = ARGIFY (arg5); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \
-({ \
+#define internal_syscall6(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5, arg6) \
+({ \
long _sys_result; \
\
{ \
- register long long __v0 asm("$2") ncs_init; \
- register long long __a0 asm("$4") = ARGIFY (arg1); \
- register long long __a1 asm("$5") = ARGIFY (arg2); \
- register long long __a2 asm("$6") = ARGIFY (arg3); \
- register long long __a3 asm("$7") = ARGIFY (arg4); \
- register long long __a4 asm("$8") = ARGIFY (arg5); \
- register long long __a5 asm("$9") = ARGIFY (arg6); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
+ register long long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long long __v0 asm ("$2"); \
+ register long long __a0 asm ("$4") = ARGIFY (arg1); \
+ register long long __a1 asm ("$5") = ARGIFY (arg2); \
+ register long long __a2 asm ("$6") = ARGIFY (arg3); \
+ register long long __a3 asm ("$7") = ARGIFY (arg4); \
+ register long long __a4 asm ("$8") = ARGIFY (arg5); \
+ register long long __a5 asm ("$9") = ARGIFY (arg6); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
"r" (__a5) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
index b3bed4663..c5f1c350e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
@@ -31,9 +31,9 @@ ENTRY (__ioctl)
ret
L(error):
- SETUP_GP64 (a0, __ioctl)
+ SETUP_GP64_REG (a0, __ioctl)
PTR_LA t9, __syscall_error
- RESTORE_GP64
+ RESTORE_GP64_REG
jr t9
PSEUDO_END (__ioctl)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
index 22b3068d8..c7e46aa86 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
@@ -1396,6 +1396,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
index 86a57e02f..d16ed6941 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
@@ -48,14 +48,14 @@
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
+#define INLINE_SYSCALL(name, nr, args...) \
({ INTERNAL_SYSCALL_DECL(err); \
- long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
- if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
- result_var = -1L; \
- } \
+ long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
+ if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
+ result_var = -1L; \
+ } \
result_var; })
#undef INTERNAL_SYSCALL_DECL
@@ -67,175 +67,223 @@
#undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
+/* Note that the original Linux syscall restart convention required the
+ instruction immediately preceding SYSCALL to initialize $v0 with the
+ syscall number. Then if a restart triggered, $v0 would have been
+ clobbered by the syscall interrupted, and needed to be reinititalized.
+ The kernel would decrement the PC by 4 before switching back to the
+ user mode so that $v0 had been reloaded before SYSCALL was executed
+ again. This implied the place $v0 was loaded from must have been
+ preserved across a syscall, e.g. an immediate, static register, stack
+ slot, etc.
+
+ The convention was relaxed in Linux with a change applied to the kernel
+ GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
+ first appeared in the 2.6.36 release. Since then the kernel has had
+ code that reloads $v0 upon syscall restart and resumes right at the
+ SYSCALL instruction, so no special arrangement is needed anymore.
+
+ For backwards compatibility with existing kernel binaries we support
+ the old convention by choosing the instruction preceding SYSCALL
+ carefully. This also means we have to force a 32-bit encoding of the
+ microMIPS MOVE instruction if one is used. */
+
+#ifdef __mips_micromips
+# define MOVE32 "move32"
+#else
+# define MOVE32 "move"
+#endif
+
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
- "i" (SYS_ify (name)), err, args)
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
+ "IK" (SYS_ify (name)), \
+ 0, err, args)
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (= number, , "r" (__v0), err, args)
+#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
+ "r" (__s0), \
+ number, err, args)
-#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
-({ \
+#define internal_syscall0(v0_init, input, number, err, dummy...) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set reorder" \
+ : "=r" (__v0), "=r" (__a3) \
: input \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
-({ \
+#define internal_syscall1(v0_init, input, number, err, arg1) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0) \
- : __SYSCALL_CLOBBERS); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set reorder" \
+ : "=r" (__v0), "=r" (__a3) \
+ : input, "r" (__a0) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
-({ \
+#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3) \
-({ \
+#define internal_syscall3(v0_init, input, number, err, \
+ arg1, arg2, arg3) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7"); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4) \
-({ \
+#define internal_syscall4(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
+ : input, "r" (__a0), "r" (__a1), "r" (__a2) \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \
-({ \
+#define internal_syscall5(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
- register long __a4 asm("$8") = (long) (arg5); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
+ register long __a4 asm ("$8") = (long) (arg5); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
_sys_result; \
})
-#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \
-({ \
+#define internal_syscall6(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5, arg6) \
+({ \
long _sys_result; \
\
{ \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) (arg1); \
- register long __a1 asm("$5") = (long) (arg2); \
- register long __a2 asm("$6") = (long) (arg3); \
- register long __a3 asm("$7") = (long) (arg4); \
- register long __a4 asm("$8") = (long) (arg5); \
- register long __a5 asm("$9") = (long) (arg6); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
+ register long __s0 asm ("$16") __attribute__ ((unused)) \
+ = (number); \
+ register long __v0 asm ("$2"); \
+ register long __a0 asm ("$4") = (long) (arg1); \
+ register long __a1 asm ("$5") = (long) (arg2); \
+ register long __a2 asm ("$6") = (long) (arg3); \
+ register long __a3 asm ("$7") = (long) (arg4); \
+ register long __a4 asm ("$8") = (long) (arg5); \
+ register long __a5 asm ("$9") = (long) (arg6); \
+ __asm__ volatile ( \
+ ".set\tnoreorder\n\t" \
+ v0_init \
+ "syscall\n\t" \
+ ".set\treorder" \
+ : "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
"r" (__a5) \
- : __SYSCALL_CLOBBERS); \
+ : __SYSCALL_CLOBBERS); \
err = __a3; \
_sys_result = __v0; \
} \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h
index 354eba2f3..656522566 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h
@@ -57,6 +57,7 @@
cfi_same_value (gp); \
RESTORESTK; \
ret; \
+ cfi_endproc; \
.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
ENTRY (name) \
SAVESTK; \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/semctl.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
index 7e5488dbd..e43e8937a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
@@ -30,9 +30,6 @@ union semun
struct seminfo *__buf; /* buffer for IPC_INFO */
};
-#include <bp-checks.h>
-#include <bp-semctl.h> /* definition of CHECK_SEMCTL needs union semum */
-
int __semctl (int semid, int semnum, int cmd, ...);
int
@@ -49,7 +46,7 @@ __semctl (int semid, int semnum, int cmd, ...)
va_end (ap);
return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
- CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)->array);
+ arg.array);
}
#include <shlib-compat.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
index 9b183f335..197f7eb80 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
@@ -20,14 +20,12 @@
#include <ipc_priv.h>
#include <sysdep.h>
-#include <bp-checks.h>
-
int __shmctl (int shmid, int cmd, struct shmid_ds *buf);
int
__shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
- return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, CHECK_1 (buf));
+ return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
}
#include <shlib-compat.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
index 839276d7a..850025c63 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
@@ -30,7 +30,9 @@ NESTED (syscall, SZREG, ra)
.mask 0x00010000, -SZREG
.fmask 0x00000000, 0
PTR_ADDIU sp, -SZREG
+ cfi_adjust_cfa_offset (SZREG)
REG_S s0, (sp)
+ cfi_rel_offset (s0, 0)
move s0, a0
move a0, a1 /* shift arg1 - arg7. */
@@ -45,15 +47,17 @@ NESTED (syscall, SZREG, ra)
syscall /* Do the system call. */
REG_L s0, (sp)
+ cfi_restore (s0)
PTR_ADDIU sp, SZREG
+ cfi_adjust_cfa_offset (-SZREG)
bne a3, zero, L(error)
ret
L(error):
- SETUP_GP64 (a0, syscall)
+ SETUP_GP64_REG (a0, syscall)
PTR_LA t9, __syscall_error
- RESTORE_GP64
+ RESTORE_GP64_REG
jr t9
END (syscall)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c
index 2408e5e37..89cde2b33 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c
@@ -23,7 +23,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <xstatconv.h>
@@ -35,7 +34,7 @@ __xstat64 (int vers, const char *name, struct stat64 *buf)
int result;
struct kernel_stat kbuf;
- result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf));
+ result = INLINE_SYSCALL (stat, 2, name, &kbuf);
if (result == 0)
result = __xstat64_conv (vers, &kbuf, buf);
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
index fe7c747cd..4f27b8b82 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
@@ -36,6 +36,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -141,6 +143,34 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
+ })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
static inline int __attribute__((always_inline))
__lll_trylock(int *futex)
{
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
index e1dd67252..3b0eccc77 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
@@ -39,6 +39,7 @@
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.align 2; \
+ .set nomips16; \
L(pseudo_start): \
cfi_startproc; \
99: PSEUDO_ERRJMP \
@@ -52,6 +53,7 @@
.set reorder; \
bne a3, zero, 99b; \
ret; \
+ cfi_endproc; \
.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
ENTRY (name) \
.set noreorder; \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/pread.c b/libc/ports/sysdeps/unix/sysv/linux/mips/pread.c
index b269e1c25..db18265e3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/pread.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/pread.c
@@ -26,7 +26,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <kernel-features.h>
@@ -54,10 +53,9 @@ __libc_pread (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
- offset);
+ result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
#endif
return result;
@@ -66,9 +64,9 @@ __libc_pread (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
+ result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/pread64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/pread64.c
index 8c2c403a9..3b8c8aa72 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/pread64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/pread64.c
@@ -25,7 +25,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <kernel-features.h>
@@ -50,10 +49,9 @@ __libc_pread64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
- offset);
+ result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
#endif
@@ -63,9 +61,9 @@ __libc_pread64 (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
+ result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite.c b/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite.c
index aa3501414..94213bc8b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite.c
@@ -26,7 +26,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <kernel-features.h>
@@ -54,10 +53,9 @@ __libc_pwrite (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
- offset);
+ result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
#endif
return result;
@@ -66,9 +64,9 @@ __libc_pwrite (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
+ result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite64.c b/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite64.c
index 1d14e0761..aa8a4dec3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/pwrite64.c
@@ -25,7 +25,6 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
#include <kernel-features.h>
@@ -49,10 +48,9 @@ __libc_pwrite64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
- offset);
+ result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
#endif
@@ -63,9 +61,9 @@ __libc_pwrite64 (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
+ result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
#else
- result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/setcontext.S b/libc/ports/sysdeps/unix/sysv/linux/mips/setcontext.S
index 42f709d84..2d5aee013 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/setcontext.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/setcontext.S
@@ -27,6 +27,7 @@
/* int setcontext (const ucontext_t *ucp) */
.text
+ .set nomips16
LOCALSZ = 0
ARGSZ = 0
MASK = 0x00000000
@@ -56,9 +57,10 @@ NESTED (__setcontext, FRAMESZ, ra)
#endif
PTR_ADDIU sp, -FRAMESZ
+ cfi_adjust_cfa_offset (FRAMESZ)
#ifdef __PIC__
- SETUP_GP64 (GPOFF, __setcontext)
+ SETUP_GP64_STACK (GPOFF, __setcontext)
SAVE_GP (GPOFF)
#endif
@@ -152,6 +154,7 @@ NESTED (__setcontext, FRAMESZ, ra)
and call the signal return syscall as if a signal
handler exited normally. */
PTR_ADDIU sp, -((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
+ cfi_adjust_cfa_offset ((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
/* Only ucontext is referred to from rt_sigreturn,
copy it. */
@@ -175,11 +178,13 @@ NESTED (__setcontext, FRAMESZ, ra)
path. Successful rt_sigreturn never returns to
its calling place. */
PTR_ADDIU sp, ((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
+ cfi_adjust_cfa_offset (-((RT_SIGFRAME_SIZE + ALSZ) & ALMASK))
99:
#ifdef __PIC__
PTR_LA t9, JUMPTARGET (__syscall_error)
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDIU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
jr t9
#else /* ! __PIC__ */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/sigaction.c b/libc/ports/sysdeps/unix/sysv/linux/mips/sigaction.c
index c490dd144..9d8ee76d0 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/sigaction.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/sigaction.c
@@ -71,8 +71,8 @@ __libc_sigaction (sig, act, oact)
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
- act ? __ptrvalue (&kact) : NULL,
- oact ? __ptrvalue (&koact) : NULL,
+ act ? &kact : NULL,
+ oact ? &koact : NULL,
sizeof (kernel_sigset_t));
if (oact && result >= 0)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/swapcontext.S b/libc/ports/sysdeps/unix/sysv/linux/mips/swapcontext.S
index d965f3919..ec271b058 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/swapcontext.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/swapcontext.S
@@ -27,6 +27,7 @@
/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
.text
+ .set nomips16
LOCALSZ = 0
ARGSZ = 0
MASK = 0x00000000
@@ -63,7 +64,8 @@ NESTED (__swapcontext, FRAMESZ, ra)
# endif
PTR_ADDIU sp, -FRAMESZ
- SETUP_GP64 (GPOFF, __swapcontext)
+ cfi_adjust_cfa_offset (FRAMESZ)
+ SETUP_GP64_STACK (GPOFF, __swapcontext)
SAVE_GP (GPOFF)
#else /* ! __PIC__ */
@@ -198,8 +200,9 @@ NESTED (__swapcontext, FRAMESZ, ra)
99:
#ifdef __PIC__
PTR_LA t9, JUMPTARGET (__syscall_error)
- RESTORE_GP64
+ RESTORE_GP64_STACK
PTR_ADDIU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
jr t9
#else /* ! __PIC__ */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/ustat.c b/libc/ports/sysdeps/unix/sysv/linux/mips/ustat.c
index f05bba629..6db482e96 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/ustat.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/ustat.c
@@ -22,7 +22,6 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include <bp-checks.h>
int
ustat (dev_t dev, struct ustat *ubuf)
@@ -32,5 +31,5 @@ ustat (dev_t dev, struct ustat *ubuf)
/* We must convert the value to dev_t type used by the kernel. */
k_dev = ((major (dev) & 0xff) << 8) | (minor (dev) & 0xff);
- return INLINE_SYSCALL (ustat, 2, k_dev, CHECK_1 (ubuf));
+ return INLINE_SYSCALL (ustat, 2, k_dev, ubuf);
}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/vfork.S b/libc/ports/sysdeps/unix/sysv/linux/mips/vfork.S
index b9503c394..ae76a91d3 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/vfork.S
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/vfork.S
@@ -34,6 +34,7 @@
/* int vfork() */
.text
+ .set nomips16
LOCALSZ= 1
FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
GPOFF= FRAMESZ-(1*SZREG)
@@ -42,7 +43,8 @@ NESTED(__vfork,FRAMESZ,sp)
SETUP_GP
#endif
PTR_SUBU sp, FRAMESZ
- SETUP_GP64 (a5, __vfork)
+ cfi_adjust_cfa_offset (FRAMESZ)
+ SETUP_GP64_REG (a5, __vfork)
#ifdef __PIC__
SAVE_GP (GPOFF)
#endif
@@ -63,6 +65,7 @@ NESTED(__vfork,FRAMESZ,sp)
#endif
PTR_ADDU sp, FRAMESZ
+ cfi_adjust_cfa_offset (-FRAMESZ)
SAVE_PID
@@ -75,20 +78,22 @@ NESTED(__vfork,FRAMESZ,sp)
RESTORE_PID
+ cfi_remember_state
bnez a3,L(error)
/* Successful return from the parent or child. */
- RESTORE_GP64
+ RESTORE_GP64_REG
ret
/* Something bad happened -- no child created. */
L(error):
+ cfi_restore_state
#ifdef __PIC__
PTR_LA t9, __syscall_error
- RESTORE_GP64
+ RESTORE_GP64_REG
jr t9
#else
- RESTORE_GP64
+ RESTORE_GP64_REG
j __syscall_error
#endif
END(__vfork)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
index 0efc6b55c..9b6d66374 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
@@ -1781,6 +1781,9 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/tile/nptl/lowlevellock.h
index e6f5d1905..a9822ec96 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/nptl/lowlevellock.h
@@ -38,6 +38,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -139,7 +141,33 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
static inline int __attribute__ ((always_inline))
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
index d79b2df55..caf74b89e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
@@ -2088,3 +2088,6 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
index f61740567..68d975be5 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
@@ -2088,3 +2088,6 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
index d79b2df55..caf74b89e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
@@ -2088,3 +2088,6 @@ GLIBC_2.17
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F