diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
| commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
| tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/kallsyms.h | |
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/kallsyms.h')
| -rw-r--r-- | include/linux/kallsyms.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h new file mode 100644 index 00000000000..9bbd0409236 --- /dev/null +++ b/include/linux/kallsyms.h | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | /* Rewritten and vastly simplified by Rusty Russell for in-kernel | ||
| 2 | * module loader: | ||
| 3 | * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation | ||
| 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 | /* Lookup the address for a symbol. Returns 0 if not found. */ | ||
| 14 | unsigned long kallsyms_lookup_name(const char *name); | ||
| 15 | |||
| 16 | /* Lookup an address. modname is set to NULL if it's in the kernel. */ | ||
| 17 | const char *kallsyms_lookup(unsigned long addr, | ||
| 18 | unsigned long *symbolsize, | ||
| 19 | unsigned long *offset, | ||
| 20 | char **modname, char *namebuf); | ||
| 21 | |||
| 22 | /* Replace "%s" in format with address, if found */ | ||
| 23 | extern void __print_symbol(const char *fmt, unsigned long address); | ||
| 24 | |||
| 25 | #else /* !CONFIG_KALLSYMS */ | ||
| 26 | |||
| 27 | static inline unsigned long kallsyms_lookup_name(const char *name) | ||
| 28 | { | ||
| 29 | return 0; | ||
| 30 | } | ||
| 31 | |||
| 32 | static 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 | /* Stupid that this does nothing, but I didn't create this mess. */ | ||
| 41 | #define __print_symbol(fmt, addr) | ||
| 42 | #endif /*CONFIG_KALLSYMS*/ | ||
| 43 | |||
| 44 | /* This macro allows us to keep printk typechecking */ | ||
| 45 | static void __check_printsym_format(const char *fmt, ...) | ||
| 46 | __attribute__((format(printf,1,2))); | ||
| 47 | static inline void __check_printsym_format(const char *fmt, ...) | ||
| 48 | { | ||
| 49 | } | ||
| 50 | /* ia64 and ppc64 use function descriptors, which contain the real address */ | ||
| 51 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
| 52 | #define print_fn_descriptor_symbol(fmt, addr) \ | ||
| 53 | do { \ | ||
| 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) \ | ||
| 62 | do { \ | ||
| 63 | __check_printsym_format(fmt, ""); \ | ||
| 64 | __print_symbol(fmt, addr); \ | ||
| 65 | } while(0) | ||
| 66 | |||
| 67 | #endif /*_LINUX_KALLSYMS_H*/ | ||
