diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-06 20:59:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-06 20:59:33 -0500 |
commit | c77417132c12af338a7d37956809b2b98d20413c (patch) | |
tree | 02cb0ef1f8dfa1af8ce0965883dd449adf33eb2c /arch/m68k/kernel | |
parent | e4e88f31bcb5f05f24b9ae518d4ecb44e1a7774d (diff) | |
parent | 1f7034b9616e6f14dc7b6aa280210421428f31af (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu: (56 commits)
m68k: allow ColdFire 547x and 548x CPUs to be built with MMU enabled
m68k/Kconfig: Separate classic m68k and coldfire early
m68k: add ColdFire with MMU enabled support to the m68k mem init code
m68k: do not use m68k startup or interrupt code for ColdFire CPUs
m68k: add ColdFire FPU support for the V4e ColdFire CPUs
m68k: adjustments to stack frame for ColdFire with MMU enabled
m68k: use non-MMU linker script for ColdFire MMU builds
m68k: ColdFire with MMU enabled uses same clocking code as non-MMU
m68k: add code to setup a ColdFire 54xx platform when MMU enabled
m68k: use non-MMU entry.S code when compiling for ColdFire CPU
m68k: create ColdFire MMU pgalloc code
m68k: compile appropriate mm arch files for ColdFire MMU support
m68k: ColdFire V4e MMU paging init code and miss handler
m68k: use ColdFire MMU read/write bit flags when ioremapping
m68k: modify cache push and clear code for ColdFire with MMU enable
m68k: use tracehook_report_syscall_entry/exit for ColdFire MMU ptrace path
m68k: ColdFire V4e MMU context support code
m68k: MMU enabled ColdFire needs 8k ELF alignment
m68k: set ColdFire MMU page size
m68k: define PAGE_OFFSET_RAW for ColdFire CPU with MMU enabled
...
Diffstat (limited to 'arch/m68k/kernel')
-rw-r--r-- | arch/m68k/kernel/Makefile | 21 | ||||
-rw-r--r-- | arch/m68k/kernel/asm-offsets.c | 3 | ||||
-rw-r--r-- | arch/m68k/kernel/entry.S | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/entry_mm.S | 31 | ||||
-rw-r--r-- | arch/m68k/kernel/entry_no.S | 9 | ||||
-rw-r--r-- | arch/m68k/kernel/init_task.c | 3 | ||||
-rw-r--r-- | arch/m68k/kernel/m68k_ksyms.c | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/process_mm.c | 75 | ||||
-rw-r--r-- | arch/m68k/kernel/ptrace_mm.c | 18 | ||||
-rw-r--r-- | arch/m68k/kernel/setup_mm.c | 22 | ||||
-rw-r--r-- | arch/m68k/kernel/setup_no.c | 1 | ||||
-rw-r--r-- | arch/m68k/kernel/signal_mm.c | 204 | ||||
-rw-r--r-- | arch/m68k/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/time_no.c | 3 | ||||
-rw-r--r-- | arch/m68k/kernel/traps.c | 104 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux-nommu.lds (renamed from arch/m68k/kernel/vmlinux.lds_no.S) | 8 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux-std.lds | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux-sun3.lds | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux.lds.S | 15 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux.lds_mm.S | 10 |
20 files changed, 407 insertions, 130 deletions
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index c5696193281a..40d29a788b05 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile | |||
@@ -2,19 +2,24 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-$(CONFIG_MMU) := head.o | 5 | extra-$(CONFIG_AMIGA) := head.o |
6 | extra-$(CONFIG_ATARI) := head.o | ||
7 | extra-$(CONFIG_MAC) := head.o | ||
8 | extra-$(CONFIG_APOLLO) := head.o | ||
9 | extra-$(CONFIG_VME) := head.o | ||
10 | extra-$(CONFIG_HP300) := head.o | ||
11 | extra-$(CONFIG_Q40) := head.o | ||
12 | extra-$(CONFIG_SUN3X) := head.o | ||
6 | extra-$(CONFIG_SUN3) := sun3-head.o | 13 | extra-$(CONFIG_SUN3) := sun3-head.o |
7 | extra-y += vmlinux.lds | 14 | extra-y += vmlinux.lds |
8 | 15 | ||
9 | obj-y := entry.o irq.o m68k_ksyms.o module.o process.o ptrace.o setup.o \ | 16 | obj-y := entry.o init_task.o irq.o m68k_ksyms.o module.o process.o ptrace.o |
10 | signal.o sys_m68k.o syscalltable.o time.o traps.o | 17 | obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o |
11 | 18 | ||
12 | obj-$(CONFIG_MMU) += ints.o vectors.o | 19 | obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o |
20 | obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o | ||
13 | 21 | ||
14 | ifndef CONFIG_MMU_SUN3 | 22 | ifndef CONFIG_MMU_SUN3 |
15 | obj-y += dma.o | 23 | obj-y += dma.o |
16 | endif | ||
17 | ifndef CONFIG_MMU | ||
18 | obj-y += init_task.o | ||
19 | endif | 24 | endif |
20 | 25 | ||
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c index 983fed9d469b..a972b00cd77d 100644 --- a/arch/m68k/kernel/asm-offsets.c +++ b/arch/m68k/kernel/asm-offsets.c | |||
@@ -24,8 +24,7 @@ int main(void) | |||
24 | /* offsets into the task struct */ | 24 | /* offsets into the task struct */ |
25 | DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); | 25 | DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); |
26 | DEFINE(TASK_MM, offsetof(struct task_struct, mm)); | 26 | DEFINE(TASK_MM, offsetof(struct task_struct, mm)); |
27 | DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info)); | 27 | DEFINE(TASK_STACK, offsetof(struct task_struct, stack)); |
28 | DEFINE(TASK_TINFO, offsetof(struct task_struct, thread.info)); | ||
29 | 28 | ||
30 | /* offsets into the thread struct */ | 29 | /* offsets into the thread struct */ |
31 | DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); | 30 | DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); |
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 081cf96f243b..b8daf64e347d 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S | |||
@@ -1,4 +1,4 @@ | |||
1 | #ifdef CONFIG_MMU | 1 | #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) |
2 | #include "entry_mm.S" | 2 | #include "entry_mm.S" |
3 | #else | 3 | #else |
4 | #include "entry_no.S" | 4 | #include "entry_no.S" |
diff --git a/arch/m68k/kernel/entry_mm.S b/arch/m68k/kernel/entry_mm.S index c713f514843d..675a854966a6 100644 --- a/arch/m68k/kernel/entry_mm.S +++ b/arch/m68k/kernel/entry_mm.S | |||
@@ -99,7 +99,8 @@ do_trace_exit: | |||
99 | jra .Lret_from_exception | 99 | jra .Lret_from_exception |
100 | 100 | ||
101 | ENTRY(ret_from_signal) | 101 | ENTRY(ret_from_signal) |
102 | tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) | 102 | movel %curptr@(TASK_STACK),%a1 |
103 | tstb %a1@(TINFO_FLAGS+2) | ||
103 | jge 1f | 104 | jge 1f |
104 | jbsr syscall_trace | 105 | jbsr syscall_trace |
105 | 1: RESTORE_SWITCH_STACK | 106 | 1: RESTORE_SWITCH_STACK |
@@ -120,11 +121,13 @@ ENTRY(system_call) | |||
120 | SAVE_ALL_SYS | 121 | SAVE_ALL_SYS |
121 | 122 | ||
122 | GET_CURRENT(%d1) | 123 | GET_CURRENT(%d1) |
124 | movel %d1,%a1 | ||
125 | |||
123 | | save top of frame | 126 | | save top of frame |
124 | movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) | 127 | movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) |
125 | 128 | ||
126 | | syscall trace? | 129 | | syscall trace? |
127 | tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) | 130 | tstb %a1@(TINFO_FLAGS+2) |
128 | jmi do_trace_entry | 131 | jmi do_trace_entry |
129 | cmpl #NR_syscalls,%d0 | 132 | cmpl #NR_syscalls,%d0 |
130 | jcc badsys | 133 | jcc badsys |
@@ -133,7 +136,8 @@ syscall: | |||
133 | movel %d0,%sp@(PT_OFF_D0) | save the return value | 136 | movel %d0,%sp@(PT_OFF_D0) | save the return value |
134 | ret_from_syscall: | 137 | ret_from_syscall: |
135 | |oriw #0x0700,%sr | 138 | |oriw #0x0700,%sr |
136 | movew %curptr@(TASK_INFO+TINFO_FLAGS+2),%d0 | 139 | movel %curptr@(TASK_STACK),%a1 |
140 | movew %a1@(TINFO_FLAGS+2),%d0 | ||
137 | jne syscall_exit_work | 141 | jne syscall_exit_work |
138 | 1: RESTORE_ALL | 142 | 1: RESTORE_ALL |
139 | 143 | ||
@@ -159,7 +163,8 @@ ENTRY(ret_from_exception) | |||
159 | andw #ALLOWINT,%sr | 163 | andw #ALLOWINT,%sr |
160 | 164 | ||
161 | resume_userspace: | 165 | resume_userspace: |
162 | moveb %curptr@(TASK_INFO+TINFO_FLAGS+3),%d0 | 166 | movel %curptr@(TASK_STACK),%a1 |
167 | moveb %a1@(TINFO_FLAGS+3),%d0 | ||
163 | jne exit_work | 168 | jne exit_work |
164 | 1: RESTORE_ALL | 169 | 1: RESTORE_ALL |
165 | 170 | ||
@@ -199,7 +204,8 @@ do_delayed_trace: | |||
199 | ENTRY(auto_inthandler) | 204 | ENTRY(auto_inthandler) |
200 | SAVE_ALL_INT | 205 | SAVE_ALL_INT |
201 | GET_CURRENT(%d0) | 206 | GET_CURRENT(%d0) |
202 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 207 | movel %d0,%a1 |
208 | addqb #1,%a1@(TINFO_PREEMPT+1) | ||
203 | | put exception # in d0 | 209 | | put exception # in d0 |
204 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 | 210 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 |
205 | subw #VEC_SPUR,%d0 | 211 | subw #VEC_SPUR,%d0 |
@@ -211,7 +217,8 @@ auto_irqhandler_fixup = . + 2 | |||
211 | addql #8,%sp | pop parameters off stack | 217 | addql #8,%sp | pop parameters off stack |
212 | 218 | ||
213 | ret_from_interrupt: | 219 | ret_from_interrupt: |
214 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 220 | movel %curptr@(TASK_STACK),%a1 |
221 | subqb #1,%a1@(TINFO_PREEMPT+1) | ||
215 | jeq ret_from_last_interrupt | 222 | jeq ret_from_last_interrupt |
216 | 2: RESTORE_ALL | 223 | 2: RESTORE_ALL |
217 | 224 | ||
@@ -232,7 +239,8 @@ ret_from_last_interrupt: | |||
232 | ENTRY(user_inthandler) | 239 | ENTRY(user_inthandler) |
233 | SAVE_ALL_INT | 240 | SAVE_ALL_INT |
234 | GET_CURRENT(%d0) | 241 | GET_CURRENT(%d0) |
235 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 242 | movel %d0,%a1 |
243 | addqb #1,%a1@(TINFO_PREEMPT+1) | ||
236 | | put exception # in d0 | 244 | | put exception # in d0 |
237 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 | 245 | bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 |
238 | user_irqvec_fixup = . + 2 | 246 | user_irqvec_fixup = . + 2 |
@@ -243,7 +251,8 @@ user_irqvec_fixup = . + 2 | |||
243 | jsr do_IRQ | process the IRQ | 251 | jsr do_IRQ | process the IRQ |
244 | addql #8,%sp | pop parameters off stack | 252 | addql #8,%sp | pop parameters off stack |
245 | 253 | ||
246 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 254 | movel %curptr@(TASK_STACK),%a1 |
255 | subqb #1,%a1@(TINFO_PREEMPT+1) | ||
247 | jeq ret_from_last_interrupt | 256 | jeq ret_from_last_interrupt |
248 | RESTORE_ALL | 257 | RESTORE_ALL |
249 | 258 | ||
@@ -252,13 +261,15 @@ user_irqvec_fixup = . + 2 | |||
252 | ENTRY(bad_inthandler) | 261 | ENTRY(bad_inthandler) |
253 | SAVE_ALL_INT | 262 | SAVE_ALL_INT |
254 | GET_CURRENT(%d0) | 263 | GET_CURRENT(%d0) |
255 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 264 | movel %d0,%a1 |
265 | addqb #1,%a1@(TINFO_PREEMPT+1) | ||
256 | 266 | ||
257 | movel %sp,%sp@- | 267 | movel %sp,%sp@- |
258 | jsr handle_badint | 268 | jsr handle_badint |
259 | addql #4,%sp | 269 | addql #4,%sp |
260 | 270 | ||
261 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | 271 | movel %curptr@(TASK_STACK),%a1 |
272 | subqb #1,%a1@(TINFO_PREEMPT+1) | ||
262 | jeq ret_from_last_interrupt | 273 | jeq ret_from_last_interrupt |
263 | RESTORE_ALL | 274 | RESTORE_ALL |
264 | 275 | ||
diff --git a/arch/m68k/kernel/entry_no.S b/arch/m68k/kernel/entry_no.S index 1b4289061a64..d80cba45589f 100644 --- a/arch/m68k/kernel/entry_no.S +++ b/arch/m68k/kernel/entry_no.S | |||
@@ -44,8 +44,7 @@ | |||
44 | 44 | ||
45 | ENTRY(buserr) | 45 | ENTRY(buserr) |
46 | SAVE_ALL_INT | 46 | SAVE_ALL_INT |
47 | moveq #-1,%d0 | 47 | GET_CURRENT(%d0) |
48 | movel %d0,%sp@(PT_OFF_ORIG_D0) | ||
49 | movel %sp,%sp@- /* stack frame pointer argument */ | 48 | movel %sp,%sp@- /* stack frame pointer argument */ |
50 | jsr buserr_c | 49 | jsr buserr_c |
51 | addql #4,%sp | 50 | addql #4,%sp |
@@ -53,8 +52,7 @@ ENTRY(buserr) | |||
53 | 52 | ||
54 | ENTRY(trap) | 53 | ENTRY(trap) |
55 | SAVE_ALL_INT | 54 | SAVE_ALL_INT |
56 | moveq #-1,%d0 | 55 | GET_CURRENT(%d0) |
57 | movel %d0,%sp@(PT_OFF_ORIG_D0) | ||
58 | movel %sp,%sp@- /* stack frame pointer argument */ | 56 | movel %sp,%sp@- /* stack frame pointer argument */ |
59 | jsr trap_c | 57 | jsr trap_c |
60 | addql #4,%sp | 58 | addql #4,%sp |
@@ -65,8 +63,7 @@ ENTRY(trap) | |||
65 | .globl dbginterrupt | 63 | .globl dbginterrupt |
66 | ENTRY(dbginterrupt) | 64 | ENTRY(dbginterrupt) |
67 | SAVE_ALL_INT | 65 | SAVE_ALL_INT |
68 | moveq #-1,%d0 | 66 | GET_CURRENT(%d0) |
69 | movel %d0,%sp@(PT_OFF_ORIG_D0) | ||
70 | movel %sp,%sp@- /* stack frame pointer argument */ | 67 | movel %sp,%sp@- /* stack frame pointer argument */ |
71 | jsr dbginterrupt_c | 68 | jsr dbginterrupt_c |
72 | addql #4,%sp | 69 | addql #4,%sp |
diff --git a/arch/m68k/kernel/init_task.c b/arch/m68k/kernel/init_task.c index cbf9dc3cc51d..c744cfc6bfa1 100644 --- a/arch/m68k/kernel/init_task.c +++ b/arch/m68k/kernel/init_task.c | |||
@@ -19,7 +19,6 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | |||
19 | * | 19 | * |
20 | * All other task structs will be allocated on slabs in fork.c | 20 | * All other task structs will be allocated on slabs in fork.c |
21 | */ | 21 | */ |
22 | __asm__(".align 4"); | ||
23 | struct task_struct init_task = INIT_TASK(init_task); | 22 | struct task_struct init_task = INIT_TASK(init_task); |
24 | 23 | ||
25 | EXPORT_SYMBOL(init_task); | 24 | EXPORT_SYMBOL(init_task); |
@@ -27,7 +26,7 @@ EXPORT_SYMBOL(init_task); | |||
27 | /* | 26 | /* |
28 | * Initial thread structure. | 27 | * Initial thread structure. |
29 | * | 28 | * |
30 | * We need to make sure that this is 8192-byte aligned due to the | 29 | * We need to make sure that this is THREAD size aligned due to the |
31 | * way process stacks are handled. This is done by having a special | 30 | * way process stacks are handled. This is done by having a special |
32 | * "init_task" linker map entry.. | 31 | * "init_task" linker map entry.. |
33 | */ | 32 | */ |
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c index 1b7a14d1a000..774c1bd59c36 100644 --- a/arch/m68k/kernel/m68k_ksyms.c +++ b/arch/m68k/kernel/m68k_ksyms.c | |||
@@ -14,7 +14,7 @@ EXPORT_SYMBOL(__ashrdi3); | |||
14 | EXPORT_SYMBOL(__lshrdi3); | 14 | EXPORT_SYMBOL(__lshrdi3); |
15 | EXPORT_SYMBOL(__muldi3); | 15 | EXPORT_SYMBOL(__muldi3); |
16 | 16 | ||
17 | #if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) | 17 | #if defined(CONFIG_CPU_HAS_NO_MULDIV64) |
18 | /* | 18 | /* |
19 | * Simpler 68k and ColdFire parts also need a few other gcc functions. | 19 | * Simpler 68k and ColdFire parts also need a few other gcc functions. |
20 | */ | 20 | */ |
diff --git a/arch/m68k/kernel/process_mm.c b/arch/m68k/kernel/process_mm.c index 1bc223aa07ec..125f34e00bf0 100644 --- a/arch/m68k/kernel/process_mm.c +++ b/arch/m68k/kernel/process_mm.c | |||
@@ -33,22 +33,6 @@ | |||
33 | #include <asm/setup.h> | 33 | #include <asm/setup.h> |
34 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
35 | 35 | ||
36 | /* | ||
37 | * Initial task/thread structure. Make this a per-architecture thing, | ||
38 | * because different architectures tend to have different | ||
39 | * alignment requirements and potentially different initial | ||
40 | * setup. | ||
41 | */ | ||
42 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
43 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
44 | union thread_union init_thread_union __init_task_data | ||
45 | __attribute__((aligned(THREAD_SIZE))) = | ||
46 | { INIT_THREAD_INFO(init_task) }; | ||
47 | |||
48 | /* initial task structure */ | ||
49 | struct task_struct init_task = INIT_TASK(init_task); | ||
50 | |||
51 | EXPORT_SYMBOL(init_task); | ||
52 | 36 | ||
53 | asmlinkage void ret_from_fork(void); | 37 | asmlinkage void ret_from_fork(void); |
54 | 38 | ||
@@ -188,9 +172,7 @@ void flush_thread(void) | |||
188 | 172 | ||
189 | current->thread.fs = __USER_DS; | 173 | current->thread.fs = __USER_DS; |
190 | if (!FPU_IS_EMU) | 174 | if (!FPU_IS_EMU) |
191 | asm volatile (".chip 68k/68881\n\t" | 175 | asm volatile ("frestore %0@" : : "a" (&zero) : "memory"); |
192 | "frestore %0@\n\t" | ||
193 | ".chip 68k" : : "a" (&zero)); | ||
194 | } | 176 | } |
195 | 177 | ||
196 | /* | 178 | /* |
@@ -264,11 +246,28 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
264 | /* Copy the current fpu state */ | 246 | /* Copy the current fpu state */ |
265 | asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory"); | 247 | asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory"); |
266 | 248 | ||
267 | if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) | 249 | if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) { |
268 | asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t" | 250 | if (CPU_IS_COLDFIRE) { |
269 | "fmoveml %/fpiar/%/fpcr/%/fpsr,%1" | 251 | asm volatile ("fmovemd %/fp0-%/fp7,%0\n\t" |
270 | : : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0]) | 252 | "fmovel %/fpiar,%1\n\t" |
271 | : "memory"); | 253 | "fmovel %/fpcr,%2\n\t" |
254 | "fmovel %/fpsr,%3" | ||
255 | : | ||
256 | : "m" (p->thread.fp[0]), | ||
257 | "m" (p->thread.fpcntl[0]), | ||
258 | "m" (p->thread.fpcntl[1]), | ||
259 | "m" (p->thread.fpcntl[2]) | ||
260 | : "memory"); | ||
261 | } else { | ||
262 | asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t" | ||
263 | "fmoveml %/fpiar/%/fpcr/%/fpsr,%1" | ||
264 | : | ||
265 | : "m" (p->thread.fp[0]), | ||
266 | "m" (p->thread.fpcntl[0]) | ||
267 | : "memory"); | ||
268 | } | ||
269 | } | ||
270 | |||
272 | /* Restore the state in case the fpu was busy */ | 271 | /* Restore the state in case the fpu was busy */ |
273 | asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); | 272 | asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0])); |
274 | } | 273 | } |
@@ -301,12 +300,28 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) | |||
301 | if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) | 300 | if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) |
302 | return 0; | 301 | return 0; |
303 | 302 | ||
304 | asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" | 303 | if (CPU_IS_COLDFIRE) { |
305 | :: "m" (fpu->fpcntl[0]) | 304 | asm volatile ("fmovel %/fpiar,%0\n\t" |
306 | : "memory"); | 305 | "fmovel %/fpcr,%1\n\t" |
307 | asm volatile ("fmovemx %/fp0-%/fp7,%0" | 306 | "fmovel %/fpsr,%2\n\t" |
308 | :: "m" (fpu->fpregs[0]) | 307 | "fmovemd %/fp0-%/fp7,%3" |
309 | : "memory"); | 308 | : |
309 | : "m" (fpu->fpcntl[0]), | ||
310 | "m" (fpu->fpcntl[1]), | ||
311 | "m" (fpu->fpcntl[2]), | ||
312 | "m" (fpu->fpregs[0]) | ||
313 | : "memory"); | ||
314 | } else { | ||
315 | asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" | ||
316 | : | ||
317 | : "m" (fpu->fpcntl[0]) | ||
318 | : "memory"); | ||
319 | asm volatile ("fmovemx %/fp0-%/fp7,%0" | ||
320 | : | ||
321 | : "m" (fpu->fpregs[0]) | ||
322 | : "memory"); | ||
323 | } | ||
324 | |||
310 | return 1; | 325 | return 1; |
311 | } | 326 | } |
312 | EXPORT_SYMBOL(dump_fpu); | 327 | EXPORT_SYMBOL(dump_fpu); |
diff --git a/arch/m68k/kernel/ptrace_mm.c b/arch/m68k/kernel/ptrace_mm.c index 0b252683cefb..7bc999b73529 100644 --- a/arch/m68k/kernel/ptrace_mm.c +++ b/arch/m68k/kernel/ptrace_mm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ptrace.h> | 18 | #include <linux/ptrace.h> |
19 | #include <linux/user.h> | 19 | #include <linux/user.h> |
20 | #include <linux/signal.h> | 20 | #include <linux/signal.h> |
21 | #include <linux/tracehook.h> | ||
21 | 22 | ||
22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
@@ -275,3 +276,20 @@ asmlinkage void syscall_trace(void) | |||
275 | current->exit_code = 0; | 276 | current->exit_code = 0; |
276 | } | 277 | } |
277 | } | 278 | } |
279 | |||
280 | #ifdef CONFIG_COLDFIRE | ||
281 | asmlinkage int syscall_trace_enter(void) | ||
282 | { | ||
283 | int ret = 0; | ||
284 | |||
285 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | ||
286 | ret = tracehook_report_syscall_entry(task_pt_regs(current)); | ||
287 | return ret; | ||
288 | } | ||
289 | |||
290 | asmlinkage void syscall_trace_leave(void) | ||
291 | { | ||
292 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | ||
293 | tracehook_report_syscall_exit(task_pt_regs(current), 0); | ||
294 | } | ||
295 | #endif /* CONFIG_COLDFIRE */ | ||
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index c3b45061dd08..d872ce4807c9 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c | |||
@@ -221,7 +221,8 @@ void __init setup_arch(char **cmdline_p) | |||
221 | #endif | 221 | #endif |
222 | 222 | ||
223 | /* The bootinfo is located right after the kernel bss */ | 223 | /* The bootinfo is located right after the kernel bss */ |
224 | m68k_parse_bootinfo((const struct bi_record *)_end); | 224 | if (!CPU_IS_COLDFIRE) |
225 | m68k_parse_bootinfo((const struct bi_record *)_end); | ||
225 | 226 | ||
226 | if (CPU_IS_040) | 227 | if (CPU_IS_040) |
227 | m68k_is040or060 = 4; | 228 | m68k_is040or060 = 4; |
@@ -235,7 +236,7 @@ void __init setup_arch(char **cmdline_p) | |||
235 | * with them, we should add a test to check_bugs() below] */ | 236 | * with them, we should add a test to check_bugs() below] */ |
236 | #ifndef CONFIG_M68KFPU_EMU_ONLY | 237 | #ifndef CONFIG_M68KFPU_EMU_ONLY |
237 | /* clear the fpu if we have one */ | 238 | /* clear the fpu if we have one */ |
238 | if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) { | 239 | if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|FPU_COLDFIRE)) { |
239 | volatile int zero = 0; | 240 | volatile int zero = 0; |
240 | asm volatile ("frestore %0" : : "m" (zero)); | 241 | asm volatile ("frestore %0" : : "m" (zero)); |
241 | } | 242 | } |
@@ -258,6 +259,10 @@ void __init setup_arch(char **cmdline_p) | |||
258 | init_mm.end_data = (unsigned long)_edata; | 259 | init_mm.end_data = (unsigned long)_edata; |
259 | init_mm.brk = (unsigned long)_end; | 260 | init_mm.brk = (unsigned long)_end; |
260 | 261 | ||
262 | #if defined(CONFIG_BOOTPARAM) | ||
263 | strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE); | ||
264 | m68k_command_line[CL_SIZE - 1] = 0; | ||
265 | #endif /* CONFIG_BOOTPARAM */ | ||
261 | *cmdline_p = m68k_command_line; | 266 | *cmdline_p = m68k_command_line; |
262 | memcpy(boot_command_line, *cmdline_p, CL_SIZE); | 267 | memcpy(boot_command_line, *cmdline_p, CL_SIZE); |
263 | 268 | ||
@@ -323,6 +328,11 @@ void __init setup_arch(char **cmdline_p) | |||
323 | config_sun3x(); | 328 | config_sun3x(); |
324 | break; | 329 | break; |
325 | #endif | 330 | #endif |
331 | #ifdef CONFIG_COLDFIRE | ||
332 | case MACH_M54XX: | ||
333 | config_BSP(NULL, 0); | ||
334 | break; | ||
335 | #endif | ||
326 | default: | 336 | default: |
327 | panic("No configuration setup"); | 337 | panic("No configuration setup"); |
328 | } | 338 | } |
@@ -384,6 +394,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
384 | #define LOOP_CYCLES_68030 (8) | 394 | #define LOOP_CYCLES_68030 (8) |
385 | #define LOOP_CYCLES_68040 (3) | 395 | #define LOOP_CYCLES_68040 (3) |
386 | #define LOOP_CYCLES_68060 (1) | 396 | #define LOOP_CYCLES_68060 (1) |
397 | #define LOOP_CYCLES_COLDFIRE (2) | ||
387 | 398 | ||
388 | if (CPU_IS_020) { | 399 | if (CPU_IS_020) { |
389 | cpu = "68020"; | 400 | cpu = "68020"; |
@@ -397,6 +408,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
397 | } else if (CPU_IS_060) { | 408 | } else if (CPU_IS_060) { |
398 | cpu = "68060"; | 409 | cpu = "68060"; |
399 | clockfactor = LOOP_CYCLES_68060; | 410 | clockfactor = LOOP_CYCLES_68060; |
411 | } else if (CPU_IS_COLDFIRE) { | ||
412 | cpu = "ColdFire"; | ||
413 | clockfactor = LOOP_CYCLES_COLDFIRE; | ||
400 | } else { | 414 | } else { |
401 | cpu = "680x0"; | 415 | cpu = "680x0"; |
402 | clockfactor = 0; | 416 | clockfactor = 0; |
@@ -415,6 +429,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
415 | fpu = "68060"; | 429 | fpu = "68060"; |
416 | else if (m68k_fputype & FPU_SUNFPA) | 430 | else if (m68k_fputype & FPU_SUNFPA) |
417 | fpu = "Sun FPA"; | 431 | fpu = "Sun FPA"; |
432 | else if (m68k_fputype & FPU_COLDFIRE) | ||
433 | fpu = "ColdFire"; | ||
418 | else | 434 | else |
419 | fpu = "none"; | 435 | fpu = "none"; |
420 | #endif | 436 | #endif |
@@ -431,6 +447,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
431 | mmu = "Sun-3"; | 447 | mmu = "Sun-3"; |
432 | else if (m68k_mmutype & MMU_APOLLO) | 448 | else if (m68k_mmutype & MMU_APOLLO) |
433 | mmu = "Apollo"; | 449 | mmu = "Apollo"; |
450 | else if (m68k_mmutype & MMU_COLDFIRE) | ||
451 | mmu = "ColdFire"; | ||
434 | else | 452 | else |
435 | mmu = "unknown"; | 453 | mmu = "unknown"; |
436 | 454 | ||
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 2ed8c0fb1517..ca3df0dc7e88 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c | |||
@@ -47,7 +47,6 @@ EXPORT_SYMBOL(memory_end); | |||
47 | char __initdata command_line[COMMAND_LINE_SIZE]; | 47 | char __initdata command_line[COMMAND_LINE_SIZE]; |
48 | 48 | ||
49 | /* machine dependent timer functions */ | 49 | /* machine dependent timer functions */ |
50 | void (*mach_gettod)(int*, int*, int*, int*, int*, int*); | ||
51 | int (*mach_set_clock_mmss)(unsigned long); | 50 | int (*mach_set_clock_mmss)(unsigned long); |
52 | 51 | ||
53 | /* machine dependent reboot functions */ | 52 | /* machine dependent reboot functions */ |
diff --git a/arch/m68k/kernel/signal_mm.c b/arch/m68k/kernel/signal_mm.c index a0afc239304e..cb856f9da655 100644 --- a/arch/m68k/kernel/signal_mm.c +++ b/arch/m68k/kernel/signal_mm.c | |||
@@ -56,7 +56,11 @@ static const int frame_extra_sizes[16] = { | |||
56 | [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */ | 56 | [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */ |
57 | [2] = sizeof(((struct frame *)0)->un.fmt2), | 57 | [2] = sizeof(((struct frame *)0)->un.fmt2), |
58 | [3] = sizeof(((struct frame *)0)->un.fmt3), | 58 | [3] = sizeof(((struct frame *)0)->un.fmt3), |
59 | #ifdef CONFIG_COLDFIRE | ||
60 | [4] = 0, | ||
61 | #else | ||
59 | [4] = sizeof(((struct frame *)0)->un.fmt4), | 62 | [4] = sizeof(((struct frame *)0)->un.fmt4), |
63 | #endif | ||
60 | [5] = -1, /* sizeof(((struct frame *)0)->un.fmt5), */ | 64 | [5] = -1, /* sizeof(((struct frame *)0)->un.fmt5), */ |
61 | [6] = -1, /* sizeof(((struct frame *)0)->un.fmt6), */ | 65 | [6] = -1, /* sizeof(((struct frame *)0)->un.fmt6), */ |
62 | [7] = sizeof(((struct frame *)0)->un.fmt7), | 66 | [7] = sizeof(((struct frame *)0)->un.fmt7), |
@@ -84,7 +88,11 @@ int handle_kernel_fault(struct pt_regs *regs) | |||
84 | regs->stkadj = frame_extra_sizes[regs->format]; | 88 | regs->stkadj = frame_extra_sizes[regs->format]; |
85 | tregs = (struct pt_regs *)((long)regs + regs->stkadj); | 89 | tregs = (struct pt_regs *)((long)regs + regs->stkadj); |
86 | tregs->vector = regs->vector; | 90 | tregs->vector = regs->vector; |
91 | #ifdef CONFIG_COLDFIRE | ||
92 | tregs->format = 4; | ||
93 | #else | ||
87 | tregs->format = 0; | 94 | tregs->format = 0; |
95 | #endif | ||
88 | tregs->pc = fixup->fixup; | 96 | tregs->pc = fixup->fixup; |
89 | tregs->sr = regs->sr; | 97 | tregs->sr = regs->sr; |
90 | 98 | ||
@@ -195,7 +203,8 @@ static inline int restore_fpu_state(struct sigcontext *sc) | |||
195 | 203 | ||
196 | if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) { | 204 | if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) { |
197 | /* Verify the frame format. */ | 205 | /* Verify the frame format. */ |
198 | if (!CPU_IS_060 && (sc->sc_fpstate[0] != fpu_version)) | 206 | if (!(CPU_IS_060 || CPU_IS_COLDFIRE) && |
207 | (sc->sc_fpstate[0] != fpu_version)) | ||
199 | goto out; | 208 | goto out; |
200 | if (CPU_IS_020_OR_030) { | 209 | if (CPU_IS_020_OR_030) { |
201 | if (m68k_fputype & FPU_68881 && | 210 | if (m68k_fputype & FPU_68881 && |
@@ -214,19 +223,43 @@ static inline int restore_fpu_state(struct sigcontext *sc) | |||
214 | sc->sc_fpstate[3] == 0x60 || | 223 | sc->sc_fpstate[3] == 0x60 || |
215 | sc->sc_fpstate[3] == 0xe0)) | 224 | sc->sc_fpstate[3] == 0xe0)) |
216 | goto out; | 225 | goto out; |
226 | } else if (CPU_IS_COLDFIRE) { | ||
227 | if (!(sc->sc_fpstate[0] == 0x00 || | ||
228 | sc->sc_fpstate[0] == 0x05 || | ||
229 | sc->sc_fpstate[0] == 0xe5)) | ||
230 | goto out; | ||
217 | } else | 231 | } else |
218 | goto out; | 232 | goto out; |
219 | 233 | ||
220 | __asm__ volatile (".chip 68k/68881\n\t" | 234 | if (CPU_IS_COLDFIRE) { |
221 | "fmovemx %0,%%fp0-%%fp1\n\t" | 235 | __asm__ volatile ("fmovemd %0,%%fp0-%%fp1\n\t" |
222 | "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t" | 236 | "fmovel %1,%%fpcr\n\t" |
223 | ".chip 68k" | 237 | "fmovel %2,%%fpsr\n\t" |
224 | : /* no outputs */ | 238 | "fmovel %3,%%fpiar" |
225 | : "m" (*sc->sc_fpregs), "m" (*sc->sc_fpcntl)); | 239 | : /* no outputs */ |
240 | : "m" (sc->sc_fpregs[0]), | ||
241 | "m" (sc->sc_fpcntl[0]), | ||
242 | "m" (sc->sc_fpcntl[1]), | ||
243 | "m" (sc->sc_fpcntl[2])); | ||
244 | } else { | ||
245 | __asm__ volatile (".chip 68k/68881\n\t" | ||
246 | "fmovemx %0,%%fp0-%%fp1\n\t" | ||
247 | "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t" | ||
248 | ".chip 68k" | ||
249 | : /* no outputs */ | ||
250 | : "m" (*sc->sc_fpregs), | ||
251 | "m" (*sc->sc_fpcntl)); | ||
252 | } | ||
253 | } | ||
254 | |||
255 | if (CPU_IS_COLDFIRE) { | ||
256 | __asm__ volatile ("frestore %0" : : "m" (*sc->sc_fpstate)); | ||
257 | } else { | ||
258 | __asm__ volatile (".chip 68k/68881\n\t" | ||
259 | "frestore %0\n\t" | ||
260 | ".chip 68k" | ||
261 | : : "m" (*sc->sc_fpstate)); | ||
226 | } | 262 | } |
227 | __asm__ volatile (".chip 68k/68881\n\t" | ||
228 | "frestore %0\n\t" | ||
229 | ".chip 68k" : : "m" (*sc->sc_fpstate)); | ||
230 | err = 0; | 263 | err = 0; |
231 | 264 | ||
232 | out: | 265 | out: |
@@ -241,7 +274,7 @@ out: | |||
241 | static inline int rt_restore_fpu_state(struct ucontext __user *uc) | 274 | static inline int rt_restore_fpu_state(struct ucontext __user *uc) |
242 | { | 275 | { |
243 | unsigned char fpstate[FPCONTEXT_SIZE]; | 276 | unsigned char fpstate[FPCONTEXT_SIZE]; |
244 | int context_size = CPU_IS_060 ? 8 : 0; | 277 | int context_size = CPU_IS_060 ? 8 : (CPU_IS_COLDFIRE ? 12 : 0); |
245 | fpregset_t fpregs; | 278 | fpregset_t fpregs; |
246 | int err = 1; | 279 | int err = 1; |
247 | 280 | ||
@@ -260,10 +293,11 @@ static inline int rt_restore_fpu_state(struct ucontext __user *uc) | |||
260 | if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate)) | 293 | if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate)) |
261 | goto out; | 294 | goto out; |
262 | if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { | 295 | if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { |
263 | if (!CPU_IS_060) | 296 | if (!(CPU_IS_060 || CPU_IS_COLDFIRE)) |
264 | context_size = fpstate[1]; | 297 | context_size = fpstate[1]; |
265 | /* Verify the frame format. */ | 298 | /* Verify the frame format. */ |
266 | if (!CPU_IS_060 && (fpstate[0] != fpu_version)) | 299 | if (!(CPU_IS_060 || CPU_IS_COLDFIRE) && |
300 | (fpstate[0] != fpu_version)) | ||
267 | goto out; | 301 | goto out; |
268 | if (CPU_IS_020_OR_030) { | 302 | if (CPU_IS_020_OR_030) { |
269 | if (m68k_fputype & FPU_68881 && | 303 | if (m68k_fputype & FPU_68881 && |
@@ -282,26 +316,50 @@ static inline int rt_restore_fpu_state(struct ucontext __user *uc) | |||
282 | fpstate[3] == 0x60 || | 316 | fpstate[3] == 0x60 || |
283 | fpstate[3] == 0xe0)) | 317 | fpstate[3] == 0xe0)) |
284 | goto out; | 318 | goto out; |
319 | } else if (CPU_IS_COLDFIRE) { | ||
320 | if (!(fpstate[3] == 0x00 || | ||
321 | fpstate[3] == 0x05 || | ||
322 | fpstate[3] == 0xe5)) | ||
323 | goto out; | ||
285 | } else | 324 | } else |
286 | goto out; | 325 | goto out; |
287 | if (__copy_from_user(&fpregs, &uc->uc_mcontext.fpregs, | 326 | if (__copy_from_user(&fpregs, &uc->uc_mcontext.fpregs, |
288 | sizeof(fpregs))) | 327 | sizeof(fpregs))) |
289 | goto out; | 328 | goto out; |
290 | __asm__ volatile (".chip 68k/68881\n\t" | 329 | |
291 | "fmovemx %0,%%fp0-%%fp7\n\t" | 330 | if (CPU_IS_COLDFIRE) { |
292 | "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t" | 331 | __asm__ volatile ("fmovemd %0,%%fp0-%%fp7\n\t" |
293 | ".chip 68k" | 332 | "fmovel %1,%%fpcr\n\t" |
294 | : /* no outputs */ | 333 | "fmovel %2,%%fpsr\n\t" |
295 | : "m" (*fpregs.f_fpregs), | 334 | "fmovel %3,%%fpiar" |
296 | "m" (*fpregs.f_fpcntl)); | 335 | : /* no outputs */ |
336 | : "m" (fpregs.f_fpregs[0]), | ||
337 | "m" (fpregs.f_fpcntl[0]), | ||
338 | "m" (fpregs.f_fpcntl[1]), | ||
339 | "m" (fpregs.f_fpcntl[2])); | ||
340 | } else { | ||
341 | __asm__ volatile (".chip 68k/68881\n\t" | ||
342 | "fmovemx %0,%%fp0-%%fp7\n\t" | ||
343 | "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t" | ||
344 | ".chip 68k" | ||
345 | : /* no outputs */ | ||
346 | : "m" (*fpregs.f_fpregs), | ||
347 | "m" (*fpregs.f_fpcntl)); | ||
348 | } | ||
297 | } | 349 | } |
298 | if (context_size && | 350 | if (context_size && |
299 | __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1, | 351 | __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1, |
300 | context_size)) | 352 | context_size)) |
301 | goto out; | 353 | goto out; |
302 | __asm__ volatile (".chip 68k/68881\n\t" | 354 | |
303 | "frestore %0\n\t" | 355 | if (CPU_IS_COLDFIRE) { |
304 | ".chip 68k" : : "m" (*fpstate)); | 356 | __asm__ volatile ("frestore %0" : : "m" (*fpstate)); |
357 | } else { | ||
358 | __asm__ volatile (".chip 68k/68881\n\t" | ||
359 | "frestore %0\n\t" | ||
360 | ".chip 68k" | ||
361 | : : "m" (*fpstate)); | ||
362 | } | ||
305 | err = 0; | 363 | err = 0; |
306 | 364 | ||
307 | out: | 365 | out: |
@@ -336,8 +394,12 @@ static int mangle_kernel_stack(struct pt_regs *regs, int formatvec, | |||
336 | regs->format = formatvec >> 12; | 394 | regs->format = formatvec >> 12; |
337 | regs->vector = formatvec & 0xfff; | 395 | regs->vector = formatvec & 0xfff; |
338 | #define frame_offset (sizeof(struct pt_regs)+sizeof(struct switch_stack)) | 396 | #define frame_offset (sizeof(struct pt_regs)+sizeof(struct switch_stack)) |
339 | __asm__ __volatile__ | 397 | __asm__ __volatile__ ( |
340 | (" movel %0,%/a0\n\t" | 398 | #ifdef CONFIG_COLDFIRE |
399 | " movel %0,%/sp\n\t" | ||
400 | " bra ret_from_signal\n" | ||
401 | #else | ||
402 | " movel %0,%/a0\n\t" | ||
341 | " subl %1,%/a0\n\t" /* make room on stack */ | 403 | " subl %1,%/a0\n\t" /* make room on stack */ |
342 | " movel %/a0,%/sp\n\t" /* set stack pointer */ | 404 | " movel %/a0,%/sp\n\t" /* set stack pointer */ |
343 | /* move switch_stack and pt_regs */ | 405 | /* move switch_stack and pt_regs */ |
@@ -350,6 +412,7 @@ static int mangle_kernel_stack(struct pt_regs *regs, int formatvec, | |||
350 | "2: movel %4@+,%/a0@+\n\t" | 412 | "2: movel %4@+,%/a0@+\n\t" |
351 | " dbra %1,2b\n\t" | 413 | " dbra %1,2b\n\t" |
352 | " bral ret_from_signal\n" | 414 | " bral ret_from_signal\n" |
415 | #endif | ||
353 | : /* no outputs, it doesn't ever return */ | 416 | : /* no outputs, it doesn't ever return */ |
354 | : "a" (sw), "d" (fsize), "d" (frame_offset/4-1), | 417 | : "a" (sw), "d" (fsize), "d" (frame_offset/4-1), |
355 | "n" (frame_offset), "a" (buf + fsize/4) | 418 | "n" (frame_offset), "a" (buf + fsize/4) |
@@ -516,10 +579,15 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs) | |||
516 | return; | 579 | return; |
517 | } | 580 | } |
518 | 581 | ||
519 | __asm__ volatile (".chip 68k/68881\n\t" | 582 | if (CPU_IS_COLDFIRE) { |
520 | "fsave %0\n\t" | 583 | __asm__ volatile ("fsave %0" |
521 | ".chip 68k" | 584 | : : "m" (*sc->sc_fpstate) : "memory"); |
522 | : : "m" (*sc->sc_fpstate) : "memory"); | 585 | } else { |
586 | __asm__ volatile (".chip 68k/68881\n\t" | ||
587 | "fsave %0\n\t" | ||
588 | ".chip 68k" | ||
589 | : : "m" (*sc->sc_fpstate) : "memory"); | ||
590 | } | ||
523 | 591 | ||
524 | if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) { | 592 | if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) { |
525 | fpu_version = sc->sc_fpstate[0]; | 593 | fpu_version = sc->sc_fpstate[0]; |
@@ -530,21 +598,35 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs) | |||
530 | if (*(unsigned short *) sc->sc_fpstate == 0x1f38) | 598 | if (*(unsigned short *) sc->sc_fpstate == 0x1f38) |
531 | sc->sc_fpstate[0x38] |= 1 << 3; | 599 | sc->sc_fpstate[0x38] |= 1 << 3; |
532 | } | 600 | } |
533 | __asm__ volatile (".chip 68k/68881\n\t" | 601 | |
534 | "fmovemx %%fp0-%%fp1,%0\n\t" | 602 | if (CPU_IS_COLDFIRE) { |
535 | "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t" | 603 | __asm__ volatile ("fmovemd %%fp0-%%fp1,%0\n\t" |
536 | ".chip 68k" | 604 | "fmovel %%fpcr,%1\n\t" |
537 | : "=m" (*sc->sc_fpregs), | 605 | "fmovel %%fpsr,%2\n\t" |
538 | "=m" (*sc->sc_fpcntl) | 606 | "fmovel %%fpiar,%3" |
539 | : /* no inputs */ | 607 | : "=m" (sc->sc_fpregs[0]), |
540 | : "memory"); | 608 | "=m" (sc->sc_fpcntl[0]), |
609 | "=m" (sc->sc_fpcntl[1]), | ||
610 | "=m" (sc->sc_fpcntl[2]) | ||
611 | : /* no inputs */ | ||
612 | : "memory"); | ||
613 | } else { | ||
614 | __asm__ volatile (".chip 68k/68881\n\t" | ||
615 | "fmovemx %%fp0-%%fp1,%0\n\t" | ||
616 | "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t" | ||
617 | ".chip 68k" | ||
618 | : "=m" (*sc->sc_fpregs), | ||
619 | "=m" (*sc->sc_fpcntl) | ||
620 | : /* no inputs */ | ||
621 | : "memory"); | ||
622 | } | ||
541 | } | 623 | } |
542 | } | 624 | } |
543 | 625 | ||
544 | static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs) | 626 | static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs) |
545 | { | 627 | { |
546 | unsigned char fpstate[FPCONTEXT_SIZE]; | 628 | unsigned char fpstate[FPCONTEXT_SIZE]; |
547 | int context_size = CPU_IS_060 ? 8 : 0; | 629 | int context_size = CPU_IS_060 ? 8 : (CPU_IS_COLDFIRE ? 12 : 0); |
548 | int err = 0; | 630 | int err = 0; |
549 | 631 | ||
550 | if (FPU_IS_EMU) { | 632 | if (FPU_IS_EMU) { |
@@ -557,15 +639,19 @@ static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * | |||
557 | return err; | 639 | return err; |
558 | } | 640 | } |
559 | 641 | ||
560 | __asm__ volatile (".chip 68k/68881\n\t" | 642 | if (CPU_IS_COLDFIRE) { |
561 | "fsave %0\n\t" | 643 | __asm__ volatile ("fsave %0" : : "m" (*fpstate) : "memory"); |
562 | ".chip 68k" | 644 | } else { |
563 | : : "m" (*fpstate) : "memory"); | 645 | __asm__ volatile (".chip 68k/68881\n\t" |
646 | "fsave %0\n\t" | ||
647 | ".chip 68k" | ||
648 | : : "m" (*fpstate) : "memory"); | ||
649 | } | ||
564 | 650 | ||
565 | err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate); | 651 | err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate); |
566 | if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { | 652 | if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { |
567 | fpregset_t fpregs; | 653 | fpregset_t fpregs; |
568 | if (!CPU_IS_060) | 654 | if (!(CPU_IS_060 || CPU_IS_COLDFIRE)) |
569 | context_size = fpstate[1]; | 655 | context_size = fpstate[1]; |
570 | fpu_version = fpstate[0]; | 656 | fpu_version = fpstate[0]; |
571 | if (CPU_IS_020_OR_030 && | 657 | if (CPU_IS_020_OR_030 && |
@@ -575,14 +661,27 @@ static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * | |||
575 | if (*(unsigned short *) fpstate == 0x1f38) | 661 | if (*(unsigned short *) fpstate == 0x1f38) |
576 | fpstate[0x38] |= 1 << 3; | 662 | fpstate[0x38] |= 1 << 3; |
577 | } | 663 | } |
578 | __asm__ volatile (".chip 68k/68881\n\t" | 664 | if (CPU_IS_COLDFIRE) { |
579 | "fmovemx %%fp0-%%fp7,%0\n\t" | 665 | __asm__ volatile ("fmovemd %%fp0-%%fp7,%0\n\t" |
580 | "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t" | 666 | "fmovel %%fpcr,%1\n\t" |
581 | ".chip 68k" | 667 | "fmovel %%fpsr,%2\n\t" |
582 | : "=m" (*fpregs.f_fpregs), | 668 | "fmovel %%fpiar,%3" |
583 | "=m" (*fpregs.f_fpcntl) | 669 | : "=m" (fpregs.f_fpregs[0]), |
584 | : /* no inputs */ | 670 | "=m" (fpregs.f_fpcntl[0]), |
585 | : "memory"); | 671 | "=m" (fpregs.f_fpcntl[1]), |
672 | "=m" (fpregs.f_fpcntl[2]) | ||
673 | : /* no inputs */ | ||
674 | : "memory"); | ||
675 | } else { | ||
676 | __asm__ volatile (".chip 68k/68881\n\t" | ||
677 | "fmovemx %%fp0-%%fp7,%0\n\t" | ||
678 | "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t" | ||
679 | ".chip 68k" | ||
680 | : "=m" (*fpregs.f_fpregs), | ||
681 | "=m" (*fpregs.f_fpcntl) | ||
682 | : /* no inputs */ | ||
683 | : "memory"); | ||
684 | } | ||
586 | err |= copy_to_user(&uc->uc_mcontext.fpregs, &fpregs, | 685 | err |= copy_to_user(&uc->uc_mcontext.fpregs, &fpregs, |
587 | sizeof(fpregs)); | 686 | sizeof(fpregs)); |
588 | } | 687 | } |
@@ -679,8 +778,7 @@ static inline void push_cache (unsigned long vaddr) | |||
679 | "cpushl %%bc,(%0)\n\t" | 778 | "cpushl %%bc,(%0)\n\t" |
680 | ".chip 68k" | 779 | ".chip 68k" |
681 | : : "a" (temp)); | 780 | : : "a" (temp)); |
682 | } | 781 | } else if (!CPU_IS_COLDFIRE) { |
683 | else { | ||
684 | /* | 782 | /* |
685 | * 68030/68020 have no writeback cache; | 783 | * 68030/68020 have no writeback cache; |
686 | * still need to clear icache. | 784 | * still need to clear icache. |
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index a5cf40c26de5..75ab79b3bdeb 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #ifdef CONFIG_MMU | 1 | #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) |
2 | #include "time_mm.c" | 2 | #include "time_mm.c" |
3 | #else | 3 | #else |
4 | #include "time_no.c" | 4 | #include "time_no.c" |
diff --git a/arch/m68k/kernel/time_no.c b/arch/m68k/kernel/time_no.c index 6623909f70e6..3ef0f7768dcd 100644 --- a/arch/m68k/kernel/time_no.c +++ b/arch/m68k/kernel/time_no.c | |||
@@ -26,6 +26,9 @@ | |||
26 | 26 | ||
27 | #define TICK_SIZE (tick_nsec / 1000) | 27 | #define TICK_SIZE (tick_nsec / 1000) |
28 | 28 | ||
29 | /* machine dependent timer functions */ | ||
30 | void (*mach_gettod)(int*, int*, int*, int*, int*, int*); | ||
31 | |||
29 | static inline int set_rtc_mmss(unsigned long nowtime) | 32 | static inline int set_rtc_mmss(unsigned long nowtime) |
30 | { | 33 | { |
31 | if (mach_set_clock_mmss) | 34 | if (mach_set_clock_mmss) |
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index 89362f2bb56a..a76452ca964e 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c | |||
@@ -706,6 +706,88 @@ create_atc_entry: | |||
706 | #endif /* CPU_M68020_OR_M68030 */ | 706 | #endif /* CPU_M68020_OR_M68030 */ |
707 | #endif /* !CONFIG_SUN3 */ | 707 | #endif /* !CONFIG_SUN3 */ |
708 | 708 | ||
709 | #if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU) | ||
710 | #include <asm/mcfmmu.h> | ||
711 | |||
712 | /* | ||
713 | * The following table converts the FS encoding of a ColdFire | ||
714 | * exception stack frame into the error_code value needed by | ||
715 | * do_fault. | ||
716 | */ | ||
717 | static const unsigned char fs_err_code[] = { | ||
718 | 0, /* 0000 */ | ||
719 | 0, /* 0001 */ | ||
720 | 0, /* 0010 */ | ||
721 | 0, /* 0011 */ | ||
722 | 1, /* 0100 */ | ||
723 | 0, /* 0101 */ | ||
724 | 0, /* 0110 */ | ||
725 | 0, /* 0111 */ | ||
726 | 2, /* 1000 */ | ||
727 | 3, /* 1001 */ | ||
728 | 2, /* 1010 */ | ||
729 | 0, /* 1011 */ | ||
730 | 1, /* 1100 */ | ||
731 | 1, /* 1101 */ | ||
732 | 0, /* 1110 */ | ||
733 | 0 /* 1111 */ | ||
734 | }; | ||
735 | |||
736 | static inline void access_errorcf(unsigned int fs, struct frame *fp) | ||
737 | { | ||
738 | unsigned long mmusr, addr; | ||
739 | unsigned int err_code; | ||
740 | int need_page_fault; | ||
741 | |||
742 | mmusr = mmu_read(MMUSR); | ||
743 | addr = mmu_read(MMUAR); | ||
744 | |||
745 | /* | ||
746 | * error_code: | ||
747 | * bit 0 == 0 means no page found, 1 means protection fault | ||
748 | * bit 1 == 0 means read, 1 means write | ||
749 | */ | ||
750 | switch (fs) { | ||
751 | case 5: /* 0101 TLB opword X miss */ | ||
752 | need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 0, 0); | ||
753 | addr = fp->ptregs.pc; | ||
754 | break; | ||
755 | case 6: /* 0110 TLB extension word X miss */ | ||
756 | need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 0, 1); | ||
757 | addr = fp->ptregs.pc + sizeof(long); | ||
758 | break; | ||
759 | case 10: /* 1010 TLB W miss */ | ||
760 | need_page_fault = cf_tlb_miss(&fp->ptregs, 1, 1, 0); | ||
761 | break; | ||
762 | case 14: /* 1110 TLB R miss */ | ||
763 | need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 1, 0); | ||
764 | break; | ||
765 | default: | ||
766 | /* 0000 Normal */ | ||
767 | /* 0001 Reserved */ | ||
768 | /* 0010 Interrupt during debug service routine */ | ||
769 | /* 0011 Reserved */ | ||
770 | /* 0100 X Protection */ | ||
771 | /* 0111 IFP in emulator mode */ | ||
772 | /* 1000 W Protection*/ | ||
773 | /* 1001 Write error*/ | ||
774 | /* 1011 Reserved*/ | ||
775 | /* 1100 R Protection*/ | ||
776 | /* 1101 R Protection*/ | ||
777 | /* 1111 OEP in emulator mode*/ | ||
778 | need_page_fault = 1; | ||
779 | break; | ||
780 | } | ||
781 | |||
782 | if (need_page_fault) { | ||
783 | err_code = fs_err_code[fs]; | ||
784 | if ((fs == 13) && (mmusr & MMUSR_WF)) /* rd-mod-wr access */ | ||
785 | err_code |= 2; /* bit1 - write, bit0 - protection */ | ||
786 | do_page_fault(&fp->ptregs, addr, err_code); | ||
787 | } | ||
788 | } | ||
789 | #endif /* CONFIG_COLDFIRE CONFIG_MMU */ | ||
790 | |||
709 | asmlinkage void buserr_c(struct frame *fp) | 791 | asmlinkage void buserr_c(struct frame *fp) |
710 | { | 792 | { |
711 | /* Only set esp0 if coming from user mode */ | 793 | /* Only set esp0 if coming from user mode */ |
@@ -716,6 +798,28 @@ asmlinkage void buserr_c(struct frame *fp) | |||
716 | printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format); | 798 | printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format); |
717 | #endif | 799 | #endif |
718 | 800 | ||
801 | #if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU) | ||
802 | if (CPU_IS_COLDFIRE) { | ||
803 | unsigned int fs; | ||
804 | fs = (fp->ptregs.vector & 0x3) | | ||
805 | ((fp->ptregs.vector & 0xc00) >> 8); | ||
806 | switch (fs) { | ||
807 | case 0x5: | ||
808 | case 0x6: | ||
809 | case 0x7: | ||
810 | case 0x9: | ||
811 | case 0xa: | ||
812 | case 0xd: | ||
813 | case 0xe: | ||
814 | case 0xf: | ||
815 | access_errorcf(fs, fp); | ||
816 | return; | ||
817 | default: | ||
818 | break; | ||
819 | } | ||
820 | } | ||
821 | #endif /* CONFIG_COLDFIRE && CONFIG_MMU */ | ||
822 | |||
719 | switch (fp->ptregs.format) { | 823 | switch (fp->ptregs.format) { |
720 | #if defined (CONFIG_M68060) | 824 | #if defined (CONFIG_M68060) |
721 | case 4: /* 68060 access error */ | 825 | case 4: /* 68060 access error */ |
diff --git a/arch/m68k/kernel/vmlinux.lds_no.S b/arch/m68k/kernel/vmlinux-nommu.lds index 4e2389340837..8e66ccb0935e 100644 --- a/arch/m68k/kernel/vmlinux.lds_no.S +++ b/arch/m68k/kernel/vmlinux-nommu.lds | |||
@@ -69,6 +69,7 @@ SECTIONS { | |||
69 | SCHED_TEXT | 69 | SCHED_TEXT |
70 | LOCK_TEXT | 70 | LOCK_TEXT |
71 | *(.text..lock) | 71 | *(.text..lock) |
72 | *(.fixup) | ||
72 | 73 | ||
73 | . = ALIGN(16); /* Exception table */ | 74 | . = ALIGN(16); /* Exception table */ |
74 | __start___ex_table = .; | 75 | __start___ex_table = .; |
@@ -161,6 +162,13 @@ SECTIONS { | |||
161 | _edata = . ; | 162 | _edata = . ; |
162 | } > DATA | 163 | } > DATA |
163 | 164 | ||
165 | .m68k_fixup : { | ||
166 | __start_fixup = .; | ||
167 | *(.m68k_fixup) | ||
168 | __stop_fixup = .; | ||
169 | } > DATA | ||
170 | NOTES > DATA | ||
171 | |||
164 | .init.text : { | 172 | .init.text : { |
165 | . = ALIGN(PAGE_SIZE); | 173 | . = ALIGN(PAGE_SIZE); |
166 | __init_begin = .; | 174 | __init_begin = .; |
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds index d0993594f558..63407c836826 100644 --- a/arch/m68k/kernel/vmlinux-std.lds +++ b/arch/m68k/kernel/vmlinux-std.lds | |||
@@ -31,7 +31,9 @@ SECTIONS | |||
31 | 31 | ||
32 | RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) | 32 | RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) |
33 | 33 | ||
34 | _sbss = .; | ||
34 | BSS_SECTION(0, 0, 0) | 35 | BSS_SECTION(0, 0, 0) |
36 | _ebss = .; | ||
35 | 37 | ||
36 | _edata = .; /* End of data section */ | 38 | _edata = .; /* End of data section */ |
37 | 39 | ||
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds index 8080469ee6c1..ad0f46d64c0b 100644 --- a/arch/m68k/kernel/vmlinux-sun3.lds +++ b/arch/m68k/kernel/vmlinux-sun3.lds | |||
@@ -44,7 +44,9 @@ __init_begin = .; | |||
44 | . = ALIGN(PAGE_SIZE); | 44 | . = ALIGN(PAGE_SIZE); |
45 | __init_end = .; | 45 | __init_end = .; |
46 | 46 | ||
47 | _sbss = .; | ||
47 | BSS_SECTION(0, 0, 0) | 48 | BSS_SECTION(0, 0, 0) |
49 | _ebss = .; | ||
48 | 50 | ||
49 | _end = . ; | 51 | _end = . ; |
50 | 52 | ||
diff --git a/arch/m68k/kernel/vmlinux.lds.S b/arch/m68k/kernel/vmlinux.lds.S index 030dabf0bc53..69ec79638870 100644 --- a/arch/m68k/kernel/vmlinux.lds.S +++ b/arch/m68k/kernel/vmlinux.lds.S | |||
@@ -1,5 +1,14 @@ | |||
1 | #ifdef CONFIG_MMU | 1 | #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) |
2 | #include "vmlinux.lds_mm.S" | 2 | PHDRS |
3 | { | ||
4 | text PT_LOAD FILEHDR PHDRS FLAGS (7); | ||
5 | data PT_LOAD FLAGS (7); | ||
6 | } | ||
7 | #ifdef CONFIG_SUN3 | ||
8 | #include "vmlinux-sun3.lds" | ||
3 | #else | 9 | #else |
4 | #include "vmlinux.lds_no.S" | 10 | #include "vmlinux-std.lds" |
11 | #endif | ||
12 | #else | ||
13 | #include "vmlinux-nommu.lds" | ||
5 | #endif | 14 | #endif |
diff --git a/arch/m68k/kernel/vmlinux.lds_mm.S b/arch/m68k/kernel/vmlinux.lds_mm.S deleted file mode 100644 index 99ba315bd0a8..000000000000 --- a/arch/m68k/kernel/vmlinux.lds_mm.S +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | PHDRS | ||
2 | { | ||
3 | text PT_LOAD FILEHDR PHDRS FLAGS (7); | ||
4 | data PT_LOAD FLAGS (7); | ||
5 | } | ||
6 | #ifdef CONFIG_SUN3 | ||
7 | #include "vmlinux-sun3.lds" | ||
8 | #else | ||
9 | #include "vmlinux-std.lds" | ||
10 | #endif | ||