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-devel

[Xen-devel] [PATCH 4/5] dump-core take 2: hvm builder: tell memory map

# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1168929749 -32400
# Node ID dae81535b77157d2bc3c3547088f0ef512c3b5d2
# Parent  9d5b9b6ff32744c912c44cfb9944646224923628
x86 hvm domain builder: tell xen memory map for dump-core to know
the area to dump.
PATCHNAME: x86_hvm_domain_builder_tell_memory_map

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 9d5b9b6ff327 -r dae81535b771 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Thu Jan 18 11:49:44 2007 +0900
+++ b/tools/libxc/xc_hvm_build.c        Tue Jan 16 15:42:29 2007 +0900
@@ -66,12 +66,14 @@ int xc_get_hvm_param(
     return rc;
 }
 
-static void build_e820map(void *e820_page, unsigned long long mem_size)
+static int build_e820map(int xc_handle, uint32_t domid,
+                         void *e820_page, unsigned long long mem_size)
 {
     struct e820entry *e820entry =
         (struct e820entry *)(((unsigned char *)e820_page) + E820_MAP_OFFSET);
     unsigned long long extra_mem_size = 0;
     unsigned char nr_map = 0;
+    struct e820entry *tmp;
 
     /*
      * Physical address space from HVM_BELOW_4G_RAM_END to 4G is reserved
@@ -142,6 +144,17 @@ static void build_e820map(void *e820_pag
     }
 
     *(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
+
+    tmp = malloc(nr_map * sizeof(struct e820entry));
+    if ( tmp == NULL )
+    {
+        PERROR("Could not allocate memory.\n");
+        return -1;
+    }
+    memcpy(tmp, &e820entry[0], nr_map * sizeof(e820entry[0]));
+    xc_domain_set_memmap(xc_handle, domid, tmp, nr_map);
+    free(tmp);
+    return 0;
 }
 
 static int setup_guest(int xc_handle,
@@ -219,8 +232,10 @@ static int setup_guest(int xc_handle,
               E820_MAP_PAGE >> PAGE_SHIFT)) == NULL )
         goto error_out;
     memset(e820_page, 0, PAGE_SIZE);
-    build_e820map(e820_page, v_end);
+    rc = build_e820map(xc_handle, dom, e820_page, v_end);
     munmap(e820_page, PAGE_SIZE);
+    if ( rc != 0 )
+        goto error_out;
 
     /* Map and initialise shared_info page. */
     xatp.domid = dom;
--
yamahata

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