Commit | Line | Data |
---|---|---|
a90917c3 MD |
1 | #ifndef _LTTNG_WRAPPER_KALLSYMS_H |
2 | #define _LTTNG_WRAPPER_KALLSYMS_H | |
cab3c961 AS |
3 | |
4 | /* | |
886d51a3 | 5 | * wrapper/kallsyms.h |
cab3c961 AS |
6 | * |
7 | * wrapper around kallsyms_lookup_name. Implements arch-dependent code for | |
8 | * arches where the address of the start of the function body is different | |
9 | * from the pointer which can be used to call the function, e.g. ARM THUMB2. | |
10 | * | |
886d51a3 MD |
11 | * Copyright (C) 2011 Avik Sil (avik.sil@linaro.org) |
12 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
13 | * | |
14 | * This library is free software; you can redistribute it and/or | |
15 | * modify it under the terms of the GNU Lesser General Public | |
16 | * License as published by the Free Software Foundation; only | |
17 | * version 2.1 of the License. | |
18 | * | |
19 | * This library is distributed in the hope that it will be useful, | |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
22 | * Lesser General Public License for more details. | |
23 | * | |
24 | * You should have received a copy of the GNU Lesser General Public | |
25 | * License along with this library; if not, write to the Free Software | |
26 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
cab3c961 AS |
27 | */ |
28 | ||
f6566a02 MD |
29 | #include <linux/kallsyms.h> |
30 | ||
cab3c961 AS |
31 | static inline |
32 | unsigned long kallsyms_lookup_funcptr(const char *name) | |
33 | { | |
34 | unsigned long addr; | |
35 | ||
36 | addr = kallsyms_lookup_name(name); | |
37 | #ifdef CONFIG_ARM | |
38 | #ifdef CONFIG_THUMB2_KERNEL | |
39 | if (addr) | |
40 | addr |= 1; /* set bit 0 in address for thumb mode */ | |
41 | #endif | |
42 | #endif | |
43 | return addr; | |
44 | } | |
42d9070d AG |
45 | |
46 | static inline | |
47 | unsigned long kallsyms_lookup_dataptr(const char *name) | |
48 | { | |
49 | return kallsyms_lookup_name(name); | |
50 | } | |
a90917c3 | 51 | #endif /* _LTTNG_WRAPPER_KALLSYMS_H */ |