[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] allow non-fpu m68k libraries



This patch allows a --without-fp glibc to be built for ColdFire. The 54455 ISAC device has no floating point unit. ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@xxxxxxxxxxxxxxxx    ::     http://www.planetfall.pwp.blueyonder.co.uk

2007-03-26  Nathan Sidwell  <nathan@xxxxxxxxxxxxxxxx>

	* sysdeps/m68k/dl-trampoline.S: Do not save float regs on
	non-float cpus.
	* sysdeps/m68k/fpu_control.h: Provide non-fpu macro definitions.

Index: sysdeps/m68k/dl-trampoline.S
===================================================================
--- sysdeps/m68k/dl-trampoline.S	(revision 165538)
+++ sysdeps/m68k/dl-trampoline.S	(working copy)
@@ -138,10 +138,13 @@ _dl_runtime_profile:
 	    +4      %a1
 	   %sp      %a0
 	*/
-#ifdef __mcoldfire__
+#if !defined (__mcoldfire__)
+	fmove.x %fp0, -(%sp)
+#elif defined (__mcffpu__)
 	fmove.l %fp0, -(%sp)
 #else
-	fmove.x %fp0, -(%sp)
+	move.l #0, -(%sp)
+	move.l #0, -(%sp)
 #endif
 	move.l %a0, -(%sp)
 	move.l %d1, -(%sp)
@@ -161,10 +164,10 @@ _dl_runtime_profile:
 	move.l (%sp)+, %d0
 	move.l (%sp)+, %d1
 	move.l (%sp)+, %a0
-#ifdef __mcoldfire__
-	fmove.d (%sp)+, %fp0
-#else
+#if !defined (__mcoldfire__)
 	fmove.x (%sp)+, %fp0
+#elif defined (__mcffpu__)
+	fmove.l (%sp)+, %fp0
 #endif
 	lea 20(%sp), %sp
 	rts
Index: sysdeps/m68k/fpu_control.h
===================================================================
--- sysdeps/m68k/fpu_control.h	(revision 165538)
+++ sysdeps/m68k/fpu_control.h	(working copy)
@@ -54,6 +54,15 @@
 
 #include <features.h>
 
+#if defined (__mcoldfire__) && !defined (__mcffpu__)
+
+#define _FPU_RESERVED 0xffffffff
+#define _FPU_DEFAULT  0x00000000
+#define _FPU_GETCW(cw) ((cw) = 0)
+#define _FPU_SETCW(cw) ((void)(cw))
+
+#else
+
 /* masking of interrupts */
 #define _FPU_MASK_BSUN  0x8000
 #define _FPU_MASK_SNAN  0x4000
@@ -96,14 +105,14 @@
    that __setfpucw works.  This bit will be ignored.  */
 #define _FPU_IEEE     0x00000001
 
-/* Type of the control word.  */
-typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
-
 /* Macros for accessing the hardware control word.  */
 #define _FPU_GETCW(cw) __asm__ ("fmove%.l %!, %0" : "=dm" (cw))
 #define _FPU_SETCW(cw) __asm__ volatile ("fmove%.l %0, %!" : : "dm" (cw))
+#endif
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
-
 #endif /* _M68K_FPU_CONTROL_H */