From: Isaku Yamahata Subject: [PATCH 4/5] dump-core take 2: hvm builder: tell memory map Date: Thu, 18 Jan 2007 15:53:02 +0900 Message-ID: <20070118065302.4302.52816.sendpatchset@ls.local.valinux.co.jp> References: <20070118065242.4302.39670.sendpatchset@ls.local.valinux.co.jp> Return-path: In-Reply-To: <20070118065242.4302.39670.sendpatchset@ls.local.valinux.co.jp> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Isaku Yamahata , xen-ia64-devel@lists.xensource.com, Dave Anderson , John Levon List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User yamahata@valinux.co.jp # 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 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