summaryrefslogtreecommitdiff
path: root/arch/arm/mm/fault.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-09-20 12:41:58 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-20 12:55:49 +0100
commitc88d6aa71bd2ad7b4da2f281bd64ada65d533d83 (patch)
treedbc0f5ad6f48abddde2072300b0e4617d7d46cd4 /arch/arm/mm/fault.c
parent4275c13ca8859af8a1390856c82173bcdfc32938 (diff)
downloadlinux-3.10-c88d6aa71bd2ad7b4da2f281bd64ada65d533d83.tar.gz
linux-3.10-c88d6aa71bd2ad7b4da2f281bd64ada65d533d83.tar.bz2
linux-3.10-c88d6aa71bd2ad7b4da2f281bd64ada65d533d83.zip
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.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index cc8829d7e11..1bb38712c86 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -25,6 +25,18 @@
#include "fault.h"
+/*
+ * Fault status register encodings
+ */
+#define FSR_WRITE (1 << 11)
+#define FSR_FS4 (1 << 10)
+#define FSR_FS3_0 (15)
+
+static inline int fsr_fs(unsigned int fsr)
+{
+ return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6;
+}
+
#ifdef CONFIG_MMU
#ifdef CONFIG_KPROBES
@@ -201,7 +213,7 @@ __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
* memory access, so we can handle it.
*/
good_area:
- if (fsr & (1 << 11)) /* write? */
+ if (fsr & FSR_WRITE)
mask = VM_WRITE;
else
mask = VM_READ|VM_EXEC|VM_WRITE;
@@ -216,7 +228,7 @@ good_area:
* than endlessly redo the fault.
*/
survive:
- fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & (1 << 11)) ? FAULT_FLAG_WRITE : 0);
+ fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0);
if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)
goto out_of_memory;
@@ -489,7 +501,7 @@ hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *)
asmlinkage void __exception
do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
{
- const struct fsr_info *inf = fsr_info + (fsr & 15) + ((fsr & (1 << 10)) >> 6);
+ const struct fsr_info *inf = fsr_info + fsr_fs(fsr);
struct siginfo info;
if (!inf->fn(addr, fsr, regs))