hw_breakpoint.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _I386_HW_BREAKPOINT_H
  2. #define _I386_HW_BREAKPOINT_H
  3. #ifdef __KERNEL__
  4. #define __ARCH_HW_BREAKPOINT_H
  5. struct arch_hw_breakpoint {
  6. char *name; /* Contains name of the symbol to set bkpt */
  7. unsigned long address;
  8. u8 len;
  9. u8 type;
  10. };
  11. #include <linux/kdebug.h>
  12. #include <linux/hw_breakpoint.h>
  13. /* Available HW breakpoint length encodings */
  14. #define HW_BREAKPOINT_LEN_1 0x40
  15. #define HW_BREAKPOINT_LEN_2 0x44
  16. #define HW_BREAKPOINT_LEN_4 0x4c
  17. #define HW_BREAKPOINT_LEN_EXECUTE 0x40
  18. #ifdef CONFIG_X86_64
  19. #define HW_BREAKPOINT_LEN_8 0x48
  20. #endif
  21. /* Available HW breakpoint type encodings */
  22. /* trigger on instruction execute */
  23. #define HW_BREAKPOINT_EXECUTE 0x80
  24. /* trigger on memory write */
  25. #define HW_BREAKPOINT_WRITE 0x81
  26. /* trigger on memory read or write */
  27. #define HW_BREAKPOINT_RW 0x83
  28. /* Total number of available HW breakpoint registers */
  29. #define HBP_NUM 4
  30. extern struct hw_breakpoint *hbp_kernel[HBP_NUM];
  31. DECLARE_PER_CPU(struct hw_breakpoint*, this_hbp_kernel[HBP_NUM]);
  32. extern unsigned int hbp_user_refcount[HBP_NUM];
  33. extern void arch_install_thread_hw_breakpoint(struct task_struct *tsk);
  34. extern void arch_uninstall_thread_hw_breakpoint(void);
  35. extern int arch_check_va_in_userspace(unsigned long va, u8 hbp_len);
  36. extern int arch_validate_hwbkpt_settings(struct hw_breakpoint *bp,
  37. struct task_struct *tsk);
  38. extern void arch_update_user_hw_breakpoint(int pos, struct task_struct *tsk);
  39. extern void arch_flush_thread_hw_breakpoint(struct task_struct *tsk);
  40. extern void arch_update_kernel_hw_breakpoint(void *);
  41. extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
  42. unsigned long val, void *data);
  43. #endif /* __KERNEL__ */
  44. #endif /* _I386_HW_BREAKPOINT_H */