1 |
1276 |
phoenix |
/* or32 pgtable.h - macros and functions to manipulate page tables
|
2 |
|
|
*
|
3 |
|
|
* Based on:
|
4 |
|
|
* include/asm-cris/pgtable.h
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
#ifndef _OR32_PGTABLE_H
|
8 |
|
|
#define _OR32_PGTABLE_H
|
9 |
|
|
|
10 |
|
|
#include <linux/config.h>
|
11 |
|
|
|
12 |
|
|
#ifndef __ASSEMBLY__
|
13 |
|
|
#include <asm/mmu.h>
|
14 |
|
|
|
15 |
|
|
/*
|
16 |
|
|
* The Linux memory management assumes a three-level page table setup. On
|
17 |
|
|
* or32, we use that, but "fold" the mid level into the top-level page
|
18 |
|
|
* table. Since the MMU TLB is software loaded through an interrupt, it
|
19 |
|
|
* supports any page table structure, so we could have used a three-level
|
20 |
|
|
* setup, but for the amounts of memory we normally use, a two-level is
|
21 |
|
|
* probably more efficient.
|
22 |
|
|
*
|
23 |
|
|
* This file contains the functions and defines necessary to modify and use
|
24 |
|
|
* the or32 page table tree.
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
extern void paging_init(void);
|
28 |
|
|
|
29 |
|
|
/* The cache doesn't need to be flushed when TLB entries change because
|
30 |
|
|
* the cache is mapped to physical memory, not virtual memory
|
31 |
|
|
*/
|
32 |
|
|
#define flush_cache_all() do { } while (0)
|
33 |
|
|
#define flush_cache_mm(mm) do { } while (0)
|
34 |
|
|
#define flush_cache_range(mm, start, end) do { } while (0)
|
35 |
|
|
#define flush_cache_page(vma, vmaddr) do { } while (0)
|
36 |
|
|
#define flush_page_to_ram(page) do { } while (0)
|
37 |
|
|
#define flush_dcache_page(page) do { } while (0)
|
38 |
|
|
#define flush_icache_range(start, end) do { } while (0)
|
39 |
|
|
#define flush_icache_page(vma,pg) do { } while (0)
|
40 |
|
|
#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
|
41 |
|
|
|
42 |
|
|
extern void flush_tlb_all(void);
|
43 |
|
|
extern void flush_tlb_mm(struct mm_struct *mm);
|
44 |
|
|
extern void flush_tlb_page(struct vm_area_struct *vma,
|
45 |
|
|
unsigned long addr);
|
46 |
|
|
extern void flush_tlb_range(struct mm_struct *mm,
|
47 |
|
|
unsigned long start,
|
48 |
|
|
unsigned long end);
|
49 |
|
|
|
50 |
|
|
static inline void flush_tlb_pgtables(struct mm_struct *mm,
|
51 |
|
|
unsigned long start, unsigned long end)
|
52 |
|
|
{
|
53 |
|
|
/* or32 does not keep any page table caches in TLB */
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
static inline void flush_tlb(void)
|
58 |
|
|
{
|
59 |
|
|
flush_tlb_mm(current->mm);
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
/* Certain architectures need to do special things when pte's
|
63 |
|
|
* within a page table are directly modified. Thus, the following
|
64 |
|
|
* hook is made available.
|
65 |
|
|
*/
|
66 |
|
|
#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))
|
67 |
|
|
/*
|
68 |
|
|
* (pmds are folded into pgds so this doesn't get actually called,
|
69 |
|
|
* but the define is needed for a generic inline function.)
|
70 |
|
|
*/
|
71 |
|
|
#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
|
72 |
|
|
#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
|
73 |
|
|
|
74 |
|
|
/* PMD_SHIFT determines the size of the area a second-level page table can
|
75 |
|
|
* map. It is equal to the page size times the number of PTE's that fit in
|
76 |
|
|
* a PMD page. A PTE is 4-bytes in or32. Hence the following number.
|
77 |
|
|
*/
|
78 |
|
|
|
79 |
|
|
#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2))
|
80 |
|
|
#define PMD_SIZE (1UL << PMD_SHIFT)
|
81 |
|
|
#define PMD_MASK (~(PMD_SIZE-1))
|
82 |
|
|
|
83 |
|
|
/* PGDIR_SHIFT determines what a third-level page table entry can map.
|
84 |
|
|
* Since we fold into a two-level structure, this is the same as PMD_SHIFT.
|
85 |
|
|
*/
|
86 |
|
|
|
87 |
|
|
#define PGDIR_SHIFT PMD_SHIFT
|
88 |
|
|
#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
|
89 |
|
|
#define PGDIR_MASK (~(PGDIR_SIZE-1))
|
90 |
|
|
|
91 |
|
|
/*
|
92 |
|
|
* entries per page directory level: we use a two-level, so
|
93 |
|
|
* we don't really have any PMD directory physically.
|
94 |
|
|
* pointers are 4 bytes so we can use the page size and
|
95 |
|
|
* divide it by 4 (shift by 2).
|
96 |
|
|
*/
|
97 |
|
|
#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2))
|
98 |
|
|
#define PTRS_PER_PMD 1
|
99 |
|
|
#define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2))
|
100 |
|
|
|
101 |
|
|
/* calculate how many PGD entries a user-level program can use
|
102 |
|
|
* the first mappable virtual address is 0
|
103 |
|
|
* (TASK_SIZE is the maximum virtual address space)
|
104 |
|
|
*/
|
105 |
|
|
|
106 |
|
|
#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
|
107 |
|
|
#define FIRST_USER_PGD_NR 0
|
108 |
|
|
|
109 |
|
|
/*
|
110 |
|
|
* Kernels own virtual memory area.
|
111 |
|
|
*/
|
112 |
|
|
|
113 |
|
|
#define VMALLOC_START 0xd0000000
|
114 |
|
|
#define VMALLOC_VMADDR(x) ((unsigned long)(x))
|
115 |
|
|
#define VMALLOC_END 0xe0000000
|
116 |
|
|
|
117 |
|
|
/* Define some higher level generic page attributes.
|
118 |
|
|
*/
|
119 |
|
|
|
120 |
|
|
#define _PAGE_CC 0x001 /* software: pte contains a translation */
|
121 |
|
|
#define _PAGE_CI 0x002 /* cache inhibit */
|
122 |
|
|
#define _PAGE_WBC 0x004 /* write back cache */
|
123 |
|
|
#define _PAGE_WOM 0x008 /* weakly ordered memory */
|
124 |
|
|
|
125 |
|
|
#define _PAGE_A 0x010 /* accessed */
|
126 |
|
|
#define _PAGE_D 0x020 /* dirty */
|
127 |
|
|
#define _PAGE_URE 0x040 /* user read enable */
|
128 |
|
|
#define _PAGE_UWE 0x080 /* user write enable */
|
129 |
|
|
|
130 |
|
|
#define _PAGE_SRE 0x100 /* superuser read enable */
|
131 |
|
|
#define _PAGE_SWE 0x200 /* superuser write enable */
|
132 |
|
|
#define _PAGE_EXEC 0x400 /* software: page is executable */
|
133 |
|
|
#define _PAGE_U_SHARED 0x800 /* software: page is shared in user space */
|
134 |
|
|
|
135 |
|
|
/* 0x001 is cache coherency bit, which should always be set to
|
136 |
|
|
* 1 - for SMP (when we support it)
|
137 |
|
|
* 0 - otherwise
|
138 |
|
|
*
|
139 |
|
|
* we just reuse this bit in software for _PAGE_PRESENT and
|
140 |
|
|
* force it to 0 when loading it into TLB.
|
141 |
|
|
*/
|
142 |
|
|
#define _PAGE_PRESENT _PAGE_CC
|
143 |
|
|
#define _PAGE_USER _PAGE_URE
|
144 |
|
|
#define _PAGE_WRITE (_PAGE_UWE | _PAGE_SWE)
|
145 |
|
|
#define _PAGE_DIRTY _PAGE_D
|
146 |
|
|
#define _PAGE_ACCESSED _PAGE_A
|
147 |
|
|
#define _PAGE_NO_CACHE _PAGE_CI
|
148 |
|
|
#define _PAGE_SHARED _PAGE_U_SHARED
|
149 |
|
|
#define _PAGE_READ (_PAGE_URE | _PAGE_SRE)
|
150 |
|
|
|
151 |
|
|
#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
|
152 |
|
|
#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED)
|
153 |
|
|
#define _PAGE_ALL (_PAGE_PRESENT | _PAGE_ACCESSED)
|
154 |
|
|
#define _KERNPG_TABLE (_PAGE_BASE | _PAGE_SRE | _PAGE_SWE | _PAGE_ACCESSED | _PAGE_DIRTY)
|
155 |
|
|
|
156 |
|
|
#define PAGE_NONE __pgprot(_PAGE_ALL)
|
157 |
|
|
#define PAGE_READONLY __pgprot(_PAGE_ALL | _PAGE_URE | _PAGE_SRE )
|
158 |
|
|
#define PAGE_READONLY_X __pgprot(_PAGE_ALL | _PAGE_URE | _PAGE_SRE | _PAGE_EXEC)
|
159 |
|
|
#define PAGE_SHARED __pgprot(_PAGE_ALL | _PAGE_URE | _PAGE_SRE | _PAGE_UWE | _PAGE_SWE | _PAGE_SHARED)
|
160 |
|
|
#define PAGE_SHARED_X __pgprot(_PAGE_ALL | _PAGE_URE | _PAGE_SRE | _PAGE_UWE | _PAGE_SWE | _PAGE_SHARED | _PAGE_EXEC)
|
161 |
|
|
#define PAGE_COPY __pgprot(_PAGE_ALL | _PAGE_URE | _PAGE_SRE )
|
162 |
|
|
#define PAGE_COPY_X __pgprot(_PAGE_ALL | _PAGE_URE | _PAGE_SRE | _PAGE_EXEC)
|
163 |
|
|
|
164 |
|
|
#define PAGE_KERNEL __pgprot(_PAGE_ALL | _PAGE_SRE | _PAGE_SWE | _PAGE_SHARED | _PAGE_DIRTY | _PAGE_EXEC)
|
165 |
|
|
|
166 |
|
|
#define __P000 PAGE_NONE
|
167 |
|
|
#define __P001 PAGE_READONLY_X
|
168 |
|
|
#define __P010 PAGE_COPY
|
169 |
|
|
#define __P011 PAGE_COPY_X
|
170 |
|
|
#define __P100 PAGE_READONLY
|
171 |
|
|
#define __P101 PAGE_READONLY_X
|
172 |
|
|
#define __P110 PAGE_COPY
|
173 |
|
|
#define __P111 PAGE_COPY_X
|
174 |
|
|
|
175 |
|
|
#define __S000 PAGE_NONE
|
176 |
|
|
#define __S001 PAGE_READONLY_X
|
177 |
|
|
#define __S010 PAGE_SHARED
|
178 |
|
|
#define __S011 PAGE_SHARED_X
|
179 |
|
|
#define __S100 PAGE_READONLY
|
180 |
|
|
#define __S101 PAGE_READONLY_X
|
181 |
|
|
#define __S110 PAGE_SHARED
|
182 |
|
|
#define __S111 PAGE_SHARED_X
|
183 |
|
|
|
184 |
|
|
/* zero page used for uninitialized stuff */
|
185 |
|
|
extern unsigned long empty_zero_page[2048];
|
186 |
|
|
#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
|
187 |
|
|
|
188 |
|
|
/* number of bits that fit into a memory pointer */
|
189 |
|
|
#define BITS_PER_PTR (8*sizeof(unsigned long))
|
190 |
|
|
|
191 |
|
|
/* to align the pointer to a pointer address */
|
192 |
|
|
#define PTR_MASK (~(sizeof(void*)-1))
|
193 |
|
|
|
194 |
|
|
/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
|
195 |
|
|
/* 64-bit machines, beware! SRB. */
|
196 |
|
|
#define SIZEOF_PTR_LOG2 2
|
197 |
|
|
|
198 |
|
|
/* to find an entry in a page-table */
|
199 |
|
|
#define PAGE_PTR(address) \
|
200 |
|
|
((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
|
201 |
|
|
|
202 |
|
|
/* to set the page-dir */
|
203 |
|
|
#define SET_PAGE_DIR(tsk,pgdir)
|
204 |
|
|
|
205 |
|
|
#define pte_none(x) (!pte_val(x))
|
206 |
|
|
#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
|
207 |
|
|
#define pte_clear(xp) do { pte_val(*(xp)) = 0; } while (0)
|
208 |
|
|
|
209 |
|
|
#define pmd_none(x) (!pmd_val(x))
|
210 |
|
|
#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK)) != 0)
|
211 |
|
|
#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
|
212 |
|
|
#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0)
|
213 |
|
|
|
214 |
|
|
/*
|
215 |
|
|
* The "pgd_xxx()" functions here are trivial for a folded two-level
|
216 |
|
|
* setup: the pgd is never bad, and a pmd always exists (as it's folded
|
217 |
|
|
* into the pgd entry)
|
218 |
|
|
*/
|
219 |
|
|
static inline int pgd_none(pgd_t pgd) { return 0; }
|
220 |
|
|
static inline int pgd_bad(pgd_t pgd) { return 0; }
|
221 |
|
|
static inline int pgd_present(pgd_t pgd) { return 1; }
|
222 |
|
|
static inline void pgd_clear(pgd_t * pgdp) { }
|
223 |
|
|
|
224 |
|
|
/*
|
225 |
|
|
* The following only work if pte_present() is true.
|
226 |
|
|
* Undefined behaviour if not..
|
227 |
|
|
*/
|
228 |
|
|
|
229 |
|
|
static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
|
230 |
|
|
static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
|
231 |
|
|
static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
|
232 |
|
|
static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
|
233 |
|
|
static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
|
234 |
|
|
|
235 |
|
|
static inline pte_t pte_wrprotect(pte_t pte)
|
236 |
|
|
{
|
237 |
|
|
pte_val(pte) &= ~(_PAGE_WRITE);
|
238 |
|
|
return pte;
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
static inline pte_t pte_rdprotect(pte_t pte)
|
242 |
|
|
{
|
243 |
|
|
pte_val(pte) &= ~(_PAGE_READ);
|
244 |
|
|
return pte;
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
static inline pte_t pte_exprotect(pte_t pte)
|
248 |
|
|
{
|
249 |
|
|
pte_val(pte) &= ~(_PAGE_EXEC);
|
250 |
|
|
return pte;
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
static inline pte_t pte_mkclean(pte_t pte)
|
254 |
|
|
{
|
255 |
|
|
pte_val(pte) &= ~(_PAGE_DIRTY);
|
256 |
|
|
return pte;
|
257 |
|
|
}
|
258 |
|
|
|
259 |
|
|
static inline pte_t pte_mkold(pte_t pte)
|
260 |
|
|
{
|
261 |
|
|
pte_val(pte) &= ~(_PAGE_ACCESSED);
|
262 |
|
|
return pte;
|
263 |
|
|
}
|
264 |
|
|
|
265 |
|
|
static inline pte_t pte_mkwrite(pte_t pte)
|
266 |
|
|
{
|
267 |
|
|
pte_val(pte) |= _PAGE_WRITE;
|
268 |
|
|
return pte;
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
static inline pte_t pte_mkread(pte_t pte)
|
272 |
|
|
{
|
273 |
|
|
pte_val(pte) |= _PAGE_READ;
|
274 |
|
|
return pte;
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
static inline pte_t pte_mkexec(pte_t pte)
|
278 |
|
|
{
|
279 |
|
|
pte_val(pte) |= _PAGE_EXEC;
|
280 |
|
|
return pte;
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
static inline pte_t pte_mkdirty(pte_t pte)
|
284 |
|
|
{
|
285 |
|
|
pte_val(pte) |= _PAGE_DIRTY;
|
286 |
|
|
return pte;
|
287 |
|
|
}
|
288 |
|
|
|
289 |
|
|
static inline pte_t pte_mkyoung(pte_t pte)
|
290 |
|
|
{
|
291 |
|
|
pte_val(pte) |= _PAGE_ACCESSED;
|
292 |
|
|
return pte;
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
/*
|
296 |
|
|
* Conversion functions: convert a page and protection to a page entry,
|
297 |
|
|
* and a page entry and page directory to the page they refer to.
|
298 |
|
|
*/
|
299 |
|
|
|
300 |
|
|
/* What actually goes as arguments to the various functions is less than
|
301 |
|
|
* obvious, but a rule of thumb is that struct page's goes as struct page *,
|
302 |
|
|
* really physical DRAM addresses are unsigned long's, and DRAM "virtual"
|
303 |
|
|
* addresses (the 0xc0xxxxxx's) goes as void *'s.
|
304 |
|
|
*/
|
305 |
|
|
|
306 |
|
|
static inline pte_t __mk_pte(void * page, pgprot_t pgprot)
|
307 |
|
|
{
|
308 |
|
|
pte_t pte;
|
309 |
|
|
/* the PTE needs a physical address */
|
310 |
|
|
pte_val(pte) = __pa(page) | pgprot_val(pgprot);
|
311 |
|
|
return pte;
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
#define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot))
|
315 |
|
|
|
316 |
|
|
#define mk_pte_phys(physpage, pgprot) \
|
317 |
|
|
({ \
|
318 |
|
|
pte_t __pte; \
|
319 |
|
|
\
|
320 |
|
|
pte_val(__pte) = (physpage) + pgprot_val(pgprot); \
|
321 |
|
|
__pte; \
|
322 |
|
|
})
|
323 |
|
|
|
324 |
|
|
static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
|
325 |
|
|
{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; }
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
/* pte_val refers to a page in the 0x0xxxxxxx physical DRAM interval
|
329 |
|
|
* __pte_page(pte_val) refers to the "virtual" DRAM interval
|
330 |
|
|
* pte_pagenr refers to the page-number counted starting from the virtual DRAM start
|
331 |
|
|
*/
|
332 |
|
|
|
333 |
|
|
static inline unsigned long __pte_page(pte_t pte)
|
334 |
|
|
{
|
335 |
|
|
/* the PTE contains a physical address */
|
336 |
|
|
return (unsigned long)__va(pte_val(pte) & PAGE_MASK);
|
337 |
|
|
}
|
338 |
|
|
|
339 |
|
|
#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)
|
340 |
|
|
|
341 |
|
|
/* permanent address of a page */
|
342 |
|
|
|
343 |
|
|
#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
|
344 |
|
|
#define pte_page(pte) (mem_map+pte_pagenr(pte))
|
345 |
|
|
|
346 |
|
|
/* only the pte's themselves need to point to physical DRAM (see above)
|
347 |
|
|
* the pagetable links are purely handled within the kernel SW and thus
|
348 |
|
|
* don't need the __pa and __va transformations.
|
349 |
|
|
*/
|
350 |
|
|
#define page_pte(page) page_pte_prot(page, __pgprot(0))
|
351 |
|
|
|
352 |
|
|
#define pmd_page(pmd) \
|
353 |
|
|
((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
|
354 |
|
|
|
355 |
|
|
/* to find an entry in a page-table-directory. */
|
356 |
|
|
#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
|
357 |
|
|
|
358 |
|
|
#define __pgd_offset(address) pgd_index(address)
|
359 |
|
|
|
360 |
|
|
#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
|
361 |
|
|
|
362 |
|
|
/* to find an entry in a kernel page-table-directory */
|
363 |
|
|
#define pgd_offset_k(address) pgd_offset(&init_mm, address)
|
364 |
|
|
|
365 |
|
|
#define __pmd_offset(address) \
|
366 |
|
|
(((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
|
367 |
|
|
|
368 |
|
|
static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
|
369 |
|
|
{
|
370 |
|
|
return (pmd_t *) dir;
|
371 |
|
|
}
|
372 |
|
|
|
373 |
|
|
/* Find an entry in the third-level page table.. */
|
374 |
|
|
#define __pte_offset(address) \
|
375 |
|
|
((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
|
376 |
|
|
|
377 |
|
|
#define pte_offset(dir, address) ((pte_t *) pmd_page(*(dir)) + \
|
378 |
|
|
__pte_offset(address))
|
379 |
|
|
|
380 |
|
|
#define pte_ERROR(e) \
|
381 |
|
|
printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e))
|
382 |
|
|
#define pmd_ERROR(e) \
|
383 |
|
|
printk("%s:%d: bad pmd %p(%08lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
|
384 |
|
|
#define pgd_ERROR(e) \
|
385 |
|
|
printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
|
386 |
|
|
|
387 |
|
|
extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */
|
388 |
|
|
|
389 |
|
|
/*
|
390 |
|
|
* or32 doesn't have any external MMU info: the kernel page
|
391 |
|
|
* tables contain all the necessary information.
|
392 |
|
|
*
|
393 |
|
|
* Actually I am not sure on what this could be used for.
|
394 |
|
|
*/
|
395 |
|
|
static inline void update_mmu_cache(struct vm_area_struct * vma,
|
396 |
|
|
unsigned long address, pte_t pte)
|
397 |
|
|
{
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
#define __pgd_offset(address) pgd_index(address)
|
401 |
|
|
|
402 |
|
|
#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
|
403 |
|
|
|
404 |
|
|
/* to find an entry in a kernel page-table-directory */
|
405 |
|
|
#define pgd_offset_k(address) pgd_offset(&init_mm, address)
|
406 |
|
|
|
407 |
|
|
#define __pmd_offset(address) \
|
408 |
|
|
(((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
|
409 |
|
|
|
410 |
|
|
/* Find an entry in the third-level page table.. */
|
411 |
|
|
#define __pte_offset(address) \
|
412 |
|
|
((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
|
413 |
|
|
|
414 |
|
|
#define pte_offset(dir, address) ((pte_t *) pmd_page(*(dir)) + \
|
415 |
|
|
__pte_offset(address))
|
416 |
|
|
|
417 |
|
|
|
418 |
|
|
/* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */
|
419 |
|
|
/* Since the PAGE_PRESENT bit is bit 4, we can use the bits above */
|
420 |
|
|
|
421 |
|
|
#define SWP_TYPE(x) (((x).val >> 5) & 0x7f)
|
422 |
|
|
#define SWP_OFFSET(x) ((x).val >> 12)
|
423 |
|
|
#define SWP_ENTRY(type, offset) ((swp_entry_t) { ((type) << 5) | ((offset) << 12) })
|
424 |
|
|
#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
|
425 |
|
|
#define swp_entry_to_pte(x) ((pte_t) { (x).val })
|
426 |
|
|
|
427 |
|
|
/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
|
428 |
|
|
#define PageSkip(page) (0)
|
429 |
|
|
#define kern_addr_valid(addr) (1)
|
430 |
|
|
|
431 |
|
|
#include <asm-generic/pgtable.h>
|
432 |
|
|
|
433 |
|
|
/*
|
434 |
|
|
* No page table caches to initialise
|
435 |
|
|
*/
|
436 |
|
|
#define pgtable_cache_init() do { } while (0)
|
437 |
|
|
|
438 |
|
|
#endif /* __ASSEMBLY__ */
|
439 |
|
|
#endif /* _OR32_PGTABLE_H */
|