]> err.no Git - linux-2.6/blobdiff - include/asm-x86/atomic_64.h
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / include / asm-x86 / atomic_64.h
index fe589c153db8c0eb7edf188c0107e54c636af6b7..91c7d03e65bcc077f4bbffe98cf662ee47bf33dc 100644 (file)
@@ -228,7 +228,7 @@ static inline void atomic64_add(long i, atomic64_t *v)
 {
        asm volatile(LOCK_PREFIX "addq %1,%0"
                     : "=m" (v->counter)
-                    : "ir" (i), "m" (v->counter));
+                    : "er" (i), "m" (v->counter));
 }
 
 /**
@@ -242,7 +242,7 @@ static inline void atomic64_sub(long i, atomic64_t *v)
 {
        asm volatile(LOCK_PREFIX "subq %1,%0"
                     : "=m" (v->counter)
-                    : "ir" (i), "m" (v->counter));
+                    : "er" (i), "m" (v->counter));
 }
 
 /**
@@ -260,7 +260,7 @@ static inline int atomic64_sub_and_test(long i, atomic64_t *v)
 
        asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
                     : "=m" (v->counter), "=qm" (c)
-                    : "ir" (i), "m" (v->counter) : "memory");
+                    : "er" (i), "m" (v->counter) : "memory");
        return c;
 }
 
@@ -341,7 +341,7 @@ static inline int atomic64_add_negative(long i, atomic64_t *v)
 
        asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
                     : "=m" (v->counter), "=qm" (c)
-                    : "ir" (i), "m" (v->counter) : "memory");
+                    : "er" (i), "m" (v->counter) : "memory");
        return c;
 }
 
@@ -425,6 +425,32 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
        return c != (u);
 }
 
+/**
+ * atomic_inc_short - increment of a short integer
+ * @v: pointer to type int
+ *
+ * Atomically adds 1 to @v
+ * Returns the new value of @u
+ */
+static inline short int atomic_inc_short(short int *v)
+{
+       asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
+       return *v;
+}
+
+/**
+ * atomic_or_long - OR of two long integers
+ * @v1: pointer to type unsigned long
+ * @v2: pointer to type unsigned long
+ *
+ * Atomically ORs @v1 and @v2
+ * Returns the result of the OR
+ */
+static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
+{
+       asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2));
+}
+
 #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
 
 /* These are x86-specific, used by some header files */