linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.4.22] Re: PPC405 support in later 2.4.x kernels
@ 2003-08-29 15:01 Wouter Cloetens
  2003-08-31 11:59 ` Paul Mackerras
  0 siblings, 1 reply; 2+ messages in thread
From: Wouter Cloetens @ 2003-08-29 15:01 UTC (permalink / raw)
  To: Trevor Woerner, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

On Thu, 31 Jul 2003 23:32:41 -0400, Trevor Woerner wrote:
> I grabbed 2.4.22-pre8 and found the ppc4xx code back, but the strangest
> thing is now happening: I've lost my user-space.

I had the same problem with 2.4.22. I diffed 2.4.21-pre7 with 2.4.22
and found some 405-specific code to be missing in the fault handler.
The attached patch fixes the problem.

[-- Attachment #2: 405fault.diff --]
[-- Type: text/plain, Size: 1522 bytes --]

--- linux-2.4.22_linuxppc_2_4/arch/ppc/mm/fault.c	2003-08-29 11:13:00.000000000 +0200
+++ linux-2.4.22_linuxppc_2_4_insightv2p/arch/ppc/mm/fault.c	2003-08-29 16:35:26.000000000 +0200
@@ -26,6 +26,7 @@
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
+#include <linux/highmem.h>

 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -51,6 +52,7 @@ unsigned int probingmem;
 extern void die_if_kernel(char *, struct pt_regs *, long);
 void bad_page_fault(struct pt_regs *, unsigned long, int sig);
 void do_page_fault(struct pt_regs *, unsigned long, unsigned long);
+extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);

 /*
  * Check whether the instruction at regs->nip is a store using
@@ -202,6 +204,28 @@ good_area:
 	if (is_write) {
 		if (!(vma->vm_flags & VM_WRITE))
 			goto bad_area;
+#if defined(CONFIG_4xx)
+        /* an exec  - 4xx/BookE allows for per-page execute permission */
+	} else if (regs->trap == 0x400) {
+		pte_t *ptep;
+
+
+		/* Since 4xx supports per-page execute permission,
+		 * we lazily flush dcache to icache. */
+		if (get_pteptr(mm, address, &ptep) && pte_present(*ptep)) {
+			struct page *page = pte_page(*ptep);
+
+			if (! test_bit(PG_arch_1, &page->flags)) {
+				__flush_dcache_icache(kmap(page));
+				kunmap(page);
+				set_bit(PG_arch_1, &page->flags);
+			}
+			pte_update(ptep, 0, _PAGE_HWEXEC);
+			_tlbie(address);
+			up_read(&mm->mmap_sem);
+			return;
+		}
+#endif
 	/* a read */
 	} else {
 		/* protection fault */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-31 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-29 15:01 [PATCH 2.4.22] Re: PPC405 support in later 2.4.x kernels Wouter Cloetens
2003-08-31 11:59 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).