linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: zhangwm@marvell.com (Neil Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: add the ability to hook the fault code
Date: Thu, 19 Jun 2014 18:54:56 +0800	[thread overview]
Message-ID: <1403175296-25181-1-git-send-email-zhangwm@marvell.com> (raw)

Add the ability to hook the fault code for future use.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 arch/arm64/include/asm/system_misc.h |    4 ++++
 arch/arm64/mm/fault.c                |   12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
index 7a18fab..a8c19dd 100644
--- a/arch/arm64/include/asm/system_misc.h
+++ b/arch/arm64/include/asm/system_misc.h
@@ -37,6 +37,10 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
 					     struct pt_regs *),
 			   int sig, int code, const char *name);
 
+void hook_fault_code(int nr,
+		int (*fn)(unsigned long, unsigned int, struct pt_regs *),
+		int sig, int code, const char *name);
+
 struct mm_struct;
 extern void show_pte(struct mm_struct *mm, unsigned long addr);
 extern void __show_regs(struct pt_regs *);
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index bcc965e..7902fb6 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -447,6 +447,18 @@ static const char *fault_name(unsigned int esr)
 	return inf->name;
 }
 
+void __init hook_fault_code(int nr,
+		int (*fn)(unsigned long, unsigned int, struct pt_regs *),
+		int sig, int code, const char *name)
+{
+	BUG_ON(nr < 0 || nr >= ARRAY_SIZE(fault_info));
+
+	fault_info[nr].fn   = fn;
+	fault_info[nr].sig  = sig;
+	fault_info[nr].code = code;
+	fault_info[nr].name = name;
+}
+
 /*
  * Dispatch a data abort to the relevant handler.
  */
-- 
1.7.9.5

             reply	other threads:[~2014-06-19 10:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 10:54 Neil Zhang [this message]
2014-06-20  8:25 ` [PATCH] arm64: add the ability to hook the fault code Will Deacon
2014-06-20  8:33   ` Neil Zhang
2014-06-20  8:39     ` Will Deacon
2014-06-20  9:02       ` Neil Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403175296-25181-1-git-send-email-zhangwm@marvell.com \
    --to=zhangwm@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).