aboutsummaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/Kconfig3
-rw-r--r--samples/hw_breakpoint/data_breakpoint.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/samples/Kconfig b/samples/Kconfig
index e4be84ac3d38..8924f72f0629 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -1,5 +1,3 @@
1# samples/Kconfig
2
3menuconfig SAMPLES 1menuconfig SAMPLES
4 bool "Sample kernel code" 2 bool "Sample kernel code"
5 help 3 help
@@ -47,4 +45,3 @@ config SAMPLE_HW_BREAKPOINT
47 This builds kernel hardware breakpoint example modules. 45 This builds kernel hardware breakpoint example modules.
48 46
49endif # SAMPLES 47endif # SAMPLES
50
diff --git a/samples/hw_breakpoint/data_breakpoint.c b/samples/hw_breakpoint/data_breakpoint.c
index 29525500df00..c69cbe9b2426 100644
--- a/samples/hw_breakpoint/data_breakpoint.c
+++ b/samples/hw_breakpoint/data_breakpoint.c
@@ -41,7 +41,9 @@ module_param_string(ksym, ksym_name, KSYM_NAME_LEN, S_IRUGO);
41MODULE_PARM_DESC(ksym, "Kernel symbol to monitor; this module will report any" 41MODULE_PARM_DESC(ksym, "Kernel symbol to monitor; this module will report any"
42 " write operations on the kernel symbol"); 42 " write operations on the kernel symbol");
43 43
44static void sample_hbp_handler(struct perf_event *temp, void *data) 44static void sample_hbp_handler(struct perf_event *bp, int nmi,
45 struct perf_sample_data *data,
46 struct pt_regs *regs)
45{ 47{
46 printk(KERN_INFO "%s value is changed\n", ksym_name); 48 printk(KERN_INFO "%s value is changed\n", ksym_name);
47 dump_stack(); 49 dump_stack();
@@ -51,8 +53,9 @@ static void sample_hbp_handler(struct perf_event *temp, void *data)
51static int __init hw_break_module_init(void) 53static int __init hw_break_module_init(void)
52{ 54{
53 int ret; 55 int ret;
54 DEFINE_BREAKPOINT_ATTR(attr); 56 struct perf_event_attr attr;
55 57
58 hw_breakpoint_init(&attr);
56 attr.bp_addr = kallsyms_lookup_name(ksym_name); 59 attr.bp_addr = kallsyms_lookup_name(ksym_name);
57 attr.bp_len = HW_BREAKPOINT_LEN_4; 60 attr.bp_len = HW_BREAKPOINT_LEN_4;
58 attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R; 61 attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R;