From: Brendan Cully Subject: [PATCH] xc_resume: fix modify_returncode when PV guest width != host width Date: Wed, 4 Nov 2009 13:03:24 -0800 Message-ID: <20091104210324.GA9535@kremvax.cs.ubc.ca> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Developers List-Id: xen-devel@lists.xenproject.org --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline It seems that xm save -c breaks PV guests when their address width does not match that of domain 0. It looks to me like modify_returncode is treating the guest VCPU context as native format, but honestly I don't quite understand the purpose of vcpu_guest_context_any_t.c. I suspect I'm missing something obvious about how the compat code is supposed to work, but at any rate, the attached patch fixes things for me. --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="modify-returncode-width.patch" # 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; --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --VbJkn9YxBvnuCH5J--