diff options
author | Alexander van Heukelum <heukelum@fastmail.fm> | 2008-09-09 15:55:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-13 04:20:02 -0400 |
commit | 762db4347060c5d23e9675846e02f7d95d7f944f (patch) | |
tree | 39267b2c53f6525d8f9a95c1bdb6848205362095 | |
parent | 927604c7592473742891dc13e1da09febc06e01b (diff) |
i386: remove kprobes' restore_interrupts in favour of conditional_sti
x86_64 uses a helper function conditional_sti in traps_64.c which
is equal to restore_interrupts in kprobes.h. The only user of
restore_interrupts is in traps_32.c. Introduce conditional_sti
for i386 and remove restore_interrupts.
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/traps_32.c | 8 | ||||
-rw-r--r-- | include/asm-x86/kprobes.h | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 0429c5de5ea9..203b863ac2a8 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -84,6 +84,12 @@ static unsigned int code_bytes = 64; | |||
84 | static int ignore_nmis; | 84 | static int ignore_nmis; |
85 | static int die_counter; | 85 | static int die_counter; |
86 | 86 | ||
87 | static inline void conditional_sti(struct pt_regs *regs) | ||
88 | { | ||
89 | if (regs->flags & X86_EFLAGS_IF) | ||
90 | local_irq_enable(); | ||
91 | } | ||
92 | |||
87 | void printk_address(unsigned long address, int reliable) | 93 | void printk_address(unsigned long address, int reliable) |
88 | { | 94 | { |
89 | #ifdef CONFIG_KALLSYMS | 95 | #ifdef CONFIG_KALLSYMS |
@@ -859,7 +865,7 @@ void __kprobes do_int3(struct pt_regs *regs, long error_code) | |||
859 | * This is an interrupt gate, because kprobes wants interrupts | 865 | * This is an interrupt gate, because kprobes wants interrupts |
860 | * disabled. Normal trap handlers don't. | 866 | * disabled. Normal trap handlers don't. |
861 | */ | 867 | */ |
862 | restore_interrupts(regs); | 868 | conditional_sti(regs); |
863 | 869 | ||
864 | do_trap(3, SIGTRAP, "int3", 1, regs, error_code, NULL); | 870 | do_trap(3, SIGTRAP, "int3", 1, regs, error_code, NULL); |
865 | } | 871 | } |
diff --git a/include/asm-x86/kprobes.h b/include/asm-x86/kprobes.h index bd8407863c13..8a0748d01036 100644 --- a/include/asm-x86/kprobes.h +++ b/include/asm-x86/kprobes.h | |||
@@ -82,15 +82,6 @@ struct kprobe_ctlblk { | |||
82 | struct prev_kprobe prev_kprobe; | 82 | struct prev_kprobe prev_kprobe; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* trap3/1 are intr gates for kprobes. So, restore the status of IF, | ||
86 | * if necessary, before executing the original int3/1 (trap) handler. | ||
87 | */ | ||
88 | static inline void restore_interrupts(struct pt_regs *regs) | ||
89 | { | ||
90 | if (regs->flags & X86_EFLAGS_IF) | ||
91 | local_irq_enable(); | ||
92 | } | ||
93 | |||
94 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); | 85 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); |
95 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 86 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
96 | unsigned long val, void *data); | 87 | unsigned long val, void *data); |