Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88908
b: refs/heads/master
c: 709f744
h: refs/heads/master
v: v3
  • Loading branch information
Jan Beulich authored and Ingo Molnar committed Apr 17, 2008
1 parent b5af4d6 commit afe6a59
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 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: 6e908947b4995bc0e551a8257c586d5c3e428201
refs/heads/master: 709f744f18ebc3a810d29c8d5502bf20c3cecc70
43 changes: 24 additions & 19 deletions trunk/include/asm-x86/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
/* 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])
#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 @@ -79,9 +82,8 @@ 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,%0"
: ADDR
: "Ir" (nr));
asm volatile(LOCK_PREFIX "btr %1,%2"
: BIT_ADDR : "Ir" (nr), BASE_ADDR);
}

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

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

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

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

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

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

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

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

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

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

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

return oldbit;
}
Expand All @@ -310,6 +313,8 @@ static int test_bit(int nr, const volatile unsigned long *addr);
constant_test_bit((nr),(addr)) : \
variable_test_bit((nr),(addr)))

#undef BASE_ADDR
#undef BIT_ADDR
#undef ADDR

#ifdef CONFIG_X86_32
Expand Down

0 comments on commit afe6a59

Please sign in to comment.