diff --git a/configure b/configure index 7e69ea8864..a5eb8323e9 100755 --- a/configure +++ b/configure @@ -1291,17 +1291,6 @@ esac fi -# host long bits test, actually a pointer size test -cat > $TMPC << EOF -int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; -EOF -if compile_object; then -hostlongbits=64 -else -hostlongbits=32 -fi - - ########################################## # NPTL probe @@ -2988,7 +2977,6 @@ fi if test "$bigendian" = "yes" ; then echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak fi -echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak rc_version=`cat $source_path/VERSION` diff --git a/cpu-defs.h b/cpu-defs.h index 57a709b679..4527cbf4f3 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -60,8 +60,6 @@ typedef uint64_t target_ulong __attribute__((aligned(TARGET_LONG_ALIGNMENT))); #error TARGET_LONG_SIZE undefined #endif -#define HOST_LONG_SIZE (HOST_LONG_BITS / 8) - #define EXCP_INTERRUPT 0x10000 /* async interruption */ #define EXCP_HLT 0x10001 /* hlt instruction reached */ #define EXCP_DEBUG 0x10002 /* cpu stopped after a breakpoint or singlestep */ diff --git a/qemu-common.h b/qemu-common.h index c5e9cad35e..dbfce6f4c6 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -65,6 +65,15 @@ typedef struct Monitor Monitor; #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 + #ifndef CONFIG_IOVEC #define CONFIG_IOVEC struct iovec { diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 9d61d45ab6..5cd6fd834f 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -21,6 +21,7 @@ #define __CPU_ALPHA_H__ #include "config.h" +#include "qemu-common.h" #define TARGET_LONG_BITS 64 diff --git a/target-alpha/translate.c b/target-alpha/translate.c index a961159d5d..1d2142bfde 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -17,15 +17,10 @@ * License along with this library; if not, see . */ -#include -#include -#include - #include "cpu.h" #include "disas.h" #include "host-utils.h" #include "tcg-op.h" -#include "qemu-common.h" #include "helper.h" #define GEN_HELPER 1 diff --git a/target-arm/helper.c b/target-arm/helper.c index 4929372489..abe1c30d6a 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1,11 +1,6 @@ -#include -#include -#include - #include "cpu.h" #include "gdbstub.h" #include "helper.h" -#include "qemu-common.h" #include "host-utils.h" #if !defined(CONFIG_USER_ONLY) #include "hw/loader.h" diff --git a/target-cris/cpu.h b/target-cris/cpu.h index 453afbb66e..222a0625a3 100644 --- a/target-cris/cpu.h +++ b/target-cris/cpu.h @@ -20,6 +20,9 @@ #ifndef CPU_CRIS_H #define CPU_CRIS_H +#include "config.h" +#include "qemu-common.h" + #define TARGET_LONG_BITS 32 #define CPUState struct CPUCRISState diff --git a/target-cris/helper.c b/target-cris/helper.c index 5bc6d810cb..dd7f18e7f4 100644 --- a/target-cris/helper.c +++ b/target-cris/helper.c @@ -18,10 +18,6 @@ * License along with this library; if not, see . */ -#include -#include - -#include "config.h" #include "cpu.h" #include "mmu.h" #include "host-utils.h" diff --git a/target-cris/mmu.c b/target-cris/mmu.c index d481e39352..5cd8f27528 100644 --- a/target-cris/mmu.c +++ b/target-cris/mmu.c @@ -20,11 +20,6 @@ #ifndef CONFIG_USER_ONLY -#include -#include -#include - -#include "config.h" #include "cpu.h" #include "mmu.h" diff --git a/target-cris/translate.c b/target-cris/translate.c index 70abf8a095..cbdc72c9b9 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -23,19 +23,12 @@ * The condition code translation is in need of attention. */ -#include -#include -#include -#include -#include - #include "cpu.h" #include "disas.h" #include "tcg-op.h" #include "helper.h" #include "mmu.h" #include "crisv32-decode.h" -#include "qemu-common.h" #define GEN_HELPER 1 #include "helper.h" diff --git a/target-i386/helper.c b/target-i386/helper.c index d12c9621bd..af6bba2680 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -16,14 +16,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include -#include #include "cpu.h" -#include "qemu-common.h" #include "kvm.h" #ifndef CONFIG_USER_ONLY #include "sysemu.h" diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 2aea71bf85..63a08d6d9a 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -22,7 +22,6 @@ #include "dyngen-exec.h" #include "host-utils.h" #include "ioport.h" -#include "qemu-common.h" #include "qemu-log.h" #include "cpu-defs.h" #include "helper.h" diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h index 037ef528ed..b6b6b4c87a 100644 --- a/target-lm32/cpu.h +++ b/target-lm32/cpu.h @@ -24,6 +24,7 @@ #define CPUState struct CPULM32State +#include "config.h" #include "qemu-common.h" #include "cpu-defs.h" struct CPULM32State; diff --git a/target-lm32/helper.c b/target-lm32/helper.c index fc0b444d81..2637c03c91 100644 --- a/target-lm32/helper.c +++ b/target-lm32/helper.c @@ -17,11 +17,6 @@ * License along with this library; if not, see . */ -#include -#include -#include - -#include "config.h" #include "cpu.h" #include "host-utils.h" diff --git a/target-lm32/translate.c b/target-lm32/translate.c index 0be105d018..c80e48b39e 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -17,18 +17,10 @@ * License along with this library; if not, see . */ -#include -#include -#include -#include -#include -#include - #include "cpu.h" #include "disas.h" #include "helper.h" #include "tcg-op.h" -#include "qemu-common.h" #include "hw/lm32_pic.h" diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h index 0667f8214a..4cc3a35f2e 100644 --- a/target-m68k/cpu.h +++ b/target-m68k/cpu.h @@ -24,6 +24,7 @@ #define CPUState struct CPUM68KState +#include "config.h" #include "qemu-common.h" #include "cpu-defs.h" diff --git a/target-m68k/helper.c b/target-m68k/helper.c index 674c8e6f07..fa675bfca6 100644 --- a/target-m68k/helper.c +++ b/target-m68k/helper.c @@ -18,12 +18,7 @@ * License along with this library; if not, see . */ -#include -#include - -#include "config.h" #include "cpu.h" -#include "qemu-common.h" #include "gdbstub.h" #include "helpers.h" diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 0e7f1fe2c7..2bdd9dd1e3 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -17,13 +17,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include -#include -#include "config.h" #include "cpu.h" #include "disas.h" #include "tcg-op.h" diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 3ecaeee346..409250649d 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -19,6 +19,9 @@ #ifndef CPU_MICROBLAZE_H #define CPU_MICROBLAZE_H +#include "config.h" +#include "qemu-common.h" + #define TARGET_LONG_BITS 32 #define CPUState struct CPUMBState diff --git a/target-microblaze/helper.c b/target-microblaze/helper.c index 2cf28022bd..e1355ff93e 100644 --- a/target-microblaze/helper.c +++ b/target-microblaze/helper.c @@ -17,11 +17,6 @@ * License along with this library; if not, see . */ -#include -#include -#include - -#include "config.h" #include "cpu.h" #include "host-utils.h" diff --git a/target-microblaze/mmu.c b/target-microblaze/mmu.c index 281fc8d8c4..7c34ac0971 100644 --- a/target-microblaze/mmu.c +++ b/target-microblaze/mmu.c @@ -16,11 +16,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include "config.h" #include "cpu.h" #define D(x) diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c index 96ce2ece51..725c2ddf9b 100644 --- a/target-microblaze/translate.c +++ b/target-microblaze/translate.c @@ -17,19 +17,11 @@ * License along with this library; if not, see . */ -#include -#include -#include -#include -#include -#include - #include "cpu.h" #include "disas.h" #include "tcg-op.h" #include "helper.h" #include "microblaze-decode.h" -#include "qemu-common.h" #define GEN_HELPER 1 #include "helper.h" diff --git a/target-mips/translate.c b/target-mips/translate.c index d5b1c765fb..8361d88aa8 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -20,16 +20,9 @@ * License along with this library; if not, see . */ -#include -#include -#include -#include -#include - #include "cpu.h" #include "disas.h" #include "tcg-op.h" -#include "qemu-common.h" #include "helper.h" #define GEN_HELPER 1 diff --git a/target-ppc/helper.c b/target-ppc/helper.c index 928fbcf3cb..bb76a8b9e0 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -16,15 +16,9 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include -#include #include "cpu.h" #include "helper_regs.h" -#include "qemu-common.h" #include "kvm.h" #include "kvm_ppc.h" #include "cpus.h" diff --git a/target-ppc/translate.c b/target-ppc/translate.c index b2780dbe55..8573e1f775 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -17,16 +17,10 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include -#include #include "cpu.h" #include "disas.h" #include "tcg-op.h" -#include "qemu-common.h" #include "host-utils.h" #include "helper.h" diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index b8893b3027..e892beca3b 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -19,6 +19,9 @@ #ifndef CPU_S390X_H #define CPU_S390X_H +#include "config.h" +#include "qemu-common.h" + #define TARGET_LONG_BITS 64 #define ELF_MACHINE EM_S390 diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 10cc9dd5fa..c0ec8908a6 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -18,13 +18,8 @@ * License along with this library; if not, see . */ -#include -#include -#include - #include "cpu.h" #include "gdbstub.h" -#include "qemu-common.h" #include "qemu-timer.h" #ifndef CONFIG_USER_ONLY #include "sysemu.h" diff --git a/target-s390x/translate.c b/target-s390x/translate.c index ee15672185..71f9dcdff5 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -17,11 +17,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include -#include /* #define DEBUG_ILLEGAL_INSTRUCTIONS */ /* #define DEBUG_INLINE_BRANCHES */ diff --git a/target-sh4/translate.c b/target-sh4/translate.c index aacf96d9a3..dd0ee4be93 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -16,11 +16,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#include -#include -#include -#include -#include #define DEBUG_DISAS #define SH4_DEBUG_DISAS @@ -29,7 +24,6 @@ #include "cpu.h" #include "disas.h" #include "tcg-op.h" -#include "qemu-common.h" #include "helper.h" #define GEN_HELPER 1 diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h index b4e72cfa6e..f725634801 100644 --- a/target-unicore32/cpu.h +++ b/target-unicore32/cpu.h @@ -20,6 +20,8 @@ #define CPUState struct CPUState_UniCore32 +#include "config.h" +#include "qemu-common.h" #include "cpu-defs.h" #include "softfloat.h" diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index b5b1cb7c9b..ee7f82bdcd 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -5,14 +5,10 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include -#include -#include #include "cpu.h" #include "gdbstub.h" #include "helper.h" -#include "qemu-common.h" #include "host-utils.h" static inline void set_feature(CPUState *env, int feature) diff --git a/target-xtensa/core-dc232b.c b/target-xtensa/core-dc232b.c index b723c4ca7b..7c038351b3 100644 --- a/target-xtensa/core-dc232b.c +++ b/target-xtensa/core-dc232b.c @@ -1,7 +1,6 @@ #include "cpu.h" #include "exec-all.h" #include "gdbstub.h" -#include "qemu-common.h" #include "host-utils.h" #include "core-dc232b/core-isa.h" diff --git a/target-xtensa/core-fsf.c b/target-xtensa/core-fsf.c index 88de4dd4ba..c11d9708e7 100644 --- a/target-xtensa/core-fsf.c +++ b/target-xtensa/core-fsf.c @@ -1,7 +1,6 @@ #include "cpu.h" #include "exec-all.h" #include "gdbstub.h" -#include "qemu-common.h" #include "host-utils.h" #include "core-fsf/core-isa.h" diff --git a/target-xtensa/helper.c b/target-xtensa/helper.c index 2ef50d656e..42a559f756 100644 --- a/target-xtensa/helper.c +++ b/target-xtensa/helper.c @@ -28,7 +28,6 @@ #include "cpu.h" #include "exec-all.h" #include "gdbstub.h" -#include "qemu-common.h" #include "host-utils.h" #if !defined(CONFIG_USER_ONLY) #include "hw/loader.h" diff --git a/thunk.h b/thunk.h index 109c541f0f..9810743191 100644 --- a/thunk.h +++ b/thunk.h @@ -99,7 +99,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host) case TYPE_PTRVOID: case TYPE_PTR: if (is_host) { - return HOST_LONG_SIZE; + return sizeof(void *); } else { return TARGET_ABI_BITS / 8; } @@ -136,7 +136,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) case TYPE_PTRVOID: case TYPE_PTR: if (is_host) { - return HOST_LONG_SIZE; + return sizeof(void *); } else { return TARGET_ABI_BITS / 8; }