WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-devel] [PATCH 1/2] dump-core take 3: hvm domain: set shared_info.ar

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/2] dump-core take 3: hvm domain: set shared_info.arch.max_pfn
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Sun, 21 Jan 2007 16:46:57 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, John Levon <levon@xxxxxxxxxxxxxxxxx>, Dave Anderson <anderson@xxxxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 20 Jan 2007 23:47:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070121074652.23834.28219.sendpatchset@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20070121074652.23834.28219.sendpatchset@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1169363541 -32400
# Node ID e26aa113e059b1c824c43a1f8abf8e493a5696c4
# Parent  7e28a8c150edae62aa1a7db4411eb6efbb96af7e
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 7e28a8c150ed -r e26aa113e059 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Sat Jan 20 14:33:43 2007 +0000
+++ b/tools/libxc/xc_hvm_build.c        Sun Jan 21 16:12:21 2007 +0900
@@ -236,6 +236,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 7e28a8c150ed -r e26aa113e059 tools/libxc/xc_hvm_restore.c
--- a/tools/libxc/xc_hvm_restore.c      Sat Jan 20 14:33:43 2007 +0000
+++ 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