diff options
Diffstat (limited to 'arch/parisc/mm/init.c')
-rw-r--r-- | arch/parisc/mm/init.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index c5fec4890fdf..1b366c477687 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -409,15 +409,11 @@ static void __init map_pages(unsigned long start_vaddr, | |||
409 | unsigned long vaddr; | 409 | unsigned long vaddr; |
410 | unsigned long ro_start; | 410 | unsigned long ro_start; |
411 | unsigned long ro_end; | 411 | unsigned long ro_end; |
412 | unsigned long fv_addr; | 412 | unsigned long kernel_end; |
413 | unsigned long gw_addr; | ||
414 | extern const unsigned long fault_vector_20; | ||
415 | extern void * const linux_gateway_page; | ||
416 | 413 | ||
417 | ro_start = __pa((unsigned long)_text); | 414 | ro_start = __pa((unsigned long)_text); |
418 | ro_end = __pa((unsigned long)&data_start); | 415 | ro_end = __pa((unsigned long)&data_start); |
419 | fv_addr = __pa((unsigned long)&fault_vector_20) & PAGE_MASK; | 416 | kernel_end = __pa((unsigned long)&_end); |
420 | gw_addr = __pa((unsigned long)&linux_gateway_page) & PAGE_MASK; | ||
421 | 417 | ||
422 | end_paddr = start_paddr + size; | 418 | end_paddr = start_paddr + size; |
423 | 419 | ||
@@ -475,24 +471,25 @@ static void __init map_pages(unsigned long start_vaddr, | |||
475 | for (tmp2 = start_pte; tmp2 < PTRS_PER_PTE; tmp2++, pg_table++) { | 471 | for (tmp2 = start_pte; tmp2 < PTRS_PER_PTE; tmp2++, pg_table++) { |
476 | pte_t pte; | 472 | pte_t pte; |
477 | 473 | ||
478 | /* | ||
479 | * Map the fault vector writable so we can | ||
480 | * write the HPMC checksum. | ||
481 | */ | ||
482 | if (force) | 474 | if (force) |
483 | pte = __mk_pte(address, pgprot); | 475 | pte = __mk_pte(address, pgprot); |
484 | else if (parisc_text_address(vaddr) && | 476 | else if (parisc_text_address(vaddr)) { |
485 | address != fv_addr) | ||
486 | pte = __mk_pte(address, PAGE_KERNEL_EXEC); | 477 | pte = __mk_pte(address, PAGE_KERNEL_EXEC); |
478 | if (address >= ro_start && address < kernel_end) | ||
479 | pte = pte_mkhuge(pte); | ||
480 | } | ||
487 | else | 481 | else |
488 | #if defined(CONFIG_PARISC_PAGE_SIZE_4KB) | 482 | #if defined(CONFIG_PARISC_PAGE_SIZE_4KB) |
489 | if (address >= ro_start && address < ro_end | 483 | if (address >= ro_start && address < ro_end) { |
490 | && address != fv_addr | 484 | pte = __mk_pte(address, PAGE_KERNEL_EXEC); |
491 | && address != gw_addr) | 485 | pte = pte_mkhuge(pte); |
492 | pte = __mk_pte(address, PAGE_KERNEL_RO); | 486 | } else |
493 | else | ||
494 | #endif | 487 | #endif |
488 | { | ||
495 | pte = __mk_pte(address, pgprot); | 489 | pte = __mk_pte(address, pgprot); |
490 | if (address >= ro_start && address < kernel_end) | ||
491 | pte = pte_mkhuge(pte); | ||
492 | } | ||
496 | 493 | ||
497 | if (address >= end_paddr) { | 494 | if (address >= end_paddr) { |
498 | if (force) | 495 | if (force) |
@@ -536,15 +533,12 @@ void free_initmem(void) | |||
536 | 533 | ||
537 | /* force the kernel to see the new TLB entries */ | 534 | /* force the kernel to see the new TLB entries */ |
538 | __flush_tlb_range(0, init_begin, init_end); | 535 | __flush_tlb_range(0, init_begin, init_end); |
539 | /* Attempt to catch anyone trying to execute code here | 536 | |
540 | * by filling the page with BRK insns. | ||
541 | */ | ||
542 | memset((void *)init_begin, 0x00, init_end - init_begin); | ||
543 | /* finally dump all the instructions which were cached, since the | 537 | /* finally dump all the instructions which were cached, since the |
544 | * pages are no-longer executable */ | 538 | * pages are no-longer executable */ |
545 | flush_icache_range(init_begin, init_end); | 539 | flush_icache_range(init_begin, init_end); |
546 | 540 | ||
547 | free_initmem_default(-1); | 541 | free_initmem_default(POISON_FREE_INITMEM); |
548 | 542 | ||
549 | /* set up a new led state on systems shipped LED State panel */ | 543 | /* set up a new led state on systems shipped LED State panel */ |
550 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); | 544 | pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); |
@@ -728,8 +722,8 @@ static void __init pagetable_init(void) | |||
728 | unsigned long size; | 722 | unsigned long size; |
729 | 723 | ||
730 | start_paddr = pmem_ranges[range].start_pfn << PAGE_SHIFT; | 724 | start_paddr = pmem_ranges[range].start_pfn << PAGE_SHIFT; |
731 | end_paddr = start_paddr + (pmem_ranges[range].pages << PAGE_SHIFT); | ||
732 | size = pmem_ranges[range].pages << PAGE_SHIFT; | 725 | size = pmem_ranges[range].pages << PAGE_SHIFT; |
726 | end_paddr = start_paddr + size; | ||
733 | 727 | ||
734 | map_pages((unsigned long)__va(start_paddr), start_paddr, | 728 | map_pages((unsigned long)__va(start_paddr), start_paddr, |
735 | size, PAGE_KERNEL, 0); | 729 | size, PAGE_KERNEL, 0); |