2 * (C) Copyright 2009-2011 -
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * LTTng kprobes integration module.
7 * Dual LGPL v2.1/GPL v2 license.
10 #include <linux/module.h>
11 #include <linux/kprobes.h>
12 #include "../ltt-events.h"
13 #include "../wrapper/ringbuffer/frontend_types.h"
14 #include "../ltt-tracer.h"
16 void lttng_kprobes_handler_pre(struct kprobe
*p
, struct pt_regs
*regs
)
18 struct ltt_event
*event
=
19 container_of(p
, struct ltt_event
, u
.kprobe
.kp
);
20 struct ltt_channel
*chan
= event
->chan
;
21 struct lib_ring_buffer_ctx ctx
;
23 unsigned long data
= (unsigned long) p
->addr
;
25 if (!ACCESS_ONCE(chan
->session
->active
))
27 lib_ring_buffer_ctx_init(&ctx
, chan
->chan
, NULL
, sizeof(data
),
28 ltt_alignof(data
), -1);
29 ret
= chan
->ops
->event_reserve(&ctx
);
32 lib_ring_buffer_align_ctx(&ctx
, ltt_alignof(data
));
33 chan
->ops
->event_write(&ctx
, &data
, sizeof(data
));
34 chan
->ops
->event_commit(&ctx
);
36 EXPORT_SYMBOL_GPL(lttng_kprobes_handler_pre
);
38 MODULE_LICENSE("GPL and additional rights");
39 MODULE_AUTHOR("Mathieu Desnoyers");
40 MODULE_DESCRIPTION("Linux Trace Toolkit Kprobes Support");