ia64/xen-unstable

changeset 12671:6fdbf173142d

[IA64] update xc_set_hvm_param(), add xc_get_hvm_param()

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Sat Dec 02 15:19:50 2006 -0700 (2006-12-02)
parents 0705db48d23c
children d603aed5ad6d
files tools/libxc/ia64/xc_ia64_hvm_build.c
line diff
     1.1 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c	Fri Dec 01 11:40:57 2006 -0700
     1.2 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c	Sat Dec 02 15:19:50 2006 -0700
     1.3 @@ -41,7 +41,7 @@ error_out:
     1.4      return -1;
     1.5  }
     1.6  
     1.7 -static void
     1.8 +int 
     1.9  xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value)
    1.10  {
    1.11      DECLARE_HYPERCALL;
    1.12 @@ -56,15 +56,37 @@ xc_set_hvm_param(int handle, domid_t dom
    1.13      arg.index = param;
    1.14      arg.value = value;
    1.15  
    1.16 -    if (mlock(&arg, sizeof(arg)) != 0) {
    1.17 -        PERROR("Could not lock memory for set parameter");
    1.18 -        return;
    1.19 -    }
    1.20 +    if (mlock(&arg, sizeof(arg)) != 0)
    1.21 +        return -1;
    1.22  
    1.23      rc = do_xen_hypercall(handle, &hypercall);
    1.24      safe_munlock(&arg, sizeof(arg));
    1.25 -    if (rc < 0)
    1.26 -        PERROR("set HVM parameter failed (%d)", rc);
    1.27 +
    1.28 +    return rc;
    1.29 +}
    1.30 +
    1.31 +int 
    1.32 +xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value)
    1.33 +{
    1.34 +    DECLARE_HYPERCALL;
    1.35 +    xen_hvm_param_t arg;
    1.36 +    int rc;
    1.37 +
    1.38 +    hypercall.op = __HYPERVISOR_hvm_op;
    1.39 +    hypercall.arg[0] = HVMOP_get_param;
    1.40 +    hypercall.arg[1] = (unsigned long)&arg;
    1.41 +
    1.42 +    arg.domid = dom;
    1.43 +    arg.index = param;
    1.44 +
    1.45 +    if (mlock(&arg, sizeof(arg)) != 0)
    1.46 +        return -1;
    1.47 +
    1.48 +    rc = do_xen_hypercall(handle, &hypercall);
    1.49 +    safe_munlock(&arg, sizeof(arg));
    1.50 +
    1.51 +    *value = arg.value;
    1.52 +    return rc;
    1.53  }
    1.54  
    1.55  #define HOB_SIGNATURE         0x3436474953424f48        // "HOBSIG64"