mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [PATCH 2/7] AVR32: Fix invalid constraints for stcond
Date: Tue, 11 Jul 2006 14:43:17 +0200	[thread overview]
Message-ID: <11526218024091-git-send-email-hskinnemoen@atmel.com> (raw)
In-Reply-To: <11526218022840-git-send-email-hskinnemoen@atmel.com>

Because gcc doesn't seem to like arch-dependent constraints in inline
asm, we ended up using "m" as constraint for the stcond instruction.
This is wrong since stcond doesn't support indexed addressing, but
it did seem to work on all the configurations we tried out.

When trying to build an allyesconfig, however, things broke in the
ocfs2 filesystem as the compiler used indexed addressing for the
stcond instruction and the assembler panic'ed.

Using the vaguely documented "o" constraint seems to fix the problem.
This only allows "offsetable" memory operands, and since
(reg + reg + constant) is not possible with any AVR32 instruction,
gcc is forced to disallow indexed addressing.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 include/asm-avr32/atomic.h |   10 +++++-----
 include/asm-avr32/bitops.h |   20 ++++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index fa53d53..e0b9c44 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -40,7 +40,7 @@ static inline int atomic_sub_return(int 
 		"	sub	%0, %3\n"
 		"	stcond	%1, %0\n"
 		"	brne	1b"
-		: "=&r"(result), "=m"(v->counter)
+		: "=&r"(result), "=o"(v->counter)
 		: "m"(v->counter), "ir"(i)
 		: "cc");
 
@@ -68,7 +68,7 @@ static inline int atomic_add_return(int 
 			"	add	%0, %3\n"
 			"	stcond	%2, %0\n"
 			"	brne	1b"
-			: "=&r"(result), "=m"(v->counter)
+			: "=&r"(result), "=o"(v->counter)
 			: "m"(v->counter), "r"(i)
 			: "cc", "memory");
 
@@ -100,7 +100,7 @@ static inline int atomic_sub_unless(atom
 		"	brne	1b\n"
 		"	mov	%1, 1\n"
 		"1:"
-		: "=&r"(tmp), "=&r"(result), "=m"(v->counter)
+		: "=&r"(tmp), "=&r"(result), "=o"(v->counter)
 		: "m"(v->counter), "ir"(a), "ir"(u)
 		: "cc", "memory");
 
@@ -136,7 +136,7 @@ static inline int atomic_add_unless(atom
 			"	brne	1b\n"
 			"	mov	%1, 1\n"
 			"1:"
-			: "=&r"(tmp), "=&r"(result), "=m"(v->counter)
+			: "=&r"(tmp), "=&r"(result), "=o"(v->counter)
 			: "m"(v->counter), "r"(a), "ir"(u)
 			: "cc", "memory");
 	}
@@ -165,7 +165,7 @@ static inline int atomic_sub_if_positive
 		"	stcond	%1, %0\n"
 		"	brne	1b\n"
 		"1:"
-		: "=&r"(result), "=m"(v->counter)
+		: "=&r"(result), "=o"(v->counter)
 		: "m"(v->counter), "ir"(i)
 		: "cc", "memory");
 
diff --git a/include/asm-avr32/bitops.h b/include/asm-avr32/bitops.h
index f0d7bc7..4d47b07 100644
--- a/include/asm-avr32/bitops.h
+++ b/include/asm-avr32/bitops.h
@@ -40,7 +40,7 @@ static inline void set_bit(int nr, volat
 			"	sbr	%0, %3\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p)
+			: "=r"(tmp), "=o"(*p)
 			: "m"(*p), "i"(nr)
 			: "cc");
 	} else {
@@ -51,7 +51,7 @@ static inline void set_bit(int nr, volat
 			"	or	%0, %3\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p)
+			: "=r"(tmp), "=o"(*p)
 			: "m"(*p), "r"(mask)
 			: "cc");
 	}
@@ -79,7 +79,7 @@ static inline void clear_bit(int nr, vol
 			"	cbr	%0, %3\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p)
+			: "=r"(tmp), "=o"(*p)
 			: "m"(*p), "i"(nr)
 			: "cc");
 	} else {
@@ -90,7 +90,7 @@ static inline void clear_bit(int nr, vol
 			"	andn	%0, %3\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p)
+			: "=r"(tmp), "=o"(*p)
 			: "m"(*p), "r"(mask)
 			: "cc");
 	}
@@ -117,7 +117,7 @@ static inline void change_bit(int nr, vo
 		"	eor	%0, %3\n"
 		"	stcond	%1, %0\n"
 		"	brne	1b"
-		: "=r"(tmp), "=m"(*p)
+		: "=r"(tmp), "=o"(*p)
 		: "m"(*p), "r"(mask)
 		: "cc");
 }
@@ -144,7 +144,7 @@ static inline int test_and_set_bit(int n
 			"	sbr	%0, %4\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p), "=r"(old)
+			: "=r"(tmp), "=o"(*p), "=r"(old)
 			: "m"(*p), "i"(nr)
 			: "memory", "cc");
 	} else {
@@ -154,7 +154,7 @@ static inline int test_and_set_bit(int n
 			"	or	%0, %2, %4\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p), "=r"(old)
+			: "=r"(tmp), "=o"(*p), "=r"(old)
 			: "m"(*p), "r"(mask)
 			: "memory", "cc");
 	}
@@ -184,7 +184,7 @@ static inline int test_and_clear_bit(int
 			"	cbr	%0, %4\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p), "=r"(old)
+			: "=r"(tmp), "=o"(*p), "=r"(old)
 			: "m"(*p), "i"(nr)
 			: "memory", "cc");
 	} else {
@@ -195,7 +195,7 @@ static inline int test_and_clear_bit(int
 			"	andn	%0, %4\n"
 			"	stcond	%1, %0\n"
 			"	brne	1b"
-			: "=r"(tmp), "=m"(*p), "=r"(old)
+			: "=r"(tmp), "=o"(*p), "=r"(old)
 			: "m"(*p), "r"(mask)
 			: "memory", "cc");
 	}
@@ -223,7 +223,7 @@ static inline int test_and_change_bit(in
 		"	eor	%0, %2, %4\n"
 		"	stcond	%1, %0\n"
 		"	brne	1b"
-		: "=r"(tmp), "=m"(*p), "=r"(old)
+		: "=r"(tmp), "=o"(*p), "=r"(old)
 		: "m"(*p), "r"(mask)
 		: "memory", "cc");
 
-- 
1.4.0


  reply	other threads:[~2006-07-11 12:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-11 12:43 [PATCH 0/7] AVR32 update Haavard Skinnemoen
2006-07-11 12:43 ` [PATCH 1/7] AVR32: CONFIG_DEBUG_BUGVERBOSE and CONFIG_FRAME_POINTER Haavard Skinnemoen
2006-07-11 12:43   ` Haavard Skinnemoen [this message]
2006-07-11 12:43     ` [PATCH 3/7] AVR32: Add support for irq-flags state tracing Haavard Skinnemoen
2006-07-11 12:43       ` [PATCH 4/7] AVR32: Turn off support for DISCONTIGMEM and SPARSEMEM Haavard Skinnemoen
2006-07-11 12:43         ` [PATCH 5/7] AVR32: Always enable CONFIG_EMBEDDED Haavard Skinnemoen
2006-07-11 12:43           ` [PATCH 6/7] AVR32: Export the find_*_bit() functions Haavard Skinnemoen
2006-07-11 12:43             ` [PATCH 7/7] AVR32: Add defconfig for AT32STK1002 Haavard Skinnemoen
2006-07-11 18:07     ` [PATCH 2/7] AVR32: Fix invalid constraints for stcond H. Peter Anvin
2006-07-11 19:26       ` Haavard Skinnemoen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11526218024091-git-send-email-hskinnemoen@atmel.com \
    --to=hskinnemoen@atmel.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®