1 | /* |
2 | * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com> |
3 | * |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; either version 2 |
7 | * of the License, or (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | #ifndef _ORC_LOOKUP_H |
18 | #define _ORC_LOOKUP_H |
19 | |
20 | /* |
21 | * This is a lookup table for speeding up access to the .orc_unwind table. |
22 | * Given an input address offset, the corresponding lookup table entry |
23 | * specifies a subset of the .orc_unwind table to search. |
24 | * |
25 | * Each block represents the end of the previous range and the start of the |
26 | * next range. An extra block is added to give the last range an end. |
27 | * |
28 | * The block size should be a power of 2 to avoid a costly 'div' instruction. |
29 | * |
30 | * A block size of 256 was chosen because it roughly doubles unwinder |
31 | * performance while only adding ~5% to the ORC data footprint. |
32 | */ |
33 | #define LOOKUP_BLOCK_ORDER 8 |
34 | #define LOOKUP_BLOCK_SIZE (1 << LOOKUP_BLOCK_ORDER) |
35 | |
36 | #ifndef LINKER_SCRIPT |
37 | |
38 | extern unsigned int orc_lookup[]; |
39 | extern unsigned int orc_lookup_end[]; |
40 | |
41 | #define LOOKUP_START_IP (unsigned long)_stext |
42 | #define LOOKUP_STOP_IP (unsigned long)_etext |
43 | |
44 | #endif /* LINKER_SCRIPT */ |
45 | |
46 | #endif /* _ORC_LOOKUP_H */ |
47 | |