diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kprobes.h | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index ca1d27a0d6a6..077f65321b5e 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -264,10 +264,34 @@ extern void arch_arm_kprobe(struct kprobe *p); | |||
| 264 | extern void arch_disarm_kprobe(struct kprobe *p); | 264 | extern void arch_disarm_kprobe(struct kprobe *p); |
| 265 | extern int arch_init_kprobes(void); | 265 | extern int arch_init_kprobes(void); |
| 266 | extern void show_registers(struct pt_regs *regs); | 266 | extern void show_registers(struct pt_regs *regs); |
| 267 | extern kprobe_opcode_t *get_insn_slot(void); | ||
| 268 | extern void free_insn_slot(kprobe_opcode_t *slot, int dirty); | ||
| 269 | extern void kprobes_inc_nmissed_count(struct kprobe *p); | 267 | extern void kprobes_inc_nmissed_count(struct kprobe *p); |
| 270 | 268 | ||
| 269 | struct kprobe_insn_cache { | ||
| 270 | struct mutex mutex; | ||
| 271 | struct list_head pages; /* list of kprobe_insn_page */ | ||
| 272 | size_t insn_size; /* size of instruction slot */ | ||
| 273 | int nr_garbage; | ||
| 274 | }; | ||
| 275 | |||
| 276 | extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c); | ||
| 277 | extern void __free_insn_slot(struct kprobe_insn_cache *c, | ||
| 278 | kprobe_opcode_t *slot, int dirty); | ||
| 279 | |||
| 280 | #define DEFINE_INSN_CACHE_OPS(__name) \ | ||
| 281 | extern struct kprobe_insn_cache kprobe_##__name##_slots; \ | ||
| 282 | \ | ||
| 283 | static inline kprobe_opcode_t *get_##__name##_slot(void) \ | ||
| 284 | { \ | ||
| 285 | return __get_insn_slot(&kprobe_##__name##_slots); \ | ||
| 286 | } \ | ||
| 287 | \ | ||
| 288 | static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\ | ||
| 289 | { \ | ||
| 290 | __free_insn_slot(&kprobe_##__name##_slots, slot, dirty); \ | ||
| 291 | } \ | ||
| 292 | |||
| 293 | DEFINE_INSN_CACHE_OPS(insn); | ||
| 294 | |||
| 271 | #ifdef CONFIG_OPTPROBES | 295 | #ifdef CONFIG_OPTPROBES |
| 272 | /* | 296 | /* |
| 273 | * Internal structure for direct jump optimized probe | 297 | * Internal structure for direct jump optimized probe |
| @@ -287,13 +311,13 @@ extern void arch_optimize_kprobes(struct list_head *oplist); | |||
| 287 | extern void arch_unoptimize_kprobes(struct list_head *oplist, | 311 | extern void arch_unoptimize_kprobes(struct list_head *oplist, |
| 288 | struct list_head *done_list); | 312 | struct list_head *done_list); |
| 289 | extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); | 313 | extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); |
| 290 | extern kprobe_opcode_t *get_optinsn_slot(void); | ||
| 291 | extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty); | ||
| 292 | extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, | 314 | extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, |
| 293 | unsigned long addr); | 315 | unsigned long addr); |
| 294 | 316 | ||
| 295 | extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); | 317 | extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); |
| 296 | 318 | ||
| 319 | DEFINE_INSN_CACHE_OPS(optinsn); | ||
| 320 | |||
| 297 | #ifdef CONFIG_SYSCTL | 321 | #ifdef CONFIG_SYSCTL |
| 298 | extern int sysctl_kprobes_optimization; | 322 | extern int sysctl_kprobes_optimization; |
| 299 | extern int proc_kprobes_optimization_handler(struct ctl_table *table, | 323 | extern int proc_kprobes_optimization_handler(struct ctl_table *table, |
