Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182582
b: refs/heads/master
c: 0d1622d
h: refs/heads/master
v: v3
  • Loading branch information
Avi Kivity authored and H. Peter Anvin committed Feb 13, 2010
1 parent 184ecf2 commit 012f993
Show file tree
Hide file tree
Showing 2 changed files with 6 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: 1838ef1d782f7527e6defe87e180598622d2d071
refs/heads/master: 0d1622d7f526311d87d7da2ee7dd14b73e45d3fc
25 changes: 5 additions & 20 deletions trunk/arch/x86/include/asm/rwsem.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,34 +232,19 @@ static inline void __up_write(struct rw_semaphore *sem)
*/
static inline void __downgrade_write(struct rw_semaphore *sem)
{
#ifdef CONFIG_X86_64
# if RWSEM_WAITING_BIAS != -0x100000000
# error "This code assumes RWSEM_WAITING_BIAS == -2^32"
# endif

/* 64-bit immediates are special and expensive, and not needed here */
asm volatile("# beginning __downgrade_write\n\t"
LOCK_PREFIX "incl 4(%1)\n\t"
/* transitions 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 */
" jns 1f\n\t"
" call call_rwsem_downgrade_wake\n"
"1:\n\t"
"# ending __downgrade_write\n"
: "+m" (sem->count)
: "a" (sem)
: "memory", "cc");
#else
asm volatile("# beginning __downgrade_write\n\t"
LOCK_PREFIX _ASM_ADD "%2,(%1)\n\t"
/* transitions 0xZZZZ0001 -> 0xYYYY0001 */
/*
* transitions 0xZZZZ0001 -> 0xYYYY0001 (i386)
* 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64)
*/
" jns 1f\n\t"
" call call_rwsem_downgrade_wake\n"
"1:\n\t"
"# ending __downgrade_write\n"
: "+m" (sem->count)
: "a" (sem), "i" (-RWSEM_WAITING_BIAS)
: "a" (sem), "er" (-RWSEM_WAITING_BIAS)
: "memory", "cc");
#endif
}

/*
Expand Down

0 comments on commit 012f993

Please sign in to comment.