vserver 1.9.5.x5
[linux-2.6.git] / arch / ppc64 / mm / tlb.c
index 8825e14..8495c7b 100644 (file)
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/percpu.h>
+#include <linux/hardirq.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
 #include <asm/tlb.h>
-#include <asm/hardirq.h>
 #include <linux/highmem.h>
 
 DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
@@ -85,8 +85,12 @@ void hpte_update(pte_t *ptep, unsigned long pte, int wrprot)
 
        ptepage = virt_to_page(ptep);
        mm = (struct mm_struct *) ptepage->mapping;
-       addr = ptepage->index +
-               (((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE);
+       addr = ptepage->index;
+       if (pte_huge(pte))
+               addr +=  ((unsigned long)ptep & ~PAGE_MASK)
+                       / sizeof(*ptep) * HPAGE_SIZE;
+       else
+               addr += ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
 
        if (REGION_ID(addr) == USER_REGION_ID)
                context = mm->context.id;