diff options
-rw-r--r-- | arch/ia64/Kconfig | 4 | ||||
-rw-r--r-- | arch/ia64/mm/init.c | 3 | ||||
-rw-r--r-- | arch/x86/Kconfig | 4 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 4 | ||||
-rw-r--r-- | fs/proc/kcore.c | 19 |
5 files changed, 28 insertions, 6 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 011a1cdf0eb5..6851e52ed5a2 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -500,6 +500,10 @@ config HAVE_ARCH_NODEDATA_EXTENSION | |||
500 | def_bool y | 500 | def_bool y |
501 | depends on NUMA | 501 | depends on NUMA |
502 | 502 | ||
503 | config ARCH_PROC_KCORE_TEXT | ||
504 | def_bool y | ||
505 | depends on PROC_KCORE | ||
506 | |||
503 | config IA32_SUPPORT | 507 | config IA32_SUPPORT |
504 | bool "Support for Linux/x86 binaries" | 508 | bool "Support for Linux/x86 binaries" |
505 | help | 509 | help |
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index 286b98aa8547..3f95ea1d6fb6 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c | |||
@@ -617,7 +617,7 @@ mem_init (void) | |||
617 | long reserved_pages, codesize, datasize, initsize; | 617 | long reserved_pages, codesize, datasize, initsize; |
618 | pg_data_t *pgdat; | 618 | pg_data_t *pgdat; |
619 | int i; | 619 | int i; |
620 | static struct kcore_list kcore_mem, kcore_kernel; | 620 | static struct kcore_list kcore_mem; |
621 | 621 | ||
622 | BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE); | 622 | BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE); |
623 | BUG_ON(PTRS_PER_PMD * sizeof(pmd_t) != PAGE_SIZE); | 623 | BUG_ON(PTRS_PER_PMD * sizeof(pmd_t) != PAGE_SIZE); |
@@ -640,7 +640,6 @@ mem_init (void) | |||
640 | high_memory = __va(max_low_pfn * PAGE_SIZE); | 640 | high_memory = __va(max_low_pfn * PAGE_SIZE); |
641 | 641 | ||
642 | kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE, KCORE_RAM); | 642 | kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE, KCORE_RAM); |
643 | kclist_add(&kcore_kernel, _stext, _end - _stext, KCORE_TEXT); | ||
644 | 643 | ||
645 | for_each_online_pgdat(pgdat) | 644 | for_each_online_pgdat(pgdat) |
646 | if (pgdat->bdata->node_bootmem_map) | 645 | if (pgdat->bdata->node_bootmem_map) |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index e4ff5d1280ca..7c7a54bed4a6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1204,6 +1204,10 @@ config ARCH_DISCONTIGMEM_DEFAULT | |||
1204 | def_bool y | 1204 | def_bool y |
1205 | depends on NUMA && X86_32 | 1205 | depends on NUMA && X86_32 |
1206 | 1206 | ||
1207 | config ARCH_PROC_KCORE_TEXT | ||
1208 | def_bool y | ||
1209 | depends on X86_64 && PROC_KCORE | ||
1210 | |||
1207 | config ARCH_SPARSEMEM_DEFAULT | 1211 | config ARCH_SPARSEMEM_DEFAULT |
1208 | def_bool y | 1212 | def_bool y |
1209 | depends on X86_64 | 1213 | depends on X86_64 |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index da2cae7427a6..a0c2efb10cbe 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -647,8 +647,7 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); | |||
647 | 647 | ||
648 | #endif /* CONFIG_MEMORY_HOTPLUG */ | 648 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
649 | 649 | ||
650 | static struct kcore_list kcore_mem, kcore_kernel, | 650 | static struct kcore_list kcore_mem, kcore_modules, kcore_vsyscall; |
651 | kcore_modules, kcore_vsyscall; | ||
652 | 651 | ||
653 | void __init mem_init(void) | 652 | void __init mem_init(void) |
654 | { | 653 | { |
@@ -678,7 +677,6 @@ void __init mem_init(void) | |||
678 | 677 | ||
679 | /* Register memory areas for /proc/kcore */ | 678 | /* Register memory areas for /proc/kcore */ |
680 | kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM); | 679 | kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM); |
681 | kclist_add(&kcore_kernel, &_stext, _end - _stext, KCORE_TEXT); | ||
682 | kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN, | 680 | kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN, |
683 | KCORE_OTHER); | 681 | KCORE_OTHER); |
684 | kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, | 682 | kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index e10d360110bd..fdde1cc78392 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <asm/sections.h> | ||
24 | 25 | ||
25 | #define CORE_STR "CORE" | 26 | #define CORE_STR "CORE" |
26 | 27 | ||
@@ -374,10 +375,26 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) | |||
374 | 375 | ||
375 | static struct kcore_list kcore_vmalloc; | 376 | static struct kcore_list kcore_vmalloc; |
376 | 377 | ||
378 | #ifdef CONFIG_ARCH_PROC_KCORE_TEXT | ||
379 | static struct kcore_list kcore_text; | ||
380 | /* | ||
381 | * If defined, special segment is used for mapping kernel text instead of | ||
382 | * direct-map area. We need to create special TEXT section. | ||
383 | */ | ||
384 | static void __init proc_kcore_text_init(void) | ||
385 | { | ||
386 | kclist_add(&kcore_text, _stext, _end - _stext, KCORE_TEXT); | ||
387 | } | ||
388 | #else | ||
389 | static void __init proc_kcore_text_init(void) | ||
390 | { | ||
391 | } | ||
392 | #endif | ||
393 | |||
377 | static int __init proc_kcore_init(void) | 394 | static int __init proc_kcore_init(void) |
378 | { | 395 | { |
379 | proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations); | 396 | proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations); |
380 | 397 | proc_kcore_text_init(); | |
381 | kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, | 398 | kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, |
382 | VMALLOC_END - VMALLOC_START, KCORE_VMALLOC); | 399 | VMALLOC_END - VMALLOC_START, KCORE_VMALLOC); |
383 | return 0; | 400 | return 0; |