aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/process.c4
-rw-r--r--arch/mips/kernel/ptrace.c12
-rw-r--r--arch/mips/kernel/ptrace32.c6
-rw-r--r--include/asm-mips/processor.h8
-rw-r--r--include/asm-mips/system.h2
5 files changed, 12 insertions, 20 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 0476a4dce14e..aca56f4a5d50 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -229,9 +229,7 @@ void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs)
229 229
230int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs) 230int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs)
231{ 231{
232 struct thread_info *ti = tsk->thread_info; 232 elf_dump_regs(*regs, task_pt_regs(tsk));
233 long ksp = (unsigned long)ti + THREAD_SIZE - 32;
234 elf_dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1);
235 return 1; 233 return 1;
236} 234}
237 235
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 8d2549335304..6c358b333166 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -64,8 +64,7 @@ int ptrace_getregs (struct task_struct *child, __s64 __user *data)
64 if (!access_ok(VERIFY_WRITE, data, 38 * 8)) 64 if (!access_ok(VERIFY_WRITE, data, 38 * 8))
65 return -EIO; 65 return -EIO;
66 66
67 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 67 regs = task_pt_regs(child);
68 THREAD_SIZE - 32 - sizeof(struct pt_regs));
69 68
70 for (i = 0; i < 32; i++) 69 for (i = 0; i < 32; i++)
71 __put_user (regs->regs[i], data + i); 70 __put_user (regs->regs[i], data + i);
@@ -92,8 +91,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data)
92 if (!access_ok(VERIFY_READ, data, 38 * 8)) 91 if (!access_ok(VERIFY_READ, data, 38 * 8))
93 return -EIO; 92 return -EIO;
94 93
95 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 94 regs = task_pt_regs(child);
96 THREAD_SIZE - 32 - sizeof(struct pt_regs));
97 95
98 for (i = 0; i < 32; i++) 96 for (i = 0; i < 32; i++)
99 __get_user (regs->regs[i], data + i); 97 __get_user (regs->regs[i], data + i);
@@ -198,8 +196,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
198 struct pt_regs *regs; 196 struct pt_regs *regs;
199 unsigned long tmp = 0; 197 unsigned long tmp = 0;
200 198
201 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 199 regs = task_pt_regs(child);
202 THREAD_SIZE - 32 - sizeof(struct pt_regs));
203 ret = 0; /* Default return value. */ 200 ret = 0; /* Default return value. */
204 201
205 switch (addr) { 202 switch (addr) {
@@ -314,8 +311,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
314 case PTRACE_POKEUSR: { 311 case PTRACE_POKEUSR: {
315 struct pt_regs *regs; 312 struct pt_regs *regs;
316 ret = 0; 313 ret = 0;
317 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 314 regs = task_pt_regs(child);
318 THREAD_SIZE - 32 - sizeof(struct pt_regs));
319 315
320 switch (addr) { 316 switch (addr) {
321 case 0 ... 31: 317 case 0 ... 31:
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 1f998bfde165..456ec438728c 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -126,8 +126,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
126 struct pt_regs *regs; 126 struct pt_regs *regs;
127 unsigned int tmp; 127 unsigned int tmp;
128 128
129 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 129 regs = task_pt_regs(child);
130 THREAD_SIZE - 32 - sizeof(struct pt_regs));
131 ret = 0; /* Default return value. */ 130 ret = 0; /* Default return value. */
132 131
133 switch (addr) { 132 switch (addr) {
@@ -259,8 +258,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
259 case PTRACE_POKEUSR: { 258 case PTRACE_POKEUSR: {
260 struct pt_regs *regs; 259 struct pt_regs *regs;
261 ret = 0; 260 ret = 0;
262 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 261 regs = task_pt_regs(child);
263 THREAD_SIZE - 32 - sizeof(struct pt_regs));
264 262
265 switch (addr) { 263 switch (addr) {
266 case 0 ... 31: 264 case 0 ... 31:
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index de53055a62ae..ab3123ea5658 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -200,11 +200,11 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long
200 200
201unsigned long get_wchan(struct task_struct *p); 201unsigned long get_wchan(struct task_struct *p);
202 202
203#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs))
204#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32) 203#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32)
205#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc))) 204#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
206#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29]))) 205#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
207#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status))) 206#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
207#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
208 208
209#define cpu_relax() barrier() 209#define cpu_relax() barrier()
210 210
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 5f761ad5a8d9..e8e5d4143377 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -159,7 +159,7 @@ struct task_struct;
159do { \ 159do { \
160 if (cpu_has_dsp) \ 160 if (cpu_has_dsp) \
161 __save_dsp(prev); \ 161 __save_dsp(prev); \
162 (last) = resume(prev, next, next->thread_info); \ 162 (last) = resume(prev, next, task_thread_info(next)); \
163 if (cpu_has_dsp) \ 163 if (cpu_has_dsp) \
164 __restore_dsp(current); \ 164 __restore_dsp(current); \
165} while(0) 165} while(0)