1 #include <linux/kernel.h>
3 #include <asm/cputype.h>
4 #include <asm/pgalloc.h>
5 #include <asm/pgtable.h>
7 static void idmap_add_pmd(pgd_t
*pgd
, unsigned long addr
, unsigned long end
,
10 pmd_t
*pmd
= pmd_offset(pgd
, addr
);
12 addr
= (addr
& PMD_MASK
) | prot
;
19 void identity_mapping_add(pgd_t
*pgd
, unsigned long addr
, unsigned long end
)
21 unsigned long prot
, next
;
23 prot
= PMD_TYPE_SECT
| PMD_SECT_AP_WRITE
;
24 if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ
&& !cpu_is_xscale())
27 pgd
+= pgd_index(addr
);
29 next
= pgd_addr_end(addr
, end
);
30 idmap_add_pmd(pgd
, addr
, next
, prot
);
31 } while (pgd
++, addr
= next
, addr
!= end
);
35 static void idmap_del_pmd(pgd_t
*pgd
, unsigned long addr
, unsigned long end
)
37 pmd_t
*pmd
= pmd_offset(pgd
, addr
);
41 void identity_mapping_del(pgd_t
*pgd
, unsigned long addr
, unsigned long end
)
45 pgd
+= pgd_index(addr
);
47 next
= pgd_addr_end(addr
, end
);
48 idmap_del_pmd(pgd
, addr
, next
);
49 } while (pgd
++, addr
= next
, addr
!= end
);
54 * In order to soft-boot, we need to insert a 1:1 mapping in place of
55 * the user-mode pages. This will then ensure that we have predictable
56 * results when turning the mmu off
58 void setup_mm_for_reboot(char mode
)
61 * We need to access to user-mode page tables here. For kernel threads
62 * we don't have any user-mode mappings so we use the context that we
65 identity_mapping_add(current
->active_mm
->pgd
, 0, TASK_SIZE
);
66 local_flush_tlb_all();