aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.alpha11
-rw-r--r--sysdeps/unix/alpha/sysdep.h190
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setregid.c31
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setresgid.c33
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setresuid.c33
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setreuid.c31
6 files changed, 85 insertions, 244 deletions
diff --git a/ChangeLog.alpha b/ChangeLog.alpha
index eb5544cbb3..912fe332db 100644
--- a/ChangeLog.alpha
+++ b/ChangeLog.alpha
@@ -1,6 +1,15 @@
2012-02-15 Richard Henderson <rth@twiddle.net>
- * sysdeps/unux/alpha/sysdep.h: Don't include <tls.h>
+ * sysdeps/unix/alpha/sysdep.h (syscall_promote): New.
+ (inline_syscall0, inline_syscall1, inline_syscall2,
+ inline_syscall3, inline_syscall4, inline_syscall5,
+ inline_syscall6): Use it.
+ * sysdeps/unix/sysv/linux/alpha/setregid.c: Remove.
+ * sysdeps/unix/sysv/linux/alpha/setreuid.c: Remove.
+ * sysdeps/unix/sysv/linux/alpha/setresgid.c: Remove.
+ * sysdeps/unix/sysv/linux/alpha/setresuid.c: Remove.
+
+ * sysdeps/unix/alpha/sysdep.h: Don't include <tls.h>
[PIC] (SYSCALL_ERROR_HANDLER): Emit nothing.
[PIC] (SYSCALL_ERROR_LABEL): Add !samegp markup.
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index e82784225b..c3f5920ad0 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -190,6 +190,12 @@ __LABEL(name) \
#define INTERNAL_SYSCALL_DECL(err) \
long int err __attribute__((unused))
+/* The normal Alpha calling convention sign-extends 32-bit quantties
+ no matter what the "real" sign of the 32-bit type. We want to
+ preserve that when filling in values for the kernel. */
+#define syscall_promote(arg) \
+ (sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
+
/* Make sure and "use" the variable that we're not returning,
in order to suppress unused variable warnings. */
#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void)val, err)
@@ -205,172 +211,126 @@ __LABEL(name) \
#define inline_syscall0(name, args...) \
{ \
- register long _sc_0; \
register long _sc_19 __asm__("$19"); \
- \
- _sc_0 = name; \
+ register long _sc_0 = name; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2" \
- : "=v"(_sc_0), "=r"(_sc_19) \
- : "0"(_sc_0) \
- : inline_syscall_clobbers, \
+ : "+v"(_sc_0), "=r"(_sc_19) \
+ : : inline_syscall_clobbers, \
"$16", "$17", "$18", "$20", "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#define inline_syscall1(name,arg1) \
{ \
- register long _sc_0; \
- register long _sc_16 __asm__("$16"); \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
register long _sc_19 __asm__("$19"); \
- register long _tmp_16 = (long) (arg1); \
- \
- _sc_0 = name; \
- _sc_16 = _tmp_16; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3" \
- : "=v"(_sc_0), "=r"(_sc_19), "=r"(_sc_16) \
- : "0"(_sc_0), "2"(_sc_16) \
- : inline_syscall_clobbers, \
+ : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
+ : : inline_syscall_clobbers, \
"$17", "$18", "$20", "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#define inline_syscall2(name,arg1,arg2) \
{ \
- register long _sc_0; \
- register long _sc_16 __asm__("$16"); \
- register long _sc_17 __asm__("$17"); \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
register long _sc_19 __asm__("$19"); \
- register long _tmp_16 = (long) (arg1); \
- register long _tmp_17 = (long) (arg2); \
- \
- _sc_0 = name; \
- _sc_16 = _tmp_16; \
- _sc_17 = _tmp_17; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4" \
- : "=v"(_sc_0), "=r"(_sc_19), \
- "=r"(_sc_16), "=r"(_sc_17) \
- : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17) \
- : inline_syscall_clobbers, \
+ : "+v"(_sc_0), "=r"(_sc_19), \
+ "+r"(_sc_16), "+r"(_sc_17) \
+ : : inline_syscall_clobbers, \
"$18", "$20", "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#define inline_syscall3(name,arg1,arg2,arg3) \
{ \
- register long _sc_0; \
- register long _sc_16 __asm__("$16"); \
- register long _sc_17 __asm__("$17"); \
- register long _sc_18 __asm__("$18"); \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
register long _sc_19 __asm__("$19"); \
- register long _tmp_16 = (long) (arg1); \
- register long _tmp_17 = (long) (arg2); \
- register long _tmp_18 = (long) (arg3); \
- \
- _sc_0 = name; \
- _sc_16 = _tmp_16; \
- _sc_17 = _tmp_17; \
- _sc_18 = _tmp_18; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5" \
- : "=v"(_sc_0), "=r"(_sc_19), "=r"(_sc_16), \
- "=r"(_sc_17), "=r"(_sc_18) \
- : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \
- "4"(_sc_18) \
- : inline_syscall_clobbers, "$20", "$21"); \
+ : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18) \
+ : : inline_syscall_clobbers, "$20", "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#define inline_syscall4(name,arg1,arg2,arg3,arg4) \
{ \
- register long _sc_0; \
- register long _sc_16 __asm__("$16"); \
- register long _sc_17 __asm__("$17"); \
- register long _sc_18 __asm__("$18"); \
- register long _sc_19 __asm__("$19"); \
- register long _tmp_16 = (long) (arg1); \
- register long _tmp_17 = (long) (arg2); \
- register long _tmp_18 = (long) (arg3); \
- register long _tmp_19 = (long) (arg4); \
- \
- _sc_0 = name; \
- _sc_16 = _tmp_16; \
- _sc_17 = _tmp_17; \
- _sc_18 = _tmp_18; \
- _sc_19 = _tmp_19; \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _tmp_19 = syscall_promote (arg4); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19") = _tmp_19; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
- : "=v"(_sc_0), "=r"(_sc_19), "=r"(_sc_16), \
- "=r"(_sc_17), "=r"(_sc_18) \
- : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \
- "4"(_sc_18), "1"(_sc_19) \
- : inline_syscall_clobbers, "$20", "$21"); \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18) \
+ : : inline_syscall_clobbers, "$20", "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
{ \
- register long _sc_0; \
- register long _sc_16 __asm__("$16"); \
- register long _sc_17 __asm__("$17"); \
- register long _sc_18 __asm__("$18"); \
- register long _sc_19 __asm__("$19"); \
- register long _sc_20 __asm__("$20"); \
- register long _tmp_16 = (long) (arg1); \
- register long _tmp_17 = (long) (arg2); \
- register long _tmp_18 = (long) (arg3); \
- register long _tmp_19 = (long) (arg4); \
- register long _tmp_20 = (long) (arg5); \
- \
- _sc_0 = name; \
- _sc_16 = _tmp_16; \
- _sc_17 = _tmp_17; \
- _sc_18 = _tmp_18; \
- _sc_19 = _tmp_19; \
- _sc_20 = _tmp_20; \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _tmp_19 = syscall_promote (arg4); \
+ register long _tmp_20 = syscall_promote (arg5); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19") = _tmp_19; \
+ register long _sc_20 __asm__("$20") = _tmp_20; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
- : "=v"(_sc_0), "=r"(_sc_19), "=r"(_sc_16), \
- "=r"(_sc_17), "=r"(_sc_18), "=r"(_sc_20) \
- : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \
- "4"(_sc_18), "1"(_sc_19), "5"(_sc_20) \
- : inline_syscall_clobbers, "$21"); \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
+ : : inline_syscall_clobbers, "$21"); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
{ \
- register long _sc_0; \
- register long _sc_16 __asm__("$16"); \
- register long _sc_17 __asm__("$17"); \
- register long _sc_18 __asm__("$18"); \
- register long _sc_19 __asm__("$19"); \
- register long _sc_20 __asm__("$20"); \
- register long _sc_21 __asm__("$21"); \
- register long _tmp_16 = (long) (arg1); \
- register long _tmp_17 = (long) (arg2); \
- register long _tmp_18 = (long) (arg3); \
- register long _tmp_19 = (long) (arg4); \
- register long _tmp_20 = (long) (arg5); \
- register long _tmp_21 = (long) (arg6); \
- \
- _sc_0 = name; \
- _sc_16 = _tmp_16; \
- _sc_17 = _tmp_17; \
- _sc_18 = _tmp_18; \
- _sc_19 = _tmp_19; \
- _sc_20 = _tmp_20; \
- _sc_21 = _tmp_21; \
+ register long _tmp_16 = syscall_promote (arg1); \
+ register long _tmp_17 = syscall_promote (arg2); \
+ register long _tmp_18 = syscall_promote (arg3); \
+ register long _tmp_19 = syscall_promote (arg4); \
+ register long _tmp_20 = syscall_promote (arg5); \
+ register long _tmp_21 = syscall_promote (arg6); \
+ register long _sc_0 = name; \
+ register long _sc_16 __asm__("$16") = _tmp_16; \
+ register long _sc_17 __asm__("$17") = _tmp_17; \
+ register long _sc_18 __asm__("$18") = _tmp_18; \
+ register long _sc_19 __asm__("$19") = _tmp_19; \
+ register long _sc_20 __asm__("$20") = _tmp_20; \
+ register long _sc_21 __asm__("$21") = _tmp_21; \
__asm__ __volatile__ \
("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
- : "=v"(_sc_0), "=r"(_sc_19), "=r"(_sc_16), \
- "=r"(_sc_17), "=r"(_sc_18), "=r"(_sc_20), \
- "=r"(_sc_21) \
- : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), "4"(_sc_18), \
- "1"(_sc_19), "5"(_sc_20), "6"(_sc_21) \
- : inline_syscall_clobbers); \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
+ "+r"(_sc_21) \
+ : : inline_syscall_clobbers); \
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
diff --git a/sysdeps/unix/sysv/linux/alpha/setregid.c b/sysdeps/unix/sysv/linux/alpha/setregid.c
deleted file mode 100644
index 0973fe4ac1..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/setregid.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <unistd.h>
-#include <setxid.h>
-
-
-int
-__setregid (gid_t rgid, gid_t egid)
-{
- return INLINE_SETXID_SYSCALL (setregid, 2, (int) rgid, (int) egid);
-}
-#ifndef __setregid
-weak_alias (__setregid, setregid)
-#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/setresgid.c b/sysdeps/unix/sysv/linux/alpha/setresgid.c
deleted file mode 100644
index 50e29e3c76..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/setresgid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <unistd.h>
-#include <setxid.h>
-
-
-int
-__setresgid (gid_t rgid, gid_t egid, gid_t sgid)
-{
- return INLINE_SETXID_SYSCALL (setresgid, 3, (int) rgid,
- (int) egid, (int) sgid);
-}
-libc_hidden_def (__setresgid)
-#ifndef __setresgid
-weak_alias (__setresgid, setresgid)
-#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/setresuid.c b/sysdeps/unix/sysv/linux/alpha/setresuid.c
deleted file mode 100644
index e76413bf6a..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/setresuid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <unistd.h>
-#include <setxid.h>
-
-
-int
-__setresuid (uid_t ruid, uid_t euid, uid_t suid)
-{
- return INLINE_SETXID_SYSCALL (setresuid, 3, (int) ruid,
- (int) euid, (int) suid);
-}
-libc_hidden_def (__setresuid)
-#ifndef __setresuid
-weak_alias (__setresuid, setresuid)
-#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/setreuid.c b/sysdeps/unix/sysv/linux/alpha/setreuid.c
deleted file mode 100644
index a23a34792e..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/setreuid.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 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, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <unistd.h>
-#include <setxid.h>
-
-
-int
-__setreuid (uid_t ruid, uid_t euid)
-{
- return INLINE_SETXID_SYSCALL (setreuid, 2, (int) ruid, (int) euid);
-}
-#ifndef __setreuid
-weak_alias (__setreuid, setreuid)
-#endif