| 1 | From 784b170a69906c48a688a9ffa7512fc858f8836c Mon Sep 17 00:00:00 2001 |
| 2 | From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com> |
| 3 | Date: Sun, 30 Mar 2008 21:36:29 -0700 |
| 4 | Subject: [PATCH 061/134] [ARM] Save thread registers in coredumps |
| 5 | |
| 6 | Signed-off-by: Brian Swetland <swetland@google.com> |
| 7 | --- |
| 8 | arch/arm/include/asm/elf.h | 6 ++++++ |
| 9 | arch/arm/kernel/process.c | 10 ++++++++++ |
| 10 | 2 files changed, 16 insertions(+), 0 deletions(-) |
| 11 | |
| 12 | --- a/arch/arm/include/asm/elf.h |
| 13 | +++ b/arch/arm/include/asm/elf.h |
| 14 | @@ -86,6 +86,10 @@ extern char elf_platform[]; |
| 15 | |
| 16 | struct elf32_hdr; |
| 17 | |
| 18 | +struct task_struct; |
| 19 | + |
| 20 | +extern int dump_task_regs (struct task_struct *, elf_gregset_t *); |
| 21 | + |
| 22 | /* |
| 23 | * This is used to ensure we don't load something for the wrong architecture. |
| 24 | */ |
| 25 | @@ -113,4 +117,6 @@ extern int arm_elf_read_implies_exec(con |
| 26 | extern void elf_set_personality(const struct elf32_hdr *); |
| 27 | #define SET_PERSONALITY(ex) elf_set_personality(&(ex)) |
| 28 | |
| 29 | +#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) |
| 30 | + |
| 31 | #endif |
| 32 | --- a/arch/arm/kernel/process.c |
| 33 | +++ b/arch/arm/kernel/process.c |
| 34 | @@ -337,6 +337,16 @@ int dump_fpu (struct pt_regs *regs, stru |
| 35 | EXPORT_SYMBOL(dump_fpu); |
| 36 | |
| 37 | /* |
| 38 | + * Capture the user space registers if the task is not running (in user space) |
| 39 | + */ |
| 40 | +int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) |
| 41 | +{ |
| 42 | + struct pt_regs ptregs = *task_pt_regs(tsk); |
| 43 | + elf_core_copy_regs(regs, &ptregs); |
| 44 | + return 1; |
| 45 | +} |
| 46 | + |
| 47 | +/* |
| 48 | * Shuffle the argument into the correct register before calling the |
| 49 | * thread function. r1 is the thread argument, r2 is the pointer to |
| 50 | * the thread function, and r3 points to the exit function. |
| 51 | |