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 /arch/um/kernel | |
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 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/mem.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index 3eddc2091d4d..663011c2983f 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c | |||
@@ -132,7 +132,7 @@ static void __init fixrange_init(unsigned long start, unsigned long end, | |||
132 | if (pud_none(*pud)) | 132 | if (pud_none(*pud)) |
133 | one_md_table_init(pud); | 133 | one_md_table_init(pud); |
134 | pmd = pmd_offset(pud, vaddr); | 134 | pmd = pmd_offset(pud, vaddr); |
135 | for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) { | 135 | for (; (j < PTRS_PER_PMD) && (vaddr < end); pmd++, j++) { |
136 | one_page_table_init(pmd); | 136 | one_page_table_init(pmd); |
137 | vaddr += PMD_SIZE; | 137 | vaddr += PMD_SIZE; |
138 | } | 138 | } |
@@ -191,22 +191,23 @@ static void __init fixaddr_user_init( void) | |||
191 | pud_t *pud; | 191 | pud_t *pud; |
192 | pmd_t *pmd; | 192 | pmd_t *pmd; |
193 | pte_t *pte; | 193 | pte_t *pte; |
194 | unsigned long paddr, vaddr = FIXADDR_USER_START; | 194 | phys_t p; |
195 | unsigned long v, vaddr = FIXADDR_USER_START; | ||
195 | 196 | ||
196 | if ( ! size ) | 197 | if (!size) |
197 | return; | 198 | return; |
198 | 199 | ||
199 | fixrange_init( FIXADDR_USER_START, FIXADDR_USER_END, swapper_pg_dir); | 200 | fixrange_init( FIXADDR_USER_START, FIXADDR_USER_END, swapper_pg_dir); |
200 | paddr = (unsigned long)alloc_bootmem_low_pages( size); | 201 | v = (unsigned long) alloc_bootmem_low_pages(size); |
201 | memcpy( (void *)paddr, (void *)FIXADDR_USER_START, size); | 202 | memcpy((void *) v , (void *) FIXADDR_USER_START, size); |
202 | paddr = __pa(paddr); | 203 | p = __pa(v); |
203 | for ( ; size > 0; size -= PAGE_SIZE, vaddr += PAGE_SIZE, | 204 | for ( ; size > 0; size -= PAGE_SIZE, vaddr += PAGE_SIZE, |
204 | paddr += PAGE_SIZE) { | 205 | p += PAGE_SIZE) { |
205 | pgd = swapper_pg_dir + pgd_index(vaddr); | 206 | pgd = swapper_pg_dir + pgd_index(vaddr); |
206 | pud = pud_offset(pgd, vaddr); | 207 | pud = pud_offset(pgd, vaddr); |
207 | pmd = pmd_offset(pud, vaddr); | 208 | pmd = pmd_offset(pud, vaddr); |
208 | pte = pte_offset_kernel(pmd, vaddr); | 209 | pte = pte_offset_kernel(pmd, vaddr); |
209 | pte_set_val( (*pte), paddr, PAGE_READONLY); | 210 | pte_set_val(*pte, p, PAGE_READONLY); |
210 | } | 211 | } |
211 | #endif | 212 | #endif |
212 | } | 213 | } |