qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Avoid compilation error with --disable-guest-base
@ 2015-06-30 16:19 Laurent Vivier
  2015-06-30 16:45 ` Peter Maydell
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Vivier @ 2015-06-30 16:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: riku.voipio, Laurent Vivier

When guest base is disabled, RESERVED_VA is 0, and
(__guest < RESERVED_VA) is always false as __guest is unsigned.

With -Werror=type-limits, this triggers an error:

    include/exec/cpu_ldst.h:60:31: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
         (!RESERVED_VA || (__guest < RESERVED_VA)); \

This patch removes this comparison when guest base is disabled.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 include/exec/cpu_ldst.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 1239c60..f278126 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -54,11 +54,16 @@
 #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS
 #define h2g_valid(x) 1
 #else
+#if defined(CONFIG_USE_GUEST_BASE)
 #define h2g_valid(x) ({ \
     unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
     (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
     (!RESERVED_VA || (__guest < RESERVED_VA)); \
 })
+#else
+#define h2g_valid(x) \
+    ((unsigned long)(x) < (1ul << TARGET_VIRT_ADDR_SPACE_BITS))
+#endif
 #endif
 
 #define h2g_nocheck(x) ({ \
-- 
2.4.3

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

end of thread, other threads:[~2015-07-21  6:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30 16:19 [Qemu-devel] [PATCH] linux-user: Avoid compilation error with --disable-guest-base Laurent Vivier
2015-06-30 16:45 ` Peter Maydell
2015-06-30 17:13   ` Laurent Vivier
2015-06-30 17:20     ` Peter Maydell
2015-06-30 23:58       ` Laurent Vivier
2015-07-01 11:12         ` Peter Maydell
2015-07-01 13:15         ` Aurelien Jarno
2015-07-01 18:21           ` Laurent Vivier
2015-07-01 19:46             ` Aurelien Jarno
2015-07-21  6:51             ` Richard Henderson

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