]> xenbits.xensource.com Git - xenalyze.git/commitdiff
Fix handling of CR_WRITE64 and PF_INJECT64
authorGeorge Dunlap <gdunlap@gdunlap-desktop.(none)>
Tue, 16 Sep 2008 11:49:31 +0000 (12:49 +0100)
committerGeorge Dunlap <gdunlap@gdunlap-desktop.(none)>
Tue, 16 Sep 2008 11:49:31 +0000 (12:49 +0100)
analyze.c

index ea39eade2351b3e53aa22866c6276e81ca21aea6..ca2074a6aa11648ecd78631de479546c4cab1279 100644 (file)
--- a/analyze.c
+++ b/analyze.c
@@ -3731,25 +3731,25 @@ void hvm_cr_write_postprocess(struct hvm_data *h)
 
 void hvm_cr_write_process(struct record_info *ri, struct hvm_data *h)
 {
-    struct {
+    union {
         struct {
             unsigned cr;
             unsigned long val;
         } x32;
         struct {
             unsigned cr;
-            unsigned long val;
+            unsigned long long val;
         } x64;
     } *r = (typeof(r))h->d;
     unsigned cr;
     unsigned long long val;
 
     if(ri->event & TRC_64_FLAG) {
-        h->inflight.cr_write.cr = cr = r->x32.cr;
-        h->inflight.cr_write.val = val = r->x32.val;
-    } else {
         h->inflight.cr_write.cr = cr = r->x64.cr;
         h->inflight.cr_write.val = val = r->x64.val;
+    } else {
+        h->inflight.cr_write.cr = cr = r->x32.cr;
+        h->inflight.cr_write.val = val = r->x32.val;
     }
 
     h->post_process = hvm_cr_write_postprocess;
@@ -3995,15 +3995,35 @@ void hvm_intr_process(struct hvm_data *h)
 
 void hvm_pf_inject_process(struct record_info *ri, struct hvm_data *h)
 {
-    struct {
-        unsigned cr2, ec;
+    union {
+        struct {
+            unsigned ec;
+            unsigned long cr2;
+        } x32;
+        struct {
+            unsigned ec;
+            unsigned long long cr2;
+        } x64;
     } *r = (typeof(r))h->d;
+    unsigned long ec;
+    unsigned long long cr2;
+    int is_64 = 0;
+
+    if(ri->event & TRC_64_FLAG) {
+        is_64 = 1;
+        cr2 = r->x64.cr2;
+        ec = r->x64.ec;
+    } else {
+        cr2 = r->x32.cr2;
+        ec = r->x32.ec;
+    }
 
     if ( opt.dump_cooked || opt.dump_all )
     {
-            printf(" %3lu.%09lu %s pf_inject guest_cr2 %x  guest_ec %x\n",
+            printf(" %3lu.%09lu %s pf_inject%s guest_cr2 %llx  guest_ec %lx\n",
                    ri->t.s, ri->t.ns, pcpu_string(ri->cpu),
-                   r->cr2, r->ec);
+                   is_64?"64":"",
+                   cr2, ec);
     }
 }
 
@@ -4113,6 +4133,7 @@ void hvm_handler_process(struct record_info *ri, struct hvm_data *h) {
         goto needs_vmexit;
         /* Records about changing guest state */
     case TRC_HVM_PF_INJECT:
+    case TRC_HVM_PF_INJECT64:
         hvm_pf_inject_process(ri, h);
         break;
     case TRC_HVM_REINJ_VIRQ: