]> xenbits.xensource.com Git - xenalyze.git/commitdiff
Handle TRC_64_FLAG for more HVM records
authorGeorge Dunlap <gdunlap@gdunlap-desktop.(none)>
Fri, 12 Sep 2008 13:58:40 +0000 (14:58 +0100)
committerGeorge Dunlap <gdunlap@gdunlap-desktop.(none)>
Fri, 12 Sep 2008 13:58:40 +0000 (14:58 +0100)
analyze.c

index 4a1a25e10d22a8280b45a55ec4ee6dd73383d855..ce12526ded014e77824a134a9ebd7fc874eb3020 100644 (file)
--- a/analyze.c
+++ b/analyze.c
@@ -3729,31 +3729,43 @@ void hvm_cr_write_postprocess(struct hvm_data *h)
 
 }
 
-void hvm_cr_write_process(struct hvm_data *h)
+void hvm_cr_write_process(struct record_info *ri, struct hvm_data *h)
 {
     struct {
-        /* FIXME -- 64-bit values */
-        unsigned cr;
-        unsigned val;
+        struct {
+            unsigned cr;
+            unsigned long val;
+        } x32;
+        struct {
+            unsigned cr;
+            unsigned long val;
+        } x64;
     } *r = (typeof(r))h->d;
+    unsigned cr;
+    unsigned long long val;
 
-    h->inflight.cr_write.cr = r->cr;
-    h->inflight.cr_write.val = r->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;
+    }
 
     h->post_process = hvm_cr_write_postprocess;
 
     if(opt.dump_all)
     {
-        if(r->cr == 3 && h->v->cr3.val) {
+        if(cr == 3 && h->v->cr3.val) {
             printf("]%s cr_write cr3 val %llx oval %llx %s\n",
                    h->dump_header, 
-                   (unsigned long long)r->val,
+                   val,
                    h->v->cr3.val,
-                   (h->v->cr3.val == r->val)?"flush":"switch");
+                   (h->v->cr3.val == val)?"flush":"switch");
         } else {
             printf(" %s cr_write cr%d val %llx\n",
                    h->dump_header, 
-                   r->cr, (unsigned long long)r->val);
+                   cr, val);
 
         }
     }
@@ -4050,7 +4062,14 @@ void hvm_generic_dump(struct record_info *ri, char * prefix)
 
     char *evt_string, evt_number[256];
     unsigned *d;
-    int i, evt = ri->event - TRC_HVM_HANDLER;
+    int i, evt, is_64 = 0;
+
+    evt = ri->event - TRC_HVM_HANDLER;
+
+    if(evt & TRC_64_FLAG) {
+        evt &= ~(TRC_64_FLAG);
+        is_64=1;
+    }
 
     if(evt < HVM_EVENT_HANDLER_MAX)
     {
@@ -4063,10 +4082,11 @@ void hvm_generic_dump(struct record_info *ri, char * prefix)
     }
 
     d = ri->d;
-    printf("%s%s %s [",
+    printf("%s%s %s%s [",
            prefix,
            ri->dump_header,
-           evt_string);
+           evt_string,
+           is_64?"64":"");
         
     for(i=0; i<4; i++) 
     {
@@ -4164,7 +4184,8 @@ needs_vmexit:
         hvm_mmio_assist_process(ri, h);
         break;
     case TRC_HVM_CR_WRITE:
-        hvm_cr_write_process(h);
+    case TRC_HVM_CR_WRITE64:
+        hvm_cr_write_process(ri, h);
         break;
     case TRC_HVM_MSR_WRITE:
       hvm_msr_write_process(ri, h);
@@ -4176,6 +4197,7 @@ needs_vmexit:
         hvm_vmcall_process(ri, h);
         break;
     case TRC_HVM_CR_READ:
+    case TRC_HVM_CR_READ64:
     case TRC_HVM_DR_READ:
     case TRC_HVM_DR_WRITE:
     case TRC_HVM_CPUID:
@@ -4183,9 +4205,11 @@ needs_vmexit:
     case TRC_HVM_SMI:
     case TRC_HVM_HLT:
     case TRC_HVM_INVLPG:
+    case TRC_HVM_INVLPG64:
     case TRC_HVM_MCE:
     case TRC_HVM_CLTS:
     case TRC_HVM_LMSW:
+    case TRC_HVM_LMSW64:
         if ( h->post_process != NULL )
             fprintf(warn, "Strange, h->postprocess already set!\n");
         h->inflight.generic.event = ri->event;