Commit:     bb7aa6d47fcd4f9ab18b4ade2ba078f7719f74ca
Parent:     82c54f864fea26c4c44f27e2b4c4d9a811dde299
Author:     Haavard Skinnemoen <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 3 15:05:20 2007 +0200
Committer:  Haavard Skinnemoen <[EMAIL PROTECTED]>
CommitDate: Thu Oct 11 13:32:56 2007 +0200

    [AVR32] Don't use __builtin_xchg()
    The implementation of __builtin_xchg() in at least some versions of
    avr32 gcc is buggy. Rather than find out exactly which versions that
    have this bug, let's just avoid the problem altogether by implementing
    xchg() in inline assembly.
    Also, in most architectures, xchg() seems to imply a memory barrier,
    while the existing avr32 implementation did not. This patch also fixes
    that discrepancy.
    Signed-off-by: Haavard Skinnemoen <[EMAIL PROTECTED]>
 include/asm-avr32/system.h |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
index a8236ba..dc2d527 100644
--- a/include/asm-avr32/system.h
+++ b/include/asm-avr32/system.h
@@ -73,11 +73,16 @@ extern struct task_struct *__switch_to(struct task_struct *,
 extern void __xchg_called_with_bad_pointer(void);
-#ifdef __CHECKER__
-extern unsigned long __builtin_xchg(void *ptr, unsigned long x);
+static inline unsigned long xchg_u32(u32 val, volatile u32 *m)
+       u32 ret;
-#define xchg_u32(val, m) __builtin_xchg((void *)m, val)
+       asm volatile("xchg %[ret], %[m], %[val]"
+                       : [ret] "=&r"(ret), "=m"(*m)
+                       : "m"(*m), [m] "r"(m), [val] "r"(val)
+                       : "memory");
+       return ret;
 static inline unsigned long __xchg(unsigned long x,
                                       volatile void *ptr,
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to