From e85ef5381a512d8f781b862e8b5f9d4cbf0ba494 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 4 Jun 2013 09:51:59 -0700 Subject: [PATCH 1/2] tcg: Use QEMU_BUILD_BUG_ON for CPU_TLB_ENTRY_BITS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than a hand-coded version of the same thing. Reviewed-by: Andreas Färber Reviewed-by: liguang Signed-off-by: Richard Henderson --- include/exec/cpu-defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index d8c64e927..2e5a9bab3 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -99,7 +99,7 @@ typedef struct CPUTLBEntry { sizeof(uintptr_t))]; } CPUTLBEntry; -extern int CPUTLBEntry_wrong_size[sizeof(CPUTLBEntry) == (1 << CPU_TLB_ENTRY_BITS) ? 1 : -1]; +QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS)); #define CPU_COMMON_TLB \ /* The meaning of the MMU modes is defined in the target code. */ \ From 56bbc2f967ce185fa1c5c39e1aeb5b68b26242e9 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 4 Jun 2013 09:53:19 -0700 Subject: [PATCH 2/2] tcg: Remove redundant tcg_target_init checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We've got a compile-time check for the condition in exec/cpu-defs.h. Reviewed-by: Andreas Färber Reviewed-by: liguang Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c | 6 ------ tcg/i386/tcg-target.c | 6 ------ tcg/s390/tcg-target.c | 7 ------- 3 files changed, 19 deletions(-) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index 3d434124a..6be736b75 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -2053,12 +2053,6 @@ static const TCGTargetOpDef arm_op_defs[] = { static void tcg_target_init(TCGContext *s) { -#if !defined(CONFIG_USER_ONLY) - /* fail safe */ - if ((1 << CPU_TLB_ENTRY_BITS) != sizeof(CPUTLBEntry)) - tcg_abort(); -#endif - tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff); tcg_regset_set32(tcg_target_call_clobber_regs, 0, (1 << TCG_REG_R0) | diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index 9eec06c8a..9e95477ef 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -2283,12 +2283,6 @@ static void tcg_target_init(TCGContext *s) } #endif -#if !defined(CONFIG_USER_ONLY) - /* fail safe */ - if ((1 << CPU_TLB_ENTRY_BITS) != sizeof(CPUTLBEntry)) - tcg_abort(); -#endif - if (TCG_TARGET_REG_BITS == 64) { tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff); tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffff); diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c index 7d6f77708..f229f1c34 100644 --- a/tcg/s390/tcg-target.c +++ b/tcg/s390/tcg-target.c @@ -2324,13 +2324,6 @@ static void query_facilities(void) static void tcg_target_init(TCGContext *s) { -#if !defined(CONFIG_USER_ONLY) - /* fail safe */ - if ((1 << CPU_TLB_ENTRY_BITS) != sizeof(CPUTLBEntry)) { - tcg_abort(); - } -#endif - query_facilities(); tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff);