0001
0002 #ifndef _I386_HW_BREAKPOINT_H
0003 #define _I386_HW_BREAKPOINT_H
0004
0005 #include <uapi/asm/hw_breakpoint.h>
0006
0007 #define __ARCH_HW_BREAKPOINT_H
0008
0009
0010
0011
0012
0013
0014 struct arch_hw_breakpoint {
0015 unsigned long address;
0016 unsigned long mask;
0017 u8 len;
0018 u8 type;
0019 };
0020
0021 #include <linux/kdebug.h>
0022 #include <linux/percpu.h>
0023 #include <linux/list.h>
0024
0025
0026 #define X86_BREAKPOINT_LEN_X 0x40
0027 #define X86_BREAKPOINT_LEN_1 0x40
0028 #define X86_BREAKPOINT_LEN_2 0x44
0029 #define X86_BREAKPOINT_LEN_4 0x4c
0030
0031 #ifdef CONFIG_X86_64
0032 #define X86_BREAKPOINT_LEN_8 0x48
0033 #endif
0034
0035
0036
0037
0038 #define X86_BREAKPOINT_EXECUTE 0x80
0039
0040 #define X86_BREAKPOINT_WRITE 0x81
0041
0042 #define X86_BREAKPOINT_RW 0x83
0043
0044
0045 #define HBP_NUM 4
0046
0047 static inline int hw_breakpoint_slots(int type)
0048 {
0049 return HBP_NUM;
0050 }
0051
0052 struct perf_event_attr;
0053 struct perf_event;
0054 struct pmu;
0055
0056 extern int arch_check_bp_in_kernelspace(struct arch_hw_breakpoint *hw);
0057 extern int hw_breakpoint_arch_parse(struct perf_event *bp,
0058 const struct perf_event_attr *attr,
0059 struct arch_hw_breakpoint *hw);
0060 extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
0061 unsigned long val, void *data);
0062
0063
0064 int arch_install_hw_breakpoint(struct perf_event *bp);
0065 void arch_uninstall_hw_breakpoint(struct perf_event *bp);
0066 void hw_breakpoint_pmu_read(struct perf_event *bp);
0067 void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
0068
0069 extern void
0070 arch_fill_perf_breakpoint(struct perf_event *bp);
0071
0072 unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type);
0073 int decode_dr7(unsigned long dr7, int bpnum, unsigned *len, unsigned *type);
0074
0075 extern int arch_bp_generic_fields(int x86_len, int x86_type,
0076 int *gen_len, int *gen_type);
0077
0078 extern struct pmu perf_ops_bp;
0079
0080 #endif