blob: dcfcad139bccc0765e3dc6a5f17cd5566258910b [file] [log] [blame]
jdl@freescale.coma37c8872005-09-07 15:27:09 -05001#ifndef _ASM_POWERPC_MODULE_H
2#define _ASM_POWERPC_MODULE_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01003#ifdef __KERNEL__
Jon Loeliger6b9269a2005-09-01 15:51:52 -05004
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>
David Howells786d35d2012-09-28 14:31:03 +093014#include <asm-generic/module.h>
Jon Loeliger6b9269a2005-09-01 15:51:52 -050015
16
17#ifndef __powerpc64__
18/*
19 * Thanks to Paul M for explaining this.
20 *
21 * PPC can only do rel jumps += 32MB, and often the kernel and other
22 * modules are furthur away than this. So, we jump to a table of
23 * trampolines attached to the module (the Procedure Linkage Table)
24 * whenever that happens.
25 */
26
27struct ppc_plt_entry {
28 /* 16 byte jump instruction sequence (4 instructions) */
29 unsigned int jump[4];
30};
31#endif /* __powerpc64__ */
32
33
34struct mod_arch_specific {
35#ifdef __powerpc64__
36 unsigned int stubs_section; /* Index of stubs section in module */
37 unsigned int toc_section; /* What section is the TOC? */
Rusty Russell4edebbe2014-03-18 19:59:26 +103038 bool toc_fixed; /* Have we fixed up .TOC.? */
Steven Rostedtf48cb8b2008-11-14 20:47:03 -080039#ifdef CONFIG_DYNAMIC_FTRACE
40 unsigned long toc;
41 unsigned long tramp;
42#endif
43
Steven Rostedt7cc45e62008-11-15 02:39:05 -050044#else /* powerpc64 */
Jon Loeliger6b9269a2005-09-01 15:51:52 -050045 /* Indices of PLT sections within module. */
46 unsigned int core_plt_section;
47 unsigned int init_plt_section;
Steven Rostedt7cc45e62008-11-15 02:39:05 -050048#ifdef CONFIG_DYNAMIC_FTRACE
49 unsigned long tramp;
Jon Loeliger6b9269a2005-09-01 15:51:52 -050050#endif
Steven Rostedt7cc45e62008-11-15 02:39:05 -050051#endif /* powerpc64 */
Jon Loeliger6b9269a2005-09-01 15:51:52 -050052
53 /* List of BUG addresses, source line numbers and filenames */
54 struct list_head bug_list;
55 struct bug_entry *bug_table;
56 unsigned int num_bugs;
57};
58
Jon Loeliger6b9269a2005-09-01 15:51:52 -050059/*
60 * Select ELF headers.
61 * Make empty section for module_frob_arch_sections to expand.
62 */
63
64#ifdef __powerpc64__
Jon Loeliger6b9269a2005-09-01 15:51:52 -050065# ifdef MODULE
66 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
67# endif
68#else
Jon Loeliger6b9269a2005-09-01 15:51:52 -050069# ifdef MODULE
70 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
71 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
72# endif /* MODULE */
73#endif
74
Steven Rostedtf48cb8b2008-11-14 20:47:03 -080075#ifdef CONFIG_DYNAMIC_FTRACE
76# ifdef MODULE
77 asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
78# endif /* MODULE */
79#endif
80
Anton Blanchard83775b82014-04-03 20:00:43 +110081bool is_module_trampoline(u32 *insns);
Anton Blancharddd9fa162014-04-04 15:58:42 +110082int module_trampoline_target(struct module *mod, u32 *trampoline,
83 unsigned long *target);
Jon Loeliger6b9269a2005-09-01 15:51:52 -050084
85struct exception_table_entry;
86void sort_ex_table(struct exception_table_entry *start,
87 struct exception_table_entry *finish);
88
Anton Blanchard0e0ed642013-07-15 14:04:50 +100089#if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64)
Rusty Russelld4703ae2009-12-15 16:28:32 -060090#define ARCH_RELOCATES_KCRCTAB
Anton Blanchard0e0ed642013-07-15 14:04:50 +100091#define reloc_start PHYSICAL_START
Rusty Russelld4703ae2009-12-15 16:28:32 -060092#endif
Arnd Bergmann88ced032005-12-16 22:43:46 +010093#endif /* __KERNEL__ */
jdl@freescale.coma37c8872005-09-07 15:27:09 -050094#endif /* _ASM_POWERPC_MODULE_H */