diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-um/page.h | 6 | ||||
-rw-r--r-- | include/asm-um/pgtable-3level.h | 21 | ||||
-rw-r--r-- | include/asm-um/pgtable.h | 2 |
3 files changed, 24 insertions, 5 deletions
diff --git a/include/asm-um/page.h b/include/asm-um/page.h index 4b424c75fca5..fe2374d705d1 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h | |||
@@ -30,7 +30,7 @@ struct page; | |||
30 | #if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT) | 30 | #if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT) |
31 | 31 | ||
32 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | 32 | typedef struct { unsigned long pte_low, pte_high; } pte_t; |
33 | typedef struct { unsigned long long pmd; } pmd_t; | 33 | typedef struct { unsigned long pmd; } pmd_t; |
34 | typedef struct { unsigned long pgd; } pgd_t; | 34 | typedef struct { unsigned long pgd; } pgd_t; |
35 | #define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32)) | 35 | #define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32)) |
36 | 36 | ||
@@ -106,8 +106,8 @@ extern unsigned long uml_physmem; | |||
106 | #define __pa(virt) to_phys((void *) (unsigned long) (virt)) | 106 | #define __pa(virt) to_phys((void *) (unsigned long) (virt)) |
107 | #define __va(phys) to_virt((unsigned long) (phys)) | 107 | #define __va(phys) to_virt((unsigned long) (phys)) |
108 | 108 | ||
109 | #define phys_to_pfn(p) ((p) >> PAGE_SHIFT) | 109 | #define phys_to_pfn(p) ((pfn_t) ((p) >> PAGE_SHIFT)) |
110 | #define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) | 110 | #define pfn_to_phys(pfn) ((phys_t) ((pfn) << PAGE_SHIFT)) |
111 | 111 | ||
112 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 112 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
113 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) | 113 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) |
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); |
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index bec4840d30ea..62ab94a4f1b6 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h | |||
@@ -262,7 +262,7 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval) | |||
262 | 262 | ||
263 | #define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) | 263 | #define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) |
264 | #define __virt_to_page(virt) phys_to_page(__pa(virt)) | 264 | #define __virt_to_page(virt) phys_to_page(__pa(virt)) |
265 | #define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) | 265 | #define page_to_phys(page) pfn_to_phys((pfn_t) page_to_pfn(page)) |
266 | #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) | 266 | #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) |
267 | 267 | ||
268 | #define mk_pte(page, pgprot) \ | 268 | #define mk_pte(page, pgprot) \ |