diff options
author | Dario Faggioli <dario.faggioli@citrix.com> | 2013-09-10 19:53:40 +0200 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-09-13 13:06:28 +0100 |
commit | 0dd5b654107103765994243017a7f0eb15fda341 (patch) | |
tree | aa5f3648656674a0f48b8b6a3663f5799937b588 /tools/libxc/xc_resume.c | |
parent | bd9a0528ebc68ddb723feef6be57f75096d9df52 (diff) | |
download | xen-0dd5b654107103765994243017a7f0eb15fda341.tar.gz xen-0dd5b654107103765994243017a7f0eb15fda341.tar.bz2 xen-0dd5b654107103765994243017a7f0eb15fda341.zip |
libxc: introduce xc_domain_get_guest_width()
As a wrapper to XEN_DOMCTL_get_address_size, and use it
wherever the call was being issued directly via do_domctl(),
saving quite some line of code.
Actually, the function returns the guest width in bytes,
rather than directly what XEN_DOMCTL_get_address_size provides
(which is a number of bits), since that is what it is useful
almost everywhere.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xc_resume.c')
-rw-r--r-- | tools/libxc/xc_resume.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/tools/libxc/xc_resume.c b/tools/libxc/xc_resume.c index 1c43ec612d..cb6165049f 100644 --- a/tools/libxc/xc_resume.c +++ b/tools/libxc/xc_resume.c @@ -24,19 +24,6 @@ #include <xen/foreign/x86_64.h> #include <xen/hvm/params.h> -static int pv_guest_width(xc_interface *xch, uint32_t domid) -{ - DECLARE_DOMCTL; - domctl.domain = domid; - domctl.cmd = XEN_DOMCTL_get_address_size; - if ( xc_domctl(xch, &domctl) != 0 ) - { - PERROR("Could not get guest address size"); - return -1; - } - return domctl.u.address_size.size / 8; -} - static int modify_returncode(xc_interface *xch, uint32_t domid) { vcpu_guest_context_any_t ctxt; @@ -71,8 +58,7 @@ static int modify_returncode(xc_interface *xch, uint32_t domid) else { /* Probe PV guest address width. */ - dinfo->guest_width = pv_guest_width(xch, domid); - if ( dinfo->guest_width < 0 ) + if ( xc_domain_get_guest_width(xch, domid, &dinfo->guest_width) ) return -1; } @@ -120,7 +106,8 @@ static int xc_domain_resume_any(xc_interface *xch, uint32_t domid) xc_dominfo_t info; int i, rc = -1; #if defined(__i386__) || defined(__x86_64__) - struct domain_info_context _dinfo = { .p2m_size = 0 }; + struct domain_info_context _dinfo = { .guest_width = 0, + .p2m_size = 0 }; struct domain_info_context *dinfo = &_dinfo; unsigned long mfn; vcpu_guest_context_any_t ctxt; @@ -147,7 +134,7 @@ static int xc_domain_resume_any(xc_interface *xch, uint32_t domid) return rc; } - dinfo->guest_width = pv_guest_width(xch, domid); + xc_domain_get_guest_width(xch, domid, &dinfo->guest_width); if ( dinfo->guest_width != sizeof(long) ) { ERROR("Cannot resume uncooperative cross-address-size guests"); |