Commit eb2b4e68 authored by Simon Holm Thøgersen's avatar Simon Holm Thøgersen Committed by Thomas Gleixner

x86: revert commit 709f744f ("x86: bitops asm constraint fixes")

709f744f causes my computer to freeze during the start up of X and my
login manger (GDM). It gets to the point where it has shown the default
X mouse cursor logo (a big X / cross) and does not respond to anything
from that point on.

This worked fine before 709f744f, and it works fine with 709f744f
reverted on top of Linus' current tree (f74d505b). The revert had
conflicts, as far as I can tell due to white space changes. The diff I
ended up with is below.

It is 100% reproducible.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 9096bd7a
...@@ -23,13 +23,10 @@ ...@@ -23,13 +23,10 @@
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
/* Technically wrong, but this avoids compilation errors on some gcc /* Technically wrong, but this avoids compilation errors on some gcc
versions. */ versions. */
#define ADDR "=m" (*(volatile long *)addr) #define ADDR "=m" (*(volatile long *) addr)
#define BIT_ADDR "=m" (((volatile int *)addr)[nr >> 5])
#else #else
#define ADDR "+m" (*(volatile long *) addr) #define ADDR "+m" (*(volatile long *) addr)
#define BIT_ADDR "+m" (((volatile int *)addr)[nr >> 5])
#endif #endif
#define BASE_ADDR "m" (*(volatile int *)addr)
/** /**
* set_bit - Atomically set a bit in memory * set_bit - Atomically set a bit in memory
...@@ -77,7 +74,7 @@ static inline void __set_bit(int nr, volatile void *addr) ...@@ -77,7 +74,7 @@ static inline void __set_bit(int nr, volatile void *addr)
*/ */
static inline void clear_bit(int nr, volatile void *addr) static inline void clear_bit(int nr, volatile void *addr)
{ {
asm volatile(LOCK_PREFIX "btr %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); asm volatile(LOCK_PREFIX "btr %1,%0" : ADDR : "Ir" (nr));
} }
/* /*
...@@ -96,7 +93,7 @@ static inline void clear_bit_unlock(unsigned nr, volatile void *addr) ...@@ -96,7 +93,7 @@ static inline void clear_bit_unlock(unsigned nr, volatile void *addr)
static inline void __clear_bit(int nr, volatile void *addr) static inline void __clear_bit(int nr, volatile void *addr)
{ {
asm volatile("btr %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
} }
/* /*
...@@ -131,7 +128,7 @@ static inline void __clear_bit_unlock(unsigned nr, volatile void *addr) ...@@ -131,7 +128,7 @@ static inline void __clear_bit_unlock(unsigned nr, volatile void *addr)
*/ */
static inline void __change_bit(int nr, volatile void *addr) static inline void __change_bit(int nr, volatile void *addr)
{ {
asm volatile("btc %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
} }
/** /**
...@@ -145,7 +142,7 @@ static inline void __change_bit(int nr, volatile void *addr) ...@@ -145,7 +142,7 @@ static inline void __change_bit(int nr, volatile void *addr)
*/ */
static inline void change_bit(int nr, volatile void *addr) static inline void change_bit(int nr, volatile void *addr)
{ {
asm volatile(LOCK_PREFIX "btc %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr));
} }
/** /**
...@@ -191,9 +188,10 @@ static inline int __test_and_set_bit(int nr, volatile void *addr) ...@@ -191,9 +188,10 @@ static inline int __test_and_set_bit(int nr, volatile void *addr)
{ {
int oldbit; int oldbit;
asm volatile("bts %2,%3\n\t" asm("bts %2,%1\n\t"
"sbb %0,%0" "sbb %0,%0"
: "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR); : "=r" (oldbit), ADDR
: "Ir" (nr));
return oldbit; return oldbit;
} }
...@@ -229,9 +227,10 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr) ...@@ -229,9 +227,10 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr)
{ {
int oldbit; int oldbit;
asm volatile("btr %2,%3\n\t" asm volatile("btr %2,%1\n\t"
"sbb %0,%0" "sbb %0,%0"
: "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR); : "=r" (oldbit), ADDR
: "Ir" (nr));
return oldbit; return oldbit;
} }
...@@ -240,9 +239,10 @@ static inline int __test_and_change_bit(int nr, volatile void *addr) ...@@ -240,9 +239,10 @@ static inline int __test_and_change_bit(int nr, volatile void *addr)
{ {
int oldbit; int oldbit;
asm volatile("btc %2,%3\n\t" asm volatile("btc %2,%1\n\t"
"sbb %0,%0" "sbb %0,%0"
: "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR); : "=r" (oldbit), ADDR
: "Ir" (nr) : "memory");
return oldbit; return oldbit;
} }
...@@ -276,11 +276,10 @@ static inline int variable_test_bit(int nr, volatile const void *addr) ...@@ -276,11 +276,10 @@ static inline int variable_test_bit(int nr, volatile const void *addr)
{ {
int oldbit; int oldbit;
asm volatile("bt %2,%3\n\t" asm volatile("bt %2,%1\n\t"
"sbb %0,%0" "sbb %0,%0"
: "=r" (oldbit) : "=r" (oldbit)
: "m" (((volatile const int *)addr)[nr >> 5]), : "m" (*(unsigned long *)addr), "Ir" (nr));
"Ir" (nr), BASE_ADDR);
return oldbit; return oldbit;
} }
...@@ -397,8 +396,6 @@ static inline int fls(int x) ...@@ -397,8 +396,6 @@ static inline int fls(int x)
} }
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#undef BASE_ADDR
#undef BIT_ADDR
#undef ADDR #undef ADDR
static inline void set_bit_string(unsigned long *bitmap, static inline void set_bit_string(unsigned long *bitmap,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment