Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __S390_EXTABLE_H
0003 #define __S390_EXTABLE_H
0004 
0005 #include <asm/ptrace.h>
0006 #include <linux/compiler.h>
0007 
0008 /*
0009  * The exception table consists of three addresses:
0010  *
0011  * - Address of an instruction that is allowed to fault.
0012  * - Address at which the program should continue.
0013  * - Optional address of handler that takes pt_regs * argument and runs in
0014  *   interrupt context.
0015  *
0016  * No registers are modified, so it is entirely up to the continuation code
0017  * to figure out what to do.
0018  *
0019  * All the routines below use bits of fixup code that are out of line
0020  * with the main instruction path.  This means when everything is well,
0021  * we don't even have to jump over them.  Further, they do not intrude
0022  * on our cache or tlb entries.
0023  */
0024 
0025 struct exception_table_entry
0026 {
0027     int insn, fixup;
0028     short type, data;
0029 };
0030 
0031 extern struct exception_table_entry *__start_amode31_ex_table;
0032 extern struct exception_table_entry *__stop_amode31_ex_table;
0033 
0034 const struct exception_table_entry *s390_search_extables(unsigned long addr);
0035 
0036 static inline unsigned long extable_fixup(const struct exception_table_entry *x)
0037 {
0038     return (unsigned long)&x->fixup + x->fixup;
0039 }
0040 
0041 #define ARCH_HAS_RELATIVE_EXTABLE
0042 
0043 static inline void swap_ex_entry_fixup(struct exception_table_entry *a,
0044                        struct exception_table_entry *b,
0045                        struct exception_table_entry tmp,
0046                        int delta)
0047 {
0048     a->fixup = b->fixup + delta;
0049     b->fixup = tmp.fixup - delta;
0050     a->type = b->type;
0051     b->type = tmp.type;
0052     a->data = b->data;
0053     b->data = tmp.data;
0054 }
0055 #define swap_ex_entry_fixup swap_ex_entry_fixup
0056 
0057 #ifdef CONFIG_BPF_JIT
0058 
0059 bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs);
0060 
0061 #else /* !CONFIG_BPF_JIT */
0062 
0063 static inline bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs)
0064 {
0065     return false;
0066 }
0067 
0068 #endif /* CONFIG_BPF_JIT */
0069 
0070 bool fixup_exception(struct pt_regs *regs);
0071 
0072 #endif