# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1170415242 -32400 # Node ID b43e97dba85d7320940a75edc4dd6a8dcfa1d394 # Parent 01ec7dba9ff805a5c74a0318997b747d3e3e3327 x86 hvm domain builder, restore: set shared_info.arch.max_pfn for dump-core to know the area to dump PATCHNAME: x86_hvm_domain_builder_set_max_pfn Signed-off-by: Isaku Yamahata diff -r 01ec7dba9ff8 -r b43e97dba85d tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Fri Feb 02 16:07:13 2007 +0000 +++ b/tools/libxc/xc_hvm_build.c Fri Feb 02 20:20:42 2007 +0900 @@ -271,6 +271,7 @@ static int setup_guest(int xc_handle, /* NB. evtchn_upcall_mask is unused: leave as zero. */ memset(&shared_info->evtchn_mask[0], 0xff, sizeof(shared_info->evtchn_mask)); + shared_info->arch.max_pfn = page_array[nr_pages - 1]; munmap(shared_info, PAGE_SIZE); if ( v_end > HVM_BELOW_4G_RAM_END ) diff -r 01ec7dba9ff8 -r b43e97dba85d tools/libxc/xc_hvm_restore.c --- a/tools/libxc/xc_hvm_restore.c Fri Feb 02 16:07:13 2007 +0000 +++ b/tools/libxc/xc_hvm_restore.c Fri Feb 02 20:20:42 2007 +0900 @@ -90,6 +90,8 @@ int xc_hvm_restore(int xc_handle, int io uint8_t *hvm_buf = NULL; unsigned long long v_end, memsize; unsigned long shared_page_nr; + shared_info_t *shared_info = NULL; + xen_pfn_t arch_max_pfn; unsigned long mfn, pfn; unsigned int prev_pc, this_pc; @@ -144,6 +146,7 @@ int xc_hvm_restore(int xc_handle, int io p2m[i] = i; for ( i = HVM_BELOW_4G_RAM_END >> PAGE_SHIFT; i < max_pfn; i++ ) p2m[i] += HVM_BELOW_4G_MMIO_LENGTH >> PAGE_SHIFT; + arch_max_pfn = p2m[max_pfn - 1];/* used later */ /* Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. */ rc = xc_domain_memory_populate_physmap( @@ -355,6 +358,14 @@ int xc_hvm_restore(int xc_handle, int io ERROR("setting the shared-info pfn failed!\n"); goto out; } + if ( (xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp) != 0) || + ((shared_info = xc_map_foreign_range( + xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, + shared_info_frame)) == NULL) ) + goto out; + /* shared_info.arch.max_pfn is used by dump-core */ + shared_info->arch.max_pfn = arch_max_pfn; + munmap(shared_info, PAGE_SIZE); rc = 0; goto out;