Commit a706af33 authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] Re: rwsem update

The attached patch fixes the compilation problems Andrew Morton has been
seeing with the rw-semaphores in the kernel when using gcc 2.95.3 with
-O1.
parent bf3493c9
...@@ -111,8 +111,8 @@ LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value ...@@ -111,8 +111,8 @@ LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value
" jmp 1b\n" " jmp 1b\n"
LOCK_SECTION_END LOCK_SECTION_END
"# ending down_read\n\t" "# ending down_read\n\t"
: "+m"(sem->count) : "=m"(sem->count)
: "a"(sem) : "a"(sem), "m"(sem->count)
: "memory", "cc"); : "memory", "cc");
} }
...@@ -126,8 +126,8 @@ static inline void __down_write(struct rw_semaphore *sem) ...@@ -126,8 +126,8 @@ static inline void __down_write(struct rw_semaphore *sem)
tmp = RWSEM_ACTIVE_WRITE_BIAS; tmp = RWSEM_ACTIVE_WRITE_BIAS;
__asm__ __volatile__( __asm__ __volatile__(
"# beginning down_write\n\t" "# beginning down_write\n\t"
LOCK_PREFIX " xadd %0,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */
" testl %0,%0\n\t" /* was the count 0 before? */ " testl %%edx,%%edx\n\t" /* was the count 0 before? */
" jnz 2f\n\t" /* jump if we weren't granted the lock */ " jnz 2f\n\t" /* jump if we weren't granted the lock */
"1:\n\t" "1:\n\t"
LOCK_SECTION_START("") LOCK_SECTION_START("")
...@@ -138,8 +138,8 @@ LOCK_PREFIX " xadd %0,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old ...@@ -138,8 +138,8 @@ LOCK_PREFIX " xadd %0,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old
" jmp 1b\n" " jmp 1b\n"
LOCK_SECTION_END LOCK_SECTION_END
"# ending down_write" "# ending down_write"
: "+d"(tmp), "+m"(sem->count) : "=m"(sem->count), "=d"(tmp)
: "a"(sem) : "a"(sem), "1"(tmp), "m"(sem->count)
: "memory", "cc"); : "memory", "cc");
} }
...@@ -164,8 +164,8 @@ LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old valu ...@@ -164,8 +164,8 @@ LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old valu
" jmp 1b\n" " jmp 1b\n"
LOCK_SECTION_END LOCK_SECTION_END
"# ending __up_read\n" "# ending __up_read\n"
: /*"+m"(sem->count),*/ "+d"(tmp) : "=m"(sem->count), "=d"(tmp)
: "a"(sem) : "a"(sem), "1"(tmp), "m"(sem->count)
: "memory", "cc"); : "memory", "cc");
} }
...@@ -190,8 +190,8 @@ LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> ...@@ -190,8 +190,8 @@ LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 ->
" jmp 1b\n" " jmp 1b\n"
LOCK_SECTION_END LOCK_SECTION_END
"# ending __up_write\n" "# ending __up_write\n"
: "+m"(sem->count) : "=m"(sem->count)
: "a"(sem), "i"(-RWSEM_ACTIVE_WRITE_BIAS) : "a"(sem), "i"(-RWSEM_ACTIVE_WRITE_BIAS), "m"(sem->count)
: "memory", "cc", "edx"); : "memory", "cc", "edx");
} }
...@@ -202,8 +202,8 @@ static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) ...@@ -202,8 +202,8 @@ static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
{ {
__asm__ __volatile__( __asm__ __volatile__(
LOCK_PREFIX "addl %1,%0" LOCK_PREFIX "addl %1,%0"
:"=m"(sem->count) : "=m"(sem->count)
:"ir"(delta), "m"(sem->count)); : "ir"(delta), "m"(sem->count));
} }
/* /*
......
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