Commit 0d4f6468 authored by Hirokazu Takata's avatar Hirokazu Takata Committed by Linus Torvalds

m32r: fix tme_handler to check _PAGE_PRESENT bit

Fix the tlb-miss handler (tme_handler) to check _PAGE_PRESENT bit
in order to handle file-mapped or swapped-out pages correctly.

This patch is required to fix unexpected page errors for m32r.
Signed-off-by: default avatarHitoshi Yamamoto <hitoshiy@linux-m32r.org>
Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 43c09ce7
...@@ -163,7 +163,8 @@ ENTRY(tme_handler) ...@@ -163,7 +163,8 @@ ENTRY(tme_handler)
; pte_data = (unsigned long)pte_val(*pte); ; pte_data = (unsigned long)pte_val(*pte);
ld r2, @r3 ; r2: pte data ld r2, @r3 ; r2: pte data
or3 r2, r2, #2 ; _PAGE_PRESENT(=2) and3 r3, r2, #2 ; _PAGE_PRESENT(=2) check
beqz r3, 3f
.fillinsn .fillinsn
5: 5:
...@@ -264,11 +265,8 @@ ENTRY(tme_handler) ...@@ -264,11 +265,8 @@ ENTRY(tme_handler)
; ;
and3 r1, r1, #0xeff and3 r1, r1, #0xeff
ldi r4, #611 ; _KERNPG_TABLE(=611) ldi r4, #611 ; _KERNPG_TABLE(=611)
beq r1, r4, 4f ; !pmd_bad(*pmd) ? bne r1, r4, 3f ; !pmd_bad(*pmd) ?
.fillinsn
3:
ldi r1, #0 ; r1: pte_data = 0
bra 5f
.fillinsn .fillinsn
4: 4:
; pte = pte_offset(pmd, address); ; pte = pte_offset(pmd, address);
...@@ -282,8 +280,10 @@ ENTRY(tme_handler) ...@@ -282,8 +280,10 @@ ENTRY(tme_handler)
add r4, r3 ; r4: pte add r4, r3 ; r4: pte
; pte_data = (unsigned long)pte_val(*pte); ; pte_data = (unsigned long)pte_val(*pte);
ld r1, @r4 ; r1: pte_data ld r1, @r4 ; r1: pte_data
.fillinsn and3 r3, r1, #2 ; _PAGE_PRESENT(=2) check
beqz r3, 3f
.fillinsn
;; set tlb ;; set tlb
; r0: address, r1: pte_data, r2: entry ; r0: address, r1: pte_data, r2: entry
; r3,r4: (free) ; r3,r4: (free)
...@@ -295,8 +295,7 @@ ENTRY(tme_handler) ...@@ -295,8 +295,7 @@ ENTRY(tme_handler)
and3 r4, r4, #(MMU_CONTEXT_ASID_MASK) and3 r4, r4, #(MMU_CONTEXT_ASID_MASK)
or r3, r4 or r3, r4
st r3, @r2 st r3, @r2
or3 r4, r1, #2 ; _PAGE_PRESENT(=2) st r1, @(4,r2) ; set_tlb_data(entry, pte_data);
st r4, @(4,r2) ; set_tlb_data(entry, pte_data);
ld r4, @sp+ ld r4, @sp+
ld r3, @sp+ ld r3, @sp+
...@@ -306,6 +305,11 @@ ENTRY(tme_handler) ...@@ -306,6 +305,11 @@ ENTRY(tme_handler)
ld sp, @sp+ ld sp, @sp+
rte rte
.fillinsn
3:
ldi r1, #2 ; r1: pte_data = 0 | _PAGE_PRESENT(=2)
bra 5b
#else #else
#error unknown isa configuration #error unknown isa configuration
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment