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] Save/restore cleanups 05: save-form

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM] Save/restore cleanups 05: save-format headers
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 20 Jan 2007 09:10:17 -0800
Delivery-date: Sat, 20 Jan 2007 09:10:36 -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 1169291862 0
# Node ID ff4f4596cb29da5f4d672e9a99fe45603282263e
# Parent  1fd5f1754ceacdd0a1468535ac53144317e9be6f
[HVM] Save/restore cleanups 05: save-format headers
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/intercept.c  |   47 ++++++++++++++++++++----------------------
 xen/include/public/hvm/save.h |   15 ++++++++++++-
 2 files changed, 37 insertions(+), 25 deletions(-)

diff -r 1fd5f1754cea -r ff4f4596cb29 xen/arch/x86/hvm/intercept.c
--- a/xen/arch/x86/hvm/intercept.c      Sat Jan 20 11:17:41 2007 +0000
+++ b/xen/arch/x86/hvm/intercept.c      Sat Jan 20 11:17:42 2007 +0000
@@ -157,9 +157,6 @@ static inline void hvm_mmio_access(struc
     }
 }
 
-/* save/restore support */
-#define HVM_FILE_MAGIC   0x54381286
-#define HVM_FILE_VERSION 0x00000001
 
 int hvm_register_savevm(struct domain *d,
                     const char *idstr,
@@ -199,6 +196,7 @@ int hvm_save(struct vcpu *v, hvm_domain_
     uint32_t eax, ebx, ecx, edx;
     HVMStateEntry *se;
     char *chgset;
+    struct hvm_save_header hdr;
 
     if (!is_hvm_vcpu(v)) {
         printk("hvm_save only for hvm guest!\n");
@@ -206,8 +204,12 @@ int hvm_save(struct vcpu *v, hvm_domain_
     }
 
     memset(h, 0, sizeof(hvm_domain_context_t));
-    hvm_put_32u(h, HVM_FILE_MAGIC);
-    hvm_put_32u(h, HVM_FILE_VERSION);
+
+    hdr.magic = HVM_FILE_MAGIC;
+    hdr.version = HVM_FILE_VERSION;
+    cpuid(1, &eax, &ebx, &ecx, &edx);
+    hdr.cpuid = eax;
+    hvm_put_struct(h, &hdr);
 
     /* save xen changeset */
     chgset = strrchr(XEN_CHANGESET, ' ');
@@ -220,10 +222,6 @@ int hvm_save(struct vcpu *v, hvm_domain_
     hvm_put_8u(h, len);
     hvm_put_buffer(h, chgset, len);
 
-    /* save cpuid */
-    cpuid(1, &eax, &ebx, &ecx, &edx);
-    hvm_put_32u(h, eax);
-
     for(se = v->domain->arch.hvm_domain.first_se; se != NULL; se = se->next) {
         /* ID string */
         len = strnlen(se->idstr, HVM_SE_IDSTR_LEN);
@@ -274,13 +272,14 @@ static HVMStateEntry *find_se(struct dom
 
 int hvm_load(struct vcpu *v, hvm_domain_context_t *h)
 {
-    uint32_t len, rec_len, rec_pos, magic, instance_id, version_id;
+    uint32_t len, rec_len, rec_pos, instance_id, version_id;
     uint32_t eax, ebx, ecx, edx;
     HVMStateEntry *se;
     char idstr[HVM_SE_IDSTR_LEN];
     xen_changeset_info_t chgset;
     char *cur_chgset;
     int ret;
+    struct hvm_save_header hdr;
 
     if (!is_hvm_vcpu(v)) {
         printk("hvm_load only for hvm guest!\n");
@@ -294,17 +293,27 @@ int hvm_load(struct vcpu *v, hvm_domain_
 
     hvm_ctxt_seek(h, 0);
 
-    magic = hvm_get_32u(h);
-    if (magic != HVM_FILE_MAGIC) {
+    hvm_get_struct(h, &hdr);
+
+    if (hdr.magic != HVM_FILE_MAGIC) {
         printk("HVM restore magic dismatch!\n");
         return -1;
     }
 
-    magic = hvm_get_32u(h);
-    if (magic != HVM_FILE_VERSION) {
+    if (hdr.version != HVM_FILE_VERSION) {
         printk("HVM restore version dismatch!\n");
         return -1;
     }
+
+    /* check cpuid */
+    cpuid(1, &eax, &ebx, &ecx, &edx);
+    /*TODO: need difine how big difference is acceptable */
+    if (hdr.cpuid != eax)
+        printk("warnings: try to restore hvm guest(0x%"PRIx32") "
+               "on a different type processor(0x%"PRIx32").\n",
+                hdr.cpuid,
+                eax);
+
 
     /* check xen change set */
     cur_chgset = strrchr(XEN_CHANGESET, ' ');
@@ -329,16 +338,6 @@ int hvm_load(struct vcpu *v, hvm_domain_
     if ( !strcmp(cur_chgset, "unavailable") )
         printk("warnings: try to restore hvm guest when changeset is 
unavailable.\n");
 
-
-    /* check cpuid */
-    cpuid(1, &eax, &ebx, &ecx, &edx);
-    ebx = hvm_get_32u(h);
-    /*TODO: need difine how big difference is acceptable */
-    if (ebx != eax)
-        printk("warnings: try to restore hvm guest(0x%"PRIx32") "
-               "on a different type processor(0x%"PRIx32").\n",
-                ebx,
-                eax);
 
     while(1) {
         if (hvm_ctxt_end(h)) {
diff -r 1fd5f1754cea -r ff4f4596cb29 xen/include/public/hvm/save.h
--- a/xen/include/public/hvm/save.h     Sat Jan 20 11:17:41 2007 +0000
+++ b/xen/include/public/hvm/save.h     Sat Jan 20 11:17:42 2007 +0000
@@ -39,7 +39,20 @@
  * Internal mechanisms should be kept in Xen-private headers.
  */
 
-
+/* 
+ * Save/restore header
+ */
+
+#define HVM_SAVE_TYPE_HEADER 0
+
+#define HVM_FILE_MAGIC   0x54381286
+#define HVM_FILE_VERSION 0x00000001
+
+struct hvm_save_header {
+    uint32_t magic;
+    uint32_t version;
+    uint32_t cpuid;
+};
 
 /*
  * Processor

_______________________________________________
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] Save/restore cleanups 05: save-format headers, Xen patchbot-unstable <=