about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-02-21 11:15:54 +0000
committerJakub Jelinek <jakub@redhat.com>2007-02-21 11:15:54 +0000
commitb428b742cf54d423e5a7a68fcbec9473303eeafa (patch)
treea7eb4bb9273b2c48c1d4deacb5458f5075d902ef /sysdeps
parent6c8cc2d3042d0585741452006c29cb21fbba39ea (diff)
downloadglibc-b428b742cf54d423e5a7a68fcbec9473303eeafa.tar.gz
glibc-b428b742cf54d423e5a7a68fcbec9473303eeafa.tar.xz
glibc-b428b742cf54d423e5a7a68fcbec9473303eeafa.zip
Updated to fedora-glibc-20070221T1011 cvs/fedora-glibc-2_5_90-18
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/bits/byteswap.h2
-rw-r--r--sysdeps/i386/fpu/e_fmod.S2
-rw-r--r--sysdeps/i386/fpu/e_fmodf.S2
-rw-r--r--sysdeps/i386/fpu/e_fmodl.c2
-rw-r--r--sysdeps/i386/i486/bits/atomic.h22
-rw-r--r--sysdeps/posix/euidaccess.c10
-rw-r--r--sysdeps/unix/closedir.c4
-rw-r--r--sysdeps/unix/opendir.c5
-rw-r--r--sysdeps/unix/readdir.c7
-rw-r--r--sysdeps/unix/sysv/linux/sys/acct.h72
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/send.c7
-rw-r--r--sysdeps/x86_64/bits/atomic.h30
-rw-r--r--sysdeps/x86_64/bits/byteswap.h3
13 files changed, 105 insertions, 63 deletions
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index 3baad85e8a..7f2ddc2dc5 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -68,7 +68,7 @@ __bswap_16 (unsigned short int __bsx)
 #  if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ \
       && !defined __pentium4__ && !defined __k8__ && !defined __athlon__ \
       && !defined __k6__ && !defined __nocona__ && !defined __core2__ \
