kprobes.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * arch/tile/include/asm/kprobes.h
  3. *
  4. * Copyright 2012 Tilera Corporation. All Rights Reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation, version 2.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  13. * NON INFRINGEMENT. See the GNU General Public License for
  14. * more details.
  15. */
  16. #ifndef _ASM_TILE_KPROBES_H
  17. #define _ASM_TILE_KPROBES_H
  18. #include <linux/types.h>
  19. #include <linux/ptrace.h>
  20. #include <linux/percpu.h>
  21. #include <arch/opcode.h>
  22. #define __ARCH_WANT_KPROBES_INSN_SLOT
  23. #define MAX_INSN_SIZE 2
  24. #define kretprobe_blacklist_size 0
  25. typedef tile_bundle_bits kprobe_opcode_t;
  26. #define flush_insn_slot(p) \
  27. flush_icache_range((unsigned long)p->addr, \
  28. (unsigned long)p->addr + \
  29. (MAX_INSN_SIZE * sizeof(kprobe_opcode_t)))
  30. struct kprobe;
  31. /* Architecture specific copy of original instruction. */
  32. struct arch_specific_insn {
  33. kprobe_opcode_t *insn;
  34. };
  35. struct prev_kprobe {
  36. struct kprobe *kp;
  37. unsigned long status;
  38. unsigned long saved_pc;
  39. };
  40. #define MAX_JPROBES_STACK_SIZE 128
  41. #define MAX_JPROBES_STACK_ADDR \
  42. (((unsigned long)current_thread_info()) + THREAD_SIZE - 32 \
  43. - sizeof(struct pt_regs))
  44. #define MIN_JPROBES_STACK_SIZE(ADDR) \
  45. ((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR) \
  46. ? MAX_JPROBES_STACK_ADDR - (ADDR) \
  47. : MAX_JPROBES_STACK_SIZE)
  48. /* per-cpu kprobe control block. */
  49. struct kprobe_ctlblk {
  50. unsigned long kprobe_status;
  51. unsigned long kprobe_saved_pc;
  52. unsigned long jprobe_saved_sp;
  53. struct prev_kprobe prev_kprobe;
  54. struct pt_regs jprobe_saved_regs;
  55. char jprobes_stack[MAX_JPROBES_STACK_SIZE];
  56. };
  57. extern tile_bundle_bits breakpoint2_insn;
  58. extern tile_bundle_bits breakpoint_insn;
  59. void arch_remove_kprobe(struct kprobe *);
  60. extern int kprobe_exceptions_notify(struct notifier_block *self,
  61. unsigned long val, void *data);
  62. #endif /* _ASM_TILE_KPROBES_H */