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

[Xen-changelog] [xen-unstable] libxc: The following patch replace the li

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: The following patch replace the libxc interface to use
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Jun 2008 07:00:07 -0700
Delivery-date: Fri, 20 Jun 2008 07:00:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213888505 -3600
# Node ID d3a87899985d8f0c91aed55ff05451aee3f973b9
# Parent  3da148fb7d9b21afd6a8c023a8e787aec86d1621
libxc: The following patch replace the libxc interface to use
vcpu_guest_context_any_t (which is both 32 and 64 bits) instead of
vcpu_guest_context_t.

Signed-off-by: Jean Guyader <jean.guyader@xxxxxxxxxxxxx>
---
 tools/libxc/xc_core.c           |    8 ++--
 tools/libxc/xc_domain.c         |   65 ++++++++++++++++------------------------
 tools/libxc/xc_domain_restore.c |   12 +++----
 tools/libxc/xc_domain_save.c    |   20 ++++++------
 tools/libxc/xc_pagetab.c        |    4 +-
 tools/libxc/xc_private.h        |    4 +-
 tools/libxc/xc_ptrace.c         |   30 +++++++++---------
 tools/libxc/xc_ptrace_core.c    |    8 ++--
 tools/libxc/xc_resume.c         |   10 +++---
 tools/libxc/xenctrl.h           |   38 ++++++++++++++++++++++-
 tools/libxc/xg_save_restore.h   |   22 -------------
 tools/xentrace/xenctx.c         |   10 +++---
 12 files changed, 116 insertions(+), 115 deletions(-)

diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_core.c     Thu Jun 19 16:15:05 2008 +0100
@@ -407,7 +407,7 @@ xc_domain_dumpcore_via_callback(int xc_h
 
     int nr_vcpus = 0;
     char *dump_mem, *dump_mem_start = NULL;
-    vcpu_guest_context_t  ctxt[MAX_VIRT_CPUS];
+    vcpu_guest_context_any_t  ctxt[MAX_VIRT_CPUS];
     struct xc_core_arch_context arch_ctxt;
     char dummy[PAGE_SIZE];
     int dummy_len;
@@ -581,10 +581,10 @@ xc_domain_dumpcore_via_callback(int xc_h
         PERROR("Could not get section header for .xen_prstatus");
         goto out;
     }
-    filesz = sizeof(ctxt[0]) * nr_vcpus;
+    filesz = sizeof(ctxt[0].c) * nr_vcpus;
     sts = xc_core_shdr_set(shdr, strtab, XEN_DUMPCORE_SEC_PRSTATUS,
                            SHT_PROGBITS, offset, filesz,
-                           __alignof__(ctxt[0]), sizeof(ctxt[0]));
+                           __alignof__(ctxt[0].c), sizeof(ctxt[0].c));
     if ( sts != 0 )
         goto out;
     offset += filesz;
