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