1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _LINUX_EXTABLE_H 3*4882a593Smuzhiyun #define _LINUX_EXTABLE_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <linux/stddef.h> /* for NULL */ 6*4882a593Smuzhiyun #include <linux/types.h> 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun struct module; 9*4882a593Smuzhiyun struct exception_table_entry; 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun const struct exception_table_entry * 12*4882a593Smuzhiyun search_extable(const struct exception_table_entry *base, 13*4882a593Smuzhiyun const size_t num, 14*4882a593Smuzhiyun unsigned long value); 15*4882a593Smuzhiyun void sort_extable(struct exception_table_entry *start, 16*4882a593Smuzhiyun struct exception_table_entry *finish); 17*4882a593Smuzhiyun void sort_main_extable(void); 18*4882a593Smuzhiyun void trim_init_extable(struct module *m); 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun /* Given an address, look for it in the exception tables */ 21*4882a593Smuzhiyun const struct exception_table_entry *search_exception_tables(unsigned long add); 22*4882a593Smuzhiyun const struct exception_table_entry * 23*4882a593Smuzhiyun search_kernel_exception_table(unsigned long addr); 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun #ifdef CONFIG_MODULES 26*4882a593Smuzhiyun /* For extable.c to search modules' exception tables. */ 27*4882a593Smuzhiyun const struct exception_table_entry *search_module_extables(unsigned long addr); 28*4882a593Smuzhiyun #else 29*4882a593Smuzhiyun static inline const struct exception_table_entry * search_module_extables(unsigned long addr)30*4882a593Smuzhiyunsearch_module_extables(unsigned long addr) 31*4882a593Smuzhiyun { 32*4882a593Smuzhiyun return NULL; 33*4882a593Smuzhiyun } 34*4882a593Smuzhiyun #endif /*CONFIG_MODULES*/ 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun #ifdef CONFIG_BPF_JIT 37*4882a593Smuzhiyun const struct exception_table_entry *search_bpf_extables(unsigned long addr); 38*4882a593Smuzhiyun #else 39*4882a593Smuzhiyun static inline const struct exception_table_entry * search_bpf_extables(unsigned long addr)40*4882a593Smuzhiyunsearch_bpf_extables(unsigned long addr) 41*4882a593Smuzhiyun { 42*4882a593Smuzhiyun return NULL; 43*4882a593Smuzhiyun } 44*4882a593Smuzhiyun #endif 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun #endif /* _LINUX_EXTABLE_H */ 47