xref: /linux/arch/loongarch/include/asm/orc_lookup.h (revision 0d21364c6e8dc1f62c34bbc49d49935c8b01844c)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _ORC_LOOKUP_H
3 #define _ORC_LOOKUP_H
4 
5 /*
6  * This is a lookup table for speeding up access to the .orc_unwind table.
7  * Given an input address offset, the corresponding lookup table entry
8  * specifies a subset of the .orc_unwind table to search.
9  *
10  * Each block represents the end of the previous range and the start of the
11  * next range.  An extra block is added to give the last range an end.
12  *
13  * The block size should be a power of 2 to avoid a costly 'div' instruction.
14  *
15  * A block size of 256 was chosen because it roughly doubles unwinder
16  * performance while only adding ~5% to the ORC data footprint.
17  */
18 #define LOOKUP_BLOCK_ORDER	8
19 #define LOOKUP_BLOCK_SIZE	(1 << LOOKUP_BLOCK_ORDER)
20 
21 #ifndef LINKER_SCRIPT
22 
23 extern unsigned int orc_lookup[];
24 extern unsigned int orc_lookup_end[];
25 
26 #define LOOKUP_START_IP		(unsigned long)_stext
27 #define LOOKUP_STOP_IP		(unsigned long)_etext
28 
29 #endif /* LINKER_SCRIPT */
30 
31 #endif /* _ORC_LOOKUP_H */
32