Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ARCH_POWERPC_EXTABLE_H
0003 #define _ARCH_POWERPC_EXTABLE_H
0004 
0005 /*
0006  * The exception table consists of pairs of relative addresses: the first is
0007  * the address of an instruction that is allowed to fault, and the second is
0008  * the address at which the program should continue.  No registers are
0009  * modified, so it is entirely up to the continuation code to figure out what
0010  * to do.
0011  *
0012  * All the routines below use bits of fixup code that are out of line with the
0013  * main instruction path.  This means when everything is well, we don't even
0014  * have to jump over them.  Further, they do not intrude on our cache or tlb
0015  * entries.
0016  */
0017 
0018 #define ARCH_HAS_RELATIVE_EXTABLE
0019 
0020 #ifndef __ASSEMBLY__
0021 
0022 struct exception_table_entry {
0023     int insn;
0024     int fixup;
0025 };
0026 
0027 static inline unsigned long extable_fixup(const struct exception_table_entry *x)
0028 {
0029     return (unsigned long)&x->fixup + x->fixup;
0030 }
0031 
0032 #endif
0033 
0034 /*
0035  * Helper macro for exception table entries
0036  */
0037 #define EX_TABLE(_fault, _target)       \
0038     stringify_in_c(.section __ex_table,"a";)\
0039     stringify_in_c(.balign 4;)      \
0040     stringify_in_c(.long (_fault) - . ;)    \
0041     stringify_in_c(.long (_target) - . ;)   \
0042     stringify_in_c(.previous)
0043 
0044 #endif