xenalyze: add missing casts to fix 64bit build
PATCH 1/1 xenalyze: add missing casts to fix 64bit build
# HG changeset patch
# User Olaf Hering <[email protected]>
# 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
xenalyze.c +7 -7
@@ -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(structcase 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_davoid 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_infvoid 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 ;
Olaf Hering writes ("[Xen-devel] [PATCH] xenalyze: add missing casts to fix 64bit build"):
Quoted 4 lines
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
...
Quoted 2 lines
xenalyze.c +1
-1-int reason=(int )data; +int reason=(long )data;
...
Review
Quoted 3 lines
reason=NONPF_MMIO_NPF;(quoted diff) +1
-1- 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.
How about this patch instead? It makes the base variable "long", so that we don't need the extra intermediate cast.
-George
Quoted 86 lines · Olaf Hering
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1326374876 -3600
# Node ID94f71dded5ab5a31224b852aac6b238b590b7b25# Parent223e8ad4c7557960e29a7c294bb94723b2cd7f09
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 sizexenalyze.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 sizexenalyze.c: In function 'hvm_cr_write_summary':
xenalyze.c:4251: error: cast from pointer to integer of different sizexenalyze.c: In function 'hvm_generic_summary':
xenalyze.c:4800: error: cast from pointer to integer of different sizexenalyze.c: In function 'hvm_generic_postprocess':
xenalyze.c:4871: error: cast to pointer from integer of different size
make: *** [xenalyze] Error 1Signed-off-by Olaf Hering <[email protected]>diff -r
223e8ad4c755-r94f71dded5abxenalyze.cxenalyze.c +7
-7@@ -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(structcase 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_davoid 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_infvoid 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 ;
Quoted 1 line
From [email protected] Thu Jan 12 13:53:15 2012
Received: from SMTP.EU.CITRIX.COM (10.31.1.27) by LONPMAILMX02.citrite.net
(10.30.203.163) with Microsoft SMTP Server id 8.3.213.0; Thu, 12 Jan 2012 13:53:15 +0000
Received: from mo-p00-ob.rzone.de ([81.169.146.161]) by SMTP.EU.CITRIX.COM
with ESMTP/TLS/EDH-RSA-DES-CBC3-SHA; 12 Jan 2012 13:53:15 +0000
Received: from probook.site (dslb-088-065-110-122.pools.arcor-ip.net
[88.65.110.122]) by smtp.strato.de (fruni mo6) (RZmta 27.3 DYNA|AUTH) with
(EDH-RSA-DES-CBC3-SHA encrypted) ESMTPA id z02699o0CDYeUs ; Thu, 12 Jan
2012 14:52:52 +0100 (MET)
Received: from probook.site (localhost [IPv6:::1]) by probook.site
(Postfix) with ESMTP id CB15318634; Thu, 12 Jan 2012 14:52:51 +0100 (CET)
From: Olaf Hering <[email protected]>
To: "[email protected]" <[email protected]>
CC: George Dunlap <[email protected]>
Date: Thu, 12 Jan 2012 13:52:51 +0000
Subject: [PATCH] xenalyze: add missing casts to fix 64bit build
Thread-Topic: [PATCH] xenalyze: add missing casts to fix 64bit build
Thread-Index: AczRMYilUkKqxSPMTEShuD89quR++A==
Message-ID: <[email protected]>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: LONPMAILMX02.citrite.net X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-sbrs: 4.1
x-mesageid: 9971216
x-ironport-server: LONPIP01.CITRITE.NET
x-remote-ip: 81.169.146.161
x-policy: $ACCEPTED
x-ironport-anti-spam-filtered: true
x-ironport-anti-spam-result:
Av4BAC/lDk9RqZKhjWdsb2JhbABDrQkiAQEBAQkJCwkSBSKCIBMGOQE7FR8uM4d8pTeSBweJAYMcmlCMfw
x-ironport-av: E=Sophos;i="4.71,498,1320624000"; d="scan'208";a="9971216"
dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1326376394; l=2969;
s=domk; d=aepfle.de; h=Cc:To:From:Date:Subject:Content-Transfer-Encoding:MIME-Version:
Content-Type:X-RZG-CLASS-ID:X-RZG-AUTH; bh=X6Rg3zN9hR3a7o+4QJ3b3HFlrL4=;
b=RcH7lQSvp2kGDWRXGFz1E40PbfO1PoHdjMME7T8HAdtB1mqhT6K6IWFhRHH+Hf4OGtU xcWSK9jxQs13YdFzUOVXZhXnodRlFPorCXKzZ2Hikbs9qrZR7F0qT2V1XFzHzdEPRK1kR Tt2x7tJWIqguMAx/Jx/Ve4IOxfrAeOmyBIk=
user-agent: Mercurial-patchbomb/1.7.5
x-rzg-class-id: mo00
x-rzg-auth: :P2EQZWCpfu+qG7CngxMFH1J+zrwiavkK6tmQaLfmztM8TOFPjzMQEiX0jA==
x-mercurial-node: 94f71dded5ab5a31224b852aac6b238b590b7b25
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
X-Evolution-Source: imap://[email protected]/
Content-Transfer-Encoding: 8bit
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1326374876 -3600
# Node ID 94f71dded5ab5a31224b852aac6b238b590b7b25 # Parent 223e8ad4c7557960e29a7c294bb94723b2cd7f09
xenalyze: Use long to cast into and out of pointers
64-bit compileers will complain when casting into our out of a pointer if the integer is not of the same size; so make all things which are cast into or out of pointers "long", which translates to 32-bit on 32-bit systems and 64-bit on 64-bit systems.
xenalyze.c +7 -7
@@ -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; +long reason=(long )data;PRINT_SUMMARY (h->summary.mmio[reason]," mmio " );
@@ -3733,7 +3733,7 @@ void hvm_mmio_summary(struct hvm_data *hvoid hvm_mmio_assist_postprocess (struct hvm_data *h) { -int reason; +long reason;switch (h->exit_reason) {
@@ -4248,10 +4248,10 @@ void hvm_cr3_write_summary(struct hvm_davoid hvm_cr_write_summary (struct hvm_data *h,void *data) { -int cr=(int )data; +long cr=(long )data;PRINT_SUMMARY (h->summary.cr_write[cr], -" cr%d " , cr); +" cr%ld " , cr);if ( cr==3 )hvm_cr3_write_summary (h); }
@@ -4797,7 +4797,7 @@ void hvm_rdtsc_process(struct record_infvoid hvm_generic_summary (struct hvm_data *h,void *data) { -int evt = (int )data; +long evt = (long )data;assert (evt <HVM_EVENT_HANDLER_MAX );
@@ -4808,7 +4808,7 @@ void hvm_generic_summary(struct hvm_datavoid hvm_generic_postprocess (struct hvm_data *h) { -int evt =0 ; +long evt =0 ;static unsigned registered[HVM_EVENT_HANDLER_MAX ] = {0 };if ( h->inflight.generic.event )
@@ -4860,7 +4860,7 @@ void hvm_generic_postprocess(struct hvm_static unsigned warned[HVM_EXIT_REASON_MAX ] = {0 };if ( registered[evt] != h->exit_reason+1 && !warned[h->exit_reason]) { -fprintf (warn,"%s: HVM evt %x in %x and %x!\n" , +fprintf (warn,"%s: HVM evt %lx in %x and %x!\n" , __func__, evt, registered[evt]-1 , h->exit_reason); warned[h->exit_reason]=1 ; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · George Dunlap
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
OK, I've applied it.
-George
Quoted 10 lines · Olaf Hering
Quoted 2 lines · George Dunlap
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