blob: 584fabfb4f08aa9eccfb688727e109da3d021530 [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>
14
15
16#ifndef __powerpc64__
17/*
18 * Thanks to Paul M for explaining this.
19 *
20 * PPC can only do rel jumps += 32MB, and often the kernel and other
21 * modules are furthur away than this. So, we jump to a table of
22 * trampolines attached to the module (the Procedure Linkage Table)
23 * whenever that happens.
24 */
25
26struct ppc_plt_entry {
27 /* 16 byte jump instruction sequence (4 instructions) */
28 unsigned int jump[4];
29};
30#endif /* __powerpc64__ */
31
32
33struct mod_arch_specific {
34#ifdef __powerpc64__
35 unsigned int stubs_section; /* Index of stubs section in module */
36 unsigned int toc_section; /* What section is the TOC? */
37#else
38 /* Indices of PLT sections within module. */
39 unsigned int core_plt_section;
40 unsigned int init_plt_section;
41#endif
42
43 /* List of BUG addresses, source line numbers and filenames */
44 struct list_head bug_list;
45 struct bug_entry *bug_table;
46 unsigned int num_bugs;
47};
48
49extern struct bug_entry *module_find_bug(unsigned long bugaddr);
50
51/*
52 * Select ELF headers.
53 * Make empty section for module_frob_arch_sections to expand.
54 */
55
56#ifdef __powerpc64__
57# define Elf_Shdr Elf64_Shdr
58# define Elf_Sym Elf64_Sym
59# define Elf_Ehdr Elf64_Ehdr
60# ifdef MODULE
61 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
62# endif
63#else
64# define Elf_Shdr Elf32_Shdr
65# define Elf_Sym Elf32_Sym
66# define Elf_Ehdr Elf32_Ehdr
67# ifdef MODULE
68 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
69 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
70# endif /* MODULE */
71#endif
72
73
74struct exception_table_entry;
75void sort_ex_table(struct exception_table_entry *start,
76 struct exception_table_entry *finish);
77
Arnd Bergmann88ced032005-12-16 22:43:46 +010078#endif /* __KERNEL__ */
jdl@freescale.coma37c8872005-09-07 15:27:09 -050079#endif /* _ASM_POWERPC_MODULE_H */