1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2527b5baeSAl Viro #ifndef _ARCH_POWERPC_EXTABLE_H 3527b5baeSAl Viro #define _ARCH_POWERPC_EXTABLE_H 4527b5baeSAl Viro 5527b5baeSAl Viro /* 6527b5baeSAl Viro * The exception table consists of pairs of relative addresses: the first is 7527b5baeSAl Viro * the address of an instruction that is allowed to fault, and the second is 8527b5baeSAl Viro * the address at which the program should continue. No registers are 9527b5baeSAl Viro * modified, so it is entirely up to the continuation code to figure out what 10527b5baeSAl Viro * to do. 11527b5baeSAl Viro * 12527b5baeSAl Viro * All the routines below use bits of fixup code that are out of line with the 13527b5baeSAl Viro * main instruction path. This means when everything is well, we don't even 14527b5baeSAl Viro * have to jump over them. Further, they do not intrude on our cache or tlb 15527b5baeSAl Viro * entries. 16527b5baeSAl Viro */ 17527b5baeSAl Viro 18527b5baeSAl Viro #define ARCH_HAS_RELATIVE_EXTABLE 19527b5baeSAl Viro 20*1e688dd2SChristophe Leroy #ifndef __ASSEMBLY__ 21*1e688dd2SChristophe Leroy 22527b5baeSAl Viro struct exception_table_entry { 23527b5baeSAl Viro int insn; 24527b5baeSAl Viro int fixup; 25527b5baeSAl Viro }; 26527b5baeSAl Viro extable_fixup(const struct exception_table_entry * x)27527b5baeSAl Virostatic inline unsigned long extable_fixup(const struct exception_table_entry *x) 28527b5baeSAl Viro { 29527b5baeSAl Viro return (unsigned long)&x->fixup + x->fixup; 30527b5baeSAl Viro } 31527b5baeSAl Viro 32527b5baeSAl Viro #endif 33*1e688dd2SChristophe Leroy 34*1e688dd2SChristophe Leroy /* 35*1e688dd2SChristophe Leroy * Helper macro for exception table entries 36*1e688dd2SChristophe Leroy */ 37*1e688dd2SChristophe Leroy #define EX_TABLE(_fault, _target) \ 38*1e688dd2SChristophe Leroy stringify_in_c(.section __ex_table,"a";)\ 39*1e688dd2SChristophe Leroy stringify_in_c(.balign 4;) \ 40*1e688dd2SChristophe Leroy stringify_in_c(.long (_fault) - . ;) \ 41*1e688dd2SChristophe Leroy stringify_in_c(.long (_target) - . ;) \ 42*1e688dd2SChristophe Leroy stringify_in_c(.previous) 43*1e688dd2SChristophe Leroy 44*1e688dd2SChristophe Leroy #endif 45