diff options
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/page.h | 42 | ||||
-rw-r--r-- | include/asm-mips/pgalloc.h | 19 | ||||
-rw-r--r-- | include/asm-mips/pgtable-32.h | 40 | ||||
-rw-r--r-- | include/asm-mips/pgtable-64.h | 55 | ||||
-rw-r--r-- | include/asm-mips/pgtable.h | 13 |
5 files changed, 101 insertions, 68 deletions
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 652b6d67a571..ee25a779bf49 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h | |||
@@ -87,22 +87,48 @@ static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | |||
87 | typedef struct { unsigned long pte; } pte_t; | 87 | typedef struct { unsigned long pte; } pte_t; |
88 | #define pte_val(x) ((x).pte) | 88 | #define pte_val(x) ((x).pte) |
89 | #endif | 89 | #endif |
90 | #define __pte(x) ((pte_t) { (x) } ) | ||
90 | 91 | ||
91 | typedef struct { unsigned long pmd; } pmd_t; | 92 | /* |
92 | typedef struct { unsigned long pgd; } pgd_t; | 93 | * For 3-level pagetables we defines these ourselves, for 2-level the |
93 | typedef struct { unsigned long pgprot; } pgprot_t; | 94 | * definitions are supplied by <asm-generic/pgtable-nopmd.h>. |
95 | */ | ||
96 | #ifdef CONFIG_64BIT | ||
94 | 97 | ||
98 | typedef struct { unsigned long pmd; } pmd_t; | ||
95 | #define pmd_val(x) ((x).pmd) | 99 | #define pmd_val(x) ((x).pmd) |
96 | #define pgd_val(x) ((x).pgd) | 100 | #define __pmd(x) ((pmd_t) { (x) } ) |
97 | #define pgprot_val(x) ((x).pgprot) | ||
98 | 101 | ||
99 | #define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t))) | 102 | #endif |
100 | 103 | ||
101 | #define __pte(x) ((pte_t) { (x) } ) | 104 | /* |
102 | #define __pmd(x) ((pmd_t) { (x) } ) | 105 | * Right now we don't support 4-level pagetables, so all pud-related |
106 | * definitions come from <asm-generic/pgtable-nopud.h>. | ||
107 | */ | ||
108 | |||
109 | /* | ||
110 | * Finall the top of the hierarchy, the pgd | ||
111 | */ | ||
112 | typedef struct { unsigned long pgd; } pgd_t; | ||
113 | #define pgd_val(x) ((x).pgd) | ||
103 | #define __pgd(x) ((pgd_t) { (x) } ) | 114 | #define __pgd(x) ((pgd_t) { (x) } ) |
115 | |||
116 | /* | ||
117 | * Manipulate page protection bits | ||
118 | */ | ||
119 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
120 | #define pgprot_val(x) ((x).pgprot) | ||
104 | #define __pgprot(x) ((pgprot_t) { (x) } ) | 121 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
105 | 122 | ||
123 | /* | ||
124 | * On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd | ||
125 | * pair of pages we only have a single global bit per pair of pages. When | ||
126 | * writing to the TLB make sure we always have the bit set for both pages | ||
127 | * or none. This macro is used to access the `buddy' of the pte we're just | ||
128 | * working on. | ||
129 | */ | ||
130 | #define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t))) | ||
131 | |||
106 | #endif /* !__ASSEMBLY__ */ | 132 | #endif /* !__ASSEMBLY__ */ |
107 | 133 | ||
108 | /* to align the pointer to the (next) page boundary */ | 134 | /* to align the pointer to the (next) page boundary */ |
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h index ce57288d43bd..fe1df572318b 100644 --- a/include/asm-mips/pgalloc.h +++ b/include/asm-mips/pgalloc.h | |||
@@ -26,10 +26,22 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
26 | } | 26 | } |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Initialize a new pmd table with invalid pointers. | ||
30 | */ | ||
31 | extern void pmd_init(unsigned long page, unsigned long pagetable); | ||
32 | |||
33 | #ifdef CONFIG_64BIT | ||
34 | |||
35 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) | ||
36 | { | ||
37 | set_pud(pud, __pud((unsigned long)pmd)); | ||
38 | } | ||
39 | #endif | ||
40 | |||
41 | /* | ||
29 | * Initialize a new pgd / pmd table with invalid pointers. | 42 | * Initialize a new pgd / pmd table with invalid pointers. |
30 | */ | 43 | */ |
31 | extern void pgd_init(unsigned long page); | 44 | extern void pgd_init(unsigned long page); |
32 | extern void pmd_init(unsigned long page, unsigned long pagetable); | ||
33 | 45 | ||
34 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 46 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
35 | { | 47 | { |
@@ -86,21 +98,18 @@ static inline void pte_free(struct page *pte) | |||
86 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) | 98 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) |
87 | 99 | ||
88 | #ifdef CONFIG_32BIT | 100 | #ifdef CONFIG_32BIT |
89 | #define pgd_populate(mm, pmd, pte) BUG() | ||
90 | 101 | ||
91 | /* | 102 | /* |
92 | * allocating and freeing a pmd is trivial: the 1-entry pmd is | 103 | * allocating and freeing a pmd is trivial: the 1-entry pmd is |
93 | * inside the pgd, so has no extra memory associated with it. | 104 | * inside the pgd, so has no extra memory associated with it. |
94 | */ | 105 | */ |
95 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) | ||
96 | #define pmd_free(x) do { } while (0) | 106 | #define pmd_free(x) do { } while (0) |
97 | #define __pmd_free_tlb(tlb,x) do { } while (0) | 107 | #define __pmd_free_tlb(tlb,x) do { } while (0) |
108 | |||
98 | #endif | 109 | #endif |
99 | 110 | ||
100 | #ifdef CONFIG_64BIT | 111 | #ifdef CONFIG_64BIT |
101 | 112 | ||
102 | #define pgd_populate(mm, pgd, pmd) set_pgd(pgd, __pgd(pmd)) | ||
103 | |||
104 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | 113 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) |
105 | { | 114 | { |
106 | pmd_t *pmd; | 115 | pmd_t *pmd; |
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h index 7fec93b76da9..8d66303eabc4 100644 --- a/include/asm-mips/pgtable-32.h +++ b/include/asm-mips/pgtable-32.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <asm/cachectl.h> | 17 | #include <asm/cachectl.h> |
18 | #include <asm/fixmap.h> | 18 | #include <asm/fixmap.h> |
19 | 19 | ||
20 | #include <asm-generic/pgtable-nopmd.h> | ||
21 | |||
20 | /* | 22 | /* |
21 | * - add_wired_entry() add a fixed TLB entry, and move wired register | 23 | * - add_wired_entry() add a fixed TLB entry, and move wired register |
22 | */ | 24 | */ |
@@ -42,35 +44,35 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
42 | */ | 44 | */ |
43 | 45 | ||
44 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ | 46 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ |
45 | #ifdef CONFIG_64BIT_PHYS_ADDR | ||
46 | #define PMD_SHIFT 21 | ||
47 | #else | ||
48 | #define PMD_SHIFT 22 | ||
49 | #endif | ||
50 | #define PMD_SIZE (1UL << PMD_SHIFT) | 47 | #define PMD_SIZE (1UL << PMD_SHIFT) |
51 | #define PMD_MASK (~(PMD_SIZE-1)) | 48 | #define PMD_MASK (~(PMD_SIZE-1)) |
52 | 49 | ||
53 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | 50 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ |
54 | #define PGDIR_SHIFT PMD_SHIFT | 51 | #ifdef CONFIG_64BIT_PHYS_ADDR |
52 | #define PGDIR_SHIFT 21 | ||
53 | #else | ||
54 | #define PGDIR_SHIFT 22 | ||
55 | #endif | ||
55 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 56 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
56 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 57 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
57 | 58 | ||
58 | /* | 59 | /* |
59 | * Entries per page directory level: we use two-level, so | 60 | * Entries per page directory level: we use two-level, so |
60 | * we don't really have any PMD directory physically. | 61 | * we don't really have any PUD/PMD directory physically. |
61 | */ | 62 | */ |
62 | #ifdef CONFIG_64BIT_PHYS_ADDR | 63 | #ifdef CONFIG_64BIT_PHYS_ADDR |
63 | #define PGD_ORDER 1 | 64 | #define PGD_ORDER 1 |
64 | #define PMD_ORDER 0 | 65 | #define PUD_ORDER aieeee_attempt_to_allocate_pud |
66 | #define PMD_ORDER 1 | ||
65 | #define PTE_ORDER 0 | 67 | #define PTE_ORDER 0 |
66 | #else | 68 | #else |
67 | #define PGD_ORDER 0 | 69 | #define PGD_ORDER 0 |
68 | #define PMD_ORDER 0 | 70 | #define PUD_ORDER aieeee_attempt_to_allocate_pud |
71 | #define PMD_ORDER 1 | ||
69 | #define PTE_ORDER 0 | 72 | #define PTE_ORDER 0 |
70 | #endif | 73 | #endif |
71 | 74 | ||
72 | #define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) | 75 | #define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) |
73 | #define PTRS_PER_PMD 1 | ||
74 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) | 76 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) |
75 | 77 | ||
76 | #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) | 78 | #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) |
@@ -91,8 +93,6 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
91 | #define pte_ERROR(e) \ | 93 | #define pte_ERROR(e) \ |
92 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | 94 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) |
93 | #endif | 95 | #endif |
94 | #define pmd_ERROR(e) \ | ||
95 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | ||
96 | #define pgd_ERROR(e) \ | 96 | #define pgd_ERROR(e) \ |
97 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | 97 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) |
98 | 98 | ||
@@ -120,16 +120,6 @@ static inline void pmd_clear(pmd_t *pmdp) | |||
120 | pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); | 120 | pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); |
121 | } | 121 | } |
122 | 122 | ||
123 | /* | ||
124 | * The "pgd_xxx()" functions here are trivial for a folded two-level | ||
125 | * setup: the pgd is never bad, and a pmd always exists (as it's folded | ||
126 | * into the pgd entry) | ||
127 | */ | ||
128 | static inline int pgd_none(pgd_t pgd) { return 0; } | ||
129 | static inline int pgd_bad(pgd_t pgd) { return 0; } | ||
130 | static inline int pgd_present(pgd_t pgd) { return 1; } | ||
131 | static inline void pgd_clear(pgd_t *pgdp) { } | ||
132 | |||
133 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | 123 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) |
134 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 124 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
135 | #define pte_pfn(x) ((unsigned long)((x).pte_high >> 6)) | 125 | #define pte_pfn(x) ((unsigned long)((x).pte_high >> 6)) |
@@ -166,12 +156,6 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
166 | /* to find an entry in a page-table-directory */ | 156 | /* to find an entry in a page-table-directory */ |
167 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) | 157 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) |
168 | 158 | ||
169 | /* Find an entry in the second-level page table.. */ | ||
170 | static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address) | ||
171 | { | ||
172 | return (pmd_t *) dir; | ||
173 | } | ||
174 | |||
175 | /* Find an entry in the third-level page table.. */ | 159 | /* Find an entry in the third-level page table.. */ |
176 | #define __pte_offset(address) \ | 160 | #define __pte_offset(address) \ |
177 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 161 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h index 1011e0635f56..ac5517fa1ee4 100644 --- a/include/asm-mips/pgtable-64.h +++ b/include/asm-mips/pgtable-64.h | |||
@@ -16,13 +16,15 @@ | |||
16 | #include <asm/page.h> | 16 | #include <asm/page.h> |
17 | #include <asm/cachectl.h> | 17 | #include <asm/cachectl.h> |
18 | 18 | ||
19 | #include <asm-generic/pgtable-nopud.h> | ||
20 | |||
19 | /* | 21 | /* |
20 | * Each address space has 2 4K pages as its page directory, giving 1024 | 22 | * Each address space has 2 4K pages as its page directory, giving 1024 |
21 | * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a | 23 | * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a |
22 | * pair of 4K pages, giving 1024 (== PTRS_PER_PMD) 8 byte pointers to | 24 | * single 4K page, giving 512 (== PTRS_PER_PMD) 8 byte pointers to page |
23 | * page tables. Each page table is a single 4K page, giving 512 (== | 25 | * tables. Each page table is also a single 4K page, giving 512 (== |
24 | * PTRS_PER_PTE) 8 byte ptes. Each pgde is initialized to point to | 26 | * PTRS_PER_PTE) 8 byte ptes. Each pud entry is initialized to point to |
25 | * invalid_pmd_table, each pmde is initialized to point to | 27 | * invalid_pmd_table, each pmd entry is initialized to point to |
26 | * invalid_pte_table, each pte is initialized to 0. When memory is low, | 28 | * invalid_pte_table, each pte is initialized to 0. When memory is low, |
27 | * and a pmd table or a page table allocation fails, empty_bad_pmd_table | 29 | * and a pmd table or a page table allocation fails, empty_bad_pmd_table |
28 | * and empty_bad_page_table is returned back to higher layer code, so | 30 | * and empty_bad_page_table is returned back to higher layer code, so |
@@ -36,17 +38,17 @@ | |||
36 | */ | 38 | */ |
37 | 39 | ||
38 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ | 40 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ |
39 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - 3)) | 41 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3)) |
40 | #define PMD_SIZE (1UL << PMD_SHIFT) | 42 | #define PMD_SIZE (1UL << PMD_SHIFT) |
41 | #define PMD_MASK (~(PMD_SIZE-1)) | 43 | #define PMD_MASK (~(PMD_SIZE-1)) |
42 | 44 | ||
43 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | 45 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ |
44 | #define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + 1 - 3)) | 46 | #define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3)) |
45 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 47 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
46 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 48 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
47 | 49 | ||
48 | /* | 50 | /* |
49 | * For 4kB page size we use a 3 level page tree and a 8kB pmd and pgds which | 51 | * For 4kB page size we use a 3 level page tree and an 8kB pud, which |
50 | * permits us mapping 40 bits of virtual address space. | 52 | * permits us mapping 40 bits of virtual address space. |
51 | * | 53 | * |
52 | * We used to implement 41 bits by having an order 1 pmd level but that seemed | 54 | * We used to implement 41 bits by having an order 1 pmd level but that seemed |
@@ -65,21 +67,25 @@ | |||
65 | */ | 67 | */ |
66 | #ifdef CONFIG_PAGE_SIZE_4KB | 68 | #ifdef CONFIG_PAGE_SIZE_4KB |
67 | #define PGD_ORDER 1 | 69 | #define PGD_ORDER 1 |
70 | #define PUD_ORDER aieeee_attempt_to_allocate_pud | ||
68 | #define PMD_ORDER 0 | 71 | #define PMD_ORDER 0 |
69 | #define PTE_ORDER 0 | 72 | #define PTE_ORDER 0 |
70 | #endif | 73 | #endif |
71 | #ifdef CONFIG_PAGE_SIZE_8KB | 74 | #ifdef CONFIG_PAGE_SIZE_8KB |
72 | #define PGD_ORDER 0 | 75 | #define PGD_ORDER 0 |
76 | #define PUD_ORDER aieeee_attempt_to_allocate_pud | ||
73 | #define PMD_ORDER 0 | 77 | #define PMD_ORDER 0 |
74 | #define PTE_ORDER 0 | 78 | #define PTE_ORDER 0 |
75 | #endif | 79 | #endif |
76 | #ifdef CONFIG_PAGE_SIZE_16KB | 80 | #ifdef CONFIG_PAGE_SIZE_16KB |
77 | #define PGD_ORDER 0 | 81 | #define PGD_ORDER 0 |
82 | #define PUD_ORDER aieeee_attempt_to_allocate_pud | ||
78 | #define PMD_ORDER 0 | 83 | #define PMD_ORDER 0 |
79 | #define PTE_ORDER 0 | 84 | #define PTE_ORDER 0 |
80 | #endif | 85 | #endif |
81 | #ifdef CONFIG_PAGE_SIZE_64KB | 86 | #ifdef CONFIG_PAGE_SIZE_64KB |
82 | #define PGD_ORDER 0 | 87 | #define PGD_ORDER 0 |
88 | #define PUD_ORDER aieeee_attempt_to_allocate_pud | ||
83 | #define PMD_ORDER 0 | 89 | #define PMD_ORDER 0 |
84 | #define PTE_ORDER 0 | 90 | #define PTE_ORDER 0 |
85 | #endif | 91 | #endif |
@@ -102,10 +108,10 @@ | |||
102 | #define pgd_ERROR(e) \ | 108 | #define pgd_ERROR(e) \ |
103 | printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) | 109 | printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) |
104 | 110 | ||
105 | extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)]; | 111 | extern pte_t invalid_pte_table[PTRS_PER_PTE]; |
106 | extern pte_t empty_bad_page_table[PAGE_SIZE/sizeof(pte_t)]; | 112 | extern pte_t empty_bad_page_table[PTRS_PER_PTE]; |
107 | extern pmd_t invalid_pmd_table[2*PAGE_SIZE/sizeof(pmd_t)]; | 113 | extern pmd_t invalid_pmd_table[PTRS_PER_PMD]; |
108 | extern pmd_t empty_bad_pmd_table[2*PAGE_SIZE/sizeof(pmd_t)]; | 114 | extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD]; |
109 | 115 | ||
110 | /* | 116 | /* |
111 | * Empty pmd entries point to the invalid_pte_table. | 117 | * Empty pmd entries point to the invalid_pte_table. |
@@ -130,21 +136,24 @@ static inline void pmd_clear(pmd_t *pmdp) | |||
130 | /* | 136 | /* |
131 | * Empty pgd entries point to the invalid_pmd_table. | 137 | * Empty pgd entries point to the invalid_pmd_table. |
132 | */ | 138 | */ |
133 | static inline int pgd_none(pgd_t pgd) | 139 | static inline int pud_none(pud_t pud) |
134 | { | 140 | { |
135 | return pgd_val(pgd) == (unsigned long) invalid_pmd_table; | 141 | return pud_val(pud) == (unsigned long) invalid_pmd_table; |
136 | } | 142 | } |
137 | 143 | ||
138 | #define pgd_bad(pgd) (pgd_val(pgd) &~ PAGE_MASK) | 144 | static inline int pud_bad(pud_t pud) |
145 | { | ||
146 | return pud_val(pud) & ~PAGE_MASK; | ||
147 | } | ||
139 | 148 | ||
140 | static inline int pgd_present(pgd_t pgd) | 149 | static inline int pud_present(pud_t pud) |
141 | { | 150 | { |
142 | return pgd_val(pgd) != (unsigned long) invalid_pmd_table; | 151 | return pud_val(pud) != (unsigned long) invalid_pmd_table; |
143 | } | 152 | } |
144 | 153 | ||
145 | static inline void pgd_clear(pgd_t *pgdp) | 154 | static inline void pud_clear(pud_t *pudp) |
146 | { | 155 | { |
147 | pgd_val(*pgdp) = ((unsigned long) invalid_pmd_table); | 156 | pud_val(*pudp) = ((unsigned long) invalid_pmd_table); |
148 | } | 157 | } |
149 | 158 | ||
150 | #define pte_page(x) pfn_to_page((unsigned long)((pte_val(x) >> PAGE_SHIFT))) | 159 | #define pte_page(x) pfn_to_page((unsigned long)((pte_val(x) >> PAGE_SHIFT))) |
@@ -162,20 +171,20 @@ static inline void pgd_clear(pgd_t *pgdp) | |||
162 | /* to find an entry in a kernel page-table-directory */ | 171 | /* to find an entry in a kernel page-table-directory */ |
163 | #define pgd_offset_k(address) pgd_offset(&init_mm, 0) | 172 | #define pgd_offset_k(address) pgd_offset(&init_mm, 0) |
164 | 173 | ||
165 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | 174 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
166 | 175 | ||
167 | /* to find an entry in a page-table-directory */ | 176 | /* to find an entry in a page-table-directory */ |
168 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) | 177 | #define pgd_offset(mm,addr) ((mm)->pgd + pgd_index(addr)) |
169 | 178 | ||
170 | static inline unsigned long pgd_page(pgd_t pgd) | 179 | static inline unsigned long pud_page(pud_t pud) |
171 | { | 180 | { |
172 | return pgd_val(pgd); | 181 | return pud_val(pud); |
173 | } | 182 | } |
174 | 183 | ||
175 | /* Find an entry in the second-level page table.. */ | 184 | /* Find an entry in the second-level page table.. */ |
176 | static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) | 185 | static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) |
177 | { | 186 | { |
178 | return (pmd_t *) pgd_page(*dir) + | 187 | return (pmd_t *) pud_page(*pud) + |
179 | ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1)); | 188 | ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1)); |
180 | } | 189 | } |
181 | 190 | ||
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index eaf5d9b3a0e1..34d06fe7caac 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #ifndef _ASM_PGTABLE_H | 8 | #ifndef _ASM_PGTABLE_H |
9 | #define _ASM_PGTABLE_H | 9 | #define _ASM_PGTABLE_H |
10 | 10 | ||
11 | #include <asm-generic/4level-fixup.h> | ||
12 | |||
13 | #include <linux/config.h> | 11 | #include <linux/config.h> |
14 | #ifdef CONFIG_32BIT | 12 | #ifdef CONFIG_32BIT |
15 | #include <asm/pgtable-32.h> | 13 | #include <asm/pgtable-32.h> |
@@ -148,11 +146,18 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt | |||
148 | #endif | 146 | #endif |
149 | 147 | ||
150 | /* | 148 | /* |
151 | * (pmds are folded into pgds so this doesn't get actually called, | 149 | * (pmds are folded into puds so this doesn't get actually called, |
152 | * but the define is needed for a generic inline function.) | 150 | * but the define is needed for a generic inline function.) |
153 | */ | 151 | */ |
154 | #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0) | 152 | #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0) |
155 | #define set_pgd(pgdptr, pgdval) do { *(pgdptr) = (pgdval); } while(0) | 153 | |
154 | #ifdef CONFIG_64BIT | ||
155 | /* | ||
156 | * (puds are folded into pgds so this doesn't get actually called, | ||
157 | * but the define is needed for a generic inline function.) | ||
158 | */ | ||
159 | #define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0) | ||
160 | #endif | ||
156 | 161 | ||
157 | #define PGD_T_LOG2 ffz(~sizeof(pgd_t)) | 162 | #define PGD_T_LOG2 ffz(~sizeof(pgd_t)) |
158 | #define PMD_T_LOG2 ffz(~sizeof(pmd_t)) | 163 | #define PMD_T_LOG2 ffz(~sizeof(pmd_t)) |