summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSrinivasa Ds <srinivasa@in.ibm.com>2008-09-23 15:23:52 +0530
committerIngo Molnar <mingo@elte.hu>2008-09-23 13:26:52 +0200
commitda654b74bda14c45a7d98c731bf3c1a43b6b74e2 (patch)
treee3cc6f1a1f7300c07e59c9091cd2ede0c5da8d4d /include
parent101d5b713700b902b1c200cdd1925c3cb7d34567 (diff)
downloadkernel-crypto-da654b74bda14c45a7d98c731bf3c1a43b6b74e2.tar.gz
kernel-crypto-da654b74bda14c45a7d98c731bf3c1a43b6b74e2.tar.xz
kernel-crypto-da654b74bda14c45a7d98c731bf3c1a43b6b74e2.zip
signals: demultiplexing SIGTRAP signal
Currently a SIGTRAP can denote any one of below reasons. - Breakpoint hit - H/W debug register hit - Single step - Signal sent through kill() or rasie() Architectures like powerpc/parisc provides infrastructure to demultiplex SIGTRAP signal by passing down the information for receiving SIGTRAP through si_code of siginfot_t structure. Here is an attempt is generalise this infrastructure by extending it to x86 and x86_64 archs. Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com> Cc: Roland McGrath <roland@redhat.com> Cc: akpm@linux-foundation.org Cc: paulus@samba.org Cc: linuxppc-dev@ozlabs.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/siginfo.h2
-rw-r--r--include/asm-parisc/siginfo.h5
-rw-r--r--include/asm-x86/ptrace.h2
-rw-r--r--include/asm-x86/traps.h10
4 files changed, 13 insertions, 6 deletions
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 8786e01e0db..969570167e9 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -199,6 +199,8 @@ typedef struct siginfo {
*/
#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
+#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
+#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
#define NSIGTRAP 2
/*
diff --git a/include/asm-parisc/siginfo.h b/include/asm-parisc/siginfo.h
index d4909f55fe3..d7034728f37 100644
--- a/include/asm-parisc/siginfo.h
+++ b/include/asm-parisc/siginfo.h
@@ -3,11 +3,6 @@
#include <asm-generic/siginfo.h>
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
-#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */
#undef NSIGTRAP
#define NSIGTRAP 4
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
index fad80776991..c2f36827307 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -143,7 +143,7 @@ convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
#ifdef CONFIG_X86_32
extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
- int error_code);
+ int error_code, int si_code);
#endif
void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
diff --git a/include/asm-x86/traps.h b/include/asm-x86/traps.h
index 2ccebc6fb0b..4b1e9040925 100644
--- a/include/asm-x86/traps.h
+++ b/include/asm-x86/traps.h
@@ -36,6 +36,16 @@ void do_invalid_op(struct pt_regs *, long);
void do_general_protection(struct pt_regs *, long);
void do_nmi(struct pt_regs *, long);
+static inline int get_si_code(unsigned long condition)
+{
+ if (condition & DR_STEP)
+ return TRAP_TRACE;
+ else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
+ return TRAP_HWBKPT;
+ else
+ return TRAP_BRKPT;
+}
+
extern int panic_on_unrecovered_nmi;
extern int kstack_depth_to_print;