diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 01:50:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 01:50:54 -0400 |
commit | 3b76eefe0f970c2e19f165d4a1650abc523d10bc (patch) | |
tree | 1987bc1b2b61ea70170094e3cb1204f5b0a0401e /arch/m68k/kernel | |
parent | 91d44d99992ff2587104df5760bfffbb3564b3c2 (diff) | |
parent | 8c9f08f9de38c9af3a946faf0cccd7fc46978443 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
m68k: Revive reporting of spurious interrupts
m68knommu: Move forward declaration of do_IRQ() from machdep.h to irq.h
m68k: fix some atomic operation asm address modes for ColdFire
m68k: use CPU_HAS_NO_BITFIELDS for signal functions
m68k: merge and clean up delay.h files
m68knommu: correctly use trap_init
m68knommu: merge ColdFire 5206 and 5206e platform code
m68k: merge mmu and non-mmu bitops.h
m68k: merge MMU and non MMU versions of system.h
m68k: merge MMU and non-MMU versions of asm/hardirq.h
m68k: merge the non-mmu and mmu versions of module.c
m68knommu: Fix printk() format in free_initrd_mem()
m68knommu: Make empty_zero_page "void *", like on m68k
Diffstat (limited to 'arch/m68k/kernel')
-rw-r--r-- | arch/m68k/kernel/irq.c | 10 | ||||
-rw-r--r-- | arch/m68k/kernel/module.c | 130 | ||||
-rw-r--r-- | arch/m68k/kernel/module_mm.c | 128 | ||||
-rw-r--r-- | arch/m68k/kernel/module_no.c | 92 | ||||
-rw-r--r-- | arch/m68k/kernel/traps_no.c | 4 |
5 files changed, 137 insertions, 227 deletions
diff --git a/arch/m68k/kernel/irq.c b/arch/m68k/kernel/irq.c index 544b8717d499..c73988cfa90f 100644 --- a/arch/m68k/kernel/irq.c +++ b/arch/m68k/kernel/irq.c | |||
@@ -28,3 +28,13 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs) | |||
28 | 28 | ||
29 | set_irq_regs(oldregs); | 29 | set_irq_regs(oldregs); |
30 | } | 30 | } |
31 | |||
32 | |||
33 | /* The number of spurious interrupts */ | ||
34 | atomic_t irq_err_count; | ||
35 | |||
36 | int arch_show_interrupts(struct seq_file *p, int prec) | ||
37 | { | ||
38 | seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count)); | ||
39 | return 0; | ||
40 | } | ||
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c index 7ea203ce6b1a..34849c4c6e3d 100644 --- a/arch/m68k/kernel/module.c +++ b/arch/m68k/kernel/module.c | |||
@@ -1,5 +1,129 @@ | |||
1 | #ifdef CONFIG_MMU | 1 | /* |
2 | #include "module_mm.c" | 2 | * This file is subject to the terms and conditions of the GNU General Public |
3 | * License. See the file COPYING in the main directory of this archive | ||
4 | * for more details. | ||
5 | */ | ||
6 | |||
7 | #include <linux/moduleloader.h> | ||
8 | #include <linux/elf.h> | ||
9 | #include <linux/vmalloc.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/kernel.h> | ||
13 | |||
14 | #if 0 | ||
15 | #define DEBUGP printk | ||
3 | #else | 16 | #else |
4 | #include "module_no.c" | 17 | #define DEBUGP(fmt...) |
18 | #endif | ||
19 | |||
20 | #ifdef CONFIG_MODULES | ||
21 | |||
22 | int apply_relocate(Elf32_Shdr *sechdrs, | ||
23 | const char *strtab, | ||
24 | unsigned int symindex, | ||
25 | unsigned int relsec, | ||
26 | struct module *me) | ||
27 | { | ||
28 | unsigned int i; | ||
29 | Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; | ||
30 | Elf32_Sym *sym; | ||
31 | uint32_t *location; | ||
32 | |||
33 | DEBUGP("Applying relocate section %u to %u\n", relsec, | ||
34 | sechdrs[relsec].sh_info); | ||
35 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
36 | /* This is where to make the change */ | ||
37 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
38 | + rel[i].r_offset; | ||
39 | /* This is the symbol it is referring to. Note that all | ||
40 | undefined symbols have been resolved. */ | ||
41 | sym = (Elf32_Sym *)sechdrs[symindex].sh_addr | ||
42 | + ELF32_R_SYM(rel[i].r_info); | ||
43 | |||
44 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
45 | case R_68K_32: | ||
46 | /* We add the value into the location given */ | ||
47 | *location += sym->st_value; | ||
48 | break; | ||
49 | case R_68K_PC32: | ||
50 | /* Add the value, subtract its postition */ | ||
51 | *location += sym->st_value - (uint32_t)location; | ||
52 | break; | ||
53 | default: | ||
54 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | ||
55 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
56 | return -ENOEXEC; | ||
57 | } | ||
58 | } | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | int apply_relocate_add(Elf32_Shdr *sechdrs, | ||
63 | const char *strtab, | ||
64 | unsigned int symindex, | ||
65 | unsigned int relsec, | ||
66 | struct module *me) | ||
67 | { | ||
68 | unsigned int i; | ||
69 | Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; | ||
70 | Elf32_Sym *sym; | ||
71 | uint32_t *location; | ||
72 | |||
73 | DEBUGP("Applying relocate_add section %u to %u\n", relsec, | ||
74 | sechdrs[relsec].sh_info); | ||
75 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
76 | /* This is where to make the change */ | ||
77 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
78 | + rel[i].r_offset; | ||
79 | /* This is the symbol it is referring to. Note that all | ||
80 | undefined symbols have been resolved. */ | ||
81 | sym = (Elf32_Sym *)sechdrs[symindex].sh_addr | ||
82 | + ELF32_R_SYM(rel[i].r_info); | ||
83 | |||
84 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
85 | case R_68K_32: | ||
86 | /* We add the value into the location given */ | ||
87 | *location = rel[i].r_addend + sym->st_value; | ||
88 | break; | ||
89 | case R_68K_PC32: | ||
90 | /* Add the value, subtract its postition */ | ||
91 | *location = rel[i].r_addend + sym->st_value - (uint32_t)location; | ||
92 | break; | ||
93 | default: | ||
94 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | ||
95 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
96 | return -ENOEXEC; | ||
97 | } | ||
98 | } | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | int module_finalize(const Elf_Ehdr *hdr, | ||
103 | const Elf_Shdr *sechdrs, | ||
104 | struct module *mod) | ||
105 | { | ||
106 | module_fixup(mod, mod->arch.fixup_start, mod->arch.fixup_end); | ||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | #endif /* CONFIG_MODULES */ | ||
111 | |||
112 | void module_fixup(struct module *mod, struct m68k_fixup_info *start, | ||
113 | struct m68k_fixup_info *end) | ||
114 | { | ||
115 | #ifdef CONFIG_MMU | ||
116 | struct m68k_fixup_info *fixup; | ||
117 | |||
118 | for (fixup = start; fixup < end; fixup++) { | ||
119 | switch (fixup->type) { | ||
120 | case m68k_fixup_memoffset: | ||
121 | *(u32 *)fixup->addr = m68k_memoffset; | ||
122 | break; | ||
123 | case m68k_fixup_vnode_shift: | ||
124 | *(u16 *)fixup->addr += m68k_virt_to_node_shift; | ||
125 | break; | ||
126 | } | ||
127 | } | ||
5 | #endif | 128 | #endif |
129 | } | ||
diff --git a/arch/m68k/kernel/module_mm.c b/arch/m68k/kernel/module_mm.c deleted file mode 100644 index ceafc47c96d5..000000000000 --- a/arch/m68k/kernel/module_mm.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file COPYING in the main directory of this archive | ||
4 | * for more details. | ||
5 | */ | ||
6 | |||
7 | #include <linux/moduleloader.h> | ||
8 | #include <linux/elf.h> | ||
9 | #include <linux/vmalloc.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/kernel.h> | ||
13 | |||
14 | #if 0 | ||
15 | #define DEBUGP printk | ||
16 | #else | ||
17 | #define DEBUGP(fmt...) | ||
18 | #endif | ||
19 | |||
20 | #ifdef CONFIG_MODULES | ||
21 | |||
22 | int apply_relocate(Elf32_Shdr *sechdrs, | ||
23 | const char *strtab, | ||
24 | unsigned int symindex, | ||
25 | unsigned int relsec, | ||
26 | struct module *me) | ||
27 | { | ||
28 | unsigned int i; | ||
29 | Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; | ||
30 | Elf32_Sym *sym; | ||
31 | uint32_t *location; | ||
32 | |||
33 | DEBUGP("Applying relocate section %u to %u\n", relsec, | ||
34 | sechdrs[relsec].sh_info); | ||
35 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
36 | /* This is where to make the change */ | ||
37 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
38 | + rel[i].r_offset; | ||
39 | /* This is the symbol it is referring to. Note that all | ||
40 | undefined symbols have been resolved. */ | ||
41 | sym = (Elf32_Sym *)sechdrs[symindex].sh_addr | ||
42 | + ELF32_R_SYM(rel[i].r_info); | ||
43 | |||
44 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
45 | case R_68K_32: | ||
46 | /* We add the value into the location given */ | ||
47 | *location += sym->st_value; | ||
48 | break; | ||
49 | case R_68K_PC32: | ||
50 | /* Add the value, subtract its postition */ | ||
51 | *location += sym->st_value - (uint32_t)location; | ||
52 | break; | ||
53 | default: | ||
54 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | ||
55 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
56 | return -ENOEXEC; | ||
57 | } | ||
58 | } | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | int apply_relocate_add(Elf32_Shdr *sechdrs, | ||
63 | const char *strtab, | ||
64 | unsigned int symindex, | ||
65 | unsigned int relsec, | ||
66 | struct module *me) | ||
67 | { | ||
68 | unsigned int i; | ||
69 | Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; | ||
70 | Elf32_Sym *sym; | ||
71 | uint32_t *location; | ||
72 | |||
73 | DEBUGP("Applying relocate_add section %u to %u\n", relsec, | ||
74 | sechdrs[relsec].sh_info); | ||
75 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
76 | /* This is where to make the change */ | ||
77 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
78 | + rel[i].r_offset; | ||
79 | /* This is the symbol it is referring to. Note that all | ||
80 | undefined symbols have been resolved. */ | ||
81 | sym = (Elf32_Sym *)sechdrs[symindex].sh_addr | ||
82 | + ELF32_R_SYM(rel[i].r_info); | ||
83 | |||
84 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
85 | case R_68K_32: | ||
86 | /* We add the value into the location given */ | ||
87 | *location = rel[i].r_addend + sym->st_value; | ||
88 | break; | ||
89 | case R_68K_PC32: | ||
90 | /* Add the value, subtract its postition */ | ||
91 | *location = rel[i].r_addend + sym->st_value - (uint32_t)location; | ||
92 | break; | ||
93 | default: | ||
94 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | ||
95 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
96 | return -ENOEXEC; | ||
97 | } | ||
98 | } | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | int module_finalize(const Elf_Ehdr *hdr, | ||
103 | const Elf_Shdr *sechdrs, | ||
104 | struct module *mod) | ||
105 | { | ||
106 | module_fixup(mod, mod->arch.fixup_start, mod->arch.fixup_end); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | #endif /* CONFIG_MODULES */ | ||
112 | |||
113 | void module_fixup(struct module *mod, struct m68k_fixup_info *start, | ||
114 | struct m68k_fixup_info *end) | ||
115 | { | ||
116 | struct m68k_fixup_info *fixup; | ||
117 | |||
118 | for (fixup = start; fixup < end; fixup++) { | ||
119 | switch (fixup->type) { | ||
120 | case m68k_fixup_memoffset: | ||
121 | *(u32 *)fixup->addr = m68k_memoffset; | ||
122 | break; | ||
123 | case m68k_fixup_vnode_shift: | ||
124 | *(u16 *)fixup->addr += m68k_virt_to_node_shift; | ||
125 | break; | ||
126 | } | ||
127 | } | ||
128 | } | ||
diff --git a/arch/m68k/kernel/module_no.c b/arch/m68k/kernel/module_no.c deleted file mode 100644 index 5a097c6063fa..000000000000 --- a/arch/m68k/kernel/module_no.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | #include <linux/moduleloader.h> | ||
2 | #include <linux/elf.h> | ||
3 | #include <linux/vmalloc.h> | ||
4 | #include <linux/fs.h> | ||
5 | #include <linux/string.h> | ||
6 | #include <linux/kernel.h> | ||
7 | |||
8 | #if 0 | ||
9 | #define DEBUGP printk | ||
10 | #else | ||
11 | #define DEBUGP(fmt...) | ||
12 | #endif | ||
13 | |||
14 | int apply_relocate(Elf32_Shdr *sechdrs, | ||
15 | const char *strtab, | ||
16 | unsigned int symindex, | ||
17 | unsigned int relsec, | ||
18 | struct module *me) | ||
19 | { | ||
20 | unsigned int i; | ||
21 | Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; | ||
22 | Elf32_Sym *sym; | ||
23 | uint32_t *location; | ||
24 | |||
25 | DEBUGP("Applying relocate section %u to %u\n", relsec, | ||
26 | sechdrs[relsec].sh_info); | ||
27 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
28 | /* This is where to make the change */ | ||
29 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
30 | + rel[i].r_offset; | ||
31 | /* This is the symbol it is referring to. Note that all | ||
32 | undefined symbols have been resolved. */ | ||
33 | sym = (Elf32_Sym *)sechdrs[symindex].sh_addr | ||
34 | + ELF32_R_SYM(rel[i].r_info); | ||
35 | |||
36 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
37 | case R_68K_32: | ||
38 | /* We add the value into the location given */ | ||
39 | *location += sym->st_value; | ||
40 | break; | ||
41 | case R_68K_PC32: | ||
42 | /* Add the value, subtract its postition */ | ||
43 | *location += sym->st_value - (uint32_t)location; | ||
44 | break; | ||
45 | default: | ||
46 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | ||
47 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
48 | return -ENOEXEC; | ||
49 | } | ||
50 | } | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | int apply_relocate_add(Elf32_Shdr *sechdrs, | ||
55 | const char *strtab, | ||
56 | unsigned int symindex, | ||
57 | unsigned int relsec, | ||
58 | struct module *me) | ||
59 | { | ||
60 | unsigned int i; | ||
61 | Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; | ||
62 | Elf32_Sym *sym; | ||
63 | uint32_t *location; | ||
64 | |||
65 | DEBUGP("Applying relocate_add section %u to %u\n", relsec, | ||
66 | sechdrs[relsec].sh_info); | ||
67 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
68 | /* This is where to make the change */ | ||
69 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
70 | + rel[i].r_offset; | ||
71 | /* This is the symbol it is referring to. Note that all | ||
72 | undefined symbols have been resolved. */ | ||
73 | sym = (Elf32_Sym *)sechdrs[symindex].sh_addr | ||
74 | + ELF32_R_SYM(rel[i].r_info); | ||
75 | |||
76 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
77 | case R_68K_32: | ||
78 | /* We add the value into the location given */ | ||
79 | *location = rel[i].r_addend + sym->st_value; | ||
80 | break; | ||
81 | case R_68K_PC32: | ||
82 | /* Add the value, subtract its postition */ | ||
83 | *location = rel[i].r_addend + sym->st_value - (uint32_t)location; | ||
84 | break; | ||
85 | default: | ||
86 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | ||
87 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
88 | return -ENOEXEC; | ||
89 | } | ||
90 | } | ||
91 | return 0; | ||
92 | } | ||
diff --git a/arch/m68k/kernel/traps_no.c b/arch/m68k/kernel/traps_no.c index a768008dfd06..e67b8c806959 100644 --- a/arch/m68k/kernel/traps_no.c +++ b/arch/m68k/kernel/traps_no.c | |||
@@ -60,10 +60,6 @@ static char const * const vec_names[] = { | |||
60 | "MMU CONFIGURATION ERROR" | 60 | "MMU CONFIGURATION ERROR" |
61 | }; | 61 | }; |
62 | 62 | ||
63 | void __init trap_init(void) | ||
64 | { | ||
65 | } | ||
66 | |||
67 | void die_if_kernel(char *str, struct pt_regs *fp, int nr) | 63 | void die_if_kernel(char *str, struct pt_regs *fp, int nr) |
68 | { | 64 | { |
69 | if (!(fp->sr & PS_S)) | 65 | if (!(fp->sr & PS_S)) |