ia64/xen-unstable

changeset 16107:be791f4f6040

[IA64] hvm domain builder clean up. use xc_vcpu_setcontext().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Fri Oct 12 14:17:00 2007 -0600 (2007-10-12)
parents f5bc04410880
children 64ffc61b940b
files tools/libxc/ia64/xc_ia64_hvm_build.c
line diff
     1.1 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c	Fri Oct 12 14:14:13 2007 -0600
     1.2 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c	Fri Oct 12 14:17:00 2007 -0600
     1.3 @@ -890,7 +890,7 @@ xc_ia64_setup_shared_info(int xc_handle,
     1.4   */
     1.5  static int
     1.6  setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
     1.7 -            char *image, unsigned long image_size, vcpu_guest_context_t *ctxt)
     1.8 +            char *image, unsigned long image_size)
     1.9  {
    1.10      xen_pfn_t *pfn_list;
    1.11      shared_iopage_t *sp;
    1.12 @@ -1065,8 +1065,6 @@ error_out:
    1.13  int
    1.14  xc_hvm_build(int xc_handle, uint32_t domid, int memsize, const char *image_name)
    1.15  {
    1.16 -    struct xen_domctl launch_domctl;
    1.17 -    int rc;
    1.18      vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
    1.19      char *image = NULL;
    1.20      unsigned long image_size;
    1.21 @@ -1086,42 +1084,25 @@ xc_hvm_build(int xc_handle, uint32_t dom
    1.22  
    1.23      image_size = (image_size + PAGE_SIZE - 1) & PAGE_MASK;
    1.24  
    1.25 -    if (lock_pages(&st_ctxt, sizeof(st_ctxt))) {
    1.26 -        PERROR("Unable to lock_pages ctxt");
    1.27 -        return 1;
    1.28 -    }
    1.29 -
    1.30 -    memset(ctxt, 0, sizeof(*ctxt));
    1.31 -
    1.32      if (setup_guest(xc_handle, domid, (unsigned long)memsize, image,
    1.33 -                    image_size, ctxt) < 0) {
    1.34 +                    image_size) < 0) {
    1.35          ERROR("Error constructing guest OS");
    1.36          goto error_out;
    1.37      }
    1.38  
    1.39      free(image);
    1.40  
    1.41 +    memset(ctxt, 0, sizeof(*ctxt));
    1.42      ctxt->regs.ip = 0x80000000ffffffb0UL;
    1.43      ctxt->regs.ar.fpsr = xc_ia64_fpsr_default();
    1.44      ctxt->regs.cr.isr = 1UL << 63;
    1.45      ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_BN;
    1.46      ctxt->regs.cr.dcr = 0;
    1.47      ctxt->regs.cr.pta = 15 << 2;
    1.48 -
    1.49 -    memset(&launch_domctl, 0, sizeof(launch_domctl));
    1.50 -
    1.51 -    launch_domctl.domain = (domid_t)domid;
    1.52 -    launch_domctl.u.vcpucontext.vcpu = 0;
    1.53 -    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
    1.54 -
    1.55 -    launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
    1.56 -    rc = do_domctl(xc_handle, &launch_domctl);
    1.57 -    unlock_pages(&st_ctxt, sizeof(st_ctxt));
    1.58 -    return rc;
    1.59 +    return xc_vcpu_setcontext(xc_handle, domid, 0, ctxt);
    1.60  
    1.61  error_out:
    1.62      free(image);
    1.63 -    unlock_pages(&st_ctxt, sizeof(st_ctxt));
    1.64      return -1;
    1.65  }
    1.66