* Fix asm constraint in put_user
@ 2005-11-21 15:12 Andreas Schwab
2005-11-21 16:08 ` David Mosberger-Tang
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Andreas Schwab @ 2005-11-21 15:12 UTC (permalink / raw)
To: linux-ia64
The st insn on the ia64 does not allow the post-increment to come from a
register (only ld does). Thus the "m" constraint is not suitable for the
asm statement in __put_user_size.
Signed-off-by: Andreas Schwab <schwab@suse.de>
--- linux-2.6.14/include/asm-ia64/uaccess.h.~1~ 2005-10-28 02:02:08.000000000 +0200
+++ linux-2.6.14/include/asm-ia64/uaccess.h 2005-11-20 18:15:46.559296784 +0100
@@ -154,10 +154,10 @@ do { \
# define __put_user_size(val, addr, n, err) \
do { \
register long __pu_r8 asm ("r8") = 0; \
- asm volatile ("\n[1:]\tst"#n" %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \
+ asm volatile ("\n[1:]\tst"#n" [%1]=%r2\t// %0 gets overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
"[1:]" \
- : "=r"(__pu_r8) : "m"(__m(addr)), "rO"(val), "0"(__pu_r8)); \
+ : "=r"(__pu_r8) : "r"(addr), "rO"(val), "0"(__pu_r8)); \
(err) = __pu_r8; \
} while (0)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
@ 2005-11-21 16:08 ` David Mosberger-Tang
2005-11-21 16:48 ` Andreas Schwab
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Mosberger-Tang @ 2005-11-21 16:08 UTC (permalink / raw)
To: linux-ia64
If memory services, you should use the "o" constraint instead. Note
that there is no "memory" clobber, so if you change from "m" to "r"
constraint, GCC won't know that the location at "addr" is being stored
to.
--david
On 11/21/05, Andreas Schwab <schwab@suse.de> wrote:
> The st insn on the ia64 does not allow the post-increment to come from a
> register (only ld does). Thus the "m" constraint is not suitable for the
> asm statement in __put_user_size.
>
> Signed-off-by: Andreas Schwab <schwab@suse.de>
>
> --- linux-2.6.14/include/asm-ia64/uaccess.h.~1~ 2005-10-28 02:02:08.000000000 +0200
> +++ linux-2.6.14/include/asm-ia64/uaccess.h 2005-11-20 18:15:46.559296784 +0100
> @@ -154,10 +154,10 @@ do { \
> # define __put_user_size(val, addr, n, err) \
> do { \
> register long __pu_r8 asm ("r8") = 0; \
> - asm volatile ("\n[1:]\tst"#n" %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \
> + asm volatile ("\n[1:]\tst"#n" [%1]=%r2\t// %0 gets overwritten by exception handler\n" \
> "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
> "[1:]" \
> - : "=r"(__pu_r8) : "m"(__m(addr)), "rO"(val), "0"(__pu_r8)); \
> + : "=r"(__pu_r8) : "r"(addr), "rO"(val), "0"(__pu_r8)); \
> (err) = __pu_r8; \
> } while (0)
>
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Mosberger Consulting LLC, voice/fax: 510-744-9372,
http://www.mosberger-consulting.com/
35706 Runckel Lane, Fremont, CA 94536
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
2005-11-21 16:08 ` David Mosberger-Tang
@ 2005-11-21 16:48 ` Andreas Schwab
2005-11-21 19:03 ` James E Wilson
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2005-11-21 16:48 UTC (permalink / raw)
To: linux-ia64
David Mosberger-Tang <David.Mosberger@acm.org> writes:
> If memory services, you should use the "o" constraint instead.
That doesn't work.
> Note that there is no "memory" clobber, so if you change from "m" to "r"
> constraint, GCC won't know that the location at "addr" is being stored
> to.
There is nothing worth clobbering here. The memory written to is
completely separate to anything GCC knows about. The old version didn't
clobber either.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
2005-11-21 16:08 ` David Mosberger-Tang
2005-11-21 16:48 ` Andreas Schwab
@ 2005-11-21 19:03 ` James E Wilson
2005-11-21 20:32 ` Andreas Schwab
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: James E Wilson @ 2005-11-21 19:03 UTC (permalink / raw)
To: linux-ia64
On Mon, 2005-11-21 at 07:12, Andreas Schwab wrote:
> The st insn on the ia64 does not allow the post-increment to come from a
> register (only ld does). Thus the "m" constraint is not suitable for the
> asm statement in __put_user_size.
You could use the "S" constraint here. This isn't used anywhere in
gcc. This exists solely for use by asms that need a non-postinc MEM.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
` (2 preceding siblings ...)
2005-11-21 19:03 ` James E Wilson
@ 2005-11-21 20:32 ` Andreas Schwab
2005-11-21 21:26 ` Andreas Schwab
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2005-11-21 20:32 UTC (permalink / raw)
To: linux-ia64
James E Wilson <wilson@tuliptree.org> writes:
> You could use the "S" constraint here. This isn't used anywhere in
> gcc. This exists solely for use by asms that need a non-postinc MEM.
Thanks, I didn't know about that constraint. (But it would still be nice
to have a constraint corresponding to destination_operand.)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
` (3 preceding siblings ...)
2005-11-21 20:32 ` Andreas Schwab
@ 2005-11-21 21:26 ` Andreas Schwab
2005-11-21 22:11 ` Luck, Tony
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2005-11-21 21:26 UTC (permalink / raw)
To: linux-ia64
James E Wilson <wilson@tuliptree.org> writes:
> On Mon, 2005-11-21 at 07:12, Andreas Schwab wrote:
>> The st insn on the ia64 does not allow the post-increment to come from a
>> register (only ld does). Thus the "m" constraint is not suitable for the
>> asm statement in __put_user_size.
>
> You could use the "S" constraint here. This isn't used anywhere in
> gcc. This exists solely for use by asms that need a non-postinc MEM.
Alas, it does not work:
sound/oss/rme96xx.c:744: error: 'asm' operand requires impossible reload
That's exactly the place where gcc would like to use a POST_MODIFY with a
register operand.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
` (4 preceding siblings ...)
2005-11-21 21:26 ` Andreas Schwab
@ 2005-11-21 22:11 ` Luck, Tony
2005-11-21 22:38 ` David Mosberger-Tang
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Luck, Tony @ 2005-11-21 22:11 UTC (permalink / raw)
To: linux-ia64
>> You could use the "S" constraint here. This isn't used anywhere in
>> gcc. This exists solely for use by asms that need a non-postinc MEM.
>
>Alas, it does not work:
So should I go with the original patch using "r"? I agree with Andreas'
assessment that it doesn't matter that we didn't tell gcc that memory
was being changed, since the memory that gets changed isn't in a space
that gcc knows about.
Or are there any more letters of the alphabet to try :-)
-Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
` (5 preceding siblings ...)
2005-11-21 22:11 ` Luck, Tony
@ 2005-11-21 22:38 ` David Mosberger-Tang
2005-11-23 6:02 ` James E Wilson
2005-11-23 22:08 ` James E Wilson
8 siblings, 0 replies; 10+ messages in thread
From: David Mosberger-Tang @ 2005-11-21 22:38 UTC (permalink / raw)
To: linux-ia64
On 11/21/05, Andreas Schwab <schwab@suse.de> wrote:
> There is nothing worth clobbering here. The memory written to is
> completely separate to anything GCC knows about. The old version didn't
> clobber either.
That's usually true, but I don't think it's always true. Consider the
case where put_user() is used to write kernel memory (which happens in
the ia32 emulation layer, for example). I agree it's probably
extremely unlikely for this to trigger a real problem (especially
considering that the kernel is compiled without strict aliasing) but
still, the safe thing to do would be to add a "memory" clobber if
there is no better alternative.
--david
--
Mosberger Consulting LLC, voice/fax: 510-744-9372,
http://www.mosberger-consulting.com/
35706 Runckel Lane, Fremont, CA 94536
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
` (6 preceding siblings ...)
2005-11-21 22:38 ` David Mosberger-Tang
@ 2005-11-23 6:02 ` James E Wilson
2005-11-23 22:08 ` James E Wilson
8 siblings, 0 replies; 10+ messages in thread
From: James E Wilson @ 2005-11-23 6:02 UTC (permalink / raw)
To: linux-ia64
On Mon, 2005-11-21 at 14:11, Luck, Tony wrote:
> So should I go with the original patch using "r"?
Yes. It should work fine. Meanwhile, I'm trying to look at the
compiler issues in the hope of providing a better solution in the
future.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fix asm constraint in put_user
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
` (7 preceding siblings ...)
2005-11-23 6:02 ` James E Wilson
@ 2005-11-23 22:08 ` James E Wilson
8 siblings, 0 replies; 10+ messages in thread
From: James E Wilson @ 2005-11-23 22:08 UTC (permalink / raw)
To: linux-ia64
On Mon, 2005-11-21 at 13:26, Andreas Schwab wrote:
> James E Wilson <wilson@tuliptree.org> writes:
> > You could use the "S" constraint here. This isn't used anywhere in
> > gcc. This exists solely for use by asms that need a non-postinc MEM.
> Alas, it does not work:
> sound/oss/rme96xx.c:744: error: 'asm' operand requires impossible reload
This is now FSF GCC PR 25008.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id%008
And lack of a proper constraint letter for a store destination is FSF
GCC PR 24961 which you filed.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id$961
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-11-23 22:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-21 15:12 Fix asm constraint in put_user Andreas Schwab
2005-11-21 16:08 ` David Mosberger-Tang
2005-11-21 16:48 ` Andreas Schwab
2005-11-21 19:03 ` James E Wilson
2005-11-21 20:32 ` Andreas Schwab
2005-11-21 21:26 ` Andreas Schwab
2005-11-21 22:11 ` Luck, Tony
2005-11-21 22:38 ` David Mosberger-Tang
2005-11-23 6:02 ` James E Wilson
2005-11-23 22:08 ` James E Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox