From: Thierry Reding <thierry.reding@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>, Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joe Perches <joe@perches.com>,
linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] asm/sections: Add helpers to check for section data
Date: Thu, 29 Oct 2015 09:26:06 +0100 [thread overview]
Message-ID: <1446107167-7001-1-git-send-email-thierry.reding@gmail.com> (raw)
From: Thierry Reding <treding@nvidia.com>
Add a helper to check if an object (given an address and a size) is part
of a section (given beginning and end addresses). For convenience, also
provide a helper that performs this check for __init data using the
__init_begin and __init_end limits.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
include/asm-generic/sections.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index b58fd667f87b..529909090cd6 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -63,4 +63,15 @@ static inline int arch_is_kernel_data(unsigned long addr)
}
#endif
+static inline bool section_contains(void *virt, size_t size, void *begin,
+ void *end)
+{
+ return virt >= begin && virt + size <= end;
+}
+
+static inline bool init_section_contains(void *virt, size_t size)
+{
+ return section_contains(virt, size, __init_begin, __init_end);
+}
+
#endif /* _ASM_GENERIC_SECTIONS_H_ */
--
2.5.0
next reply other threads:[~2015-10-29 8:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 8:26 Thierry Reding [this message]
2015-10-29 8:26 ` [PATCH 1/2] asm/sections: Add helpers to check for section data Thierry Reding
2015-10-29 8:26 ` [PATCH 2/2] printk: Only unregister boot consoles when necessary Thierry Reding
2015-10-29 8:26 ` Thierry Reding
2015-11-05 11:05 ` Andrew Morton
2015-11-05 11:02 ` [PATCH 1/2] asm/sections: Add helpers to check for section data Andrew Morton
2015-11-05 11:02 ` Andrew Morton
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=1446107167-7001-1-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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