fix: file: Rename fcheck lookup_fd_rcu (v5.11)
[lttng-modules.git] / wrapper / kallsyms.h
... / ...
CommitLineData
1/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2 *
3 * wrapper/kallsyms.h
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 *
9 * Copyright (C) 2011 Avik Sil (avik.sil@linaro.org)
10 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 */
12
13#ifndef _LTTNG_WRAPPER_KALLSYMS_H
14#define _LTTNG_WRAPPER_KALLSYMS_H
15
16#include <linux/kallsyms.h>
17#include <linux/version.h>
18
19/*
20 * PowerPC ABIv1 needs KALLSYMS_ALL to get the function descriptor,
21 * which is needed to perform the function call.
22 */
23#if defined(CONFIG_PPC64) && (!defined(_CALL_ELF) || _CALL_ELF < 2)
24# ifndef CONFIG_KALLSYMS_ALL
25# error "LTTng-modules requires CONFIG_KALLSYMS_ALL on PowerPC ABIv1"
26# endif
27#endif
28
29#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
30
31unsigned long wrapper_kallsyms_lookup_name(const char *name);
32
33#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */
34
35static inline
36unsigned long wrapper_kallsyms_lookup_name(const char *name)
37{
38 return kallsyms_lookup_name(name);
39}
40
41#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */
42
43static inline
44unsigned long kallsyms_lookup_funcptr(const char *name)
45{
46 unsigned long addr;
47
48 addr = wrapper_kallsyms_lookup_name(name);
49#ifdef CONFIG_ARM
50#ifdef CONFIG_THUMB2_KERNEL
51 if (addr)
52 addr |= 1; /* set bit 0 in address for thumb mode */
53#endif
54#endif
55 return addr;
56}
57
58static inline
59unsigned long kallsyms_lookup_dataptr(const char *name)
60{
61 return wrapper_kallsyms_lookup_name(name);
62}
63
64#endif /* _LTTNG_WRAPPER_KALLSYMS_H */
This page took 0.026011 seconds and 4 git commands to generate.