m68k: set register a2 to current if MMU enabled on ColdFire
authorGreg Ungerer <gerg@uclinux.org>
Fri, 14 Oct 2011 05:41:56 +0000 (15:41 +1000)
committerGreg Ungerer <gerg@uclinux.org>
Fri, 30 Dec 2011 00:20:24 +0000 (10:20 +1000)
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>
arch/m68k/include/asm/entry.h
arch/m68k/kernel/entry_no.S
arch/m68k/platform/coldfire/entry.S

index c3c5a8643e15c784e096189f1a29ef59e251d115..622138dc7288fcac734a3fa434af4780a1fa1184 100644 (file)
  * Non-MMU systems do not reserve %a2 in this way, and this definition is
  * not used for them.
  */
+#ifdef CONFIG_MMU
+
 #define curptr a2
 
 #define GET_CURRENT(tmp) get_current tmp
 .macro get_current reg=%d0
        movel   %sp,\reg
-       andw    #-THREAD_SIZE,\reg
+       andl    #-THREAD_SIZE,\reg
        movel   \reg,%curptr
        movel   %curptr@,%curptr
 .endm
 
+#else
+
+#define GET_CURRENT(tmp)
+
+#endif /* CONFIG_MMU */
+
 #else /* C source */
 
 #define STR(X) STR1(X)
index ac86a9ffc1d76f0a9db3a722761bb795fce21520..d80cba45589f4b7c337f5c9a2cdff9b430bcd514 100644 (file)
@@ -44,6 +44,7 @@
 
 ENTRY(buserr)
        SAVE_ALL_INT
+       GET_CURRENT(%d0)
        movel   %sp,%sp@-               /* stack frame pointer argument */
        jsr     buserr_c
        addql   #4,%sp
@@ -51,6 +52,7 @@ ENTRY(buserr)
 
 ENTRY(trap)
        SAVE_ALL_INT
+       GET_CURRENT(%d0)
        movel   %sp,%sp@-               /* stack frame pointer argument */
        jsr     trap_c
        addql   #4,%sp
@@ -61,6 +63,7 @@ ENTRY(trap)
 .globl dbginterrupt
 ENTRY(dbginterrupt)
        SAVE_ALL_INT
+       GET_CURRENT(%d0)
        movel   %sp,%sp@-               /* stack frame pointer argument */
        jsr     dbginterrupt_c
        addql   #4,%sp
index f567a163bc40e5fdfe072afa5959537a08437e2c..863889fc31c9c1fe2b0ad7a9b460a8627a14a56c 100644 (file)
@@ -62,6 +62,7 @@ enosys:
 ENTRY(system_call)
        SAVE_ALL_SYS
        move    #0x2000,%sr             /* enable intrs again */
+       GET_CURRENT(%d2)
 
        cmpl    #NR_syscalls,%d0
        jcc     enosys
@@ -165,6 +166,7 @@ Lsignal_return:
  */
 ENTRY(inthandler)
        SAVE_ALL_INT
+       GET_CURRENT(%d2)
 
        movew   %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */
        andl    #0x03fc,%d0             /* mask out vector only */
@@ -190,7 +192,9 @@ ENTRY(resume)
        movel   %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack pointer */
        RDUSP                                    /* movel %usp,%a3 */
        movel   %a3,%a0@(TASK_THREAD+THREAD_USP) /* save thread user stack */
-
+#ifdef CONFIG_MMU
+       movel   %a1,%a2                          /* set new current */
+#endif
        movel   %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore thread user stack */
        WRUSP                                    /* movel %a3,%usp */
        movel   %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new kernel stack */
This page took 0.028176 seconds and 5 git commands to generate.