diff options
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/fault.c | 14 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/ioremap.c | 35 |
4 files changed, 39 insertions, 16 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 8f92cac4e6db..a742d753d5b0 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -914,15 +914,15 @@ LIST_HEAD(pgd_list); | |||
914 | 914 | ||
915 | void vmalloc_sync_all(void) | 915 | void vmalloc_sync_all(void) |
916 | { | 916 | { |
917 | #ifdef CONFIG_X86_32 | ||
918 | unsigned long start = VMALLOC_START & PGDIR_MASK; | ||
919 | unsigned long address; | 917 | unsigned long address; |
920 | 918 | ||
919 | #ifdef CONFIG_X86_32 | ||
921 | if (SHARED_KERNEL_PMD) | 920 | if (SHARED_KERNEL_PMD) |
922 | return; | 921 | return; |
923 | 922 | ||
924 | BUILD_BUG_ON(TASK_SIZE & ~PGDIR_MASK); | 923 | for (address = VMALLOC_START & PMD_MASK; |
925 | for (address = start; address >= TASK_SIZE; address += PGDIR_SIZE) { | 924 | address >= TASK_SIZE && address < FIXADDR_TOP; |
925 | address += PMD_SIZE) { | ||
926 | unsigned long flags; | 926 | unsigned long flags; |
927 | struct page *page; | 927 | struct page *page; |
928 | 928 | ||
@@ -935,10 +935,8 @@ void vmalloc_sync_all(void) | |||
935 | spin_unlock_irqrestore(&pgd_lock, flags); | 935 | spin_unlock_irqrestore(&pgd_lock, flags); |
936 | } | 936 | } |
937 | #else /* CONFIG_X86_64 */ | 937 | #else /* CONFIG_X86_64 */ |
938 | unsigned long start = VMALLOC_START & PGDIR_MASK; | 938 | for (address = VMALLOC_START & PGDIR_MASK; address <= VMALLOC_END; |
939 | unsigned long address; | 939 | address += PGDIR_SIZE) { |
940 | |||
941 | for (address = start; address <= VMALLOC_END; address += PGDIR_SIZE) { | ||
942 | const pgd_t *pgd_ref = pgd_offset_k(address); | 940 | const pgd_t *pgd_ref = pgd_offset_k(address); |
943 | unsigned long flags; | 941 | unsigned long flags; |
944 | struct page *page; | 942 | struct page *page; |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c3789bb19308..bbe044dbe014 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/cpumask.h> | 31 | #include <linux/cpumask.h> |
32 | 32 | ||
33 | #include <asm/asm.h> | 33 | #include <asm/asm.h> |
34 | #include <asm/bios_ebda.h> | ||
34 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
35 | #include <asm/system.h> | 36 | #include <asm/system.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -969,6 +970,8 @@ void __init mem_init(void) | |||
969 | int codesize, reservedpages, datasize, initsize; | 970 | int codesize, reservedpages, datasize, initsize; |
970 | int tmp; | 971 | int tmp; |
971 | 972 | ||
973 | start_periodic_check_for_corruption(); | ||
974 | |||
972 | #ifdef CONFIG_FLATMEM | 975 | #ifdef CONFIG_FLATMEM |
973 | BUG_ON(!mem_map); | 976 | BUG_ON(!mem_map); |
974 | #endif | 977 | #endif |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 83e13f2d53d2..3e10054c5731 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/nmi.h> | 31 | #include <linux/nmi.h> |
32 | 32 | ||
33 | #include <asm/processor.h> | 33 | #include <asm/processor.h> |
34 | #include <asm/bios_ebda.h> | ||
34 | #include <asm/system.h> | 35 | #include <asm/system.h> |
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
36 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
@@ -881,6 +882,8 @@ void __init mem_init(void) | |||
881 | { | 882 | { |
882 | long codesize, reservedpages, datasize, initsize; | 883 | long codesize, reservedpages, datasize, initsize; |
883 | 884 | ||
885 | start_periodic_check_for_corruption(); | ||
886 | |||
884 | pci_iommu_alloc(); | 887 | pci_iommu_alloc(); |
885 | 888 | ||
886 | /* clear_bss() already clear the empty_zero_page */ | 889 | /* clear_bss() already clear the empty_zero_page */ |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 6ab3196d12b4..8cbeda15cd29 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -24,18 +24,26 @@ | |||
24 | 24 | ||
25 | #ifdef CONFIG_X86_64 | 25 | #ifdef CONFIG_X86_64 |
26 | 26 | ||
27 | unsigned long __phys_addr(unsigned long x) | 27 | static inline int phys_addr_valid(unsigned long addr) |
28 | { | 28 | { |
29 | if (x >= __START_KERNEL_map) | 29 | return addr < (1UL << boot_cpu_data.x86_phys_bits); |
30 | return x - __START_KERNEL_map + phys_base; | ||
31 | return x - PAGE_OFFSET; | ||
32 | } | 30 | } |
33 | EXPORT_SYMBOL(__phys_addr); | ||
34 | 31 | ||
35 | static inline int phys_addr_valid(unsigned long addr) | 32 | unsigned long __phys_addr(unsigned long x) |
36 | { | 33 | { |
37 | return addr < (1UL << boot_cpu_data.x86_phys_bits); | 34 | if (x >= __START_KERNEL_map) { |
35 | x -= __START_KERNEL_map; | ||
36 | VIRTUAL_BUG_ON(x >= KERNEL_IMAGE_SIZE); | ||
37 | x += phys_base; | ||
38 | } else { | ||
39 | VIRTUAL_BUG_ON(x < PAGE_OFFSET); | ||
40 | x -= PAGE_OFFSET; | ||
41 | VIRTUAL_BUG_ON(system_state == SYSTEM_BOOTING ? x > MAXMEM : | ||
42 | !phys_addr_valid(x)); | ||
43 | } | ||
44 | return x; | ||
38 | } | 45 | } |
46 | EXPORT_SYMBOL(__phys_addr); | ||
39 | 47 | ||
40 | #else | 48 | #else |
41 | 49 | ||
@@ -44,6 +52,17 @@ static inline int phys_addr_valid(unsigned long addr) | |||
44 | return 1; | 52 | return 1; |
45 | } | 53 | } |
46 | 54 | ||
55 | #ifdef CONFIG_DEBUG_VIRTUAL | ||
56 | unsigned long __phys_addr(unsigned long x) | ||
57 | { | ||
58 | /* VMALLOC_* aren't constants; not available at the boot time */ | ||
59 | VIRTUAL_BUG_ON(x < PAGE_OFFSET || (system_state != SYSTEM_BOOTING && | ||
60 | is_vmalloc_addr((void *)x))); | ||
61 | return x - PAGE_OFFSET; | ||
62 | } | ||
63 | EXPORT_SYMBOL(__phys_addr); | ||
64 | #endif | ||
65 | |||
47 | #endif | 66 | #endif |
48 | 67 | ||
49 | int page_is_ram(unsigned long pagenr) | 68 | int page_is_ram(unsigned long pagenr) |
@@ -614,7 +633,7 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size) | |||
614 | */ | 633 | */ |
615 | offset = phys_addr & ~PAGE_MASK; | 634 | offset = phys_addr & ~PAGE_MASK; |
616 | phys_addr &= PAGE_MASK; | 635 | phys_addr &= PAGE_MASK; |
617 | size = PAGE_ALIGN(last_addr) - phys_addr; | 636 | size = PAGE_ALIGN(last_addr + 1) - phys_addr; |
618 | 637 | ||
619 | /* | 638 | /* |
620 | * Mappings have to fit in the FIX_BTMAP area. | 639 | * Mappings have to fit in the FIX_BTMAP area. |