@@ -707,7 +707,7 @@ xc_domain_dumpcore_via_callback(int xc_h
         goto out;
 
     /* prstatus: .xen_prstatus */
-    sts = dump_rtn(args, (char *)&ctxt, sizeof(ctxt[0]) * nr_vcpus);
+    sts = dump_rtn(args, (char *)&ctxt[0].c, sizeof(ctxt[0].c) * nr_vcpus);
     if ( sts != 0 )
         goto out;
 
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_domain.c   Thu Jun 19 16:15:05 2008 +0100
@@ -298,30 +298,21 @@ int xc_vcpu_getcontext(int xc_handle,
 int xc_vcpu_getcontext(int xc_handle,
                        uint32_t domid,
                        uint32_t vcpu,
-                       vcpu_guest_context_t *ctxt)
-{
-    int rc;
-    DECLARE_DOMCTL;
-    size_t sz = sizeof(vcpu_guest_context_either_t);
+                       vcpu_guest_context_any_t *ctxt)
+{
+    int rc;
+    DECLARE_DOMCTL;
+    size_t sz = sizeof(vcpu_guest_context_any_t);
 
     domctl.cmd = XEN_DOMCTL_getvcpucontext;
     domctl.domain = (domid_t)domid;
     domctl.u.vcpucontext.vcpu   = (uint16_t)vcpu;
-    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
-
-    /*
-     * We may be asked to lock either a 32-bit or a 64-bit context. Lock the
-     * larger of the two if possible, otherwise fall back to native size.
-     */
+    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt->c);
+
+    
     if ( (rc = lock_pages(ctxt, sz)) != 0 )
-    {
-        sz = sizeof(*ctxt);
-        if ( (rc = lock_pages(ctxt, sz)) != 0 )
-            return rc;
-    }
-
+        return rc;
     rc = do_domctl(xc_handle, &domctl);
-
     unlock_pages(ctxt, sz);
 
     return rc;
@@ -626,32 +617,28 @@ int xc_vcpu_setcontext(int xc_handle,
 int xc_vcpu_setcontext(int xc_handle,
                        uint32_t domid,
                        uint32_t vcpu,
-                       vcpu_guest_context_t *ctxt)
-{
-    DECLARE_DOMCTL;
-    int rc;
-    size_t sz = sizeof(vcpu_guest_context_either_t);
+                       vcpu_guest_context_any_t *ctxt)
+{
+    DECLARE_DOMCTL;
+    int rc;
+    size_t sz = sizeof(vcpu_guest_context_any_t);
+
+    if (ctxt == NULL)
+    {
+        errno = EINVAL;
+        return -1;
+    }
 
     domctl.cmd = XEN_DOMCTL_setvcpucontext;
     domctl.domain = domid;
     domctl.u.vcpucontext.vcpu = vcpu;
-    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
-
-    /*
-     * We may be asked to lock either a 32-bit or a 64-bit context. Lock the
-     * larger of the two if possible, otherwise fall back to native size.
-     */
-    if ( (ctxt != NULL) && (rc = lock_pages(ctxt, sz)) != 0 )
-    {
-        sz = sizeof(*ctxt);
-        if ( (rc = lock_pages(ctxt, sz)) != 0 )
-            return rc;
-    }
-
+    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt->c);
+
+    if ( (rc = lock_pages(ctxt, sz)) != 0 )
+        return rc;
     rc = do_domctl(xc_handle, &domctl);
-
-    if ( ctxt != NULL )
-        unlock_pages(ctxt, sz);
+    
+    unlock_pages(ctxt, sz);
 
     return rc;
 }
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c   Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_domain_restore.c   Thu Jun 19 16:15:05 2008 +0100
@@ -153,7 +153,7 @@ static xen_pfn_t *load_p2m_frame_list(
     int io_fd, int *pae_extended_cr3, int *ext_vcpucontext)
 {
     xen_pfn_t *p2m_frame_list;
-    vcpu_guest_context_either_t ctxt;
+    vcpu_guest_context_any_t ctxt;
     xen_pfn_t p2m_fl_zero;
 
     /* Read first entry of P2M list, or extended-info signature (~0UL). */
@@ -284,12 +284,12 @@ int xc_domain_restore(int xc_handle, int
     /* The new domain's shared-info frame number. */
     unsigned long shared_info_frame;
     unsigned char shared_info_page[PAGE_SIZE]; /* saved contents from file */
-    shared_info_either_t *old_shared_info = 
-        (shared_info_either_t *)shared_info_page;
-    shared_info_either_t *new_shared_info;
+    shared_info_any_t *old_shared_info = 
+        (shared_info_any_t *)shared_info_page;
+    shared_info_any_t *new_shared_info;
 
     /* A copy of the CPU context of the guest. */
-    vcpu_guest_context_either_t ctxt;
+    vcpu_guest_context_any_t ctxt;
 
     /* A table containing the type of each PFN (/not/ MFN!). */
     unsigned long *pfn_type = NULL;
@@ -304,7 +304,7 @@ int xc_domain_restore(int xc_handle, int
     xen_pfn_t *p2m_frame_list = NULL;
     
     /* A temporary mapping of the guest's start_info page. */
-    start_info_either_t *start_info;
+    start_info_any_t *start_info;
 
     /* Our mapping of the current region (batch) */
     char *region_base;
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_domain_save.c      Thu Jun 19 16:15:05 2008 +0100
@@ -412,7 +412,7 @@ static int suspend_and_state(int (*suspe
 ** it to update the MFN to a reasonable value.
 */
 static void *map_frame_list_list(int xc_handle, uint32_t dom,
-                                 shared_info_either_t *shinfo)
+                                 shared_info_any_t *shinfo)
 {
     int count = 100;
     void *p;
@@ -628,9 +628,9 @@ static xen_pfn_t *map_and_save_p2m_table
                                          int io_fd, 
                                          uint32_t dom,
                                          unsigned long p2m_size,
-                                         shared_info_either_t *live_shinfo)
-{
-    vcpu_guest_context_either_t ctxt;
+                                         shared_info_any_t *live_shinfo)
+{
+    vcpu_guest_context_any_t ctxt;
 
     /* Double and single indirect references to the live P2M table */
     void *live_p2m_frame_list_list = NULL;
@@ -735,7 +735,7 @@ static xen_pfn_t *map_and_save_p2m_table
         p2m_frame_list[i/FPP] = mfn_to_pfn(p2m_frame_list[i/FPP]);
     }
 
-    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt.c) )
+    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt) )
     {
         ERROR("Could not get vcpu context");
         goto out;
@@ -814,7 +814,7 @@ int xc_domain_save(int xc_handle, int io
     unsigned long shared_info_frame;
 
     /* A copy of the CPU context of the guest. */
-    vcpu_guest_context_either_t ctxt;
+    vcpu_guest_context_any_t ctxt;
 
     /* A table containing the type of each PFN (/not/ MFN!). */
     unsigned long *pfn_type = NULL;
@@ -824,7 +824,7 @@ int xc_domain_save(int xc_handle, int io
     char page[PAGE_SIZE];
 
     /* Live mapping of shared info structure */
-    shared_info_either_t *live_shinfo = NULL;
+    shared_info_any_t *live_shinfo = NULL;
 
     /* base of the region in which domain memory is mapped */
     unsigned char *region_base = NULL;
@@ -1536,7 +1536,7 @@ int xc_domain_save(int xc_handle, int io
         }
     }
 
-    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt.c) )
+    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt) )
     {
         ERROR("Could not get vcpu context");
         goto out;
@@ -1556,7 +1556,7 @@ int xc_domain_save(int xc_handle, int io
         if ( !(vcpumap & (1ULL << i)) )
             continue;
 
-        if ( (i != 0) && xc_vcpu_getcontext(xc_handle, dom, i, &ctxt.c) )
+        if ( (i != 0) && xc_vcpu_getcontext(xc_handle, dom, i, &ctxt) )
         {
             ERROR("No context for VCPU%d", i);
             goto out;
@@ -1624,7 +1624,7 @@ int xc_domain_save(int xc_handle, int io
      * Reset the MFN to be a known-invalid value. See map_frame_list_list().
      */
     memcpy(page, live_shinfo, PAGE_SIZE);
-    SET_FIELD(((shared_info_either_t *)page), 
+    SET_FIELD(((shared_info_any_t *)page), 
               arch.pfn_to_mfn_frame_list_list, 0);
     if ( write_exact(io_fd, page, PAGE_SIZE) )
     {
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_pagetab.c
--- a/tools/libxc/xc_pagetab.c  Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_pagetab.c  Thu Jun 19 16:15:05 2008 +0100
@@ -48,7 +48,7 @@ unsigned long xc_translate_foreign_addre
 unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
                                            int vcpu, unsigned long long virt )
 {
-    vcpu_guest_context_t ctx;
+    vcpu_guest_context_any_t ctx;
     unsigned long long cr3;
     void *pd, *pt, *pdppage = NULL, *pdp, *pml = NULL;
     unsigned long long pde, pte, pdpe, pmle;
@@ -78,7 +78,7 @@ unsigned long xc_translate_foreign_addre
         DPRINTF("failed to retreive vcpu context\n");
         goto out;
     }
-    cr3 = ((unsigned long long)xen_cr3_to_pfn(ctx.ctrlreg[3])) << PAGE_SHIFT;
+    cr3 = ((unsigned long long)xen_cr3_to_pfn(ctx.c.ctrlreg[3])) << PAGE_SHIFT;
 
     /* Page Map Level 4 */
 
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_private.h  Thu Jun 19 16:15:05 2008 +0100
@@ -188,9 +188,9 @@ int xc_map_foreign_ranges(int xc_handle,
                           privcmd_mmap_entry_t *entries, int nr);
 
 void *map_domain_va_core(unsigned long domfd, int cpu, void *guest_va,
-                         vcpu_guest_context_t *ctxt);
+                         vcpu_guest_context_any_t *ctxt);
 int xc_waitdomain_core(int xc_handle, int domain, int *status,
-    int options, vcpu_guest_context_t *ctxt);
+    int options, vcpu_guest_context_any_t *ctxt);
 
 void bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, int nbits);
 void bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, int nbits);
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c   Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_ptrace.c   Thu Jun 19 16:15:05 2008 +0100
@@ -40,9 +40,9 @@ static int current_isfile;
 static int current_isfile;
 static int current_is_hvm;
 
-static uint64_t                 online_cpumap;
-static uint64_t                 regs_valid;
-static vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
+static uint64_t                         online_cpumap;
+static uint64_t                         regs_valid;
+static vcpu_guest_context_any_t      ctxt[MAX_VIRT_CPUS];
 
 extern int ffsll(long long int);
 #define FOREACH_CPU(cpumap, i)  for ( cpumap = online_cpumap; (i = 
ffsll(cpumap)); cpumap &= ~(1 << (index - 1)) )
@@ -96,9 +96,9 @@ xc_register_event_handler(thr_ev_handler
 }
 
 static inline int
