blob: 4438f4fd65246c108a0a6f58d235dcc5c49dab9c [file] [log] [blame]
Jon Loeliger6b9269a2005-09-01 15:51:52 -05001#ifndef _POWERPC_MODULE_H
2#define _POWERPC_MODULE_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <linux/list.h>
12#include <asm/bug.h>
13
14
15#ifndef __powerpc64__
16/*
17 * Thanks to Paul M for explaining this.
18 *
19 * PPC can only do rel jumps += 32MB, and often the kernel and other
20 * modules are furthur away than this. So, we jump to a table of
21 * trampolines attached to the module (the Procedure Linkage Table)
22 * whenever that happens.
23 */
24
25struct ppc_plt_entry {
26 /* 16 byte jump instruction sequence (4 instructions) */
27 unsigned int jump[4];
28};
29#endif /* __powerpc64__ */
30
31
32struct mod_arch_specific {
33#ifdef __powerpc64__
34 unsigned int stubs_section; /* Index of stubs section in module */
35 unsigned int toc_section; /* What section is the TOC? */
36#else
37 /* Indices of PLT sections within module. */
38 unsigned int core_plt_section;
39 unsigned int init_plt_section;
40#endif
41
42 /* List of BUG addresses, source line numbers and filenames */
43 struct list_head bug_list;
44 struct bug_entry *bug_table;
45 unsigned int num_bugs;
46};
47
48extern struct bug_entry *module_find_bug(unsigned long bugaddr);
49
50/*
51 * Select ELF headers.
52 * Make empty section for module_frob_arch_sections to expand.
53 */
54
55#ifdef __powerpc64__
56# define Elf_Shdr Elf64_Shdr
57# define Elf_Sym Elf64_Sym
58# define Elf_Ehdr Elf64_Ehdr
59# ifdef MODULE
60 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
61# endif
62#else
63# define Elf_Shdr Elf32_Shdr
64# define Elf_Sym Elf32_Sym
65# define Elf_Ehdr Elf32_Ehdr
66# ifdef MODULE
67 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
68 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
69# endif /* MODULE */
70#endif
71
72
73struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish);
76
77#endif /* _POWERPC_MODULE_H */