Merge branch 'hotfixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[pandora-kernel.git] / arch / sh / kernel / cpu / sh3 / entry.S
index b0b59d4..3fe482d 100644 (file)
@@ -13,8 +13,9 @@
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
-#include <asm/cpu/mmu_context.h>
 #include <asm/unistd.h>
+#include <cpu/mmu_context.h>
+#include <asm/page.h>
 
 ! NOTE:
 ! GNU as (as of 2.9.1) changes bf/s into bt/s and bra, when the address
@@ -149,8 +150,7 @@ call_dpf:
         lds    r10, pr
        rts
         nop
-0:     sti
-       mov.l   3f, r0
+0:     mov.l   3f, r0
        mov     r9, r6
        mov     r8, r5
        jmp     @r0
@@ -340,8 +340,27 @@ ENTRY(vbr_base)
 general_exception:
        mov.l   1f, k2
        mov.l   2f, k3
+#ifdef CONFIG_CPU_SUBTYPE_SHX3
+       mov.l   @k2, k2
+
+       ! Is EXPEVT larger than 0x800?
+       mov     #0x8, k0
+       shll8   k0
+       cmp/hs  k0, k2
+       bf      0f
+
+       ! then add 0x580 (k2 is 0xd80 or 0xda0)
+       mov     #0x58, k0
+       shll2   k0
+       shll2   k0
+       add     k0, k2
+0:
+       bra     handle_exception
+        nop
+#else
        bra     handle_exception
         mov.l  @k2, k2
+#endif
        .align  2
 1:     .long   EXPEVT
 2:     .long   ret_from_exception
@@ -391,6 +410,27 @@ ENTRY(handle_exception)
        ! Using k0, k1 for scratch registers (r0_bank1, r1_bank),
        ! save all registers onto stack.
        !
+
+#ifdef CONFIG_GUSA
+       ! Check for roll back gRB (User and Kernel)
+       mov     r15, k0
+       shll    k0
+       bf/s    1f
+        shll   k0
+       bf/s    1f
+        stc    spc, k1
+       stc     r0_bank, k0
+       cmp/hs  k0, k1          ! test k1 (saved PC) >= k0 (saved r0)
+       bt/s    2f
+        stc    r1_bank, k1
+
+       add     #-2, k0
+       add     r15, k0
+       ldc     k0, spc         ! PC = saved r0 + r15 - 2
+2:     mov     k1, r15         ! SP = r1
+1:
+#endif
+
        stc     ssr, k0         ! Is it from kernel space?
        shll    k0              ! Check MD bit (bit30) by shifting it into...
        shll    k0              !       ...the T bit