diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2008-01-30 07:31:21 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:21 -0500 |
commit | 8533bbe9f87b01f49ff951f665ea1988252fa3c2 (patch) | |
tree | 5286298af37057c1086405a96e6dce0b0df1fb64 /include/asm-x86/kprobes_64.h | |
parent | da07ab0375897bb9e108b28129df140ecd3ee94e (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.h | 30 |
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; | |||
35 | typedef u8 kprobe_opcode_t; | 37 | typedef 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 | |||
46 | extern const int kretprobe_blacklist_size; | 52 | extern const int kretprobe_blacklist_size; |
47 | 53 | ||
54 | void arch_remove_kprobe(struct kprobe *p); | ||
48 | void kretprobe_trampoline(void); | 55 | void kretprobe_trampoline(void); |
49 | extern 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*/ |
53 | struct arch_specific_insn { | 58 | struct arch_specific_insn { |
@@ -67,16 +72,16 @@ struct arch_specific_insn { | |||
67 | struct prev_kprobe { | 72 | struct 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 */ |
75 | struct kprobe_ctlblk { | 80 | struct 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 | ||
94 | extern int post_kprobe_handler(struct pt_regs *regs); | ||
95 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); | 99 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); |
96 | extern int kprobe_handler(struct pt_regs *regs); | ||
97 | |||
98 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 100 | extern 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 */ |