Commit | Line | Data |
---|---|---|
a37c8875 | 1 | #ifndef _ASM_POWERPC_MODULE_H |
2 | #define _ASM_POWERPC_MODULE_H | |
88ced031 | 3 | #ifdef __KERNEL__ |
6b9269ab JL |
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> | |
786d35d4 | 14 | #include <asm-generic/module.h> |
6b9269ab JL |
15 | |
16 | ||
abba7597 | 17 | #ifdef CONFIG_MPROFILE_KERNEL |
73aca179 ME |
18 | #define MODULE_ARCH_VERMAGIC_FTRACE "mprofile-kernel " |
19 | #else | |
20 | #define MODULE_ARCH_VERMAGIC_FTRACE "" | |
43e24e82 ME |
21 | #endif |
22 | ||
73aca179 ME |
23 | #ifdef CONFIG_RELOCATABLE |
24 | #define MODULE_ARCH_VERMAGIC_RELOCATABLE "relocatable " | |
25 | #else | |
26 | #define MODULE_ARCH_VERMAGIC_RELOCATABLE "" | |
27 | #endif | |
28 | ||
29 | #define MODULE_ARCH_VERMAGIC MODULE_ARCH_VERMAGIC_FTRACE MODULE_ARCH_VERMAGIC_RELOCATABLE | |
30 | ||
6b9269ab JL |
31 | #ifndef __powerpc64__ |
32 | /* | |
33 | * Thanks to Paul M for explaining this. | |
34 | * | |
35 | * PPC can only do rel jumps += 32MB, and often the kernel and other | |
446957ba | 36 | * modules are further away than this. So, we jump to a table of |
6b9269ab JL |
37 | * trampolines attached to the module (the Procedure Linkage Table) |
38 | * whenever that happens. | |
39 | */ | |
40 | ||
41 | struct ppc_plt_entry { | |
42 | /* 16 byte jump instruction sequence (4 instructions) */ | |
43 | unsigned int jump[4]; | |
44 | }; | |
45 | #endif /* __powerpc64__ */ | |
46 | ||
47 | ||
48 | struct mod_arch_specific { | |
49 | #ifdef __powerpc64__ | |
50 | unsigned int stubs_section; /* Index of stubs section in module */ | |
51 | unsigned int toc_section; /* What section is the TOC? */ | |
4edebbea | 52 | bool toc_fixed; /* Have we fixed up .TOC.? */ |
f48cb8b4 | 53 | |
5633e85b SS |
54 | /* For module function descriptor dereference */ |
55 | unsigned long start_opd; | |
56 | unsigned long end_opd; | |
7cc45e64 | 57 | #else /* powerpc64 */ |
6b9269ab JL |
58 | /* Indices of PLT sections within module. */ |
59 | unsigned int core_plt_section; | |
60 | unsigned int init_plt_section; | |
8ce621e1 JP |
61 | #endif /* powerpc64 */ |
62 | ||
7cc45e64 SR |
63 | #ifdef CONFIG_DYNAMIC_FTRACE |
64 | unsigned long tramp; | |
8ce621e1 JP |
65 | #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS |
66 | unsigned long tramp_regs; | |
67 | #endif | |
6b9269ab JL |
68 | #endif |
69 | ||
70 | /* List of BUG addresses, source line numbers and filenames */ | |
71 | struct list_head bug_list; | |
72 | struct bug_entry *bug_table; | |
73 | unsigned int num_bugs; | |
74 | }; | |
75 | ||
6b9269ab JL |
76 | /* |
77 | * Select ELF headers. | |
78 | * Make empty section for module_frob_arch_sections to expand. | |
79 | */ | |
80 | ||
81 | #ifdef __powerpc64__ | |
6b9269ab JL |
82 | # ifdef MODULE |
83 | asm(".section .stubs,\"ax\",@nobits; .align 3; .previous"); | |
84 | # endif | |
85 | #else | |
6b9269ab JL |
86 | # ifdef MODULE |
87 | asm(".section .plt,\"ax\",@nobits; .align 3; .previous"); | |
88 | asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous"); | |
89 | # endif /* MODULE */ | |
90 | #endif | |
91 | ||
f48cb8b4 SR |
92 | #ifdef CONFIG_DYNAMIC_FTRACE |
93 | # ifdef MODULE | |
94 | asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous"); | |
95 | # endif /* MODULE */ | |
96 | #endif | |
97 | ||
f17c4e01 | 98 | int module_trampoline_target(struct module *mod, unsigned long trampoline, |
dd9fa162 | 99 | unsigned long *target); |
6b9269ab | 100 | |
136cd345 ME |
101 | #ifdef CONFIG_DYNAMIC_FTRACE |
102 | int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs); | |
103 | #else | |
104 | static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs) | |
105 | { | |
106 | return 0; | |
107 | } | |
108 | #endif | |
109 | ||
88ced031 | 110 | #endif /* __KERNEL__ */ |
a37c8875 | 111 | #endif /* _ASM_POWERPC_MODULE_H */ |