diff options
-rw-r--r-- | arch/arm26/kernel/process.c | 3 | ||||
-rw-r--r-- | arch/arm26/kernel/ptrace.c | 25 | ||||
-rw-r--r-- | include/asm-arm26/thread_info.h | 2 |
3 files changed, 7 insertions, 23 deletions
diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c index 159f84a86321..386305659171 100644 --- a/arch/arm26/kernel/process.c +++ b/arch/arm26/kernel/process.c | |||
@@ -278,9 +278,8 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, | |||
278 | unsigned long unused, struct task_struct *p, struct pt_regs *regs) | 278 | unsigned long unused, struct task_struct *p, struct pt_regs *regs) |
279 | { | 279 | { |
280 | struct thread_info *thread = task_thread_info(p); | 280 | struct thread_info *thread = task_thread_info(p); |
281 | struct pt_regs *childregs; | 281 | struct pt_regs *childregs = task_pt_regs(p); |
282 | 282 | ||
283 | childregs = __get_user_regs(thread); | ||
284 | *childregs = *regs; | 283 | *childregs = *regs; |
285 | childregs->ARM_r0 = 0; | 284 | childregs->ARM_r0 = 0; |
286 | childregs->ARM_sp = stack_start; | 285 | childregs->ARM_sp = stack_start; |
diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c index 56afe1f6396a..3c3371d4683e 100644 --- a/arch/arm26/kernel/ptrace.c +++ b/arch/arm26/kernel/ptrace.c | |||
@@ -40,21 +40,6 @@ | |||
40 | #define BREAKINST_ARM 0xef9f0001 | 40 | #define BREAKINST_ARM 0xef9f0001 |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * Get the address of the live pt_regs for the specified task. | ||
44 | * These are saved onto the top kernel stack when the process | ||
45 | * is not running. | ||
46 | * | ||
47 | * Note: if a user thread is execve'd from kernel space, the | ||
48 | * kernel stack will not be empty on entry to the kernel, so | ||
49 | * ptracing these tasks will fail. | ||
50 | */ | ||
51 | static inline struct pt_regs * | ||
52 | get_user_regs(struct task_struct *task) | ||
53 | { | ||
54 | return __get_user_regs(task->thread_info); | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * this routine will get a word off of the processes privileged stack. | 43 | * this routine will get a word off of the processes privileged stack. |
59 | * the offset is how far from the base addr as stored in the THREAD. | 44 | * the offset is how far from the base addr as stored in the THREAD. |
60 | * this routine assumes that all the privileged stacks are in our | 45 | * this routine assumes that all the privileged stacks are in our |
@@ -62,7 +47,7 @@ get_user_regs(struct task_struct *task) | |||
62 | */ | 47 | */ |
63 | static inline long get_user_reg(struct task_struct *task, int offset) | 48 | static inline long get_user_reg(struct task_struct *task, int offset) |
64 | { | 49 | { |
65 | return get_user_regs(task)->uregs[offset]; | 50 | return task_pt_regs(task)->uregs[offset]; |
66 | } | 51 | } |
67 | 52 | ||
68 | /* | 53 | /* |
@@ -74,7 +59,7 @@ static inline long get_user_reg(struct task_struct *task, int offset) | |||
74 | static inline int | 59 | static inline int |
75 | put_user_reg(struct task_struct *task, int offset, long data) | 60 | put_user_reg(struct task_struct *task, int offset, long data) |
76 | { | 61 | { |
77 | struct pt_regs newregs, *regs = get_user_regs(task); | 62 | struct pt_regs newregs, *regs = task_pt_regs(task); |
78 | int ret = -EINVAL; | 63 | int ret = -EINVAL; |
79 | 64 | ||
80 | newregs = *regs; | 65 | newregs = *regs; |
@@ -377,7 +362,7 @@ void ptrace_set_bpt(struct task_struct *child) | |||
377 | u32 insn; | 362 | u32 insn; |
378 | int res; | 363 | int res; |
379 | 364 | ||
380 | regs = get_user_regs(child); | 365 | regs = task_pt_regs(child); |
381 | pc = instruction_pointer(regs); | 366 | pc = instruction_pointer(regs); |
382 | 367 | ||
383 | res = read_instr(child, pc, &insn); | 368 | res = read_instr(child, pc, &insn); |
@@ -500,7 +485,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off, | |||
500 | */ | 485 | */ |
501 | static int ptrace_getregs(struct task_struct *tsk, void *uregs) | 486 | static int ptrace_getregs(struct task_struct *tsk, void *uregs) |
502 | { | 487 | { |
503 | struct pt_regs *regs = get_user_regs(tsk); | 488 | struct pt_regs *regs = task_pt_regs(tsk); |
504 | 489 | ||
505 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; | 490 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; |
506 | } | 491 | } |
@@ -515,7 +500,7 @@ static int ptrace_setregs(struct task_struct *tsk, void *uregs) | |||
515 | 500 | ||
516 | ret = -EFAULT; | 501 | ret = -EFAULT; |
517 | if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { | 502 | if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { |
518 | struct pt_regs *regs = get_user_regs(tsk); | 503 | struct pt_regs *regs = task_pt_regs(tsk); |
519 | 504 | ||
520 | ret = -EINVAL; | 505 | ret = -EINVAL; |
521 | if (valid_user_regs(&newregs)) { | 506 | if (valid_user_regs(&newregs)) { |
diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index 909c88dff84d..f332b40aaabd 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h | |||
@@ -82,7 +82,7 @@ static inline struct thread_info *current_thread_info(void) | |||
82 | 82 | ||
83 | /* FIXME - PAGE_SIZE < 32K */ | 83 | /* FIXME - PAGE_SIZE < 32K */ |
84 | #define THREAD_SIZE (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768 | 84 | #define THREAD_SIZE (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768 |
85 | #define __get_user_regs(x) (((struct pt_regs *)((unsigned long)(x) + THREAD_SIZE - 8)) - 1) | 85 | #define task_pt_regs(task) ((struct pt_regs *)((unsigned long)(task)->thread_info + THREAD_SIZE - 8) - 1) |
86 | 86 | ||
87 | extern struct thread_info *alloc_thread_info(struct task_struct *task); | 87 | extern struct thread_info *alloc_thread_info(struct task_struct *task); |
88 | extern void free_thread_info(struct thread_info *); | 88 | extern void free_thread_info(struct thread_info *); |