diff options
| author | Al Viro <viro@ftp.linux.org.uk> | 2006-01-12 04:05:57 -0500 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 12:08:55 -0500 | 
| commit | 815d5ec86eb8d5f57e5e4aa147bd1fb6338c58ac (patch) | |
| tree | fe2e78f38963c0de63e032ec84b25a56ce963bd1 /arch/arm/kernel | |
| parent | e7c1b32fd354c34c4dceb1736a485bc5d91f7c43 (diff) | |
[PATCH] arm: task_pt_regs()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/arm/kernel')
| -rw-r--r-- | arch/arm/kernel/process.c | 5 | ||||
| -rw-r--r-- | arch/arm/kernel/ptrace.c | 27 | 
2 files changed, 7 insertions, 25 deletions
| diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 46d0984b44ff..91d107d33c8d 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
| @@ -355,10 +355,9 @@ int | |||
| 355 | copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, | 355 | copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, | 
| 356 | unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) | 356 | unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) | 
| 357 | { | 357 | { | 
| 358 | struct thread_info *thread = p->thread_info; | 358 | struct thread_info *thread = task_thread_info(p); | 
| 359 | struct pt_regs *childregs; | 359 | struct pt_regs *childregs = task_pt_regs(p); | 
| 360 | 360 | ||
| 361 | childregs = (void *)thread + THREAD_START_SP - sizeof(*regs); | ||
| 362 | *childregs = *regs; | 361 | *childregs = *regs; | 
| 363 | childregs->ARM_r0 = 0; | 362 | childregs->ARM_r0 = 0; | 
| 364 | childregs->ARM_sp = stack_start; | 363 | childregs->ARM_sp = stack_start; | 
| diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index f003062c9457..e591f72bcdeb 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
| @@ -55,23 +55,6 @@ | |||
| 55 | #endif | 55 | #endif | 
| 56 | 56 | ||
| 57 | /* | 57 | /* | 
| 58 | * Get the address of the live pt_regs for the specified task. | ||
| 59 | * These are saved onto the top kernel stack when the process | ||
| 60 | * is not running. | ||
| 61 | * | ||
| 62 | * Note: if a user thread is execve'd from kernel space, the | ||
| 63 | * kernel stack will not be empty on entry to the kernel, so | ||
| 64 | * ptracing these tasks will fail. | ||
| 65 | */ | ||
| 66 | static inline struct pt_regs * | ||
| 67 | get_user_regs(struct task_struct *task) | ||
| 68 | { | ||
| 69 | return (struct pt_regs *) | ||
| 70 | ((unsigned long)task->thread_info + THREAD_SIZE - | ||
| 71 | 8 - sizeof(struct pt_regs)); | ||
| 72 | } | ||
| 73 | |||
| 74 | /* | ||
| 75 | * this routine will get a word off of the processes privileged stack. | 58 | * this routine will get a word off of the processes privileged stack. | 
| 76 | * the offset is how far from the base addr as stored in the THREAD. | 59 | * the offset is how far from the base addr as stored in the THREAD. | 
| 77 | * this routine assumes that all the privileged stacks are in our | 60 | * this routine assumes that all the privileged stacks are in our | 
| @@ -79,7 +62,7 @@ get_user_regs(struct task_struct *task) | |||
| 79 | */ | 62 | */ | 
| 80 | static inline long get_user_reg(struct task_struct *task, int offset) | 63 | static inline long get_user_reg(struct task_struct *task, int offset) | 
| 81 | { | 64 | { | 
| 82 | return get_user_regs(task)->uregs[offset]; | 65 | return task_pt_regs(task)->uregs[offset]; | 
| 83 | } | 66 | } | 
| 84 | 67 | ||
| 85 | /* | 68 | /* | 
| @@ -91,7 +74,7 @@ static inline long get_user_reg(struct task_struct *task, int offset) | |||
| 91 | static inline int | 74 | static inline int | 
| 92 | put_user_reg(struct task_struct *task, int offset, long data) | 75 | put_user_reg(struct task_struct *task, int offset, long data) | 
| 93 | { | 76 | { | 
| 94 | struct pt_regs newregs, *regs = get_user_regs(task); | 77 | struct pt_regs newregs, *regs = task_pt_regs(task); | 
| 95 | int ret = -EINVAL; | 78 | int ret = -EINVAL; | 
| 96 | 79 | ||
| 97 | newregs = *regs; | 80 | newregs = *regs; | 
| @@ -421,7 +404,7 @@ void ptrace_set_bpt(struct task_struct *child) | |||
| 421 | u32 insn; | 404 | u32 insn; | 
| 422 | int res; | 405 | int res; | 
| 423 | 406 | ||
| 424 | regs = get_user_regs(child); | 407 | regs = task_pt_regs(child); | 
| 425 | pc = instruction_pointer(regs); | 408 | pc = instruction_pointer(regs); | 
| 426 | 409 | ||
| 427 | if (thumb_mode(regs)) { | 410 | if (thumb_mode(regs)) { | 
| @@ -572,7 +555,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off, | |||
| 572 | */ | 555 | */ | 
| 573 | static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) | 556 | static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) | 
| 574 | { | 557 | { | 
| 575 | struct pt_regs *regs = get_user_regs(tsk); | 558 | struct pt_regs *regs = task_pt_regs(tsk); | 
| 576 | 559 | ||
| 577 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; | 560 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; | 
| 578 | } | 561 | } | 
| @@ -587,7 +570,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs) | |||
| 587 | 570 | ||
| 588 | ret = -EFAULT; | 571 | ret = -EFAULT; | 
| 589 | if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { | 572 | if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { | 
| 590 | struct pt_regs *regs = get_user_regs(tsk); | 573 | struct pt_regs *regs = task_pt_regs(tsk); | 
| 591 | 574 | ||
| 592 | ret = -EINVAL; | 575 | ret = -EINVAL; | 
| 593 | if (valid_user_regs(&newregs)) { | 576 | if (valid_user_regs(&newregs)) { | 
