diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-11-11 03:24:50 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:44 -0500 |
commit | 83ce3ac1d13f9a3ae83485a5e5a1cb85faf865ff (patch) | |
tree | 0c96e81a5a8019451b9f3036fc691a50d9ae8c78 /arch/sh/mm | |
parent | 8a7bcf0dd0d49fe8b0071adef0dfe8610abdffaa (diff) |
sh: Split out extable.c _32 and _64 variants.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/Makefile | 40 | ||||
-rw-r--r-- | arch/sh/mm/Makefile_32 | 37 | ||||
-rw-r--r-- | arch/sh/mm/Makefile_64 | 11 | ||||
-rw-r--r-- | arch/sh/mm/extable_32.c (renamed from arch/sh/mm/extable.c) | 0 | ||||
-rw-r--r-- | arch/sh/mm/extable_64.c | 80 |
5 files changed, 132 insertions, 36 deletions
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile index d35caccd0aaa..9f4bc3d90b1e 100644 --- a/arch/sh/mm/Makefile +++ b/arch/sh/mm/Makefile | |||
@@ -1,37 +1,5 @@ | |||
1 | # | 1 | ifeq ($(CONFIG_SUPERH32),y) |
2 | # Makefile for the Linux SuperH-specific parts of the memory manager. | 2 | include ${srctree}/arch/sh/mm/Makefile_32 |
3 | # | 3 | else |
4 | 4 | include ${srctree}/arch/sh/mm/Makefile_64 | |
5 | obj-y := init.o extable.o consistent.o | ||
6 | |||
7 | ifndef CONFIG_CACHE_OFF | ||
8 | obj-$(CONFIG_CPU_SH2) += cache-sh2.o | ||
9 | obj-$(CONFIG_CPU_SH3) += cache-sh3.o | ||
10 | obj-$(CONFIG_CPU_SH4) += cache-sh4.o | ||
11 | obj-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o | ||
12 | endif | 5 | endif |
13 | |||
14 | mmu-y := tlb-nommu.o pg-nommu.o | ||
15 | mmu-$(CONFIG_MMU) := fault.o clear_page.o copy_page.o tlb-flush.o \ | ||
16 | ioremap.o | ||
17 | |||
18 | obj-y += $(mmu-y) | ||
19 | |||
20 | ifdef CONFIG_DEBUG_FS | ||
21 | obj-$(CONFIG_CPU_SH4) += cache-debugfs.o | ||
22 | endif | ||
23 | |||
24 | ifdef CONFIG_MMU | ||
25 | obj-$(CONFIG_CPU_SH3) += tlb-sh3.o | ||
26 | obj-$(CONFIG_CPU_SH4) += tlb-sh4.o | ||
27 | ifndef CONFIG_CACHE_OFF | ||
28 | obj-$(CONFIG_CPU_SH4) += pg-sh4.o | ||
29 | obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o | ||
30 | endif | ||
31 | endif | ||
32 | |||
33 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | ||
34 | obj-$(CONFIG_PMB) += pmb.o | ||
35 | obj-$(CONFIG_NUMA) += numa.o | ||
36 | |||
37 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/sh/mm/Makefile_32 b/arch/sh/mm/Makefile_32 new file mode 100644 index 000000000000..cc68b265c025 --- /dev/null +++ b/arch/sh/mm/Makefile_32 | |||
@@ -0,0 +1,37 @@ | |||
1 | # | ||
2 | # Makefile for the Linux SuperH-specific parts of the memory manager. | ||
3 | # | ||
4 | |||
5 | obj-y := init.o extable_32.o consistent.o | ||
6 | |||
7 | ifndef CONFIG_CACHE_OFF | ||
8 | obj-$(CONFIG_CPU_SH2) += cache-sh2.o | ||
9 | obj-$(CONFIG_CPU_SH3) += cache-sh3.o | ||
10 | obj-$(CONFIG_CPU_SH4) += cache-sh4.o | ||
11 | obj-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o | ||
12 | endif | ||
13 | |||
14 | mmu-y := tlb-nommu.o pg-nommu.o | ||
15 | mmu-$(CONFIG_MMU) := fault.o clear_page.o copy_page.o tlb-flush.o \ | ||
16 | ioremap.o | ||
17 | |||
18 | obj-y += $(mmu-y) | ||
19 | |||
20 | ifdef CONFIG_DEBUG_FS | ||
21 | obj-$(CONFIG_CPU_SH4) += cache-debugfs.o | ||
22 | endif | ||
23 | |||
24 | ifdef CONFIG_MMU | ||
25 | obj-$(CONFIG_CPU_SH3) += tlb-sh3.o | ||
26 | obj-$(CONFIG_CPU_SH4) += tlb-sh4.o | ||
27 | ifndef CONFIG_CACHE_OFF | ||
28 | obj-$(CONFIG_CPU_SH4) += pg-sh4.o | ||
29 | obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o | ||
30 | endif | ||
31 | endif | ||
32 | |||
33 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | ||
34 | obj-$(CONFIG_PMB) += pmb.o | ||
35 | obj-$(CONFIG_NUMA) += numa.o | ||
36 | |||
37 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/sh/mm/Makefile_64 b/arch/sh/mm/Makefile_64 new file mode 100644 index 000000000000..de964a1500f4 --- /dev/null +++ b/arch/sh/mm/Makefile_64 | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Makefile for the Linux SuperH-specific parts of the memory manager. | ||
3 | # | ||
4 | |||
5 | obj-y := init.o extable_64.o consistent.o | ||
6 | |||
7 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | ||
8 | obj-$(CONFIG_PMB) += pmb.o | ||
9 | obj-$(CONFIG_NUMA) += numa.o | ||
10 | |||
11 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/sh/mm/extable.c b/arch/sh/mm/extable_32.c index c1cf4463d09d..c1cf4463d09d 100644 --- a/arch/sh/mm/extable.c +++ b/arch/sh/mm/extable_32.c | |||
diff --git a/arch/sh/mm/extable_64.c b/arch/sh/mm/extable_64.c new file mode 100644 index 000000000000..a2e6e0563772 --- /dev/null +++ b/arch/sh/mm/extable_64.c | |||
@@ -0,0 +1,80 @@ | |||
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 | * arch/sh64/mm/extable.c | ||
7 | * | ||
8 | * Copyright (C) 2003 Richard Curnow | ||
9 | * Copyright (C) 2003, 2004 Paul Mundt | ||
10 | * | ||
11 | * Cloned from the 2.5 SH version.. | ||
12 | */ | ||
13 | #include <linux/rwsem.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <asm/uaccess.h> | ||
16 | |||
17 | extern unsigned long copy_user_memcpy, copy_user_memcpy_end; | ||
18 | extern void __copy_user_fixup(void); | ||
19 | |||
20 | static const struct exception_table_entry __copy_user_fixup_ex = { | ||
21 | .fixup = (unsigned long)&__copy_user_fixup, | ||
22 | }; | ||
23 | |||
24 | /* Some functions that may trap due to a bad user-mode address have too many loads | ||
25 | and stores in them to make it at all practical to label each one and put them all in | ||
26 | the main exception table. | ||
27 | |||
28 | In particular, the fast memcpy routine is like this. It's fix-up is just to fall back | ||
29 | to a slow byte-at-a-time copy, which is handled the conventional way. So it's functionally | ||
30 | OK to just handle any trap occurring in the fast memcpy with that fixup. */ | ||
31 | static const struct exception_table_entry *check_exception_ranges(unsigned long addr) | ||
32 | { | ||
33 | if ((addr >= (unsigned long)©_user_memcpy) && | ||
34 | (addr <= (unsigned long)©_user_memcpy_end)) | ||
35 | return &__copy_user_fixup_ex; | ||
36 | |||
37 | return NULL; | ||
38 | } | ||
39 | |||
40 | /* Simple binary search */ | ||
41 | const struct exception_table_entry * | ||
42 | search_extable(const struct exception_table_entry *first, | ||
43 | const struct exception_table_entry *last, | ||
44 | unsigned long value) | ||
45 | { | ||
46 | const struct exception_table_entry *mid; | ||
47 | |||
48 | mid = check_exception_ranges(value); | ||
49 | if (mid) | ||
50 | return mid; | ||
51 | |||
52 | while (first <= last) { | ||
53 | long diff; | ||
54 | |||
55 | mid = (last - first) / 2 + first; | ||
56 | diff = mid->insn - value; | ||
57 | if (diff == 0) | ||
58 | return mid; | ||
59 | else if (diff < 0) | ||
60 | first = mid+1; | ||
61 | else | ||
62 | last = mid-1; | ||
63 | } | ||
64 | |||
65 | return NULL; | ||
66 | } | ||
67 | |||
68 | int fixup_exception(struct pt_regs *regs) | ||
69 | { | ||
70 | const struct exception_table_entry *fixup; | ||
71 | |||
72 | fixup = search_exception_tables(regs->pc); | ||
73 | if (fixup) { | ||
74 | regs->pc = fixup->fixup; | ||
75 | return 1; | ||
76 | } | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||