@@ -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 */
@@ -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
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(-)