]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/asm-i386/pgtable-3level.h
[PATCH] x86/PAE: Fix pte_clear for the >4GB RAM case
[net-next-2.6.git] / include / asm-i386 / pgtable-3level.h
index 36a5aa63cbbf69fcd9e9be11799da0afcb3f1e06..dccb1b3337ad29820b7c834020bfd98b0c7050fd 100644 (file)
@@ -85,6 +85,26 @@ static inline void pud_clear (pud_t * pud) { }
 #define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
                        pmd_index(address))
 
+/*
+ * For PTEs and PDEs, we must clear the P-bit first when clearing a page table
+ * entry, so clear the bottom half first and enforce ordering with a compiler
+ * barrier.
+ */
+static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+       ptep->pte_low = 0;
+       smp_wmb();
+       ptep->pte_high = 0;
+}
+
+static inline void pmd_clear(pmd_t *pmd)
+{
+       u32 *tmp = (u32 *)pmd;
+       *tmp = 0;
+       smp_wmb();
+       *(tmp + 1) = 0;
+}
+
 static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
        pte_t res;