diff options
author | Helge Deller <deller@gmx.de> | 2009-01-18 13:16:16 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@mcmartin.ca> | 2009-03-30 22:51:33 -0400 |
commit | 48d27cb2299c0b2fc4d551bddb6a1005828dc0c6 (patch) | |
tree | 3f1d8df3a8a417264053425e706e4acce64116a9 /arch/parisc/mm | |
parent | 15f7176eb1cccec0a332541285ee752b935c1c85 (diff) |
parisc: fix usage of 32bit PTE page table entries on 32bit kernels
This patch fixes a long outstanding bug on 32bit parisc linux kernels
which prevented us from using 32bit PTE table entries (instead of 64bit
entries of which 32bit were unused).
The problem was caused by this assembler statement in the L2_ptep
macro in arch/parisc/kernel/entry.S:447:
EXTR \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
which expanded to
extrw,u r8,9,11,r1
and which has undefined behavior since the length value (11) extends
beyond the leftmost bit (11-1 > 9).
Interestingly PA2.0 processors seem to don't care and just zero-extend
the value, while PA1.1 processors don't.
Fix this problem by detecting an address space overflow with ASM_BITS_PER_PGD
and adjusting it accordingly. To prevent such problems in the future,
some compile time sanity checks in arch/parisc/mm/init.c were added.
Since the page table now only consumes half of it's old size, we can
use the freed memory to harmonize 32- and 64bit kernels and let both
map 16MB for the initial page table.
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
Diffstat (limited to 'arch/parisc/mm')
-rw-r--r-- | arch/parisc/mm/init.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 9d704d9831d1..4356ceb1e366 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -456,6 +456,13 @@ void __init mem_init(void) | |||
456 | { | 456 | { |
457 | int codesize, reservedpages, datasize, initsize; | 457 | int codesize, reservedpages, datasize, initsize; |
458 | 458 | ||
459 | /* Do sanity checks on page table constants */ | ||
460 | BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t)); | ||
461 | BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t)); | ||
462 | BUILD_BUG_ON(PGD_ENTRY_SIZE != sizeof(pgd_t)); | ||
463 | BUILD_BUG_ON(PAGE_SHIFT + BITS_PER_PTE + BITS_PER_PMD + BITS_PER_PGD | ||
464 | > BITS_PER_LONG); | ||
465 | |||
459 | high_memory = __va((max_pfn << PAGE_SHIFT)); | 466 | high_memory = __va((max_pfn << PAGE_SHIFT)); |
460 | 467 | ||
461 | #ifndef CONFIG_DISCONTIGMEM | 468 | #ifndef CONFIG_DISCONTIGMEM |