File 19523-32on64-restore-p2m.patch of Package xen
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1239214233 -3600
# Node ID a6003404e95b77d28a9dbc1550c34e9c6ba5e871
# Parent f9c8c6b0897274ffb682b259b794dde07cb2d8a5
restore: sign extend p2m when restoring on a host with pfn width <
guest pfn width
(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 <ian.campbell@citrix.com>
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -1181,7 +1181,7 @@ int xc_domain_restore(int xc_handle, int
* 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];