summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorHiroshi Shimamoto2009-02-05 00:24:09 +0100
committerH. Peter Anvin2009-02-05 01:16:55 +0100
commit0973a06cde8cc1522fbcf2baacb926f1ee3f4c79 (patch)
tree0f62e77297b94945f414f0ae289934f307e457dd /arch/x86
parentx86: add might_sleep() to do_page_fault() (diff)
downloadkernel-qcow2-linux-0973a06cde8cc1522fbcf2baacb926f1ee3f4c79.tar.gz
kernel-qcow2-linux-0973a06cde8cc1522fbcf2baacb926f1ee3f4c79.tar.xz
kernel-qcow2-linux-0973a06cde8cc1522fbcf2baacb926f1ee3f4c79.zip
x86: mm: introduce helper function in fault.c
Impact: cleanup Introduce helper function fault_in_kernel_address() to make editors happy. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/fault.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index eb4d7fe05938..8e9b0f1fd872 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -775,6 +775,15 @@ static inline int access_error(unsigned long error_code, int write,
return 0;
}
+static int fault_in_kernel_space(unsigned long address)
+{
+#ifdef CONFIG_X86_32
+ return address >= TASK_SIZE;
+#else /* !CONFIG_X86_32 */
+ return address >= TASK_SIZE64;
+#endif /* CONFIG_X86_32 */
+}
+
/*
* This routine handles page faults. It determines the address,
* and the problem, and then passes it off to one of the appropriate
@@ -817,11 +826,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
* (error_code & 4) == 0, and that the fault was not a
* protection error (error_code & 9) == 0.
*/
-#ifdef CONFIG_X86_32
- if (unlikely(address >= TASK_SIZE)) {
-#else
- if (unlikely(address >= TASK_SIZE64)) {
-#endif
+ if (unlikely(fault_in_kernel_space(address))) {
if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
vmalloc_fault(address) >= 0)
return;