~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/kallsyms.h

Version: ~ [ linux-5.5 ] ~ [ linux-5.4.15 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.98 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.167 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.211 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.211 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.81 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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/errno.h>
  9 #include <linux/kernel.h>
 10 #include <linux/stddef.h>
 11 
 12 #define KSYM_NAME_LEN 128
 13 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
 14                          2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
 15 
 16 struct module;
 17 
 18 #ifdef CONFIG_KALLSYMS
 19 /* Lookup the address for a symbol. Returns 0 if not found. */
 20 unsigned long kallsyms_lookup_name(const char *name);
 21 
 22 /* Call a function on each kallsyms symbol in the core kernel */
 23 int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
 24                                       unsigned long),
 25                             void *data);
 26 
 27 extern int kallsyms_lookup_size_offset(unsigned long addr,
 28                                   unsigned long *symbolsize,
 29                                   unsigned long *offset);
 30 
 31 /* Lookup an address.  modname is set to NULL if it's in the kernel. */
 32 const char *kallsyms_lookup(unsigned long addr,
 33                             unsigned long *symbolsize,
 34                             unsigned long *offset,
 35                             char **modname, char *namebuf);
 36 
 37 /* Look up a kernel symbol and return it in a text buffer. */
 38 extern int sprint_symbol(char *buffer, unsigned long address);
 39 extern int sprint_symbol_no_offset(char *buffer, unsigned long address);
 40 extern int sprint_backtrace(char *buffer, unsigned long address);
 41 
 42 /* Look up a kernel symbol and print it to the kernel messages. */
 43 extern void __print_symbol(const char *fmt, unsigned long address);
 44 
 45 int lookup_symbol_name(unsigned long addr, char *symname);
 46 int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
 47 
 48 #else /* !CONFIG_KALLSYMS */
 49 
 50 static inline unsigned long kallsyms_lookup_name(const char *name)
 51 {
 52         return 0;
 53 }
 54 
 55 static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
 56                                                     struct module *,
 57                                                     unsigned long),
 58                                           void *data)
 59 {
 60         return 0;
 61 }
 62 
 63 static inline int kallsyms_lookup_size_offset(unsigned long addr,
 64                                               unsigned long *symbolsize,
 65                                               unsigned long *offset)
 66 {
 67         return 0;
 68 }
 69 
 70 static inline const char *kallsyms_lookup(unsigned long addr,
 71                                           unsigned long *symbolsize,
 72                                           unsigned long *offset,
 73                                           char **modname, char *namebuf)
 74 {
 75         return NULL;
 76 }
 77 
 78 static inline int sprint_symbol(char *buffer, unsigned long addr)
 79 {
 80         *buffer = '\0';
 81         return 0;
 82 }
 83 
 84 static inline int sprint_symbol_no_offset(char *buffer, unsigned long addr)
 85 {
 86         *buffer = '\0';
 87         return 0;
 88 }
 89 
 90 static inline int sprint_backtrace(char *buffer, unsigned long addr)
 91 {
 92         *buffer = '\0';
 93         return 0;
 94 }
 95 
 96 static inline int lookup_symbol_name(unsigned long addr, char *symname)
 97 {
 98         return -ERANGE;
 99 }
100 
101 static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name)
102 {
103         return -ERANGE;
104 }
105 
106 /* Stupid that this does nothing, but I didn't create this mess. */
107 #define __print_symbol(fmt, addr)
108 #endif /*CONFIG_KALLSYMS*/
109 
110 /* This macro allows us to keep printk typechecking */
111 static __printf(1, 2)
112 void __check_printsym_format(const char *fmt, ...)
113 {
114 }
115 
116 static inline void print_symbol(const char *fmt, unsigned long addr)
117 {
118         __check_printsym_format(fmt, "");
119         __print_symbol(fmt, (unsigned long)
120                        __builtin_extract_return_addr((void *)addr));
121 }
122 
123 static inline void print_ip_sym(unsigned long ip)
124 {
125         printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
126 }
127 
128 #endif /*_LINUX_KALLSYMS_H*/
129 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp