18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com> 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#ifndef _ORC_LOOKUP_H 68c2ecf20Sopenharmony_ci#define _ORC_LOOKUP_H 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* 98c2ecf20Sopenharmony_ci * This is a lookup table for speeding up access to the .orc_unwind table. 108c2ecf20Sopenharmony_ci * Given an input address offset, the corresponding lookup table entry 118c2ecf20Sopenharmony_ci * specifies a subset of the .orc_unwind table to search. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Each block represents the end of the previous range and the start of the 148c2ecf20Sopenharmony_ci * next range. An extra block is added to give the last range an end. 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * The block size should be a power of 2 to avoid a costly 'div' instruction. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * A block size of 256 was chosen because it roughly doubles unwinder 198c2ecf20Sopenharmony_ci * performance while only adding ~5% to the ORC data footprint. 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci#define LOOKUP_BLOCK_ORDER 8 228c2ecf20Sopenharmony_ci#define LOOKUP_BLOCK_SIZE (1 << LOOKUP_BLOCK_ORDER) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef LINKER_SCRIPT 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciextern unsigned int orc_lookup[]; 278c2ecf20Sopenharmony_ciextern unsigned int orc_lookup_end[]; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define LOOKUP_START_IP (unsigned long)_stext 308c2ecf20Sopenharmony_ci#define LOOKUP_STOP_IP (unsigned long)_etext 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#endif /* LINKER_SCRIPT */ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#endif /* _ORC_LOOKUP_H */ 35