public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH} PPC 32 multithreaded core dumps
@ 2004-02-25 20:25 Greg Weeks
  2004-02-25 21:13 ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Weeks @ 2004-02-25 20:25 UTC (permalink / raw)
  To: linux-kernel

This code fixes the register dumps for 32 bit ppc multi threaded core 
dumps. It's largely based on the ppc64 code. It was tested on an 8260 
processor with the TimeSys modified 2.6.1 kernel. The patch is for 
2.6.3. Let me know if there are any problems with it. If anyone can tell 
me why arch/ppc/boot/simple/misc.c was including elf.h in the first 
place I'd appreciate it. It doesn't appear to need it and it doesn't 
like task_struct now.

Greg Weeks



diff -uprN linux-2.6.3.orig/arch/ppc/boot/simple/misc.c 
linux-2.6.3.change/arch/ppc/boot/simple/misc.c
--- linux-2.6.3.orig/arch/ppc/boot/simple/misc.c    2004-02-17 
22:59:11.000000000 -0500
+++ linux-2.6.3.change/arch/ppc/boot/simple/misc.c    2004-02-25 
14:10:30.000000000 -0500
@@ -17,7 +17,6 @@
  */
 
 #include <linux/types.h>
-#include <linux/elf.h>
 #include <linux/config.h>
 #include <linux/string.h>
 
diff -uprN linux-2.6.3.orig/arch/ppc/kernel/process.c 
linux-2.6.3.change/arch/ppc/kernel/process.c
--- linux-2.6.3.orig/arch/ppc/kernel/process.c    2004-02-17 
22:57:53.000000000 -0500
+++ linux-2.6.3.change/arch/ppc/kernel/process.c    2004-02-25 
14:12:13.000000000 -0500
@@ -45,7 +45,6 @@
 #include <asm/prom.h>
 #include <asm/hardirq.h>
 
-int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs);
 extern unsigned long _get_SP(void);
 
 struct task_struct *last_task_used_math = NULL;
@@ -188,12 +187,17 @@ enable_kernel_fp(void)
 #endif /* CONFIG_SMP */
 }
 
-int
-dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
+int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
 {
-    if (regs->msr & MSR_FP)
+    struct pt_regs *regs = tsk->thread.regs;
+
+    if (!regs)
+        return 0;
+    if (tsk == current && (regs->msr & MSR_FP))
         giveup_fpu(current);
-    memcpy(fpregs, &current->thread.fpr[0], sizeof(*fpregs));
+
+    memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
+
     return 1;
 }
 
diff -uprN linux-2.6.3.orig/include/asm-ppc/elf.h 
linux-2.6.3.change/include/asm-ppc/elf.h
--- linux-2.6.3.orig/include/asm-ppc/elf.h    2004-02-17 
22:57:11.000000000 -0500
+++ linux-2.6.3.change/include/asm-ppc/elf.h    2004-02-25 
14:14:21.000000000 -0500
@@ -90,11 +90,33 @@ typedef elf_vrreg_t elf_vrregset_t[ELF_N
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE    4096
 
-#define ELF_CORE_COPY_REGS(gregs, regs) \
-    memcpy(gregs, regs, \
-           sizeof(struct pt_regs) < sizeof(elf_gregset_t)? \
-           sizeof(struct pt_regs): sizeof(elf_gregset_t));
+static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs,
+                        struct pt_regs *regs)
+{
+    int i;
+    int gprs = sizeof(struct pt_regs)/sizeof(elf_greg_t);
+
+    if (gprs > ELF_NGREG)
+        gprs = ELF_NGREG;
+
+    for (i=0; i < gprs; i++)
+        elf_regs[i] = (elf_greg_t)((elf_greg_t *)regs)[i];
+}
+#define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, 
regs);
+
+static inline int dump_task_regs(struct task_struct *tsk,
+                 elf_gregset_t *elf_regs)
+{
+    struct pt_regs *regs = tsk->thread.regs;
+    if (regs)
+        ppc_elf_core_copy_regs(*elf_regs, regs);
+
+    return 1;
+}
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, 
elf_regs)
 
+extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
+#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, 
elf_fpregs)
 
 /* This yields a mask that user programs can use to figure out what
    instruction set this cpu supports.  This could be done in userspace,


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

* Re: [PATCH} PPC 32 multithreaded core dumps
  2004-02-25 20:25 [PATCH} PPC 32 multithreaded core dumps Greg Weeks
@ 2004-02-25 21:13 ` Tom Rini
  2004-03-04 13:05   ` Greg Weeks
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2004-02-25 21:13 UTC (permalink / raw)
  To: Greg Weeks; +Cc: linux-kernel

On Wed, Feb 25, 2004 at 03:25:56PM -0500, Greg Weeks wrote:

> This code fixes the register dumps for 32 bit ppc multi threaded core 
> dumps. It's largely based on the ppc64 code. It was tested on an 8260 

This looks right, and I'll think about it a bit more and apply.

> processor with the TimeSys modified 2.6.1 kernel. The patch is for 
> 2.6.3. Let me know if there are any problems with it. If anyone can tell 
> me why arch/ppc/boot/simple/misc.c was including elf.h in the first 
> place I'd appreciate it. It doesn't appear to need it and it doesn't 
> like task_struct now.

Long ago it used to care more about the file it was dealing with.  I'll
remove it from the other files in boot/ that include it as well.

-- 
Tom Rini
http://gate.crashing.org/~trini/

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

* Re: [PATCH} PPC 32 multithreaded core dumps
  2004-02-25 21:13 ` Tom Rini
@ 2004-03-04 13:05   ` Greg Weeks
  2004-03-04 15:31     ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Weeks @ 2004-03-04 13:05 UTC (permalink / raw)
  To: Tom Rini; +Cc: linux-kernel

Tom Rini wrote:

>On Wed, Feb 25, 2004 at 03:25:56PM -0500, Greg Weeks wrote:
>
>  
>
>>This code fixes the register dumps for 32 bit ppc multi threaded core 
>>dumps. It's largely based on the ppc64 code. It was tested on an 8260 
>>    
>>
>
>This looks right, and I'll think about it a bit more and apply.
>
>  
>
>>processor with the TimeSys modified 2.6.1 kernel. The patch is for 
>>2.6.3. Let me know if there are any problems with it. If anyone can tell 
>>me why arch/ppc/boot/simple/misc.c was including elf.h in the first 
>>place I'd appreciate it. It doesn't appear to need it and it doesn't 
>>like task_struct now.
>>    
>>
>
>Long ago it used to care more about the file it was dealing with.  I'll
>remove it from the other files in boot/ that include it as well.
>
>  
>
How does this still look?

Greg W

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

* Re: [PATCH} PPC 32 multithreaded core dumps
  2004-03-04 13:05   ` Greg Weeks
@ 2004-03-04 15:31     ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2004-03-04 15:31 UTC (permalink / raw)
  To: Greg Weeks; +Cc: linux-kernel

On Thu, Mar 04, 2004 at 08:05:48AM -0500, Greg Weeks wrote:

> Tom Rini wrote:
> 
> >On Wed, Feb 25, 2004 at 03:25:56PM -0500, Greg Weeks wrote:
> >
> >>This code fixes the register dumps for 32 bit ppc multi threaded core 
> >>dumps. It's largely based on the ppc64 code. It was tested on an 8260 
> >
> >This looks right, and I'll think about it a bit more and apply.
> >
> >>processor with the TimeSys modified 2.6.1 kernel. The patch is for 
> >>2.6.3. Let me know if there are any problems with it. If anyone can tell 
> >>me why arch/ppc/boot/simple/misc.c was including elf.h in the first 
> >>place I'd appreciate it. It doesn't appear to need it and it doesn't 
> >>like task_struct now.
> >
> >Long ago it used to care more about the file it was dealing with.  I'll
> >remove it from the other files in boot/ that include it as well.
>
> How does this still look?

I removed the #include as part of a greater fixing up of arch/ppc/boot,
that I'll hopefully get to Linus for the next release.   I'll throw the
multithreaded coredump patch in as well then.

-- 
Tom Rini
http://gate.crashing.org/~trini/

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

end of thread, other threads:[~2004-03-04 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-25 20:25 [PATCH} PPC 32 multithreaded core dumps Greg Weeks
2004-02-25 21:13 ` Tom Rini
2004-03-04 13:05   ` Greg Weeks
2004-03-04 15:31     ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox