diff options
author | Vegard Nossum <vegard.nossum@gmail.com> | 2008-10-03 11:54:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-13 04:33:15 -0400 |
commit | af5c2bd16ac2e5688c3bf46ea1f95112d696d294 (patch) | |
tree | 80e08edc5c93999f083039a81b65fbf05d47954b /include/asm-x86/page.h | |
parent | 7f2f49a58283110083a7358d2d98025a11653373 (diff) |
x86: fix virt_addr_valid() with CONFIG_DEBUG_VIRTUAL=y, v2
virt_addr_valid() calls __pa(), which calls __phys_addr(). With
CONFIG_DEBUG_VIRTUAL=y, __phys_addr() will kill the kernel if the
address *isn't* valid. That's clearly wrong for virt_addr_valid().
We also incorporate the debugging checks into virt_addr_valid().
Signed-off-by: Vegard Nossum <vegardno@ben.ifi.uio.no>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/page.h')
-rw-r--r-- | include/asm-x86/page.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index c91574776751..d4f1d5791fc1 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -179,6 +179,7 @@ static inline pteval_t native_pte_flags(pte_t pte) | |||
179 | #endif /* CONFIG_PARAVIRT */ | 179 | #endif /* CONFIG_PARAVIRT */ |
180 | 180 | ||
181 | #define __pa(x) __phys_addr((unsigned long)(x)) | 181 | #define __pa(x) __phys_addr((unsigned long)(x)) |
182 | #define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x)) | ||
182 | /* __pa_symbol should be used for C visible symbols. | 183 | /* __pa_symbol should be used for C visible symbols. |
183 | This seems to be the official gcc blessed way to do such arithmetic. */ | 184 | This seems to be the official gcc blessed way to do such arithmetic. */ |
184 | #define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x))) | 185 | #define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x))) |
@@ -188,9 +189,14 @@ static inline pteval_t native_pte_flags(pte_t pte) | |||
188 | #define __boot_va(x) __va(x) | 189 | #define __boot_va(x) __va(x) |
189 | #define __boot_pa(x) __pa(x) | 190 | #define __boot_pa(x) __pa(x) |
190 | 191 | ||
192 | /* | ||
193 | * virt_to_page(kaddr) returns a valid pointer if and only if | ||
194 | * virt_addr_valid(kaddr) returns true. | ||
195 | */ | ||
191 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 196 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
192 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 197 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
193 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 198 | extern bool __virt_addr_valid(unsigned long kaddr); |
199 | #define virt_addr_valid(kaddr) __virt_addr_valid((unsigned long) (kaddr)) | ||
194 | 200 | ||
195 | #endif /* __ASSEMBLY__ */ | 201 | #endif /* __ASSEMBLY__ */ |
196 | 202 | ||