diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-20 07:41:58 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-20 07:55:49 -0400 |
commit | c88d6aa71bd2ad7b4da2f281bd64ada65d533d83 (patch) | |
tree | dbc0f5ad6f48abddde2072300b0e4617d7d46cd4 /arch/arm/mm/fault.c | |
parent | 4275c13ca8859af8a1390856c82173bcdfc32938 (diff) |
ARM: Provide definitions and helpers for decoding the FSR register
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/fault.c')
-rw-r--r-- | arch/arm/mm/fault.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index cc8829d7e116..1bb38712c86b 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -25,6 +25,18 @@ | |||
25 | 25 | ||
26 | #include "fault.h" | 26 | #include "fault.h" |
27 | 27 | ||
28 | /* | ||
29 | * Fault status register encodings | ||
30 | */ | ||
31 | #define FSR_WRITE (1 << 11) | ||
32 | #define FSR_FS4 (1 << 10) | ||
33 | #define FSR_FS3_0 (15) | ||
34 | |||
35 | static inline int fsr_fs(unsigned int fsr) | ||
36 | { | ||
37 | return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6; | ||
38 | } | ||
39 | |||
28 | #ifdef CONFIG_MMU | 40 | #ifdef CONFIG_MMU |
29 | 41 | ||
30 | #ifdef CONFIG_KPROBES | 42 | #ifdef CONFIG_KPROBES |
@@ -201,7 +213,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, | |||
201 | * memory access, so we can handle it. | 213 | * memory access, so we can handle it. |
202 | */ | 214 | */ |
203 | good_area: | 215 | good_area: |
204 | if (fsr & (1 << 11)) /* write? */ | 216 | if (fsr & FSR_WRITE) |
205 | mask = VM_WRITE; | 217 | mask = VM_WRITE; |
206 | else | 218 | else |
207 | mask = VM_READ|VM_EXEC|VM_WRITE; | 219 | mask = VM_READ|VM_EXEC|VM_WRITE; |
@@ -216,7 +228,7 @@ good_area: | |||
216 | * than endlessly redo the fault. | 228 | * than endlessly redo the fault. |
217 | */ | 229 | */ |
218 | survive: | 230 | survive: |
219 | fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & (1 << 11)) ? FAULT_FLAG_WRITE : 0); | 231 | fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0); |
220 | if (unlikely(fault & VM_FAULT_ERROR)) { | 232 | if (unlikely(fault & VM_FAULT_ERROR)) { |
221 | if (fault & VM_FAULT_OOM) | 233 | if (fault & VM_FAULT_OOM) |
222 | goto out_of_memory; | 234 | goto out_of_memory; |
@@ -489,7 +501,7 @@ hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *) | |||
489 | asmlinkage void __exception | 501 | asmlinkage void __exception |
490 | do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | 502 | do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) |
491 | { | 503 | { |
492 | const struct fsr_info *inf = fsr_info + (fsr & 15) + ((fsr & (1 << 10)) >> 6); | 504 | const struct fsr_info *inf = fsr_info + fsr_fs(fsr); |
493 | struct siginfo info; | 505 | struct siginfo info; |
494 | 506 | ||
495 | if (!inf->fn(addr, fsr, regs)) | 507 | if (!inf->fn(addr, fsr, regs)) |