From patchwork Fri Jul 22 21:24:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 9244339 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 A431B60459 for ; Fri, 22 Jul 2016 21:28:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F3B9280DE for ; Fri, 22 Jul 2016 21:28:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 801DB2810E; Fri, 22 Jul 2016 21:28:01 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3BC35280DE for ; Fri, 22 Jul 2016 21:27:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bQhwe-00014V-AG; Fri, 22 Jul 2016 21:25:20 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bQhwd-00013d-GG for xen-devel@lists.xensource.com; Fri, 22 Jul 2016 21:25:19 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 87/2C-05661-E3F82975; Fri, 22 Jul 2016 21:25:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsVybKJsh65t/6R wg7nTbSzuTXnP7sDosb1vF3sAYxRrZl5SfkUCa8aDydsYC7ZNZKzY8b6FvYHxUn0XIxeHkMBU RokF/x+xQDgzmCTmzGhl72Lk4GAT0JW4eVsCJC4isIFJYuGXu+wgDrPAUk6JDzO3sXYxcnIIC 0RIHDy2lwnEZhFQlVi4rZcZxOYVcJC493wbC4gtISAn0fJjNyvIUE4BR4lNS5VAwkJAJc1zGs HCEgIFEvsPR0NUe0ksunGJFcJWk7h6bhPzBEa+BYwMqxjVi1OLylKLdI30kooy0zNKchMzc3Q NDcz0clOLixPTU3MSk4r1kvNzNzECw4QBCHYwLvvrdIhRkoNJSZT3ffCkcCG+pPyUyozE4oz4 otKc1OJDjDIcHEoSvPN6gXKCRanpqRVpmTnAgIVJS3DwKInwfgBJ8xYXJOYWZ6ZDpE4xKkqJ8 94ASQiAJDJK8+DaYFFyiVFWSpiXEegQIZ6C1KLczBJU+VeM4hyMSsIQ43ky80rgpr8CWswEtH iOQD/I4pJEhJRUA+PSa7M+MqRW1YXzaj88u5RfeiPjuc3sPMwqhhl3inwU7PQSillLOL338JU X3tQrTbxdfMmDIeVI9tvLSSUmKY+fzjy2zOTl4+olf1cpxIWsT7Kc8+XgoZVf1LZ/+lZy5n2n 9M1QjxO3LH5PWaqwUjT855Lq+xNZjVWDazaZ3LXhWqJx8ZtkvaoSS3FGoqEWc1FxIgBUOwHTj QIAAA== X-Env-Sender: mcgrof@kernel.org X-Msg-Ref: server-14.tower-21.messagelabs.com!1469222716!25159416!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46819 invoked from network); 22 Jul 2016 21:25:17 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-14.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Jul 2016 21:25:17 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98DBE205C4; Fri, 22 Jul 2016 21:25:13 +0000 (UTC) Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A28A205BC; Fri, 22 Jul 2016 21:25:09 +0000 (UTC) From: "Luis R. Rodriguez" To: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, linux@arm.linux.org.uk, mhiramat@kernel.org, masami.hiramatsu.pt@hitachi.com, jbaron@akamai.com, heiko.carstens@de.ibm.com, ananth@linux.vnet.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, realmz6@gmail.com Date: Fri, 22 Jul 2016 14:24:40 -0700 Message-Id: <1469222687-1600-7-git-send-email-mcgrof@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1469222687-1600-1-git-send-email-mcgrof@kernel.org> References: <1469222687-1600-1-git-send-email-mcgrof@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: gnomes@lxorguk.ukuu.org.uk, linux-ia64@vger.kernel.org, jkosina@suse.cz, benh@kernel.crashing.org, ming.lei@canonical.com, linux@rasmusvillemoes.dk, platform-driver-x86@vger.kernel.org, paul.gortmaker@windriver.com, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, xen-devel@lists.xensource.com, linux-sh@vger.kernel.org, x86@kernel.org, fontana@sharpeleven.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, dvhart@infradead.org, dwmw2@infradead.org, pali.rohar@gmail.com, keescook@chromium.org, arnd@arndb.de, will.deacon@arm.com, rusty@rustcorp.com.au, rostedt@goodmis.org, christopher.denicolo@suse.com, ak@linux.intel.com, ciaran.farrell@suse.com, jpoimboe@redhat.com, andriy.shevchenko@linux.intel.com, mcb30@ipxe.org, linux-kbuild@vger.kernel.org, alan@linux.intel.com, jgross@suse.com, pebolle@tiscali.nl, tony.luck@intel.com, ananth@in.ibm.com, gregkh@linuxfoundation.org, luto@amacapital.net, "Luis R. Rodriguez" , mmarek@suse.com, david.vrabel@citrix.com, andrew.cooper3@citrix.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, korea.drzix@gmail.com Subject: [Xen-devel] [RFC v3 06/13] ranges.h: add helpers to build and identify Linux section ranges X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Section ranges are on one of the types of custom sections types used in Linux. This provides a series of helpers for defining them and using them. Most importantly this also enables us to avoid modifying the linker script when we add new section range. It turns out a lot of custom sections are actually section ranges, and these are typically spelled out in their architecture specific asm/sections.h file -- we anable architectures to override what asm is used for section ranges but start by defult trusting the asm-generic version all around. v3: new in this series, uses copyleft-next Signed-off-by: Luis R. Rodriguez --- arch/alpha/include/asm/ranges.h | 6 ++++ arch/arc/include/asm/ranges.h | 6 ++++ arch/arm/include/asm/ranges.h | 6 ++++ arch/arm64/include/asm/ranges.h | 6 ++++ arch/avr32/include/asm/ranges.h | 6 ++++ arch/blackfin/include/asm/ranges.h | 6 ++++ arch/c6x/include/asm/ranges.h | 6 ++++ arch/cris/include/asm/ranges.h | 6 ++++ arch/frv/include/asm/ranges.h | 6 ++++ arch/h8300/include/asm/ranges.h | 6 ++++ arch/hexagon/include/asm/ranges.h | 6 ++++ arch/ia64/include/asm/ranges.h | 6 ++++ arch/m32r/include/asm/ranges.h | 6 ++++ arch/m68k/include/asm/ranges.h | 6 ++++ arch/metag/include/asm/ranges.h | 6 ++++ arch/microblaze/include/asm/ranges.h | 6 ++++ arch/mips/include/asm/ranges.h | 6 ++++ arch/mn10300/include/asm/ranges.h | 6 ++++ arch/nios2/include/asm/ranges.h | 6 ++++ arch/openrisc/include/asm/ranges.h | 6 ++++ arch/parisc/include/asm/ranges.h | 6 ++++ arch/powerpc/include/asm/ranges.h | 6 ++++ arch/s390/include/asm/ranges.h | 6 ++++ arch/score/include/asm/ranges.h | 6 ++++ arch/sh/include/asm/ranges.h | 6 ++++ arch/sparc/include/asm/ranges.h | 6 ++++ arch/tile/include/asm/ranges.h | 6 ++++ arch/um/include/asm/ranges.h | 6 ++++ arch/unicore32/include/asm/ranges.h | 6 ++++ arch/x86/include/asm/ranges.h | 6 ++++ arch/xtensa/include/asm/ranges.h | 6 ++++ include/asm-generic/ranges.h | 70 ++++++++++++++++++++++++++++++++++++ include/linux/ranges.h | 54 ++++++++++++++++++++++++++++ 33 files changed, 310 insertions(+) create mode 100644 arch/alpha/include/asm/ranges.h create mode 100644 arch/arc/include/asm/ranges.h create mode 100644 arch/arm/include/asm/ranges.h create mode 100644 arch/arm64/include/asm/ranges.h create mode 100644 arch/avr32/include/asm/ranges.h create mode 100644 arch/blackfin/include/asm/ranges.h create mode 100644 arch/c6x/include/asm/ranges.h create mode 100644 arch/cris/include/asm/ranges.h create mode 100644 arch/frv/include/asm/ranges.h create mode 100644 arch/h8300/include/asm/ranges.h create mode 100644 arch/hexagon/include/asm/ranges.h create mode 100644 arch/ia64/include/asm/ranges.h create mode 100644 arch/m32r/include/asm/ranges.h create mode 100644 arch/m68k/include/asm/ranges.h create mode 100644 arch/metag/include/asm/ranges.h create mode 100644 arch/microblaze/include/asm/ranges.h create mode 100644 arch/mips/include/asm/ranges.h create mode 100644 arch/mn10300/include/asm/ranges.h create mode 100644 arch/nios2/include/asm/ranges.h create mode 100644 arch/openrisc/include/asm/ranges.h create mode 100644 arch/parisc/include/asm/ranges.h create mode 100644 arch/powerpc/include/asm/ranges.h create mode 100644 arch/s390/include/asm/ranges.h create mode 100644 arch/score/include/asm/ranges.h create mode 100644 arch/sh/include/asm/ranges.h create mode 100644 arch/sparc/include/asm/ranges.h create mode 100644 arch/tile/include/asm/ranges.h create mode 100644 arch/um/include/asm/ranges.h create mode 100644 arch/unicore32/include/asm/ranges.h create mode 100644 arch/x86/include/asm/ranges.h create mode 100644 arch/xtensa/include/asm/ranges.h create mode 100644 include/asm-generic/ranges.h create mode 100644 include/linux/ranges.h diff --git a/arch/alpha/include/asm/ranges.h b/arch/alpha/include/asm/ranges.h new file mode 100644 index 000000000000..b7bc4107bc75 --- /dev/null +++ b/arch/alpha/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_ALPHA_RANGES_H +#define _ASM_ALPHA_RANGES_H + +#include + +#endif /* _ASM_ALPHA_RANGES_H */ diff --git a/arch/arc/include/asm/ranges.h b/arch/arc/include/asm/ranges.h new file mode 100644 index 000000000000..a761243bf79f --- /dev/null +++ b/arch/arc/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_ARC_RANGES_H +#define _ASM_ARC_RANGES_H + +#include + +#endif /* _ASM_ARC_RANGES_H */ diff --git a/arch/arm/include/asm/ranges.h b/arch/arm/include/asm/ranges.h new file mode 100644 index 000000000000..fb059e205f90 --- /dev/null +++ b/arch/arm/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_ARM_RANGES_H +#define _ASM_ARM_RANGES_H + +#include + +#endif /* _ASM_ARM_RANGES_H */ diff --git a/arch/arm64/include/asm/ranges.h b/arch/arm64/include/asm/ranges.h new file mode 100644 index 000000000000..0e0b52cc8d41 --- /dev/null +++ b/arch/arm64/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_ARM64_RANGES_H +#define _ASM_ARM64_RANGES_H + +#include + +#endif /* _ASM_ARM64_RANGES_H */ diff --git a/arch/avr32/include/asm/ranges.h b/arch/avr32/include/asm/ranges.h new file mode 100644 index 000000000000..0f50a1af03e1 --- /dev/null +++ b/arch/avr32/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_AVR32_RANGES_H +#define _ASM_AVR32_RANGES_H + +#include + +#endif /* _ASM_AVR32_RANGES_H */ diff --git a/arch/blackfin/include/asm/ranges.h b/arch/blackfin/include/asm/ranges.h new file mode 100644 index 000000000000..e1d133639a45 --- /dev/null +++ b/arch/blackfin/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_BLACKFIN_RANGES_H +#define _ASM_BLACKFIN_RANGES_H + +#include + +#endif /* _ASM_BLACKFIN_RANGES_H */ diff --git a/arch/c6x/include/asm/ranges.h b/arch/c6x/include/asm/ranges.h new file mode 100644 index 000000000000..0e8e6e149d55 --- /dev/null +++ b/arch/c6x/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_C6X_RANGES_H +#define _ASM_C6X_RANGES_H + +#include + +#endif /* _ASM_C6X_RANGES_H */ diff --git a/arch/cris/include/asm/ranges.h b/arch/cris/include/asm/ranges.h new file mode 100644 index 000000000000..8567f55ae4ea --- /dev/null +++ b/arch/cris/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_CRIS_RANGES_H +#define _ASM_CRIS_RANGES_H + +#include + +#endif /* _ASM_CRIS_RANGES_H */ diff --git a/arch/frv/include/asm/ranges.h b/arch/frv/include/asm/ranges.h new file mode 100644 index 000000000000..f11a6f0fb0bd --- /dev/null +++ b/arch/frv/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_FRV_RANGES_H +#define _ASM_FRV_RANGES_H + +#include + +#endif /* _ASM_FRV_RANGES_H */ diff --git a/arch/h8300/include/asm/ranges.h b/arch/h8300/include/asm/ranges.h new file mode 100644 index 000000000000..ab08bd6bd067 --- /dev/null +++ b/arch/h8300/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_H8300_RANGES_H +#define _ASM_H8300_RANGES_H + +#include + +#endif /* _ASM_H8300_RANGES_H */ diff --git a/arch/hexagon/include/asm/ranges.h b/arch/hexagon/include/asm/ranges.h new file mode 100644 index 000000000000..56e5241abc6b --- /dev/null +++ b/arch/hexagon/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_HEXAGON_RANGES_H +#define _ASM_HEXAGON_RANGES_H + +#include + +#endif /* _ASM_HEXAGON_RANGES_H */ diff --git a/arch/ia64/include/asm/ranges.h b/arch/ia64/include/asm/ranges.h new file mode 100644 index 000000000000..4e69cbcfd0e7 --- /dev/null +++ b/arch/ia64/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_IA64_RANGES_H +#define _ASM_IA64_RANGES_H + +#include + +#endif /* _ASM_IA64_RANGES_H */ diff --git a/arch/m32r/include/asm/ranges.h b/arch/m32r/include/asm/ranges.h new file mode 100644 index 000000000000..dd33a0b94de4 --- /dev/null +++ b/arch/m32r/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_M32R_RANGES_H +#define _ASM_M32R_RANGES_H + +#include + +#endif /* _ASM_M32R_RANGES_H */ diff --git a/arch/m68k/include/asm/ranges.h b/arch/m68k/include/asm/ranges.h new file mode 100644 index 000000000000..292a00baa73e --- /dev/null +++ b/arch/m68k/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_M68K_RANGES_H +#define _ASM_M68K_RANGES_H + +#include + +#endif /* _ASM_M68K_RANGES_H */ diff --git a/arch/metag/include/asm/ranges.h b/arch/metag/include/asm/ranges.h new file mode 100644 index 000000000000..42a77c098c85 --- /dev/null +++ b/arch/metag/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_METAG_RANGES_H +#define _ASM_METAG_RANGES_H + +#include + +#endif /* _ASM_METAG_RANGES_H */ diff --git a/arch/microblaze/include/asm/ranges.h b/arch/microblaze/include/asm/ranges.h new file mode 100644 index 000000000000..48d58e38f1e1 --- /dev/null +++ b/arch/microblaze/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_MICROBLAZE_RANGES_H +#define _ASM_MICROBLAZE_RANGES_H + +#include + +#endif /* _ASM_MICROBLAZE_RANGES_H */ diff --git a/arch/mips/include/asm/ranges.h b/arch/mips/include/asm/ranges.h new file mode 100644 index 000000000000..675a55cd3719 --- /dev/null +++ b/arch/mips/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_MIPS_RANGES_H +#define _ASM_MIPS_RANGES_H + +#include + +#endif /* _ASM_MIPS_RANGES_H */ diff --git a/arch/mn10300/include/asm/ranges.h b/arch/mn10300/include/asm/ranges.h new file mode 100644 index 000000000000..fb7f43a3c19d --- /dev/null +++ b/arch/mn10300/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_MN10300_RANGES_H +#define _ASM_MN10300_RANGES_H + +#include + +#endif /* _ASM_MN10300_RANGES_H */ diff --git a/arch/nios2/include/asm/ranges.h b/arch/nios2/include/asm/ranges.h new file mode 100644 index 000000000000..ab1991981c0f --- /dev/null +++ b/arch/nios2/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_NIOS2_RANGES_H +#define _ASM_NIOS2_RANGES_H + +#include + +#endif /* _ASM_NIOS2_RANGES_H */ diff --git a/arch/openrisc/include/asm/ranges.h b/arch/openrisc/include/asm/ranges.h new file mode 100644 index 000000000000..a64be842983f --- /dev/null +++ b/arch/openrisc/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_OPENRISC_RANGES_H +#define _ASM_OPENRISC_RANGES_H + +#include + +#endif /* _ASM_OPENRISC_RANGES_H */ diff --git a/arch/parisc/include/asm/ranges.h b/arch/parisc/include/asm/ranges.h new file mode 100644 index 000000000000..dd6b5c215941 --- /dev/null +++ b/arch/parisc/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_PARISC_RANGES_H +#define _ASM_PARISC_RANGES_H + +#include + +#endif /* _ASM_PARISC_RANGES_H */ diff --git a/arch/powerpc/include/asm/ranges.h b/arch/powerpc/include/asm/ranges.h new file mode 100644 index 000000000000..240c51a210d4 --- /dev/null +++ b/arch/powerpc/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_POWERPC_RANGES_H +#define _ASM_POWERPC_RANGES_H + +#include + +#endif /* _ASM_POWERPC_RANGES_H */ diff --git a/arch/s390/include/asm/ranges.h b/arch/s390/include/asm/ranges.h new file mode 100644 index 000000000000..d4788451f176 --- /dev/null +++ b/arch/s390/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_S390_RANGES_H +#define _ASM_S390_RANGES_H + +#include + +#endif /* _ASM_S390_RANGES_H */ diff --git a/arch/score/include/asm/ranges.h b/arch/score/include/asm/ranges.h new file mode 100644 index 000000000000..d67f859eeda3 --- /dev/null +++ b/arch/score/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_SCORE_RANGES_H +#define _ASM_SCORE_RANGES_H + +#include + +#endif /* _ASM_SCORE_RANGES_H */ diff --git a/arch/sh/include/asm/ranges.h b/arch/sh/include/asm/ranges.h new file mode 100644 index 000000000000..99df0b65f40a --- /dev/null +++ b/arch/sh/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_SH_RANGES_H +#define _ASM_SH_RANGES_H + +#include + +#endif /* _ASM_SH_RANGES_H */ diff --git a/arch/sparc/include/asm/ranges.h b/arch/sparc/include/asm/ranges.h new file mode 100644 index 000000000000..8ff4765ccd9b --- /dev/null +++ b/arch/sparc/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_SPARC_RANGES_H +#define _ASM_SPARC_RANGES_H + +#include + +#endif /* _ASM_SPARC_RANGES_H */ diff --git a/arch/tile/include/asm/ranges.h b/arch/tile/include/asm/ranges.h new file mode 100644 index 000000000000..ceda3fb075e0 --- /dev/null +++ b/arch/tile/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_TILE_RANGES_H +#define _ASM_TILE_RANGES_H + +#include + +#endif /* _ASM_TILE_RANGES_H */ diff --git a/arch/um/include/asm/ranges.h b/arch/um/include/asm/ranges.h new file mode 100644 index 000000000000..7c9c20e47879 --- /dev/null +++ b/arch/um/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_UM_RANGES_H +#define _ASM_UM_RANGES_H + +#include + +#endif /* _ASM_UM_RANGES_H */ diff --git a/arch/unicore32/include/asm/ranges.h b/arch/unicore32/include/asm/ranges.h new file mode 100644 index 000000000000..92526340d73c --- /dev/null +++ b/arch/unicore32/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_UNICORE32_RANGES_H +#define _ASM_UNICORE32_RANGES_H + +#include + +#endif /* _ASM_UNICORE32_RANGES_H */ diff --git a/arch/x86/include/asm/ranges.h b/arch/x86/include/asm/ranges.h new file mode 100644 index 000000000000..4a0c824d4082 --- /dev/null +++ b/arch/x86/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_X86_RANGES_H +#define _ASM_X86_RANGES_H + +#include + +#endif /* _ASM_X86_RANGES_H */ diff --git a/arch/xtensa/include/asm/ranges.h b/arch/xtensa/include/asm/ranges.h new file mode 100644 index 000000000000..c7360d1c9c85 --- /dev/null +++ b/arch/xtensa/include/asm/ranges.h @@ -0,0 +1,6 @@ +#ifndef _ASM_XTENSA_RANGES_H +#define _ASM_XTENSA_RANGES_H + +#include + +#endif /* _ASM_XTENSA_RANGES_H */ diff --git a/include/asm-generic/ranges.h b/include/asm-generic/ranges.h new file mode 100644 index 000000000000..0d54c632f714 --- /dev/null +++ b/include/asm-generic/ranges.h @@ -0,0 +1,70 @@ +#ifndef _ASM_GENERIC_RANGES_H_ +#define _ASM_GENERIC_RANGES_H_ +/* + * Copyright (C) 2016 Luis R. Rodriguez + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of copyleft-next (version 0.3.1 or later) as published + * at http://copyleft-next.org/. + */ +#ifdef __KERNEL__ +# include +#endif /* __KERNEL__ */ + +#define SECTION_TYPE_RANGES rng + +#define SECTION_RNG(section, name) \ + SECTION_TYPE(section, SECTION_TYPE_RANGES, name, \ + SECTION_ORDER_ANY) + +#define SECTION_RNG_LEVEL(section, name, level) \ + SECTION_TYPE(section, SECTION_TYPE_RANGES, name, level) + +#define SECTION_RANGE_ALL(section) \ + SECTION_TYPE_ALL(section,SECTION_TYPE_RANGES) + +#ifndef section_rng +# define section_rng(section, name, flags) \ + section_type(section, SECTION_TYPE_RANGES, name, \ + SECTION_ORDER_ANY, flags) +#endif + +#ifndef section_rng_asmtype +# define section_rng_asmtype(section, name, flags, asmtype) \ + section_type_asmtype(section, SECTION_TYPE_RANGES, name, \ + SECTION_ORDER_ANY, flags, asmtype) +#endif + +#ifndef section_rng_level +# define section_rng_level(section, name, level, flags) \ + section_type(section, SECTION_TYPE_RANGES, name, level, flags) +#endif + +#ifndef push_section_rng +# define push_section_rng(section, name, flags) \ + push_section_type(section, SECTION_TYPE_RANGES, name, \ + SECTION_ORDER_ANY, flags) +#endif + +#ifndef push_section_rng_level +# define push_section_rng_level(section, name, level, flags) \ + push_section_type(section, SECTION_TYPE_RANGES, name, \ + level, flags) +#endif + +#if defined(__ASSEMBLER__) || defined(__ASSEMBLY__) + +# ifndef DECLARE_SECTION_RANGE +# define DECLARE_SECTION_RANGE(section, name) \ + push_section_rng_level(section, name,,) ; \ + .globl name ; \ +name: ; \ + .popsection \ + \ + push_section_rng_level(section, name, ~,) ; \ + .popsection +# endif + +#endif /* defined(__ASSEMBLER__) || defined(__ASSEMBLY__) */ + +#endif /* _ASM_GENERIC_RANGES_H_ */ diff --git a/include/linux/ranges.h b/include/linux/ranges.h new file mode 100644 index 000000000000..1146c7225096 --- /dev/null +++ b/include/linux/ranges.h @@ -0,0 +1,54 @@ +#ifndef _LINUX_RANGES_H +#define _LINUX_RANGES_H +/* + * Linux section ranges + * + * Copyright (C) 2016 Luis R. Rodriguez + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of copyleft-next (version 0.3.1 or later) as published + * at http://copyleft-next.org/. + */ +#ifdef __KERNEL__ +#include +# include +#endif /* __KERNEL__ */ + +#ifndef __ASSEMBLY__ + +#define SECTION_ADDR_IN_RANGE(name, addr) \ + (addr >= (unsigned long) LINUX_SECTION_START(name) && \ + addr < (unsigned long) LINUX_SECTION_END(name)) + +#define DECLARE_SECTION_RANGE(name) \ + DECLARE_LINUX_SECTION_RO(char, name) + +#define SECTION_RANGE_BEGIN(name, __section) \ + const __typeof__(name[0]) \ + __attribute__((used, \ + weak, \ + __aligned__(LINUX_SECTION_ALIGNMENT(name)),\ + section(SECTION_RNG_LEVEL(__section, name, )))) + +#define SECTION_RANGE_END(name, __section) \ + const __typeof__(name[0]) \ + __attribute__((used, \ + __aligned__(LINUX_SECTION_ALIGNMENT(name)),\ + section(SECTION_RNG_LEVEL(__section, name, ~)))) + +#define DEFINE_SECTION_RANGE(name, section) \ + DECLARE_LINUX_SECTION_RO(char, name); \ + SECTION_RANGE_BEGIN(name, section) VMLINUX_SYMBOL(name)[0] = {};\ + SECTION_RANGE_END(name, section) VMLINUX_SYMBOL(name##__end)[0] = {}; + +#define __LINUX_RANGE(section, name) \ + __attribute__((__aligned__(LINUX_SECTION_ALIGNMENT(name)), \ + __section__(SECTION_RNG(section, name)))) + +#define __LINUX_RANGE_ORDER(section, name, level) \ + __attribute__((__aligned__(LINUX_SECTION_ALIGNMENT(name)), \ + __section__(SECTION_RNG_LEVEL(section, name, level)))) + +#endif /* __ASSEMBLY__ */ + +#endif /* _LINUX_RANGES_H */