aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/kprobes_64.h
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2008-01-30 07:31:21 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:21 -0500
commit8533bbe9f87b01f49ff951f665ea1988252fa3c2 (patch)
tree5286298af37057c1086405a96e6dce0b0df1fb64 /include/asm-x86/kprobes_64.h
parentda07ab0375897bb9e108b28129df140ecd3ee94e (diff)
x86: prepare kprobes code for x86 unification
This patch cleanup kprobes code on x86 for unification. This patch is based on Arjan's previous work. - Remove spurious whitespace changes - Add harmless includes - Make the 32/64 files more identical - Generalize structure fields' and local variable name. - Wrap accessing to stack address by macros. - Modify bitmap making macro. - Merge fixup code into is_riprel() and change its name to fix_riprel(). - Set MAX_INSN_SIZE to 16 on both arch. - Use u32 for bitmaps on both architectures. - Clarify some comments. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Jim Keniston <jkenisto@us.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/kprobes_64.h')
-rw-r--r--include/asm-x86/kprobes_64.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/include/asm-x86/kprobes_64.h b/include/asm-x86/kprobes_64.h
index e7e921dac7c2..94dff09b2ebe 100644
--- a/include/asm-x86/kprobes_64.h
+++ b/include/asm-x86/kprobes_64.h
@@ -2,7 +2,6 @@
2#define _ASM_KPROBES_H 2#define _ASM_KPROBES_H
3/* 3/*
4 * Kernel Probes (KProbes) 4 * Kernel Probes (KProbes)
5 * include/asm-x86_64/kprobes.h
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -20,6 +19,9 @@
20 * 19 *
21 * Copyright (C) IBM Corporation, 2002, 2004 20 * Copyright (C) IBM Corporation, 2002, 2004
22 * 21 *
22 * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
23 * Probes initial implementation ( includes suggestions from
24 * Rusty Russell).
23 * 2004-Oct Prasanna S Panchamukhi <prasanna@in.ibm.com> and Jim Keniston 25 * 2004-Oct Prasanna S Panchamukhi <prasanna@in.ibm.com> and Jim Keniston
24 * kenistoj@us.ibm.com adopted from i386. 26 * kenistoj@us.ibm.com adopted from i386.
25 */ 27 */
@@ -35,19 +37,22 @@ struct kprobe;
35typedef u8 kprobe_opcode_t; 37typedef u8 kprobe_opcode_t;
36#define BREAKPOINT_INSTRUCTION 0xcc 38#define BREAKPOINT_INSTRUCTION 0xcc
37#define RELATIVEJUMP_INSTRUCTION 0xe9 39#define RELATIVEJUMP_INSTRUCTION 0xe9
38#define MAX_INSN_SIZE 15 40#define MAX_INSN_SIZE 16
39#define MAX_STACK_SIZE 64 41#define MAX_STACK_SIZE 64
40#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ 42#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
41 (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ 43 (((unsigned long)current_thread_info()) + THREAD_SIZE \
44 - (unsigned long)(ADDR))) \
42 ? (MAX_STACK_SIZE) \ 45 ? (MAX_STACK_SIZE) \
43 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 46 : (((unsigned long)current_thread_info()) + THREAD_SIZE \
47 - (unsigned long)(ADDR)))
44 48
45#define ARCH_SUPPORTS_KRETPROBES 49#define ARCH_SUPPORTS_KRETPROBES
50#define flush_insn_slot(p) do { } while (0)
51
46extern const int kretprobe_blacklist_size; 52extern const int kretprobe_blacklist_size;
47 53
54void arch_remove_kprobe(struct kprobe *p);
48void kretprobe_trampoline(void); 55void kretprobe_trampoline(void);
49extern void arch_remove_kprobe(struct kprobe *p);
50#define flush_insn_slot(p) do { } while (0)
51 56
52/* Architecture specific copy of original instruction*/ 57/* Architecture specific copy of original instruction*/
53struct arch_specific_insn { 58struct arch_specific_insn {
@@ -67,16 +72,16 @@ struct arch_specific_insn {
67struct prev_kprobe { 72struct prev_kprobe {
68 struct kprobe *kp; 73 struct kprobe *kp;
69 unsigned long status; 74 unsigned long status;
70 unsigned long old_rflags; 75 unsigned long old_flags;
71 unsigned long saved_rflags; 76 unsigned long saved_flags;
72}; 77};
73 78
74/* per-cpu kprobe control block */ 79/* per-cpu kprobe control block */
75struct kprobe_ctlblk { 80struct kprobe_ctlblk {
76 unsigned long kprobe_status; 81 unsigned long kprobe_status;
77 unsigned long kprobe_old_rflags; 82 unsigned long kprobe_old_flags;
78 unsigned long kprobe_saved_rflags; 83 unsigned long kprobe_saved_flags;
79 unsigned long *jprobe_saved_rsp; 84 unsigned long *jprobe_saved_sp;
80 struct pt_regs jprobe_saved_regs; 85 struct pt_regs jprobe_saved_regs;
81 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; 86 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
82 struct prev_kprobe prev_kprobe; 87 struct prev_kprobe prev_kprobe;
@@ -91,10 +96,7 @@ static inline void restore_interrupts(struct pt_regs *regs)
91 local_irq_enable(); 96 local_irq_enable();
92} 97}
93 98
94extern int post_kprobe_handler(struct pt_regs *regs);
95extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 99extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
96extern int kprobe_handler(struct pt_regs *regs);
97
98extern int kprobe_exceptions_notify(struct notifier_block *self, 100extern int kprobe_exceptions_notify(struct notifier_block *self,
99 unsigned long val, void *data); 101 unsigned long val, void *data);
100#endif /* _ASM_KPROBES_H */ 102#endif /* _ASM_KPROBES_H */