[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] dump-core take4: hvm domain: set shared_info.arch.max_pfn



# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1169363541 -32400
# Node ID a697dea956db9ecc5310a411b6cb21246e089b39
# Parent  e79afe8634b5ad6d24109b246e4f5c698e59d511
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 <yamahata@xxxxxxxxxxxxx>

diff -r e79afe8634b5 -r a697dea956db tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Wed Jan 17 12:20:08 2007 +0900
+++ b/tools/libxc/xc_hvm_build.c        Sun Jan 21 16:12:21 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 e79afe8634b5 -r a697dea956db tools/libxc/xc_hvm_restore.c
--- a/tools/libxc/xc_hvm_restore.c      Wed Jan 17 12:20:08 2007 +0900
+++ b/tools/libxc/xc_hvm_restore.c      Sun Jan 21 16:12:21 2007 +0900
@@ -31,6 +31,8 @@
 #include <xen/hvm/ioreq.h>
 #include <xen/hvm/params.h>
 #include <xen/hvm/e820.h>
+
+#define SCRATCH_PFN 0xFFFFF
 
 /* max mfn of the whole machine */
 static unsigned long max_mfn;
@@ -90,6 +92,8 @@ int xc_hvm_restore(int xc_handle, int io
     hvm_domain_context_t hvm_ctxt;
     unsigned long long v_end, memsize;
     unsigned long shared_page_nr;
+    struct xen_add_to_physmap xatp;
+    shared_info_t *shared_info = NULL;
 
     unsigned long mfn, pfn;
     unsigned int prev_pc, this_pc;
@@ -152,6 +156,20 @@ 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;
+
+    /* shared-info page. shared_info.arch.max_pfn is used by dump-core */
+    xatp.domid = dom;
+    xatp.space = XENMAPSPACE_shared_info;
+    xatp.idx   = 0;
+    xatp.gpfn  = SCRATCH_PFN;
+    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,
+             SCRATCH_PFN)) == NULL) )
+        goto out;
+    memset(shared_info, 0, PAGE_SIZE);
+    shared_info->arch.max_pfn = p2m[max_pfn - 1];
+    munmap(shared_info, PAGE_SIZE);
 
     /* Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. */
     rc = xc_domain_memory_populate_physmap(
yamahata

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.