diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2006-01-12 04:05:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 12:08:57 -0500 |
commit | 02ef691f6ce4097da5617ebf59493487cb2b4f82 (patch) | |
tree | d8622de19098caeed92142a5edfe7d0df04f98a4 /arch/arm26/kernel | |
parent | 697102cda5c5e778d0bc3b4b9f8d935f4fe64125 (diff) |
[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>
Diffstat (limited to 'arch/arm26/kernel')
-rw-r--r-- | arch/arm26/kernel/process.c | 3 | ||||
-rw-r--r-- | arch/arm26/kernel/ptrace.c | 25 |
2 files changed, 6 insertions, 22 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)) { |