diff options
author | Will Deacon <will.deacon@arm.com> | 2010-09-03 05:39:59 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-09-08 05:04:59 -0400 |
commit | 3a4b5dca53aecb16db9e007d782b2d1e757e941a (patch) | |
tree | 2aae51c15a249882f656972929bf830b8e8a8b63 /arch/arm | |
parent | d56557af19867edb8c0e96f8e26399698a08857f (diff) |
ARM: 6355/1: hw-breakpoint: add mechanism for hooking into prefetch aborts
On ARM processors with hardware breakpoint and watchpoint support,
triggering these events results in a debug exception. These manifest
as prefetch and data aborts respectively.
arch/arm/mm/fault.c already provides hook_fault_code for hooking
into data aborts dependent on the DFSR. This patch adds a new function,
hook_ifault_code for hooking into prefetch aborts in the same manner.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: S. Karthikeyan <informkarthik@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/include/asm/system.h | 4 | ||||
-rw-r--r-- | arch/arm/mm/fault.c | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 8ba1ccf82a02..b516cdea5ae2 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h | |||
@@ -85,6 +85,10 @@ void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, | |||
85 | struct pt_regs *), | 85 | struct pt_regs *), |
86 | int sig, int code, const char *name); | 86 | int sig, int code, const char *name); |
87 | 87 | ||
88 | void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int, | ||
89 | struct pt_regs *), | ||
90 | int sig, int code, const char *name); | ||
91 | |||
88 | #define xchg(ptr,x) \ | 92 | #define xchg(ptr,x) \ |
89 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | 93 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) |
90 | 94 | ||
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 23b0b03af5ea..1e21e125fe3a 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -581,6 +581,19 @@ static struct fsr_info ifsr_info[] = { | |||
581 | { do_bad, SIGBUS, 0, "unknown 31" }, | 581 | { do_bad, SIGBUS, 0, "unknown 31" }, |
582 | }; | 582 | }; |
583 | 583 | ||
584 | void __init | ||
585 | hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *), | ||
586 | int sig, int code, const char *name) | ||
587 | { | ||
588 | if (nr < 0 || nr >= ARRAY_SIZE(ifsr_info)) | ||
589 | BUG(); | ||
590 | |||
591 | ifsr_info[nr].fn = fn; | ||
592 | ifsr_info[nr].sig = sig; | ||
593 | ifsr_info[nr].code = code; | ||
594 | ifsr_info[nr].name = name; | ||
595 | } | ||
596 | |||
584 | asmlinkage void __exception | 597 | asmlinkage void __exception |
585 | do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs) | 598 | do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs) |
586 | { | 599 | { |