]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
new helper: signal_pt_regs()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 5 Nov 2012 18:00:27 +0000 (13:00 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 29 Nov 2012 05:01:23 +0000 (00:01 -0500)
Always equal to task_pt_regs(current); defined only when we are in
signal delivery.  It may be different from current_pt_regs() - e.g.
architectures like m68k may have pt_regs location on exception
different from that on a syscall and signals (just as ptrace handling)
may happen on exceptions as well as on syscalls.

When they are equal, it's often better to have signal_pt_regs
defined (in asm/ptrace.h) as current_pt_regs - that tends to be
optimized better than default would be.  However, optimisation is
the only reason why we might want an arch-specific definition;
if current_pt_regs() and task_pt_regs(current) have different
values, the latter one is right.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/alpha/include/asm/ptrace.h
arch/h8300/include/asm/ptrace.h
include/linux/ptrace.h

index b87755a1955482f9a46282749ed68755afca4973..b4c5b2fbb6478a4c330d8760019cb07487b15ca9 100644 (file)
@@ -78,6 +78,7 @@ struct switch_stack {
 
 #define current_pt_regs() \
   ((struct pt_regs *) ((char *)current_thread_info() + 2*PAGE_SIZE) - 1)
+#define signal_pt_regs current_pt_regs
 
 #define force_successful_syscall_return() (current_pt_regs()->r0 = 0)
 
index 00502a61bf0a428c4e050bdbd5ddac413013e4b2..7468589a128b1be95d142b2f2e9f5139def6bc24 100644 (file)
@@ -62,6 +62,7 @@ struct pt_regs {
 #define profile_pc(regs) instruction_pointer(regs)
 #define current_pt_regs() ((struct pt_regs *) \
        (THREAD_SIZE + (unsigned long)current_thread_info()) - 1)
+#define signal_pt_regs() ((struct pt_regs *)current->thread.esp0)
 #endif /* __KERNEL__ */
 #endif /* __ASSEMBLY__ */
 #endif /* _H8300_PTRACE_H */
index 7aefbae2452e87473a7026fda45e7476b97a995c..b8e6dcec78ae0bd8c66aca7c7b220fc32071bbce 100644 (file)
@@ -333,6 +333,15 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
 #endif
 
+/*
+ * unlike current_pt_regs(), this one is equal to task_pt_regs(current)
+ * on *all* architectures; the only reason to have a per-arch definition
+ * is optimisation.
+ */
+#ifndef signal_pt_regs
+#define signal_pt_regs() task_pt_regs(current)
+#endif
+
 extern int task_current_syscall(struct task_struct *target, long *callno,
                                unsigned long args[6], unsigned int maxargs,
                                unsigned long *sp, unsigned long *pc);