Fix: update writeback instrumentation for kernel 4.14
[lttng-modules.git] / wrapper / kallsyms.h
1 #ifndef _LTTNG_WRAPPER_KALLSYMS_H
2 #define _LTTNG_WRAPPER_KALLSYMS_H
3
4 /*
5 * wrapper/kallsyms.h
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 *
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
27 */
28
29 #include <linux/kallsyms.h>
30
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
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 }
55
56 static inline
57 unsigned long kallsyms_lookup_dataptr(const char *name)
58 {
59 return kallsyms_lookup_name(name);
60 }
61 #endif /* _LTTNG_WRAPPER_KALLSYMS_H */
This page took 0.030229 seconds and 4 git commands to generate.