[patch] m68k/m5200

Ralf Corsepius corsepiu at faw.uni-ulm.de
Fri Mar 8 08:56:05 UTC 2002


Hi,

I am observing a breakdown with all m5200 based BSPs.

The assembler complains about using invalid asm-instructions:
.. 
{standard input}: Assembler messages: 
{standard input}:1634: Error: invalid instruction for this architecture;
needs 68000 or higher -- statement `rorw #8,%d0' ignored 
..
Apparent cause is the m68k_swap_u* functions from m68k.h.

Below is my stab on fixing this, however as I am not familiar with the
m5200, I am not sure if this is correct. Therefore I would like to ask
those of you being familiar with the m5200-family to comment on this
patch, rsp. correct it.

TIA,
	Ralf

-------------- next part --------------
--- c/src/exec/score/cpu/m68k/rtems/score/m68k.h	2000/06/13 21:53:38	1.5
+++ c/src/exec/score/cpu/m68k/rtems/score/m68k.h	2002/03/08 08:54:46
@@ -332,11 +332,15 @@
 )
 {
   unsigned int swapped = value;
-
+#if defined(__mcf5200) || defined(__mcf5200__)
+  asm volatile( "swap.w  %0"  : "=d" (swapped) : "0" (swapped) );
+  asm volatile( "swap    %0"  : "=d" (swapped) : "0" (swapped) );
+  asm volatile( "swap.w  %0"  : "=d" (swapped) : "0" (swapped) );
+#else
   asm volatile( "rorw  #8,%0" : "=d" (swapped) : "0" (swapped) );
   asm volatile( "swap  %0"    : "=d" (swapped) : "0" (swapped) );
   asm volatile( "rorw  #8,%0" : "=d" (swapped) : "0" (swapped) );
-
+#endif
   return( swapped );
 }
 
@@ -346,8 +350,11 @@
 {
   unsigned short swapped = value;
 
+#if defined(__mcf5200) || defined(__mcf5200__)
+  asm volatile( "swap.w  %0"  : "=d" (swapped) : "0" (swapped) );
+#else
   asm volatile( "rorw  #8,%0" : "=d" (swapped) : "0" (swapped) );
-
+#endif
   return( swapped );
 }
 


More information about the users mailing list