aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mm-armv.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-09-27 10:40:28 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-09-27 10:40:28 -0400
commit0c668984ddff94f800b37f244d7b21074b04b971 (patch)
treeea5986742ada97cc21b0341daf2b6cf34c14c60a /arch/arm/mm/mm-armv.c
parentae8f154129e4d965771c2d6adbe36210b3913d72 (diff)
[ARM] Rename mm-armv.c to pgd.c
mm-armv.c now only contains the pgd allocation/freeing code, so rename it to have a more sensible filename. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mm-armv.c')
-rw-r--r--arch/arm/mm/mm-armv.c103
1 files changed, 0 insertions, 103 deletions
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
deleted file mode 100644
index a35d5f2ee4e0..000000000000
--- a/arch/arm/mm/mm-armv.c
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * linux/arch/arm/mm/mm-armv.c
3 *
4 * Copyright (C) 1998-2005 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Page table sludge for ARM v3 and v4 processor architectures.
11 */
12#include <linux/mm.h>
13#include <linux/highmem.h>
14
15#include <asm/pgalloc.h>
16#include <asm/page.h>
17#include <asm/tlbflush.h>
18
19#include "mm.h"
20
21#define FIRST_KERNEL_PGD_NR (FIRST_USER_PGD_NR + USER_PTRS_PER_PGD)
22
23/*
24 * need to get a 16k page for level 1
25 */
26pgd_t *get_pgd_slow(struct mm_struct *mm)
27{
28 pgd_t *new_pgd, *init_pgd;
29 pmd_t *new_pmd, *init_pmd;
30 pte_t *new_pte, *init_pte;
31
32 new_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL, 2);
33 if (!new_pgd)
34 goto no_pgd;
35
36 memzero(new_pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t));
37
38 /*
39 * Copy over the kernel and IO PGD entries
40 */
41 init_pgd = pgd_offset_k(0);
42 memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
43 (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
44
45 clean_dcache_area(new_pgd, PTRS_PER_PGD * sizeof(pgd_t));
46
47 if (!vectors_high()) {
48 /*
49 * On ARM, first page must always be allocated since it
50 * contains the machine vectors.
51 */
52 new_pmd = pmd_alloc(mm, new_pgd, 0);
53 if (!new_pmd)
54 goto no_pmd;
55
56 new_pte = pte_alloc_map(mm, new_pmd, 0);
57 if (!new_pte)
58 goto no_pte;
59
60 init_pmd = pmd_offset(init_pgd, 0);
61 init_pte = pte_offset_map_nested(init_pmd, 0);
62 set_pte(new_pte, *init_pte);
63 pte_unmap_nested(init_pte);
64 pte_unmap(new_pte);
65 }
66
67 return new_pgd;
68
69no_pte:
70 pmd_free(new_pmd);
71no_pmd:
72 free_pages((unsigned long)new_pgd, 2);
73no_pgd:
74 return NULL;
75}
76
77void free_pgd_slow(pgd_t *pgd)
78{
79 pmd_t *pmd;
80 struct page *pte;
81
82 if (!pgd)
83 return;
84
85 /* pgd is always present and good */
86 pmd = pmd_off(pgd, 0);
87 if (pmd_none(*pmd))
88 goto free;
89 if (pmd_bad(*pmd)) {
90 pmd_ERROR(*pmd);
91 pmd_clear(pmd);
92 goto free;
93 }
94
95 pte = pmd_page(*pmd);
96 pmd_clear(pmd);
97 dec_zone_page_state(virt_to_page((unsigned long *)pgd), NR_PAGETABLE);
98 pte_lock_deinit(pte);
99 pte_free(pte);
100 pmd_free(pmd);
101free:
102 free_pages((unsigned long) pgd, 2);
103}