diff options
author | Greg Ungerer <gerg@uclinux.org> | 2011-10-14 01:41:56 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2011-12-29 19:20:24 -0500 |
commit | bbc6f1ba509cf9cda42ce63bbd40afe577ab028e (patch) | |
tree | 281010e3d781b995e429efaacd7c99d0947c2bdf | |
parent | 88be3515934004d271398129ba7145635e95127e (diff) |
m68k: set register a2 to current if MMU enabled on ColdFire
Virtual memory m68k systems build with register a2 dedicated to being the
current proc pointer (non-MMU don't do this). Add code to the ColdFire
interrupt and exception processing to set this on entry, and at context
switch time. We use the same GET_CURRENT() macro that MMU enabled code
uses - modifying it so that the assembler is ColdFire clean.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Matt Waddel <mwaddel@yahoo.com>
Acked-by: Kurt Mahan <kmahan@xmission.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
-rw-r--r-- | arch/m68k/include/asm/entry.h | 10 | ||||
-rw-r--r-- | arch/m68k/kernel/entry_no.S | 3 | ||||
-rw-r--r-- | arch/m68k/platform/coldfire/entry.S | 6 |
3 files changed, 17 insertions, 2 deletions
diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h index c3c5a8643e15..622138dc7288 100644 --- a/arch/m68k/include/asm/entry.h +++ b/arch/m68k/include/asm/entry.h | |||
@@ -222,16 +222,24 @@ | |||
222 | * Non-MMU systems do not reserve %a2 in this way, and this definition is | 222 | * Non-MMU systems do not reserve %a2 in this way, and this definition is |
223 | * not used for them. | 223 | * not used for them. |
224 | */ | 224 | */ |
225 | #ifdef CONFIG_MMU | ||
226 | |||
225 | #define curptr a2 | 227 | #define curptr a2 |
226 | 228 | ||
227 | #define GET_CURRENT(tmp) get_current tmp | 229 | #define GET_CURRENT(tmp) get_current tmp |
228 | .macro get_current reg=%d0 | 230 | .macro get_current reg=%d0 |
229 | movel %sp,\reg | 231 | movel %sp,\reg |
230 | andw #-THREAD_SIZE,\reg | 232 | andl #-THREAD_SIZE,\reg |
231 | movel \reg,%curptr | 233 | movel \reg,%curptr |
232 | movel %curptr@,%curptr | 234 | movel %curptr@,%curptr |
233 | .endm | 235 | .endm |
234 | 236 | ||
237 | #else | ||
238 | |||
239 | #define GET_CURRENT(tmp) | ||
240 | |||
241 | #endif /* CONFIG_MMU */ | ||
242 | |||
235 | #else /* C source */ | 243 | #else /* C source */ |
236 | 244 | ||
237 | #define STR(X) STR1(X) | 245 | #define STR(X) STR1(X) |
diff --git a/arch/m68k/kernel/entry_no.S b/arch/m68k/kernel/entry_no.S index ac86a9ffc1d7..d80cba45589f 100644 --- a/arch/m68k/kernel/entry_no.S +++ b/arch/m68k/kernel/entry_no.S | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | ENTRY(buserr) | 45 | ENTRY(buserr) |
46 | SAVE_ALL_INT | 46 | SAVE_ALL_INT |
47 | GET_CURRENT(%d0) | ||
47 | movel %sp,%sp@- /* stack frame pointer argument */ | 48 | movel %sp,%sp@- /* stack frame pointer argument */ |
48 | jsr buserr_c | 49 | jsr buserr_c |
49 | addql #4,%sp | 50 | addql #4,%sp |
@@ -51,6 +52,7 @@ ENTRY(buserr) | |||
51 | 52 | ||
52 | ENTRY(trap) | 53 | ENTRY(trap) |
53 | SAVE_ALL_INT | 54 | SAVE_ALL_INT |
55 | GET_CURRENT(%d0) | ||
54 | movel %sp,%sp@- /* stack frame pointer argument */ | 56 | movel %sp,%sp@- /* stack frame pointer argument */ |
55 | jsr trap_c | 57 | jsr trap_c |
56 | addql #4,%sp | 58 | addql #4,%sp |
@@ -61,6 +63,7 @@ ENTRY(trap) | |||
61 | .globl dbginterrupt | 63 | .globl dbginterrupt |
62 | ENTRY(dbginterrupt) | 64 | ENTRY(dbginterrupt) |
63 | SAVE_ALL_INT | 65 | SAVE_ALL_INT |
66 | GET_CURRENT(%d0) | ||
64 | movel %sp,%sp@- /* stack frame pointer argument */ | 67 | movel %sp,%sp@- /* stack frame pointer argument */ |
65 | jsr dbginterrupt_c | 68 | jsr dbginterrupt_c |
66 | addql #4,%sp | 69 | addql #4,%sp |
diff --git a/arch/m68k/platform/coldfire/entry.S b/arch/m68k/platform/coldfire/entry.S index f567a163bc40..863889fc31c9 100644 --- a/arch/m68k/platform/coldfire/entry.S +++ b/arch/m68k/platform/coldfire/entry.S | |||
@@ -62,6 +62,7 @@ enosys: | |||
62 | ENTRY(system_call) | 62 | ENTRY(system_call) |
63 | SAVE_ALL_SYS | 63 | SAVE_ALL_SYS |
64 | move #0x2000,%sr /* enable intrs again */ | 64 | move #0x2000,%sr /* enable intrs again */ |
65 | GET_CURRENT(%d2) | ||
65 | 66 | ||
66 | cmpl #NR_syscalls,%d0 | 67 | cmpl #NR_syscalls,%d0 |
67 | jcc enosys | 68 | jcc enosys |
@@ -165,6 +166,7 @@ Lsignal_return: | |||
165 | */ | 166 | */ |
166 | ENTRY(inthandler) | 167 | ENTRY(inthandler) |
167 | SAVE_ALL_INT | 168 | SAVE_ALL_INT |
169 | GET_CURRENT(%d2) | ||
168 | 170 | ||
169 | movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */ | 171 | movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */ |
170 | andl #0x03fc,%d0 /* mask out vector only */ | 172 | andl #0x03fc,%d0 /* mask out vector only */ |
@@ -190,7 +192,9 @@ ENTRY(resume) | |||
190 | movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack pointer */ | 192 | movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack pointer */ |
191 | RDUSP /* movel %usp,%a3 */ | 193 | RDUSP /* movel %usp,%a3 */ |
192 | movel %a3,%a0@(TASK_THREAD+THREAD_USP) /* save thread user stack */ | 194 | movel %a3,%a0@(TASK_THREAD+THREAD_USP) /* save thread user stack */ |
193 | 195 | #ifdef CONFIG_MMU | |
196 | movel %a1,%a2 /* set new current */ | ||
197 | #endif | ||
194 | movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore thread user stack */ | 198 | movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore thread user stack */ |
195 | WRUSP /* movel %a3,%usp */ | 199 | WRUSP /* movel %a3,%usp */ |
196 | movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new kernel stack */ | 200 | movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new kernel stack */ |