powerpc: Add 64 bit version of huge_ptep_set_wrprotect
[pandora-kernel.git] / include / asm-powerpc / pgtable-ppc64.h
index 27f1869..b2754d4 100644 (file)
 
 #define VMALLOC_REGION_ID      (REGION_ID(VMALLOC_START))
 #define KERNEL_REGION_ID       (REGION_ID(PAGE_OFFSET))
+#define VMEMMAP_REGION_ID      (0xfUL)
 #define USER_REGION_ID         (0UL)
 
 /*
- * Defines the address of the vmemap area, in the top 16th of the
- * kernel region.
+ * Defines the address of the vmemap area, in its own region
  */
-#define VMEMMAP_BASE (ASM_CONST(CONFIG_KERNEL_START) + \
-                                       (0xfUL << (REGION_SHIFT - 4)))
-#define vmemmap ((struct page *)VMEMMAP_BASE)
+#define VMEMMAP_BASE           (VMEMMAP_REGION_ID << REGION_SHIFT)
+#define vmemmap                        ((struct page *)VMEMMAP_BASE)
+
 
 /*
  * Common bits in a linux-style PTE.  These match the bits in the
@@ -91,7 +91,6 @@
 #define _PAGE_DIRTY    0x0080 /* C: page changed */
 #define _PAGE_ACCESSED 0x0100 /* R: page referenced */
 #define _PAGE_RW       0x0200 /* software: user write access allowed */
-#define _PAGE_HASHPTE  0x0400 /* software: pte has an associated HPTE */
 #define _PAGE_BUSY     0x0800 /* software: PTE & hash are busy */
 
 #define _PAGE_BASE     (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT)
@@ -313,6 +312,15 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
                        return;
        old = pte_update(mm, addr, ptep, _PAGE_RW, 0);
 }
+static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
+                                          unsigned long addr, pte_t *ptep)
+{
+       unsigned long old;
+
+               if ((pte_val(*ptep) & _PAGE_RW) == 0)
+                       return;
+       old = pte_update(mm, addr, ptep, _PAGE_RW, 1);
+}
 
 /*
  * We currently remove entries from the hashtable regardless of whether