diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/kprobes_32.h | 32 | ||||
-rw-r--r-- | include/asm-x86/kprobes_64.h | 30 |
2 files changed, 36 insertions, 26 deletions
diff --git a/include/asm-x86/kprobes_32.h b/include/asm-x86/kprobes_32.h index 2f38315bc39..94dff09b2eb 100644 --- a/include/asm-x86/kprobes_32.h +++ b/include/asm-x86/kprobes_32.h @@ -2,7 +2,6 @@ #define _ASM_KPROBES_H /* * Kernel Probes (KProbes) - * include/asm-i386/kprobes.h * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,14 +22,17 @@ * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel * Probes initial implementation ( includes suggestions from * Rusty Russell). + * 2004-Oct Prasanna S Panchamukhi <prasanna@in.ibm.com> and Jim Keniston + * kenistoj@us.ibm.com adopted from i386. */ #include <linux/types.h> #include <linux/ptrace.h> +#include <linux/percpu.h> #define __ARCH_WANT_KPROBES_INSN_SLOT -struct kprobe; struct pt_regs; +struct kprobe; typedef u8 kprobe_opcode_t; #define BREAKPOINT_INSTRUCTION 0xcc @@ -38,9 +40,11 @@ typedef u8 kprobe_opcode_t; #define MAX_INSN_SIZE 16 #define MAX_STACK_SIZE 64 #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ - (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ + (((unsigned long)current_thread_info()) + THREAD_SIZE \ + - (unsigned long)(ADDR))) \ ? (MAX_STACK_SIZE) \ - : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) + : (((unsigned long)current_thread_info()) + THREAD_SIZE \ + - (unsigned long)(ADDR))) #define ARCH_SUPPORTS_KRETPROBES #define flush_insn_slot(p) do { } while (0) @@ -55,8 +59,12 @@ struct arch_specific_insn { /* copy of the original instruction */ kprobe_opcode_t *insn; /* - * If this flag is not 0, this kprobe can be boost when its - * post_handler and break_handler is not set. + * boostable = -1: This instruction type is not boostable. + * boostable = 0: This instruction type is boostable. + * boostable = 1: This instruction has been boosted: we have + * added a relative jump after the instruction copy in insn, + * so no single-step and fixup are needed (unless there's + * a post_handler or break_handler). */ int boostable; }; @@ -64,16 +72,16 @@ struct arch_specific_insn { struct prev_kprobe { struct kprobe *kp; unsigned long status; - unsigned long old_eflags; - unsigned long saved_eflags; + unsigned long old_flags; + unsigned long saved_flags; }; /* per-cpu kprobe control block */ struct kprobe_ctlblk { unsigned long kprobe_status; - unsigned long kprobe_old_eflags; - unsigned long kprobe_saved_eflags; - unsigned long *jprobe_saved_esp; + unsigned long kprobe_old_flags; + unsigned long kprobe_saved_flags; + unsigned long *jprobe_saved_sp; struct pt_regs jprobe_saved_regs; kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; struct prev_kprobe prev_kprobe; @@ -88,7 +96,7 @@ static inline void restore_interrupts(struct pt_regs *regs) local_irq_enable(); } +extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); extern int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, void *data); -extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); #endif /* _ASM_KPROBES_H */ diff --git a/include/asm-x86/kprobes_64.h b/include/asm-x86/kprobes_64.h index e7e921dac7c..94dff09b2eb 100644 --- a/include/asm-x86/kprobes_64.h +++ b/include/asm-x86/kprobes_64.h @@ -2,7 +2,6 @@ #define _ASM_KPROBES_H /* * Kernel Probes (KProbes) - * include/asm-x86_64/kprobes.h * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,9 @@ * * Copyright (C) IBM Corporation, 2002, 2004 * + * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel + * Probes initial implementation ( includes suggestions from + * Rusty Russell). * 2004-Oct Prasanna S Panchamukhi <prasanna@in.ibm.com> and Jim Keniston * kenistoj@us.ibm.com adopted from i386. */ @@ -35,19 +37,22 @@ struct kprobe; typedef u8 kprobe_opcode_t; #define BREAKPOINT_INSTRUCTION 0xcc #define RELATIVEJUMP_INSTRUCTION 0xe9 -#define MAX_INSN_SIZE 15 +#define MAX_INSN_SIZE 16 #define MAX_STACK_SIZE 64 #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ - (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ + (((unsigned long)current_thread_info()) + THREAD_SIZE \ + - (unsigned long)(ADDR))) \ ? (MAX_STACK_SIZE) \ - : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) + : (((unsigned long)current_thread_info()) + THREAD_SIZE \ + - (unsigned long)(ADDR))) #define ARCH_SUPPORTS_KRETPROBES +#define flush_insn_slot(p) do { } while (0) + extern const int kretprobe_blacklist_size; +void arch_remove_kprobe(struct kprobe *p); void kretprobe_trampoline(void); -extern void arch_remove_kprobe(struct kprobe *p); -#define flush_insn_slot(p) do { } while (0) /* Architecture specific copy of original instruction*/ struct arch_specific_insn { @@ -67,16 +72,16 @@ struct arch_specific_insn { struct prev_kprobe { struct kprobe *kp; unsigned long status; - unsigned long old_rflags; - unsigned long saved_rflags; + unsigned long old_flags; + unsigned long saved_flags; }; /* per-cpu kprobe control block */ struct kprobe_ctlblk { unsigned long kprobe_status; - unsigned long kprobe_old_rflags; - unsigned long kprobe_saved_rflags; - unsigned long *jprobe_saved_rsp; + unsigned long kprobe_old_flags; + unsigned long kprobe_saved_flags; + unsigned long *jprobe_saved_sp; struct pt_regs jprobe_saved_regs; kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; struct prev_kprobe prev_kprobe; @@ -91,10 +96,7 @@ static inline void restore_interrupts(struct pt_regs *regs) local_irq_enable(); } -extern int post_kprobe_handler(struct pt_regs *regs); extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); -extern int kprobe_handler(struct pt_regs *regs); - extern int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, void *data); #endif /* _ASM_KPROBES_H */ |