From: William Lee Irwin III Implement remap_file_pages-with-per-page-protections for sparc64. See ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.4/2.6.4-mm1/broken-out/remap-file-pages-prot-2.6.4-rc1-mm1-A1.patch and ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.4/2.6.4-mm1/broken-out/remap-file-pages-prot-ia64-2.6.4-rc2-mm1-A0.patch --- 25-akpm/arch/sparc64/kernel/process.c | 1 + 25-akpm/include/asm-sparc64/pgtable.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff -puN include/asm-sparc64/pgtable.h~remap-file-pages-prot-sparc64 include/asm-sparc64/pgtable.h --- 25/include/asm-sparc64/pgtable.h~remap-file-pages-prot-sparc64 Thu Mar 11 12:35:26 2004 +++ 25-akpm/include/asm-sparc64/pgtable.h Thu Mar 11 12:36:03 2004 @@ -322,9 +322,16 @@ static inline pte_t mk_pte_io(unsigned l /* File offset in PTE support. */ #define pte_file(pte) (pte_val(pte) & _PAGE_FILE) -#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT) -#define pgoff_to_pte(off) (__pte(((off) << PAGE_SHIFT) | _PAGE_FILE)) -#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) +#define __pte_to_pgprot(pte) \ + __pgprot(pte_val(pte) & (_PAGE_READ|_PAGE_WRITE)) +#define __file_pte_to_pgprot(pte) \ + __pgprot(((pte_val(pte) >> PAGE_SHIFT) & 0x3UL) << 8) +#define pte_to_pgprot(pte) \ + (pte_file(pte) ? __file_pte_to_pgprot(pte) : __pte_to_pgprot(pte)) +#define pte_to_pgoff(pte) (pte_val(pte) >> (PAGE_SHIFT+2)) +#define pgoff_prot_to_pte(off, prot) \ + ((__pte(((off) | ((pgprot_val(prot) >> 8) & 0x3UL)))) << (PAGE_SHIFT+2) | _PAGE_FILE) +#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 3UL) extern unsigned long prom_virt_to_phys(unsigned long, int *); _