xref: /openbmc/linux/include/linux/extable.h (revision 3dec541b)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
20ef76537SPaul Gortmaker #ifndef _LINUX_EXTABLE_H
30ef76537SPaul Gortmaker #define _LINUX_EXTABLE_H
40ef76537SPaul Gortmaker 
549aadcf1SPaul Gortmaker #include <linux/stddef.h>	/* for NULL */
6a94c33ddSThomas Meyer #include <linux/types.h>
749aadcf1SPaul Gortmaker 
80ef76537SPaul Gortmaker struct module;
90ef76537SPaul Gortmaker struct exception_table_entry;
100ef76537SPaul Gortmaker 
110ef76537SPaul Gortmaker const struct exception_table_entry *
12a94c33ddSThomas Meyer search_extable(const struct exception_table_entry *base,
13a94c33ddSThomas Meyer 	       const size_t num,
140ef76537SPaul Gortmaker 	       unsigned long value);
150ef76537SPaul Gortmaker void sort_extable(struct exception_table_entry *start,
160ef76537SPaul Gortmaker 		  struct exception_table_entry *finish);
170ef76537SPaul Gortmaker void sort_main_extable(void);
180ef76537SPaul Gortmaker void trim_init_extable(struct module *m);
190ef76537SPaul Gortmaker 
200ef76537SPaul Gortmaker /* Given an address, look for it in the exception tables */
210ef76537SPaul Gortmaker const struct exception_table_entry *search_exception_tables(unsigned long add);
2249ec9177SSantosh Sivaraj const struct exception_table_entry *
2349ec9177SSantosh Sivaraj search_kernel_exception_table(unsigned long addr);
240ef76537SPaul Gortmaker 
250ef76537SPaul Gortmaker #ifdef CONFIG_MODULES
260ef76537SPaul Gortmaker /* For extable.c to search modules' exception tables. */
270ef76537SPaul Gortmaker const struct exception_table_entry *search_module_extables(unsigned long addr);
280ef76537SPaul Gortmaker #else
290ef76537SPaul Gortmaker static inline const struct exception_table_entry *
search_module_extables(unsigned long addr)300ef76537SPaul Gortmaker search_module_extables(unsigned long addr)
310ef76537SPaul Gortmaker {
320ef76537SPaul Gortmaker 	return NULL;
330ef76537SPaul Gortmaker }
340ef76537SPaul Gortmaker #endif /*CONFIG_MODULES*/
350ef76537SPaul Gortmaker 
363dec541bSAlexei Starovoitov #ifdef CONFIG_BPF_JIT
373dec541bSAlexei Starovoitov const struct exception_table_entry *search_bpf_extables(unsigned long addr);
383dec541bSAlexei Starovoitov #else
393dec541bSAlexei Starovoitov static inline const struct exception_table_entry *
search_bpf_extables(unsigned long addr)403dec541bSAlexei Starovoitov search_bpf_extables(unsigned long addr)
413dec541bSAlexei Starovoitov {
423dec541bSAlexei Starovoitov 	return NULL;
433dec541bSAlexei Starovoitov }
443dec541bSAlexei Starovoitov #endif
453dec541bSAlexei Starovoitov 
460ef76537SPaul Gortmaker #endif /* _LINUX_EXTABLE_H */
47