-paging_enabled(vcpu_guest_context_t *v)
-{
-    unsigned long cr0 = v->ctrlreg[0];
+paging_enabled(vcpu_guest_context_any_t *v)
+{
+    unsigned long cr0 = v->c.ctrlreg[0];
     return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG);
 }
 
@@ -174,7 +174,7 @@ map_domain_va_32(
 
     l2 = xc_map_foreign_range(
          xc_handle, current_domid, PAGE_SIZE, PROT_READ,
-         xen_cr3_to_pfn(ctxt[cpu].ctrlreg[3]));
+         xen_cr3_to_pfn(ctxt[cpu].c.ctrlreg[3]));
     if ( l2 == NULL )
         return NULL;
 
@@ -216,7 +216,7 @@ map_domain_va_pae(
 
     l3 = xc_map_foreign_range(
         xc_handle, current_domid, PAGE_SIZE, PROT_READ,
-        xen_cr3_to_pfn(ctxt[cpu].ctrlreg[3]));
+        xen_cr3_to_pfn(ctxt[cpu].c.ctrlreg[3]));
     if ( l3 == NULL )
         return NULL;
 
@@ -494,26 +494,26 @@ xc_ptrace(
     case PTRACE_GETREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL))
             goto out_error;
-        SET_PT_REGS(pt, ctxt[cpu].user_regs);
+        SET_PT_REGS(pt, ctxt[cpu].c.user_regs);
         memcpy(data, &pt, sizeof(struct gdb_regs));
         break;
 
     case PTRACE_GETFPREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL)) 
                 goto out_error;
