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] [HVM] Builder must know which kind of vcp

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM] Builder must know which kind of vcpu context struct to use
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Mar 2007 08:10:15 -0800
Delivery-date: Thu, 01 Mar 2007 08:10:04 -0800
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 Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1172747063 0
# Node ID 1966270d89d73cd44c1996c91c4c698c4004a730
# Parent  b703aa29424f07fb0800753af5fc9c0347fd7613
[HVM] Builder must know which kind of vcpu context struct to use
when the tools are being run in a compat-mode domain
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 tools/libxc/xc_hvm_build.c |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff -r b703aa29424f -r 1966270d89d7 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Thu Mar 01 09:52:40 2007 +0000
+++ b/tools/libxc/xc_hvm_build.c        Thu Mar 01 11:04:23 2007 +0000
@@ -11,6 +11,8 @@
 #include "xg_private.h"
 #include "xc_private.h"
 
+#include <xen/foreign/x86_32.h>
+#include <xen/foreign/x86_64.h>
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/params.h>
 #include <xen/hvm/e820.h>
@@ -18,6 +20,15 @@
 #include <xen/libelf.h>
 
 #define SCRATCH_PFN 0xFFFFF
+
+/* Need to provide the right flavour of vcpu context for Xen */
+typedef union
+{
+    vcpu_guest_context_x86_64_t c64;
+    vcpu_guest_context_x86_32_t c32;   
+    vcpu_guest_context_t c;
+} vcpu_guest_context_either_t;
+
 
 int xc_set_hvm_param(
     int handle, domid_t dom, int param, unsigned long value)
@@ -182,7 +193,7 @@ static int setup_guest(int xc_handle,
 static int setup_guest(int xc_handle,
                        uint32_t dom, int memsize,
                        char *image, unsigned long image_size,
-                       vcpu_guest_context_t *ctxt)
+                       vcpu_guest_context_either_t *ctxt)
 {
     xen_pfn_t *page_array = NULL;
     unsigned long i, nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
@@ -193,12 +204,19 @@ static int setup_guest(int xc_handle,
     struct elf_binary elf;
     uint64_t v_start, v_end;
     int rc;
+    xen_capabilities_info_t caps;
 
     if (0 != elf_init(&elf, image, image_size))
         goto error_out;
     elf_parse_binary(&elf);
     v_start = 0;
     v_end = (unsigned long long)memsize << 20;
+
+    if (xc_version(xc_handle, XENVER_capabilities, &caps) != 0)
+    {
+        PERROR("Could not get Xen capabilities\n");
+        goto error_out;
+    }
 
     if ( (elf.pstart & (PAGE_SIZE - 1)) != 0 )
     {
@@ -282,7 +300,11 @@ static int setup_guest(int xc_handle,
 
     free(page_array);
 
-    ctxt->user_regs.eip = elf_uval(&elf, elf.ehdr, e_entry);
+    /* Set [er]ip in the way that's right for Xen */
+    if ( strstr(caps, "x86_64") )
+        ctxt->c64.user_regs.rip = elf_uval(&elf, elf.ehdr, e_entry); 
+    else
+        ctxt->c32.user_regs.eip = elf_uval(&elf, elf.ehdr, e_entry);
 
     return 0;
 
@@ -298,7 +320,7 @@ static int xc_hvm_build_internal(int xc_
                                  unsigned long image_size)
 {
     struct xen_domctl launch_domctl;
-    vcpu_guest_context_t ctxt;
+    vcpu_guest_context_either_t ctxt;
     int rc;
 
     if ( (image == NULL) || (image_size == 0) )
@@ -323,7 +345,7 @@ static int xc_hvm_build_internal(int xc_
     memset(&launch_domctl, 0, sizeof(launch_domctl));
     launch_domctl.domain = (domid_t)domid;
     launch_domctl.u.vcpucontext.vcpu   = 0;
-    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, &ctxt);
+    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, &ctxt.c);
     launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
     rc = xc_domctl(xc_handle, &launch_domctl);
 

_______________________________________________
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] [HVM] Builder must know which kind of vcpu context struct to use, Xen patchbot-unstable <=