diff options
Diffstat (limited to 'arch/x86/include/asm/local.h')
| -rw-r--r-- | arch/x86/include/asm/local.h | 49 | 
1 files changed, 6 insertions, 43 deletions
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h index 2e9972468a5..4ad6560847b 100644 --- a/arch/x86/include/asm/local.h +++ b/arch/x86/include/asm/local.h @@ -3,8 +3,7 @@  #include <linux/percpu.h> -#include <asm/system.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/asm.h>  typedef struct { @@ -53,12 +52,7 @@ static inline void local_sub(long i, local_t *l)   */  static inline int local_sub_and_test(long i, local_t *l)  { -	unsigned char c; - -	asm volatile(_ASM_SUB "%2,%0; sete %1" -		     : "+m" (l->a.counter), "=qm" (c) -		     : "ir" (i) : "memory"); -	return c; +	GEN_BINARY_RMWcc(_ASM_SUB, l->a.counter, "er", i, "%0", "e");  }  /** @@ -71,12 +65,7 @@ static inline int local_sub_and_test(long i, local_t *l)   */  static inline int local_dec_and_test(local_t *l)  { -	unsigned char c; - -	asm volatile(_ASM_DEC "%0; sete %1" -		     : "+m" (l->a.counter), "=qm" (c) -		     : : "memory"); -	return c != 0; +	GEN_UNARY_RMWcc(_ASM_DEC, l->a.counter, "%0", "e");  }  /** @@ -89,12 +78,7 @@ static inline int local_dec_and_test(local_t *l)   */  static inline int local_inc_and_test(local_t *l)  { -	unsigned char c; - -	asm volatile(_ASM_INC "%0; sete %1" -		     : "+m" (l->a.counter), "=qm" (c) -		     : : "memory"); -	return c != 0; +	GEN_UNARY_RMWcc(_ASM_INC, l->a.counter, "%0", "e");  }  /** @@ -108,12 +92,7 @@ static inline int local_inc_and_test(local_t *l)   */  static inline int local_add_negative(long i, local_t *l)  { -	unsigned char c; - -	asm volatile(_ASM_ADD "%2,%0; sets %1" -		     : "+m" (l->a.counter), "=qm" (c) -		     : "ir" (i) : "memory"); -	return c; +	GEN_BINARY_RMWcc(_ASM_ADD, l->a.counter, "er", i, "%0", "s");  }  /** @@ -125,27 +104,11 @@ static inline int local_add_negative(long i, local_t *l)   */  static inline long local_add_return(long i, local_t *l)  { -	long __i; -#ifdef CONFIG_M386 -	unsigned long flags; -	if (unlikely(boot_cpu_data.x86 <= 3)) -		goto no_xadd; -#endif -	/* Modern 486+ processor */ -	__i = i; +	long __i = i;  	asm volatile(_ASM_XADD "%0, %1;"  		     : "+r" (i), "+m" (l->a.counter)  		     : : "memory");  	return i + __i; - -#ifdef CONFIG_M386 -no_xadd: /* Legacy 386 processor */ -	local_irq_save(flags); -	__i = local_read(l); -	local_set(l, i + __i); -	local_irq_restore(flags); -	return i + __i; -#endif  }  static inline long local_sub_return(long i, local_t *l)  | 
