ia64/xen-unstable

changeset 6753:03b9919f655e

mlock argument to version hypercall in libxc.

Signed-off-by: Ian Pratt <ian@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Sep 12 12:17:31 2005 +0000 (2005-09-12)
parents 05f36d13e30c
children 939fd35d58da
files tools/libxc/xc_private.c
line diff
     1.1 --- a/tools/libxc/xc_private.c	Mon Sep 12 12:10:43 2005 +0000
     1.2 +++ b/tools/libxc/xc_private.c	Mon Sep 12 12:17:31 2005 +0000
     1.3 @@ -425,23 +425,49 @@ int xc_dom0_op(int xc_handle, dom0_op_t 
     1.4  
     1.5  int xc_version(int xc_handle, int cmd, void *arg)
     1.6  {
     1.7 -    return do_xen_version(xc_handle, cmd, arg);
     1.8 +    int rc, argsize = 0;
     1.9 +
    1.10 +    switch ( cmd )
    1.11 +    {
    1.12 +    case XENVER_extraversion: argsize = sizeof(xen_extraversion_t); break;
    1.13 +    case XENVER_compile_info: argsize = sizeof(xen_compile_info_t); break;
    1.14 +    case XENVER_capabilities: argsize = sizeof(xen_capabilities_info_t); break;
    1.15 +    case XENVER_changeset:    argsize = sizeof(xen_changeset_info_t); break;
    1.16 +    case XENVER_parameters:   argsize = sizeof(xen_parameters_info_t); break;
    1.17 +    }
    1.18 +
    1.19 +    if ( (argsize != 0) && (mlock(arg, argsize) != 0) )
    1.20 +    {
    1.21 +        PERROR("Could not lock memory for version hypercall");
    1.22 +        return -ENOMEM;
    1.23 +    }
    1.24 +
    1.25 +    rc = do_xen_version(xc_handle, cmd, arg);
    1.26 +
    1.27 +    if ( argsize != 0 )
    1.28 +        safe_munlock(arg, argsize);
    1.29 +
    1.30 +    return rc;
    1.31  }
    1.32  
    1.33 -unsigned long xc_make_page_below_4G(int xc_handle, u32 domid, 
    1.34 -				    unsigned long mfn)
    1.35 +unsigned long xc_make_page_below_4G(
    1.36 +    int xc_handle, u32 domid, unsigned long mfn)
    1.37  {
    1.38      unsigned long new_mfn;
    1.39 +
    1.40      if ( xc_domain_memory_decrease_reservation( 
    1.41 -	xc_handle, domid, 1, 0, &mfn ) != 1 )
    1.42 +	xc_handle, domid, 1, 0, &mfn) != 1 )
    1.43      {
    1.44  	fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn);
    1.45  	return 0;
    1.46      }
    1.47 -    if ( xc_domain_memory_increase_reservation( xc_handle, domid, 1, 0, 32, &new_mfn ) != 1 )
    1.48 +
    1.49 +    if ( xc_domain_memory_increase_reservation(
    1.50 +        xc_handle, domid, 1, 0, 32, &new_mfn) != 1 )
    1.51      {
    1.52  	fprintf(stderr,"xc_make_page_below_4G increase failed. mfn=%lx\n",mfn);
    1.53  	return 0;
    1.54      }
    1.55 +
    1.56      return new_mfn;
    1.57  }