kprobes.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Kernel Probes (KProbes)
  3. * include/asm-mips/kprobes.h
  4. *
  5. * Copyright 2006 Sony Corp.
  6. * Copyright 2010 Cavium Networks
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef _ASM_KPROBES_H
  22. #define _ASM_KPROBES_H
  23. #include <asm-generic/kprobes.h>
  24. #ifdef CONFIG_KPROBES
  25. #include <linux/ptrace.h>
  26. #include <linux/types.h>
  27. #include <asm/cacheflush.h>
  28. #include <asm/kdebug.h>
  29. #include <asm/inst.h>
  30. #define __ARCH_WANT_KPROBES_INSN_SLOT
  31. struct kprobe;
  32. struct pt_regs;
  33. typedef union mips_instruction kprobe_opcode_t;
  34. #define MAX_INSN_SIZE 2
  35. #define flush_insn_slot(p) \
  36. do { \
  37. if (p->addr) \
  38. flush_icache_range((unsigned long)p->addr, \
  39. (unsigned long)p->addr + \
  40. (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
  41. } while (0)
  42. #define kretprobe_blacklist_size 0
  43. void arch_remove_kprobe(struct kprobe *p);
  44. /* Architecture specific copy of original instruction*/
  45. struct arch_specific_insn {
  46. /* copy of the original instruction */
  47. kprobe_opcode_t *insn;
  48. };
  49. struct prev_kprobe {
  50. struct kprobe *kp;
  51. unsigned long status;
  52. unsigned long old_SR;
  53. unsigned long saved_SR;
  54. unsigned long saved_epc;
  55. };
  56. #define SKIP_DELAYSLOT 0x0001
  57. /* per-cpu kprobe control block */
  58. struct kprobe_ctlblk {
  59. unsigned long kprobe_status;
  60. unsigned long kprobe_old_SR;
  61. unsigned long kprobe_saved_SR;
  62. unsigned long kprobe_saved_epc;
  63. /* Per-thread fields, used while emulating branches */
  64. unsigned long flags;
  65. unsigned long target_epc;
  66. struct prev_kprobe prev_kprobe;
  67. };
  68. extern int kprobe_exceptions_notify(struct notifier_block *self,
  69. unsigned long val, void *data);
  70. #endif /* CONFIG_KPROBES */
  71. #endif /* _ASM_KPROBES_H */