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