hw_breakpoint.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef _I386_HW_BREAKPOINT_H
  2. #define _I386_HW_BREAKPOINT_H
  3. #ifdef __KERNEL__
  4. #define __ARCH_HW_BREAKPOINT_H
  5. /*
  6. * The name should probably be something dealt in
  7. * a higher level. While dealing with the user
  8. * (display/resolving)
  9. */
  10. struct arch_hw_breakpoint {
  11. unsigned long address;
  12. u8 len;
  13. u8 type;
  14. };
  15. #include <linux/kdebug.h>
  16. #include <linux/percpu.h>
  17. #include <linux/list.h>
  18. /* Available HW breakpoint length encodings */
  19. #define X86_BREAKPOINT_LEN_X 0x40
  20. #define X86_BREAKPOINT_LEN_1 0x40
  21. #define X86_BREAKPOINT_LEN_2 0x44
  22. #define X86_BREAKPOINT_LEN_4 0x4c
  23. #ifdef CONFIG_X86_64
  24. #define X86_BREAKPOINT_LEN_8 0x48
  25. #endif
  26. /* Available HW breakpoint type encodings */
  27. /* trigger on instruction execute */
  28. #define X86_BREAKPOINT_EXECUTE 0x80
  29. /* trigger on memory write */
  30. #define X86_BREAKPOINT_WRITE 0x81
  31. /* trigger on memory read or write */
  32. #define X86_BREAKPOINT_RW 0x83
  33. /* Total number of available HW breakpoint registers */
  34. #define HBP_NUM 4
  35. static inline int hw_breakpoint_slots(int type)
  36. {
  37. return HBP_NUM;
  38. }
  39. struct perf_event;
  40. struct pmu;
  41. extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
  42. extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
  43. extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
  44. unsigned long val, void *data);
  45. int arch_install_hw_breakpoint(struct perf_event *bp);
  46. void arch_uninstall_hw_breakpoint(struct perf_event *bp);
  47. void hw_breakpoint_pmu_read(struct perf_event *bp);
  48. void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
  49. extern void
  50. arch_fill_perf_breakpoint(struct perf_event *bp);
  51. unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type);
  52. int decode_dr7(unsigned long dr7, int bpnum, unsigned *len, unsigned *type);
  53. extern int arch_bp_generic_fields(int x86_len, int x86_type,
  54. int *gen_len, int *gen_type);
  55. extern struct pmu perf_ops_bp;
  56. #endif /* __KERNEL__ */
  57. #endif /* _I386_HW_BREAKPOINT_H */