diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2005-01-25 21:21:06 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2005-10-29 14:30:19 -0400 |
commit | b053c98fbbe9942669af2f1a351eaeae1b344d38 (patch) | |
tree | a2b94eff483c4d9bad2f28502126823e5d25172e /arch/mips/kernel/binfmt_elfo32.c | |
parent | c83cfc9c9477d0bc0e0a1ba29dfc58e0d42b2faf (diff) |
Fix register layout in o32 core dumps on 64-bit systems.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/binfmt_elfo32.c')
-rw-r--r-- | arch/mips/kernel/binfmt_elfo32.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c index b4075e99c452..3ef8c852e830 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c | |||
@@ -98,7 +98,7 @@ struct elf_prpsinfo32 | |||
98 | #define init_elf_binfmt init_elf32_binfmt | 98 | #define init_elf_binfmt init_elf32_binfmt |
99 | 99 | ||
100 | #define jiffies_to_timeval jiffies_to_compat_timeval | 100 | #define jiffies_to_timeval jiffies_to_compat_timeval |
101 | static __inline__ void | 101 | static inline void |
102 | jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) | 102 | jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) |
103 | { | 103 | { |
104 | /* | 104 | /* |
@@ -113,21 +113,26 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) | |||
113 | #undef ELF_CORE_COPY_REGS | 113 | #undef ELF_CORE_COPY_REGS |
114 | #define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs); | 114 | #define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs); |
115 | 115 | ||
116 | void elf32_core_copy_regs(elf_gregset_t _dest, struct pt_regs *_regs) | 116 | void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs) |
117 | { | 117 | { |
118 | int i; | 118 | int i; |
119 | 119 | ||
120 | memset(_dest, 0, sizeof(elf_gregset_t)); | 120 | for (i = 0; i < EF_R0; i++) |
121 | 121 | grp[i] = 0; | |
122 | /* XXXKW the 6 is from EF_REG0 in gdb/gdb/mips-linux-tdep.c, include/asm-mips/reg.h */ | 122 | grp[EF_R0] = 0; |
123 | for (i=6; i<38; i++) | 123 | for (i = 1; i <= 31; i++) |
124 | _dest[i] = (elf_greg_t) _regs->regs[i-6]; | 124 | grp[EF_R0 + i] = (elf_greg_t) regs->regs[i]; |
125 | _dest[i++] = (elf_greg_t) _regs->lo; | 125 | grp[EF_R26] = 0; |
126 | _dest[i++] = (elf_greg_t) _regs->hi; | 126 | grp[EF_R27] = 0; |
127 | _dest[i++] = (elf_greg_t) _regs->cp0_epc; | 127 | grp[EF_LO] = (elf_greg_t) regs->lo; |
128 | _dest[i++] = (elf_greg_t) _regs->cp0_badvaddr; | 128 | grp[EF_HI] = (elf_greg_t) regs->hi; |
129 | _dest[i++] = (elf_greg_t) _regs->cp0_status; | 129 | grp[EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc; |
130 | _dest[i++] = (elf_greg_t) _regs->cp0_cause; | 130 | grp[EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr; |
131 | grp[EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status; | ||
132 | grp[EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause; | ||
133 | #ifdef EF_UNUSED0 | ||
134 | grp[EF_UNUSED0] = 0; | ||
135 | #endif | ||
131 | } | 136 | } |
132 | 137 | ||
133 | MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries"); | 138 | MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries"); |