[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r22371 - in /fsf/trunk/libc: ./ elf/ hesiod/ io/ ports/ ports/sysdeps/unix/sysv/linux/mips/mips32/ ports/sysdeps/unix/sysv/l...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r22371 - in /fsf/trunk/libc: ./ elf/ hesiod/ io/ ports/ ports/sysdeps/unix/sysv/linux/mips/mips32/ ports/sysdeps/unix/sysv/l...
- From: eglibc@xxxxxxxxxx
- Date: Wed, 06 Feb 2013 00:02:42 -0000
Author: eglibc
Date: Wed Feb 6 00:02:41 2013
New Revision: 22371
Log:
Import glibc-mainline for 2013-02-06
Added:
fsf/trunk/libc/hesiod/Depend
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/Makeconfig
fsf/trunk/libc/NEWS
fsf/trunk/libc/elf/dl-hwcaps.c
fsf/trunk/libc/io/lseek.c
fsf/trunk/libc/ports/ChangeLog.mips
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
fsf/trunk/libc/stdlib/getenv.c
fsf/trunk/libc/sysdeps/generic/malloc-sysdep.h
fsf/trunk/libc/sysdeps/unix/inet/Subdirs
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Feb 6 00:02:41 2013
@@ -1,3 +1,24 @@
+2013-02-05 Roland McGrath <roland@xxxxxxxxxxxxx>
+
+ * Makeconfig (all-Depend-files): Add existing
+ $(sorted-subdirs:=/Depend) files.
+ (all-subdirs): Remove nss.
+ * sysdeps/unix/inet/Subdirs: Add it here instead.
+ * hesiod/Depend: New file.
+
+ * elf/dl-hwcaps.c (_dl_important_hwcaps): Use a variable-length array
+ instead of calling alloca.
+
+ * io/lseek.c (__lseek): Rename to __libc_lseek.
+ Define __lseek as an alias.
+
+ * sysdeps/generic/malloc-sysdep.h: Include <stdbool.h> and <unistd.h>.
+
+2013-02-04 Carlos O'Donell <carlos@xxxxxxxxxx>
+
+ * stdlib/getenv.c (getenv): Assume __BIG_ENDIAN in the
+ else clause and remove check for non-standard endianness.
+
2013-02-04 David S. Miller <davem@xxxxxxxxxxxxx>
* sysdeps/sparc/fpu/libm-test-ulps: Update.
Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Wed Feb 6 00:02:41 2013
@@ -1041,13 +1041,19 @@
stdlib stdio-common libio malloc string wcsmbs time dirent \
grp pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
- crypt nss localedata timezone rt conform debug \
+ crypt localedata timezone rt conform debug \
$(add-on-subdirs) dlfcn elf
ifndef avoid-generated
-all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\
- $(firstword $($(dir)-srcdir) \
- $(..)$(dir))/Depend))
+# sysd-sorted itself will contain rules making the sysd-sorted target
+# depend on Depend files. But if you just added a Depend file to an
+# existing directory not in all-subdirs, then sysd-sorted needs to
+# be regenerated, so it depends on existing $(sorted-subdirs:=/Depend) files.
+all-Depend-files := $(wildcard $(sort \
+ $(foreach dir,$(all-subdirs),\
+ $(firstword $($(dir)-srcdir) \
+ $(..)$(dir))/Depend) \
+ $(sorted-subdirs:=/Depend)))
$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
$(common-objpfx)config.make $(..)Makeconfig \
$(wildcard $(sysdirs:=/Subdirs)) \
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed Feb 6 00:02:41 2013
@@ -10,7 +10,7 @@
* The following bugs are resolved with this release:
13951, 14142, 14200, 14317, 14327, 14496, 14964, 14981, 14982, 14985,
- 14994, 14996, 15003, 15020, 15023, 15036, 15062.
+ 14994, 14996, 15003, 15020, 15023, 15036, 15054, 15062.
Version 2.17
Modified: fsf/trunk/libc/elf/dl-hwcaps.c
==============================================================================
--- fsf/trunk/libc/elf/dl-hwcaps.c (original)
+++ fsf/trunk/libc/elf/dl-hwcaps.c Wed Feb 6 00:02:41 2013
@@ -42,7 +42,6 @@
size_t cnt = platform != NULL;
size_t n, m;
size_t total;
- struct r_strlenpair *temp;
struct r_strlenpair *result;
struct r_strlenpair *rp;
char *cp;
@@ -103,7 +102,7 @@
++cnt;
/* Create temporary data structure to generate result table. */
- temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
+ struct r_strlenpair temp[cnt];
m = 0;
#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
if (dsocaps != NULL)
@@ -199,7 +198,7 @@
}
/* Fill in the information. This follows the following scheme
- (indeces from TEMP for four strings):
+ (indices from TEMP for four strings):
entry #0: 0, 1, 2, 3 binary: 1111
#1: 0, 1, 3 1101
#2: 0, 2, 3 1011
Added: fsf/trunk/libc/hesiod/Depend
==============================================================================
--- fsf/trunk/libc/hesiod/Depend (added)
+++ fsf/trunk/libc/hesiod/Depend Wed Feb 6 00:02:41 2013
@@ -1,0 +1,2 @@
+nss
+resolv
Modified: fsf/trunk/libc/io/lseek.c
==============================================================================
--- fsf/trunk/libc/io/lseek.c (original)
+++ fsf/trunk/libc/io/lseek.c Wed Feb 6 00:02:41 2013
@@ -21,7 +21,7 @@
/* Seek to OFFSET on FD, starting from WHENCE. */
off_t
-__lseek (fd, offset, whence)
+__libc_lseek (fd, offset, whence)
int fd;
off_t offset;
int whence;
@@ -45,7 +45,8 @@
__set_errno (ENOSYS);
return -1;
}
+weak_alias (__libc_lseek, __lseek)
+weak_alias (__libc_lseek, lseek)
stub_warning (lseek)
+
libc_hidden_def (__lseek)
-
-weak_alias (__lseek, lseek)
Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Wed Feb 6 00:02:41 2013
@@ -1,3 +1,42 @@
+2013-02-05 Maciej W. Rozycki <macro@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Add a missing
+ space in asm register specifiers throughout.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise.
+
+ [BZ #15054]
+ * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (MOVE32):
+ New macro.
+ (INTERNAL_SYSCALL_NCS): Use it. Rewrite to respect the syscall
+ restart convention.
+ (INTERNAL_SYSCALL): Rewrite to respect the syscall restart
+ convention.
+ (internal_syscall0, internal_syscall1): Likewise.
+ (internal_syscall2, internal_syscall3): Likewise.
+ (internal_syscall4, internal_syscall5): Likewise.
+ (internal_syscall6, internal_syscall7): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (MOVE32):
+ New macro.
+ (INTERNAL_SYSCALL_NCS): Use it. Rewrite to respect the syscall
+ restart convention.
+ (INTERNAL_SYSCALL): Rewrite to respect the syscall restart
+ convention.
+ (internal_syscall0, internal_syscall1): Likewise.
+ (internal_syscall2, internal_syscall3): Likewise.
+ (internal_syscall4, internal_syscall5): Likewise.
+ (internal_syscall6): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (MOVE32):
+ New macro.
+ (INTERNAL_SYSCALL_NCS): Use it. Rewrite to respect the syscall
+ restart convention.
+ (INTERNAL_SYSCALL): Rewrite to respect the syscall restart
+ convention.
+ (internal_syscall0, internal_syscall1): Likewise.
+ (internal_syscall2, internal_syscall3): Likewise.
+ (internal_syscall4, internal_syscall5): Likewise.
+ (internal_syscall6): Likewise.
+
2013-02-04 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h Wed Feb 6 00:02:41 2013
@@ -67,25 +67,57 @@
#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_syscall0(ncs_init, cs_init, input, 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 \
+#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(v0_init, input, number, err, dummy...) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -97,17 +129,19 @@
_sys_result; \
})
-#define internal_syscall1(ncs_init, cs_init, input, 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 \
+#define internal_syscall1(v0_init, input, number, err, arg1) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -119,20 +153,22 @@
_sys_result; \
})
-#define internal_syscall2(ncs_init, cs_init, input, 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" \
+#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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); \
@@ -142,21 +178,24 @@
_sys_result; \
})
-#define internal_syscall3(ncs_init, cs_init, input, 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" \
+#define internal_syscall3(v0_init, input, number, err, \
+ arg1, arg2, arg3) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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); \
@@ -166,21 +205,24 @@
_sys_result; \
})
-#define internal_syscall4(ncs_init, cs_init, input, 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" \
+#define internal_syscall4(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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); \
@@ -197,25 +239,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 +271,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 +304,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)) \
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h Wed Feb 6 00:02:41 2013
@@ -71,25 +71,57 @@
#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_syscall0(ncs_init, cs_init, input, 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 \
+#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(v0_init, input, number, err, dummy...) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -101,17 +133,19 @@
_sys_result; \
})
-#define internal_syscall1(ncs_init, cs_init, input, 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 \
+#define internal_syscall1(v0_init, input, number, err, arg1) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -123,18 +157,20 @@
_sys_result; \
})
-#define internal_syscall2(ncs_init, cs_init, input, 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 \
+#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -146,19 +182,22 @@
_sys_result; \
})
-#define internal_syscall3(ncs_init, cs_init, input, 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 \
+#define internal_syscall3(v0_init, input, number, err, \
+ arg1, arg2, arg3) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -170,19 +209,22 @@
_sys_result; \
})
-#define internal_syscall4(ncs_init, cs_init, input, 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 \
+#define internal_syscall4(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -194,20 +236,23 @@
_sys_result; \
})
-#define internal_syscall5(ncs_init, cs_init, input, 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 \
+#define internal_syscall5(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -219,21 +264,24 @@
_sys_result; \
})
-#define internal_syscall6(ncs_init, cs_init, input, 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 \
+#define internal_syscall6(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5, arg6) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h Wed Feb 6 00:02:41 2013
@@ -67,25 +67,57 @@
#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_syscall0(ncs_init, cs_init, input, 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 \
+#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(v0_init, input, number, err, dummy...) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -97,17 +129,19 @@
_sys_result; \
})
-#define internal_syscall1(ncs_init, cs_init, input, 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 \
+#define internal_syscall1(v0_init, input, number, err, arg1) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -119,18 +153,20 @@
_sys_result; \
})
-#define internal_syscall2(ncs_init, cs_init, input, 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 \
+#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -142,19 +178,22 @@
_sys_result; \
})
-#define internal_syscall3(ncs_init, cs_init, input, 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 \
+#define internal_syscall3(v0_init, input, number, err, \
+ arg1, arg2, arg3) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -166,19 +205,22 @@
_sys_result; \
})
-#define internal_syscall4(ncs_init, cs_init, input, 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 \
+#define internal_syscall4(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -190,20 +232,23 @@
_sys_result; \
})
-#define internal_syscall5(ncs_init, cs_init, input, 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 \
+#define internal_syscall5(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
@@ -215,21 +260,24 @@
_sys_result; \
})
-#define internal_syscall6(ncs_init, cs_init, input, 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 \
+#define internal_syscall6(v0_init, input, number, err, \
+ arg1, arg2, arg3, arg4, arg5, arg6) \
+({ \
+ long _sys_result; \
+ \
+ { \
+ 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) \
Modified: fsf/trunk/libc/stdlib/getenv.c
==============================================================================
--- fsf/trunk/libc/stdlib/getenv.c (original)
+++ fsf/trunk/libc/stdlib/getenv.c Wed Feb 6 00:02:41 2013
@@ -48,11 +48,7 @@
#if __BYTE_ORDER == __LITTLE_ENDIAN || !_STRING_ARCH_unaligned
name_start = ('=' << 8) | *(const unsigned char *) name;
#else
-# if __BYTE_ORDER == __BIG_ENDIAN
name_start = '=' | ((*(const unsigned char *) name) << 8);
-# else
- #error "Funny byte order."
-# endif
#endif
for (ep = __environ; *ep != NULL; ++ep)
{
Modified: fsf/trunk/libc/sysdeps/generic/malloc-sysdep.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/malloc-sysdep.h (original)
+++ fsf/trunk/libc/sysdeps/generic/malloc-sysdep.h Wed Feb 6 00:02:41 2013
@@ -16,6 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
+#include <unistd.h>
+
/* Force an unmap when the heap shrinks in a secure exec. This ensures that
the old data pages immediately cease to be accessible. */
static inline bool
Modified: fsf/trunk/libc/sysdeps/unix/inet/Subdirs
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/inet/Subdirs (original)
+++ fsf/trunk/libc/sysdeps/unix/inet/Subdirs Wed Feb 6 00:02:41 2013
@@ -4,4 +4,5 @@
sunrpc
nis
nscd
+nss
streams
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits