Fix asm constraint in put_user
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.
include/asm-ia64/uaccess.h renamed from include/asm-ia64/uaccess.h.~1~ +2 -2
@@ -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.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] 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."
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
Quoted 24 lines · Andreas Schwab
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 <[email protected]>include/asm-ia64/uaccess.h 2005-11-20 18:15:46.559296784 +0100 renamed from include/asm-ia64/uaccess.h.~1~ 2005-10-28 02:02:08.000000000 +0200 +2
-2@@ -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.
Quoted 10 lines
--
Andreas Schwab, SuSE Labs, [email protected]
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 [email protected]
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
Quoted 1 line · David Mosberger-Tang
If memory services, you should use the "o" constraint instead.
That doesn't work.
Quoted 3 lines
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.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] 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."
Quoted 3 lines · Andreas Schwab
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.
Quoted 2 lines · James E Wilson
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.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] 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."
Quoted 7 lines · James E Wilson
Quoted 3 lines · Andreas Schwab
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.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] 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."
Quoted 4 lines
Quoted 2 lines
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
Quoted 3 lines · Andreas Schwab
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
Quoted 1 line · Tony
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.
Quoted 5 lines · Andreas Schwab
Quoted 2 lines · James E Wilson
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