Go to the documentation of this file. 1 #ifndef _ASM_SCORE_PGTABLE_H
2 #define _ASM_SCORE_PGTABLE_H
4 #include <linux/const.h>
7 #include <asm/fixmap.h>
9 #include <asm/pgtable-bits.h>
11 extern void load_pgd(
unsigned long pg_dir);
15 #define PGDIR_SHIFT 22
16 #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT)
17 #define PGDIR_MASK (~(PGDIR_SIZE - 1))
26 #define PTRS_PER_PGD 1024
27 #define PTRS_PER_PTE 1024
29 #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
30 #define FIRST_USER_ADDRESS 0
32 #define VMALLOC_START (0xc0000000UL)
34 #define PKMAP_BASE (0xfd000000UL)
36 #define VMALLOC_END (FIXADDR_START - 2*PAGE_SIZE)
38 #define pte_ERROR(e) \
39 printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \
40 __FILE__, __LINE__, pte_val(e))
41 #define pgd_ERROR(e) \
42 printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \
43 __FILE__, __LINE__, pgd_val(e))
53 #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
65 #define pte_page(x) pfn_to_page(pte_pfn(x))
66 #define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT))
67 #define pfn_pte(pfn, prot) \
68 __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
70 #define __pgd_offset(address) pgd_index(address)
71 #define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
72 #define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
75 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
76 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
79 #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
82 #define __pte_offset(address) \
83 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
84 #define pte_offset(dir, address) \
85 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
86 #define pte_offset_kernel(dir, address) \
87 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
89 #define pte_offset_map(dir, address) \
90 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
91 #define pte_unmap(pte) ((void)(pte))
97 #define PTE_FILE_MAX_BITS 30
98 #define pte_to_pgoff(_pte) \
99 (((_pte).pte & 0x1ff) | (((_pte).pte >> 11) << 9))
100 #define pgoff_to_pte(off) \
101 ((pte_t) {((off) & 0x1ff) | (((off) >> 9) << 11) | _PAGE_FILE})
102 #define __pte_to_swp_entry(pte) \
103 ((swp_entry_t) { pte_val(pte)})
104 #define __swp_entry_to_pte(x) ((pte_t) {(x).val})
106 #define pmd_phys(pmd) __pa((void *)pmd_val(pmd))
107 #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
108 #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
111 #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
112 #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
113 #define pte_clear(mm, addr, xp) \
114 do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
116 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
117 remap_pfn_range(vma, vaddr, pfn, size, prot)
124 #define pgd_present(pgd) (1)
125 #define pgd_none(pgd) (0)
126 #define pgd_bad(pgd) (0)
127 #define pgd_clear(pgdp) do { } while (0)
129 #define kern_addr_valid(addr) (1)
130 #define pmd_page_vaddr(pmd) pmd_val(pmd)
132 #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
133 #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
135 #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_CACHE)
136 #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
138 #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_CACHE)
139 #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_CACHE)
140 #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
141 _PAGE_GLOBAL | _PAGE_CACHE)
142 #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \
143 __WRITEABLE | _PAGE_GLOBAL & ~_PAGE_CACHE)
145 #define __P000 PAGE_NONE
146 #define __P001 PAGE_READONLY
147 #define __P010 PAGE_COPY
148 #define __P011 PAGE_COPY
149 #define __P100 PAGE_READONLY
150 #define __P101 PAGE_READONLY
151 #define __P110 PAGE_COPY
152 #define __P111 PAGE_COPY
154 #define __S000 PAGE_NONE
155 #define __S001 PAGE_READONLY
156 #define __S010 PAGE_SHARED
157 #define __S011 PAGE_SHARED
158 #define __S100 PAGE_READONLY
159 #define __S101 PAGE_READONLY
160 #define __S110 PAGE_SHARED
161 #define __S111 PAGE_SHARED
163 #define pgprot_noncached pgprot_noncached
174 #define __swp_type(x) ((x).val & 0x1f)
175 #define __swp_offset(x) ((x).val >> 11)
176 #define __swp_entry(type, offset) ((swp_entry_t){(type) | ((offset) << 11)})
181 #define ZERO_PAGE(vaddr) \
182 (virt_to_page((void *)(empty_zero_page + \
183 (((unsigned long)(vaddr)) & zero_page_mask))))
185 #define pgtable_cache_init() do {} while (0)
187 #define arch_enter_lazy_cpu_mode() do {} while (0)
209 #define pte_special(pte) (0)
253 #define set_pmd(pmdptr, pmdval) \
254 do { *(pmdptr) = (pmdval); } while (0)
255 #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)