* [PATCH] rw-semaphore asm constraints patch fix
@ 2002-04-08 12:43 David Howells
2002-04-08 15:59 ` Linus Torvalds
0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2002-04-08 12:43 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, Andrew Morton, jfs-discussion
Hi Linus,
The attached patch should fix the compile error that asm-i386/rwsem.h causes
with old gcc's whilst maintaining the asm constraints correctly.
David
diff -Nru a/include/asm-i386/rwsem.h b/include/asm-i386/rwsem.h
--- a/include/asm-i386/rwsem.h Fri Apr 5 16:56:35 2002
+++ b/include/asm-i386/rwsem.h Fri Apr 5 16:56:35 2002
@@ -164,7 +164,7 @@
" jmp 1b\n"
LOCK_SECTION_END
"# ending __up_read\n"
- : /*"+m"(sem->count),*/ "+d"(tmp)
- : "a"(sem)
+ : "=m"(sem->count), "=d"(tmp)
+ : "0"(sem->count), "1"(tmp), "a"(sem)
: "memory", "cc");
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rw-semaphore asm constraints patch fix
2002-04-08 12:43 [PATCH] rw-semaphore asm constraints patch fix David Howells
@ 2002-04-08 15:59 ` Linus Torvalds
0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2002-04-08 15:59 UTC (permalink / raw)
To: David Howells; +Cc: linux-kernel, Andrew Morton, jfs-discussion
On Mon, 8 Apr 2002, David Howells wrote:
>
> The attached patch should fix the compile error that asm-i386/rwsem.h causes
> with old gcc's whilst maintaining the asm constraints correctly.
Doesn't work.
> + : "=m"(sem->count), "=d"(tmp)
> + : "0"(sem->count), "1"(tmp), "a"(sem)
A "m" constraint cannot be used together with a subsequent number (ie the
"=m" -> "0" thing is illegal - the numbering traditionally only works on
hard registers). It may work with some compilers and with the right
register pressure, but it absolutely _will_ cause problems on other
setups.
I should know, I tried to work around gcc stupidities in this area enough
times, and cursed how various things didn't work with various compilers.
The best thing to do is probably to mark "sem->count" a memory input only,
which together with the memory clobber should be ok.
Linus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-08 16:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-08 12:43 [PATCH] rw-semaphore asm constraints patch fix David Howells
2002-04-08 15:59 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®