patch-2.4.7 linux/include/asm-mips64/pgtable.h

Next file: linux/include/asm-mips64/processor.h
Previous file: linux/include/asm-mips64/pgalloc.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/include/asm-mips64/pgtable.h linux/include/asm-mips64/pgtable.h
@@ -3,8 +3,8 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1994 - 2000 by Ralf Baechle at alii
- * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
+ * Copyright (C) 1994 - 2001 by Ralf Baechle at alii
+ * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
  */
 #ifndef _ASM_PGTABLE_H
 #define _ASM_PGTABLE_H
@@ -177,15 +177,25 @@
 
 #define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
 
-#define PAGE_NONE	__pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_COW)
+#ifdef CONFIG_MIPS_UNCACHED
+#define PAGE_CACHABLE_DEFAULT _CACHE_UNCACHED
+#else /* ! UNCACHED */
+#ifdef CONFIG_SGI_IP22
+#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT
+#else /* ! IP22 */
+#define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW
+#endif /* IP22 */
+#endif /* UNCACHED */
+
+#define PAGE_NONE	__pgprot(_PAGE_PRESENT | PAGE_CACHABLE_DEFAULT)
 #define PAGE_SHARED     __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
-			_CACHE_CACHABLE_COW)
+			PAGE_CACHABLE_DEFAULT)
 #define PAGE_COPY       __pgprot(_PAGE_PRESENT | _PAGE_READ | \
-			_CACHE_CACHABLE_COW)
+			PAGE_CACHABLE_DEFAULT)
 #define PAGE_READONLY   __pgprot(_PAGE_PRESENT | _PAGE_READ | \
-			_CACHE_CACHABLE_COW)
+			PAGE_CACHABLE_DEFAULT)
 #define PAGE_KERNEL	__pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
-			_CACHE_CACHABLE_COW)
+			PAGE_CACHABLE_DEFAULT)
 #define PAGE_USERIO     __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
 			_CACHE_UNCACHED)
 #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
@@ -224,22 +234,13 @@
 	printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
 
 /*
- * BAD_PAGETABLE is used when we need a bogus page-table, while
- * BAD_PAGE is used for a bogus page.
- *
  * ZERO_PAGE is a global shared page that is always zero: used
  * for zero-mapped memory areas etc..
  */
-extern pte_t __bad_page(void);
-extern pte_t *__bad_pagetable(void);
-extern pmd_t *__bad_pmd_table(void);
 
 extern unsigned long empty_zero_page;
 extern unsigned long zero_page_mask;
 
-#define BAD_PAGETABLE __bad_pagetable()
-#define BAD_PMDTABLE __bad_pmd_table()
-#define BAD_PAGE __bad_page()
 #define ZERO_PAGE(vaddr) \
 	(virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))
 
@@ -297,7 +298,8 @@
 	return pte_val(pte) & _PAGE_PRESENT;
 }
 
-/* Certain architectures need to do special things when pte's
+/*
+ * Certain architectures need to do special things when pte's
  * within a page table are directly modified.  Thus, the following
  * hook is made available.
  */
@@ -312,6 +314,13 @@
 }
 
 /*
+ * (pmds are folded into pgds so this doesnt get actually called,
+ * but the define is needed for a generic inline function.)
+ */
+#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
+#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
+
+/*
  * Empty pmd entries point to the invalid_pte_table.
  */
 extern inline int pmd_none(pmd_t pmd)
@@ -321,7 +330,12 @@
 
 extern inline int pmd_bad(pmd_t pmd)
 {
-	return pmd_val(pmd) == (unsigned long) empty_bad_page_table;
+	return pmd_val(pmd) &~ PAGE_MASK;
+}
+
+extern inline int pmd_present(pmd_t pmd)
+{
+	return pmd_val(pmd) != (unsigned long) invalid_pte_table;
 }
 
 extern inline void pmd_clear(pmd_t *pmdp)
@@ -339,7 +353,12 @@
 
 extern inline int pgd_bad(pgd_t pgd)
 {
-	return pgd_val(pgd) == (unsigned long) empty_bad_pmd_table;
+	return pgd_val(pgd) &~ PAGE_MASK;
+}
+
+extern inline int pgd_present(pgd_t pgd)
+{
+	return pgd_val(pgd) != (unsigned long) invalid_pmd_table;
 }
 
 extern inline void pgd_clear(pgd_t *pgdp)
@@ -350,7 +369,6 @@
 /*
  * Permanent address of a page.  On MIPS64 we never have highmem, so this
  * is simple.
- * called on a highmem page.
  */
 #define page_address(page)	((page)->virtual)
 #ifndef CONFIG_DISCONTIGMEM
@@ -761,7 +779,7 @@
 
 	__asm__ __volatile__(
 		".set noreorder\n\t"
-		"mfc0 %0, $4\n\t"
+		"dmfc0 %0, $4\n\t"
 		".set reorder"
 		: "=r" (val));
 
@@ -772,7 +790,7 @@
 {
 	__asm__ __volatile__(
 		".set noreorder\n\t"
-		"mtc0 %0, $4\n\t"
+		"dmtc0 %0, $4\n\t"
 		".set reorder"
 		: : "r" (val));
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)