-        memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof (elf_fpregset_t));
+        memcpy(data, &ctxt[cpu].c.fpu_ctxt, sizeof (elf_fpregset_t));
         break;
 
     case PTRACE_GETFPXREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL))
                 goto out_error;
-        memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof(ctxt[cpu].fpu_ctxt));
+        memcpy(data, &ctxt[cpu].c.fpu_ctxt, sizeof(ctxt[cpu].c.fpu_ctxt));
         break;
 
     case PTRACE_SETREGS:
         if (current_isfile)
                 goto out_unsupported; /* XXX not yet supported */
-        SET_XC_REGS(((struct gdb_regs *)data), ctxt[cpu].user_regs);
+        SET_XC_REGS(((struct gdb_regs *)data), ctxt[cpu].c.user_regs);
         if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
                                 &ctxt[cpu])))
             goto out_error_domctl;
@@ -525,7 +525,7 @@ xc_ptrace(
         /*  XXX we can still have problems if the user switches threads
          *  during single-stepping - but that just seems retarded
          */
-        ctxt[cpu].user_regs.eflags |= PSL_T;
+        ctxt[cpu].c.user_regs.eflags |= PSL_T;
         if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
                                 &ctxt[cpu])))
             goto out_error_domctl;
@@ -542,9 +542,9 @@ xc_ptrace(
                 if (fetch_regs(xc_handle, cpu, NULL))
                     goto out_error;
                 /* Clear trace flag */
-                if ( ctxt[cpu].user_regs.eflags & PSL_T )
+                if ( ctxt[cpu].c.user_regs.eflags & PSL_T )
                 {
-                    ctxt[cpu].user_regs.eflags &= ~PSL_T;
+                    ctxt[cpu].c.user_regs.eflags &= ~PSL_T;
                     if ((retval = xc_vcpu_setcontext(xc_handle, current_domid,
                                                 cpu, &ctxt[cpu])))
                         goto out_error_domctl;
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_ptrace_core.c
--- a/tools/libxc/xc_ptrace_core.c      Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_ptrace_core.c      Thu Jun 19 16:15:05 2008 +0100
@@ -641,24 +641,24 @@ static const struct xc_core_format_type*
 
 void *
 map_domain_va_core(unsigned long domfd, int cpu, void *guest_va,
-                   vcpu_guest_context_t *ctxt)
+                   vcpu_guest_context_any_t *ctxt)
 {
     if (current_format_type == NULL)
         return NULL;
     return (current_format_type->map_domain_va_core)(domfd, cpu, guest_va,
-                                                     ctxt);
+                                                     &ctxt->c);
 }
 
 int
 xc_waitdomain_core(int xc_handle, int domfd, int *status, int options,
-                   vcpu_guest_context_t *ctxt)
+                   vcpu_guest_context_any_t *ctxt)
 {
     int ret;
     int i;
 
     for (i = 0; i < NR_FORMAT_TYPE; i++) {
         ret = (format_type[i].waitdomain_core)(xc_handle, domfd, status,
-                                               options, ctxt);
+                                               options, &ctxt->c);
         if (ret == 0) {
             current_format_type = &format_type[i];
             break;
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xc_resume.c
--- a/tools/libxc/xc_resume.c   Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xc_resume.c   Thu Jun 19 16:15:05 2008 +0100
@@ -13,7 +13,7 @@
 
 static int modify_returncode(int xc_handle, uint32_t domid)
 {
-    vcpu_guest_context_either_t ctxt;
+    vcpu_guest_context_any_t ctxt;
     xc_dominfo_t info;
     xen_capabilities_info_t caps;
     int rc;
@@ -39,7 +39,7 @@ static int modify_returncode(int xc_hand
         return -1;
     }
 
-    if ( (rc = xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt.c)) != 0 )
+    if ( (rc = xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt)) != 0 )
         return rc;
 
     if ( !info.hvm )
@@ -49,7 +49,7 @@ static int modify_returncode(int xc_hand
     else
         ctxt.x32.user_regs.eax = 1;
 
-    if ( (rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt.c)) != 0 )
+    if ( (rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt)) != 0 )
         return rc;
 
     return 0;
