From: mhiramat@kernel.org (Masami Hiramatsu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH -tip 3/4] arm64: Cleanup in_exception_text() and move it in asm/sections.h
Date: Thu, 17 Aug 2017 16:16:06 +0900 [thread overview]
Message-ID: <150295415599.14424.2567748523337189088.stgit@devbox> (raw)
In-Reply-To: <150295395797.14424.968407208436624832.stgit@devbox>
Cleanup in_exception_text() using memory_contains() and
move it in asm/sections.h from asm/trap.h because
section symbols and memory_contains() are defined in
asm/sections.h.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
arch/arm64/include/asm/sections.h | 16 ++++++++++++++++
arch/arm64/include/asm/traps.h | 16 ----------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/arm64/include/asm/sections.h b/arch/arm64/include/asm/sections.h
index 941267caa39c..abaa8ac79eaf 100644
--- a/arch/arm64/include/asm/sections.h
+++ b/arch/arm64/include/asm/sections.h
@@ -29,4 +29,20 @@ extern char __inittext_begin[], __inittext_end[];
extern char __irqentry_text_start[], __irqentry_text_end[];
extern char __mmuoff_data_start[], __mmuoff_data_end[];
+/**
+ * in_exception_text - check if an address is in exception_text or
+ * irqentry_text
+ * @addr: virtual address to be checked
+ *
+ * Returns: true if the address specified by @addr is in the exception_text or
+ * irqentry_text, false otherwise.
+ */
+static inline bool in_exception_text(unsigned long addr)
+{
+ return memory_contains(__exception_text_start, __exception_text_end,
+ (void *)addr, 0) ||
+ memory_contains(__irqentry_text_start, __irqentry_text_end,
+ (void *)addr, 0);
+}
+
#endif /* __ASM_SECTIONS_H */
diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h
index 47a9066f7c86..c3734c3e8115 100644
--- a/arch/arm64/include/asm/traps.h
+++ b/arch/arm64/include/asm/traps.h
@@ -37,20 +37,4 @@ void unregister_undef_hook(struct undef_hook *hook);
void arm64_notify_segfault(struct pt_regs *regs, unsigned long addr);
-static inline int __in_irqentry_text(unsigned long ptr)
-{
- return ptr >= (unsigned long)&__irqentry_text_start &&
- ptr < (unsigned long)&__irqentry_text_end;
-}
-
-static inline int in_exception_text(unsigned long ptr)
-{
- int in;
-
- in = ptr >= (unsigned long)&__exception_text_start &&
- ptr < (unsigned long)&__exception_text_end;
-
- return in ? : __in_irqentry_text(ptr);
-}
-
#endif
next prev parent reply other threads:[~2017-08-17 7:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 7:12 [PATCH -tip 0/4] Add section address checking helper Masami Hiramatsu
2017-08-17 7:13 ` [PATCH -tip 1/4] x86: Add in_entry_text() helper function Masami Hiramatsu
2017-08-17 7:15 ` [PATCH -tip 2/4] arm: Cleanup in_exception_text() and move it in asm/sections.h Masami Hiramatsu
2017-09-03 22:21 ` Russell King - ARM Linux
2017-09-04 15:22 ` Masami Hiramatsu
2017-08-17 7:16 ` Masami Hiramatsu [this message]
2017-08-17 7:17 ` [PATCH -tip 4/4] extable: kallsyms: Add in_init_text() and in_core_text() helper Masami Hiramatsu
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=150295415599.14424.2567748523337189088.stgit@devbox \
--to=mhiramat@kernel.org \
--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).