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@xensource.com>
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 ){
#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
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,
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));
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,
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;
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;
}