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