jdl@freescale.com | a37c887 | 2005-09-07 15:27:09 -0500 | [diff] [blame] | 1 | #ifndef _ASM_POWERPC_MODULE_H |
| 2 | #define _ASM_POWERPC_MODULE_H |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 3 | #ifdef __KERNEL__ |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 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> |
David Howells | 786d35d | 2012-09-28 14:31:03 +0930 | [diff] [blame] | 14 | #include <asm-generic/module.h> |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 15 | |
| 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 | |
| 27 | struct ppc_plt_entry { |
| 28 | /* 16 byte jump instruction sequence (4 instructions) */ |
| 29 | unsigned int jump[4]; |
| 30 | }; |
| 31 | #endif /* __powerpc64__ */ |
| 32 | |
| 33 | |
| 34 | struct 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? */ |
Steven Rostedt | f48cb8b | 2008-11-14 20:47:03 -0800 | [diff] [blame] | 38 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 39 | unsigned long toc; |
| 40 | unsigned long tramp; |
| 41 | #endif |
| 42 | |
Steven Rostedt | 7cc45e6 | 2008-11-15 02:39:05 -0500 | [diff] [blame] | 43 | #else /* powerpc64 */ |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 44 | /* Indices of PLT sections within module. */ |
| 45 | unsigned int core_plt_section; |
| 46 | unsigned int init_plt_section; |
Steven Rostedt | 7cc45e6 | 2008-11-15 02:39:05 -0500 | [diff] [blame] | 47 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 48 | unsigned long tramp; |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 49 | #endif |
Steven Rostedt | 7cc45e6 | 2008-11-15 02:39:05 -0500 | [diff] [blame] | 50 | #endif /* powerpc64 */ |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 51 | |
| 52 | /* List of BUG addresses, source line numbers and filenames */ |
| 53 | struct list_head bug_list; |
| 54 | struct bug_entry *bug_table; |
| 55 | unsigned int num_bugs; |
| 56 | }; |
| 57 | |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 58 | /* |
| 59 | * Select ELF headers. |
| 60 | * Make empty section for module_frob_arch_sections to expand. |
| 61 | */ |
| 62 | |
| 63 | #ifdef __powerpc64__ |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 64 | # ifdef MODULE |
| 65 | asm(".section .stubs,\"ax\",@nobits; .align 3; .previous"); |
| 66 | # endif |
| 67 | #else |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 68 | # ifdef MODULE |
| 69 | asm(".section .plt,\"ax\",@nobits; .align 3; .previous"); |
| 70 | asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous"); |
| 71 | # endif /* MODULE */ |
| 72 | #endif |
| 73 | |
Steven Rostedt | f48cb8b | 2008-11-14 20:47:03 -0800 | [diff] [blame] | 74 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 75 | # ifdef MODULE |
| 76 | asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous"); |
| 77 | # endif /* MODULE */ |
| 78 | #endif |
| 79 | |
Jon Loeliger | 6b9269a | 2005-09-01 15:51:52 -0500 | [diff] [blame] | 80 | |
| 81 | struct exception_table_entry; |
| 82 | void sort_ex_table(struct exception_table_entry *start, |
| 83 | struct exception_table_entry *finish); |
| 84 | |
Anton Blanchard | 0e0ed64 | 2013-07-15 14:04:50 +1000 | [diff] [blame] | 85 | #if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64) |
Rusty Russell | d4703ae | 2009-12-15 16:28:32 -0600 | [diff] [blame] | 86 | #define ARCH_RELOCATES_KCRCTAB |
Anton Blanchard | 0e0ed64 | 2013-07-15 14:04:50 +1000 | [diff] [blame] | 87 | #define reloc_start PHYSICAL_START |
Rusty Russell | d4703ae | 2009-12-15 16:28:32 -0600 | [diff] [blame] | 88 | #endif |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 89 | #endif /* __KERNEL__ */ |
jdl@freescale.com | a37c887 | 2005-09-07 15:27:09 -0500 | [diff] [blame] | 90 | #endif /* _ASM_POWERPC_MODULE_H */ |