diff options
| author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2009-02-04 18:24:09 -0500 |
|---|---|---|
| committer | H. Peter Anvin <hpa@linux.intel.com> | 2009-02-04 19:16:55 -0500 |
| commit | 0973a06cde8cc1522fbcf2baacb926f1ee3f4c79 (patch) | |
| tree | 0f62e77297b94945f414f0ae289934f307e457dd | |
| parent | 010060741ad35eacb504414bc6fb9bb575b15f62 (diff) | |
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>
| -rw-r--r-- | arch/x86/mm/fault.c | 15 |
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, | |||
| 775 | return 0; | 775 | return 0; |
| 776 | } | 776 | } |
| 777 | 777 | ||
| 778 | static int fault_in_kernel_space(unsigned long address) | ||
| 779 | { | ||
| 780 | #ifdef CONFIG_X86_32 | ||
| 781 | return address >= TASK_SIZE; | ||
| 782 | #else /* !CONFIG_X86_32 */ | ||
| 783 | return address >= TASK_SIZE64; | ||
| 784 | #endif /* CONFIG_X86_32 */ | ||
| 785 | } | ||
| 786 | |||
| 778 | /* | 787 | /* |
| 779 | * This routine handles page faults. It determines the address, | 788 | * This routine handles page faults. It determines the address, |
| 780 | * and the problem, and then passes it off to one of the appropriate | 789 | * 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) | |||
| 817 | * (error_code & 4) == 0, and that the fault was not a | 826 | * (error_code & 4) == 0, and that the fault was not a |
| 818 | * protection error (error_code & 9) == 0. | 827 | * protection error (error_code & 9) == 0. |
| 819 | */ | 828 | */ |
| 820 | #ifdef CONFIG_X86_32 | 829 | if (unlikely(fault_in_kernel_space(address))) { |
| 821 | if (unlikely(address >= TASK_SIZE)) { | ||
| 822 | #else | ||
| 823 | if (unlikely(address >= TASK_SIZE64)) { | ||
| 824 | #endif | ||
| 825 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && | 830 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && |
| 826 | vmalloc_fault(address) >= 0) | 831 | vmalloc_fault(address) >= 0) |
| 827 | return; | 832 | return; |
