# HG changeset patch # User Brendan Cully # Date 1257367775 28800 # Node ID 75290c8f350642326b8716f36451bc3f2c67ea10 # Parent a78569c6a570468dc1cdd888b8ef8259fcceaf22 xc_resume: fix modify_returncode when host width != guest width Signed-off-by: Brendan Cully diff --git a/tools/libxc/xc_resume.c b/tools/libxc/xc_resume.c --- a/tools/libxc/xc_resume.c +++ b/tools/libxc/xc_resume.c @@ -17,6 +17,7 @@ xc_dominfo_t info; xen_capabilities_info_t caps; int rc; + int guest_address_size = 0; if ( xc_domain_getinfo(xc_handle, domid, 1, &info) != 1 ) { @@ -32,6 +33,18 @@ if ( !irq ) return 0; } + else + { + DECLARE_DOMCTL; + domctl.domain = domid; + domctl.cmd = XEN_DOMCTL_get_address_size; + if (xc_domctl(xc_handle, &domctl) != 0) + { + PERROR("Could not get guest address size"); + return -1; + } + guest_address_size = domctl.u.address_size.size; + } if ( xc_version(xc_handle, XENVER_capabilities, &caps) != 0 ) { @@ -42,9 +55,12 @@ if ( (rc = xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt)) != 0 ) return rc; - if ( !info.hvm ) - ctxt.c.user_regs.eax = 1; - else if ( strstr(caps, "x86_64") ) + if ( !info.hvm ) { + if (guest_address_size == 32) + ctxt.x32.user_regs.eax = 1; + else + ctxt.x64.user_regs.eax = 1; + } else if ( strstr(caps, "x86_64") ) ctxt.x64.user_regs.eax = 1; else ctxt.x32.user_regs.eax = 1;