This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, m68k] A couple of fixes for ColdFire Linux


Hello Andreas,

The attached are two simple fixes for ColdFire Linux port.

The first patch fixes linux-unwind.h to handle certain ColdFire kernels.

And the second patch avoids overflowed branch displacement when building a large PIC library for FPU-less ColdFire.

These patches were tested on a 4.4 branch on a ColdFire linux board. OK to apply?

Thanks,

--
Maxim K.
CodeSourcery
2009-08-23  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* config/m68k/linux-unwind.h (m68k_fallback_frame_state): Handle
	signal frames of FPU-less ColdFire CPUs.  Add alternative
	rt_sigreturn sequence for ColdFire.
--- gcc/config/m68k/linux-unwind.h
+++ gcc/config/m68k/linux-unwind.h
@@ -85,7 +85,7 @@ m68k_fallback_frame_state (struct _Unwin
       fs->regs.reg[24].how = REG_SAVED_OFFSET;
       fs->regs.reg[24].loc.offset = (long) &sc->sc_pc - cfa;
 
-#ifndef __uClinux__
+#if defined __mcffpu__ && !defined __uClinux__
       if (*(int *) sc->sc_fpstate)
 	{
 	  int *fpregs = (int *) sc->sc_fpregs;
@@ -101,8 +101,13 @@ m68k_fallback_frame_state (struct _Unwin
     }
 #ifdef __mcoldfire__
   /* move.l #__NR_rt_sigreturn,%d0; trap #0 */
-  else if (pc[0] == 0x203c && pc[1] == 0x0000 &&
-	   pc[2] == 0x00ad && pc[3] == 0x4e40)
+  else if ((pc[0] == 0x203c && pc[1] == 0x0000 &&
+	    pc[2] == 0x00ad && pc[3] == 0x4e40) ||
+	   /* Don't ask me why, this is just what recent kernel does:
+	      moveq #-__NR_rt_sigreturn,%d0; andil 0xff,%d0; trap #0;
+	      Sign...  */
+	   (pc[0] == 0x70ad && pc[1] == 0x0280 && pc[2] == 0x0000 &&
+	    pc[3] == 0x00ff && pc[4] == 0x4e40 && pc[5] == 0x0000))
 #else
   /* moveq #~__NR_rt_sigreturn,%d0; not.b %d0; trap #0 */
   else if (pc[0] == 0x7052 && pc[1] == 0x4600 && pc[2] == 0x4e40)
2009-08-23  Maxim Kuvyrkov  <maxim@codesourcery.com>
 
	* config/m68k/lb1sf68.asm (PICCALL): Use long branch to subroutine
	for ColdFire ISAs that support it.
--- gcc/config/m68k/lb1sf68.asm
+++ gcc/config/m68k/lb1sf68.asm
@@ -163,6 +163,8 @@ see the files COPYING3 and COPYING.RUNTI
 #if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
 	lea	\addr-.-8,a0
 	jsr	pc@(a0)
+#elif defined (__mcfisab__) || defined (__mcfisac__)
+	bsr.l	\addr
 #else
 	bsr	\addr
 #endif
@@ -202,6 +204,8 @@ see the files COPYING3 and COPYING.RUNTI
 #if defined (__mcoldfire__) && !defined (__mcfisab__) && !defined (__mcfisac__)
 	lea	\addr-.-8,a0
 	jsr	pc@(a0)
+#elif defined (__mcfisab__) || defined (__mcfisac__)
+	bsr.l	\addr
 #else
 	bsr	\addr
 #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]