From: Ian Campbell Subject: [PATCH] restore: sign extend p2m when restoring on a host with pfn width < guest pfn width Date: Wed, 08 Apr 2009 18:16:52 +0100 Message-ID: <83bca3619cbdfb18009b.1239211012@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org (i.e. 32on64 domain 0 and 64 bit guest domain). Otherwise P2M entries which were INVALID_P2M_ENTRY (==0xffffffffffffffff) become 0xffffffff after a migrate. Signed-off-by: Ian Campbell diff -r f9c8c6b08972 -r 83bca3619cbd tools/libxc/xc_domain_restore.c --- a/tools/libxc/xc_domain_restore.c Wed Apr 08 14:43:12 2009 +0100 +++ b/tools/libxc/xc_domain_restore.c Wed Apr 08 18:16:37 2009 +0100 @@ -1197,7 +1197,7 @@ * we need to adjust the live_p2m assignment appropriately */ if ( guest_width > sizeof (xen_pfn_t) ) for ( i = p2m_size - 1; i >= 0; i-- ) - ((uint64_t *)live_p2m)[i] = p2m[i]; + ((int64_t *)live_p2m)[i] = (long)p2m[i]; else if ( guest_width < sizeof (xen_pfn_t) ) for ( i = 0; i < p2m_size; i++ ) ((uint32_t *)live_p2m)[i] = p2m[i];