18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_LOONGARCH_EXTABLE_H 38c2ecf20Sopenharmony_ci#define _ASM_LOONGARCH_EXTABLE_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * The exception table consists of pairs of relative offsets: the first 78c2ecf20Sopenharmony_ci * is the relative offset to an instruction that is allowed to fault, 88c2ecf20Sopenharmony_ci * and the second is the relative offset at which the program should 98c2ecf20Sopenharmony_ci * continue. No registers are modified, so it is entirely up to the 108c2ecf20Sopenharmony_ci * continuation code to figure out what to do. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * All the routines below use bits of fixup code that are out of line 138c2ecf20Sopenharmony_ci * with the main instruction path. This means when everything is well, 148c2ecf20Sopenharmony_ci * we don't even have to jump over them. Further, they do not intrude 158c2ecf20Sopenharmony_ci * on our cache or tlb entries. 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistruct exception_table_entry { 198c2ecf20Sopenharmony_ci int insn, fixup; 208c2ecf20Sopenharmony_ci short type, data; 218c2ecf20Sopenharmony_ci}; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define ARCH_HAS_RELATIVE_EXTABLE 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define swap_ex_entry_fixup(a, b, tmp, delta) \ 268c2ecf20Sopenharmony_cido { \ 278c2ecf20Sopenharmony_ci (a)->fixup = (b)->fixup + (delta); \ 288c2ecf20Sopenharmony_ci (b)->fixup = (tmp).fixup - (delta); \ 298c2ecf20Sopenharmony_ci (a)->type = (b)->type; \ 308c2ecf20Sopenharmony_ci (b)->type = (tmp).type; \ 318c2ecf20Sopenharmony_ci (a)->data = (b)->data; \ 328c2ecf20Sopenharmony_ci (b)->data = (tmp).data; \ 338c2ecf20Sopenharmony_ci} while (0) 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cibool fixup_exception(struct pt_regs *regs); 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#endif 38