Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96352
b: refs/heads/master
c: eb2b4e6
h: refs/heads/master
v: v3
  • Loading branch information
Simon Holm Thøgersen authored and Thomas Gleixner committed May 10, 2008
1 parent b2153dd commit 653968e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9096bd7a66efbe406910365c5206a32eed3875af
refs/heads/master: eb2b4e682a6d5b4779a7f1a6a8419982919795f6
37 changes: 17 additions & 20 deletions trunk/include/asm-x86/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
/* Technically wrong, but this avoids compilation errors on some gcc
versions. */
#define ADDR "=m" (*(volatile long *)addr)
#define BIT_ADDR "=m" (((volatile int *)addr)[nr >> 5])
#define ADDR "=m" (*(volatile long *) addr)
#else
#define ADDR "+m" (*(volatile long *) addr)
#define BIT_ADDR "+m" (((volatile int *)addr)[nr >> 5])
#endif
#define BASE_ADDR "m" (*(volatile int *)addr)

/**
* set_bit - Atomically set a bit in memory
Expand Down Expand Up @@ -77,7 +74,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 "btr %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR);
asm volatile(LOCK_PREFIX "btr %1,%0" : ADDR : "Ir" (nr));
}

/*
Expand All @@ -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)
{
asm volatile("btr %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR);
asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
}

/*
Expand Down Expand Up @@ -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)
{
asm volatile("btc %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR);
asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
}

/**
Expand All @@ -145,7 +142,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 "btc %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR);
asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr));
}

/**
Expand Down Expand Up @@ -191,9 +188,10 @@ static inline int __test_and_set_bit(int nr, volatile void *addr)
{
int oldbit;

asm volatile("bts %2,%3\n\t"
"sbb %0,%0"
: "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR);
asm("bts %2,%1\n\t"
"sbb %0,%0"
: "=r" (oldbit), ADDR
: "Ir" (nr));
return oldbit;
}

Expand Down Expand Up @@ -229,9 +227,10 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr)
{
int oldbit;

asm volatile("btr %2,%3\n\t"
asm volatile("btr %2,%1\n\t"
"sbb %0,%0"
: "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR);
: "=r" (oldbit), ADDR
: "Ir" (nr));
return oldbit;
}

Expand All @@ -240,9 +239,10 @@ static inline int __test_and_change_bit(int nr, volatile void *addr)
{
int oldbit;

asm volatile("btc %2,%3\n\t"
asm volatile("btc %2,%1\n\t"
"sbb %0,%0"
: "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR);
: "=r" (oldbit), ADDR
: "Ir" (nr) : "memory");

return oldbit;
}
Expand Down Expand Up @@ -276,11 +276,10 @@ static inline int variable_test_bit(int nr, volatile const void *addr)
{
int oldbit;

asm volatile("bt %2,%3\n\t"
asm volatile("bt %2,%1\n\t"
"sbb %0,%0"
: "=r" (oldbit)
: "m" (((volatile const int *)addr)[nr >> 5]),
"Ir" (nr), BASE_ADDR);
: "m" (*(unsigned long *)addr), "Ir" (nr));

return oldbit;
}
Expand Down Expand Up @@ -397,8 +396,6 @@ static inline int fls(int x)
}
#endif /* __KERNEL__ */

#undef BASE_ADDR
#undef BIT_ADDR
#undef ADDR

static inline void set_bit_string(unsigned long *bitmap,
Expand Down

0 comments on commit 653968e

Please sign in to comment.