Hi Alexander,

Alexander Stein schrieb:
Hello Bernd,

Am Mittwoch, 13. Mai 2009 09:41:14 schrieb Bernd Büttner:
my platform: m68knommu
ditribution 20070130 and 20080808

Using atomic_set_mask and atomic_clear_mask I ran into an assembler error.

Doing the following patch helped me out:

Index: linux-2.6.x/include/asm-m68knommu/atomic.h
===================================================================
--- linux-2.6.x/include/asm-m68knommu/atomic.h  (Revision 5)
+++ linux-2.6.x/include/asm-m68knommu/atomic.h  (Arbeitskopie)
@@ -86,12 +86,12 @@

  static __inline__ void atomic_clear_mask(unsigned long mask, unsigned
long *v) {
-       __asm__ __volatile__("andl %1,%0" : "+m" (*v) : "id" (~(mask)));
+       __asm__ __volatile__("andl %1,%0" : "+m" (*v) : "d" (~(mask)));
  }

  static __inline__ void atomic_set_mask(unsigned long mask, unsigned long
*v) {
-       __asm__ __volatile__("orl %1,%0" : "+m" (*v) : "id" (mask));
+       __asm__ __volatile__("orl %1,%0" : "+m" (*v) : "d" (mask));
  }

  /* Atomic operations are already serializing */

I'm not familiar with __asm__ directives, so could please someone tell me
if I'm correct.

I think your used those macros with a variable mask. The "i" constraint says it is an immediate integer which must be known at assembly time. This will result in a much better code as the immediate is included into the instruction and doesn't have to be moved to a data register first. I would suggest you change your code accordingly to use assembly time static masks.

Regards
Alexander
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


This is not the point.
I do use constants. Example:

#define R_FLAGS_INIT    0x00000004
atomic_clear_mask(R_FLAGS_INIT,&dev->flags);

This results in an error from assembler:

Error: operand mismatch -- statement 'andl #-5,(%a1)' ignored

Regards
Bernd
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to