@@ -89,7 +89,7 @@ static int xc_domain_resume_any(int xc_h
     int i, rc = -1;
 #if defined(__i386__) || defined(__x86_64__)
     unsigned long mfn, p2m_size = 0;
-    vcpu_guest_context_t ctxt;
+    vcpu_guest_context_any_t ctxt;
     start_info_t *start_info;
     shared_info_t *shinfo = NULL;
     xen_pfn_t *p2m_frame_list_list = NULL;
@@ -167,7 +167,7 @@ static int xc_domain_resume_any(int xc_h
         goto out;
     }
 
-    mfn = ctxt.user_regs.edx;
+    mfn = ctxt.c.user_regs.edx;
 
     start_info = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
                                       PROT_READ | PROT_WRITE, mfn);
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xenctrl.h     Thu Jun 19 16:15:05 2008 +0100
@@ -30,6 +30,11 @@
 #include <xen/xsm/acm.h>
 #include <xen/xsm/acm_ops.h>
 #include <xen/xsm/flask_op.h>
+
+#if defined(__i386__) || defined(__x86_64__)
+#include <xen/foreign/x86_32.h>
+#include <xen/foreign/x86_64.h>
+#endif
 
 #ifdef __ia64__
 #define XC_PAGE_SHIFT           14
@@ -162,6 +167,35 @@ typedef struct xc_dominfo {
 } xc_dominfo_t;
 
 typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
