Commit 40bc9c67 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] mips: task_pt_regs()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6450578f
...@@ -229,9 +229,7 @@ void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs) ...@@ -229,9 +229,7 @@ void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs)
int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs) int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs)
{ {
struct thread_info *ti = tsk->thread_info; elf_dump_regs(*regs, task_pt_regs(tsk));
long ksp = (unsigned long)ti + THREAD_SIZE - 32;
elf_dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1);
return 1; return 1;
} }
......
...@@ -64,8 +64,7 @@ int ptrace_getregs (struct task_struct *child, __s64 __user *data) ...@@ -64,8 +64,7 @@ int ptrace_getregs (struct task_struct *child, __s64 __user *data)
if (!access_ok(VERIFY_WRITE, data, 38 * 8)) if (!access_ok(VERIFY_WRITE, data, 38 * 8))
return -EIO; return -EIO;
regs = (struct pt_regs *) ((unsigned long) child->thread_info + regs = task_pt_regs(child);
THREAD_SIZE - 32 - sizeof(struct pt_regs));
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
__put_user (regs->regs[i], data + i); __put_user (regs->regs[i], data + i);
...@@ -92,8 +91,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data) ...@@ -92,8 +91,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data)
if (!access_ok(VERIFY_READ, data, 38 * 8)) if (!access_ok(VERIFY_READ, data, 38 * 8))
return -EIO; return -EIO;
regs = (struct pt_regs *) ((unsigned long) child->thread_info + regs = task_pt_regs(child);
THREAD_SIZE - 32 - sizeof(struct pt_regs));
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
__get_user (regs->regs[i], data + i); __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,8 +196,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
struct pt_regs *regs; struct pt_regs *regs;
unsigned long tmp = 0; unsigned long tmp = 0;
regs = (struct pt_regs *) ((unsigned long) child->thread_info + regs = task_pt_regs(child);
THREAD_SIZE - 32 - sizeof(struct pt_regs));
ret = 0; /* Default return value. */ ret = 0; /* Default return value. */
switch (addr) { switch (addr) {
...@@ -314,8 +311,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -314,8 +311,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
case PTRACE_POKEUSR: { case PTRACE_POKEUSR: {
struct pt_regs *regs; struct pt_regs *regs;
ret = 0; ret = 0;
regs = (struct pt_regs *) ((unsigned long) child->thread_info + regs = task_pt_regs(child);
THREAD_SIZE - 32 - sizeof(struct pt_regs));
switch (addr) { switch (addr) {
case 0 ... 31: case 0 ... 31:
......
...@@ -126,8 +126,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) ...@@ -126,8 +126,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
struct pt_regs *regs; struct pt_regs *regs;
unsigned int tmp; unsigned int tmp;
regs = (struct pt_regs *) ((unsigned long) child->thread_info + regs = task_pt_regs(child);
THREAD_SIZE - 32 - sizeof(struct pt_regs));
ret = 0; /* Default return value. */ ret = 0; /* Default return value. */
switch (addr) { switch (addr) {
...@@ -259,8 +258,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) ...@@ -259,8 +258,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
case PTRACE_POKEUSR: { case PTRACE_POKEUSR: {
struct pt_regs *regs; struct pt_regs *regs;
ret = 0; ret = 0;
regs = (struct pt_regs *) ((unsigned long) child->thread_info + regs = task_pt_regs(child);
THREAD_SIZE - 32 - sizeof(struct pt_regs));
switch (addr) { switch (addr) {
case 0 ... 31: case 0 ... 31:
......
...@@ -200,11 +200,11 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long ...@@ -200,11 +200,11 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long
unsigned long get_wchan(struct task_struct *p); unsigned long get_wchan(struct task_struct *p);
#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs))
#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32) #define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32)
#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc))) #define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29]))) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status))) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
#define cpu_relax() barrier() #define cpu_relax() barrier()
......
...@@ -159,7 +159,7 @@ struct task_struct; ...@@ -159,7 +159,7 @@ struct task_struct;
do { \ do { \
if (cpu_has_dsp) \ if (cpu_has_dsp) \
__save_dsp(prev); \ __save_dsp(prev); \
(last) = resume(prev, next, next->thread_info); \ (last) = resume(prev, next, task_thread_info(next)); \
if (cpu_has_dsp) \ if (cpu_has_dsp) \
__restore_dsp(current); \ __restore_dsp(current); \
} while(0) } while(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment