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

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

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/kallsyms.h (Architecture sparc64) and /include/linux/kallsyms.h (Architecture sparc)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* Rewritten and vastly simplified by Rusty Ru      2 /* Rewritten and vastly simplified by Rusty Russell for in-kernel
  3  * module loader:                                   3  * module loader:
  4  *   Copyright 2002 Rusty Russell <rusty@rustc      4  *   Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
  5  */                                                 5  */
  6 #ifndef _LINUX_KALLSYMS_H                           6 #ifndef _LINUX_KALLSYMS_H
  7 #define _LINUX_KALLSYMS_H                           7 #define _LINUX_KALLSYMS_H
  8                                                     8 
  9 #include <linux/errno.h>                            9 #include <linux/errno.h>
 10 #include <linux/buildid.h>                         10 #include <linux/buildid.h>
 11 #include <linux/kernel.h>                          11 #include <linux/kernel.h>
 12 #include <linux/stddef.h>                          12 #include <linux/stddef.h>
 13 #include <linux/mm.h>                              13 #include <linux/mm.h>
 14 #include <linux/module.h>                          14 #include <linux/module.h>
 15                                                    15 
 16 #include <asm/sections.h>                          16 #include <asm/sections.h>
 17                                                    17 
 18 #define KSYM_NAME_LEN 512                          18 #define KSYM_NAME_LEN 512
 19 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx      19 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s %s]") + \
 20                         (KSYM_NAME_LEN - 1) +      20                         (KSYM_NAME_LEN - 1) + \
 21                         2*(BITS_PER_LONG*3/10)     21                         2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + \
 22                         (BUILD_ID_SIZE_MAX * 2     22                         (BUILD_ID_SIZE_MAX * 2) + 1)
 23                                                    23 
 24 struct cred;                                       24 struct cred;
 25 struct module;                                     25 struct module;
 26                                                    26 
 27 static inline int is_kernel_text(unsigned long     27 static inline int is_kernel_text(unsigned long addr)
 28 {                                                  28 {
 29         if (__is_kernel_text(addr))                29         if (__is_kernel_text(addr))
 30                 return 1;                          30                 return 1;
 31         return in_gate_area_no_mm(addr);           31         return in_gate_area_no_mm(addr);
 32 }                                                  32 }
 33                                                    33 
 34 static inline int is_kernel(unsigned long addr     34 static inline int is_kernel(unsigned long addr)
 35 {                                                  35 {
 36         if (__is_kernel(addr))                     36         if (__is_kernel(addr))
 37                 return 1;                          37                 return 1;
 38         return in_gate_area_no_mm(addr);           38         return in_gate_area_no_mm(addr);
 39 }                                                  39 }
 40                                                    40 
 41 static inline int is_ksym_addr(unsigned long a     41 static inline int is_ksym_addr(unsigned long addr)
 42 {                                                  42 {
 43         if (IS_ENABLED(CONFIG_KALLSYMS_ALL))       43         if (IS_ENABLED(CONFIG_KALLSYMS_ALL))
 44                 return is_kernel(addr);            44                 return is_kernel(addr);
 45                                                    45 
 46         return is_kernel_text(addr) || is_kern     46         return is_kernel_text(addr) || is_kernel_inittext(addr);
 47 }                                                  47 }
 48                                                    48 
 49 static inline void *dereference_symbol_descrip     49 static inline void *dereference_symbol_descriptor(void *ptr)
 50 {                                                  50 {
 51 #ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS            51 #ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS
 52         struct module *mod;                        52         struct module *mod;
 53                                                    53 
 54         ptr = dereference_kernel_function_desc     54         ptr = dereference_kernel_function_descriptor(ptr);
 55         if (is_ksym_addr((unsigned long)ptr))      55         if (is_ksym_addr((unsigned long)ptr))
 56                 return ptr;                        56                 return ptr;
 57                                                    57 
 58         preempt_disable();                         58         preempt_disable();
 59         mod = __module_address((unsigned long)     59         mod = __module_address((unsigned long)ptr);
 60         preempt_enable();                          60         preempt_enable();
 61                                                    61 
 62         if (mod)                                   62         if (mod)
 63                 ptr = dereference_module_funct     63                 ptr = dereference_module_function_descriptor(mod, ptr);
 64 #endif                                             64 #endif
 65         return ptr;                                65         return ptr;
 66 }                                                  66 }
 67                                                    67 
 68 /* How and when do we show kallsyms values? */     68 /* How and when do we show kallsyms values? */
 69 extern bool kallsyms_show_value(const struct c     69 extern bool kallsyms_show_value(const struct cred *cred);
 70                                                    70 
 71 #ifdef CONFIG_KALLSYMS                             71 #ifdef CONFIG_KALLSYMS
 72 unsigned long kallsyms_sym_address(int idx);       72 unsigned long kallsyms_sym_address(int idx);
 73 int kallsyms_on_each_symbol(int (*fn)(void *,      73 int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),
 74                             void *data);           74                             void *data);
 75 int kallsyms_on_each_match_symbol(int (*fn)(vo     75 int kallsyms_on_each_match_symbol(int (*fn)(void *, unsigned long),
 76                                   const char *     76                                   const char *name, void *data);
 77                                                    77 
 78 /* Lookup the address for a symbol. Returns 0      78 /* Lookup the address for a symbol. Returns 0 if not found. */
 79 unsigned long kallsyms_lookup_name(const char      79 unsigned long kallsyms_lookup_name(const char *name);
 80                                                    80 
 81 extern int kallsyms_lookup_size_offset(unsigne     81 extern int kallsyms_lookup_size_offset(unsigned long addr,
 82                                   unsigned lon     82                                   unsigned long *symbolsize,
 83                                   unsigned lon     83                                   unsigned long *offset);
 84                                                    84 
 85 /* Lookup an address.  modname is set to NULL      85 /* Lookup an address.  modname is set to NULL if it's in the kernel. */
 86 const char *kallsyms_lookup(unsigned long addr     86 const char *kallsyms_lookup(unsigned long addr,
 87                             unsigned long *sym     87                             unsigned long *symbolsize,
 88                             unsigned long *off     88                             unsigned long *offset,
 89                             char **modname, ch     89                             char **modname, char *namebuf);
 90                                                    90 
 91 /* Look up a kernel symbol and return it in a      91 /* Look up a kernel symbol and return it in a text buffer. */
 92 extern int sprint_symbol(char *buffer, unsigne     92 extern int sprint_symbol(char *buffer, unsigned long address);
 93 extern int sprint_symbol_build_id(char *buffer     93 extern int sprint_symbol_build_id(char *buffer, unsigned long address);
 94 extern int sprint_symbol_no_offset(char *buffe     94 extern int sprint_symbol_no_offset(char *buffer, unsigned long address);
 95 extern int sprint_backtrace(char *buffer, unsi     95 extern int sprint_backtrace(char *buffer, unsigned long address);
 96 extern int sprint_backtrace_build_id(char *buf     96 extern int sprint_backtrace_build_id(char *buffer, unsigned long address);
 97                                                    97 
 98 int lookup_symbol_name(unsigned long addr, cha     98 int lookup_symbol_name(unsigned long addr, char *symname);
 99                                                    99 
100 #else /* !CONFIG_KALLSYMS */                      100 #else /* !CONFIG_KALLSYMS */
101                                                   101 
102 static inline unsigned long kallsyms_lookup_na    102 static inline unsigned long kallsyms_lookup_name(const char *name)
103 {                                                 103 {
104         return 0;                                 104         return 0;
105 }                                                 105 }
106                                                   106 
107 static inline int kallsyms_lookup_size_offset(    107 static inline int kallsyms_lookup_size_offset(unsigned long addr,
108                                                   108                                               unsigned long *symbolsize,
109                                                   109                                               unsigned long *offset)
110 {                                                 110 {
111         return 0;                                 111         return 0;
112 }                                                 112 }
113                                                   113 
114 static inline const char *kallsyms_lookup(unsi    114 static inline const char *kallsyms_lookup(unsigned long addr,
115                                           unsi    115                                           unsigned long *symbolsize,
116                                           unsi    116                                           unsigned long *offset,
117                                           char    117                                           char **modname, char *namebuf)
118 {                                                 118 {
119         return NULL;                              119         return NULL;
120 }                                                 120 }
121                                                   121 
122 static inline int sprint_symbol(char *buffer,     122 static inline int sprint_symbol(char *buffer, unsigned long addr)
123 {                                                 123 {
124         *buffer = '\0';                           124         *buffer = '\0';
125         return 0;                                 125         return 0;
126 }                                                 126 }
127                                                   127 
128 static inline int sprint_symbol_build_id(char     128 static inline int sprint_symbol_build_id(char *buffer, unsigned long address)
129 {                                                 129 {
130         *buffer = '\0';                           130         *buffer = '\0';
131         return 0;                                 131         return 0;
132 }                                                 132 }
133                                                   133 
134 static inline int sprint_symbol_no_offset(char    134 static inline int sprint_symbol_no_offset(char *buffer, unsigned long addr)
135 {                                                 135 {
136         *buffer = '\0';                           136         *buffer = '\0';
137         return 0;                                 137         return 0;
138 }                                                 138 }
139                                                   139 
140 static inline int sprint_backtrace(char *buffe    140 static inline int sprint_backtrace(char *buffer, unsigned long addr)
141 {                                                 141 {
142         *buffer = '\0';                           142         *buffer = '\0';
143         return 0;                                 143         return 0;
144 }                                                 144 }
145                                                   145 
146 static inline int sprint_backtrace_build_id(ch    146 static inline int sprint_backtrace_build_id(char *buffer, unsigned long addr)
147 {                                                 147 {
148         *buffer = '\0';                           148         *buffer = '\0';
149         return 0;                                 149         return 0;
150 }                                                 150 }
151                                                   151 
152 static inline int lookup_symbol_name(unsigned     152 static inline int lookup_symbol_name(unsigned long addr, char *symname)
153 {                                                 153 {
154         return -ERANGE;                           154         return -ERANGE;
155 }                                                 155 }
156                                                   156 
157 static inline int kallsyms_on_each_symbol(int     157 static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),
158                                           void    158                                           void *data)
159 {                                                 159 {
160         return -EOPNOTSUPP;                       160         return -EOPNOTSUPP;
161 }                                                 161 }
162                                                   162 
163 static inline int kallsyms_on_each_match_symbo    163 static inline int kallsyms_on_each_match_symbol(int (*fn)(void *, unsigned long),
164                                                   164                                                 const char *name, void *data)
165 {                                                 165 {
166         return -EOPNOTSUPP;                       166         return -EOPNOTSUPP;
167 }                                                 167 }
168 #endif /*CONFIG_KALLSYMS*/                        168 #endif /*CONFIG_KALLSYMS*/
169                                                   169 
170 static inline void print_ip_sym(const char *lo    170 static inline void print_ip_sym(const char *loglvl, unsigned long ip)
171 {                                                 171 {
172         printk("%s[<%px>] %pS\n", loglvl, (voi    172         printk("%s[<%px>] %pS\n", loglvl, (void *) ip, (void *) ip);
173 }                                                 173 }
174                                                   174 
175 #endif /*_LINUX_KALLSYMS_H*/                      175 #endif /*_LINUX_KALLSYMS_H*/
176                                                   176 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php