From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH] xenalyze: add missing casts to fix 64bit build Date: Thu, 26 Jan 2012 12:27:35 +0000 Message-ID: <1327580855.24345.1.camel@elijah> References: <94f71dded5ab5a31224b.1326376371@probook.site> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-/91XICmGKy4o3Wk2rVkr" Return-path: In-Reply-To: <94f71dded5ab5a31224b.1326376371@probook.site> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Olaf Hering Cc: George Dunlap , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --=-/91XICmGKy4o3Wk2rVkr Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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 > # 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 > > 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; --=-/91XICmGKy4o3Wk2rVkr Content-Disposition: attachment; filename="pointer-casts-long.diff" Content-Type: text/x-patch; name="pointer-casts-long.diff"; charset="UTF-8" Content-Transfer-Encoding: 7bit >>From olaf@aepfle.de 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 To: "xen-devel@lists.xensource.com" CC: George Dunlap 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: <94f71dded5ab5a31224b.1326376371@probook.site> 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://georged@lonpmailmx01.citrite.net/ Content-Transfer-Encoding: 8bit # HG changeset patch # User Olaf Hering # 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. Reported-by: Olaf Hering Signed-off-by: George Dunlap diff -r 223e8ad4c755 xenalyze.c --- a/xenalyze.c Mon Nov 28 16:16:23 2011 +0000 +++ b/xenalyze.c Thu Jan 26 12:25:31 2012 +0000 @@ -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 *h void 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_da void 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_inf void 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_data void 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; } --=-/91XICmGKy4o3Wk2rVkr Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-/91XICmGKy4o3Wk2rVkr--