linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix 64 bits vDSO dwarf info for CR register
@ 2007-10-17  4:23 Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-17  4:23 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Jakub Jelinek, linuxppc-dev list, Andrew Haley, Alan Modra,
	Deepak Bhole

The current DWARF info for CR are incorrect causing the gcc unwinder to
go to lunch if taking a segfault in the vdso. This patch fixes it.

Problem identified by Andrew Haley, and fix provided by Jakub Jelinek
(thanks !).

Unfortunately, a bug in gcc cause it to not quite work either, but that
is being fixed separately with something around the lines of:


Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Index: linux-work/arch/powerpc/kernel/vdso64/sigtramp.S
===================================================================
--- linux-work.orig/arch/powerpc/kernel/vdso64/sigtramp.S	2007-10-17 13:32:49.000000000 +1000
+++ linux-work/arch/powerpc/kernel/vdso64/sigtramp.S	2007-10-17 13:34:18.000000000 +1000
@@ -134,13 +134,16 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
 9:
 
 /* This is where the pt_regs pointer can be found on the stack.  */
-#define PTREGS 128+168+56
+#define PTREGS	128+168+56
 
 /* Size of regs.  */
-#define RSIZE 8
+#define RSIZE	8
+
+/* Size of CR reg in DWARF unwind info. */
+#define CRSIZE	4
 
 /* This is the offset of the VMX reg pointer.  */
-#define VREGS 48*RSIZE+33*8
+#define VREGS	48*RSIZE+33*8
 
 /* Describe where general purpose regs are saved.  */
 #define EH_FRAME_GEN \
@@ -178,7 +181,7 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
   rsave (31, 31*RSIZE);							\
   rsave (67, 32*RSIZE);		/* ap, used as temp for nip */		\
   rsave (65, 36*RSIZE);		/* lr */				\
-  rsave (70, 38*RSIZE)		/* cr */
+  rsave (70, 38*RSIZE + (RSIZE - CRSIZE)) /* cr */
 
 /* Describe where the FP regs are saved.  */
 #define EH_FRAME_FP \

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

* [PATCH] powerpc: Fix 64 bits vDSO dwarf info for CR register
@ 2007-10-17  4:26 Benjamin Herrenschmidt
  2007-10-17 13:50 ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-17  4:26 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Jakub Jelinek, linuxppc-dev list, Andrew Haley, Alan Modra,
	Deepak Bhole

The current DWARF info for CR are incorrect causing the gcc unwinder to
go to lunch if taking a segfault in the vdso. This patch fixes it.

Problem identified by Andrew Haley, and fix provided by Jakub Jelinek
(thanks !).

Unfortunately, a bug in gcc cause it to not quite work either, but that
is being fixed separately with something around the lines of:

linux-unwind.h:

     fs->regs.reg[R_CR2].loc.offset = (long) &regs->ccr - new_cfa;
+    /* CR? regs are just 32-bit and PPC is big-endian.  */
+    fs->regs.reg[R_CR2].loc.offset += sizeof (long) - 4;

(According to Jakub)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Index: linux-work/arch/powerpc/kernel/vdso64/sigtramp.S
===================================================================
--- linux-work.orig/arch/powerpc/kernel/vdso64/sigtramp.S	2007-10-17 13:32:49.000000000 +1000
+++ linux-work/arch/powerpc/kernel/vdso64/sigtramp.S	2007-10-17 13:34:18.000000000 +1000
@@ -134,13 +134,16 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
 9:
 
 /* This is where the pt_regs pointer can be found on the stack.  */
-#define PTREGS 128+168+56
+#define PTREGS	128+168+56
 
 /* Size of regs.  */
-#define RSIZE 8
+#define RSIZE	8
+
+/* Size of CR reg in DWARF unwind info. */
+#define CRSIZE	4
 
 /* This is the offset of the VMX reg pointer.  */
-#define VREGS 48*RSIZE+33*8
+#define VREGS	48*RSIZE+33*8
 
 /* Describe where general purpose regs are saved.  */
 #define EH_FRAME_GEN \
@@ -178,7 +181,7 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
   rsave (31, 31*RSIZE);							\
   rsave (67, 32*RSIZE);		/* ap, used as temp for nip */		\
   rsave (65, 36*RSIZE);		/* lr */				\
-  rsave (70, 38*RSIZE)		/* cr */
+  rsave (70, 38*RSIZE + (RSIZE - CRSIZE)) /* cr */
 
 /* Describe where the FP regs are saved.  */
 #define EH_FRAME_FP \

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

* Re: [PATCH] powerpc: Fix 64 bits vDSO dwarf info for CR register
  2007-10-17  4:26 Benjamin Herrenschmidt
@ 2007-10-17 13:50 ` Jakub Jelinek
  2007-10-17 14:00   ` Andrew Haley
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2007-10-17 13:50 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Deepak Bhole, linuxppc-dev list, Andrew Haley, Paul Mackerras,
	Alan Modra

On Wed, Oct 17, 2007 at 02:26:50PM +1000, Benjamin Herrenschmidt wrote:
> Unfortunately, a bug in gcc cause it to not quite work either, but that
> is being fixed separately with something around the lines of:
> 
> linux-unwind.h:
> 
>      fs->regs.reg[R_CR2].loc.offset = (long) &regs->ccr - new_cfa;
> +    /* CR? regs are just 32-bit and PPC is big-endian.  */
> +    fs->regs.reg[R_CR2].loc.offset += sizeof (long) - 4;

Small correction.  If vdso is present, then fixing the vdso is all that is
needed, the above mentioned code is used only if the vdso is not present
(or if glibc doesn't support the vdso).

	Jakub

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

* Re: [PATCH] powerpc: Fix 64 bits vDSO dwarf info for CR register
  2007-10-17 13:50 ` Jakub Jelinek
@ 2007-10-17 14:00   ` Andrew Haley
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2007-10-17 14:00 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Deepak Bhole, linuxppc-dev list, Benjamin Herrenschmidt,
	Paul Mackerras, Alan Modra

Jakub Jelinek writes:
 > On Wed, Oct 17, 2007 at 02:26:50PM +1000, Benjamin Herrenschmidt wrote:
 > > Unfortunately, a bug in gcc cause it to not quite work either, but that
 > > is being fixed separately with something around the lines of:
 > > 
 > > linux-unwind.h:
 > > 
 > >      fs->regs.reg[R_CR2].loc.offset = (long) &regs->ccr - new_cfa;
 > > +    /* CR? regs are just 32-bit and PPC is big-endian.  */
 > > +    fs->regs.reg[R_CR2].loc.offset += sizeof (long) - 4;
 > 
 > Small correction.  If vdso is present, then fixing the vdso is all that is
 > needed, the above mentioned code is used only if the vdso is not present
 > (or if glibc doesn't support the vdso).

Perhaps we should test this change with a hacked libgcc, just to make
sure it fixes the bug.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903

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

end of thread, other threads:[~2007-10-17 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-17  4:23 [PATCH] powerpc: Fix 64 bits vDSO dwarf info for CR register Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2007-10-17  4:26 Benjamin Herrenschmidt
2007-10-17 13:50 ` Jakub Jelinek
2007-10-17 14:00   ` Andrew Haley

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 NNTP newsgroup(s).