-      && !defined __geode__
+      && !defined __geode__ && !defined __amdfam10__
 #   define __bswap_32(x)						      \
      (__extension__							      \
       ({ register unsigned int __v, __x = (x);				      \
diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S
index 4cf6e92054..e801286a9b 100644
--- a/sysdeps/i386/fpu/e_fmod.S
+++ b/sysdeps/i386/fpu/e_fmod.S
@@ -10,7 +10,7 @@ RCSID("$NetBSD: e_fmod.S,v 1.4 1995/05/08 23:47:56 jtc Exp $")
 ENTRY(__ieee754_fmod)
 	fldl	12(%esp)
 	fldl	4(%esp)
-1:	fprem
+1:	fprem1
 	fstsw	%ax
 	sahf
 	jp	1b
diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S
index bbce40976d..1850af098e 100644
--- a/sysdeps/i386/fpu/e_fmodf.S
+++ b/sysdeps/i386/fpu/e_fmodf.S
@@ -11,7 +11,7 @@ RCSID("$NetBSD: $")
 ENTRY(__ieee754_fmodf)
 	flds	8(%esp)
 	flds	4(%esp)
-1:	fprem
+1:	fprem1
 	fstsw	%ax
 	sahf
 	jp	1b
diff --git a/sysdeps/i386/fpu/e_fmodl.c b/sysdeps/i386/fpu/e_fmodl.c
index c7c9a60456..97a06d0016 100644
--- a/sysdeps/i386/fpu/e_fmodl.c
+++ b/sysdeps/i386/fpu/e_fmodl.c
@@ -12,7 +12,7 @@ __ieee754_fmodl (long double x, long double y)
 {
   long double res;
 
-  asm ("1:\tfprem\n"
+  asm ("1:\tfprem1\n"
        "fstsw   %%ax\n"
        "sahf\n"
        "jp      1b\n"
diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h
index 4577499d58..21eea7112c 100644
--- a/sysdeps/i386/i486/bits/atomic.h
+++ b/sysdeps/i386/i486/bits/atomic.h
@@ -199,7 +199,7 @@ typedef uintmax_t uatomic_max_t;
   ({ __typeof (*mem) result;						      \
      if (sizeof (*mem) == 1)						      \
        __asm __volatile ("xchgb %b0, %1"				      \
-			 : "=r" (result), "=m" (*mem)			      \
+			 : "=q" (result), "=m" (*mem)			      \
 			 : "0" (newvalue), "m" (*mem));			      \
      else if (sizeof (*mem) == 2)					      \
        __asm __volatile ("xchgw %w0, %1"				      \
@@ -222,7 +222,7 @@ typedef uintmax_t uatomic_max_t;
      __typeof (value) __addval = (value);				      \
      if (sizeof (*mem) == 1)						      \
        __asm __volatile (lock "xaddb %b0, %1"				      \
-			 : "=r" (__result), "=m" (*mem)			      \
+			 : "=q" (__result), "=m" (*mem)			      \
 			 : "0" (__addval), "m" (*mem),			      \
 			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
      else if (sizeof (*mem) == 2)					      \
@@ -272,7 +272,7 @@ typedef uintmax_t uatomic_max_t;
     else if (sizeof (*mem) == 1)					      \
       __asm __volatile (lock "addb %b1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" (value), "m" (*mem),			      \
+			: "iq" (value), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
     else if (sizeof (*mem) == 2)					      \
       __asm __volatile (lock "addw %w1, %0"				      \
@@ -331,7 +331,7 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*mem) == 1)						      \
        __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" (value), "m" (*mem));			      \
+			 : "iq" (value), "m" (*mem));			      \
      else if (sizeof (*mem) == 2)					      \
        __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
@@ -464,7 +464,7 @@ typedef uintmax_t uatomic_max_t;
     if (sizeof (*mem) == 1)						      \
       __asm __volatile (LOCK_PREFIX "orb %b2, %0"			      \
 			: "=m" (*mem)					      \
-			: "m" (*mem), "ir" (1 << (bit)));		      \
+			: "m" (*mem), "iq" (1 << (bit)));		      \
     else if (sizeof (*mem) == 2)					      \
       __asm __volatile (LOCK_PREFIX "orw %w2, %0"			      \
 			: "=m" (*mem)					      \
@@ -503,11 +503,11 @@ typedef uintmax_t uatomic_max_t;
 #define atomic_and(mem, mask) \
   do {									      \
     if (sizeof (*mem) == 1)						      \
-      __asm __volatile (LOCK_PREFIX "andb %1, %b0"			      \
+      __asm __volatile (LOCK_PREFIX "andb %b1, %0"			      \
 			: "=m" (*mem)					      \
-			: "ir" (mask), "m" (*mem));			      \
+			: "iq" (mask), "m" (*mem));			      \
     else if (sizeof (*mem) == 2)					      \
-      __asm __volatile (LOCK_PREFIX "andw %1, %w0"			      \
+      __asm __volatile (LOCK_PREFIX "andw %w1, %0"			      \
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem));			      \
     else if (sizeof (*mem) == 4)					      \
@@ -522,12 +522,12 @@ typedef uintmax_t uatomic_max_t;
 #define __arch_or_body(lock, mem, mask) \
   do {									      \
     if (sizeof (*mem) == 1)						      \
-      __asm __volatile (lock "orb %1, %b0"				      \
+      __asm __volatile (lock "orb %b1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" (mask), "m" (*mem),			      \
+			: "iq" (mask), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
     else if (sizeof (*mem) == 2)					      \
-      __asm __volatile (lock "orw %1, %w0"				      \
+      __asm __volatile (lock "orw %w1, %0"				      \
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
index 76a09d455d..333870cdde 100644
--- a/sysdeps/posix/euidaccess.c
+++ b/sysdeps/posix/euidaccess.c
@@ -1,5 +1,5 @@
 /* Check if effective user id can access file
-   Copyright (C) 1990,1991,1995-2001,2005 Free Software Foundation, Inc.
+   Copyright (C) 1990,1991,1995-2001,2005,2007 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
@@ -128,10 +128,6 @@ euidaccess (path, mode)
 #ifdef	_LIBC
   uid_t euid;
   gid_t egid;
-
-  if (! __libc_enable_secure)
-    /* If we are not set-uid or set-gid, access does the same.  */
-    return __access (path, mode);
 #else
   if (have_ids == 0)
     {
@@ -162,6 +158,10 @@ euidaccess (path, mode)
   /* Now we need the IDs.  */
   euid = __geteuid ();
   egid = __getegid ();
+
+  if (__getuid () == euid && __getgid () == egid)
+    /* If we are not set-uid or set-gid, access does the same.  */
+    return __access (path, mode);
 #endif
 
   /* The super-user can read and write any file, and execute any file
diff --git a/sysdeps/unix/closedir.c b/sysdeps/unix/closedir.c
index 09deee7e85..3d65e14f61 100644
--- a/sysdeps/unix/closedir.c
+++ b/sysdeps/unix/closedir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1995,1996,1998,2002,2003
+/* Copyright (C) 1991,1993,1995,1996,1998,2002,2003, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -45,7 +45,9 @@ __closedir (DIR *dirp)
 
   fd = dirp->fd;
 
+#ifndef NOT_IN_libc
   __libc_lock_fini (dirp->lock);
+#endif
 
   free ((void *) dirp);
 
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 6aa738fb69..59772cda75 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1996,98,2000-2003,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1996,98,2000-2003,2005,2007
+   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
@@ -173,7 +174,9 @@ __alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
   dirp->allocation = allocation;
   dirp->fd = fd;
 
+#ifndef NOT_IN_libc
   __libc_lock_init (dirp->lock);
+#endif
 
   return dirp;
 }
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index 4a0f0890e9..13e5e9a021 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,99,2000,02
-	Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997,1999,2000,2002,2007 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
@@ -42,7 +41,9 @@ __READDIR (DIR *dirp)
   DIRENT_TYPE *dp;
   int saved_errno = errno;
 
+#ifndef NOT_IN_libc
   __libc_lock_lock (dirp->lock);
+#endif
 
   do
     {
@@ -110,7 +111,9 @@ __READDIR (DIR *dirp)
       /* Skip deleted files.  */
     } while (dp->d_ino == 0);
 
+#ifndef NOT_IN_libc
   __libc_lock_unlock (dirp->lock);
+#endif
 
   return dp;
 }
diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h
index 9ee8564f70..47c63ebfb2 100644
--- a/sysdeps/unix/sysv/linux/sys/acct.h
+++ b/sysdeps/unix/sysv/linux/sys/acct.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2007 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
@@ -21,6 +21,7 @@
 
 #include <features.h>
 
+#include <endian.h>
 #define	__need_time_t
 #include <time.h>
 #include <sys/types.h>
@@ -38,25 +39,50 @@ __BEGIN_DECLS
 typedef u_int16_t comp_t;
 
 struct acct
-  {
-    char ac_flag;			/* Accounting flags.  */
-    u_int16_t ac_uid;			/* Accounting user ID.  */
-    u_int16_t ac_gid;			/* Accounting group ID.  */
-    u_int16_t ac_tty;			/* Controlling tty.  */
-    u_int32_t ac_btime;			/* Beginning time.  */
-    comp_t ac_utime;			/* Accounting user time.  */
-    comp_t ac_stime;			/* Accounting system time.  */
-    comp_t ac_etime;			/* Accounting elapsed time.  */
-    comp_t ac_mem;			/* Accounting average memory usage.  */
-    comp_t ac_io;			/* Accounting chars transferred.  */
-    comp_t ac_rw;			/* Accounting blocks read or written.  */
-    comp_t ac_minflt;			/* Accounting minor pagefaults.  */
-    comp_t ac_majflt;			/* Accounting major pagefaults.  */
-    comp_t ac_swaps;			/* Accounting number of swaps.  */
-    u_int32_t ac_exitcode;		/* Accounting process exitcode.  */
-    char ac_comm[ACCT_COMM+1];		/* Accounting command name.  */
-    char ac_pad[10];			/* Accounting padding bytes.  */
-  };
+{
+  char ac_flag;			/* Flags.  */
+  u_int16_t ac_uid;		/* Real user ID.  */
+  u_int16_t ac_gid;		/* Real group ID.  */
+  u_int16_t ac_tty;		/* Controlling terminal.  */
+  u_int32_t ac_btime;		/* Beginning time.  */
+  comp_t ac_utime;		/* User time.  */
+  comp_t ac_stime;		/* System time.  */
+  comp_t ac_etime;		/* Elapsed time.  */
+  comp_t ac_mem;		/* Average memory usage.  */
+  comp_t ac_io;			/* Chars transferred.  */
+  comp_t ac_rw;			/* Blocks read or written.  */
+  comp_t ac_minflt;		/* Minor pagefaults.  */
+  comp_t ac_majflt;		/* Major pagefaults.  */
+  comp_t ac_swaps;		/* Number of swaps.  */
+  u_int32_t ac_exitcode;	/* Process exitcode.  */
+  char ac_comm[ACCT_COMM+1];	/* Command name.  */
+  char ac_pad[10];		/* Padding bytes.  */
+};
+
+
+struct acct_v3
+{
+  char ac_flag;			/* Flags */
+  char ac_version;		/* Always set to ACCT_VERSION */
+  u_int16_t ac_tty;		/* Control Terminal */
+  u_int32_t ac_exitcode;	/* Exitcode */
+  u_int32_t ac_uid;		/* Real User ID */
+  u_int32_t ac_gid;		/* Real Group ID */
+  u_int32_t ac_pid;		/* Process ID */
+  u_int32_t ac_ppid;		/* Parent Process ID */
+  u_int32_t ac_btime;		/* Process Creation Time */
+  float ac_etime;		/* Elapsed Time */
+  comp_t ac_utime;		/* User Time */
+  comp_t ac_stime;		/* System Time */
+  comp_t ac_mem;		/* Average Memory Usage */
+  comp_t ac_io;			/* Chars Transferred */
+  comp_t ac_rw;			/* Blocks Read or Written */
+  comp_t ac_minflt;		/* Minor Pagefaults */
+  comp_t ac_majflt;		/* Major Pagefaults */
+  comp_t ac_swaps;		/* Number of Swaps */
+  char ac_comm[ACCT_COMM];	/* Command Name */
+};
+
 
 enum
   {
@@ -66,6 +92,12 @@ enum
     AXSIG = 0x10		/* Killed by a signal.  */
   };
 
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define ACCT_BYTEORDER 0x80	/* Accounting file is big endian.  */
+#else
+# define ACCT_BYTEORDER 0x00	/* Accounting file is little endian.  */
+#endif
+
 #define AHZ     100
 
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/send.c b/sysdeps/unix/sysv/linux/x86_64/send.c
index c484ce69fe..fc768311f7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/send.c
+++ b/sysdeps/unix/sysv/linux/x86_64/send.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2007 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
@@ -25,11 +25,12 @@ ssize_t
 __libc_send (int fd, const void *buf, size_t n, int flags)
 {
   if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL, NULL);
+    return INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL, (size_t) 0);
 
   int oldtype = LIBC_CANCEL_ASYNC ();
 
-  ssize_t result = INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL, NULL);
+  ssize_t result = INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL,
+				   (size_t) 0);
 
   LIBC_CANCEL_RESET (oldtype);
 
diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h
index 80e8a0bccb..39c6ecba83 100644
--- a/sysdeps/x86_64/bits/atomic.h
+++ b/sysdeps/x86_64/bits/atomic.h
@@ -144,7 +144,7 @@ typedef uintmax_t uatomic_max_t;
   ({ __typeof (*mem) result;						      \
      if (sizeof (*mem) == 1)						      \
        __asm __volatile ("xchgb %b0, %1"				      \
-			 : "=r" (result), "=m" (*mem)			      \
+			 : "=q" (result), "=m" (*mem)			      \
 			 : "0" (newvalue), "m" (*mem));			      \
      else if (sizeof (*mem) == 2)					      \
        __asm __volatile ("xchgw %w0, %1"				      \
@@ -165,7 +165,7 @@ typedef uintmax_t uatomic_max_t;
   ({ __typeof (*mem) result;						      \
      if (sizeof (*mem) == 1)						      \
        __asm __volatile (lock "xaddb %b0, %1"				      \
-			 : "=r" (result), "=m" (*mem)			      \
+			 : "=q" (result), "=m" (*mem)			      \
 			 : "0" (value), "m" (*mem),			      \
 			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
      else if (sizeof (*mem) == 2)					      \
@@ -209,7 +209,7 @@ typedef uintmax_t uatomic_max_t;
     else if (sizeof (*mem) == 1)					      \
       __asm __volatile (lock "addb %b1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" (value), "m" (*mem),			      \
+			: "iq" (value), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
     else if (sizeof (*mem) == 2)					      \
       __asm __volatile (lock "addw %w1, %0"				      \
@@ -243,7 +243,7 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*mem) == 1)						      \
        __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" (value), "m" (*mem));			      \
+			 : "iq" (value), "m" (*mem));			      \
      else if (sizeof (*mem) == 2)					      \
        __asm __volatile (LOCK_PREFIX "addw %w2, %0; sets %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
@@ -264,7 +264,7 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*mem) == 1)						      \
        __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" (value), "m" (*mem));			      \
+			 : "iq" (value), "m" (*mem));			      \
      else if (sizeof (*mem) == 2)					      \
        __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
@@ -393,7 +393,7 @@ typedef uintmax_t uatomic_max_t;
     if (sizeof (*mem) == 1)						      \
       __asm __volatile (LOCK_PREFIX "orb %b2, %0"			      \
 			: "=m" (*mem)					      \
-			: "m" (*mem), "ir" (1L << (bit)));		      \
+			: "m" (*mem), "iq" (1L << (bit)));		      \
     else if (sizeof (*mem) == 2)					      \
       __asm __volatile (LOCK_PREFIX "orw %w2, %0"			      \
 			: "=m" (*mem)					      \
@@ -418,7 +418,7 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*mem) == 1)						      \
        __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0"		      \
 			 : "=q" (__result), "=m" (*mem)			      \
-			 : "m" (*mem), "ir" (bit));			      \
+			 : "m" (*mem), "iq" (bit));			      \
      else if (sizeof (*mem) == 2)					      \
        __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0"		      \
 			 : "=q" (__result), "=m" (*mem)			      \
@@ -440,11 +440,11 @@ typedef uintmax_t uatomic_max_t;
 #define atomic_and(mem, mask) \
   do {									      \
     if (sizeof (*mem) == 1)						      \
-      __asm __volatile (LOCK_PREFIX "andb %1, %b0"			      \
+      __asm __volatile (LOCK_PREFIX "andb %b1, %0"			      \
 			: "=m" (*mem)					      \
-			: "ir" (mask), "m" (*mem));			      \
+			: "iq" (mask), "m" (*mem));			      \
     else if (sizeof (*mem) == 2)					      \
-      __asm __volatile (LOCK_PREFIX "andw %1, %w0"			      \
+      __asm __volatile (LOCK_PREFIX "andw %w1, %0"			      \
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem));			      \
     else if (sizeof (*mem) == 4)					      \
@@ -452,7 +452,7 @@ typedef uintmax_t uatomic_max_t;
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem));			      \
     else								      \
-      __asm __volatile (LOCK_PREFIX "andq %1, %q0"			      \
+      __asm __volatile (LOCK_PREFIX "andq %q1, %0"			      \
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem));			      \
   } while (0)
@@ -461,12 +461,12 @@ typedef uintmax_t uatomic_max_t;
 #define __arch_or_body(lock, mem, mask)					      \
   do {									      \
     if (sizeof (*mem) == 1)						      \
-      __asm __volatile (lock "orb %1, %b0"				      \
+      __asm __volatile (lock "orb %b1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" (mask), "m" (*mem),			      \
+			: "iq" (mask), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
     else if (sizeof (*mem) == 2)					      \
-      __asm __volatile (lock "orw %1, %w0"				      \
+      __asm __volatile (lock "orw %w1, %0"				      \
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
@@ -476,7 +476,7 @@ typedef uintmax_t uatomic_max_t;
 			: "ir" (mask), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
     else								      \
-      __asm __volatile (lock "orq %1, %q0"				      \
+      __asm __volatile (lock "orq %q1, %0"				      \
 			: "=m" (*mem)					      \
 			: "ir" (mask), "m" (*mem),			      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
index 7514a9f4db..ec2b17889d 100644
--- a/sysdeps/x86_64/bits/byteswap.h
+++ b/sysdeps/x86_64/bits/byteswap.h
@@ -61,7 +61,8 @@
 			  || defined __pentiumpro__ || defined __pentium4__   \
 			  || defined __k8__ || defined __athlon__	      \
 			  || defined __k6__ || defined __nocona__	      \
-			  || defined __core2__ || defined __geode__)
+			  || defined __core2__ || defined __geode__	      \
+			  || defined __amdfam10__)
 /* To swap the bytes in a word the i486 processors and up provide the
    `bswap' opcode.  On i386 we have to use three instructions.  */
 #  define __bswap_32(x) \