[PATCH} PPC 32 multithreaded core dumps
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
arch/ppc/boot/simple/misc.c 2004-02-25 14:10:30.000000000 -0500 renamed from arch/ppc/boot/simple/misc.c 2004-02-17 22:59:11.000000000 -0500 +0 -0
@@ -17,7 +17,6 @@ */
#include <linux/types.h>
-#include <linux/elf.h>
#include <linux/config.h>
#include <linux/string.h>
arch/ppc/kernel/process.c 2004-02-25 14:12:13.000000000 -0500 renamed from arch/ppc/kernel/process.c 2004-02-17 22:57:53.000000000 -0500 +0 -0
@@ -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, ¤t->thread.fpr[0], sizeof(*fpregs));
+
+ memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
+
return 1; }
include/asm-ppc/elf.h 2004-02-25 14:14:21.000000000 -0500 renamed from include/asm-ppc/elf.h 2004-02-17 22:57:11.000000000 -0500 +0 -0
@@ -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,
Quoted 2 lines · Greg Weeks
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.
Quoted 5 lines
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.cwas includingelf.hin the first place I'd appreciate it. It doesn't appear to need it and it doesn't liketask_structnow.
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.
Signature · 2 lines
Tom Rini http://gate.crashing.org/~trini/
Quoted 12 lines · Tom Rini
Quoted 3 lines · Greg Weeks
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.
Quoted 9 lines
Quoted 3 lines
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.cwas includingelf.hin the first place I'd appreciate it. It doesn't appear to need it and it doesn't liketask_structnow.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
Quoted 15 lines · Greg Weeks
Quoted 13 lines · Tom Rini
Quoted 2 lines · Greg Weeks
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.
Quoted 5 lines
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.cwas includingelf.hin the first place I'd appreciate it. It doesn't appear to need it and it doesn't liketask_structnow.
Quoted 4 lines
Quoted 2 lines
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.
Signature · 2 lines
Tom Rini http://gate.crashing.org/~trini/