summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@nuts.ninka.net>2003-02-10 12:27:26 -0800
committerDavid S. Miller <davem@nuts.ninka.net>2003-02-10 12:27:26 -0800
commitb6f7756d69ed057d16e1989e6fea345cba5368a9 (patch)
tree70a26339bd7162fb5634e6f72190a089d41a907e /include
parent89ed8e6a62791f20e7da81c7bc9b57f313c1eb96 (diff)
[SIGNAL]: Allow more platforms to use generic get_signal_to_deliver.
The few platforms that cannot use the generic get_signal_to_deliver implementation cannot do so because they do special things for ptraced children. This can be easily avoided and thus all of the signal handling code duplication can be eliminated. This is the first part, which adds a platform hook right before the parent of the ptraced child is woken. Data can be passed in via a cookie argument. The next part will be dealing with platforms that need to muck with breakpoints in the child in this same code block.
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/signal.h1
-rw-r--r--include/asm-cris/signal.h1
-rw-r--r--include/asm-i386/signal.h1
-rw-r--r--include/asm-ia64/signal.h1
-rw-r--r--include/asm-m68knommu/signal.h2
-rw-r--r--include/asm-mips/signal.h2
-rw-r--r--include/asm-mips64/signal.h3
-rw-r--r--include/asm-ppc/signal.h1
-rw-r--r--include/asm-ppc64/signal.h2
-rw-r--r--include/asm-s390/signal.h2
-rw-r--r--include/asm-s390x/signal.h2
-rw-r--r--include/asm-sh/signal.h2
-rw-r--r--include/asm-sparc/signal.h27
-rw-r--r--include/asm-sparc64/signal.h27
-rw-r--r--include/asm-v850/signal.h2
-rw-r--r--include/asm-x86_64/signal.h3
-rw-r--r--include/linux/signal.h2
17 files changed, 78 insertions, 3 deletions
diff --git a/include/asm-alpha/signal.h b/include/asm-alpha/signal.h
index 7df5d47927f5..27282f335de4 100644
--- a/include/asm-alpha/signal.h
+++ b/include/asm-alpha/signal.h
@@ -186,6 +186,7 @@ struct sigstack {
#ifdef __KERNEL__
#include <asm/sigcontext.h>
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#define HAVE_ARCH_SYS_PAUSE
#endif
diff --git a/include/asm-cris/signal.h b/include/asm-cris/signal.h
index 246f45042d9d..bd6f9484dbfc 100644
--- a/include/asm-cris/signal.h
+++ b/include/asm-cris/signal.h
@@ -181,6 +181,7 @@ typedef struct sigaltstack {
/* here we could define asm-optimized sigaddset, sigdelset etc. operations.
* if we don't, generic ones are used from linux/signal.h
*/
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#endif /* __KERNEL__ */
diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h
index d6883d12ab5d..82baf59acc42 100644
--- a/include/asm-i386/signal.h
+++ b/include/asm-i386/signal.h
@@ -217,6 +217,7 @@ static __inline__ int sigfindinword(unsigned long word)
struct pt_regs;
extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#endif /* __KERNEL__ */
diff --git a/include/asm-ia64/signal.h b/include/asm-ia64/signal.h
index b8fb5819036d..2bd050863527 100644
--- a/include/asm-ia64/signal.h
+++ b/include/asm-ia64/signal.h
@@ -166,6 +166,7 @@ struct k_sigaction {
# include <asm/sigcontext.h>
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#define HAVE_ARCH_SYS_PAUSE
#endif /* __KERNEL__ */
diff --git a/include/asm-m68knommu/signal.h b/include/asm-m68knommu/signal.h
index 2600c4681c84..4b4f4b4058f1 100644
--- a/include/asm-m68knommu/signal.h
+++ b/include/asm-m68knommu/signal.h
@@ -176,6 +176,8 @@ typedef struct sigaltstack {
#include <asm/sigcontext.h>
#undef __HAVE_ARCH_SIG_BITOPS
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* __KERNEL__ */
#endif /* _M68KNOMMU_SIGNAL_H */
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
index 25828d38e2aa..6c5a3dfef907 100644
--- a/include/asm-mips/signal.h
+++ b/include/asm-mips/signal.h
@@ -169,6 +169,8 @@ typedef struct sigaltstack {
#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
#define BRK_MULOVF 1023 /* Multiply overflow */
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* defined (__KERNEL__) */
#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-mips64/signal.h b/include/asm-mips64/signal.h
index 4af7b2090fcd..8bbc72583620 100644
--- a/include/asm-mips64/signal.h
+++ b/include/asm-mips64/signal.h
@@ -168,6 +168,9 @@ typedef struct sigaltstack {
#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */
#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
#define BRK_MULOVF 1023 /* Multiply overflow */
+
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* defined (__KERNEL__) || defined (__USE_MISC) */
#endif /* !defined (_ASM_SIGNAL_H) */
diff --git a/include/asm-ppc/signal.h b/include/asm-ppc/signal.h
index 6935af6a07db..f692baff3a44 100644
--- a/include/asm-ppc/signal.h
+++ b/include/asm-ppc/signal.h
@@ -150,6 +150,7 @@ typedef struct sigaltstack {
#ifdef __KERNEL__
#include <asm/sigcontext.h>
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#endif /* __KERNEL__ */
#endif
diff --git a/include/asm-ppc64/signal.h b/include/asm-ppc64/signal.h
index cc67e7f8bf0c..707e5d2ba609 100644
--- a/include/asm-ppc64/signal.h
+++ b/include/asm-ppc64/signal.h
@@ -143,4 +143,6 @@ typedef struct sigaltstack {
size_t ss_size;
} stack_t;
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* _ASMPPC64_SIGNAL_H */
diff --git a/include/asm-s390/signal.h b/include/asm-s390/signal.h
index 1c27c9f50966..4aeaef2cd395 100644
--- a/include/asm-s390/signal.h
+++ b/include/asm-s390/signal.h
@@ -175,6 +175,8 @@ struct sigaction {
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* __KERNEL__ */
typedef struct sigaltstack {
diff --git a/include/asm-s390x/signal.h b/include/asm-s390x/signal.h
index c2a52040791f..d24e32fc6c82 100644
--- a/include/asm-s390x/signal.h
+++ b/include/asm-s390x/signal.h
@@ -175,6 +175,8 @@ struct sigaction {
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* __KERNEL__ */
typedef struct sigaltstack {
diff --git a/include/asm-sh/signal.h b/include/asm-sh/signal.h
index 332ce7a66b8e..ce776462e6ef 100644
--- a/include/asm-sh/signal.h
+++ b/include/asm-sh/signal.h
@@ -165,6 +165,8 @@ typedef struct sigaltstack {
#ifdef __KERNEL__
#include <asm/sigcontext.h>
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* __KERNEL__ */
#endif /* __ASM_SH_SIGNAL_H */
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
index 11cd75b94062..dca2ae21f286 100644
--- a/include/asm-sparc/signal.h
+++ b/include/asm-sparc/signal.h
@@ -216,7 +216,32 @@ typedef struct sigaltstack {
size_t ss_size;
} stack_t;
-#define HAVE_ARCH_GET_SIGNAL_TO_DELIVER
+struct sparc_deliver_cookie {
+ int restart_syscall;
+ unsigned long orig_i0;
+};
+
+#define ptrace_signal_deliver(REGS, COOKIE) \
+do { struct sparc_deliver_cookie *cp = (COOKIE); \
+ if (cp->restart_syscall && \
+ (regs->u_regs[UREG_I0] == ERESTARTNOHAND || \
+ regs->u_regs[UREG_I0] == ERESTARTSYS || \
+ regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { \
+ /* replay the system call when we are done */ \
+ regs->u_regs[UREG_I0] = cp->orig_i0; \
+ regs->pc -= 4; \
+ regs->npc -= 4; \
+ cp->restart_syscall = 0; \
+ } \
+ if (cp->restart_syscall && \
+ regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { \
+ regs->u_regs[UREG_G1] = __NR_restart_syscall; \
+ regs->pc -= 4; \
+ regs->npc -= 4; \
+ cp->restart_syscall = 0; \
+ } \
+} while (0)
+
#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
index 303b9453d024..73f5f5b307ac 100644
--- a/include/asm-sparc64/signal.h
+++ b/include/asm-sparc64/signal.h
@@ -245,7 +245,32 @@ typedef struct sigaltstack32 {
compat_size_t ss_size;
} stack_t32;
-#define HAVE_ARCH_GET_SIGNAL_TO_DELIVER
+struct signal_deliver_cookie {
+ int restart_syscall;
+ unsigned long orig_i0;
+};
+
+#define ptrace_signal_deliver(REGS, COOKIE) \
+do { struct signal_deliver_cookie *cp = (COOKIE); \
+ if (cp->restart_syscall && \
+ (regs->u_regs[UREG_I0] == ERESTARTNOHAND || \
+ regs->u_regs[UREG_I0] == ERESTARTSYS || \
+ regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { \
+ /* replay the system call when we are done */ \
+ regs->u_regs[UREG_I0] = cp->orig_i0; \
+ regs->tpc -= 4; \
+ regs->tnpc -= 4; \
+ cp->restart_syscall = 0; \
+ } \
+ if (cp->restart_syscall && \
+ regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { \
+ regs->u_regs[UREG_G1] = __NR_restart_syscall; \
+ regs->tpc -= 4; \
+ regs->tnpc -= 4; \
+ cp->restart_syscall = 0; \
+ } \
+} while (0)
+
#define HAVE_ARCH_SYS_PAUSE
#endif
diff --git a/include/asm-v850/signal.h b/include/asm-v850/signal.h
index 3f701cd82390..c33b1db71749 100644
--- a/include/asm-v850/signal.h
+++ b/include/asm-v850/signal.h
@@ -188,6 +188,8 @@ typedef struct sigaltstack {
#include <asm/sigcontext.h>
#undef __HAVE_ARCH_SIG_BITOPS
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* __KERNEL__ */
#endif /* __V850_SIGNAL_H__ */
diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h
index bfc4553b8b90..c554160f390a 100644
--- a/include/asm-x86_64/signal.h
+++ b/include/asm-x86_64/signal.h
@@ -200,6 +200,9 @@ extern __inline__ int sigfindinword(unsigned long word)
}
#endif
#endif
+
+#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
#endif /* __KERNEL__ */
#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index dd2e25e2129f..09e4d8587f0a 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -208,7 +208,7 @@ extern int sigprocmask(int, sigset_t *, sigset_t *);
#ifndef HAVE_ARCH_GET_SIGNAL_TO_DELIVER
struct pt_regs;
-extern int get_signal_to_deliver(siginfo_t *info, struct pt_regs *regs);
+extern int get_signal_to_deliver(siginfo_t *info, struct pt_regs *regs, void *cookie);
#endif
#endif /* __KERNEL__ */