[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] xc_vcpu_getcontext() can no longer be called before a
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 334dc7e6a23f2786895b706ea50958dc5296c609 # Parent 85d693e6f61aacc709d7a0adceb0090543e762e3 xc_vcpu_getcontext() can no longer be called before a VCPU's context has been explicitly initialised. Fix all the domain builders to no longer attempt this. They really don't need to anyhow. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 85d693e6f61a -r 334dc7e6a23f tools/libxc/xc_ia64_stubs.c --- a/tools/libxc/xc_ia64_stubs.c Sat Jan 14 20:26:40 2006 +++ b/tools/libxc/xc_ia64_stubs.c Sat Jan 14 21:17:33 2006 @@ -665,15 +665,7 @@ goto error_out; } - if ( xc_vcpu_getcontext(xc_handle, domid, 0, ctxt) ){ - PERROR("Could not get vcpu context"); - goto error_out; - } - - if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ) { - ERROR("Domain is already constructed"); - goto error_out; - } + memset(ctxt, 0, sizeof(*ctxt)); if ( setup_guest(xc_handle, domid, (unsigned long)memsize, image, image_size, control_evtchn, store_evtchn, store_mfn ) < 0 ){ diff -r 85d693e6f61a -r 334dc7e6a23f tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Sat Jan 14 20:26:40 2006 +++ b/tools/libxc/xc_linux_build.c Sat Jan 14 21:17:33 2006 @@ -33,10 +33,8 @@ #endif #ifdef __ia64__ -#define already_built(ctxt) (0) #define get_tot_pages xc_get_max_pages #else -#define already_built(ctxt) ((ctxt)->ctrlreg[3] != 0) #define get_tot_pages xc_get_tot_pages #endif @@ -800,17 +798,7 @@ goto error_out; } - if ( xc_vcpu_getcontext(xc_handle, domid, 0, ctxt) ) - { - PERROR("Could not get vcpu context"); - goto error_out; - } - - if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || already_built(ctxt) ) - { - ERROR("Domain is already constructed"); - goto error_out; - } + memset(ctxt, 0, sizeof(*ctxt)); if ( setup_guest(xc_handle, domid, image, image_size, initrd_gfd, initrd_size, nr_pages, @@ -865,6 +853,8 @@ ctxt->user_regs.esi = vstartinfo_start; ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */ + ctxt->flags = VGCF_IN_KERNEL; + /* FPU is set up to default initial state. */ memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); diff -r 85d693e6f61a -r 334dc7e6a23f tools/libxc/xc_vmx_build.c --- a/tools/libxc/xc_vmx_build.c Sat Jan 14 20:26:40 2006 +++ b/tools/libxc/xc_vmx_build.c Sat Jan 14 21:17:33 2006 @@ -651,18 +651,7 @@ goto error_out; } - if ( xc_vcpu_getcontext(xc_handle, domid, 0, ctxt) ) - { - PERROR("Could not get vcpu context"); - goto error_out; - } - - if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || - (ctxt->ctrlreg[3] != 0) ) - { - ERROR("Domain is already constructed"); - goto error_out; - } + memset(ctxt, 0, sizeof(*ctxt)); if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages, ctxt, op.u.getdomaininfo.shared_info_frame, control_evtchn, diff -r 85d693e6f61a -r 334dc7e6a23f xen/common/dom0_ops.c --- a/xen/common/dom0_ops.c Sat Jan 14 20:26:40 2006 +++ b/xen/common/dom0_ops.c Sat Jan 14 21:17:33 2006 @@ -450,6 +450,10 @@ if ( (v = d->vcpu[op->u.getvcpucontext.vcpu]) == NULL ) goto getvcpucontext_out; + ret = -ENODATA; + if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) ) + goto getvcpucontext_out; + ret = -ENOMEM; if ( (c = xmalloc(struct vcpu_guest_context)) == NULL ) goto getvcpucontext_out; diff -r 85d693e6f61a -r 334dc7e6a23f xen/common/domain.c --- a/xen/common/domain.c Sat Jan 14 20:26:40 2006 +++ b/xen/common/domain.c Sat Jan 14 21:17:33 2006 @@ -369,15 +369,16 @@ if ( (vcpu >= MAX_VIRT_CPUS) || ((v = d->vcpu[vcpu]) == NULL) ) return -EINVAL; - if ( !test_bit(_DOMF_ctrl_pause, &d->domain_flags) ) - return -EINVAL; - if ( (c = xmalloc(struct vcpu_guest_context)) == NULL ) return -ENOMEM; + + domain_pause(d); rc = -EFAULT; if ( copy_from_user(c, setvcpucontext->ctxt, sizeof(*c)) == 0 ) rc = arch_set_info_guest(v, c); + + domain_unpause(d); xfree(c); return rc; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |