xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xenalyze: add missing casts to fix 64bit build
@ 2012-01-12 13:52 Olaf Hering
  2012-01-12 17:56 ` Ian Jackson
  2012-01-26 12:27 ` George Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Olaf Hering @ 2012-01-12 13:52 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap

# 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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xenalyze: add missing casts to fix 64bit build
  2012-01-12 13:52 [PATCH] xenalyze: add missing casts to fix 64bit build Olaf Hering
@ 2012-01-12 17:56 ` Ian Jackson
  2012-01-26 12:27 ` George Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2012-01-12 17:56 UTC (permalink / raw)
  To: Olaf Hering; +Cc: George Dunlap, xen-devel

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xenalyze: add missing casts to fix 64bit build
  2012-01-12 13:52 [PATCH] xenalyze: add missing casts to fix 64bit build Olaf Hering
  2012-01-12 17:56 ` Ian Jackson
@ 2012-01-26 12:27 ` George Dunlap
  2012-01-26 16:43   ` Olaf Hering
  1 sibling, 1 reply; 5+ messages in thread
From: George Dunlap @ 2012-01-26 12:27 UTC (permalink / raw)
  To: Olaf Hering; +Cc: George Dunlap, xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 3557 bytes --]

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;


[-- Attachment #2: pointer-casts-long.diff --]
[-- Type: text/x-patch, Size: 4980 bytes --]

>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 <olaf@aepfle.de>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
CC: George Dunlap <George.Dunlap@eu.citrix.com>
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 <olaf@aepfle.de>
# 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 <olaf@aepfle.de>
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

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;
             }

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xenalyze: add missing casts to fix 64bit build
  2012-01-26 12:27 ` George Dunlap
@ 2012-01-26 16:43   ` Olaf Hering
  2012-01-26 16:45     ` George Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2012-01-26 16:43 UTC (permalink / raw)
  To: George Dunlap; +Cc: George Dunlap, xen-devel@lists.xensource.com

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xenalyze: add missing casts to fix 64bit build
  2012-01-26 16:43   ` Olaf Hering
@ 2012-01-26 16:45     ` George Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: George Dunlap @ 2012-01-26 16:45 UTC (permalink / raw)
  To: Olaf Hering; +Cc: George Dunlap, xen-devel@lists.xensource.com

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-26 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-12 13:52 [PATCH] xenalyze: add missing casts to fix 64bit build Olaf Hering
2012-01-12 17:56 ` Ian Jackson
2012-01-26 12:27 ` George Dunlap
2012-01-26 16:43   ` Olaf Hering
2012-01-26 16:45     ` George Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).