diff options
Diffstat (limited to 'arch/i386/mm/init.c')
-rw-r--r-- | arch/i386/mm/init.c | 82 |
1 files changed, 55 insertions, 27 deletions
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 89e8486aac34..4a5a914b3432 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -435,16 +435,22 @@ u64 __supported_pte_mask __read_mostly = ~_PAGE_NX; | |||
435 | * on Enable | 435 | * on Enable |
436 | * off Disable | 436 | * off Disable |
437 | */ | 437 | */ |
438 | void __init noexec_setup(const char *str) | 438 | static int __init noexec_setup(char *str) |
439 | { | 439 | { |
440 | if (!strncmp(str, "on",2) && cpu_has_nx) { | 440 | if (!str || !strcmp(str, "on")) { |
441 | __supported_pte_mask |= _PAGE_NX; | 441 | if (cpu_has_nx) { |
442 | disable_nx = 0; | 442 | __supported_pte_mask |= _PAGE_NX; |
443 | } else if (!strncmp(str,"off",3)) { | 443 | disable_nx = 0; |
444 | } | ||
445 | } else if (!strcmp(str,"off")) { | ||
444 | disable_nx = 1; | 446 | disable_nx = 1; |
445 | __supported_pte_mask &= ~_PAGE_NX; | 447 | __supported_pte_mask &= ~_PAGE_NX; |
446 | } | 448 | } else |
449 | return -EINVAL; | ||
450 | |||
451 | return 0; | ||
447 | } | 452 | } |
453 | early_param("noexec", noexec_setup); | ||
448 | 454 | ||
449 | int nx_enabled = 0; | 455 | int nx_enabled = 0; |
450 | #ifdef CONFIG_X86_PAE | 456 | #ifdef CONFIG_X86_PAE |
@@ -552,18 +558,6 @@ static void __init test_wp_bit(void) | |||
552 | } | 558 | } |
553 | } | 559 | } |
554 | 560 | ||
555 | static void __init set_max_mapnr_init(void) | ||
556 | { | ||
557 | #ifdef CONFIG_HIGHMEM | ||
558 | num_physpages = highend_pfn; | ||
559 | #else | ||
560 | num_physpages = max_low_pfn; | ||
561 | #endif | ||
562 | #ifdef CONFIG_FLATMEM | ||
563 | max_mapnr = num_physpages; | ||
564 | #endif | ||
565 | } | ||
566 | |||
567 | static struct kcore_list kcore_mem, kcore_vmalloc; | 561 | static struct kcore_list kcore_mem, kcore_vmalloc; |
568 | 562 | ||
569 | void __init mem_init(void) | 563 | void __init mem_init(void) |
@@ -590,14 +584,6 @@ void __init mem_init(void) | |||
590 | } | 584 | } |
591 | #endif | 585 | #endif |
592 | 586 | ||
593 | set_max_mapnr_init(); | ||
594 | |||
595 | #ifdef CONFIG_HIGHMEM | ||
596 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
597 | #else | ||
598 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | ||
599 | #endif | ||
600 | |||
601 | /* this will put all low memory onto the freelists */ | 587 | /* this will put all low memory onto the freelists */ |
602 | totalram_pages += free_all_bootmem(); | 588 | totalram_pages += free_all_bootmem(); |
603 | 589 | ||
@@ -629,6 +615,48 @@ void __init mem_init(void) | |||
629 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) | 615 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) |
630 | ); | 616 | ); |
631 | 617 | ||
618 | #if 1 /* double-sanity-check paranoia */ | ||
619 | printk("virtual kernel memory layout:\n" | ||
620 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | ||
621 | #ifdef CONFIG_HIGHMEM | ||
622 | " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | ||
623 | #endif | ||
624 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" | ||
625 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" | ||
626 | " .init : 0x%08lx - 0x%08lx (%4ld kB)\n" | ||
627 | " .data : 0x%08lx - 0x%08lx (%4ld kB)\n" | ||
628 | " .text : 0x%08lx - 0x%08lx (%4ld kB)\n", | ||
629 | FIXADDR_START, FIXADDR_TOP, | ||
630 | (FIXADDR_TOP - FIXADDR_START) >> 10, | ||
631 | |||
632 | #ifdef CONFIG_HIGHMEM | ||
633 | PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE, | ||
634 | (LAST_PKMAP*PAGE_SIZE) >> 10, | ||
635 | #endif | ||
636 | |||
637 | VMALLOC_START, VMALLOC_END, | ||
638 | (VMALLOC_END - VMALLOC_START) >> 20, | ||
639 | |||
640 | (unsigned long)__va(0), (unsigned long)high_memory, | ||
641 | ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, | ||
642 | |||
643 | (unsigned long)&__init_begin, (unsigned long)&__init_end, | ||
644 | ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10, | ||
645 | |||
646 | (unsigned long)&_etext, (unsigned long)&_edata, | ||
647 | ((unsigned long)&_edata - (unsigned long)&_etext) >> 10, | ||
648 | |||
649 | (unsigned long)&_text, (unsigned long)&_etext, | ||
650 | ((unsigned long)&_etext - (unsigned long)&_text) >> 10); | ||
651 | |||
652 | #ifdef CONFIG_HIGHMEM | ||
653 | BUG_ON(PKMAP_BASE+LAST_PKMAP*PAGE_SIZE > FIXADDR_START); | ||
654 | BUG_ON(VMALLOC_END > PKMAP_BASE); | ||
655 | #endif | ||
656 | BUG_ON(VMALLOC_START > VMALLOC_END); | ||
657 | BUG_ON((unsigned long)high_memory > VMALLOC_START); | ||
658 | #endif /* double-sanity-check paranoia */ | ||
659 | |||
632 | #ifdef CONFIG_X86_PAE | 660 | #ifdef CONFIG_X86_PAE |
633 | if (!cpu_has_pae) | 661 | if (!cpu_has_pae) |
634 | panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); | 662 | panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); |
@@ -657,7 +685,7 @@ void __init mem_init(void) | |||
657 | int arch_add_memory(int nid, u64 start, u64 size) | 685 | int arch_add_memory(int nid, u64 start, u64 size) |
658 | { | 686 | { |
659 | struct pglist_data *pgdata = &contig_page_data; | 687 | struct pglist_data *pgdata = &contig_page_data; |
660 | struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1; | 688 | struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM; |
661 | unsigned long start_pfn = start >> PAGE_SHIFT; | 689 | unsigned long start_pfn = start >> PAGE_SHIFT; |
662 | unsigned long nr_pages = size >> PAGE_SHIFT; | 690 | unsigned long nr_pages = size >> PAGE_SHIFT; |
663 | 691 | ||