* add p cc
[mascara-docs.git] / i386 / linux / linux-2.3.21 / arch / arm / mm / mm-armv.c
blob02890c55bd02b4c73d1747c8a35a20263f01d802
1 /*
2 * arch/arm/mm/mm-armv.c
4 * Common routines for ARM v3 and v4 architectures.
6 * Copyright (C) 1998 Russell King
8 * Do not compile this file directly!
9 */
11 #ifndef MAPPING
12 #error MAPPING not defined - do not compile this file individually
13 #endif
15 static const struct mapping {
16 unsigned long virtual;
17 unsigned long physical;
18 unsigned long length;
19 int domain:4,
20 prot_read:1,
21 prot_write:1;
22 } mapping[] __initdata = {
23 MAPPING
26 #define SIZEOFMAP (sizeof(mapping) / sizeof(mapping[0]))
28 unsigned long __init setup_io_pagetables(unsigned long start_mem)
30 const struct mapping *mp;
31 int i;
33 for (i = 0, mp = mapping; i < SIZEOFMAP; i++, mp++) {
34 unsigned long virtual, physical, length;
35 int prot;
37 virtual = mp->virtual;
38 physical = mp->physical;
39 length = mp->length;
40 prot = (mp->prot_read ? L_PTE_USER : 0) | (mp->prot_write ? L_PTE_WRITE : 0)
41 | L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY;
43 while ((virtual & 1048575 || physical & 1048575) && length >= PAGE_SIZE) {
44 alloc_init_page(&start_mem, virtual, physical, mp->domain, prot);
45 length -= PAGE_SIZE;
46 virtual += PAGE_SIZE;
47 physical += PAGE_SIZE;
50 prot = (mp->prot_read ? PMD_SECT_AP_READ : 0) |
51 (mp->prot_write ? PMD_SECT_AP_WRITE : 0);
53 while (length >= 1048576) {
54 alloc_init_section(&start_mem, virtual, physical, mp->domain, prot);
55 length -= 1048576;
56 virtual += 1048576;
57 physical += 1048576;
60 prot = (mp->prot_read ? L_PTE_USER : 0) | (mp->prot_write ? L_PTE_WRITE : 0)
61 | L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY;
63 while (length >= PAGE_SIZE) {
64 alloc_init_page(&start_mem, virtual, physical, mp->domain, prot);
65 length -= PAGE_SIZE;
66 virtual += PAGE_SIZE;
67 physical += PAGE_SIZE;
71 return start_mem;