From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/3] xen/err: Support an optional per-arch slide for the error region
Date: Tue, 1 Nov 2016 10:46:09 +0000 [thread overview]
Message-ID: <1477997170-7795-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1477997170-7795-1-git-send-email-andrew.cooper3@citrix.com>
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
xen/include/xen/err.h | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/xen/include/xen/err.h b/xen/include/xen/err.h
index ef77992..bea7fa3 100644
--- a/xen/include/xen/err.h
+++ b/xen/include/xen/err.h
@@ -15,19 +15,28 @@
*/
#define MAX_ERRNO 4095
+/*
+ * Individual architectures may wish to slide the error region away from its
+ * default position at the very top of virtual address space. (e.g. if Xen
+ * doesn't own the range).
+ */
+#ifndef ARCH_ERR_PTR_SLIDE
+#define ARCH_ERR_PTR_SLIDE 0
+#endif
+
static inline bool IS_ERR_VALUE(unsigned long x)
{
- return x >= (unsigned long)-MAX_ERRNO;
+ return (x + ARCH_ERR_PTR_SLIDE) >= (unsigned long)-MAX_ERRNO;
}
static inline void *__must_check ERR_PTR(long error)
{
- return (void *)error;
+ return (void *)((unsigned long)error - ARCH_ERR_PTR_SLIDE);
}
static inline long __must_check PTR_ERR(const void *ptr)
{
- return (long)ptr;
+ return (long)((unsigned long)ptr + ARCH_ERR_PTR_SLIDE);
}
static inline bool __must_check IS_ERR(const void *ptr)
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-11-01 10:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-01 10:46 [PATCH for-4.9 0/3] Improvements to ERR_PTR() infrastructure Andrew Cooper
2016-11-01 10:46 ` [PATCH 1/3] xen/err: Use static inlines and boolean types Andrew Cooper
2016-11-02 11:33 ` Jan Beulich
2016-11-01 10:46 ` Andrew Cooper [this message]
2016-11-02 11:37 ` [PATCH 2/3] xen/err: Support an optional per-arch slide for the error region Jan Beulich
2016-11-01 10:46 ` [PATCH 3/3] xen/x86: Use non-canonical pointers for ERR_PTR() errors Andrew Cooper
2016-11-02 11:47 ` Jan Beulich
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=1477997170-7795-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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).