# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1277477030 -3600
# Node ID 8e0a20f050a14feba1068ce9a0df9cb0effd5452
# Parent e307aa11ed27ea91cf175461b3a715fe3f7253bc
libxc: Fix ia64 build for interface change
This patch fixes ia64 by the following method:
- rename xc_handle xch
- rename guest_xc xch
- add xc_interface *xch to arguments of some functions
- replace xc_dom_printf with macros
- Add *xch argument to corresponding x86 functions [iwj]
Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/libxc/ia64/xc_dom_ia64_util.c | 10 +-
tools/libxc/ia64/xc_ia64_dom_fwloader.c | 2
tools/libxc/ia64/xc_ia64_hvm_build.c | 125 +++++++++++++++----------------
tools/libxc/ia64/xc_ia64_linux_restore.c | 113 ++++++++++++++--------------
tools/libxc/ia64/xc_ia64_linux_save.c | 92 +++++++++++-----------
tools/libxc/ia64/xc_ia64_stubs.c | 36 ++++----
tools/libxc/xc_core.c | 4
tools/libxc/xc_core_ia64.c | 17 ++--
tools/libxc/xc_core_ia64.h | 6 -
tools/libxc/xc_core_x86.h | 5 -
tools/libxc/xc_dom_ia64.c | 14 +--
xen/arch/ia64/xen/dom_fw_common.c | 12 ++
xen/arch/ia64/xen/dom_fw_domu.c | 7 +
xen/include/asm-ia64/dom_fw_common.h | 2
xen/include/asm-ia64/dom_fw_domu.h | 4
15 files changed, 242 insertions(+), 207 deletions(-)
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/ia64/xc_dom_ia64_util.c
--- a/tools/libxc/ia64/xc_dom_ia64_util.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/ia64/xc_dom_ia64_util.c Fri Jun 25 15:43:50 2010 +0100
@@ -28,7 +28,7 @@ uint32_t
uint32_t
xen_ia64_version(struct xc_dom_image *dom)
{
- return xc_version(dom->guest_xc, XENVER_version, NULL);
+ return xc_version(dom->xch, XENVER_version, NULL);
}
int
@@ -41,11 +41,12 @@ xen_ia64_fpswa_revision(struct xc_dom_im
hypercall.arg[1] = (unsigned long)revision;
if (lock_pages(revision, sizeof(*revision)) != 0) {
+ xc_interface *xch = dom->xch;
PERROR("Could not lock memory for xen fpswa hypercall");
return -1;
}
- ret = do_xen_hypercall(dom->guest_xc, &hypercall);
+ ret = do_xen_hypercall(dom->xch, &hypercall);
unlock_pages(revision, sizeof(*revision));
@@ -75,7 +76,7 @@ xen_ia64_dom_fw_map(struct xc_dom_image
unsigned long page_size = XC_DOM_PAGE_SIZE(dom);
void* ret;
- ret = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+ ret = xc_map_foreign_range(dom->xch, dom->guest_domid,
page_size, PROT_READ | PROT_WRITE,
mpaddr / page_size);
if (ret != NULL)
@@ -98,8 +99,9 @@ xen_ia64_is_vcpu_allocated(struct xc_dom
int rc;
xc_vcpuinfo_t info;
+ xc_interface *xch = dom->xch;
- rc = xc_vcpu_getinfo(dom->guest_xc, dom->guest_domid,
+ rc = xc_vcpu_getinfo(xch, dom->guest_domid,
vcpu, &info);
if (rc == 0)
return 1;
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/ia64/xc_ia64_dom_fwloader.c
--- a/tools/libxc/ia64/xc_ia64_dom_fwloader.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_dom_fwloader.c Fri Jun 25 15:43:50 2010 +0100
@@ -72,7 +72,7 @@ static int vcpu_ia64(struct xc_dom_image
{
vcpu_guest_context_ia64_t *ctxt = ptr;
- xc_dom_printf("%s: called\n", __FUNCTION__);
+ DOMPRINTF_CALLED(dom->xch);
/* clear everything */
memset(ctxt, 0, sizeof(*ctxt));
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Fri Jun 25 15:43:50 2010 +0100
@@ -13,14 +13,14 @@
#include <xen/hvm/params.h>
static int
-xc_ia64_copy_to_domain_pages(xc_interface *xc_handle, uint32_t domid, void*
src_page,
+xc_ia64_copy_to_domain_pages(xc_interface *xch, uint32_t domid, void* src_page,
unsigned long dst_pfn, int nr_pages)
{
// N.B. gva should be page aligned
int i;
for (i = 0; i < nr_pages; i++) {
- if (xc_copy_to_domain_page(xc_handle, domid, dst_pfn + i,
+ if (xc_copy_to_domain_page(xch, domid, dst_pfn + i,
src_page + (i << PAGE_SHIFT)))
return -1;
}
@@ -87,13 +87,14 @@ static int add_mem_hob(void* hob_buf, un
static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size);
static int add_vcpus_hob(void* hob_buf, unsigned long nr_vcpu);
static int add_nvram_hob(void* hob_buf, unsigned long nvram_addr);
-static int build_hob(void* hob_buf, unsigned long hob_buf_size,
+static int build_hob(xc_interface *xch,
+ void* hob_buf, unsigned long hob_buf_size,
unsigned long dom_mem_size, unsigned long vcpus,
unsigned long nvram_addr);
-static int load_hob(xc_interface *xc_handle,uint32_t dom, void *hob_buf);
-
-static int
-xc_ia64_build_hob(xc_interface *xc_handle, uint32_t dom,
+static int load_hob(xc_interface *xch,uint32_t dom, void *hob_buf);
+
+static int
+xc_ia64_build_hob(xc_interface *xch, uint32_t dom,
unsigned long memsize, unsigned long vcpus,
unsigned long nvram_addr)
{
@@ -105,13 +106,13 @@ xc_ia64_build_hob(xc_interface *xc_handl
return -1;
}
- if (build_hob(hob_buf, GFW_HOB_SIZE, memsize, vcpus, nvram_addr) < 0) {
+ if (build_hob(xch, hob_buf, GFW_HOB_SIZE, memsize, vcpus, nvram_addr) < 0)
{
free(hob_buf);
PERROR("Could not build hob");
return -1;
}
- if (load_hob(xc_handle, dom, hob_buf) < 0) {
+ if (load_hob(xch, dom, hob_buf) < 0) {
free(hob_buf);
PERROR("Could not load hob");
return -1;
@@ -190,7 +191,7 @@ hob_add(void* hob_start, int type, void*
}
static int
-get_hob_size(void* hob_buf)
+get_hob_size(xc_interface *xch, void* hob_buf)
{
HOB_INFO *phit = (HOB_INFO*)hob_buf;
@@ -202,7 +203,7 @@ get_hob_size(void* hob_buf)
}
static int
-build_hob(void* hob_buf, unsigned long hob_buf_size,
+build_hob(xc_interface *xch, void* hob_buf, unsigned long hob_buf_size,
unsigned long dom_mem_size, unsigned long vcpus,
unsigned long nvram_addr)
{
@@ -239,13 +240,13 @@ err_out:
}
static int
-load_hob(xc_interface *xc_handle, uint32_t dom, void *hob_buf)
+load_hob(xc_interface *xch, uint32_t dom, void *hob_buf)
{
// hob_buf should be page aligned
int hob_size;
int nr_pages;
- hob_size = get_hob_size(hob_buf);
+ hob_size = get_hob_size(xch, hob_buf);
if (hob_size < 0) {
PERROR("Invalid hob data");
return -1;
@@ -258,7 +259,7 @@ load_hob(xc_interface *xc_handle, uint32
nr_pages = (hob_size + PAGE_SIZE -1) >> PAGE_SHIFT;
- return xc_ia64_copy_to_domain_pages(xc_handle, dom, hob_buf,
+ return xc_ia64_copy_to_domain_pages(xch, dom, hob_buf,
GFW_HOB_START >> PAGE_SHIFT, nr_pages);
}
@@ -529,7 +530,7 @@ add_pal_hob(void* hob_buf)
#define VALIDATE_NVRAM_FD(x) ((1UL<<(sizeof(x)*8 - 1)) | x)
#define IS_VALID_NVRAM_FD(x) ((uint64_t)x >> (sizeof(x)*8 - 1))
static uint64_t
-nvram_init(const char *nvram_path)
+nvram_init(xc_interface *xch, const char *nvram_path)
{
uint64_t fd = 0;
fd = open(nvram_path, O_CREAT|O_RDWR, 0644);
@@ -545,7 +546,7 @@ nvram_init(const char *nvram_path)
}
static int
-copy_from_nvram_to_GFW(xc_interface *xc_handle, uint32_t dom, int nvram_fd)
+copy_from_nvram_to_GFW(xc_interface *xch, uint32_t dom, int nvram_fd)
{
unsigned int nr_pages = NVRAM_SIZE >> PAGE_SHIFT;
struct stat file_stat;
@@ -571,7 +572,7 @@ copy_from_nvram_to_GFW(xc_interface *xc_
return -1;
}
- return xc_ia64_copy_to_domain_pages(xc_handle, dom, buf,
+ return xc_ia64_copy_to_domain_pages(xch, dom, buf,
NVRAM_START >> PAGE_SHIFT, nr_pages);
}
@@ -579,7 +580,7 @@ copy_from_nvram_to_GFW(xc_interface *xc_
/*
*Check is the address where NVRAM data located valid
*/
-static int is_valid_address(void *addr)
+static int is_valid_address(xc_interface *xch, void *addr)
{
struct nvram_save_addr *p = (struct nvram_save_addr *)addr;
@@ -597,7 +598,7 @@ static int is_valid_address(void *addr)
* can be got.
*/
static int
-copy_from_GFW_to_nvram(xc_interface *xc_handle, uint32_t dom, int nvram_fd)
+copy_from_GFW_to_nvram(xc_interface *xch, uint32_t dom, int nvram_fd)
{
xen_pfn_t *pfn_list = NULL;
char *tmp_ptr = NULL;
@@ -625,7 +626,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_
* memory address first.
*/
pfn_list[0] = NVRAM_START >> PAGE_SHIFT;
- tmp_ptr = (char *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ tmp_ptr = (char *)xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ | PROT_WRITE,
pfn_list[0]);
if ( NULL == tmp_ptr )
@@ -637,7 +638,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_
}
/* Check is NVRAM data vaild */
- if ( !is_valid_address(tmp_ptr) )
+ if ( !is_valid_address(xch, tmp_ptr) )
{
free(pfn_list);
munmap(tmp_ptr, PAGE_SIZE);
@@ -654,7 +655,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_
for ( i=0; i<nr_pages; i++ )
pfn_list[i] = (addr_from_GFW_4k_align >> PAGE_SHIFT) + i;
- tmp_ptr = (char *)xc_map_foreign_pages(xc_handle, dom,
+ tmp_ptr = (char *)xc_map_foreign_pages(xch, dom,
PROT_READ | PROT_WRITE,
pfn_list, nr_pages);
if ( NULL == tmp_ptr )
@@ -686,12 +687,12 @@ copy_from_GFW_to_nvram(xc_interface *xc_
return 0;
}
-int xc_ia64_save_to_nvram(xc_interface *xc_handle, uint32_t dom)
+int xc_ia64_save_to_nvram(xc_interface *xch, uint32_t dom)
{
xc_dominfo_t info;
uint64_t nvram_fd = 0;
- if ( xc_domain_getinfo(xc_handle, dom, 1, &info) != 1 )
+ if ( xc_domain_getinfo(xch, dom, 1, &info) != 1 )
{
PERROR("Could not get info for domain");
return -1;
@@ -700,12 +701,12 @@ int xc_ia64_save_to_nvram(xc_interface *
if ( !info.hvm )
return 0;
- xc_get_hvm_param(xc_handle, dom, HVM_PARAM_NVRAM_FD, &nvram_fd);
+ xc_get_hvm_param(xch, dom, HVM_PARAM_NVRAM_FD, &nvram_fd);
if ( !IS_VALID_NVRAM_FD(nvram_fd) )
PERROR("Nvram not initialized. Nvram save failed!");
else
- copy_from_GFW_to_nvram(xc_handle, dom, (int)nvram_fd);
+ copy_from_GFW_to_nvram(xch, dom, (int)nvram_fd);
// although save to nvram maybe fail, we don't return any error number
// to Xend. This is quite logical because damage of NVRAM on native would
@@ -717,7 +718,7 @@ int xc_ia64_save_to_nvram(xc_interface *
#define NVRAM_DIR "/var/lib/xen/nvram/"
#define NVRAM_FILE_PREFIX "nvram_"
-int xc_ia64_nvram_init(xc_interface *xc_handle, char *dom_name, uint32_t dom)
+int xc_ia64_nvram_init(xc_interface *xch, char *dom_name, uint32_t dom)
{
uint64_t nvram_fd;
char nvram_path[PATH_MAX] = NVRAM_DIR;
@@ -750,14 +751,14 @@ int xc_ia64_nvram_init(xc_interface *xc_
strcat(nvram_path, NVRAM_FILE_PREFIX);
strcat(nvram_path, dom_name);
- nvram_fd = nvram_init(nvram_path);
+ nvram_fd = nvram_init(xch, nvram_path);
if ( nvram_fd == (uint64_t)(-1) )
{
- xc_set_hvm_param(xc_handle, dom, HVM_PARAM_NVRAM_FD, 0);
- return -1;
- }
-
- xc_set_hvm_param(xc_handle, dom, HVM_PARAM_NVRAM_FD, nvram_fd);
+ xc_set_hvm_param(xch, dom, HVM_PARAM_NVRAM_FD, 0);
+ return -1;
+ }
+
+ xc_set_hvm_param(xch, dom, HVM_PARAM_NVRAM_FD, nvram_fd);
return 0;
}
@@ -784,7 +785,7 @@ min(unsigned long lhs, unsigned long rhs
}
static int
-xc_ia64_setup_memmap_info(xc_interface *xc_handle, uint32_t dom,
+xc_ia64_setup_memmap_info(xc_interface *xch, uint32_t dom,
unsigned long dom_memsize, /* in bytes */
unsigned long *pfns_special_pages,
unsigned long nr_special_pages,
@@ -795,7 +796,7 @@ xc_ia64_setup_memmap_info(xc_interface *
efi_memory_desc_t *md;
uint64_t nr_mds;
- memmap_info = xc_map_foreign_range(xc_handle, dom,
+ memmap_info = xc_map_foreign_range(xch, dom,
PAGE_SIZE * memmap_info_num_pages,
PROT_READ | PROT_WRITE,
memmap_info_pfn);
@@ -861,14 +862,14 @@ xc_ia64_setup_memmap_info(xc_interface *
/* setup shared_info page */
static int
-xc_ia64_setup_shared_info(xc_interface *xc_handle, uint32_t dom,
+xc_ia64_setup_shared_info(xc_interface *xch, uint32_t dom,
unsigned long shared_info_pfn,
unsigned long memmap_info_pfn,
unsigned long memmap_info_num_pages)
{
shared_info_t *shared_info;
- shared_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ shared_info = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ | PROT_WRITE,
shared_info_pfn);
if (shared_info == NULL) {
@@ -891,7 +892,7 @@ xc_ia64_setup_shared_info(xc_interface *
* convenient to allocate discontiguous memory with different size.
*/
static int
-setup_guest(xc_interface *xc_handle, uint32_t dom, unsigned long memsize,
+setup_guest(xc_interface *xch, uint32_t dom, unsigned long memsize,
char *image, unsigned long image_size)
{
xen_pfn_t *pfn_list;
@@ -949,7 +950,7 @@ setup_guest(xc_interface *xc_handle, uin
pfn++)
pfn_list[i++] = pfn;
- rc = xc_domain_memory_populate_physmap(xc_handle, dom, nr_pages, 0, 0,
+ rc = xc_domain_memory_populate_physmap(xch, dom, nr_pages, 0, 0,
&pfn_list[0]);
if (rc != 0) {
PERROR("Could not allocate normal memory for Vti guest.");
@@ -962,7 +963,7 @@ setup_guest(xc_interface *xc_handle, uin
for (i = 0; i < GFW_PAGES; i++)
pfn_list[i] = (GFW_START >> PAGE_SHIFT) + i;
- rc = xc_domain_memory_populate_physmap(xc_handle, dom, GFW_PAGES,
+ rc = xc_domain_memory_populate_physmap(xch, dom, GFW_PAGES,
0, 0, &pfn_list[0]);
if (rc != 0) {
PERROR("Could not allocate GFW memory for Vti guest.");
@@ -978,7 +979,7 @@ setup_guest(xc_interface *xc_handle, uin
pfn_list[nr_special_pages] = memmap_info_pfn;
nr_special_pages++;
- rc = xc_domain_memory_populate_physmap(xc_handle, dom, nr_special_pages,
+ rc = xc_domain_memory_populate_physmap(xch, dom, nr_special_pages,
0, 0, &pfn_list[0]);
if (rc != 0) {
PERROR("Could not allocate IO page or store page or buffer io page.");
@@ -992,11 +993,11 @@ setup_guest(xc_interface *xc_handle, uin
domctl.u.arch_setup.maxmem = dom_memsize + VGA_IO_SIZE + 1 * MEM_G;
domctl.cmd = XEN_DOMCTL_arch_setup;
domctl.domain = (domid_t)dom;
- if (xc_domctl(xc_handle, &domctl))
+ if (xc_domctl(xch, &domctl))
goto error_out;
// Load guest firmware
- if (xc_ia64_copy_to_domain_pages(xc_handle, dom, image,
+ if (xc_ia64_copy_to_domain_pages(xch, dom, image,
(GFW_START + GFW_SIZE - image_size) >> PAGE_SHIFT,
image_size >> PAGE_SHIFT)) {
PERROR("Could not load guest firmware into domain");
@@ -1005,28 +1006,28 @@ setup_guest(xc_interface *xc_handle, uin
domctl.cmd = XEN_DOMCTL_getdomaininfo;
domctl.domain = (domid_t)dom;
- if (xc_domctl(xc_handle, &domctl) < 0) {
+ if (xc_domctl(xch, &domctl) < 0) {
PERROR("Could not get info on domain");
goto error_out;
}
- if (xc_ia64_setup_memmap_info(xc_handle, dom, dom_memsize,
+ if (xc_ia64_setup_memmap_info(xch, dom, dom_memsize,
pfn_list, nr_special_pages,
memmap_info_pfn, memmap_info_num_pages)) {
PERROR("Could not build memmap info");
goto error_out;
}
- if (xc_ia64_setup_shared_info(xc_handle, dom,
+ if (xc_ia64_setup_shared_info(xch, dom,
domctl.u.getdomaininfo.shared_info_frame,
memmap_info_pfn, memmap_info_num_pages)) {
PERROR("Could not setup shared_info");
goto error_out;
}
- xc_get_hvm_param(xc_handle, dom, HVM_PARAM_NVRAM_FD, &nvram_fd);
+ xc_get_hvm_param(xch, dom, HVM_PARAM_NVRAM_FD, &nvram_fd);
if ( !IS_VALID_NVRAM_FD(nvram_fd) )
nvram_start = 0;
- else if ( copy_from_nvram_to_GFW(xc_handle, dom, (int)nvram_fd ) == -1 ) {
+ else if ( copy_from_nvram_to_GFW(xch, dom, (int)nvram_fd ) == -1 ) {
nvram_start = 0;
close(nvram_fd);
}
@@ -1034,16 +1035,16 @@ setup_guest(xc_interface *xc_handle, uin
vcpus = domctl.u.getdomaininfo.max_vcpu_id + 1;
// Hand-off state passed to guest firmware
- if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, vcpus, nvram_start) <
0) {
+ if (xc_ia64_build_hob(xch, dom, dom_memsize, vcpus, nvram_start) < 0) {
PERROR("Could not build hob");
goto error_out;
}
// zero clear all special pages
for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) {
- xc_set_hvm_param(xc_handle, dom,
+ xc_set_hvm_param(xch, dom,
special_pages[i].param, special_pages[i].pfn);
- if (xc_clear_domain_page(xc_handle, dom, special_pages[i].pfn))
+ if (xc_clear_domain_page(xch, dom, special_pages[i].pfn))
goto error_out;
}
@@ -1055,7 +1056,7 @@ error_out:
}
int
-xc_hvm_build(xc_interface *xc_handle, uint32_t domid, int memsize, const char
*image_name)
+xc_hvm_build(xc_interface *xch, uint32_t domid, int memsize, const char
*image_name)
{
vcpu_guest_context_any_t st_ctxt_any;
vcpu_guest_context_t *ctxt = &st_ctxt_any.c;
@@ -1063,13 +1064,13 @@ xc_hvm_build(xc_interface *xc_handle, ui
unsigned long image_size;
unsigned long nr_pages;
- nr_pages = xc_get_max_pages(xc_handle, domid);
+ nr_pages = xc_get_max_pages(xch, domid);
if (nr_pages < 0) {
PERROR("Could not find total pages for domain");
goto error_out;
}
- image = xc_read_image(image_name, &image_size);
+ image = xc_read_image(xch, image_name, &image_size);
if (image == NULL) {
PERROR("Could not read guest firmware image %s", image_name);
goto error_out;
@@ -1077,7 +1078,7 @@ xc_hvm_build(xc_interface *xc_handle, ui
image_size = (image_size + PAGE_SIZE - 1) & PAGE_MASK;
- if (setup_guest(xc_handle, domid, (unsigned long)memsize, image,
+ if (setup_guest(xch, domid, (unsigned long)memsize, image,
image_size) < 0) {
ERROR("Error constructing guest OS");
goto error_out;
@@ -1092,7 +1093,7 @@ xc_hvm_build(xc_interface *xc_handle, ui
ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_BN;
ctxt->regs.cr.dcr = 0;
ctxt->regs.cr.pta = 15 << 2;
- return xc_vcpu_setcontext(xc_handle, domid, 0, &st_ctxt_any);
+ return xc_vcpu_setcontext(xch, domid, 0, &st_ctxt_any);
error_out:
free(image);
@@ -1105,14 +1106,14 @@ error_out:
* memsize pages marked populate-on-demand, and with a PoD cache size
* of target. If target == memsize, pages are populated normally.
*/
-int xc_hvm_build_target_mem(xc_interface *xc_handle,
+int xc_hvm_build_target_mem(xc_interface *xch,
uint32_t domid,
int memsize,
int target,
const char *image_name)
{
/* XXX:PoD isn't supported yet */
- return xc_hvm_build(xc_handle, domid, target, image_name);
+ return xc_hvm_build(xch, domid, target, image_name);
}
/*
@@ -1131,7 +1132,7 @@ int xc_hvm_build_target_mem(xc_interface
#define _PAGE_AR_RW (2 << 9) /* read & write */
int
-xc_ia64_set_os_type(xc_interface *xc_handle, char *guest_os_type, uint32_t dom)
+xc_ia64_set_os_type(xc_interface *xch, char *guest_os_type, uint32_t dom)
{
DECLARE_DOMCTL;
@@ -1153,7 +1154,7 @@ xc_ia64_set_os_type(xc_interface *xc_han
domctl.u.set_opt_feature.optf.pgprot = (_PAGE_P | _PAGE_A | _PAGE_D |
_PAGE_MA_WB | _PAGE_AR_RW);
domctl.u.set_opt_feature.optf.key = 0;
- if (xc_domctl(xc_handle, &domctl))
+ if (xc_domctl(xch, &domctl))
PERROR("Failed to set region 4 identity mapping for Windows "
"guest OS type.\n");
@@ -1162,7 +1163,7 @@ xc_ia64_set_os_type(xc_interface *xc_han
domctl.u.set_opt_feature.optf.pgprot = (_PAGE_P | _PAGE_A | _PAGE_D |
_PAGE_MA_UC | _PAGE_AR_RW);
domctl.u.set_opt_feature.optf.key = 0;
- if (xc_domctl(xc_handle, &domctl))
+ if (xc_domctl(xch, &domctl))
PERROR("Failed to set region 5 identity mapping for Windows "
"guest OS type.\n");
return 0;
@@ -1176,7 +1177,7 @@ xc_ia64_set_os_type(xc_interface *xc_han
domctl.u.set_opt_feature.optf.pgprot = (_PAGE_P | _PAGE_A | _PAGE_D |
_PAGE_MA_WB | _PAGE_AR_RW);
domctl.u.set_opt_feature.optf.key = 0;
- if (xc_domctl(xc_handle, &domctl))
+ if (xc_domctl(xch, &domctl))
PERROR("Failed to set region 7 identity mapping for Linux "
"guest OS type.\n");
return 0;
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c Fri Jun 25 15:43:50 2010 +0100
@@ -29,21 +29,21 @@ static unsigned long nr_pfns;
static unsigned long nr_pfns;
static int
-populate_page_if_necessary(xc_interface *xc_handle, uint32_t dom, unsigned
long gmfn,
+populate_page_if_necessary(xc_interface *xch, uint32_t dom, unsigned long gmfn,
struct xen_ia64_p2m_table *p2m_table)
{
if (xc_ia64_p2m_present(p2m_table, gmfn))
return 0;
- return xc_domain_memory_populate_physmap(xc_handle, dom, 1, 0, 0, &gmfn);
-}
-
-static int
-read_page(xc_interface *xc_handle, int io_fd, uint32_t dom, unsigned long pfn)
+ return xc_domain_memory_populate_physmap(xch, dom, 1, 0, 0, &gmfn);
+}
+
+static int
+read_page(xc_interface *xch, int io_fd, uint32_t dom, unsigned long pfn)
{
void *mem;
- mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ mem = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ|PROT_WRITE, pfn);
if (mem == NULL) {
ERROR("cannot map page");
@@ -65,7 +65,7 @@ read_page(xc_interface *xc_handle, int i
* pages here.
*/
static int
-xc_ia64_recv_unallocated_list(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_recv_unallocated_list(xc_interface *xch, int io_fd, uint32_t dom,
struct xen_ia64_p2m_table *p2m_table)
{
int rc = -1;
@@ -98,7 +98,7 @@ xc_ia64_recv_unallocated_list(xc_interfa
}
}
if (nr_frees > 0) {
- if (xc_domain_memory_decrease_reservation(xc_handle, dom, nr_frees,
+ if (xc_domain_memory_decrease_reservation(xch, dom, nr_frees,
0, pfntab) < 0) {
PERROR("Could not decrease reservation");
goto out;
@@ -116,7 +116,7 @@ xc_ia64_recv_unallocated_list(xc_interfa
}
static int
-xc_ia64_recv_vcpu_context(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_recv_vcpu_context(xc_interface *xch, int io_fd, uint32_t dom,
uint32_t vcpu, vcpu_guest_context_any_t *ctxt_any)
{
vcpu_guest_context_t *ctxt = &ctxt_any->c;
@@ -130,14 +130,14 @@ xc_ia64_recv_vcpu_context(xc_interface *
/* Initialize and set registers. */
ctxt->flags = VGCF_EXTRA_REGS | VGCF_SET_CR_IRR | VGCF_online |
VGCF_SET_AR_ITC;
- if (xc_vcpu_setcontext(xc_handle, dom, vcpu, ctxt_any) != 0) {
+ if (xc_vcpu_setcontext(xch, dom, vcpu, ctxt_any) != 0) {
ERROR("Couldn't set vcpu context");
return -1;
}
/* Just a check. */
ctxt->flags = 0;
- if (xc_vcpu_getcontext(xc_handle, dom, vcpu, ctxt_any)) {
+ if (xc_vcpu_getcontext(xch, dom, vcpu, ctxt_any)) {
ERROR("Could not get vcpu context");
return -1;
}
@@ -147,7 +147,7 @@ xc_ia64_recv_vcpu_context(xc_interface *
/* Read shared info. */
static int
-xc_ia64_recv_shared_info(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_recv_shared_info(xc_interface *xch, int io_fd, uint32_t dom,
unsigned long shared_info_frame,
unsigned long *start_info_pfn)
{
@@ -157,7 +157,7 @@ xc_ia64_recv_shared_info(xc_interface *x
shared_info_t *shared_info;
/* Read shared info. */
- shared_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ shared_info = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ|PROT_WRITE,
shared_info_frame);
if (shared_info == NULL) {
@@ -186,7 +186,8 @@ xc_ia64_recv_shared_info(xc_interface *x
}
static int
-xc_ia64_recv_vcpumap(const xc_dominfo_t *info, int io_fd, uint64_t **vcpumapp)
+xc_ia64_recv_vcpumap(xc_interface *xch,
+ const xc_dominfo_t *info, int io_fd, uint64_t **vcpumapp)
{
uint64_t max_virt_cpus;
unsigned long vcpumap_size;
@@ -222,7 +223,7 @@ xc_ia64_recv_vcpumap(const xc_dominfo_t
}
static int
-xc_ia64_pv_recv_vcpu_context(xc_interface *xc_handle, int io_fd, int32_t dom,
+xc_ia64_pv_recv_vcpu_context(xc_interface *xch, int io_fd, int32_t dom,
uint32_t vcpu)
{
int rc = -1;
@@ -237,11 +238,11 @@ xc_ia64_pv_recv_vcpu_context(xc_interfac
return -1;
}
- if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, vcpu, &ctxt_any))
+ if (xc_ia64_recv_vcpu_context(xch, io_fd, dom, vcpu, &ctxt_any))
goto out;
/* Then get privreg page. */
- if (read_page(xc_handle, io_fd, dom, ctxt->privregs_pfn) < 0) {
+ if (read_page(xch, io_fd, dom, ctxt->privregs_pfn) < 0) {
ERROR("Could not read vcpu privregs");
goto out;
}
@@ -254,7 +255,7 @@ xc_ia64_pv_recv_vcpu_context(xc_interfac
}
static int
-xc_ia64_pv_recv_shared_info(xc_interface *xc_handle, int io_fd, int32_t dom,
+xc_ia64_pv_recv_shared_info(xc_interface *xch, int io_fd, int32_t dom,
unsigned long shared_info_frame,
struct xen_ia64_p2m_table *p2m_table,
unsigned int store_evtchn,
@@ -268,16 +269,16 @@ xc_ia64_pv_recv_shared_info(xc_interface
start_info_t *start_info;
/* Read shared info. */
- if (xc_ia64_recv_shared_info(xc_handle, io_fd, dom,
+ if (xc_ia64_recv_shared_info(xch, io_fd, dom,
shared_info_frame, &gmfn))
return -1;
/* Uncanonicalise the suspend-record frame number and poke resume rec. */
- if (populate_page_if_necessary(xc_handle, dom, gmfn, p2m_table)) {
+ if (populate_page_if_necessary(xch, dom, gmfn, p2m_table)) {
ERROR("cannot populate page 0x%lx", gmfn);
return -1;
}
- start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ start_info = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ | PROT_WRITE, gmfn);
if (start_info == NULL) {
ERROR("cannot map start_info page");
@@ -296,7 +297,7 @@ xc_ia64_pv_recv_shared_info(xc_interface
}
static int
-xc_ia64_pv_recv_context_ver_one_or_two(xc_interface *xc_handle, int io_fd,
uint32_t dom,
+xc_ia64_pv_recv_context_ver_one_or_two(xc_interface *xch, int io_fd, uint32_t
dom,
unsigned long shared_info_frame,
struct xen_ia64_p2m_table *p2m_table,
unsigned int store_evtchn,
@@ -307,20 +308,20 @@ xc_ia64_pv_recv_context_ver_one_or_two(x
int rc;
/* vcpu 0 context */
- rc = xc_ia64_pv_recv_vcpu_context(xc_handle, io_fd, dom, 0);
+ rc = xc_ia64_pv_recv_vcpu_context(xch, io_fd, dom, 0);
if (rc)
return rc;
/* shared_info */
- rc = xc_ia64_pv_recv_shared_info(xc_handle, io_fd, dom, shared_info_frame,
+ rc = xc_ia64_pv_recv_shared_info(xch, io_fd, dom, shared_info_frame,
p2m_table, store_evtchn, store_mfn,
console_evtchn, console_mfn);
return rc;
}
static int
-xc_ia64_pv_recv_context_ver_three(xc_interface *xc_handle, int io_fd, uint32_t
dom,
+xc_ia64_pv_recv_context_ver_three(xc_interface *xch, int io_fd, uint32_t dom,
unsigned long shared_info_frame,
struct xen_ia64_p2m_table *p2m_table,
unsigned int store_evtchn,
@@ -335,11 +336,11 @@ xc_ia64_pv_recv_context_ver_three(xc_int
/* vcpu map */
uint64_t *vcpumap = NULL;
- if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
+ if (xc_domain_getinfo(xch, dom, 1, &info) != 1) {
ERROR("Could not get domain info");
return -1;
}
- rc = xc_ia64_recv_vcpumap(&info, io_fd, &vcpumap);
+ rc = xc_ia64_recv_vcpumap(xch, &info, io_fd, &vcpumap);
if (rc != 0)
goto out;
@@ -348,13 +349,13 @@ xc_ia64_pv_recv_context_ver_three(xc_int
if (!__test_bit(i, vcpumap))
continue;
- rc = xc_ia64_pv_recv_vcpu_context(xc_handle, io_fd, dom, i);
+ rc = xc_ia64_pv_recv_vcpu_context(xch, io_fd, dom, i);
if (rc != 0)
goto out;
}
/* shared_info */
- rc = xc_ia64_pv_recv_shared_info(xc_handle, io_fd, dom, shared_info_frame,
+ rc = xc_ia64_pv_recv_shared_info(xch, io_fd, dom, shared_info_frame,
p2m_table, store_evtchn, store_mfn,
console_evtchn, console_mfn);
out:
@@ -365,7 +366,7 @@ xc_ia64_pv_recv_context_ver_three(xc_int
static int
xc_ia64_pv_recv_context(unsigned long format_version,
- xc_interface *xc_handle, int io_fd, uint32_t dom,
+ xc_interface *xch, int io_fd, uint32_t dom,
unsigned long shared_info_frame,
struct xen_ia64_p2m_table *p2m_table,
unsigned int store_evtchn,
@@ -377,14 +378,14 @@ xc_ia64_pv_recv_context(unsigned long fo
switch (format_version) {
case XC_IA64_SR_FORMAT_VER_ONE:
case XC_IA64_SR_FORMAT_VER_TWO:
- rc = xc_ia64_pv_recv_context_ver_one_or_two(xc_handle, io_fd, dom,
+ rc = xc_ia64_pv_recv_context_ver_one_or_two(xch, io_fd, dom,
shared_info_frame,
p2m_table, store_evtchn,
store_mfn, console_evtchn,
console_mfn);
break;
case XC_IA64_SR_FORMAT_VER_THREE:
- rc = xc_ia64_pv_recv_context_ver_three(xc_handle, io_fd, dom,
+ rc = xc_ia64_pv_recv_context_ver_three(xch, io_fd, dom,
shared_info_frame,
p2m_table, store_evtchn,
store_mfn, console_evtchn,
@@ -399,7 +400,7 @@ xc_ia64_pv_recv_context(unsigned long fo
}
static int
-xc_ia64_hvm_recv_context(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_hvm_recv_context(xc_interface *xch, int io_fd, uint32_t dom,
unsigned long shared_info_frame,
struct xen_ia64_p2m_table *p2m_table,
unsigned int store_evtchn, unsigned long *store_mfn,
@@ -429,16 +430,16 @@ xc_ia64_hvm_recv_context(xc_interface *x
uint8_t *hvm_buf = NULL;
/* Read shared info. */
- if (xc_ia64_recv_shared_info(xc_handle, io_fd, dom, shared_info_frame,
+ if (xc_ia64_recv_shared_info(xch, io_fd, dom, shared_info_frame,
NULL))
goto out;
/* vcpu map */
- if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
+ if (xc_domain_getinfo(xch, dom, 1, &info) != 1) {
ERROR("Could not get domain info");
goto out;
}
- if (xc_ia64_recv_vcpumap(&info, io_fd, &vcpumap))
+ if (xc_ia64_recv_vcpumap(xch, &info, io_fd, &vcpumap))
goto out;
/* vcpu context */
@@ -449,7 +450,7 @@ xc_ia64_hvm_recv_context(xc_interface *x
if (!__test_bit(i, vcpumap))
continue;
- if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, i, &ctxt_any))
+ if (xc_ia64_recv_vcpu_context(xch, io_fd, dom, i, &ctxt_any))
goto out;
/* system context of vcpu is recieved as hvm context. */
@@ -463,18 +464,18 @@ xc_ia64_hvm_recv_context(xc_interface *x
/* These comms pages need to be zeroed at the start of day */
for (i = 0; i < NR_PARAMS; i++) {
- rc = xc_clear_domain_page(xc_handle, dom, magic_pfns[i]);
+ rc = xc_clear_domain_page(xch, dom, magic_pfns[i]);
if (rc != 0) {
ERROR("error zeroing magic pages: %i", rc);
goto out;
}
- rc = xc_set_hvm_param(xc_handle, dom, hvm_params[i], magic_pfns[i]);
+ rc = xc_set_hvm_param(xch, dom, hvm_params[i], magic_pfns[i]);
if (rc != 0) {
ERROR("error setting HVM params: %i", rc);
goto out;
}
}
- rc = xc_set_hvm_param(xc_handle, dom,
+ rc = xc_set_hvm_param(xch, dom,
HVM_PARAM_STORE_EVTCHN, store_evtchn);
if (rc != 0) {
ERROR("error setting HVM params: %i", rc);
@@ -501,7 +502,7 @@ xc_ia64_hvm_recv_context(xc_interface *x
goto out;
}
- rc = xc_domain_hvm_setcontext(xc_handle, dom, hvm_buf, rec_size);
+ rc = xc_domain_hvm_setcontext(xch, dom, hvm_buf, rec_size);
if (rc != 0) {
ERROR("error setting the HVM context");
goto out;
@@ -521,7 +522,7 @@ out:
* hvm domain requires IO pages allocated when XEN_DOMCTL_arch_setup
*/
static int
-xc_ia64_hvm_domain_setup(xc_interface *xc_handle, uint32_t dom)
+xc_ia64_hvm_domain_setup(xc_interface *xch, uint32_t dom)
{
int rc;
xen_pfn_t pfn_list[] = {
@@ -531,7 +532,7 @@ xc_ia64_hvm_domain_setup(xc_interface *x
};
unsigned long nr_pages = sizeof(pfn_list) / sizeof(pfn_list[0]);
- rc = xc_domain_memory_populate_physmap(xc_handle, dom, nr_pages,
+ rc = xc_domain_memory_populate_physmap(xch, dom, nr_pages,
0, 0, &pfn_list[0]);
if (rc != 0)
PERROR("Could not allocate IO page or buffer io page.");
@@ -539,7 +540,7 @@ xc_ia64_hvm_domain_setup(xc_interface *x
}
int
-xc_domain_restore(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
unsigned int store_evtchn, unsigned long *store_mfn,
unsigned int console_evtchn, unsigned long *console_mfn,
unsigned int hvm, unsigned int pae, int superpages)
@@ -580,7 +581,7 @@ xc_domain_restore(xc_interface *xc_handl
goto out;
}
- if (hvm && xc_ia64_hvm_domain_setup(xc_handle, dom) != 0)
+ if (hvm && xc_ia64_hvm_domain_setup(xch, dom) != 0)
goto out;
/* Build firmware (will be overwritten). */
@@ -589,13 +590,13 @@ xc_domain_restore(xc_interface *xc_handl
domctl.u.arch_setup.bp = 0; /* indicate domain restore */
domctl.cmd = XEN_DOMCTL_arch_setup;
- if (xc_domctl(xc_handle, &domctl))
+ if (xc_domctl(xch, &domctl))
goto out;
/* Get the domain's shared-info frame. */
domctl.cmd = XEN_DOMCTL_getdomaininfo;
domctl.domain = (domid_t)dom;
- if (xc_domctl(xc_handle, &domctl) < 0) {
+ if (xc_domctl(xch, &domctl) < 0) {
ERROR("Could not get information on new domain");
goto out;
}
@@ -622,7 +623,7 @@ xc_domain_restore(xc_interface *xc_handl
ERROR("read: memmap_info");
goto out;
}
- if (xc_ia64_p2m_map(&p2m_table, xc_handle,
+ if (xc_ia64_p2m_map(&p2m_table, xch,
dom, memmap_info, IA64_DOM0VP_EFP_ALLOC_PTE)) {
ERROR("p2m mapping");
goto out;
@@ -647,7 +648,7 @@ xc_domain_restore(xc_interface *xc_handl
memdesc->num_pages = nr_pfns << (PAGE_SHIFT - EFI_PAGE_SHIFT);
memdesc->attribute = EFI_MEMORY_WB;
- if (xc_ia64_p2m_map(&p2m_table, xc_handle,
+ if (xc_ia64_p2m_map(&p2m_table, xch,
dom, memmap_info, IA64_DOM0VP_EFP_ALLOC_PTE)) {
ERROR("p2m mapping");
goto out;
@@ -668,26 +669,26 @@ xc_domain_restore(xc_interface *xc_handl
if (gmfn == INVALID_MFN)
break;
- if (populate_page_if_necessary(xc_handle, dom, gmfn, &p2m_table) < 0) {
+ if (populate_page_if_necessary(xch, dom, gmfn, &p2m_table) < 0) {
ERROR("can not populate page 0x%lx", gmfn);
goto out;
}
- if (read_page(xc_handle, io_fd, dom, gmfn) < 0)
+ if (read_page(xch, io_fd, dom, gmfn) < 0)
goto out;
}
DPRINTF("Received all pages\n");
- if (xc_ia64_recv_unallocated_list(xc_handle, io_fd, dom, &p2m_table))
+ if (xc_ia64_recv_unallocated_list(xch, io_fd, dom, &p2m_table))
goto out;
if (!hvm)
rc = xc_ia64_pv_recv_context(ver,
- xc_handle, io_fd, dom, shared_info_frame,
+ xch, io_fd, dom, shared_info_frame,
&p2m_table, store_evtchn, store_mfn,
console_evtchn, console_mfn);
else
- rc = xc_ia64_hvm_recv_context(xc_handle, io_fd, dom, shared_info_frame,
+ rc = xc_ia64_hvm_recv_context(xch, io_fd, dom, shared_info_frame,
&p2m_table, store_evtchn, store_mfn,
console_evtchn, console_mfn);
if (rc)
@@ -713,7 +714,7 @@ xc_domain_restore(xc_interface *xc_handl
xc_ia64_p2m_unmap(&p2m_table);
if ((rc != 0) && (dom != 0))
- xc_domain_destroy(xc_handle, dom);
+ xc_domain_destroy(xch, dom);
DPRINTF("Restore exit with rc=%d\n", rc);
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c Fri Jun 25 15:43:50 2010 +0100
@@ -54,7 +54,7 @@ static inline void set_bit(int nr, volat
static int
suspend_and_state(int (*suspend)(void*), void* data,
- xc_interface *xc_handle, int io_fd,
+ xc_interface *xch, int io_fd,
int dom, xc_dominfo_t *info)
{
if ( !(*suspend)(data) ) {
@@ -62,7 +62,7 @@ suspend_and_state(int (*suspend)(void*),
return -1;
}
- if ( (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) ||
+ if ( (xc_domain_getinfo(xch, dom, 1, info) != 1) ||
!info->shutdown || (info->shutdown_reason != SHUTDOWN_suspend) ) {
ERROR("Could not get domain info");
return -1;
@@ -86,7 +86,7 @@ md_is_not_ram(const efi_memory_desc_t *m
* page after pausing the domain.
*/
static int
-xc_ia64_send_unallocated_list(xc_interface *xc_handle, int io_fd,
+xc_ia64_send_unallocated_list(xc_interface *xch, int io_fd,
struct xen_ia64_p2m_table *p2m_table,
xen_ia64_memmap_info_t *memmap_info,
void *memmap_desc_start, void *memmap_desc_end)
@@ -155,11 +155,11 @@ xc_ia64_send_unallocated_list(xc_interfa
}
static int
-xc_ia64_send_vcpu_context(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_send_vcpu_context(xc_interface *xch, int io_fd, uint32_t dom,
uint32_t vcpu, vcpu_guest_context_any_t *ctxt_any)
{
vcpu_guest_context_t *ctxt = &ctxt_any->c;
- if (xc_vcpu_getcontext(xc_handle, dom, vcpu, ctxt_any)) {
+ if (xc_vcpu_getcontext(xch, dom, vcpu, ctxt_any)) {
ERROR("Could not get vcpu context");
return -1;
}
@@ -174,7 +174,7 @@ xc_ia64_send_vcpu_context(xc_interface *
}
static int
-xc_ia64_send_shared_info(xc_interface *xc_handle, int io_fd, shared_info_t
*live_shinfo)
+xc_ia64_send_shared_info(xc_interface *xch, int io_fd, shared_info_t
*live_shinfo)
{
if (write_exact(io_fd, live_shinfo, PAGE_SIZE)) {
ERROR("Error when writing to state file (1)");
@@ -184,7 +184,7 @@ xc_ia64_send_shared_info(xc_interface *x
}
static int
-xc_ia64_send_vcpumap(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_send_vcpumap(xc_interface *xch, int io_fd, uint32_t dom,
const xc_dominfo_t *info, uint64_t max_virt_cpus,
uint64_t **vcpumapp)
{
@@ -204,7 +204,7 @@ xc_ia64_send_vcpumap(xc_interface *xc_ha
for (i = 0; i <= info->max_vcpu_id; i++) {
xc_vcpuinfo_t vinfo;
- if ((xc_vcpu_getinfo(xc_handle, dom, i, &vinfo) == 0) && vinfo.online)
+ if ((xc_vcpu_getinfo(xch, dom, i, &vinfo) == 0) && vinfo.online)
__set_bit(i, vcpumap);
}
@@ -231,7 +231,7 @@ xc_ia64_send_vcpumap(xc_interface *xc_ha
static int
-xc_ia64_pv_send_context(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_pv_send_context(xc_interface *xch, int io_fd, uint32_t dom,
const xc_dominfo_t *info, shared_info_t *live_shinfo)
{
int rc = -1;
@@ -239,7 +239,7 @@ xc_ia64_pv_send_context(xc_interface *xc
/* vcpu map */
uint64_t *vcpumap = NULL;
- if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, XEN_LEGACY_MAX_VCPUS,
+ if (xc_ia64_send_vcpumap(xch, io_fd, dom, info, XEN_LEGACY_MAX_VCPUS,
&vcpumap))
goto out;
@@ -254,10 +254,10 @@ xc_ia64_pv_send_context(xc_interface *xc
if (!__test_bit(i, vcpumap))
continue;
- if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, i, &ctxt_any))
- goto out;
-
- mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ if (xc_ia64_send_vcpu_context(xch, io_fd, dom, i, &ctxt_any))
+ goto out;
+
+ mem = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ|PROT_WRITE, ctxt->privregs_pfn);
if (mem == NULL) {
ERROR("cannot map privreg page");
@@ -271,7 +271,7 @@ xc_ia64_pv_send_context(xc_interface *xc
munmap(mem, PAGE_SIZE);
}
- rc = xc_ia64_send_shared_info(xc_handle, io_fd, live_shinfo);
+ rc = xc_ia64_send_shared_info(xch, io_fd, live_shinfo);
out:
if (vcpumap != NULL)
@@ -280,7 +280,7 @@ xc_ia64_pv_send_context(xc_interface *xc
}
static int
-xc_ia64_hvm_send_context(xc_interface *xc_handle, int io_fd, uint32_t dom,
+xc_ia64_hvm_send_context(xc_interface *xch, int io_fd, uint32_t dom,
const xc_dominfo_t *info, shared_info_t *live_shinfo)
{
int rc = -1;
@@ -305,11 +305,11 @@ xc_ia64_hvm_send_context(xc_interface *x
uint64_t hvm_buf_size = 0;
uint8_t *hvm_buf = NULL;
- if (xc_ia64_send_shared_info(xc_handle, io_fd, live_shinfo))
+ if (xc_ia64_send_shared_info(xch, io_fd, live_shinfo))
return -1;
/* vcpu map */
- if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, XEN_LEGACY_MAX_VCPUS,
+ if (xc_ia64_send_vcpumap(xch, io_fd, dom, info, XEN_LEGACY_MAX_VCPUS,
&vcpumap))
goto out;
@@ -321,7 +321,7 @@ xc_ia64_hvm_send_context(xc_interface *x
if (!__test_bit(i, vcpumap))
continue;
- if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, i, &ctxt_any))
+ if (xc_ia64_send_vcpu_context(xch, io_fd, dom, i, &ctxt_any))
goto out;
/* system context of vcpu is sent as hvm context. */
@@ -330,7 +330,7 @@ xc_ia64_hvm_send_context(xc_interface *x
/* Save magic-page locations. */
memset(magic_pfns, 0, sizeof(magic_pfns));
for (i = 0; i < NR_PARAMS; i++) {
- if (xc_get_hvm_param(xc_handle, dom, hvm_params[i], &magic_pfns[i])) {
+ if (xc_get_hvm_param(xch, dom, hvm_params[i], &magic_pfns[i])) {
PERROR("Error when xc_get_hvm_param");
goto out;
}
@@ -342,7 +342,7 @@ xc_ia64_hvm_send_context(xc_interface *x
}
/* Need another buffer for HVM context */
- hvm_buf_size = xc_domain_hvm_getcontext(xc_handle, dom, 0, 0);
+ hvm_buf_size = xc_domain_hvm_getcontext(xch, dom, 0, 0);
if (hvm_buf_size == -1) {
ERROR("Couldn't get HVM context size from Xen");
goto out;
@@ -355,7 +355,7 @@ xc_ia64_hvm_send_context(xc_interface *x
}
/* Get HVM context from Xen and save it too */
- rec_size = xc_domain_hvm_getcontext(xc_handle, dom, hvm_buf, hvm_buf_size);
+ rec_size = xc_domain_hvm_getcontext(xch, dom, hvm_buf, hvm_buf_size);
if (rec_size == -1) {
ERROR("HVM:Could not get hvm buffer");
goto out;
@@ -381,7 +381,7 @@ out:
}
int
-xc_domain_save(xc_interface *xc_handle, int io_fd, uint32_t dom, uint32_t
max_iters,
+xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags,
struct save_callbacks* callbacks,
int hvm, void (*switch_qemu_logdirty)(int, unsigned))
@@ -449,7 +449,7 @@ xc_domain_save(xc_interface *xc_handle,
//initialize_mbit_rate();
- if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
+ if (xc_domain_getinfo(xch, dom, 1, &info) != 1) {
ERROR("Could not get domain info");
return 1;
}
@@ -466,14 +466,14 @@ xc_domain_save(xc_interface *xc_handle,
#endif
/* Map the shared info frame */
- live_shinfo = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ live_shinfo = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ, shared_info_frame);
if (!live_shinfo) {
ERROR("Couldn't map live_shinfo");
goto out;
}
- p2m_size = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom) + 1;
+ p2m_size = xc_memory_op(xch, XENMEM_maximum_gpfn, &dom) + 1;
/* This is expected by xm restore. */
if (write_exact(io_fd, &p2m_size, sizeof(unsigned long))) {
@@ -498,7 +498,7 @@ xc_domain_save(xc_interface *xc_handle,
domctl.cmd = XEN_DOMCTL_arch_setup;
domctl.domain = (domid_t)dom;
domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query;
- if (xc_domctl(xc_handle, &domctl) < 0) {
+ if (xc_domctl(xch, &domctl) < 0) {
ERROR("Could not get domain setup");
goto out;
}
@@ -511,7 +511,7 @@ xc_domain_save(xc_interface *xc_handle,
/* Domain is still running at this point */
if (live) {
- if (xc_shadow_control(xc_handle, dom,
+ if (xc_shadow_control(xch, dom,
XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
NULL, 0, NULL, 0, NULL ) < 0) {
ERROR("Couldn't enable shadow mode");
@@ -551,7 +551,7 @@ xc_domain_save(xc_interface *xc_handle,
last_iter = 1;
- if (suspend_and_state(callbacks->suspend, callbacks->data, xc_handle,
+ if (suspend_and_state(callbacks->suspend, callbacks->data, xch,
io_fd, dom, &info)) {
ERROR("Domain appears not to have suspended");
goto out;
@@ -560,14 +560,14 @@ xc_domain_save(xc_interface *xc_handle,
}
/* copy before use in case someone updating them */
- if (xc_ia64_copy_memmap(xc_handle, info.domid, live_shinfo,
+ if (xc_ia64_copy_memmap(xch, info.domid, live_shinfo,
&memmap_info, &memmap_info_num_pages) != 0) {
PERROR("Could not copy memmap");
goto out;
}
memmap_size = memmap_info_num_pages << PAGE_SHIFT;
- if (xc_ia64_p2m_map(&p2m_table, xc_handle, dom, memmap_info, 0) < 0) {
+ if (xc_ia64_p2m_map(&p2m_table, xch, dom, memmap_info, 0) < 0) {
PERROR("xc_ia64_p2m_map");
goto out;
}
@@ -596,7 +596,7 @@ xc_domain_save(xc_interface *xc_handle,
slightly wasteful to peek the whole array evey time,
but this is fast enough for the moment. */
if (!last_iter) {
- if (xc_shadow_control(xc_handle, dom,
+ if (xc_shadow_control(xch, dom,
XEN_DOMCTL_SHADOW_OP_PEEK,
to_skip, p2m_size,
NULL, 0, NULL) != p2m_size) {
@@ -638,7 +638,7 @@ xc_domain_save(xc_interface *xc_handle,
xc_ia64_p2m_mfn(&p2m_table, N),
N, p2m_size);
- mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ mem = xc_map_foreign_range(xch, dom, PAGE_SIZE,
PROT_READ|PROT_WRITE, N);
if (mem == NULL) {
/* The page may have move.
@@ -681,14 +681,14 @@ xc_domain_save(xc_interface *xc_handle,
last_iter = 1;
if (suspend_and_state(callbacks->suspend, callbacks->data,
- xc_handle, io_fd, dom, &info)) {
+ xch, io_fd, dom, &info)) {
ERROR("Domain appears not to have suspended");
goto out;
}
}
/* Pages to be sent are pages which were dirty. */
- if (xc_shadow_control(xc_handle, dom,
+ if (xc_shadow_control(xch, dom,
XEN_DOMCTL_SHADOW_OP_CLEAN,
to_send, p2m_size,
NULL, 0, NULL ) != p2m_size) {
@@ -698,7 +698,7 @@ xc_domain_save(xc_interface *xc_handle,
sent_last_iter = sent_this_iter;
- //print_stats(xc_handle, dom, sent_this_iter, &stats, 1);
+ //print_stats(xch, dom, sent_this_iter, &stats, 1);
}
}
@@ -713,16 +713,16 @@ xc_domain_save(xc_interface *xc_handle,
}
}
- if (xc_ia64_send_unallocated_list(xc_handle, io_fd, &p2m_table,
+ if (xc_ia64_send_unallocated_list(xch, io_fd, &p2m_table,
memmap_info,
memmap_desc_start, memmap_desc_end))
goto out;
if (!hvm)
- rc = xc_ia64_pv_send_context(xc_handle, io_fd,
+ rc = xc_ia64_pv_send_context(xch, io_fd,
dom, &info, live_shinfo);
else
- rc = xc_ia64_hvm_send_context(xc_handle, io_fd,
+ rc = xc_ia64_hvm_send_context(xch, io_fd,
dom, &info, live_shinfo);
if (rc)
goto out;
@@ -735,27 +735,27 @@ xc_domain_save(xc_interface *xc_handle,
callbacks->postcopy(callbacks->data);
/* Flush last write and discard cache for file. */
- discard_file_cache(io_fd, 1 /* flush */);
+ discard_file_cache(xch, io_fd, 1 /* flush */);
/* checkpoint_cb can spend arbitrarily long in between rounds */
if (!rc && callbacks->checkpoint &&
callbacks->checkpoint(callbacks->data) > 0)
{
/* reset stats timer */
- //print_stats(xc_handle, dom, 0, &stats, 0);
+ //print_stats(xch, dom, 0, &stats, 0);
rc = 1;
/* last_iter = 1; */
- if ( suspend_and_state(callbacks->suspend, callbacks->data, xc_handle,
+ if ( suspend_and_state(callbacks->suspend, callbacks->data, xch,
io_fd, dom, &info) )
{
ERROR("Domain appears not to have suspended");
goto out;
}
DPRINTF("SUSPEND shinfo %08lx\n", info.shared_info_frame);
- //print_stats(xc_handle, dom, 0, &stats, 1);
-
- if ( xc_shadow_control(xc_handle, dom,
+ //print_stats(xch, dom, 0, &stats, 1);
+
+ if ( xc_shadow_control(xch, dom,
XEN_DOMCTL_SHADOW_OP_CLEAN, to_send,
p2m_size, NULL, 0, NULL) != p2m_size )
{
@@ -766,7 +766,7 @@ xc_domain_save(xc_interface *xc_handle,
}
if (live) {
- if (xc_shadow_control(xc_handle, dom,
+ if (xc_shadow_control(xch, dom,
XEN_DOMCTL_SHADOW_OP_OFF,
NULL, 0, NULL, 0, NULL ) < 0) {
DPRINTF("Warning - couldn't disable shadow mode");
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/ia64/xc_ia64_stubs.c
--- a/tools/libxc/ia64/xc_ia64_stubs.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_stubs.c Fri Jun 25 15:43:50 2010 +0100
@@ -19,7 +19,7 @@ xc_ia64_fpsr_default(void)
}
static int
-xc_ia64_get_pfn_list(xc_interface *xc_handle, uint32_t domid, xen_pfn_t
*pfn_buf,
+xc_ia64_get_pfn_list(xc_interface *xch, uint32_t domid, xen_pfn_t *pfn_buf,
unsigned int start_page, unsigned int nr_pages)
{
DECLARE_DOMCTL;
@@ -36,34 +36,34 @@ xc_ia64_get_pfn_list(xc_interface *xc_ha
PERROR("Could not lock pfn list buffer");
return -1;
}
- ret = do_domctl(xc_handle, &domctl);
+ ret = do_domctl(xch, &domctl);
unlock_pages(pfn_buf, nr_pages * sizeof(xen_pfn_t));
return ret < 0 ? -1 : nr_pages;
}
int
-xc_get_pfn_list(xc_interface *xc_handle, uint32_t domid, uint64_t *pfn_buf,
+xc_get_pfn_list(xc_interface *xch, uint32_t domid, uint64_t *pfn_buf,
unsigned long max_pfns)
{
- return xc_ia64_get_pfn_list(xc_handle, domid, (xen_pfn_t *)pfn_buf,
+ return xc_ia64_get_pfn_list(xch, domid, (xen_pfn_t *)pfn_buf,
0, max_pfns);
}
long
-xc_get_max_pages(xc_interface *xc_handle, uint32_t domid)
+xc_get_max_pages(xc_interface *xch, uint32_t domid)
{
struct xen_domctl domctl;
domctl.cmd = XEN_DOMCTL_getdomaininfo;
domctl.domain = (domid_t)domid;
- return ((do_domctl(xc_handle, &domctl) < 0)
+ return ((do_domctl(xch, &domctl) < 0)
? -1 : domctl.u.getdomaininfo.max_pages);
}
/* It is possible to get memmap_info and memmap by
foreign domain page mapping. But it's racy. Use hypercall to avoid race. */
static int
-xc_ia64_get_memmap(xc_interface *xc_handle,
+xc_ia64_get_memmap(xc_interface *xch,
uint32_t domid, char *buf, unsigned long bufsize)
{
privcmd_hypercall_t hypercall;
@@ -78,13 +78,13 @@ xc_ia64_get_memmap(xc_interface *xc_hand
if (lock_pages(buf, bufsize) != 0)
return -1;
- ret = do_xen_hypercall(xc_handle, &hypercall);
+ ret = do_xen_hypercall(xch, &hypercall);
unlock_pages(buf, bufsize);
return ret;
}
int
-xc_ia64_copy_memmap(xc_interface *xc_handle, uint32_t domid, shared_info_t
*live_shinfo,
+xc_ia64_copy_memmap(xc_interface *xch, uint32_t domid, shared_info_t
*live_shinfo,
xen_ia64_memmap_info_t **memmap_info_p,
unsigned long *memmap_info_num_pages_p)
{
@@ -98,7 +98,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han
int ret;
- gpfn_max_prev = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &domid);
+ gpfn_max_prev = xc_memory_op(xch, XENMEM_maximum_gpfn, &domid);
if (gpfn_max_prev < 0)
return -1;
@@ -113,7 +113,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han
memmap_info = malloc(memmap_size);
if (memmap_info == NULL)
return -1;
- ret = xc_ia64_get_memmap(xc_handle,
+ ret = xc_ia64_get_memmap(xch,
domid, (char*)memmap_info, memmap_size);
if (ret != 0) {
free(memmap_info);
@@ -127,7 +127,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han
goto again;
}
- gpfn_max_post = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &domid);
+ gpfn_max_post = xc_memory_op(xch, XENMEM_maximum_gpfn, &domid);
if (gpfn_max_prev < 0) {
free(memmap_info);
return -1;
@@ -163,7 +163,7 @@ xc_ia64_copy_memmap(xc_interface *xc_han
#define PTRS_PER_PTE (1UL << (PAGE_SHIFT - 3))
static void*
-xc_ia64_map_foreign_p2m(xc_interface *xc_handle, uint32_t dom,
+xc_ia64_map_foreign_p2m(xc_interface *xch, uint32_t dom,
struct xen_ia64_memmap_info *memmap_info,
unsigned long flags, unsigned long *p2m_size_p)
{
@@ -174,12 +174,12 @@ xc_ia64_map_foreign_p2m(xc_interface *xc
int ret;
int saved_errno;
- gpfn_max = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom);
+ gpfn_max = xc_memory_op(xch, XENMEM_maximum_gpfn, &dom);
if (gpfn_max < 0)
return NULL;
p2m_size =
(((gpfn_max + 1) + PTRS_PER_PTE - 1) / PTRS_PER_PTE) << PAGE_SHIFT;
- addr = mmap(NULL, p2m_size, PROT_READ, MAP_SHARED, xc_handle, 0);
+ addr = mmap(NULL, p2m_size, PROT_READ, MAP_SHARED, xch->fd, 0);
if (addr == MAP_FAILED)
return NULL;
@@ -197,7 +197,7 @@ xc_ia64_map_foreign_p2m(xc_interface *xc
errno = saved_errno;
return NULL;
}
- ret = do_xen_hypercall(xc_handle, &hypercall);
+ ret = do_xen_hypercall(xch, &hypercall);
saved_errno = errno;
unlock_pages(memmap_info,
sizeof(*memmap_info) + memmap_info->efi_memmap_size);
@@ -219,11 +219,11 @@ xc_ia64_p2m_init(struct xen_ia64_p2m_tab
}
int
-xc_ia64_p2m_map(struct xen_ia64_p2m_table *p2m_table, xc_interface *xc_handle,
+xc_ia64_p2m_map(struct xen_ia64_p2m_table *p2m_table, xc_interface *xch,
uint32_t domid, struct xen_ia64_memmap_info *memmap_info,
unsigned long flag)
{
- p2m_table->p2m = xc_ia64_map_foreign_p2m(xc_handle, domid, memmap_info,
+ p2m_table->p2m = xc_ia64_map_foreign_p2m(xch, domid, memmap_info,
flag, &p2m_table->size);
if (p2m_table->p2m == NULL) {
PERROR("Could not map foreign p2m. falling back to old method");
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/xc_core.c Fri Jun 25 15:43:50 2010 +0100
@@ -642,7 +642,7 @@ xc_domain_dumpcore_via_callback(xc_inter
offset += filesz;
/* arch context */
- sts = xc_core_arch_context_get_shdr(&arch_ctxt, sheaders, strtab,
+ sts = xc_core_arch_context_get_shdr(xch, &arch_ctxt, sheaders, strtab,
&filesz, offset);
if ( sts != 0 )
goto out;
@@ -773,7 +773,7 @@ xc_domain_dumpcore_via_callback(xc_inter
}
/* arch specific context */
- sts = xc_core_arch_context_dump(&arch_ctxt, args, dump_rtn);
+ sts = xc_core_arch_context_dump(xch, &arch_ctxt, args, dump_rtn);
if ( sts != 0 )
goto out;
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/xc_core_ia64.c
--- a/tools/libxc/xc_core_ia64.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/xc_core_ia64.c Fri Jun 25 15:43:50 2010 +0100
@@ -48,10 +48,12 @@ xc_memory_map_cmp(const void *lhs__, con
return 1;
/* memory map overlap isn't allowed. complain */
- DPRINTF("duplicated addresses are detected "
+#ifdef DEBUG
+ fprintf(stderr, "duplicated addresses are detected "
"(0x%" PRIx64 ", 0x%" PRIx64 "), "
"(0x%" PRIx64 ", 0x%" PRIx64 ")\n",
lhs->addr, lhs->size, rhs->addr, rhs->size);
+#endif
return 0;
}
@@ -316,7 +318,8 @@ xc_core_arch_context_get(struct xc_core_
}
int
-xc_core_arch_context_get_shdr(struct xc_core_arch_context *arch_ctxt,
+xc_core_arch_context_get_shdr(xc_interface *xch,
+ struct xc_core_arch_context *arch_ctxt,
struct xc_core_section_headers *sheaders,
struct xc_core_strtab *strtab,
uint64_t *filesz, uint64_t offset)
@@ -332,14 +335,15 @@ xc_core_arch_context_get_shdr(struct xc_
}
/* mmapped priv regs */
- shdr = xc_core_shdr_get(sheaders);
+ shdr = xc_core_shdr_get(xch, sheaders);
if ( shdr == NULL )
{
PERROR("Could not get section header for .xen_ia64_mapped_regs");
return sts;
}
*filesz = arch_ctxt->mapped_regs_size * arch_ctxt->nr_vcpus;
- sts = xc_core_shdr_set(shdr, strtab, XEN_DUMPCORE_SEC_IA64_MAPPED_REGS,
+ sts = xc_core_shdr_set(xch, shdr, strtab,
+ XEN_DUMPCORE_SEC_IA64_MAPPED_REGS,
SHT_PROGBITS, offset, *filesz,
__alignof__(*arch_ctxt->mapped_regs[0]),
arch_ctxt->mapped_regs_size);
@@ -347,7 +351,8 @@ xc_core_arch_context_get_shdr(struct xc_
}
int
-xc_core_arch_context_dump(struct xc_core_arch_context* arch_ctxt,
+xc_core_arch_context_dump(xc_interface *xch,
+ struct xc_core_arch_context* arch_ctxt,
void* args, dumpcore_rtn_t dump_rtn)
{
int sts = 0;
@@ -356,7 +361,7 @@ xc_core_arch_context_dump(struct xc_core
/* ia64 mapped_regs: .xen_ia64_mapped_regs */
for ( i = 0; i < arch_ctxt->nr_vcpus; i++ )
{
- sts = dump_rtn(args, (char*)arch_ctxt->mapped_regs[i],
+ sts = dump_rtn(xch, args, (char*)arch_ctxt->mapped_regs[i],
arch_ctxt->mapped_regs_size);
if ( sts != 0 )
break;
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/xc_core_ia64.h
--- a/tools/libxc/xc_core_ia64.h Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/xc_core_ia64.h Fri Jun 25 15:43:50 2010 +0100
@@ -43,12 +43,14 @@ xc_core_arch_context_get(struct xc_core_
vcpu_guest_context_any_t* ctxt,
xc_interface *xch, uint32_t domid);
int
-xc_core_arch_context_get_shdr(struct xc_core_arch_context* arch_ctxt,
+xc_core_arch_context_get_shdr(xc_interface *xch,
+ struct xc_core_arch_context* arch_ctxt,
struct xc_core_section_headers *sheaders,
struct xc_core_strtab *strtab,
uint64_t *filesz, uint64_t offset);
int
-xc_core_arch_context_dump(struct xc_core_arch_context* arch_ctxt,
+xc_core_arch_context_dump(xc_interface *xch,
+ struct xc_core_arch_context* arch_ctxt,
void* args, dumpcore_rtn_t dump_rtn);
int
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/xc_core_x86.h
--- a/tools/libxc/xc_core_x86.h Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/xc_core_x86.h Fri Jun 25 15:43:50 2010 +0100
@@ -32,13 +32,14 @@ struct xc_core_arch_context {
#define xc_core_arch_context_free(arch_ctxt) do {} while (0)
#define xc_core_arch_context_get(arch_ctxt, ctxt, xch, domid) \
(0)
-#define xc_core_arch_context_dump(arch_ctxt, args, dump_rtn) (0)
+#define xc_core_arch_context_dump(xch, arch_ctxt, args, dump_rtn) (0)
int
xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
unsigned long pfn);
static inline int
-xc_core_arch_context_get_shdr(struct xc_core_arch_context *arch_ctxt,
+xc_core_arch_context_get_shdr(xc_interface *xch,
+ struct xc_core_arch_context *arch_ctxt,
struct xc_core_section_headers *sheaders,
struct xc_core_strtab *strtab,
uint64_t *filesz, uint64_t offset)
diff -r e307aa11ed27 -r 8e0a20f050a1 tools/libxc/xc_dom_ia64.c
--- a/tools/libxc/xc_dom_ia64.c Fri Jun 25 15:13:11 2010 +0100
+++ b/tools/libxc/xc_dom_ia64.c Fri Jun 25 15:43:50 2010 +0100
@@ -172,7 +172,7 @@ int arch_setup_meminit(struct xc_dom_ima
dom->p2m_host[pfn] = start + pfn;
/* allocate guest memory */
- rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
+ rc = xc_domain_memory_populate_physmap(dom->xch, dom->guest_domid,
nbr, 0, 0,
dom->p2m_host);
return rc;
@@ -195,7 +195,7 @@ static int ia64_setup_memmap(struct xc_d
memmap_info_pfn = dom->start_info_pfn - 1;
DOMPRINTF("%s: memmap: mfn 0x%" PRIpfn " pages 0x%lx",
__FUNCTION__, memmap_info_pfn, memmap_info_num_pages);
- memmap_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+ memmap_info = xc_map_foreign_range(dom->xch, dom->guest_domid,
page_size * memmap_info_num_pages,
PROT_READ | PROT_WRITE,
memmap_info_pfn);
@@ -225,7 +225,7 @@ static int ia64_setup_memmap(struct xc_d
* we use xen_ia64_boot_param::efi_memmap::{efi_memmap, efi_memmap_size}
* for this purpose
*/
- start_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+ start_info = xc_map_foreign_range(dom->xch, dom->guest_domid,
page_size,
PROT_READ | PROT_WRITE,
dom->start_info_pfn);
@@ -254,7 +254,7 @@ int arch_setup_bootearly(struct xc_dom_i
domctl.u.arch_setup.maxmem = 0;
domctl.cmd = XEN_DOMCTL_arch_setup;
domctl.domain = dom->guest_domid;
- rc = xc_domctl(dom->guest_xc, &domctl);
+ rc = xc_domctl(dom->xch, &domctl);
DOMPRINTF("%s: hvm-3.0-ia64-sioemu: %d", __FUNCTION__, rc);
return rc;
}
@@ -267,7 +267,7 @@ int arch_setup_bootearly(struct xc_dom_i
domctl.cmd = XEN_DOMCTL_arch_setup;
domctl.domain = dom->guest_domid;
domctl.u.arch_setup.flags = XEN_DOMAINSETUP_query;
- rc = do_domctl(dom->guest_xc, &domctl);
+ rc = do_domctl(dom->xch, &domctl);
if (rc)
return rc;
rc = xen_ia64_dom_fw_setup(dom, domctl.u.arch_setup.hypercall_imm,
@@ -286,7 +286,7 @@ int arch_setup_bootearly(struct xc_dom_i
+ sizeof(start_info_t);
domctl.u.arch_setup.maxmem = dom->total_pages << PAGE_SHIFT;
domctl.u.arch_setup.vhpt_size_log2 = dom->vhpt_size_log2;
- rc = do_domctl(dom->guest_xc, &domctl);
+ rc = do_domctl(dom->xch, &domctl);
return rc;
}
@@ -298,7 +298,7 @@ int arch_setup_bootlate(struct xc_dom_im
/* setup shared_info page */
DOMPRINTF("%s: shared_info: mfn 0x%" PRIpfn "",
__FUNCTION__, dom->shared_info_mfn);
- shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+ shared_info = xc_map_foreign_range(dom->xch, dom->guest_domid,
page_size,
PROT_READ | PROT_WRITE,
dom->shared_info_mfn);
diff -r e307aa11ed27 -r 8e0a20f050a1 xen/arch/ia64/xen/dom_fw_common.c
--- a/xen/arch/ia64/xen/dom_fw_common.c Fri Jun 25 15:13:11 2010 +0100
+++ b/xen/arch/ia64/xen/dom_fw_common.c Fri Jun 25 15:43:50 2010 +0100
@@ -318,7 +318,11 @@ dom_fw_pal_hypercall_patch(uint64_t brki
}
static inline void
+#ifdef __XEN__
print_md(efi_memory_desc_t *md)
+#else
+print_md(xc_interface *xch, efi_memory_desc_t *md)
+#endif
{
uint64_t size;
@@ -581,7 +585,11 @@ dom_fw_init(domain_t *d,
if (xen_ia64_is_dom0(d)) {
efi_systable_init_dom0(tables);
} else {
+#ifdef __XEN__
efi_systable_init_domu(tables);
+#else
+ efi_systable_init_domu(d->xch, tables);
+#endif
}
/* fill in the SAL system table: */
@@ -675,7 +683,11 @@ dom_fw_init(domain_t *d,
/* Display memmap. */
for (i = 0 ; i < tables->num_mds; i++)
+#ifdef __XEN__
print_md(&tables->efi_memmap[i]);
+#else
+ print_md(d->xch, &tables->efi_memmap[i]);
+#endif
/* Fill boot_param */
bp->efi_systab = FW_FIELD_MPA(efi_systab);
diff -r e307aa11ed27 -r 8e0a20f050a1 xen/arch/ia64/xen/dom_fw_domu.c
--- a/xen/arch/ia64/xen/dom_fw_domu.c Fri Jun 25 15:13:11 2010 +0100
+++ b/xen/arch/ia64/xen/dom_fw_domu.c Fri Jun 25 15:43:50 2010 +0100
@@ -47,7 +47,11 @@
#include <asm/dom_fw.h>
#include <asm/dom_fw_domu.h>
+#ifdef __XEN__
void efi_systable_init_domu(struct fw_tables *tables)
+#else
+void efi_systable_init_domu(xc_interface *xch, struct fw_tables *tables)
+#endif
{
int i = 1;
@@ -77,6 +81,9 @@ complete_domu_memmap(domain_t * d,
void *p;
void *memmap_start;
void *memmap_end;
+#ifndef __XEN__
+ xc_interface *xch = d->xch;
+#endif
if (memmap_info_pfn == 0 || memmap_info_num_pages == 0) {
/* old domain builder which doesn't setup
diff -r e307aa11ed27 -r 8e0a20f050a1 xen/include/asm-ia64/dom_fw_common.h
--- a/xen/include/asm-ia64/dom_fw_common.h Fri Jun 25 15:13:11 2010 +0100
+++ b/xen/include/asm-ia64/dom_fw_common.h Fri Jun 25 15:43:50 2010 +0100
@@ -35,7 +35,7 @@ typedef struct xc_dom_image domain_t;
#define XENLOG_INFO "info:"
#define XENLOG_WARNING "Warning:"
#define XENLOG_GUEST ""
-#define printk(fmt, args ...) xc_dom_printf(fmt, ## args)
+#define printk(fmt, args ...) IPRINTF(fmt, ## args)
#define BUG_ON(p) assert(!(p))
#define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); }))
diff -r e307aa11ed27 -r 8e0a20f050a1 xen/include/asm-ia64/dom_fw_domu.h
--- a/xen/include/asm-ia64/dom_fw_domu.h Fri Jun 25 15:13:11 2010 +0100
+++ b/xen/include/asm-ia64/dom_fw_domu.h Fri Jun 25 15:43:50 2010 +0100
@@ -23,7 +23,11 @@
#include <asm/dom_fw_common.h>
+#ifdef __XEN__
void efi_systable_init_domu(struct fw_tables *tables);
+#else
+void efi_systable_init_domu(xc_interface *xch, struct fw_tables *tables);
+#endif
int
complete_domu_memmap(domain_t *d,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|