Cleanup HOST_LONG_BITS, HOST_I386 and HOST_X86_64
HOST_LONG_BITS is now computed automatically in
include/qemu-common.h so remove all the configuration/probing
that was required before this patch to get the correct value.
Also get rid of HOST_I386 and HOST_X86_64 since they are not
needed anymore.
Change-Id: I61823a896033e38938346242b7aea78d3e832826
diff --git a/android-configure.sh b/android-configure.sh
index 8abfd52..a3f4259 100755
--- a/android-configure.sh
+++ b/android-configure.sh
@@ -511,17 +511,6 @@
feature_run_exec HOST_BIGENDIAN
fi
-# check size of host long bits
-HOST_LONGBITS=32
-if [ "$TARGET_OS" = "$OS" ] ; then
-cat > $TMPC << EOF
-int main(void) {
- return sizeof(void*)*8;
-}
-EOF
-feature_run_exec HOST_LONGBITS
-fi
-
# check whether we have <byteswap.h>
#
feature_check_header HAVE_BYTESWAP_H "<byteswap.h>"
@@ -608,16 +597,6 @@
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#if defined(__x86_64__)
-#define HOST_X86_64 1
-#define HOST_LONG_BITS 64
-#elif defined(__i386__)
-#define HOST_I386 1
-#define HOST_LONG_BITS 32
-#else
-#error Unknown architecture for codegen
-#endif
-
EOF
if [ "$HAVE_BYTESWAP_H" = "yes" ] ; then
diff --git a/android/config/darwin-x86/config-host.h b/android/config/darwin-x86/config-host.h
index d84727e..1262cf0 100644
--- a/android/config/darwin-x86/config-host.h
+++ b/android/config/darwin-x86/config-host.h
@@ -1,14 +1,5 @@
/* This file was autogenerated by 'android-configure.sh' */
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#if defined(__x86_64__)
-#define HOST_X86_64 1
-#define HOST_LONG_BITS 64
-#elif defined(__i386__)
-#define HOST_I386 1
-#define HOST_LONG_BITS 32
-#else
-#error Unknown architecture for codegen
-#endif
#define CONFIG_FNMATCH 1
#define CONFIG_GDBSTUB 1
diff --git a/android/config/darwin-x86_64/config-host.h b/android/config/darwin-x86_64/config-host.h
index 7e2dfa8..9135b70 100644
--- a/android/config/darwin-x86_64/config-host.h
+++ b/android/config/darwin-x86_64/config-host.h
@@ -2,16 +2,6 @@
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#if defined(__x86_64__)
-#define HOST_X86_64 1
-#define HOST_LONG_BITS 64
-#elif defined(__i386__)
-#define HOST_I386 1
-#define HOST_LONG_BITS 32
-#else
-#error Unknown architecture for codegen
-#endif
-
#define CONFIG_FNMATCH 1
#define CONFIG_GDBSTUB 1
#define CONFIG_SLIRP 1
diff --git a/android/config/freebsd-x86/config-host.h b/android/config/freebsd-x86/config-host.h
index fd31de4..e74ff53 100644
--- a/android/config/freebsd-x86/config-host.h
+++ b/android/config/freebsd-x86/config-host.h
@@ -1,14 +1,5 @@
/* Automatically generated by configure - do not modify */
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#if defined(__x86_64__)
-#define HOST_X86_64 1
-#define HOST_LONG_BITS 64
-#elif defined(__i386__)
-#define HOST_I386 1
-#define HOST_LONG_BITS 32
-#else
-#error Unknown architecture for codegen
-#endif
#define CONFIG_MACHINE_BSWAP_H 1
#define CONFIG_FNMATCH 1
diff --git a/android/config/linux-ppc/config-host.h b/android/config/linux-ppc/config-host.h
index f87ef47..ea0123b 100644
--- a/android/config/linux-ppc/config-host.h
+++ b/android/config/linux-ppc/config-host.h
@@ -1,6 +1,5 @@
/* This file was autogenerated by 'android-configure.sh' */
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#define HOST_LONG_BITS 32
#define CONFIG_BYTESWAP_H 1
#define CONFIG_FNMATCH 1
#define CONFIG_GDBSTUB 1
diff --git a/android/config/linux-x86/config-host.h b/android/config/linux-x86/config-host.h
index 3936a72..d7ac22d 100644
--- a/android/config/linux-x86/config-host.h
+++ b/android/config/linux-x86/config-host.h
@@ -1,14 +1,5 @@
/* This file was autogenerated by 'android-configure.sh' */
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#if defined(__x86_64__)
-#define HOST_X86_64 1
-#define HOST_LONG_BITS 64
-#elif defined(__i386__)
-#define HOST_I386 1
-#define HOST_LONG_BITS 32
-#else
-#error Unknown architecture for codegen
-#endif
#define CONFIG_BYTESWAP_H 1
#define CONFIG_FNMATCH 1
diff --git a/android/config/windows/config-host.h b/android/config/windows/config-host.h
index 8174f94..45b1363 100644
--- a/android/config/windows/config-host.h
+++ b/android/config/windows/config-host.h
@@ -1,14 +1,5 @@
/* This file was autogenerated by 'android-configure.sh' */
#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu"
-#if defined(__x86_64__)
-#define HOST_X86_64 1
-#define HOST_LONG_BITS 64
-#elif defined(__i386__)
-#define HOST_I386 1
-#define HOST_LONG_BITS 32
-#else
-#error Unknown architecture for codegen
-#endif
#define CONFIG_GDBSTUB 1
#define CONFIG_SLIRP 1
diff --git a/android/opengles.c b/android/opengles.c
index d4ff301..2570429 100644
--- a/android/opengles.c
+++ b/android/opengles.c
@@ -67,12 +67,12 @@
#define DD(...) VERBOSE_PRINT(gles,__VA_ARGS__)
/* Name of the GLES rendering library we're going to use */
-#if HOST_LONG_BITS == 32
+#if UINTPTR_MAX == UINT32_MAX
#define RENDERER_LIB_NAME "libOpenglRender"
-#elif HOST_LONG_BITS == 64
+#elif UINTPTR_MAX == UINT64_MAX
#define RENDERER_LIB_NAME "lib64OpenglRender"
#else
-#error Unknown HOST_LONG_BITS
+#error Unknown UINTPTR_MAX
#endif
// Define the corresponding function pointers.
diff --git a/audio/audio.c b/audio/audio.c
index 8523cdf..ce0234f 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -232,7 +232,7 @@
AUD_log (NULL, "Context:\n");
#if defined AUDIO_BREAKPOINT_ON_BUG
-# if defined HOST_I386
+# if defined __i386__
# if defined __GNUC__
__asm__ ("int3");
# elif defined _MSC_VER
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 3b784cf..5cd8ebb 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -27,6 +27,7 @@
#include <setjmp.h>
#include <inttypes.h>
#include <signal.h>
+#include "qemu-common.h"
#include "qemu/osdep.h"
#include "qemu/queue.h"
#include "exec/hwaddr.h"
diff --git a/include/qemu-common.h b/include/qemu-common.h
index b203354..a033ee4 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -80,6 +80,15 @@
#define TIME_MAX LONG_MAX
#endif
+/* HOST_LONG_BITS is the size of a native pointer in bits. */
+#if UINTPTR_MAX == UINT32_MAX
+# define HOST_LONG_BITS 32
+#elif UINTPTR_MAX == UINT64_MAX
+# define HOST_LONG_BITS 64
+#else
+# error Unknown pointer size
+#endif
+
typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);