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