Merge git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-mn10300
[pandora-kernel.git] / arch / mn10300 / mm / tlb-mn10300.S
index 7095147..b994017 100644 (file)
@@ -27,7 +27,6 @@
 ###############################################################################
        .type   itlb_miss,@function
 ENTRY(itlb_miss)
-       and     ~EPSW_NMID,epsw
 #ifdef CONFIG_GDBSTUB
        movm    [d2,d3,a2],(sp)
 #else
@@ -38,6 +37,12 @@ ENTRY(itlb_miss)
        nop
 #endif
 
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+       mov     (MMUCTR),d2
+       mov     d2,(MMUCTR)
+#endif
+
+       and     ~EPSW_NMID,epsw
        mov     (IPTEU),d3
        mov     (PTBR),a2
        mov     d3,d2
@@ -56,10 +61,16 @@ ENTRY(itlb_miss)
        btst    _PAGE_VALID,d2
        beq     itlb_miss_fault         # jump if doesn't point to a page
                                        # (might be a swap id)
+#if    ((_PAGE_ACCESSED & 0xffffff00) == 0)
        bset    _PAGE_ACCESSED,(0,a2)
-       and     ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2
+#elif  ((_PAGE_ACCESSED & 0xffff00ff) == 0)
+       bset    +(_PAGE_ACCESSED >> 8),(1,a2)
+#else
+#error "_PAGE_ACCESSED value is out of range"
+#endif
+       and     ~xPTEL2_UNUSED1,d2
 itlb_miss_set:
-       mov     d2,(IPTEL             # change the TLB
+       mov     d2,(IPTEL2)             # change the TLB
 #ifdef CONFIG_GDBSTUB
        movm    (sp),[d2,d3,a2]
 #endif
@@ -79,7 +90,6 @@ itlb_miss_fault:
 ###############################################################################
        .type   dtlb_miss,@function
 ENTRY(dtlb_miss)
-       and     ~EPSW_NMID,epsw
 #ifdef CONFIG_GDBSTUB
        movm    [d2,d3,a2],(sp)
 #else
@@ -90,6 +100,12 @@ ENTRY(dtlb_miss)
        nop
 #endif
 
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+       mov     (MMUCTR),d2
+       mov     d2,(MMUCTR)
+#endif
+
+       and     ~EPSW_NMID,epsw
        mov     (DPTEU),d3
        mov     (PTBR),a2
        mov     d3,d2
@@ -108,10 +124,16 @@ ENTRY(dtlb_miss)
        btst    _PAGE_VALID,d2
        beq     dtlb_miss_fault         # jump if doesn't point to a page
                                        # (might be a swap id)
+#if    ((_PAGE_ACCESSED & 0xffffff00) == 0)
        bset    _PAGE_ACCESSED,(0,a2)
-       and     ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2
+#elif  ((_PAGE_ACCESSED & 0xffff00ff) == 0)
+       bset    +(_PAGE_ACCESSED >> 8),(1,a2)
+#else
+#error "_PAGE_ACCESSED value is out of range"
+#endif
+       and     ~xPTEL2_UNUSED1,d2
 dtlb_miss_set:
-       mov     d2,(DPTEL             # change the TLB
+       mov     d2,(DPTEL2)             # change the TLB
 #ifdef CONFIG_GDBSTUB
        movm    (sp),[d2,d3,a2]
 #endif
@@ -130,9 +152,15 @@ dtlb_miss_fault:
 ###############################################################################
        .type   itlb_aerror,@function
 ENTRY(itlb_aerror)
-       and     ~EPSW_NMID,epsw
        add     -4,sp
        SAVE_ALL
+
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+       mov     (MMUCTR),d1
+       mov     d1,(MMUCTR)
+#endif
+
+       and     ~EPSW_NMID,epsw
        add     -4,sp                           # need to pass three params
 
        # calculate the fault code
@@ -140,15 +168,13 @@ ENTRY(itlb_aerror)
        or      0x00010000,d1                   # it's an instruction fetch
 
        # determine the page address
-       mov     (IPTEU),a2
-       mov     a2,d0
+       mov     (IPTEU),d0
        and     PAGE_MASK,d0
        mov     d0,(12,sp)
 
        clr     d0
-       mov     d0,(IPTEL)
+       mov     d0,(IPTEL2)
 
-       and     ~EPSW_NMID,epsw
        or      EPSW_IE,epsw
        mov     fp,d0
        call    do_page_fault[],0               # do_page_fault(regs,code,addr
@@ -163,10 +189,16 @@ ENTRY(itlb_aerror)
 ###############################################################################
        .type   dtlb_aerror,@function
 ENTRY(dtlb_aerror)
-       and     ~EPSW_NMID,epsw
        add     -4,sp
        SAVE_ALL
+
+#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR)
+       mov     (MMUCTR),d1
+       mov     d1,(MMUCTR)
+#endif
+
        add     -4,sp                           # need to pass three params
+       and     ~EPSW_NMID,epsw
 
        # calculate the fault code
        movhu   (MMUFCR_DFC),d1
@@ -178,9 +210,8 @@ ENTRY(dtlb_aerror)
        mov     d0,(12,sp)
 
        clr     d0
-       mov     d0,(DPTEL)
+       mov     d0,(DPTEL2)
 
-       and     ~EPSW_NMID,epsw
        or      EPSW_IE,epsw
        mov     fp,d0
        call    do_page_fault[],0               # do_page_fault(regs,code,addr