1
2#ifndef _ASM_POWERPC_MODULE_H
3#define _ASM_POWERPC_MODULE_H
4#ifdef __KERNEL__
5
6
7
8
9#include <linux/list.h>
10#include <asm/bug.h>
11#include <asm-generic/module.h>
12
13
14#ifdef CONFIG_MPROFILE_KERNEL
15#define MODULE_ARCH_VERMAGIC_FTRACE "mprofile-kernel "
16#else
17#define MODULE_ARCH_VERMAGIC_FTRACE ""
18#endif
19
20#ifdef CONFIG_RELOCATABLE
21#define MODULE_ARCH_VERMAGIC_RELOCATABLE "relocatable "
22#else
23#define MODULE_ARCH_VERMAGIC_RELOCATABLE ""
24#endif
25
26#define MODULE_ARCH_VERMAGIC MODULE_ARCH_VERMAGIC_FTRACE MODULE_ARCH_VERMAGIC_RELOCATABLE
27
28#ifndef __powerpc64__
29
30
31
32
33
34
35
36
37
38struct ppc_plt_entry {
39
40 unsigned int jump[4];
41};
42#endif
43
44
45struct mod_arch_specific {
46#ifdef __powerpc64__
47 unsigned int stubs_section;
48 unsigned int toc_section;
49 bool toc_fixed;
50
51
52 unsigned long start_opd;
53 unsigned long end_opd;
54#else
55
56 unsigned int core_plt_section;
57 unsigned int init_plt_section;
58#endif
59
60#ifdef CONFIG_DYNAMIC_FTRACE
61 unsigned long tramp;
62#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
63 unsigned long tramp_regs;
64#endif
65#endif
66
67
68 struct list_head bug_list;
69 struct bug_entry *bug_table;
70 unsigned int num_bugs;
71};
72
73
74
75
76
77
78#ifdef __powerpc64__
79# ifdef MODULE
80 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
81# endif
82#else
83# ifdef MODULE
84 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
85 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
86# endif
87#endif
88
89#ifdef CONFIG_DYNAMIC_FTRACE
90# ifdef MODULE
91 asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
92# endif
93#endif
94
95int module_trampoline_target(struct module *mod, unsigned long trampoline,
96 unsigned long *target);
97
98#ifdef CONFIG_DYNAMIC_FTRACE
99int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs);
100#else
101static inline int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs)
102{
103 return 0;
104}
105#endif
106
107#endif
108#endif
109