aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/doublefault_32.c2
-rw-r--r--arch/x86/mm/ioremap.c31
2 files changed, 25 insertions, 8 deletions
diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
index a47798b59f07..395acb12b0d1 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault_32.c
@@ -66,6 +66,6 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
66 .ds = __USER_DS, 66 .ds = __USER_DS,
67 .fs = __KERNEL_PERCPU, 67 .fs = __KERNEL_PERCPU,
68 68
69 .__cr3 = __pa(swapper_pg_dir) 69 .__cr3 = __phys_addr_const((unsigned long)swapper_pg_dir)
70 } 70 }
71}; 71};
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 2b2bb3f9b683..a78ffef62a2b 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -23,18 +23,26 @@
23 23
24#ifdef CONFIG_X86_64 24#ifdef CONFIG_X86_64
25 25
26unsigned long __phys_addr(unsigned long x) 26static inline int phys_addr_valid(unsigned long addr)
27{ 27{
28 if (x >= __START_KERNEL_map) 28 return addr < (1UL << boot_cpu_data.x86_phys_bits);
29 return x - __START_KERNEL_map + phys_base;
30 return x - PAGE_OFFSET;
31} 29}
32EXPORT_SYMBOL(__phys_addr);
33 30
34static inline int phys_addr_valid(unsigned long addr) 31unsigned long __phys_addr(unsigned long x)
35{ 32{
36 return addr < (1UL << boot_cpu_data.x86_phys_bits); 33 if (x >= __START_KERNEL_map) {
34 x -= __START_KERNEL_map;
35 VIRTUAL_BUG_ON(x >= KERNEL_IMAGE_SIZE);
36 x += phys_base;
37 } else {
38 VIRTUAL_BUG_ON(x < PAGE_OFFSET);
39 x -= PAGE_OFFSET;
40 VIRTUAL_BUG_ON(system_state == SYSTEM_BOOTING ? x > MAXMEM :
41 !phys_addr_valid(x));
42 }
43 return x;
37} 44}
45EXPORT_SYMBOL(__phys_addr);
38 46
39#else 47#else
40 48
@@ -43,6 +51,15 @@ static inline int phys_addr_valid(unsigned long addr)
43 return 1; 51 return 1;
44} 52}
45 53
54unsigned long __phys_addr(unsigned long x)
55{
56 /* VMALLOC_* aren't constants; not available at the boot time */
57 VIRTUAL_BUG_ON(x < PAGE_OFFSET || (system_state != SYSTEM_BOOTING &&
58 is_vmalloc_addr((void *)x)));
59 return x - PAGE_OFFSET;
60}
61EXPORT_SYMBOL(__phys_addr);
62
46#endif 63#endif
47 64
48int page_is_ram(unsigned long pagenr) 65int page_is_ram(unsigned long pagenr)