18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_ARM_MODULE_H 38c2ecf20Sopenharmony_ci#define _ASM_ARM_MODULE_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm-generic/module.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cistruct unwind_table; 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_UNWIND 108c2ecf20Sopenharmony_cienum { 118c2ecf20Sopenharmony_ci ARM_SEC_INIT, 128c2ecf20Sopenharmony_ci ARM_SEC_DEVINIT, 138c2ecf20Sopenharmony_ci ARM_SEC_CORE, 148c2ecf20Sopenharmony_ci ARM_SEC_EXIT, 158c2ecf20Sopenharmony_ci ARM_SEC_DEVEXIT, 168c2ecf20Sopenharmony_ci ARM_SEC_HOT, 178c2ecf20Sopenharmony_ci ARM_SEC_UNLIKELY, 188c2ecf20Sopenharmony_ci ARM_SEC_MAX, 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci#endif 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define PLT_ENT_STRIDE L1_CACHE_BYTES 238c2ecf20Sopenharmony_ci#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) 248c2ecf20Sopenharmony_ci#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistruct plt_entries { 278c2ecf20Sopenharmony_ci u32 ldr[PLT_ENT_COUNT]; 288c2ecf20Sopenharmony_ci u32 lit[PLT_ENT_COUNT]; 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistruct mod_plt_sec { 328c2ecf20Sopenharmony_ci struct elf32_shdr *plt; 338c2ecf20Sopenharmony_ci struct plt_entries *plt_ent; 348c2ecf20Sopenharmony_ci int plt_count; 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistruct mod_arch_specific { 388c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_UNWIND 398c2ecf20Sopenharmony_ci struct unwind_table *unwind[ARM_SEC_MAX]; 408c2ecf20Sopenharmony_ci#endif 418c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_MODULE_PLTS 428c2ecf20Sopenharmony_ci struct mod_plt_sec core; 438c2ecf20Sopenharmony_ci struct mod_plt_sec init; 448c2ecf20Sopenharmony_ci#endif 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct module; 488c2ecf20Sopenharmony_ciu32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val); 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#ifdef CONFIG_THUMB2_KERNEL 518c2ecf20Sopenharmony_ci#define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE 528c2ecf20Sopenharmony_cistatic inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci if (ELF_ST_TYPE(sym->st_info) == STT_FUNC) 558c2ecf20Sopenharmony_ci return sym->st_value & ~1; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci return sym->st_value; 588c2ecf20Sopenharmony_ci} 598c2ecf20Sopenharmony_ci#endif 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#endif /* _ASM_ARM_MODULE_H */ 62