2 * linux/include/asm-arm/proc-armo/pgtable.h
4 * Copyright (C) 1995-2001 Russell King
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.
10 * 18-Oct-1997 RMK Now two-level (32x32)
12 #ifndef __ASM_PROC_PGTABLE_H
13 #define __ASM_PROC_PGTABLE_H
16 * entries per page directory level: they are two-level, so
17 * we don't really have any PMD directory.
19 #define PTRS_PER_PTE 32
20 #define PTRS_PER_PMD 1
21 #define PTRS_PER_PGD 32
24 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
25 * area for the same reason. ;)
27 #define VMALLOC_START 0x01a00000
28 #define VMALLOC_VMADDR(x) ((unsigned long)(x))
29 #define VMALLOC_END 0x01c00000
31 #define _PAGE_TABLE (0x01)
33 #define pmd_bad(pmd) ((pmd_val(pmd) & 0xfc000002))
34 #define set_pmd(pmdp,pmd) ((*(pmdp)) = (pmd))
36 static inline pmd_t __mk_pmd(pte_t *ptep, unsigned long prot)
38 unsigned long pte_ptr = (unsigned long)ptep;
41 pmd_val(pmd) = __virt_to_phys(pte_ptr) | prot;
46 static inline unsigned long pmd_page(pmd_t pmd)
48 return __phys_to_virt(pmd_val(pmd) & ~_PAGE_TABLE);
51 #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))
53 #define _PAGE_PRESENT 0x01
54 #define _PAGE_READONLY 0x02
55 #define _PAGE_NOT_USER 0x04
56 #define _PAGE_OLD 0x08
57 #define _PAGE_CLEAN 0x10
59 /* -- present -- -- !dirty -- --- !write --- ---- !user --- */
60 #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_CLEAN | _PAGE_READONLY | _PAGE_NOT_USER)
61 #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_CLEAN )
62 #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_CLEAN | _PAGE_READONLY )
63 #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_CLEAN | _PAGE_READONLY )
64 #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_NOT_USER)
66 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_OLD | _PAGE_CLEAN)
70 * The following only work if pte_present() is true.
71 * Undefined behaviour if not..
73 #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
74 #define pte_read(pte) (!(pte_val(pte) & _PAGE_NOT_USER))
75 #define pte_write(pte) (!(pte_val(pte) & _PAGE_READONLY))
76 #define pte_exec(pte) (!(pte_val(pte) & _PAGE_NOT_USER))
77 #define pte_dirty(pte) (!(pte_val(pte) & _PAGE_CLEAN))
78 #define pte_young(pte) (!(pte_val(pte) & _PAGE_OLD))
80 static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_READONLY; return pte; }
81 static inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) |= _PAGE_NOT_USER; return pte; }
82 static inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) |= _PAGE_NOT_USER; return pte; }
83 static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) |= _PAGE_CLEAN; return pte; }
84 static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) |= _PAGE_OLD; return pte; }
86 static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_READONLY; return pte; }
87 static inline pte_t pte_mkread(pte_t pte) { pte_val(pte) &= ~_PAGE_NOT_USER; return pte; }
88 static inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_NOT_USER; return pte; }
89 static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) &= ~_PAGE_CLEAN; return pte; }
90 static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) &= ~_PAGE_OLD; return pte; }
92 #define pte_alloc_kernel pte_alloc
95 * We don't store cache state bits in the page table here.
97 #define pgprot_noncached(prot) (prot)
99 #endif /* __ASM_PROC_PGTABLE_H */