tcg: Remove redundant tcg_target_init checks
cover tcg: Remove redundant tcg_target_init checks
Reviewing the tcg/aarch64 patch set, and comparing that to existing hosts made me remember that I've wanted to do this for quite some time.
r~
Richard Henderson (2):
tcg: Use QEMU_BUILD_BUG_ON for CPU_TLB_ENTRY_BITS
tcg: Remove redundant tcg_target_init checks
include/exec/cpu-defs.h | 2 +- tcg/arm/tcg-target.c | 6 ------ tcg/i386/tcg-target.c | 6 ------ tcg/s390/tcg-target.c | 7 ------- 4 files changed, 1 insertion(+), 20 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/2 tcg: Use QEMU_BUILD_BUG_ON for CPU_TLB_ENTRY_BITS
Rather than a hand-coded version of the same thing.
--- include/exec/cpu-defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/exec/cpu-defs.h +1 -1
@@ -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. */ \
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 1/2] tcg: Use QEMU_BUILD_BUG_ON for CPU_TLB_ENTRY_BITS
Quoted 20 lines · 在 2013-06-04二的 09:58 -0700,Richard Henderson写道:
Rather than a hand-coded version of the same thing.
Signed-off-by Richard Henderson <[email protected]>--- include/exec/cpu-defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/exec/cpu-defs.h +1
-1@@ -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. */ \
PATCH 2/2 tcg: Remove redundant tcg_target_init checks
In reply to Richard HendersonWe've got a compile-time check for the condition in exec/cpu-defs.h.
--- tcg/arm/tcg-target.c | 6 ------ tcg/i386/tcg-target.c | 6 ------ tcg/s390/tcg-target.c | 7 ------- 3 files changed, 19 deletions(-)
tcg/arm/tcg-target.c +0 -6
@@ -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) |
tcg/i386/tcg-target.c +0 -6
@@ -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 );
tcg/s390/tcg-target.c +0 -7
@@ -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 );
Signature · 1 line
1.8.1.4
Quoted 61 lines · 在 2013-06-04二的 09:58 -0700,Richard Henderson写道:
We've got a compile-time check for the condition in
exec/cpu-defs.h.Signed-off-by Richard Henderson <[email protected]>--- tcg/arm/tcg-target.c | 6 ------ tcg/i386/tcg-target.c | 6 ------ tcg/s390/tcg-target.c | 7 ------- 3 files changed, 19 deletions(-)tcg/arm/tcg-target.c +0
-6@@ -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) |tcg/i386/tcg-target.c +0
-6@@ -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 );tcg/s390/tcg-target.c +0
-7@@ -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 );
Am 04.06.2013 18:58, schrieb Richard Henderson:
Quoted 5 lines
Reviewing the tcg/aarch64 patch set, and comparing that to existing hosts made me remember that I've wanted to do this for quite some time.
Quoted 7 lines
r~
Richard Henderson (2):
tcg: UseQEMU_BUILD_BUG_ONforCPU_TLB_ENTRY_BITS
tcg: Remove redundanttcg_target_initchecks
Andreas
Quoted 7 lines
include/exec/cpu-defs.h | 2 +- tcg/arm/tcg-target.c | 6 ------ tcg/i386/tcg-target.c | 6 ------ tcg/s390/tcg-target.c | 7 ------- 4 files changed, 1 insertion(+), 20 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg