diff options
author | Mikael Starvik <mikael.starvik@axis.com> | 2005-07-27 14:44:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:26:01 -0400 |
commit | 5d01e6ce785884a5db5792cd2e5bb36fa82fe23c (patch) | |
tree | aec09f0c058a6750904b947733a6cc7033359447 /include/asm-cris/pgtable.h | |
parent | dcf1310b72149d016970c666539d4d73bb77c086 (diff) |
[PATCH] CRIS update: updates for 2.6.12
Patches to make CRIS work with 2.6.12.
Signed-off-by: Mikael Starvik <starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-cris/pgtable.h')
-rw-r--r-- | include/asm-cris/pgtable.h | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h index f7042944b073..a9143bed99db 100644 --- a/include/asm-cris/pgtable.h +++ b/include/asm-cris/pgtable.h | |||
@@ -5,7 +5,8 @@ | |||
5 | #ifndef _CRIS_PGTABLE_H | 5 | #ifndef _CRIS_PGTABLE_H |
6 | #define _CRIS_PGTABLE_H | 6 | #define _CRIS_PGTABLE_H |
7 | 7 | ||
8 | #include <asm-generic/4level-fixup.h> | 8 | #include <asm/page.h> |
9 | #include <asm-generic/pgtable-nopmd.h> | ||
9 | 10 | ||
10 | #ifndef __ASSEMBLY__ | 11 | #ifndef __ASSEMBLY__ |
11 | #include <linux/config.h> | 12 | #include <linux/config.h> |
@@ -41,22 +42,14 @@ extern void paging_init(void); | |||
41 | * but the define is needed for a generic inline function.) | 42 | * but the define is needed for a generic inline function.) |
42 | */ | 43 | */ |
43 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | 44 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) |
44 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) | 45 | #define set_pgu(pudptr, pudval) (*(pudptr) = pudval) |
45 | 46 | ||
46 | /* PMD_SHIFT determines the size of the area a second-level page table can | 47 | /* PGDIR_SHIFT determines the size of the area a second-level page table can |
47 | * map. It is equal to the page size times the number of PTE's that fit in | 48 | * map. It is equal to the page size times the number of PTE's that fit in |
48 | * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number. | 49 | * a PMD page. A PTE is 4-bytes in CRIS. Hence the following number. |
49 | */ | 50 | */ |
50 | 51 | ||
51 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2)) | 52 | #define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-2)) |
52 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
53 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
54 | |||
55 | /* PGDIR_SHIFT determines what a third-level page table entry can map. | ||
56 | * Since we fold into a two-level structure, this is the same as PMD_SHIFT. | ||
57 | */ | ||
58 | |||
59 | #define PGDIR_SHIFT PMD_SHIFT | ||
60 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 53 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
61 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 54 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
62 | 55 | ||
@@ -67,7 +60,6 @@ extern void paging_init(void); | |||
67 | * divide it by 4 (shift by 2). | 60 | * divide it by 4 (shift by 2). |
68 | */ | 61 | */ |
69 | #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2)) | 62 | #define PTRS_PER_PTE (1UL << (PAGE_SHIFT-2)) |
70 | #define PTRS_PER_PMD 1 | ||
71 | #define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2)) | 63 | #define PTRS_PER_PGD (1UL << (PAGE_SHIFT-2)) |
72 | 64 | ||
73 | /* calculate how many PGD entries a user-level program can use | 65 | /* calculate how many PGD entries a user-level program can use |
@@ -105,7 +97,7 @@ extern unsigned long empty_zero_page; | |||
105 | #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) | 97 | #define pte_present(x) (pte_val(x) & _PAGE_PRESENT) |
106 | #define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0) | 98 | #define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0) |
107 | 99 | ||
108 | #define pmd_none(x) (!pmd_val(x)) | 100 | #define pmd_none(x) (!pmd_val(x)) |
109 | /* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad | 101 | /* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad |
110 | * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries. | 102 | * works for both _PAGE_TABLE and _KERNPG_TABLE pmd entries. |
111 | */ | 103 | */ |
@@ -116,16 +108,6 @@ extern unsigned long empty_zero_page; | |||
116 | #ifndef __ASSEMBLY__ | 108 | #ifndef __ASSEMBLY__ |
117 | 109 | ||
118 | /* | 110 | /* |
119 | * The "pgd_xxx()" functions here are trivial for a folded two-level | ||
120 | * setup: the pgd is never bad, and a pmd always exists (as it's folded | ||
121 | * into the pgd entry) | ||
122 | */ | ||
123 | extern inline int pgd_none(pgd_t pgd) { return 0; } | ||
124 | extern inline int pgd_bad(pgd_t pgd) { return 0; } | ||
125 | extern inline int pgd_present(pgd_t pgd) { return 1; } | ||
126 | extern inline void pgd_clear(pgd_t * pgdp) { } | ||
127 | |||
128 | /* | ||
129 | * The following only work if pte_present() is true. | 111 | * The following only work if pte_present() is true. |
130 | * Undefined behaviour if not.. | 112 | * Undefined behaviour if not.. |
131 | */ | 113 | */ |
@@ -275,7 +257,7 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) | |||
275 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | 257 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
276 | 258 | ||
277 | /* to find an entry in a page-table-directory. */ | 259 | /* to find an entry in a page-table-directory. */ |
278 | #define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 260 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
279 | 261 | ||
280 | /* to find an entry in a page-table-directory */ | 262 | /* to find an entry in a page-table-directory */ |
281 | extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) | 263 | extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) |
@@ -286,12 +268,6 @@ extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) | |||
286 | /* to find an entry in a kernel page-table-directory */ | 268 | /* to find an entry in a kernel page-table-directory */ |
287 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | 269 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) |
288 | 270 | ||
289 | /* Find an entry in the second-level page table.. */ | ||
290 | extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | ||
291 | { | ||
292 | return (pmd_t *) dir; | ||
293 | } | ||
294 | |||
295 | /* Find an entry in the third-level page table.. */ | 271 | /* Find an entry in the third-level page table.. */ |
296 | #define __pte_offset(address) \ | 272 | #define __pte_offset(address) \ |
297 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 273 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
@@ -308,8 +284,6 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | |||
308 | 284 | ||
309 | #define pte_ERROR(e) \ | 285 | #define pte_ERROR(e) \ |
310 | printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) | 286 | printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) |
311 | #define pmd_ERROR(e) \ | ||
312 | printk("%s:%d: bad pmd %p(%08lx).\n", __FILE__, __LINE__, &(e), pmd_val(e)) | ||
313 | #define pgd_ERROR(e) \ | 287 | #define pgd_ERROR(e) \ |
314 | printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) | 288 | printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) |
315 | 289 | ||
@@ -348,5 +322,7 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, | |||
348 | #define pte_to_pgoff(x) (pte_val(x) >> 6) | 322 | #define pte_to_pgoff(x) (pte_val(x) >> 6) |
349 | #define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) | 323 | #define pgoff_to_pte(x) __pte(((x) << 6) | _PAGE_FILE) |
350 | 324 | ||
325 | typedef pte_t *pte_addr_t; | ||
326 | |||
351 | #endif /* __ASSEMBLY__ */ | 327 | #endif /* __ASSEMBLY__ */ |
352 | #endif /* _CRIS_PGTABLE_H */ | 328 | #endif /* _CRIS_PGTABLE_H */ |