1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _ARCH_POWERPC_EXTABLE_H 3*4882a593Smuzhiyun #define _ARCH_POWERPC_EXTABLE_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun /* 6*4882a593Smuzhiyun * The exception table consists of pairs of relative addresses: the first is 7*4882a593Smuzhiyun * the address of an instruction that is allowed to fault, and the second is 8*4882a593Smuzhiyun * the address at which the program should continue. No registers are 9*4882a593Smuzhiyun * modified, so it is entirely up to the continuation code to figure out what 10*4882a593Smuzhiyun * to do. 11*4882a593Smuzhiyun * 12*4882a593Smuzhiyun * All the routines below use bits of fixup code that are out of line with the 13*4882a593Smuzhiyun * main instruction path. This means when everything is well, we don't even 14*4882a593Smuzhiyun * have to jump over them. Further, they do not intrude on our cache or tlb 15*4882a593Smuzhiyun * entries. 16*4882a593Smuzhiyun */ 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun #define ARCH_HAS_RELATIVE_EXTABLE 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun struct exception_table_entry { 21*4882a593Smuzhiyun int insn; 22*4882a593Smuzhiyun int fixup; 23*4882a593Smuzhiyun }; 24*4882a593Smuzhiyun extable_fixup(const struct exception_table_entry * x)25*4882a593Smuzhiyunstatic inline unsigned long extable_fixup(const struct exception_table_entry *x) 26*4882a593Smuzhiyun { 27*4882a593Smuzhiyun return (unsigned long)&x->fixup + x->fixup; 28*4882a593Smuzhiyun } 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun #endif 31