target/m68k: Convert to TranslatorOps
cover target/m68k: Convert to TranslatorOps
FYI, I've only tested this with linux-user-test-0.3 and our qemu coldfire testing kernel.
r~
Richard Henderson (9):
target/m68k: Use DISAS_NORETURN for exceptions target/m68k: Replace DISAS_TB_JUMP with DISAS_NORETURN target/m68k: Remove DISAS_JUMP_NEXT as unused target/m68k: Use lookup_and_goto_tb for DISAS_JUMP target/m68k: Rename DISAS_UPDATE and gen_lookup_tb target/m68k: Convert to DisasContextBase target/m68k: Convert to TranslatorOps
target/m68k: Improve ending TB at page boundaries target/m68k: Merge disas_m68k_insn into m68k_tr_translate_insn
target/m68k/translate.c | 354 ++++++++++++++++++++-------------------- 1 file changed, 179 insertions(+), 175 deletions(-)
Signature · 1 line
2.17.0
PATCH 1/2 hw/virtio: Fix brace Werror with clang 6.0.0
The warning is
hw/virtio/vhost-user.c:1319:26: error: suggest braces
around initialization of subobject [-Werror,-Wmissing-braces]
VhostUserMsg msg = { 0 };
^
{}While the original code is correct, and technically exactly correct as per ISO C89, both GCC and Clang support plain empty set of braces as an extension.
--- hw/virtio/vhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
@@ -1316,7 +1316,7 @@ static bool vhost_user_requires_shm_log(struct vhost_dev *dev)static int vhost_user_migration_done (struct vhost_dev *dev,char * mac_addr) { -VhostUserMsg msg = {0 }; +VhostUserMsg msg = { };assert (dev->vhost_ops->backend_type ==VHOST_BACKEND_TYPE_USER );
Signature · 1 line
2.17.0
PATCH 1/9 target/m68k: Use DISAS_NORETURN for exceptions
In reply to Richard HendersonThe raise_exception helper does not return. Do not generate any code following that.
--- target/m68k/translate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
target/m68k/translate.c +8 -8
@@ -291,18 +291,18 @@ static void gen_jmp(DisasContext *s, TCGv dest) s->is_jmp =DISAS_JUMP ; } -static void gen_raise_exception (int nr) +static void gen_exception (DisasContext *s,uint32_t dest,int nr) { -TCGv_i32 tmp =tcg_const_i32 (nr); +TCGv_i32 tmp; +update_cc_op (s); +tcg_gen_movi_i32 (QREG_PC , dest); + + tmp =tcg_const_i32 (nr);gen_helper_raise_exception (cpu_env, tmp);tcg_temp_free_i32 (tmp); -} -static void gen_exception (DisasContext *s,uint32_t where,int nr) -{ -gen_jmp_im (s, where); -gen_raise_exception (nr); + s->is_jmp =DISAS_NORETURN ; }static inline void gen_addr_fault (DisasContext *s)
@@ -6106,7 +6106,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)if (unlikely (cpu_breakpoint_test (cs, dc->pc,BP_ANY ))) {gen_exception (dc, dc->pc,EXCP_DEBUG ); - dc->is_jmp =DISAS_JUMP ;/* The address covered by the breakpoint must be included in [tb->pc, tb->pc + tb->size) in order to for it to be properly cleared -- thus we increment the PC here so that
@@ -6150,6 +6149,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)tcg_gen_exit_tb (0 );break ;case DISAS_TB_JUMP : +case DISAS_NORETURN :/* nothing more to generate */ break ; }
Signature · 1 line
2.17.0
PATCH 2/9 target/m68k: Replace DISAS_TB_JUMP with DISAS_NORETURN
In reply to Richard HendersonWe have exited the TB after using goto_tb; there is no distinction from DISAS_NORETURN.
--- target/m68k/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
target/m68k/translate.c +1 -3
@@ -199,7 +199,6 @@ static void do_writebacks(DisasContext *s)/* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0/* only pc was modified dynamically */ #define DISAS_UPDATE DISAS_TARGET_1/* cpu state was modified dynamically */ -#define DISAS_TB_JUMP DISAS_TARGET_2/* only pc was modified statically */ #define DISAS_JUMP_NEXT DISAS_TARGET_3#if defined(CONFIG_USER_ONLY )
@@ -1496,7 +1495,7 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)gen_jmp_im (s, dest);tcg_gen_exit_tb (0 ); } - s->is_jmp =DISAS_TB_JUMP ; + s->is_jmp =DISAS_NORETURN ; }DISAS_INSN (scc)
@@ -6148,7 +6147,6 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)/* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb (0 );break ; -case DISAS_TB_JUMP :case DISAS_NORETURN :/* nothing more to generate */ break ;
Signature · 1 line
2.17.0
PATCH 2/2 target/s390x: Fix brace Werror with clang 6.0.0
In reply to Richard HendersonThe warning is
target/s390x/misc_helper.c:209:21: error: suggest
braces around initialization of subobject [-Werror,-Wmissing-braces]
SysIB sysib = { 0 };
^
{}While the original code is correct, and technically exactly correct as per ISO C89, both GCC and Clang support plain empty set of braces as an extension.
--- target/s390x/misc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/misc_helper.c +1 -1
@@ -206,7 +206,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1)const MachineState *ms =MACHINE (qdev_get_machine ());uint16_t total_cpus =0 , conf_cpus =0 , reserved_cpus =0 ;S390CPU *cpu =s390_env_get_cpu (env); -SysIB sysib = {0 }; +SysIB sysib = { };int i, cc =0 ;if ((r0 &STSI_R0_FC_MASK ) >STSI_R0_FC_LEVEL_3 ) {
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 2/2] target/s390x: Fix brace Werror with clang 6.0.0
Quoted 26 lines · Richard Henderson
The warning is
target/s390x/misc_helper.c:209:21: error: suggestbraces around initialization of subobject [-Werror,-Wmissing-braces] SysIB sysib = { 0 }; ^ {}While the original code is correct, and technically exactly correct as per ISO C89, both GCC and Clang support plain empty set of braces as an extension.
Cc Alexander Graf <[email protected]>Cc David Hildenbrand <[email protected]>Cc Cornelia Huck <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- target/s390x/misc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/s390x/misc_helper.c +0
-0
target/s390x/misc_helper.c uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1) · line 212
Quoted 8 lines
target/s390x/misc_helper.c +1
-1@@ -206,7 +206,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1)const MachineState *ms =MACHINE (qdev_get_machine ());uint16_t total_cpus =0 , conf_cpus =0 , reserved_cpus =0 ;S390CPU *cpu =s390_env_get_cpu (env); -SysIB sysib = {0 }; +SysIB sysib = { };int i, cc =0 ;if ((r0 &STSI_R0_FC_MASK ) >STSI_R0_FC_LEVEL_3 ) {
Very strange that this is reported as an error if it is technically the right thing to do. Anyhow, to make compilers happy:
Signature · 3 lines
Thanks, David / dhildenb
Cornelia Huck
AppliedRe: [Qemu-devel] [PATCH 2/2] target/s390x: Fix brace Werror with clang 6.0.0
In reply to Richard HendersonQuoted 25 lines · On Fri, 11 May 2018 21:59:43 -0700 Richard Henderson…
The warning is
target/s390x/misc_helper.c:209:21: error: suggestbraces around initialization of subobject [-Werror,-Wmissing-braces] SysIB sysib = { 0 }; ^ {}While the original code is correct, and technically exactly correct as per ISO C89, both GCC and Clang support plain empty set of braces as an extension.
Cc Alexander Graf <[email protected]>Cc David Hildenbrand <[email protected]>Cc Cornelia Huck <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- target/s390x/misc_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/s390x/misc_helper.c +0
-0
target/s390x/misc_helper.c uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1) · line 212
Quoted 8 lines
target/s390x/misc_helper.c +1
-1@@ -206,7 +206,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1)const MachineState *ms =MACHINE (qdev_get_machine ());uint16_t total_cpus =0 , conf_cpus =0 , reserved_cpus =0 ;S390CPU *cpu =s390_env_get_cpu (env); -SysIB sysib = {0 }; +SysIB sysib = { };int i, cc =0 ;if ((r0 &STSI_R0_FC_MASK ) >STSI_R0_FC_LEVEL_3 ) {
Thanks, applied.
PATCH 3/9 target/m68k: Remove DISAS_JUMP_NEXT as unused
In reply to Richard Henderson--- target/m68k/translate.c | 1 - 1 file changed, 1 deletion(-)
target/m68k/translate.c +0 -1
@@ -199,7 +199,6 @@ static void do_writebacks(DisasContext *s)/* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0/* only pc was modified dynamically */ #define DISAS_UPDATE DISAS_TARGET_1/* cpu state was modified dynamically */ -#define DISAS_JUMP_NEXT DISAS_TARGET_3#if defined(CONFIG_USER_ONLY )#define IS_USER (s) 1
Signature · 1 line
2.17.0
PATCH 4/9 target/m68k: Use lookup_and_goto_tb for DISAS_JUMP
In reply to Richard HendersonThese are all indirect or out-of-page direct jumps. We can indirectly chain to the next TB without going back to the main loop.
--- target/m68k/translate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
target/m68k/translate.c +4 -1
@@ -6139,8 +6139,11 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)update_cc_op (dc);gen_jmp_tb (dc,0 , dc->pc);break ; -default :case DISAS_JUMP : +/* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */ +tcg_gen_lookup_and_goto_ptr (); +break ; +default :case DISAS_UPDATE :update_cc_op (dc);/* indicate that the hash table must be used to find the next TB */
Signature · 1 line
2.17.0