kprobes.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_SH_KPROBES_H
  3. #define __ASM_SH_KPROBES_H
  4. #include <asm-generic/kprobes.h>
  5. #define BREAKPOINT_INSTRUCTION 0xc33a
  6. #ifdef CONFIG_KPROBES
  7. #include <linux/types.h>
  8. #include <linux/ptrace.h>
  9. typedef insn_size_t kprobe_opcode_t;
  10. #define MAX_INSN_SIZE 16
  11. #define MAX_STACK_SIZE 64
  12. #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
  13. (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \
  14. ? (MAX_STACK_SIZE) \
  15. : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
  16. #define flush_insn_slot(p) do { } while (0)
  17. #define kretprobe_blacklist_size 0
  18. struct kprobe;
  19. void arch_remove_kprobe(struct kprobe *);
  20. void __kretprobe_trampoline(void);
  21. /* Architecture specific copy of original instruction*/
  22. struct arch_specific_insn {
  23. /* copy of the original instruction */
  24. kprobe_opcode_t insn[MAX_INSN_SIZE];
  25. };
  26. struct prev_kprobe {
  27. struct kprobe *kp;
  28. unsigned long status;
  29. };
  30. /* per-cpu kprobe control block */
  31. struct kprobe_ctlblk {
  32. unsigned long kprobe_status;
  33. struct prev_kprobe prev_kprobe;
  34. };
  35. extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
  36. extern int kprobe_exceptions_notify(struct notifier_block *self,
  37. unsigned long val, void *data);
  38. extern int kprobe_handle_illslot(unsigned long pc);
  39. #else
  40. #define kprobe_handle_illslot(pc) (-1)
  41. #endif /* CONFIG_KPROBES */
  42. #endif /* __ASM_SH_KPROBES_H */