···55#endif5657/*58- * Get the address of the live pt_regs for the specified task.59- * These are saved onto the top kernel stack when the process60- * is not running.61- *62- * Note: if a user thread is execve'd from kernel space, the63- * kernel stack will not be empty on entry to the kernel, so64- * 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.76 * 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···62 */63static inline long get_user_reg(struct task_struct *task, int offset)64{65- return get_user_regs(task)->uregs[offset];66}6768/*···74static inline int75put_user_reg(struct task_struct *task, int offset, long data)76{77- struct pt_regs newregs, *regs = get_user_regs(task);78 int ret = -EINVAL;7980 newregs = *regs;···404 u32 insn;405 int res;406407- regs = get_user_regs(child);408 pc = instruction_pointer(regs);409410 if (thumb_mode(regs)) {···555 */556static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)557{558- struct pt_regs *regs = get_user_regs(tsk);559560 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;561}···570571 ret = -EFAULT;572 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {573- struct pt_regs *regs = get_user_regs(tsk);574575 ret = -EINVAL;576 if (valid_user_regs(&newregs)) {
···55#endif5657/*0000000000000000058 * 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.60 * this routine assumes that all the privileged stacks are in our···79 */80static inline long get_user_reg(struct task_struct *task, int offset)81{82+ return task_pt_regs(task)->uregs[offset];83}8485/*···91static inline int92put_user_reg(struct task_struct *task, int offset, long data)93{94+ struct pt_regs newregs, *regs = task_pt_regs(task);95 int ret = -EINVAL;9697 newregs = *regs;···421 u32 insn;422 int res;423424+ regs = task_pt_regs(child);425 pc = instruction_pointer(regs);426427 if (thumb_mode(regs)) {···572 */573static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)574{575+ struct pt_regs *regs = task_pt_regs(tsk);576577 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;578}···587588 ret = -EFAULT;589 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {590+ struct pt_regs *regs = task_pt_regs(tsk);591592 ret = -EINVAL;593 if (valid_user_regs(&newregs)) {
+5-3
include/asm-arm/processor.h
···85 */86extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);8788-#define KSTK_REGS(tsk) (((struct pt_regs *)(THREAD_START_SP + (unsigned long)(tsk)->thread_info)) - 1)89-#define KSTK_EIP(tsk) KSTK_REGS(tsk)->ARM_pc90-#define KSTK_ESP(tsk) KSTK_REGS(tsk)->ARM_sp009192/*93 * Prefetching support - only ARMv5.
···85 */86extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);8788+#define task_pt_regs(p) \89+ ((struct pt_regs *)(THREAD_START_SP + (void *)(p)->thread_info) - 1)90+91+#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc92+#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp9394/*95 * Prefetching support - only ARMv5.