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 | ||
43a2a0fa MD |
31 | /* |
32 | * PowerPC ABIv1 needs KALLSYMS_ALL to get the function descriptor, | |
33 | * which is needed to perform the function call. | |
34 | */ | |
35 | #if defined(CONFIG_PPC64) && (!defined(_CALL_ELF) || _CALL_ELF < 2) | |
36 | # ifndef CONFIG_KALLSYMS_ALL | |
37 | # error "LTTng-modules requires CONFIG_KALLSYMS_ALL on PowerPC ABIv1" | |
38 | # endif | |
39 | #endif | |
40 | ||
cab3c961 AS |
41 | static inline |
42 | unsigned long kallsyms_lookup_funcptr(const char *name) | |
43 | { | |
44 | unsigned long addr; | |
45 | ||
46 | addr = kallsyms_lookup_name(name); | |
47 | #ifdef CONFIG_ARM | |
48 | #ifdef CONFIG_THUMB2_KERNEL | |
49 | if (addr) | |
50 | addr |= 1; /* set bit 0 in address for thumb mode */ | |
51 | #endif | |
52 | #endif | |
53 | return addr; | |
54 | } | |
42d9070d AG |
55 | |
56 | static inline | |
57 | unsigned long kallsyms_lookup_dataptr(const char *name) | |
58 | { | |
59 | return kallsyms_lookup_name(name); | |
60 | } | |
a90917c3 | 61 | #endif /* _LTTNG_WRAPPER_KALLSYMS_H */ |