public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Miscellaneous ColdFire patches
@ 2013-06-28 16:00 Joseph S. Myers
  2013-06-28 18:45 ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Joseph S. Myers @ 2013-06-28 16:00 UTC (permalink / raw)
  To: libc-ports, Andreas Schwab

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

The attached patches are various glibc changes for ColdFire that have been 
in EGLIBC for some years.  I've extracted the current versions of the 
changes and generally reworked the ChangeLog entries, but note that I have 
*not* tested any of these patches; they may however be useful to some 
users.  Are any or all of them OK?

1. Define MMAP2_PAGE_SHIFT to 13, as previously discussed at 
<http://sourceware.org/ml/libc-ports/2009-10/msg00005.html>.  The kernel 
port (or at least there relevant part thereof) is now upstream, still with 
this value.  Given the request last time to use getpagesize instead of a 
hardcoded value, also attached is:

2. Variant of that patch, defining MMAP2_PAGE_SHIFT to -1 instead of 13 
for ColdFire, so using the code now present in mmap64.c to get the value 
using getpagesize.

3. Make fpu_control.h handle no-FPU ColdFire, in a similar way to how 
several other architectures' fpu_control.h files handle soft-float cases.  
This patch doesn't use "# define" indentation, given that existing 
conditionals in this file don't use it either.

4. Handle no-FPU ColdFire in dl-trampoline.S.

-- 
Joseph S. Myers
joseph@codesourcery.com

[-- Attachment #2: Type: text/plain, Size: 689 bytes --]

2013-06-28  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* sysdeps/unix/sysv/linux/m68k/kernel-features.h [__mcoldfire__]
	(MMAP2_PAGE_SHIFT): Define to 13.

diff --git a/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 4203780..fac2107 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -47,3 +47,9 @@
 # undef __ASSUME_PSELECT
 # undef __ASSUME_PPOLL
 #endif
+
+#ifdef __mcoldfire__
+/* ColdFire kernels have PAGE_SHIFT set to 13 and expect mmap2 offset
+   to be provided in 8K pages.  */
+# define MMAP2_PAGE_SHIFT 13
+#endif

[-- Attachment #3: Type: text/plain, Size: 745 bytes --]

2013-06-28  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/m68k/kernel-features.h [__mcoldfire__]
	(MMAP2_PAGE_SHIFT): Define to -1.

diff --git a/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 4203780..80569c4 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -47,3 +47,10 @@
 # undef __ASSUME_PSELECT
 # undef __ASSUME_PPOLL
 #endif
+
+#ifdef __mcoldfire__
+/* ColdFire kernels have PAGE_SHIFT set to 13 and expect mmap2 offset
+   to be provided in 8K pages.  Determine the shift dynamically with
+   getpagesize.  */
+# define MMAP2_PAGE_SHIFT -1
+#endif

[-- Attachment #4: Type: text/plain, Size: 1623 bytes --]

2013-06-28  Nathan Sidwell  <nathan@codesourcery.com>

	* sysdeps/m68k/fpu_control.h [__mcoldfire__ && !__mcffpu__]
	(_FPU_RESERVED): Provide alternative definition.
	[__mcoldfire__ && !__mcffpu__] (_FPU_DEFAULT): Likewise.
	[__mcoldfire__ && !__mcffpu__] (_FPU_GETCW): Likewise.
	[__mcoldfire__ && !__mcffpu__] (_FPU_SETCW): Likewise.
	[!(__mcoldfire__ && !__mcffpu__)]: Make existing macro definitions
	conditional.

diff --git a/ports/sysdeps/m68k/fpu_control.h b/ports/sysdeps/m68k/fpu_control.h
index c37fcf4..848b5ba 100644
--- a/ports/sysdeps/m68k/fpu_control.h
+++ b/ports/sysdeps/m68k/fpu_control.h
@@ -53,6 +53,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
@@ -95,12 +104,13 @@
    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;

[-- Attachment #5: Type: text/plain, Size: 1529 bytes --]

2013-06-28  Nathan Sidwell  <nathan@codesourcery.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/m68k/dl-trampoline.S (_dl_runtime_profile)
	[__mcoldfire__ && !__mcffpu]: Do not save floating-point
	registers.

diff --git a/ports/sysdeps/m68k/dl-trampoline.S b/ports/sysdeps/m68k/dl-trampoline.S
index 5aeafc7..16f20dc 100644
--- a/ports/sysdeps/m68k/dl-trampoline.S
+++ b/ports/sysdeps/m68k/dl-trampoline.S
@@ -174,12 +174,16 @@ _dl_runtime_profile:
 	    +4      %a1
 	   %sp      %a0
 	*/
-#ifdef __mcoldfire__
+#if !defined (__mcoldfire__)
+	fmove.x %fp0, -(%sp)
+	cfi_adjust_cfa_offset (12)
+#elif defined (__mcffpu__)
 	fmove.d %fp0, -(%sp)
 	cfi_adjust_cfa_offset (8)
 #else
-	fmove.x %fp0, -(%sp)
-	cfi_adjust_cfa_offset (12)
+	clr.l -(%sp)
+	clr.l -(%sp)
+	cfi_adjust_cfa_offset (8)
 #endif
 	move.l %a0, -(%sp)
 	cfi_adjust_cfa_offset (4)
@@ -213,15 +217,20 @@ _dl_runtime_profile:
 	cfi_adjust_cfa_offset (-4)
 	move.l (%sp)+, %a0
 	cfi_adjust_cfa_offset (-4)
-#ifdef __mcoldfire__
-	fmove.d (%sp)+, %fp0
-	cfi_adjust_cfa_offset (-8)
-#else
+#if !defined (__mcoldfire__)
 	fmove.x (%sp)+, %fp0
 	cfi_adjust_cfa_offset (-12)
-#endif
 	lea 20(%sp), %sp
 	cfi_adjust_cfa_offset (-20)
+#elif defined (__mcffpu__)
+	fmove.l (%sp)+, %fp0
+	cfi_adjust_cfa_offset (-8)
+	lea 20(%sp), %sp
+	cfi_adjust_cfa_offset (-20)
+#else
+	lea 28(%sp), %sp
+	cfi_adjust_cfa_offset (-28)
+#endif
 	rts
 	cfi_endproc
 	.size _dl_runtime_profile, . - _dl_runtime_profile

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-04 20:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 16:00 Miscellaneous ColdFire patches Joseph S. Myers
2013-06-28 18:45 ` Andreas Schwab
2013-06-28 20:15   ` Joseph S. Myers
2013-06-30 20:57     ` Andreas Schwab
2013-06-28 20:25   ` Joseph S. Myers
2013-08-20 16:48     ` Ping for m68k MMAP2_PAGE_SHIFT fix Joseph S. Myers
2013-08-20 18:49       ` Andreas Schwab
2013-09-02 15:17       ` Ping " Joseph S. Myers
2013-09-04 20:44     ` Miscellaneous ColdFire patches Andreas Schwab
2013-06-28 20:32   ` Joseph S. Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).