X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-x86_64%2Flocal.h;h=cd17945bf2181d1bd574b44818601e018ee806aa;hb=47b9c3b1e6afa3c40e3ac1822cd13946567b5955;hp=169c223a8452177b6c37c02be7356aabc299da7d;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=linux-2.6 diff --git a/include/asm-x86_64/local.h b/include/asm-x86_64/local.h index 169c223a84..cd17945bf2 100644 --- a/include/asm-x86_64/local.h +++ b/include/asm-x86_64/local.h @@ -5,7 +5,7 @@ typedef struct { - volatile unsigned int counter; + volatile long counter; } local_t; #define LOCAL_INIT(i) { (i) } @@ -13,39 +13,40 @@ typedef struct #define local_read(v) ((v)->counter) #define local_set(v,i) (((v)->counter) = (i)) -static __inline__ void local_inc(local_t *v) +static inline void local_inc(local_t *v) { __asm__ __volatile__( - "incl %0" + "incq %0" :"=m" (v->counter) :"m" (v->counter)); } -static __inline__ void local_dec(local_t *v) +static inline void local_dec(local_t *v) { __asm__ __volatile__( - "decl %0" + "decq %0" :"=m" (v->counter) :"m" (v->counter)); } -static __inline__ void local_add(unsigned long i, local_t *v) +static inline void local_add(long i, local_t *v) { __asm__ __volatile__( - "addl %1,%0" + "addq %1,%0" :"=m" (v->counter) :"ir" (i), "m" (v->counter)); } -static __inline__ void local_sub(unsigned long i, local_t *v) +static inline void local_sub(long i, local_t *v) { __asm__ __volatile__( - "subl %1,%0" + "subq %1,%0" :"=m" (v->counter) :"ir" (i), "m" (v->counter)); } -/* On x86, these are no better than the atomic variants. */ +/* On x86-64 these are better than the atomic variants on SMP kernels + because they dont use a lock prefix. */ #define __local_inc(l) local_inc(l) #define __local_dec(l) local_dec(l) #define __local_add(i,l) local_add((i),(l))