PowerPC fallback_frame_stack doesn't restore CR

Alan Modra amodra@bigpond.net.au
Fri Sep 10 05:24:00 GMT 2004


The initial MD_FALLBACK_FRAME_STATE_FOR committed by Andrew back in 2001
didn't restore CR, and it appears no one has noticed a problem since
then.  However, I think it's a bug that we don't restore this
caller-saved register.

	* config/rs6000/linux-unwind.h (struct gcc_pt_regs): Extend to
	include ccr.
	(ppc_fallback_frame_state): Save location of CR.

powerpc-linux bootstrap in progress.  OK for mainline?  And analogous
patch for gcc-3.4?

Index: gcc/config/rs6000/linux-unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/linux-unwind.h,v
retrieving revision 1.1
diff -u -p -r1.1 linux-unwind.h
--- gcc/config/rs6000/linux-unwind.h	8 Sep 2004 00:17:17 -0000	1.1
+++ gcc/config/rs6000/linux-unwind.h	10 Sep 2004 03:58:05 -0000
@@ -32,6 +32,8 @@ struct gcc_pt_regs
   unsigned long orig_gpr3;
   unsigned long ctr;
   unsigned long link;
+  unsigned long xer;
+  unsigned long ccr;
 };
 
 struct gcc_sigcontext
@@ -174,6 +176,10 @@ ppc_fallback_frame_state (struct _Unwind
 	  = (long)&(sc->regs->gpr[i]) - new_cfa;
       }
 
+  fs->regs.reg[CR2_REGNO].how = REG_SAVED_OFFSET;
+  fs->regs.reg[CR2_REGNO].loc.offset
+    = (long)&(sc->regs->ccr) - new_cfa;
+
   fs->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET;
   fs->regs.reg[LINK_REGISTER_REGNUM].loc.offset
     = (long)&(sc->regs->link) - new_cfa;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Gcc-patches mailing list