From bd4f43b462aadbe49bece8a7d6b62381ee90f690 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 14 Apr 2003 17:30:34 +0000 Subject: [PATCH] Update. 2003-04-14 Jakub Jelinek * sysdeps/i386/i486/bits/atomic.h: Rename LOCK to LOCK_PREFIX. * sysdeps/x86_64/bits/atomic.h: Likewise. 2003-04-14 Ulrich Drepper * sysdeps/unix/sysv/linux/i386/sysdep.h: Change PUSHARGS_1 and POPARGS_1 to emit labels for the mov instructions. 2003-04-14 Jakub Jelinek * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h (ret_NOERRNO): Define. --- ChangeLog | 14 ++++ localedata/ChangeLog | 4 ++ localedata/locales/mn_MN | 4 +- nptl/ChangeLog | 5 ++ nptl/sysdeps/i386/pthread_spin_lock.c | 15 ++-- nptl/sysdeps/i386/tls.h | 10 +-- nptl/sysdeps/x86_64/tls.h | 12 +++- sysdeps/i386/i486/bits/atomic.h | 78 ++++++++++----------- sysdeps/unix/sysv/linux/i386/sysdep.h | 4 +- sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h | 3 +- sysdeps/x86_64/bits/atomic.h | 96 +++++++++++++------------- 11 files changed, 139 insertions(+), 106 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c86339..0869ac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-04-14 Jakub Jelinek + + * sysdeps/i386/i486/bits/atomic.h: Rename LOCK to LOCK_PREFIX. + * sysdeps/x86_64/bits/atomic.h: Likewise. + +2003-04-14 Ulrich Drepper + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Change PUSHARGS_1 and + POPARGS_1 to emit labels for the mov instructions. + +2003-04-14 Jakub Jelinek + + * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h (ret_NOERRNO): Define. + 2003-04-14 Roland McGrath * sysdeps/generic/unwind-dw2.c (_Unwind_GetCFA): Add a cast to silence diff --git a/localedata/ChangeLog b/localedata/ChangeLog index b5ca9ef..69550a1 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,7 @@ +2003-04-14 Ulrich Drepper + + * locales/mn_MN: Fix country_post and country_ab2. + 2003-03-17 Ulrich Drepper * localedata/en_ZA: Changed %x for LC_TIME to use dd/mm/ccyy. diff --git a/localedata/locales/mn_MN b/localedata/locales/mn_MN index 61ccb3a..e75ff42 100644 --- a/localedata/locales/mn_MN +++ b/localedata/locales/mn_MN @@ -172,8 +172,8 @@ postal_fmt "/ " country_name "" -country_post "" -country_ab2 "" +country_post "" +country_ab2 "" country_ab3 "" country_num 496 country_car "" diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 1687bf4..9f8cbae 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,10 @@ 2003-04-14 Jakub Jelinek + * sysdeps/i386/tls.h: Rename LOCK to LOCK_PREFIX. + * sysdeps/i386/pthread_spin_lock.c: Likewise. + * sysdeps/x86_64/tls.h: Likewise. Define LOCK_PREFIX if not already + defined. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Use DW_CFA_advance_loc2 for .Laddl-.Lsubl. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Use diff --git a/nptl/sysdeps/i386/pthread_spin_lock.c b/nptl/sysdeps/i386/pthread_spin_lock.c index 43a1831..f001fba 100644 --- a/nptl/sysdeps/i386/pthread_spin_lock.c +++ b/nptl/sysdeps/i386/pthread_spin_lock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. @@ -19,11 +19,12 @@ #include "pthreadP.h" - -#ifdef UP -# define LOCK -#else -# define LOCK "lock;" +#ifndef LOCK_PREFIX +# ifdef UP +# define LOCK_PREFIX /* nothing */ +# else +# define LOCK_PREFIX "lock;" +# endif #endif @@ -32,7 +33,7 @@ pthread_spin_lock (lock) pthread_spinlock_t *lock; { asm ("\n" - "1:\t" LOCK "decl %0\n\t" + "1:\t" LOCK_PREFIX "decl %0\n\t" "jne 2f\n\t" ".subsection 1\n\t" ".align 16\n" diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h index 4f2e818..7ee2bca 100644 --- a/nptl/sysdeps/i386/tls.h +++ b/nptl/sysdeps/i386/tls.h @@ -169,11 +169,11 @@ union user_desc_init # define INIT_SYSINFO #endif -#ifndef LOCK +#ifndef LOCK_PREFIX # ifdef UP -# define LOCK /* nothing */ +# define LOCK_PREFIX /* nothing */ # else -# define LOCK "lock;" +# define LOCK_PREFIX "lock;" # endif #endif @@ -365,7 +365,7 @@ union user_desc_init ({ __typeof (descr->member) __ret; \ __typeof (oldval) __old = (oldval); \ if (sizeof (descr->member) == 4) \ - asm volatile (LOCK "cmpxchgl %2, %%gs:%P3" \ + asm volatile (LOCK_PREFIX "cmpxchgl %2, %%gs:%P3" \ : "=a" (__ret) \ : "0" (__old), "r" (newval), \ "i" (offsetof (struct pthread, member))); \ @@ -378,7 +378,7 @@ union user_desc_init /* Atomic set bit. */ #define THREAD_ATOMIC_BIT_SET(descr, member, bit) \ (void) ({ if (sizeof ((descr)->member) == 4) \ - asm volatile (LOCK "orl %1, %%gs:%P0" \ + asm volatile (LOCK_PREFIX "orl %1, %%gs:%P0" \ :: "i" (offsetof (struct pthread, member)), \ "ir" (1 << (bit))); \ else \ diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h index 975d20f..ab13f25 100644 --- a/nptl/sysdeps/x86_64/tls.h +++ b/nptl/sysdeps/x86_64/tls.h @@ -67,6 +67,14 @@ typedef struct /* Get the thread descriptor definition. */ # include +#ifndef LOCK_PREFIX +# ifdef UP +# define LOCK_PREFIX /* nothing */ +# else +# define LOCK_PREFIX "lock;" +# endif +#endif + /* This is the size of the initial TCB. */ # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) @@ -267,7 +275,7 @@ typedef struct ({ __typeof (descr->member) __ret; \ __typeof (oldval) __old = (oldval); \ if (sizeof (descr->member) == 4) \ - asm volatile (LOCK "cmpxchgl %2, %%fs:%P3" \ + asm volatile (LOCK_PREFIX "cmpxchgl %2, %%fs:%P3" \ : "=a" (__ret) \ : "0" (__old), "r" (newval), \ "i" (offsetof (struct pthread, member))); \ @@ -280,7 +288,7 @@ typedef struct /* Atomic set bit. */ #define THREAD_ATOMIC_BIT_SET(descr, member, bit) \ (void) ({ if (sizeof ((descr)->member) == 4) \ - asm volatile (LOCK "orl %1, %%fs:%P0" \ + asm volatile (LOCK_PREFIX "orl %1, %%fs:%P0" \ :: "i" (offsetof (struct pthread, member)), \ "ir" (1 << (bit))); \ else \ diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h index 33c47dc..aff8cd9 100644 --- a/sysdeps/i386/i486/bits/atomic.h +++ b/sysdeps/i386/i486/bits/atomic.h @@ -46,32 +46,32 @@ typedef intmax_t atomic_max_t; typedef uintmax_t uatomic_max_t; -#ifndef LOCK +#ifndef LOCK_PREFIX # ifdef UP -# define LOCK /* nothing */ +# define LOCK_PREFIX /* nothing */ # else -# define LOCK "lock;" +# define LOCK_PREFIX "lock;" # endif #endif #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgb %b2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ : "=a" (ret), "=m" (*mem) \ : "q" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgw %w2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgl %2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) @@ -90,7 +90,7 @@ typedef uintmax_t uatomic_max_t; # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ __asm __volatile ("xchgl %2, %%ebx\n\t" \ - LOCK "cmpxchg8b %1\n\t" \ + LOCK_PREFIX "cmpxchg8b %1\n\t" \ "xchgl %2, %%ebx" \ : "=A" (ret), "=m" (*mem) \ : "DS" (((unsigned long long int) (newval)) \ @@ -103,11 +103,11 @@ typedef uintmax_t uatomic_max_t; # else # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchg8b %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchg8b %1" \ : "=A" (ret), "=m" (*mem) \ : "b" (((unsigned long long int) (newval)) \ & 0xffffffff), \ - "c" (((unsigned long long int) (newval)) >> 32), \ + "c" (((unsigned long long int) (newval)) >> 32), \ "m" (*mem), "a" (((unsigned long long int) (oldval)) \ & 0xffffffff), \ "d" (((unsigned long long int) (oldval)) >> 32)); \ @@ -143,15 +143,15 @@ typedef uintmax_t uatomic_max_t; ({ __typeof (*mem) result; \ __typeof (value) addval = (value); \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "xaddb %b0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (addval), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "xaddw %w0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (addval), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "xaddl %0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (addval), "m" (*mem)); \ else \ @@ -172,15 +172,15 @@ typedef uintmax_t uatomic_max_t; else if (__builtin_constant_p (value) && (value) == 1) \ atomic_decrement (mem); \ else if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b1, %0" \ + __asm __volatile (LOCK_PREFIX "addb %b1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w1, %0" \ + __asm __volatile (LOCK_PREFIX "addw %w1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %1, %0" \ + __asm __volatile (LOCK_PREFIX "addl %1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else \ @@ -199,15 +199,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_add_negative(mem, value) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "iq" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addw %w2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addl %2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else \ @@ -218,15 +218,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_add_zero(mem, value) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addl %2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else \ @@ -236,15 +236,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_increment(mem) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "incb %b0" \ + __asm __volatile (LOCK_PREFIX "incb %b0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "incw %w0" \ + __asm __volatile (LOCK_PREFIX "incw %w0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "incl %0" \ + __asm __volatile (LOCK_PREFIX "incl %0" \ : "=m" (*mem) \ : "m" (*mem)); \ else \ @@ -262,15 +262,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_increment_and_test(mem) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "incb %0; sete %b1" \ + __asm __volatile (LOCK_PREFIX "incb %0; sete %b1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "incw %0; sete %w1" \ + __asm __volatile (LOCK_PREFIX "incw %0; sete %w1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "incl %0; sete %1" \ + __asm __volatile (LOCK_PREFIX "incl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else \ @@ -280,15 +280,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_decrement(mem) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "decb %b0" \ + __asm __volatile (LOCK_PREFIX "decb %b0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "decw %w0" \ + __asm __volatile (LOCK_PREFIX "decw %w0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "decl %0" \ + __asm __volatile (LOCK_PREFIX "decl %0" \ : "=m" (*mem) \ : "m" (*mem)); \ else \ @@ -306,15 +306,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_decrement_and_test(mem) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "decb %b0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decb %b0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "decw %w0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decw %w0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "decl %0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else \ @@ -324,15 +324,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_set(mem, bit) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "orb %b2, %0" \ + __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1 << (bit))); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "orw %w2, %0" \ + __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1 << (bit))); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "orl %2, %0" \ + __asm __volatile (LOCK_PREFIX "orl %2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1 << (bit))); \ else \ @@ -343,15 +343,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_test_set(mem, bit) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "btsb %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "btsw %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "btsl %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsl %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else \ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 14984b6..858a56a 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -247,9 +247,9 @@ __i686.get_pc_thunk.reg: \ #define _DOARGS_0(n) /* No arguments to frob. */ #define _POPARGS_0 /* No arguments to pop. */ -#define PUSHARGS_1 movl %ebx, %edx; PUSHARGS_0 +#define PUSHARGS_1 movl %ebx, %edx; L(SAVEBX1): PUSHARGS_0 #define DOARGS_1 _DOARGS_1 (4) -#define POPARGS_1 POPARGS_0; movl %edx, %ebx +#define POPARGS_1 POPARGS_0; movl %edx, %ebx; L(RESTBX1): #define _PUSHARGS_1 pushl %ebx; L(PUSHBX1): _PUSHARGS_0 #define _DOARGS_1(n) movl n(%esp), %ebx; _DOARGS_0(n-4) #define _POPARGS_1 _POPARGS_0; popl %ebx; L(POPBX1): diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index cd907da..c16e8ff 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -121,7 +121,8 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ .size name,.-name /* Careful here! This "ret" define can interfere; use jmpl if unsure. */ -#define ret retl; nop +#define ret retl; nop +#define ret_NOERRNO retl; nop #define r0 %o0 #define r1 %o1 #define MOVE(x,y) mov x, y diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h index 0582103..ece260d 100644 --- a/sysdeps/x86_64/bits/atomic.h +++ b/sysdeps/x86_64/bits/atomic.h @@ -46,39 +46,39 @@ typedef intmax_t atomic_max_t; typedef uintmax_t uatomic_max_t; -#ifndef LOCK +#ifndef LOCK_PREFIX # ifdef UP -# define LOCK /* nothing */ +# define LOCK_PREFIX /* nothing */ # else -# define LOCK "lock;" +# define LOCK_PREFIX "lock;" # endif #endif #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgb %b2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \ : "=a" (ret), "=m" (*mem) \ : "q" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgw %w2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgl %2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchgq %q2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" ((long) (newval)), "m" (*mem), \ "0" ((long) (oldval))); \ @@ -110,19 +110,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_exchange_and_add(mem, value) \ ({ __typeof (*mem) result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "xaddb %b0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "xaddw %w0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "xaddl %0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (value), "m" (*mem)); \ else \ - __asm __volatile (LOCK "xaddq %q0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddq %q0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" ((long) (value)), "m" (*mem)); \ result; }) @@ -134,19 +134,19 @@ typedef uintmax_t uatomic_max_t; else if (__builtin_constant_p (value) && (value) == 1) \ atomic_decrement (mem); \ else if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b1, %0" \ + __asm __volatile (LOCK_PREFIX "addb %b1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w1, %0" \ + __asm __volatile (LOCK_PREFIX "addw %w1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %1, %0" \ + __asm __volatile (LOCK_PREFIX "addl %1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else \ - __asm __volatile (LOCK "addq %q1, %0" \ + __asm __volatile (LOCK_PREFIX "addq %q1, %0" \ : "=m" (*mem) \ : "ir" ((long) (value)), "m" (*mem)); \ }) @@ -155,19 +155,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_add_negative(mem, value) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addw %w2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addl %2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else \ - __asm __volatile (LOCK "addq %q2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" ((long) (value)), "m" (*mem)); \ __result; }) @@ -176,19 +176,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_add_zero(mem, value) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addl %2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else \ - __asm __volatile (LOCK "addq %q2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" ((long) (value)), "m" (*mem)); \ __result; }) @@ -196,19 +196,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_increment(mem) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "incb %b0" \ + __asm __volatile (LOCK_PREFIX "incb %b0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "incw %w0" \ + __asm __volatile (LOCK_PREFIX "incw %w0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "incl %0" \ + __asm __volatile (LOCK_PREFIX "incl %0" \ : "=m" (*mem) \ : "m" (*mem)); \ else \ - __asm __volatile (LOCK "incq %q0" \ + __asm __volatile (LOCK_PREFIX "incq %q0" \ : "=m" (*mem) \ : "m" (*mem)); \ }) @@ -217,19 +217,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_increment_and_test(mem) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "incb %b0; sete %1" \ + __asm __volatile (LOCK_PREFIX "incb %b0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "incw %w0; sete %1" \ + __asm __volatile (LOCK_PREFIX "incw %w0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "incl %0; sete %1" \ + __asm __volatile (LOCK_PREFIX "incl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else \ - __asm __volatile (LOCK "incq %q0; sete %1" \ + __asm __volatile (LOCK_PREFIX "incq %q0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ __result; }) @@ -237,19 +237,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_decrement(mem) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "decb %b0" \ + __asm __volatile (LOCK_PREFIX "decb %b0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "decw %w0" \ + __asm __volatile (LOCK_PREFIX "decw %w0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "decl %0" \ + __asm __volatile (LOCK_PREFIX "decl %0" \ : "=m" (*mem) \ : "m" (*mem)); \ else \ - __asm __volatile (LOCK "decq %q0" \ + __asm __volatile (LOCK_PREFIX "decq %q0" \ : "=m" (*mem) \ : "m" (*mem)); \ }) @@ -258,19 +258,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_decrement_and_test(mem) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "decb %b0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decb %b0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "decw %w0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decw %w0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "decl %0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else \ - __asm __volatile (LOCK "decq %q0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decq %q0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ __result; }) @@ -278,23 +278,23 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_set(mem, bit) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "orb %b2, %0" \ + __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1L << (bit))); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "orw %w2, %0" \ + __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1L << (bit))); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "orl %2, %0" \ + __asm __volatile (LOCK_PREFIX "orl %2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1L << (bit))); \ else if (__builtin_constant_p (bit) && (bit) < 32) \ - __asm __volatile (LOCK "orq %2, %0" \ + __asm __volatile (LOCK_PREFIX "orq %2, %0" \ : "=m" (*mem) \ : "m" (*mem), "i" (1L << (bit))); \ else \ - __asm __volatile (LOCK "orq %q2, %0" \ + __asm __volatile (LOCK_PREFIX "orq %q2, %0" \ : "=m" (*mem) \ : "m" (*mem), "r" (1UL << (bit))); \ }) @@ -303,19 +303,19 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_test_set(mem, bit) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "btsb %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "btsw %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "btsl %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsl %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else \ - __asm __volatile (LOCK "btsq %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsq %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ __result; }) -- 2.7.4