Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v4.16-rc2 101 lines 2.6 kB view raw
1#ifndef _ASM_POWERPC_MODULE_H 2#define _ASM_POWERPC_MODULE_H 3#ifdef __KERNEL__ 4 5/* 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 9 * 2 of the License, or (at your option) any later version. 10 */ 11 12#include <linux/list.h> 13#include <asm/bug.h> 14#include <asm-generic/module.h> 15 16 17#ifdef CC_USING_MPROFILE_KERNEL 18#define MODULE_ARCH_VERMAGIC "mprofile-kernel" 19#endif 20 21#ifndef __powerpc64__ 22/* 23 * Thanks to Paul M for explaining this. 24 * 25 * PPC can only do rel jumps += 32MB, and often the kernel and other 26 * modules are further away than this. So, we jump to a table of 27 * trampolines attached to the module (the Procedure Linkage Table) 28 * whenever that happens. 29 */ 30 31struct ppc_plt_entry { 32 /* 16 byte jump instruction sequence (4 instructions) */ 33 unsigned int jump[4]; 34}; 35#endif /* __powerpc64__ */ 36 37 38struct mod_arch_specific { 39#ifdef __powerpc64__ 40 unsigned int stubs_section; /* Index of stubs section in module */ 41 unsigned int toc_section; /* What section is the TOC? */ 42 bool toc_fixed; /* Have we fixed up .TOC.? */ 43#ifdef CONFIG_DYNAMIC_FTRACE 44 unsigned long toc; 45 unsigned long tramp; 46#endif 47 48 /* For module function descriptor dereference */ 49 unsigned long start_opd; 50 unsigned long end_opd; 51#else /* powerpc64 */ 52 /* Indices of PLT sections within module. */ 53 unsigned int core_plt_section; 54 unsigned int init_plt_section; 55#ifdef CONFIG_DYNAMIC_FTRACE 56 unsigned long tramp; 57#endif 58#endif /* powerpc64 */ 59 60 /* List of BUG addresses, source line numbers and filenames */ 61 struct list_head bug_list; 62 struct bug_entry *bug_table; 63 unsigned int num_bugs; 64}; 65 66/* 67 * Select ELF headers. 68 * Make empty section for module_frob_arch_sections to expand. 69 */ 70 71#ifdef __powerpc64__ 72# ifdef MODULE 73 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous"); 74# endif 75#else 76# ifdef MODULE 77 asm(".section .plt,\"ax\",@nobits; .align 3; .previous"); 78 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous"); 79# endif /* MODULE */ 80#endif 81 82#ifdef CONFIG_DYNAMIC_FTRACE 83# ifdef MODULE 84 asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous"); 85# endif /* MODULE */ 86#endif 87 88int module_trampoline_target(struct module *mod, unsigned long trampoline, 89 unsigned long *target); 90 91#ifdef CONFIG_DYNAMIC_FTRACE 92int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs); 93#else 94static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs) 95{ 96 return 0; 97} 98#endif 99 100#endif /* __KERNEL__ */ 101#endif /* _ASM_POWERPC_MODULE_H */