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 <[email protected]>
---
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