qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [4844] Avoid compiler warning.
@ 2008-07-03 21:36 Thiemo Seufer
  2008-07-04  6:05 ` [Qemu-devel] " Jan Kiszka
  2008-07-04  7:29 ` [Qemu-devel] " Laurent Desnogues
  0 siblings, 2 replies; 3+ messages in thread
From: Thiemo Seufer @ 2008-07-03 21:36 UTC (permalink / raw)
  To: qemu-devel

Revision: 4844
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4844
Author:   ths
Date:     2008-07-03 21:36:35 +0000 (Thu, 03 Jul 2008)

Log Message:
-----------
Avoid compiler warning.

Modified Paths:
--------------
    trunk/cpu-all.h

Modified: trunk/cpu-all.h
===================================================================
--- trunk/cpu-all.h	2008-07-03 19:55:47 UTC (rev 4843)
+++ trunk/cpu-all.h	2008-07-03 21:36:35 UTC (rev 4844)
@@ -667,7 +667,7 @@
 
 /* All direct uses of g2h and h2g need to go away for usermode softmmu.  */
 #define g2h(x) ((void *)((unsigned long)(x) + GUEST_BASE))
-#define h2g(x) ((target_ulong)(x - GUEST_BASE))
+#define h2g(x) ((target_ulong)((unsigned long)(x) - GUEST_BASE))
 
 #define saddr(x) g2h(x)
 #define laddr(x) g2h(x)

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

* [Qemu-devel] Re: [4844] Avoid compiler warning.
  2008-07-03 21:36 [Qemu-devel] [4844] Avoid compiler warning Thiemo Seufer
@ 2008-07-04  6:05 ` Jan Kiszka
  2008-07-04  7:29 ` [Qemu-devel] " Laurent Desnogues
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2008-07-04  6:05 UTC (permalink / raw)
  To: qemu-devel

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

Thiemo Seufer wrote:
> Revision: 4844
>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4844
> Author:   ths
> Date:     2008-07-03 21:36:35 +0000 (Thu, 03 Jul 2008)
> 
> Log Message:
> -----------
> Avoid compiler warning.
> 
> Modified Paths:
> --------------
>     trunk/cpu-all.h
> 
> Modified: trunk/cpu-all.h
> ===================================================================
> --- trunk/cpu-all.h	2008-07-03 19:55:47 UTC (rev 4843)
> +++ trunk/cpu-all.h	2008-07-03 21:36:35 UTC (rev 4844)
> @@ -667,7 +667,7 @@
>  
>  /* All direct uses of g2h and h2g need to go away for usermode softmmu.  */
>  #define g2h(x) ((void *)((unsigned long)(x) + GUEST_BASE))
> -#define h2g(x) ((target_ulong)(x - GUEST_BASE))
> +#define h2g(x) ((target_ulong)((unsigned long)(x) - GUEST_BASE))

Just to keep heads up: While this is OK in itself, the potential bug it
pointed out is still open, see

http://permalink.gmane.org/gmane.comp.emulators.qemu/26687

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* Re: [Qemu-devel] [4844] Avoid compiler warning.
  2008-07-03 21:36 [Qemu-devel] [4844] Avoid compiler warning Thiemo Seufer
  2008-07-04  6:05 ` [Qemu-devel] " Jan Kiszka
@ 2008-07-04  7:29 ` Laurent Desnogues
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Desnogues @ 2008-07-04  7:29 UTC (permalink / raw)
  To: qemu-devel

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

On Thu, Jul 3, 2008 at 11:36 PM, Thiemo Seufer <ths@networkno.de> wrote:
> Revision: 4844
[...]
> -#define h2g(x) ((target_ulong)(x - GUEST_BASE))
> +#define h2g(x) ((target_ulong)((unsigned long)(x) - GUEST_BASE))

What about getting rid of explicit casts when using h2g?


Laurent

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: h2g.patch --]
[-- Type: text/x-patch; name=h2g.patch, Size: 1370 bytes --]

Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c	(revision 4845)
+++ linux-user/syscall.c	(working copy)
@@ -2018,7 +2018,7 @@
                 ret = get_errno((long)host_addr);
                 break;
             }
-            raddr = h2g((unsigned long)host_addr);
+            raddr = h2g(host_addr);
             /* find out the length of the shared memory segment */
             
             ret = get_errno(shmctl(first, IPC_STAT, &shm_info));
@@ -2477,7 +2477,7 @@
         if (!ldt_table)
             return -TARGET_ENOMEM;
         memset(ldt_table, 0, TARGET_LDT_ENTRIES * TARGET_LDT_ENTRY_SIZE);
-        env->ldt.base = h2g((unsigned long)ldt_table);
+        env->ldt.base = h2g(ldt_table);
         env->ldt.limit = 0xffff;
     }
 
Index: linux-user/main.c
===================================================================
--- linux-user/main.c	(revision 4845)
+++ linux-user/main.c	(working copy)
@@ -2472,7 +2472,7 @@
     {
         uint64_t *gdt_table;
         gdt_table = qemu_mallocz(sizeof(uint64_t) * TARGET_GDT_ENTRIES);
-        env->gdt.base = h2g((unsigned long)gdt_table);
+        env->gdt.base = h2g(gdt_table);
         env->gdt.limit = sizeof(uint64_t) * TARGET_GDT_ENTRIES - 1;
 #ifdef TARGET_ABI32
         write_dt(&gdt_table[__USER_CS >> 3], 0, 0xfffff,

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

end of thread, other threads:[~2008-07-04  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 21:36 [Qemu-devel] [4844] Avoid compiler warning Thiemo Seufer
2008-07-04  6:05 ` [Qemu-devel] " Jan Kiszka
2008-07-04  7:29 ` [Qemu-devel] " Laurent Desnogues

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).