|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/3] xen/err: Support an optional per-arch slide for the error region
>>> On 01.11.16 at 11:46, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- 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);
I don't see the need for the inner cast here and ...
> }
>
> static inline long __must_check PTR_ERR(const void *ptr)
> {
> - return (long)ptr;
> + return (long)((unsigned long)ptr + ARCH_ERR_PTR_SLIDE);
... the outer one here.
And then of course this change is pointless without patch 3, which
I have reservations against (will reply there).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |