Commit 02ef691f6ce4097da5617ebf59493487cb2b4f82
Committed by
Linus Torvalds
1 parent
697102cda5
Exists in
master
and in
7 other branches
[PATCH] arm26: 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>
Showing 3 changed files with 7 additions and 23 deletions Side-by-side Diff
arch/arm26/kernel/process.c
... | ... | @@ -278,9 +278,8 @@ |
278 | 278 | unsigned long unused, struct task_struct *p, struct pt_regs *regs) |
279 | 279 | { |
280 | 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 | 283 | *childregs = *regs; |
285 | 284 | childregs->ARM_r0 = 0; |
286 | 285 | childregs->ARM_sp = stack_start; |
arch/arm26/kernel/ptrace.c
... | ... | @@ -40,21 +40,6 @@ |
40 | 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 | 43 | * this routine will get a word off of the processes privileged stack. |
59 | 44 | * the offset is how far from the base addr as stored in the THREAD. |
60 | 45 | * this routine assumes that all the privileged stacks are in our |
... | ... | @@ -62,7 +47,7 @@ |
62 | 47 | */ |
63 | 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 @@ |
74 | 59 | static inline int |
75 | 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 | 63 | int ret = -EINVAL; |
79 | 64 | |
80 | 65 | newregs = *regs; |
... | ... | @@ -377,7 +362,7 @@ |
377 | 362 | u32 insn; |
378 | 363 | int res; |
379 | 364 | |
380 | - regs = get_user_regs(child); | |
365 | + regs = task_pt_regs(child); | |
381 | 366 | pc = instruction_pointer(regs); |
382 | 367 | |
383 | 368 | res = read_instr(child, pc, &insn); |
... | ... | @@ -500,7 +485,7 @@ |
500 | 485 | */ |
501 | 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 | 490 | return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; |
506 | 491 | } |
... | ... | @@ -515,7 +500,7 @@ |
515 | 500 | |
516 | 501 | ret = -EFAULT; |
517 | 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 | 505 | ret = -EINVAL; |
521 | 506 | if (valid_user_regs(&newregs)) { |
include/asm-arm26/thread_info.h
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | |
83 | 83 | /* FIXME - PAGE_SIZE < 32K */ |
84 | 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 | 87 | extern struct thread_info *alloc_thread_info(struct task_struct *task); |
88 | 88 | extern void free_thread_info(struct thread_info *); |