1 /* Rewritten and vastly simplified by Rusty Russell for in-kernel
3 * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
5 #ifndef _LINUX_KALLSYMS_H
6 #define _LINUX_KALLSYMS_H
8 #include <linux/config.h>
10 #ifdef CONFIG_KALLSYMS
11 /* Lookup the address for a symbol. Returns 0 if not found. */
12 unsigned long kallsyms_lookup_name(const char *name);
14 /* Lookup an address. modname is set to NULL if it's in the kernel. */
15 const char *kallsyms_lookup(unsigned long addr,
16 unsigned long *symbolsize,
17 unsigned long *offset,
18 char **modname, char *namebuf);
20 /* Replace "%s" in format with address, if found */
21 extern void __print_symbol(const char *fmt, unsigned long address);
23 #else /* !CONFIG_KALLSYMS */
25 static inline unsigned long kallsyms_lookup_name(const char *name)
30 static inline const char *kallsyms_lookup(unsigned long addr,
31 unsigned long *symbolsize,
32 unsigned long *offset,
33 char **modname, char *namebuf)
38 /* Stupid that this does nothing, but I didn't create this mess. */
39 #define __print_symbol(fmt, addr)
40 #endif /*CONFIG_KALLSYMS*/
42 /* This macro allows us to keep printk typechecking */
43 static void __check_printsym_format(const char *fmt, ...)
44 __attribute__((format(printf,1,2)));
45 static inline void __check_printsym_format(const char *fmt, ...)
49 #define print_symbol(fmt, addr) \
51 __check_printsym_format(fmt, ""); \
52 __print_symbol(fmt, addr); \
55 #endif /*_LINUX_KALLSYMS_H*/