1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
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.
9 * Copyright (C) 2011 Avik Sil (avik.sil@linaro.org)
10 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 #ifndef _LTTNG_WRAPPER_KALLSYMS_H
14 #define _LTTNG_WRAPPER_KALLSYMS_H
16 #include <linux/kallsyms.h>
17 #include <lttng-kernel-version.h>
19 /* CONFIG_PPC64_ELF_ABI_V1/V2 were introduced in v5.19 */
20 #if defined(CONFIG_PPC64_ELF_ABI_V2) || (defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN))
21 #define LTTNG_CONFIG_PPC64_ELF_ABI_V2
23 #if defined(CONFIG_PPC64_ELF_ABI_V1) || (defined(CONFIG_PPC64) && defined(CONFIG_CPU_BIG_ENDIAN))
24 #define LTTNG_CONFIG_PPC64_ELF_ABI_V1
28 * PowerPC ABIv1 needs KALLSYMS_ALL to get the function descriptor,
29 * which is needed to perform the function call.
31 #ifdef LTTNG_CONFIG_PPC64_ELF_ABI_V1
32 # ifndef CONFIG_KALLSYMS_ALL
33 # error "LTTng-modules requires CONFIG_KALLSYMS_ALL on PowerPC ABIv1"
37 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0))
39 unsigned long wrapper_kallsyms_lookup_name(const char *name
);
41 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0)) */
44 unsigned long wrapper_kallsyms_lookup_name(const char *name
)
46 return kallsyms_lookup_name(name
);
49 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0)) */
52 unsigned long kallsyms_lookup_funcptr(const char *name
)
56 addr
= wrapper_kallsyms_lookup_name(name
);
58 #ifdef CONFIG_THUMB2_KERNEL
60 addr
|= 1; /* set bit 0 in address for thumb mode */
67 unsigned long kallsyms_lookup_dataptr(const char *name
)
69 return wrapper_kallsyms_lookup_name(name
);
72 #endif /* _LTTNG_WRAPPER_KALLSYMS_H */
This page took 0.031365 seconds and 4 git commands to generate.