# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1326374876 -3600 # Node ID 94f71dded5ab5a31224b852aac6b238b590b7b25 # Parent 223e8ad4c7557960e29a7c294bb94723b2cd7f09 xenalyze: add missing casts to fix 64bit build xenalyze.c: In function ''hvm_mmio_summary'': xenalyze.c:3728: error: cast from pointer to integer of different size xenalyze.c: In function ''hvm_mmio_assist_postprocess'': xenalyze.c:3743: error: cast to pointer from integer of different size xenalyze.c:3747: error: cast to pointer from integer of different size xenalyze.c:3759: error: cast to pointer from integer of different size xenalyze.c: In function ''hvm_cr_write_summary'': xenalyze.c:4251: error: cast from pointer to integer of different size xenalyze.c: In function ''hvm_generic_summary'': xenalyze.c:4800: error: cast from pointer to integer of different size xenalyze.c: In function ''hvm_generic_postprocess'': xenalyze.c:4871: error: cast to pointer from integer of different size make: *** [xenalyze] Error 1 Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r 223e8ad4c755 -r 94f71dded5ab xenalyze.c --- a/xenalyze.c +++ b/xenalyze.c @@ -3725,7 +3725,7 @@ void enumerate_mmio(struct hvm_data *h) void hvm_mmio_summary(struct hvm_data *h, void *data) { - int reason=(int)data; + int reason=(long)data; PRINT_SUMMARY(h->summary.mmio[reason], " mmio "); @@ -3740,11 +3740,11 @@ void hvm_mmio_assist_postprocess(struct case VMEXIT_NPF: case EXIT_REASON_EPT_VIOLATION: reason=NONPF_MMIO_NPF; - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason); break; case EXIT_REASON_APIC_ACCESS: reason=NONPF_MMIO_APIC; - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason); break; default: { @@ -3756,7 +3756,7 @@ void hvm_mmio_assist_postprocess(struct warned=1; } reason=NONPF_MMIO_UNKNOWN; - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason); break; } } @@ -4248,7 +4248,7 @@ void hvm_cr3_write_summary(struct hvm_da void hvm_cr_write_summary(struct hvm_data *h, void *data) { - int cr=(int)data; + int cr=(long)data; PRINT_SUMMARY(h->summary.cr_write[cr], " cr%d ", cr); @@ -4797,7 +4797,7 @@ void hvm_rdtsc_process(struct record_inf void hvm_generic_summary(struct hvm_data *h, void *data) { - int evt = (int)data; + int evt = (long)data; assert(evt < HVM_EVENT_HANDLER_MAX); @@ -4868,7 +4868,7 @@ void hvm_generic_postprocess(struct hvm_ else { int ret; - if((ret=__hvm_set_summary_handler(h, hvm_generic_summary, (void *)evt))) + if((ret=__hvm_set_summary_handler(h, hvm_generic_summary, (void *)(long)evt))) fprintf(stderr, "%s: hvm_set_summary_handler returned %d\n", __func__, ret); registered[evt]=h->exit_reason+1;
Ian Jackson
2012-Jan-12 17:56 UTC
Re: [PATCH] xenalyze: add missing casts to fix 64bit build
Olaf Hering writes ("[Xen-devel] [PATCH] xenalyze: add missing casts to fix 64bit build"):> xenalyze: add missing casts to fix 64bit build > > xenalyze.c: In function ''hvm_mmio_summary'': > xenalyze.c:3728: error: cast from pointer to integer of different size...> - int reason=(int)data; > + int reason=(long)data;...> reason=NONPF_MMIO_NPF; > - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); > + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason);This is really quite ugly. But I''ll leave George to decide what should be done ... Ian.
George Dunlap
2012-Jan-26 12:27 UTC
Re: [PATCH] xenalyze: add missing casts to fix 64bit build
How about this patch instead? It makes the base variable "long", so that we don''t need the extra intermediate cast. -George On Thu, 2012-01-12 at 13:52 +0000, Olaf Hering wrote:> # HG changeset patch > # User Olaf Hering <olaf@aepfle.de> > # Date 1326374876 -3600 > # Node ID 94f71dded5ab5a31224b852aac6b238b590b7b25 > # Parent 223e8ad4c7557960e29a7c294bb94723b2cd7f09 > xenalyze: add missing casts to fix 64bit build > > xenalyze.c: In function ''hvm_mmio_summary'': > xenalyze.c:3728: error: cast from pointer to integer of different size > xenalyze.c: In function ''hvm_mmio_assist_postprocess'': > xenalyze.c:3743: error: cast to pointer from integer of different size > xenalyze.c:3747: error: cast to pointer from integer of different size > xenalyze.c:3759: error: cast to pointer from integer of different size > xenalyze.c: In function ''hvm_cr_write_summary'': > xenalyze.c:4251: error: cast from pointer to integer of different size > xenalyze.c: In function ''hvm_generic_summary'': > xenalyze.c:4800: error: cast from pointer to integer of different size > xenalyze.c: In function ''hvm_generic_postprocess'': > xenalyze.c:4871: error: cast to pointer from integer of different size > make: *** [xenalyze] Error 1 > > Signed-off-by: Olaf Hering <olaf@aepfle.de> > > diff -r 223e8ad4c755 -r 94f71dded5ab xenalyze.c > --- a/xenalyze.c > +++ b/xenalyze.c > @@ -3725,7 +3725,7 @@ void enumerate_mmio(struct hvm_data *h) > > void hvm_mmio_summary(struct hvm_data *h, void *data) > { > - int reason=(int)data; > + int reason=(long)data; > > PRINT_SUMMARY(h->summary.mmio[reason], > " mmio "); > @@ -3740,11 +3740,11 @@ void hvm_mmio_assist_postprocess(struct > case VMEXIT_NPF: > case EXIT_REASON_EPT_VIOLATION: > reason=NONPF_MMIO_NPF; > - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); > + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason); > break; > case EXIT_REASON_APIC_ACCESS: > reason=NONPF_MMIO_APIC; > - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); > + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason); > break; > default: > { > @@ -3756,7 +3756,7 @@ void hvm_mmio_assist_postprocess(struct > warned=1; > } > reason=NONPF_MMIO_UNKNOWN; > - hvm_set_summary_handler(h, hvm_mmio_summary, (void *)reason); > + hvm_set_summary_handler(h, hvm_mmio_summary, (void *)(long)reason); > break; > } > } > @@ -4248,7 +4248,7 @@ void hvm_cr3_write_summary(struct hvm_da > > void hvm_cr_write_summary(struct hvm_data *h, void *data) > { > - int cr=(int)data; > + int cr=(long)data; > > PRINT_SUMMARY(h->summary.cr_write[cr], > " cr%d ", cr); > @@ -4797,7 +4797,7 @@ void hvm_rdtsc_process(struct record_inf > > void hvm_generic_summary(struct hvm_data *h, void *data) > { > - int evt = (int)data; > + int evt = (long)data; > > assert(evt < HVM_EVENT_HANDLER_MAX); > > @@ -4868,7 +4868,7 @@ void hvm_generic_postprocess(struct hvm_ > else > { > int ret; > - if((ret=__hvm_set_summary_handler(h, hvm_generic_summary, (void *)evt))) > + if((ret=__hvm_set_summary_handler(h, hvm_generic_summary, (void *)(long)evt))) > fprintf(stderr, "%s: hvm_set_summary_handler returned %d\n", > __func__, ret); > registered[evt]=h->exit_reason+1;_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2012-Jan-26 16:43 UTC
Re: [PATCH] xenalyze: add missing casts to fix 64bit build
On Thu, Jan 26, George Dunlap wrote:> How about this patch instead? It makes the base variable "long", so > that we don''t need the extra intermediate cast.Compiles ok for me. Thanks. Olaf
George Dunlap
2012-Jan-26 16:45 UTC
Re: [PATCH] xenalyze: add missing casts to fix 64bit build
OK, I''ve applied it. -George On Thu, 2012-01-26 at 16:43 +0000, Olaf Hering wrote:> On Thu, Jan 26, George Dunlap wrote: > > > How about this patch instead? It makes the base variable "long", so > > that we don''t need the extra intermediate cast. > > Compiles ok for me. > > Thanks. > > Olaf