From 9c6ecf3e76311ac04cf1779f0c9beef831c152b5 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:50:10 +0100 Subject: [PATCH 01/15] Remove macro HOST_LONG_SIZE HOST_LONG_SIZE is simply the size of a pointer value. There is no need for this macro. Signed-off-by: Stefan Weil --- cpu-defs.h | 2 -- thunk.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) 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/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; } From 2c9762973cbee50de591cf63c05d0e79218be60c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:51:52 +0100 Subject: [PATCH 02/15] target-alpha: Clean includes The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h. Cc: Richard Henderson Signed-off-by: Stefan Weil --- target-alpha/cpu.h | 1 + target-alpha/translate.c | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) 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 From 853bfcc71afc5436830cfcb58bc31622024eaf7c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:53:02 +0100 Subject: [PATCH 03/15] target-arm: Clean includes Remove some include statements which are not needed. Reviewed-by: Peter Maydell Signed-off-by: Stefan Weil --- target-arm/helper.c | 5 ----- 1 file changed, 5 deletions(-) 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" From 7ad757b29b5096ae100d646c584036b4892c9be5 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:53:33 +0100 Subject: [PATCH 04/15] target-cris: Clean includes The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h. Cc: Edgar E. Iglesias Signed-off-by: Stefan Weil --- target-cris/cpu.h | 3 +++ target-cris/helper.c | 4 ---- target-cris/mmu.c | 5 ----- target-cris/translate.c | 7 ------- 4 files changed, 3 insertions(+), 16 deletions(-) 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" From 727d6bff27a176f12180149edffb3c52f07132c8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:54:13 +0100 Subject: [PATCH 05/15] target-i386: Clean includes Remove some include statements which are not needed. Signed-off-by: Stefan Weil --- target-i386/helper.c | 6 ------ target-i386/op_helper.c | 1 - 2 files changed, 7 deletions(-) diff --git a/target-i386/helper.c b/target-i386/helper.c index 2586aff700..87c6a8f7d9 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" From 60ed8d298e1e75b80a560dc5c3f25582aa1fc548 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:54:57 +0100 Subject: [PATCH 06/15] target-lm32: Clean includes config.h was missing in cpu.h. Acked-by: Michael Walle Signed-off-by: Stefan Weil --- target-lm32/cpu.h | 1 + target-lm32/helper.c | 5 ----- target-lm32/translate.c | 8 -------- 3 files changed, 1 insertion(+), 13 deletions(-) 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" From 3aef481a6b043e6995d2edef49e89489b4f1e2cc Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:55:18 +0100 Subject: [PATCH 07/15] target-m68k: Clean includes config.h was missing in cpu.h. Signed-off-by: Stefan Weil --- target-m68k/cpu.h | 1 + target-m68k/helper.c | 5 ----- target-m68k/translate.c | 6 ------ 3 files changed, 1 insertion(+), 11 deletions(-) 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" From 94598c1d9561e042ec80389c82e4fe3e15563584 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:55:39 +0100 Subject: [PATCH 08/15] target-microblaze: Clean includes The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h. Signed-off-by: Stefan Weil --- target-microblaze/cpu.h | 3 +++ target-microblaze/helper.c | 5 ----- target-microblaze/mmu.c | 4 ---- target-microblaze/translate.c | 8 -------- 4 files changed, 3 insertions(+), 17 deletions(-) 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" From 0056c093b683879535f99a0ab7ccccaa5d1fefc6 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:56:03 +0100 Subject: [PATCH 09/15] target-mips: Clean includes Remove some include statements which are not needed. Cc: Aurelien Jarno Signed-off-by: Stefan Weil --- target-mips/translate.c | 7 ------- 1 file changed, 7 deletions(-) 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 From 550a82ec32c1afe6518bfbe8c811d34d85518cdc Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 2 Feb 2012 21:40:37 +0100 Subject: [PATCH 10/15] target-ppc: Clean includes Remove some include statements which are not needed. Acked-by: Alexander Graf Signed-off-by: Stefan Weil --- target-ppc/helper.c | 6 ------ target-ppc/translate.c | 6 ------ 2 files changed, 12 deletions(-) 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" From 45133b74bacc67d2cc7c6b19315528325cc23c26 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 20:56:52 +0100 Subject: [PATCH 11/15] target-s390x: Clean includes The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h. Signed-off-by: Stefan Weil --- target-s390x/cpu.h | 3 +++ target-s390x/helper.c | 5 ----- target-s390x/translate.c | 5 ----- 3 files changed, 3 insertions(+), 10 deletions(-) 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 */ From 2d0b9ac6d629bf9d32f101a319cebd9767bb3350 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 2 Feb 2012 21:44:38 +0100 Subject: [PATCH 12/15] target-sh4: Clean includes Remove some include statements which are not needed. Cc: Aurelien Jarno Signed-off-by: Stefan Weil --- target-sh4/translate.c | 6 ------ 1 file changed, 6 deletions(-) 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 From 8141905a4458400b094d60d835a98b26ab48a4af Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 2 Feb 2012 21:47:01 +0100 Subject: [PATCH 13/15] target-unicore32: Clean includes The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h. Signed-off-by: Stefan Weil --- target-unicore32/cpu.h | 2 ++ target-unicore32/helper.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) 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) From 2ad5201c1e3d53fef14af1e9eb629c180b318d89 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 2 Feb 2012 21:48:08 +0100 Subject: [PATCH 14/15] target-xtensa: Clean includes Remove some include statements which are not needed. Acked-by: Max Filippov Signed-off-by: Stefan Weil --- target-xtensa/core-dc232b.c | 1 - target-xtensa/core-fsf.c | 1 - target-xtensa/helper.c | 1 - 3 files changed, 3 deletions(-) diff --git a/target-xtensa/core-dc232b.c b/target-xtensa/core-dc232b.c index 4d9bd559d4..21b287d0b0 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 7650462f2f..763b8e5c92 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 2a0cb1a562..1264c83839 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" From c0fd260e9da7e6e60ea6bf1b0198a804f147073f Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Feb 2012 21:04:13 +0100 Subject: [PATCH 15/15] Move definition of HOST_LONG_BITS to qemu-common.h Like the related macro TCG_TARGET_LONG, HOST_LONG_BITS can be determined by the C preprocessor. It is also not used in Makefiles. So there is no need to calculate it in configure, and it can be defined in qemu-common.h. Signed-off-by: Stefan Weil --- configure | 12 ------------ qemu-common.h | 9 +++++++++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/configure b/configure index d9dde969d6..9ae85bec4b 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/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 {