]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-frv/pgtable.h
FRV: Handle update_mmu_cache() being called when current->mm is NULL [try #2]
[linux-2.6-omap-h63xx.git] / include / asm-frv / pgtable.h
index 6c0682ed5fc93db05ec12a27e9dabb6fee665cfc..4e219046fe422910b72619c51245f3798ac6ea80 100644 (file)
@@ -507,13 +507,22 @@ static inline int pte_file(pte_t pte)
  */
 static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
 {
+       struct mm_struct *mm;
        unsigned long ampr;
-       pgd_t *pge = pgd_offset(current->mm, address);
-       pud_t *pue = pud_offset(pge, address);
-       pmd_t *pme = pmd_offset(pue, address);
 
-       ampr = pme->ste[0] & 0xffffff00;
-       ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | xAMPRx_V;
+       mm = current->mm;
+       if (mm) {
+               pgd_t *pge = pgd_offset(mm, address);
+               pud_t *pue = pud_offset(pge, address);
+               pmd_t *pme = pmd_offset(pue, address);
+
+               ampr = pme->ste[0] & 0xffffff00;
+               ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C |
+                       xAMPRx_V;
+       } else {
+               address = ULONG_MAX;
+               ampr = 0;
+       }
 
        asm volatile("movgs %0,scr0\n"
                     "movgs %0,scr1\n"