+
+typedef union 
+{
+#if defined(__i386__) || defined(__x86_64__)
+    vcpu_guest_context_x86_64_t x64;
+    vcpu_guest_context_x86_32_t x32;   
+#endif
+    vcpu_guest_context_t c;
+} vcpu_guest_context_any_t;
+
+typedef union
+{
+#if defined(__i386__) || defined(__x86_64__)
+    shared_info_x86_64_t x64;
+    shared_info_x86_32_t x32;
+#endif
+    shared_info_t s;
+} shared_info_any_t;
+
+typedef union
+{
+#if defined(__i386__) || defined(__x86_64__)
+    start_info_x86_64_t x64;
+    start_info_x86_32_t x32;
+#endif
+    start_info_t s;
+} start_info_any_t;
+
+
 int xc_domain_create(int xc_handle,
                      uint32_t ssidref,
                      xen_domain_handle_t handle,
@@ -307,7 +341,7 @@ int xc_vcpu_setcontext(int xc_handle,
 int xc_vcpu_setcontext(int xc_handle,
                        uint32_t domid,
                        uint32_t vcpu,
-                       vcpu_guest_context_t *ctxt);
+                       vcpu_guest_context_any_t *ctxt);
 /**
  * This function will return information about one or more domains, using a
  * single hypercall.  The domain information will be stored into the supplied
@@ -368,7 +402,7 @@ int xc_vcpu_getcontext(int xc_handle,
 int xc_vcpu_getcontext(int xc_handle,
                        uint32_t domid,
                        uint32_t vcpu,
-                       vcpu_guest_context_t *ctxt);
+                       vcpu_guest_context_any_t *ctxt);
 
 typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
 int xc_vcpu_getinfo(int xc_handle,
diff -r 3da148fb7d9b -r d3a87899985d tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h     Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/libxc/xg_save_restore.h     Thu Jun 19 16:15:05 2008 +0100
@@ -112,28 +112,6 @@ static inline int get_platform_info(int 
 #define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
 
 
-/* 32-on-64 support: saving 32bit guests from 64bit tools and vice versa */
-typedef union 
-{
-    vcpu_guest_context_x86_64_t x64;
-    vcpu_guest_context_x86_32_t x32;   
-    vcpu_guest_context_t c;
-} vcpu_guest_context_either_t;
-
-typedef union 
-{
-    shared_info_x86_64_t x64;
-    shared_info_x86_32_t x32;   
-    shared_info_t s;
-} shared_info_either_t;
-
-typedef union 
-{
-    start_info_x86_64_t x64;
-    start_info_x86_32_t x32;   
-    start_info_t s;
-} start_info_either_t;
-
 #define GET_FIELD(_p, _f) ((guest_width==8) ? ((_p)->x64._f) : ((_p)->x32._f))
 
 #define SET_FIELD(_p, _f, _v) do {              \
diff -r 3da148fb7d9b -r d3a87899985d tools/xentrace/xenctx.c
--- a/tools/xentrace/xenctx.c   Thu Jun 19 11:09:10 2008 +0100
+++ b/tools/xentrace/xenctx.c   Thu Jun 19 16:15:05 2008 +0100
@@ -22,6 +22,8 @@
 #include <string.h>
 #include <inttypes.h>
 #include <getopt.h>
+#include <xen/foreign/x86_64.h>
+#include <xen/foreign/x86_32.h>
 
 #include "xenctrl.h"
 
@@ -702,7 +704,7 @@ void dump_ctx(int vcpu)
 void dump_ctx(int vcpu)
 {
     int ret;
-    vcpu_guest_context_t ctx;
+    vcpu_guest_context_any_t ctx;
     xc_dominfo_t dominfo;
 
     xc_handle = xc_interface_open(); /* for accessing control interface */
@@ -727,10 +729,10 @@ void dump_ctx(int vcpu)
         exit(-1);
     }
 
-    print_ctx(&ctx);
+    print_ctx(&ctx.c);
 #ifndef NO_TRANSLATION
-    if (is_kernel_text(INSTR_POINTER((&ctx.user_regs))))
-        print_stack(&ctx, vcpu);
+    if (is_kernel_text(INSTR_POINTER((&ctx.c.user_regs))))
+        print_stack(&ctx.c, vcpu);
 #endif
 
     if (!dominfo.paused) {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: The following patch replace the libxc interface to use, Xen patchbot-unstable <=