From: George Dunlap Date: Tue, 16 Sep 2008 11:49:31 +0000 (+0100) Subject: Fix handling of CR_WRITE64 and PF_INJECT64 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7a8548ef45c6ac98b5dc57d6694bc5efd2e9d670;p=xenalyze.git Fix handling of CR_WRITE64 and PF_INJECT64 --- diff --git a/analyze.c b/analyze.c index ea39ead..ca2074a 100644 --- 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: