kprobes.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Kernel Probes (KProbes)
  4. * include/asm-mips/kprobes.h
  5. *
  6. * Copyright 2006 Sony Corp.
  7. * Copyright 2010 Cavium Networks
  8. */
  9. #ifndef _ASM_KPROBES_H
  10. #define _ASM_KPROBES_H
  11. #include <asm-generic/kprobes.h>
  12. #ifdef CONFIG_KPROBES
  13. #include <linux/ptrace.h>
  14. #include <linux/types.h>
  15. #include <asm/cacheflush.h>
  16. #include <asm/kdebug.h>
  17. #include <asm/inst.h>
  18. #define __ARCH_WANT_KPROBES_INSN_SLOT
  19. struct kprobe;
  20. struct pt_regs;
  21. typedef union mips_instruction kprobe_opcode_t;
  22. #define MAX_INSN_SIZE 2
  23. #define flush_insn_slot(p) \
  24. do { \
  25. if (p->addr) \
  26. flush_icache_range((unsigned long)p->addr, \
  27. (unsigned long)p->addr + \
  28. (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
  29. } while (0)
  30. #define kretprobe_blacklist_size 0
  31. void arch_remove_kprobe(struct kprobe *p);
  32. int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
  33. /* Architecture specific copy of original instruction*/
  34. struct arch_specific_insn {
  35. /* copy of the original instruction */
  36. kprobe_opcode_t *insn;
  37. };
  38. struct prev_kprobe {
  39. struct kprobe *kp;
  40. unsigned long status;
  41. unsigned long old_SR;
  42. unsigned long saved_SR;
  43. unsigned long saved_epc;
  44. };
  45. #define SKIP_DELAYSLOT 0x0001
  46. /* per-cpu kprobe control block */
  47. struct kprobe_ctlblk {
  48. unsigned long kprobe_status;
  49. unsigned long kprobe_old_SR;
  50. unsigned long kprobe_saved_SR;
  51. unsigned long kprobe_saved_epc;
  52. /* Per-thread fields, used while emulating branches */
  53. unsigned long flags;
  54. unsigned long target_epc;
  55. struct prev_kprobe prev_kprobe;
  56. };
  57. extern int kprobe_exceptions_notify(struct notifier_block *self,
  58. unsigned long val, void *data);
  59. #endif /* CONFIG_KPROBES */
  60. #endif /* _ASM_KPROBES_H */