ia64/xen-unstable

changeset 10835:a4ab169ee850

[powerpc] Handle 2 forms of NULL guest handle

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Thu Jul 13 11:26:51 2006 -0400 (2006-07-13)
parents fcef9a741e1d
children 80e2c1b3f9b1
files xen/arch/powerpc/usercopy.c xen/include/asm-powerpc/guest_access.h
line diff
     1.1 --- a/xen/arch/powerpc/usercopy.c	Thu Jul 13 11:25:36 2006 -0400
     1.2 +++ b/xen/arch/powerpc/usercopy.c	Thu Jul 13 11:26:51 2006 -0400
     1.3 @@ -231,3 +231,12 @@ void xencomm_add_offset(void *handle, un
     1.4          bytes -= chunk_skip;
     1.5      }
     1.6  }
     1.7 +
     1.8 +int xencomm_handle_is_null(void *ptr)
     1.9 +{
    1.10 +    struct xencomm_desc *desc;
    1.11 +
    1.12 +    desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)ptr);
    1.13 +
    1.14 +    return (desc->address[0] == XENCOMM_INVALID);
    1.15 +}
     2.1 --- a/xen/include/asm-powerpc/guest_access.h	Thu Jul 13 11:25:36 2006 -0400
     2.2 +++ b/xen/include/asm-powerpc/guest_access.h	Thu Jul 13 11:26:51 2006 -0400
     2.3 @@ -26,9 +26,12 @@ extern unsigned long xencomm_copy_to_gue
     2.4  extern unsigned long xencomm_copy_from_guest(void *to, const void *from,
     2.5          unsigned int len, unsigned int skip); 
     2.6  extern void xencomm_add_offset(void *handle, unsigned int bytes);
     2.7 +extern int xencomm_handle_is_null(void *ptr);
     2.8 +
     2.9  
    2.10  /* Is the guest handle a NULL reference? */
    2.11 -#define guest_handle_is_null(hnd)        ((hnd).p == NULL)
    2.12 +#define guest_handle_is_null(hnd) \
    2.13 +    ((hnd).p == NULL || xencomm_handle_is_null((hnd).p))
    2.14  
    2.15  /* Offset the given guest handle into the array it refers to. */
    2.16  #define guest_handle_add_offset(hnd, nr) ({         \