x86: Remove unnecessary LOCK/LOCK_PREFIX macros.
authorKeir Fraser <keir@xen.org>
Thu, 16 Dec 2010 18:46:55 +0000 (18:46 +0000)
committerKeir Fraser <keir@xen.org>
Thu, 16 Dec 2010 18:46:55 +0000 (18:46 +0000)
We don't support !CONFIG_SMP.

Signed-off-by: Keir Fraser <keir@xen.org>
xen/include/asm-ia64/config.h
xen/include/asm-x86/atomic.h
xen/include/asm-x86/bitops.h
xen/include/asm-x86/system.h
xen/include/asm-x86/x86_32/system.h
xen/include/asm-x86/x86_64/system.h

index 8194b4476cf4984a614da686cd00a5ba94c8069a..8e93a458143f0df26a0530d38ab778c7afbc04d4 100644 (file)
@@ -85,9 +85,6 @@ typedef unsigned long paddr_t;
 #define CLEAR_BITMAP(name,bits) \
        memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long))
 
-// FIXME?: x86-ism used in xen/mm.h
-#define LOCK_PREFIX
-
 extern unsigned long total_pages;
 extern unsigned long xen_pstart;
 extern unsigned long xenheap_size;
index 17becc5a7e283252df49f6feec3bc11cb2e70ac1..c73d1ce7259c7c0842f5835b2f2c11ffe51e225c 100644 (file)
@@ -4,12 +4,6 @@
 #include <xen/config.h>
 #include <asm/system.h>
 
-#ifdef CONFIG_SMP
-#define LOCK "lock ; "
-#else
-#define LOCK ""
-#endif
-
 /*
  * NB. I've pushed the volatile qualifier into the operations. This allows
  * fast accessors such as _atomic_read() and _atomic_set() which don't give
@@ -48,7 +42,7 @@ typedef struct { int counter; } atomic_t;
 static __inline__ void atomic_add(int i, atomic_t *v)
 {
        asm volatile(
-               LOCK "addl %1,%0"
+               "lock; addl %1,%0"
                :"=m" (*(volatile int *)&v->counter)
                :"ir" (i), "m" (*(volatile int *)&v->counter));
 }
@@ -63,7 +57,7 @@ static __inline__ void atomic_add(int i, atomic_t *v)
 static __inline__ void atomic_sub(int i, atomic_t *v)
 {
        asm volatile(
-               LOCK "subl %1,%0"
+               "lock; subl %1,%0"
                :"=m" (*(volatile int *)&v->counter)
                :"ir" (i), "m" (*(volatile int *)&v->counter));
 }
@@ -82,7 +76,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
        unsigned char c;
 
        asm volatile(
-               LOCK "subl %2,%0; sete %1"
+               "lock; subl %2,%0; sete %1"
                :"=m" (*(volatile int *)&v->counter), "=qm" (c)
                :"ir" (i), "m" (*(volatile int *)&v->counter) : "memory");
        return c;
@@ -97,7 +91,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
 static __inline__ void atomic_inc(atomic_t *v)
 {
        asm volatile(
-               LOCK "incl %0"
+               "lock; incl %0"
                :"=m" (*(volatile int *)&v->counter)
                :"m" (*(volatile int *)&v->counter));
 }
@@ -111,7 +105,7 @@ static __inline__ void atomic_inc(atomic_t *v)
 static __inline__ void atomic_dec(atomic_t *v)
 {
        asm volatile(
-               LOCK "decl %0"
+               "lock; decl %0"
                :"=m" (*(volatile int *)&v->counter)
                :"m" (*(volatile int *)&v->counter));
 }
@@ -129,7 +123,7 @@ static __inline__ int atomic_dec_and_test(atomic_t *v)
        unsigned char c;
 
        asm volatile(
-               LOCK "decl %0; sete %1"
+               "lock; decl %0; sete %1"
                :"=m" (*(volatile int *)&v->counter), "=qm" (c)
                :"m" (*(volatile int *)&v->counter) : "memory");
        return c != 0;
@@ -148,7 +142,7 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)
        unsigned char c;
 
        asm volatile(
-               LOCK "incl %0; sete %1"
+               "lock; incl %0; sete %1"
                :"=m" (*(volatile int *)&v->counter), "=qm" (c)
                :"m" (*(volatile int *)&v->counter) : "memory");
        return c != 0;
@@ -168,7 +162,7 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)
        unsigned char c;
 
        asm volatile(
-               LOCK "addl %2,%0; sets %1"
+               "lock; addl %2,%0; sets %1"
                :"=m" (*(volatile int *)&v->counter), "=qm" (c)
                :"ir" (i), "m" (*(volatile int *)&v->counter) : "memory");
        return c;
index 8237381f81a48ef8c2046077fc6b53bdf3a26732..0bc1952e79db28ac33d8f6b9d4803d981d40bd19 100644 (file)
@@ -7,12 +7,6 @@
 
 #include <xen/config.h>
 
-#ifdef CONFIG_SMP
-#define LOCK_PREFIX "lock ; "
-#else
-#define LOCK_PREFIX ""
-#endif
-
 /*
  * We specify the memory operand as both input and output because the memory
  * operand is both read from and written to. Since the operand is in fact a
@@ -41,8 +35,7 @@ extern void __bitop_bad_size(void);
 static inline void set_bit(int nr, volatile void *addr)
 {
     asm volatile (
-        LOCK_PREFIX
-        "btsl %1,%0"
+        "lock; btsl %1,%0"
         : "=m" (ADDR)
         : "Ir" (nr), "m" (ADDR) : "memory");
 }
@@ -85,8 +78,7 @@ static inline void __set_bit(int nr, volatile void *addr)
 static inline void clear_bit(int nr, volatile void *addr)
 {
     asm volatile (
-        LOCK_PREFIX
-        "btrl %1,%0"
+        "lock; btrl %1,%0"
         : "=m" (ADDR)
         : "Ir" (nr), "m" (ADDR) : "memory");
 }
@@ -152,8 +144,7 @@ static inline void __change_bit(int nr, volatile void *addr)
 static inline void change_bit(int nr, volatile void *addr)
 {
     asm volatile (
-        LOCK_PREFIX
-        "btcl %1,%0"
+        "lock; btcl %1,%0"
         : "=m" (ADDR)
         : "Ir" (nr), "m" (ADDR) : "memory");
 }
@@ -175,8 +166,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
     int oldbit;
 
     asm volatile (
-        LOCK_PREFIX
-        "btsl %2,%1\n\tsbbl %0,%0"
+        "lock; btsl %2,%1\n\tsbbl %0,%0"
         : "=r" (oldbit), "=m" (ADDR)
         : "Ir" (nr), "m" (ADDR) : "memory");
     return oldbit;
@@ -223,8 +213,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
     int oldbit;
 
     asm volatile (
-        LOCK_PREFIX
-        "btrl %2,%1\n\tsbbl %0,%0"
+        "lock; btrl %2,%1\n\tsbbl %0,%0"
         : "=r" (oldbit), "=m" (ADDR)
         : "Ir" (nr), "m" (ADDR) : "memory");
     return oldbit;
@@ -287,8 +276,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr)
     int oldbit;
 
     asm volatile (
-        LOCK_PREFIX
-        "btcl %2,%1\n\tsbbl %0,%0"
+        "lock; btcl %2,%1\n\tsbbl %0,%0"
         : "=r" (oldbit), "=m" (ADDR)
         : "Ir" (nr), "m" (ADDR) : "memory");
     return oldbit;
index 52816da1c9a3746c122c182bd48a6f2d1ddac9a0..a57d35de815b7affc75733eeef017264bfe07eed 100644 (file)
@@ -91,14 +91,14 @@ static always_inline unsigned long __cmpxchg(
     switch ( size )
     {
     case 1:
-        asm volatile ( LOCK_PREFIX "cmpxchgb %b1,%2"
+        asm volatile ( "lock; cmpxchgb %b1,%2"
                        : "=a" (prev)
                        : "q" (new), "m" (*__xg((volatile void *)ptr)),
                        "0" (old)
                        : "memory" );
         return prev;
     case 2:
-        asm volatile ( LOCK_PREFIX "cmpxchgw %w1,%2"
+        asm volatile ( "lock; cmpxchgw %w1,%2"
                        : "=a" (prev)
                        : "r" (new), "m" (*__xg((volatile void *)ptr)),
                        "0" (old)
@@ -106,7 +106,7 @@ static always_inline unsigned long __cmpxchg(
         return prev;
 #if defined(__i386__)
     case 4:
-        asm volatile ( LOCK_PREFIX "cmpxchgl %1,%2"
+        asm volatile ( "lock; cmpxchgl %1,%2"
                        : "=a" (prev)
                        : "r" (new), "m" (*__xg((volatile void *)ptr)),
                        "0" (old)
@@ -114,14 +114,14 @@ static always_inline unsigned long __cmpxchg(
         return prev;
 #elif defined(__x86_64__)
     case 4:
-        asm volatile ( LOCK_PREFIX "cmpxchgl %k1,%2"
+        asm volatile ( "lock; cmpxchgl %k1,%2"
                        : "=a" (prev)
                        : "r" (new), "m" (*__xg((volatile void *)ptr)),
                        "0" (old)
                        : "memory" );
         return prev;
     case 8:
-        asm volatile ( LOCK_PREFIX "cmpxchgq %1,%2"
+        asm volatile ( "lock; cmpxchgq %1,%2"
                        : "=a" (prev)
                        : "r" (new), "m" (*__xg((volatile void *)ptr)),
                        "0" (old)
index 56ef751ec7fbe06e15b962e358fc7c377d67b0cc..0ec103d449a10baea642d579d6f4d745e548444a 100644 (file)
@@ -6,7 +6,7 @@ static always_inline unsigned long long __cmpxchg8b(
 {
     unsigned long long prev;
     asm volatile (
-        LOCK_PREFIX "cmpxchg8b %3"
+        "lock; cmpxchg8b %3"
         : "=A" (prev)
         : "c" ((u32)(new>>32)), "b" ((u32)new),
           "m" (*__xg((volatile void *)ptr)), "0" (old)
@@ -43,7 +43,7 @@ static always_inline unsigned long long __cmpxchg8b(
  */
 #define __cmpxchg_user(_p,_o,_n,_isuff,_oppre,_regtype)                 \
     asm volatile (                                                      \
-        "1: " LOCK_PREFIX "cmpxchg"_isuff" %"_oppre"2,%3\n"             \
+        "1: lock; cmpxchg"_isuff" %"_oppre"2,%3\n"                      \
         "2:\n"                                                          \
         ".section .fixup,\"ax\"\n"                                      \
         "3:     movl $1,%1\n"                                           \
@@ -72,7 +72,7 @@ static always_inline unsigned long long __cmpxchg8b(
         break;                                                          \
     case 8:                                                             \
         asm volatile (                                                  \
-            "1: " LOCK_PREFIX "cmpxchg8b %4\n"                          \
+            "1: lock; cmpxchg8b %4\n"                                   \
             "2:\n"                                                      \
             ".section .fixup,\"ax\"\n"                                  \
             "3:     movl $1,%1\n"                                       \
index fa9b3118b063b4a78e086c40d70b7c286915f25d..3d0a294e3a58da31bda571628eb6968406c001a0 100644 (file)
@@ -13,7 +13,7 @@
  */
 #define __cmpxchg_user(_p,_o,_n,_isuff,_oppre,_regtype)                 \
     asm volatile (                                                      \
-        "1: " LOCK_PREFIX "cmpxchg"_isuff" %"_oppre"2,%3\n"             \
+        "1: lock; cmpxchg"_isuff" %"_oppre"2,%3\n"                      \
         "2:\n"                                                          \
         ".section .fixup,\"ax\"\n"                                      \
         "3:     movl $1,%1\n"                                           \