diff options
author | Tim Deegan <Tim.Deegan@xensource.com> | 2007-01-18 16:48:04 +0000 |
---|---|---|
committer | Tim Deegan <Tim.Deegan@xensource.com> | 2007-01-18 16:48:04 +0000 |
commit | 294b0bdd8b609d7e510b07b16a6351f7cfe265c1 (patch) | |
tree | 7c2f386bd9ea9338a03408d56c7a387928311911 /xen/common | |
parent | 4a13cf1b7005cc5022b67f2e96ab597108333704 (diff) | |
download | xen-294b0bdd8b609d7e510b07b16a6351f7cfe265c1.tar.gz xen-294b0bdd8b609d7e510b07b16a6351f7cfe265c1.tar.bz2 xen-294b0bdd8b609d7e510b07b16a6351f7cfe265c1.zip |
[HVM] save restore: new hyper-call
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
add a pair of hyper-call for hvm guest context
Diffstat (limited to 'xen/common')
-rw-r--r-- | xen/common/domctl.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/xen/common/domctl.c b/xen/common/domctl.c index b9cd57e949..4494c84494 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -215,6 +215,39 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) } break; + case XEN_DOMCTL_sethvmcontext: + { + struct hvm_domain_context *c; + struct domain *d; + struct vcpu *v; + + ret = -ESRCH; + if ( (d = find_domain_by_id(op->domain)) == NULL ) + break; + + ret = -ENOMEM; + if ( (c = xmalloc(struct hvm_domain_context)) == NULL ) + goto sethvmcontext_out; + + v = d->vcpu[0]; + + ret = -EFAULT; + +#ifndef CONFIG_COMPAT + if ( copy_from_guest(c, op->u.hvmcontext.ctxt, 1) != 0 ) + goto sethvmcontext_out; + + ret = arch_sethvm_ctxt(v, c); +#endif + + xfree(c); + + sethvmcontext_out: + put_domain(d); + + } + break; + case XEN_DOMCTL_pausedomain: { struct domain *d = find_domain_by_id(op->domain); @@ -552,6 +585,46 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) } break; + case XEN_DOMCTL_gethvmcontext: + { + struct hvm_domain_context *c; + struct domain *d; + struct vcpu *v; + + ret = -ESRCH; + if ( (d = find_domain_by_id(op->domain)) == NULL ) + break; + + ret = -ENOMEM; + if ( (c = xmalloc(struct hvm_domain_context)) == NULL ) + goto gethvmcontext_out; + + v = d->vcpu[0]; + + ret = -ENODATA; + if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) ) + goto gethvmcontext_out; + + ret = 0; + if (arch_gethvm_ctxt(v, c) == -1) + ret = -EFAULT; + +#ifndef CONFIG_COMPAT + if ( copy_to_guest(op->u.hvmcontext.ctxt, c, 1) ) + ret = -EFAULT; + + xfree(c); +#endif + + if ( copy_to_guest(u_domctl, op, 1) ) + ret = -EFAULT; + + gethvmcontext_out: + put_domain(d); + + } + break; + case XEN_DOMCTL_getvcpuinfo: { struct domain *d; |