aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/binfmt_elfo32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/binfmt_elfo32.c')
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index b4075e99c452..cec5f327e360 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -54,7 +54,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
54 54
55#include <asm/processor.h> 55#include <asm/processor.h>
56#include <linux/module.h> 56#include <linux/module.h>
57#include <linux/config.h>
58#include <linux/elfcore.h> 57#include <linux/elfcore.h>
59#include <linux/compat.h> 58#include <linux/compat.h>
60 59
@@ -98,7 +97,7 @@ struct elf_prpsinfo32
98#define init_elf_binfmt init_elf32_binfmt 97#define init_elf_binfmt init_elf32_binfmt
99 98
100#define jiffies_to_timeval jiffies_to_compat_timeval 99#define jiffies_to_timeval jiffies_to_compat_timeval
101static __inline__ void 100static inline void
102jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) 101jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
103{ 102{
104 /* 103 /*
@@ -113,21 +112,26 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
113#undef ELF_CORE_COPY_REGS 112#undef ELF_CORE_COPY_REGS
114#define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs); 113#define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs);
115 114
116void elf32_core_copy_regs(elf_gregset_t _dest, struct pt_regs *_regs) 115void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs)
117{ 116{
118 int i; 117 int i;
119 118
120 memset(_dest, 0, sizeof(elf_gregset_t)); 119 for (i = 0; i < EF_R0; i++)
121 120 grp[i] = 0;
122 /* XXXKW the 6 is from EF_REG0 in gdb/gdb/mips-linux-tdep.c, include/asm-mips/reg.h */ 121 grp[EF_R0] = 0;
123 for (i=6; i<38; i++) 122 for (i = 1; i <= 31; i++)
124 _dest[i] = (elf_greg_t) _regs->regs[i-6]; 123 grp[EF_R0 + i] = (elf_greg_t) regs->regs[i];
125 _dest[i++] = (elf_greg_t) _regs->lo; 124 grp[EF_R26] = 0;
126 _dest[i++] = (elf_greg_t) _regs->hi; 125 grp[EF_R27] = 0;
127 _dest[i++] = (elf_greg_t) _regs->cp0_epc; 126 grp[EF_LO] = (elf_greg_t) regs->lo;
128 _dest[i++] = (elf_greg_t) _regs->cp0_badvaddr; 127 grp[EF_HI] = (elf_greg_t) regs->hi;
129 _dest[i++] = (elf_greg_t) _regs->cp0_status; 128 grp[EF_CP0_EPC] = (elf_greg_t) regs->cp0_epc;
130 _dest[i++] = (elf_greg_t) _regs->cp0_cause; 129 grp[EF_CP0_BADVADDR] = (elf_greg_t) regs->cp0_badvaddr;
130 grp[EF_CP0_STATUS] = (elf_greg_t) regs->cp0_status;
131 grp[EF_CP0_CAUSE] = (elf_greg_t) regs->cp0_cause;
132#ifdef EF_UNUSED0
133 grp[EF_UNUSED0] = 0;
134#endif
131} 135}
132 136
133MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries"); 137MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries");
@@ -136,4 +140,7 @@ MODULE_AUTHOR("Ralf Baechle (ralf@linux-mips.org)");
136#undef MODULE_DESCRIPTION 140#undef MODULE_DESCRIPTION
137#undef MODULE_AUTHOR 141#undef MODULE_AUTHOR
138 142
143#undef TASK_SIZE
144#define TASK_SIZE TASK_SIZE32
145
139#include "../../../fs/binfmt_elf.c" 146#include "../../../fs/binfmt_elf.c"