1
2
3
4
5#ifndef _LINUX_KALLSYMS_H
6#define _LINUX_KALLSYMS_H
7
8#include <linux/config.h>
9
10#define KSYM_NAME_LEN 127
11
12#ifdef CONFIG_KALLSYMS
13
14unsigned long kallsyms_lookup_name(const char *name);
15
16
17const char *kallsyms_lookup(unsigned long addr,
18 unsigned long *symbolsize,
19 unsigned long *offset,
20 char **modname, char *namebuf);
21
22
23extern void __print_symbol(const char *fmt, unsigned long address);
24
25#else
26
27static inline unsigned long kallsyms_lookup_name(const char *name)
28{
29 return 0;
30}
31
32static inline const char *kallsyms_lookup(unsigned long addr,
33 unsigned long *symbolsize,
34 unsigned long *offset,
35 char **modname, char *namebuf)
36{
37 return NULL;
38}
39
40
41#define __print_symbol(fmt, addr)
42#endif
43
44
45static void __check_printsym_format(const char *fmt, ...)
46__attribute__((format(printf,1,2)));
47static inline void __check_printsym_format(const char *fmt, ...)
48{
49}
50
51#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
52#define print_fn_descriptor_symbol(fmt, addr) \
53do { \
54 unsigned long *__faddr = (unsigned long*) addr; \
55 print_symbol(fmt, __faddr[0]); \
56} while (0)
57#else
58#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
59#endif
60
61#define print_symbol(fmt, addr) \
62do { \
63 __check_printsym_format(fmt, ""); \
64 __print_symbol(fmt, addr); \
65} while(0)
66
67#endif
68