diff options
author | Jeff Dike <jdike@addtoit.com> | 2008-02-05 01:30:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:28 -0500 |
commit | 655e4ed0c521dcfdbf1c5a79da971560e6733527 (patch) | |
tree | 8b0cf794410c9e632b9ee65b8e0750621d9c96ce /include/asm-um/pgtable-3level.h | |
parent | a5a678c80beac4d163babda243a27eeb9c89bd89 (diff) |
uml: fix page table data sizes
Get the sizes of various pieces of data right when using three-level
page tables. pgd and pmd entries remain at 32 bits in a 32-bit
compilation because page tables will remain in low memory. So,
PGDIR_SHIFT, the PTRS_PER_* values, set_pud, set_pmd are conditional
on 64BIT.
More use of phys_t is made when there are physical memory addresses
floating around.
ObCheckpatchViolationJustification - the new typedef is an alternate
definition of pmd_t, which I can't really live without.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-um/pgtable-3level.h')
-rw-r--r-- | include/asm-um/pgtable-3level.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index e0b6c16a3a41..48f8f5d96d20 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h | |||
@@ -11,7 +11,11 @@ | |||
11 | 11 | ||
12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | 12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ |
13 | 13 | ||
14 | #ifdef CONFIG_64BIT | ||
14 | #define PGDIR_SHIFT 30 | 15 | #define PGDIR_SHIFT 30 |
16 | #else | ||
17 | #define PGDIR_SHIFT 31 | ||
18 | #endif | ||
15 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 19 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
16 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 20 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
17 | 21 | ||
@@ -28,9 +32,15 @@ | |||
28 | */ | 32 | */ |
29 | 33 | ||
30 | #define PTRS_PER_PTE 512 | 34 | #define PTRS_PER_PTE 512 |
35 | #ifdef CONFIG_64BIT | ||
31 | #define PTRS_PER_PMD 512 | 36 | #define PTRS_PER_PMD 512 |
32 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
33 | #define PTRS_PER_PGD 512 | 37 | #define PTRS_PER_PGD 512 |
38 | #else | ||
39 | #define PTRS_PER_PMD 1024 | ||
40 | #define PTRS_PER_PGD 1024 | ||
41 | #endif | ||
42 | |||
43 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
34 | #define FIRST_USER_ADDRESS 0 | 44 | #define FIRST_USER_ADDRESS 0 |
35 | 45 | ||
36 | #define pte_ERROR(e) \ | 46 | #define pte_ERROR(e) \ |
@@ -49,7 +59,12 @@ | |||
49 | #define pud_populate(mm, pud, pmd) \ | 59 | #define pud_populate(mm, pud, pmd) \ |
50 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) | 60 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) |
51 | 61 | ||
62 | #ifdef CONFIG_64BIT | ||
52 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) | 63 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) |
64 | #else | ||
65 | #define set_pud(pudptr, pudval) (*(pudptr) = (pudval)) | ||
66 | #endif | ||
67 | |||
53 | static inline int pgd_newpage(pgd_t pgd) | 68 | static inline int pgd_newpage(pgd_t pgd) |
54 | { | 69 | { |
55 | return(pgd_val(pgd) & _PAGE_NEWPAGE); | 70 | return(pgd_val(pgd) & _PAGE_NEWPAGE); |
@@ -57,7 +72,11 @@ static inline int pgd_newpage(pgd_t pgd) | |||
57 | 72 | ||
58 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } | 73 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } |
59 | 74 | ||
75 | #ifdef CONFIG_64BIT | ||
60 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) | 76 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) |
77 | #else | ||
78 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) | ||
79 | #endif | ||
61 | 80 | ||
62 | struct mm_struct; | 81 | struct mm_struct; |
63 | extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); | 82 | extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); |