# HG changeset patch # User Brendan Cully # Date 1169252138 28800 # Node ID 2048d2698d461070786a655e7d0d24f015b6cb8b # Parent f89126a590738ad804463772230dde0b4a6640ba Use xc_vcpu_setcontext instead of the lowlevel domctl. Signed-off-by: Brendan Cully diff -r f89126a59073 -r 2048d2698d46 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Fri Jan 19 16:11:31 2007 +0000 +++ b/tools/libxc/xc_hvm_build.c Fri Jan 19 16:15:38 2007 -0800 @@ -270,7 +270,6 @@ static int xc_hvm_build_internal(int xc_ char *image, unsigned long image_size) { - struct xen_domctl launch_domctl; vcpu_guest_context_t ctxt; int rc; @@ -287,20 +286,7 @@ static int xc_hvm_build_internal(int xc_ goto error_out; } - if ( lock_pages(&ctxt, sizeof(ctxt) ) ) - { - PERROR("%s: ctxt mlock failed", __func__); - goto error_out; - } - - memset(&launch_domctl, 0, sizeof(launch_domctl)); - launch_domctl.domain = (domid_t)domid; - launch_domctl.u.vcpucontext.vcpu = 0; - set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, &ctxt); - launch_domctl.cmd = XEN_DOMCTL_setvcpucontext; - rc = xc_domctl(xc_handle, &launch_domctl); - - unlock_pages(&ctxt, sizeof(ctxt)); + rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt); return rc; diff -r f89126a59073 -r 2048d2698d46 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Fri Jan 19 16:11:31 2007 +0000 +++ b/tools/libxc/xc_linux_build.c Fri Jan 19 16:15:38 2007 -0800 @@ -1092,7 +1092,6 @@ static int xc_linux_build_internal(int x unsigned int console_evtchn, unsigned long *console_mfn) { - struct xen_domctl launch_domctl; DECLARE_DOMCTL; int rc; struct vcpu_guest_context st_ctxt, *ctxt = &st_ctxt; @@ -1109,12 +1108,6 @@ static int xc_linux_build_internal(int x } memset(ctxt, 0, sizeof(*ctxt)); - - if ( lock_pages(ctxt, sizeof(*ctxt) ) ) - { - PERROR("%s: ctxt lock failed", __func__); - return 1; - } domctl.cmd = XEN_DOMCTL_getdomaininfo; domctl.domain = (domid_t)domid; @@ -1170,14 +1163,7 @@ static int xc_linux_build_internal(int x ctxt->kernel_sp = ctxt->user_regs.esp; #endif /* x86 */ - memset(&launch_domctl, 0, sizeof(launch_domctl)); - - launch_domctl.domain = (domid_t)domid; - launch_domctl.u.vcpucontext.vcpu = 0; - set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt); - - launch_domctl.cmd = XEN_DOMCTL_setvcpucontext; - rc = xc_domctl(xc_handle, &launch_domctl); + rc = xc_vcpu_setcontext(xc_handle, domid, 0, ctxt); return rc; diff -r f89126a59073 -r 2048d2698d46 tools/libxc/xc_linux_restore.c --- a/tools/libxc/xc_linux_restore.c Fri Jan 19 16:11:31 2007 +0000 +++ b/tools/libxc/xc_linux_restore.c Fri Jan 19 16:15:38 2007 -0800 @@ -195,12 +195,6 @@ int xc_linux_restore(int xc_handle, int if(!get_platform_info(xc_handle, dom, &max_mfn, &hvirt_start, &pt_levels)) { ERROR("Unable to get platform info."); - return 1; - } - - if (lock_pages(&ctxt, sizeof(ctxt))) { - /* needed for build domctl, but might as well do early */ - ERROR("Unable to lock ctxt"); return 1; } @@ -845,12 +839,7 @@ int xc_linux_restore(int xc_handle, int DPRINTF("Domain ready to be built.\n"); - domctl.cmd = XEN_DOMCTL_setvcpucontext; - domctl.domain = (domid_t)dom; - domctl.u.vcpucontext.vcpu = 0; - set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt); - rc = xc_domctl(xc_handle, &domctl); - + rc = xc_vcpu_setcontext(xc_handle, dom, 0, &ctxt); if (rc != 0) { ERROR("Couldn't build the domain"); goto out;