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