Commit | Line | Data |
---|---|---|
9f36eaed MJ |
1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
2 | * | |
886d51a3 | 3 | * wrapper/kallsyms.h |
cab3c961 AS |
4 | * |
5 | * wrapper around kallsyms_lookup_name. Implements arch-dependent code for | |
6 | * arches where the address of the start of the function body is different | |
7 | * from the pointer which can be used to call the function, e.g. ARM THUMB2. | |
8 | * | |
886d51a3 MD |
9 | * Copyright (C) 2011 Avik Sil (avik.sil@linaro.org) |
10 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
cab3c961 AS |
11 | */ |
12 | ||
9f36eaed MJ |
13 | #ifndef _LTTNG_WRAPPER_KALLSYMS_H |
14 | #define _LTTNG_WRAPPER_KALLSYMS_H | |
15 | ||
f6566a02 MD |
16 | #include <linux/kallsyms.h> |
17 | ||
43a2a0fa MD |
18 | /* |
19 | * PowerPC ABIv1 needs KALLSYMS_ALL to get the function descriptor, | |
20 | * which is needed to perform the function call. | |
21 | */ | |
22 | #if defined(CONFIG_PPC64) && (!defined(_CALL_ELF) || _CALL_ELF < 2) | |
23 | # ifndef CONFIG_KALLSYMS_ALL | |
24 | # error "LTTng-modules requires CONFIG_KALLSYMS_ALL on PowerPC ABIv1" | |
25 | # endif | |
26 | #endif | |
27 | ||
cab3c961 AS |
28 | static inline |
29 | unsigned long kallsyms_lookup_funcptr(const char *name) | |
30 | { | |
31 | unsigned long addr; | |
32 | ||
33 | addr = kallsyms_lookup_name(name); | |
34 | #ifdef CONFIG_ARM | |
35 | #ifdef CONFIG_THUMB2_KERNEL | |
36 | if (addr) | |
37 | addr |= 1; /* set bit 0 in address for thumb mode */ | |
38 | #endif | |
39 | #endif | |
40 | return addr; | |
41 | } | |
42d9070d AG |
42 | |
43 | static inline | |
44 | unsigned long kallsyms_lookup_dataptr(const char *name) | |
45 | { | |
46 | return kallsyms_lookup_name(name); | |
47 | } | |
a90917c3 | 48 | #endif /* _LTTNG_WRAPPER_KALLSYMS_H */ |