From: Paul Mackerras <paulus@samba.org>

This patch makes the necessary pte_to_pgprot/pgoff_prot_to_pte changes for
-mm2 to compile and run on ppc64.


---

 25-akpm/include/asm-ppc64/mman.h    |    1 +
 25-akpm/include/asm-ppc64/pgtable.h |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff -puN include/asm-ppc64/mman.h~remap-file-pages-prot-ppc64 include/asm-ppc64/mman.h
--- 25/include/asm-ppc64/mman.h~remap-file-pages-prot-ppc64	2004-03-20 02:10:46.365627656 -0800
+++ 25-akpm/include/asm-ppc64/mman.h	2004-03-20 02:10:46.369627048 -0800
@@ -38,6 +38,7 @@
 
 #define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x10000		/* do not block on IO */
+#define MAP_INHERIT	0x20000		/* inherit prot of underlying vma */
 
 #define MADV_NORMAL	0x0		/* default page-in behavior */
 #define MADV_RANDOM	0x1		/* page-in minimum required */
diff -puN include/asm-ppc64/pgtable.h~remap-file-pages-prot-ppc64 include/asm-ppc64/pgtable.h
--- 25/include/asm-ppc64/pgtable.h~remap-file-pages-prot-ppc64	2004-03-20 02:10:46.366627504 -0800
+++ 25-akpm/include/asm-ppc64/pgtable.h	2004-03-20 02:10:46.370626896 -0800
@@ -79,8 +79,8 @@
  */
 #define _PAGE_PRESENT	0x0001 /* software: pte contains a translation */
 #define _PAGE_USER	0x0002 /* matches one of the PP bits */
-#define _PAGE_FILE	0x0002 /* (!present only) software: pte holds file offset */
 #define _PAGE_RW	0x0004 /* software: user write access allowed */
+#define _PAGE_FILE	0x0008 /* !present: pte holds file offset */
 #define _PAGE_GUARDED	0x0008
 #define _PAGE_COHERENT	0x0010 /* M: enforce memory coherence (SMP systems) */
 #define _PAGE_NO_CACHE	0x0020 /* I: cache inhibit */
@@ -458,9 +458,15 @@ extern void update_mmu_cache(struct vm_a
 #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) >> PTE_SHIFT })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val << PTE_SHIFT })
-#define pte_to_pgoff(pte)	(pte_val(pte) >> PTE_SHIFT)
-#define pgoff_to_pte(off)	((pte_t) {((off) << PTE_SHIFT)|_PAGE_FILE})
+
 #define PTE_FILE_MAX_BITS	(BITS_PER_LONG - PTE_SHIFT)
+#define pte_to_pgoff(pte)	(pte_val(pte) >> PTE_SHIFT)
+#define pte_to_pgprot(pte)	\
+__pgprot((pte_val(pte) & (_PAGE_USER|_PAGE_RW|_PAGE_PRESENT)) | _PAGE_ACCESSED)
+
+#define pgoff_prot_to_pte(off, prot)					\
+	((pte_t) { ((off) << PTE_SHIFT) | _PAGE_FILE			\
+		   | (pgprot_val(prot) & (_PAGE_USER|_PAGE_RW)) })
 
 /*
  * kern_addr_valid is intended to indicate whether an address is a valid

_