From patchwork Thu Aug 17 07:15:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 9905095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84DE860386 for ; Thu, 17 Aug 2017 07:16:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76FEB28ABC for ; Thu, 17 Aug 2017 07:16:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BC0E28AC0; Thu, 17 Aug 2017 07:16:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 012EB28ABC for ; Thu, 17 Aug 2017 07:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8XFdc9ce6+cGco+yJMKsTw5PZnAR1ln95OjKqMmETII=; b=s2OTGReyMTUpMY gFlrU4oU1Qpek9ykurJiGxO5MrVzeeQOJHYvLyBVV42WEYv10FOZlS9+YE/az9TsA7GWkqd7HaQbr u8PMMVhc1Zznw7qpksNm3I0c8/X8CzE76mP48JN8hx6osU39zIkg2OoICSMI+U8e7HrrfO9hsZDJF 1LhO5xvX7JyNmM7Ycs+2jxoHYFSFBoryWFM8xTRQwY7IMqBlSTcndgf7JFrfN2HF+6ftTnfntsnPd +hlwvbTT0R4GKhjMelt7y3P20IuC7PF1pjYe0fVf+kk2u4yFZDpmku5cAUagOlsV2Fc0XPOXDX29T pgjzOGg7g1Pf6/5T+bjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1diF2N-0006va-64; Thu, 17 Aug 2017 07:16:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1diF2J-0006tN-0W for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2017 07:16:12 +0000 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 574882170E; Thu, 17 Aug 2017 07:15:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 574882170E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Ingo Molnar Subject: [PATCH -tip 2/4] arm: Cleanup in_exception_text() and move it in asm/sections.h Date: Thu, 17 Aug 2017 16:15:00 +0900 Message-Id: <150295409062.14424.11976553130089631456.stgit@devbox> X-Mailer: git-send-email 2.13.4 In-Reply-To: <150295395797.14424.968407208436624832.stgit@devbox> References: <150295395797.14424.968407208436624832.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170817_001611_097296_7842D1B3 X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Arnd Bergmann , Peter Zijlstra , Catalin Marinas , x86@kernel.org, Will Deacon , Russell King , linux-kernel@vger.kernel.org, Ingo Molnar , Masami Hiramatsu , "H . Peter Anvin" , Thomas Gleixner , Thierry Reding , Andrew Morton , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- arch/arm/include/asm/sections.h | 17 +++++++++++++++++ arch/arm/include/asm/traps.h | 22 +--------------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h index 803bbf2b20b8..76791cfc7619 100644 --- a/arch/arm/include/asm/sections.h +++ b/arch/arm/include/asm/sections.h @@ -4,5 +4,22 @@ #include extern char _exiprom[]; +extern char __exception_text_start[], __exception_text_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_ARM_SECTIONS_H */ diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h index 683d9230984a..0ee9a87b9dd4 100644 --- a/arch/arm/include/asm/traps.h +++ b/arch/arm/include/asm/traps.h @@ -2,6 +2,7 @@ #define _ASMARM_TRAP_H #include +#include struct pt_regs; struct task_struct; @@ -18,27 +19,6 @@ struct undef_hook { void register_undef_hook(struct undef_hook *hook); void unregister_undef_hook(struct undef_hook *hook); -static inline int __in_irqentry_text(unsigned long ptr) -{ - extern char __irqentry_text_start[]; - extern char __irqentry_text_end[]; - - return ptr >= (unsigned long)&__irqentry_text_start && - ptr < (unsigned long)&__irqentry_text_end; -} - -static inline int in_exception_text(unsigned long ptr) -{ - extern char __exception_text_start[]; - extern char __exception_text_end[]; - int in; - - in = ptr >= (unsigned long)&__exception_text_start && - ptr < (unsigned long)&__exception_text_end; - - return in ? : __in_irqentry_text(ptr); -} - extern void __init early_trap_init(void *); extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame); extern void ptrace_break(struct task_struct *tsk, struct pt_regs *regs);