The core dump code in binfmt_elfo32.c has bitrotted. It no longer worked after elfcore.h started using inline functions - not sure when that was. With this, I have both single-threaded and multi-threaded core dumps working. I'm not sure about the FP bits, if a task is currently using hardware FP, but I just copied the existing brokenness from dump_fpu. Better than nothing. Signed-off-by: Daniel Jacobowitz <dan@xxxxxxxxxxxxxxxx> Index: linux/arch/mips/kernel/binfmt_elfo32.c =================================================================== --- linux.orig/arch/mips/kernel/binfmt_elfo32.c 2005-01-20 18:43:06.979702056 -0500 +++ linux/arch/mips/kernel/binfmt_elfo32.c 2005-01-20 19:51:07.238552283 -0500 @@ -55,43 +55,10 @@ #include <asm/processor.h> #include <linux/module.h> #include <linux/config.h> -#include <linux/elfcore.h> #include <linux/compat.h> -#define elf_prstatus elf_prstatus32 -struct elf_prstatus32 -{ - struct elf_siginfo pr_info; /* Info associated with signal */ - short pr_cursig; /* Current signal */ - unsigned int pr_sigpend; /* Set of pending signals */ - unsigned int pr_sighold; /* Set of held signals */ - pid_t pr_pid; - pid_t pr_ppid; - pid_t pr_pgrp; - pid_t pr_sid; - struct compat_timeval pr_utime; /* User time */ - struct compat_timeval pr_stime; /* System time */ - struct compat_timeval pr_cutime;/* Cumulative user time */ - struct compat_timeval pr_cstime;/* Cumulative system time */ - elf_gregset_t pr_reg; /* GP registers */ - int pr_fpvalid; /* True if math co-processor being used. */ -}; +#include <asm/ptrace.h> -#define elf_prpsinfo elf_prpsinfo32 -struct elf_prpsinfo32 -{ - char pr_state; /* numeric process state */ - char pr_sname; /* char for pr_state */ - char pr_zomb; /* zombie */ - char pr_nice; /* nice val */ - unsigned int pr_flag; /* flags */ - __kernel_uid_t pr_uid; - __kernel_gid_t pr_gid; - pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* filename of executable */ - char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ -}; #define elf_addr_t u32 #define elf_caddr_t u32 @@ -110,10 +77,12 @@ value->tv_usec /= NSEC_PER_USEC; } +/* These need to be here, before the incluson of elfcore.h. */ + #undef ELF_CORE_COPY_REGS #define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs); -void elf32_core_copy_regs(elf_gregset_t _dest, struct pt_regs *_regs) +static void elf32_core_copy_regs(elf_gregset_t _dest, struct pt_regs *_regs) { int i; @@ -130,6 +99,65 @@ _dest[i++] = (elf_greg_t) _regs->cp0_cause; } +#undef ELF_CORE_COPY_TASK_REGS +#define ELF_CORE_COPY_TASK_REGS(_task,_dest) elf32_core_copy_task_regs(_task, *(_dest)) + +static int elf32_core_copy_task_regs(struct task_struct *_task, elf_gregset_t _dest) +{ + struct pt_regs *_regs; + _regs = (struct pt_regs *) ((unsigned long) _task->thread_info + + THREAD_SIZE - 32 - sizeof (struct pt_regs)); + elf32_core_copy_regs (_dest, _regs); + return 1; +} + +#undef ELF_CORE_COPY_FPREGS +#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) elf32_dump_task_fpu(tsk, elf_fpregs) + +static int elf32_dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpu) +{ + /* FIXME: Is this right? */ + memcpy(fpu, &tsk->thread.fpu, sizeof(tsk->thread.fpu)); + return 1; +} + +#include <linux/elfcore.h> + +#define elf_prstatus elf_prstatus32 +struct elf_prstatus32 +{ + struct elf_siginfo pr_info; /* Info associated with signal */ + short pr_cursig; /* Current signal */ + unsigned int pr_sigpend; /* Set of pending signals */ + unsigned int pr_sighold; /* Set of held signals */ + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct compat_timeval pr_utime; /* User time */ + struct compat_timeval pr_stime; /* System time */ + struct compat_timeval pr_cutime;/* Cumulative user time */ + struct compat_timeval pr_cstime;/* Cumulative system time */ + elf_gregset_t pr_reg; /* GP registers */ + int pr_fpvalid; /* True if math co-processor being used. */ +}; + +#define elf_prpsinfo elf_prpsinfo32 +struct elf_prpsinfo32 +{ + char pr_state; /* numeric process state */ + char pr_sname; /* char for pr_state */ + char pr_zomb; /* zombie */ + char pr_nice; /* nice val */ + unsigned int pr_flag; /* flags */ + __kernel_uid_t pr_uid; + __kernel_gid_t pr_gid; + pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* filename of executable */ + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ +}; + MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries"); MODULE_AUTHOR("Ralf Baechle (ralf@xxxxxxxxxxxxxx)"); -- Daniel Jacobowitz