direct-io.hg

changeset 10117:299f048c4855

[IA64] Strengthen dom0_getmemlist

reset num_pfns before hypercalling, more checks in hypercall, cleanup

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Mon May 15 13:42:18 2006 -0600 (2006-05-15)
parents 90329e7d6be5
children cdecdd55f0d3
files tools/libxc/xc_ia64_stubs.c xen/arch/ia64/xen/dom0_ops.c
line diff
     1.1 --- a/tools/libxc/xc_ia64_stubs.c	Mon May 15 10:53:23 2006 -0600
     1.2 +++ b/tools/libxc/xc_ia64_stubs.c	Mon May 15 13:42:18 2006 -0600
     1.3 @@ -50,7 +50,7 @@ xc_plan9_build(int xc_handle,
     1.4  }
     1.5  /*  
     1.6      VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
     1.7 -    VMM don't handle this now.
     1.8 +    VMM doesn't handle this now.
     1.9      This method will touch guest buffer to make sure the buffer's mapping
    1.10      is tracked by VMM,
    1.11   */
    1.12 @@ -66,6 +66,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
    1.13      unsigned int __start_page, __nr_pages;
    1.14      unsigned long max_pfns;
    1.15      unsigned long *__pfn_buf;
    1.16 +
    1.17      __start_page = start_page;
    1.18      __nr_pages = nr_pages;
    1.19      __pfn_buf = pfn_buf;
    1.20 @@ -75,6 +76,7 @@ int xc_ia64_get_pfn_list(int xc_handle,
    1.21          op.cmd = DOM0_GETMEMLIST;
    1.22          op.u.getmemlist.domain   = (domid_t)domid;
    1.23          op.u.getmemlist.max_pfns = max_pfns;
    1.24 +        op.u.getmemlist.num_pfns = 0;
    1.25          set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf);
    1.26  
    1.27          if ( (max_pfns != -1UL)
     2.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Mon May 15 10:53:23 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Mon May 15 13:42:18 2006 -0600
     2.3 @@ -151,10 +151,7 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
     2.4          put_domain(d);
     2.5      }
     2.6      break;
     2.7 -    /*
     2.8 -     * NOTE: DOM0_GETMEMLIST has somewhat different semantics on IA64 -
     2.9 -     * it actually allocates and maps pages.
    2.10 -     */
    2.11 +
    2.12      case DOM0_GETMEMLIST:
    2.13      {
    2.14          unsigned long i = 0;
    2.15 @@ -198,7 +195,8 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
    2.16                  ret = -ENOMEM;
    2.17  
    2.18              op->u.getmemlist.num_pfns = i - start_page;
    2.19 -            copy_to_guest(u_dom0_op, op, 1);
    2.20 +            if (copy_to_guest(u_dom0_op, op, 1))
    2.21 +                ret = -EFAULT;
    2.22              
    2.23              put_domain(d);
    2.24          }