direct-io.hg

changeset 13524:701afa77106a

[XEN] Move hvm get/set domctl() commands to arch/x86/domctl.c.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Jan 19 18:04:00 2007 +0000 (2007-01-19)
parents d4ed1deee42d
children 9f27746eff43
files xen/arch/x86/domctl.c xen/common/domctl.c
line diff
     1.1 --- a/xen/arch/x86/domctl.c	Fri Jan 19 17:58:30 2007 +0000
     1.2 +++ b/xen/arch/x86/domctl.c	Fri Jan 19 18:04:00 2007 +0000
     1.3 @@ -293,6 +293,79 @@
     1.4      }
     1.5      break;
     1.6  
     1.7 +    case XEN_DOMCTL_sethvmcontext:
     1.8 +    { 
     1.9 +        struct hvm_domain_context *c;
    1.10 +        struct domain             *d;
    1.11 +        struct vcpu               *v;
    1.12 +
    1.13 +        ret = -ESRCH;
    1.14 +        if ( (d = find_domain_by_id(domctl->domain)) == NULL )
    1.15 +            break;
    1.16 +
    1.17 +        ret = -ENOMEM;
    1.18 +        if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
    1.19 +            goto sethvmcontext_out;
    1.20 +
    1.21 +        v = d->vcpu[0];
    1.22 +        
    1.23 +        ret = -EFAULT;
    1.24 +
    1.25 +#ifndef CONFIG_COMPAT
    1.26 +        if ( copy_from_guest(c, domctl->u.hvmcontext.ctxt, 1) != 0 )
    1.27 +            goto sethvmcontext_out;
    1.28 +
    1.29 +        ret = arch_sethvm_ctxt(v, c);
    1.30 +#endif
    1.31 +
    1.32 +        xfree(c);
    1.33 +
    1.34 +    sethvmcontext_out:
    1.35 +        put_domain(d);
    1.36 +
    1.37 +    }
    1.38 +    break;
    1.39 +
    1.40 +    case XEN_DOMCTL_gethvmcontext:
    1.41 +    { 
    1.42 +        struct hvm_domain_context *c;
    1.43 +        struct domain             *d;
    1.44 +        struct vcpu               *v;
    1.45 +
    1.46 +        ret = -ESRCH;
    1.47 +        if ( (d = find_domain_by_id(domctl->domain)) == NULL )
    1.48 +            break;
    1.49 +
    1.50 +        ret = -ENOMEM;
    1.51 +        if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
    1.52 +            goto gethvmcontext_out;
    1.53 +
    1.54 +        v = d->vcpu[0];
    1.55 +
    1.56 +        ret = -ENODATA;
    1.57 +        if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
    1.58 +            goto gethvmcontext_out;
    1.59 +        
    1.60 +        ret = 0;
    1.61 +        if (arch_gethvm_ctxt(v, c) == -1)
    1.62 +            ret = -EFAULT;
    1.63 +
    1.64 +#ifndef CONFIG_COMPAT
    1.65 +        if ( copy_to_guest(domctl->u.hvmcontext.ctxt, c, 1) )
    1.66 +            ret = -EFAULT;
    1.67 +
    1.68 +        xfree(c);
    1.69 +#endif
    1.70 +
    1.71 +        if ( copy_to_guest(u_domctl, domctl, 1) )
    1.72 +            ret = -EFAULT;
    1.73 +
    1.74 +    gethvmcontext_out:
    1.75 +        put_domain(d);
    1.76 +
    1.77 +    }
    1.78 +    break;
    1.79 +
    1.80      default:
    1.81          ret = -ENOSYS;
    1.82          break;
     2.1 --- a/xen/common/domctl.c	Fri Jan 19 17:58:30 2007 +0000
     2.2 +++ b/xen/common/domctl.c	Fri Jan 19 18:04:00 2007 +0000
     2.3 @@ -218,39 +218,6 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
     2.4      }
     2.5      break;
     2.6  
     2.7 -    case XEN_DOMCTL_sethvmcontext:
     2.8 -    { 
     2.9 -        struct hvm_domain_context *c;
    2.10 -        struct domain             *d;
    2.11 -        struct vcpu               *v;
    2.12 -
    2.13 -        ret = -ESRCH;
    2.14 -        if ( (d = find_domain_by_id(op->domain)) == NULL )
    2.15 -            break;
    2.16 -
    2.17 -        ret = -ENOMEM;
    2.18 -        if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
    2.19 -            goto sethvmcontext_out;
    2.20 -
    2.21 -        v = d->vcpu[0];
    2.22 -        
    2.23 -        ret = -EFAULT;
    2.24 -
    2.25 -#ifndef CONFIG_COMPAT
    2.26 -        if ( copy_from_guest(c, op->u.hvmcontext.ctxt, 1) != 0 )
    2.27 -            goto sethvmcontext_out;
    2.28 -
    2.29 -        ret = arch_sethvm_ctxt(v, c);
    2.30 -#endif
    2.31 -
    2.32 -        xfree(c);
    2.33 -
    2.34 -    sethvmcontext_out:
    2.35 -        put_domain(d);
    2.36 -
    2.37 -    }
    2.38 -    break;
    2.39 -
    2.40      case XEN_DOMCTL_pausedomain:
    2.41      {
    2.42          struct domain *d = find_domain_by_id(op->domain);
    2.43 @@ -605,46 +572,6 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
    2.44      }
    2.45      break;
    2.46  
    2.47 -    case XEN_DOMCTL_gethvmcontext:
    2.48 -    { 
    2.49 -        struct hvm_domain_context *c;
    2.50 -        struct domain             *d;
    2.51 -        struct vcpu               *v;
    2.52 -
    2.53 -        ret = -ESRCH;
    2.54 -        if ( (d = find_domain_by_id(op->domain)) == NULL )
    2.55 -            break;
    2.56 -
    2.57 -        ret = -ENOMEM;
    2.58 -        if ( (c = xmalloc(struct hvm_domain_context)) == NULL )
    2.59 -            goto gethvmcontext_out;
    2.60 -
    2.61 -        v = d->vcpu[0];
    2.62 -
    2.63 -        ret = -ENODATA;
    2.64 -        if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
    2.65 -            goto gethvmcontext_out;
    2.66 -        
    2.67 -        ret = 0;
    2.68 -        if (arch_gethvm_ctxt(v, c) == -1)
    2.69 -            ret = -EFAULT;
    2.70 -
    2.71 -#ifndef CONFIG_COMPAT
    2.72 -        if ( copy_to_guest(op->u.hvmcontext.ctxt, c, 1) )
    2.73 -            ret = -EFAULT;
    2.74 -
    2.75 -        xfree(c);
    2.76 -#endif
    2.77 -
    2.78 -        if ( copy_to_guest(u_domctl, op, 1) )
    2.79 -            ret = -EFAULT;
    2.80 -
    2.81 -    gethvmcontext_out:
    2.82 -        put_domain(d);
    2.83 -
    2.84 -    }
    2.85 -    break;
    2.86 -
    2.87      case XEN_DOMCTL_getvcpuinfo:
    2.88      { 
    2.89          struct domain *d;