]> git.zerfleddert.de Git - ms2-kexec/blob - mmu.c
7d25e1673b5de92a6c6a0bcf01ca5c7392925529
[ms2-kexec] / mmu.c
1 /*
2 * linux/arch/arm/mm/mmu.c
3 *
4 * Copyright (C) 1995-2005 Russell King
5 * This Edition is maintained by Matthew Veety (aliasxerog) <mveety@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/init.h>
15 #include <linux/bootmem.h>
16 #include <linux/mman.h>
17 #include <linux/nodemask.h>
18 #include <linux/ioport.h>
19
20 #include <asm/cputype.h>
21 #include <asm/mach-types.h>
22 #include <asm/sections.h>
23 #include <asm/setup.h>
24 #include <asm/sizes.h>
25 #include <asm/tlb.h>
26 #include <asm/pgtable.h>
27
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30
31 #include "mm.h"
32
33 /*
34 * In order to soft-boot, we need to insert a 1:1 mapping in place of
35 * the user-mode pages. This will then ensure that we have predictable
36 * results when turning the mmu off
37 */
38 void setup_mm_for_reboot(char mode)
39 {
40 unsigned long base_pmdval;
41 pgd_t *pgd;
42 int i;
43
44 if (current->mm && current->mm->pgd)
45 pgd = current->mm->pgd;
46 #if 0
47 else
48 pgd = init_mm.pgd;
49 #else
50 else
51 {
52 struct mm_struct *initmm = (struct mm_struct *)0xc05672a0;
53 pgd = initmm->pgd;
54 }
55 #warning FIXME init_mm is no longer exported
56 #endif
57
58 base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT;
59
60 for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
61 unsigned long pmdval = (i << PGDIR_SHIFT) | base_pmdval;
62 pmd_t *pmd;
63
64 pmd = pmd_off(pgd, i << PGDIR_SHIFT);
65 pmd[0] = __pmd(pmdval);
66 pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1)));
67 flush_pmd_entry(pmd);
68 }
69 }
Impressum, Datenschutz