[RFC v2][PATCH 17/35] sparc: create ptemap.h

Dave Hansen
2009-05-20T18:25:12Z

linux-2.6.git-dave/arch/sparc/include/asm/pgtable_32.h | 10 -------
linux-2.6.git-dave/arch/sparc/include/asm/pgtable_64.h | 5 ---
linux-2.6.git-dave/arch/sparc/include/asm/ptemap.h | 24 +++++++++++++++++
3 files changed, 26 insertions(+), 13 deletions(-)

diff -puN arch/sparc/include/asm/pgtable_32.h~sparc-ptemaph arch/sparc/include/asm/pgtable_32.h
--- linux-2.6.git/arch/sparc/include/asm/pgtable_32.h~sparc-ptemaph 2009-05-02 14:39:54.000000000 -0700
+++ linux-2.6.git-dave/arch/sparc/include/asm/pgtable_32.h 2009-05-02 14:40:38.000000000 -0700
@@ -300,15 +300,7 @@ BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd
BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)
#define pte_offset_kernel(dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr)

-/*
- * This shortcut works on sun4m (and sun4d) because the nocache area is static,
- * and sun4c is guaranteed to have no highmem anyway.
- */
-#define pte_offset_map(d, a) pte_offset_kernel(d,a)
-#define pte_offset_map_nested(d, a) pte_offset_kernel(d,a)
-
-#define pte_unmap(pte) do{}while(0)
-#define pte_unmap_nested(pte) do{}while(0)
+#include <asm/ptemap.h>

/* Certain architectures need to do special things when pte's
* within a page table are directly modified. Thus, the following
diff -puN arch/sparc/include/asm/pgtable_64.h~sparc-ptemaph arch/sparc/include/asm/pgtable_64.h
--- linux-2.6.git/arch/sparc/include/asm/pgtable_64.h~sparc-ptemaph 2009-05-02 14:39:54.000000000 -0700
+++ linux-2.6.git-dave/arch/sparc/include/asm/pgtable_64.h 2009-05-02 14:39:54.000000000 -0700
@@ -652,10 +652,7 @@ static inline int pte_special(pte_t pte)
/* Find an entry in the third-level page table.. */
#define pte_offset_kernel(dir, address) \
((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address))
-#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
-#define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address))
-#define pte_unmap(pte) do { } while (0)
-#define pte_unmap_nested(pte) do { } while (0)
+#include <asm/ptemap.h>

/* Actual page table PTE updates. */
extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, pte_t *ptep, pte_t orig);
diff -puN /dev/null arch/sparc/include/asm/ptemap.h
--- /dev/null 2008-09-02 09:40:19.000000000 -0700
+++ linux-2.6.git-dave/arch/sparc/include/asm/ptemap.h 2009-05-02 14:41:35.000000000 -0700
@@ -0,0 +1,24 @@
+#ifndef _SPARC_ASM_PTEMAP_H
+#define _SPARC_ASM_PTEMAP_H
+
+#if defined(__sparc__) && defined(__arch64__)
+
+#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
+#define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address))
+#define pte_unmap(pte) do { } while (0)
+#define pte_unmap_nested(pte) do { } while (0)
+
+#else
+/*
+ * This shortcut works on sun4m (and sun4d) because the nocache area is static,
+ * and sun4c is guaranteed to have no highmem anyway.
+ */
+#define pte_offset_map(d, a) pte_offset_kernel(d,a)
+#define pte_offset_map_nested(d, a) pte_offset_kernel(d,a)
+
+#define pte_unmap(pte) do{}while(0)
+#define pte_unmap_nested(pte) do{}while(0)
+
+#endif
+
+#endif /* _SPARC_ASM_PTEMAP_H */
_