[rfc][patch 2/2] mips: reinstate move_pte

Nick Piggin
2007-03-29T07:58:48Z

Restore move_pte for MIPS, so that any given virtual address vaddr that maps
a ZERO_PAGE will map ZERO_PAGE(vaddr).

This has a circular dependancy on the previous patch, which normally means
they belong in the same patch, but I thought this case is clearer if split
out.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/include/asm-mips/pgtable.h
===================================================================
--- linux-2.6.orig/include/asm-mips/pgtable.h
+++ linux-2.6/include/asm-mips/pgtable.h
@@ -69,6 +69,16 @@ extern unsigned long zero_page_mask;
#define ZERO_PAGE(vaddr) \
(virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))

+#define __HAVE_ARCH_MOVE_PTE
+#define move_pte(pte, prot, old_addr, new_addr) \
+({ \
+ pte_t newpte = (pte); \
+ if (pte_present(pte) && \
+ pte_pfn(pte) == page_to_pfn(ZERO_PAGE(old_addr))) \
+ newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \
+ newpte;
+})
+
extern void paging_init(void);

/*