Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

new helper: current_user_stack_pointer()

Cross-architecture equivalent of rdusp(); default is
user_stack_pointer(current_pt_regs()) - that works for almost all
platforms that have usp saved in pt_regs. The only exception from
that is ia64 - we want memory stack, not the backing store for
register one.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 1ca97bb5 5208ba24

+14
+1
arch/alpha/include/asm/ptrace.h
··· 72 72 #define user_mode(regs) (((regs)->ps & 8) != 0) 73 73 #define instruction_pointer(regs) ((regs)->pc) 74 74 #define profile_pc(regs) instruction_pointer(regs) 75 + #define current_user_stack_pointer() rdusp() 75 76 76 77 #define task_pt_regs(task) \ 77 78 ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
+1
arch/blackfin/include/asm/ptrace.h
··· 106 106 #define arch_has_single_step() (1) 107 107 /* common code demands this function */ 108 108 #define ptrace_disable(child) user_disable_single_step(child) 109 + #define current_user_stack_pointer() rdusp() 109 110 110 111 extern int is_user_addr_valid(struct task_struct *child, 111 112 unsigned long start, unsigned long len);
+1
arch/cris/include/asm/ptrace.h
··· 10 10 #define PTRACE_SETREGS 13 11 11 12 12 #define profile_pc(regs) instruction_pointer(regs) 13 + #define current_user_stack_pointer() rdusp() 13 14 14 15 #endif /* __KERNEL__ */ 15 16
+1
arch/h8300/include/asm/ptrace.h
··· 63 63 #define current_pt_regs() ((struct pt_regs *) \ 64 64 (THREAD_SIZE + (unsigned long)current_thread_info()) - 1) 65 65 #define signal_pt_regs() ((struct pt_regs *)current->thread.esp0) 66 + #define current_user_stack_pointer() rdusp() 66 67 #endif /* __KERNEL__ */ 67 68 #endif /* __ASSEMBLY__ */ 68 69 #endif /* _H8300_PTRACE_H */
+5
arch/ia64/include/asm/ptrace.h
··· 78 78 unsigned long __ip = instruction_pointer(regs); \ 79 79 (__ip & ~3UL) + ((__ip & 3UL) << 2); \ 80 80 }) 81 + /* 82 + * Why not default? Because user_stack_pointer() on ia64 gives register 83 + * stack backing store instead... 84 + */ 85 + #define current_user_stack_pointer() (current_pt_regs()->r12) 81 86 82 87 /* given a pointer to a task_struct, return the user's pt_regs */ 83 88 # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
+1
arch/m68k/include/asm/ptrace.h
··· 15 15 #define profile_pc(regs) instruction_pointer(regs) 16 16 #define current_pt_regs() \ 17 17 (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1 18 + #define current_user_stack_pointer() rdusp() 18 19 19 20 #define arch_has_single_step() (1) 20 21
+4
include/linux/ptrace.h
··· 342 342 #define signal_pt_regs() task_pt_regs(current) 343 343 #endif 344 344 345 + #ifndef current_user_stack_pointer 346 + #define current_user_stack_pointer() user_stack_pointer(current_pt_regs()) 347 + #endif 348 + 345 349 extern int task_current_syscall(struct task_struct *target, long *callno, 346 350 unsigned long args[6], unsigned int maxargs, 347 351 unsigned long *sp, unsigned long *pc);