diff options
Diffstat (limited to 'arch/ppc/mm/fault.c')
-rw-r--r-- | arch/ppc/mm/fault.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c index ee5e9f25baf9..8e08ca32531a 100644 --- a/arch/ppc/mm/fault.c +++ b/arch/ppc/mm/fault.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * arch/ppc/mm/fault.c | ||
3 | * | ||
4 | * PowerPC version | 2 | * PowerPC version |
5 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | 3 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) |
6 | * | 4 | * |
@@ -204,6 +202,7 @@ good_area: | |||
204 | /* an exec - 4xx/Book-E allows for per-page execute permission */ | 202 | /* an exec - 4xx/Book-E allows for per-page execute permission */ |
205 | } else if (TRAP(regs) == 0x400) { | 203 | } else if (TRAP(regs) == 0x400) { |
206 | pte_t *ptep; | 204 | pte_t *ptep; |
205 | pmd_t *pmdp; | ||
207 | 206 | ||
208 | #if 0 | 207 | #if 0 |
209 | /* It would be nice to actually enforce the VM execute | 208 | /* It would be nice to actually enforce the VM execute |
@@ -217,21 +216,24 @@ good_area: | |||
217 | /* Since 4xx/Book-E supports per-page execute permission, | 216 | /* Since 4xx/Book-E supports per-page execute permission, |
218 | * we lazily flush dcache to icache. */ | 217 | * we lazily flush dcache to icache. */ |
219 | ptep = NULL; | 218 | ptep = NULL; |
220 | if (get_pteptr(mm, address, &ptep) && pte_present(*ptep)) { | 219 | if (get_pteptr(mm, address, &ptep, &pmdp)) { |
221 | struct page *page = pte_page(*ptep); | 220 | spinlock_t *ptl = pte_lockptr(mm, pmdp); |
222 | 221 | spin_lock(ptl); | |
223 | if (! test_bit(PG_arch_1, &page->flags)) { | 222 | if (pte_present(*ptep)) { |
224 | flush_dcache_icache_page(page); | 223 | struct page *page = pte_page(*ptep); |
225 | set_bit(PG_arch_1, &page->flags); | 224 | |
225 | if (!test_bit(PG_arch_1, &page->flags)) { | ||
226 | flush_dcache_icache_page(page); | ||
227 | set_bit(PG_arch_1, &page->flags); | ||
228 | } | ||
229 | pte_update(ptep, 0, _PAGE_HWEXEC); | ||
230 | _tlbie(address); | ||
231 | pte_unmap_unlock(ptep, ptl); | ||
232 | up_read(&mm->mmap_sem); | ||
233 | return 0; | ||
226 | } | 234 | } |
227 | pte_update(ptep, 0, _PAGE_HWEXEC); | 235 | pte_unmap_unlock(ptep, ptl); |
228 | _tlbie(address); | ||
229 | pte_unmap(ptep); | ||
230 | up_read(&mm->mmap_sem); | ||
231 | return 0; | ||
232 | } | 236 | } |
233 | if (ptep != NULL) | ||
234 | pte_unmap(ptep); | ||
235 | #endif | 237 | #endif |
236 | /* a read */ | 238 | /* a read */ |
237 | } else { | 239 | } else { |