[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/3] xen/err: Support an optional per-arch slide for the error region



No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.