Trivial code improvement
PATCH 1/1 Trivial code improvement
Hello All,
this patch contains some fallout from my qemu mips development. It uses the cached interrupt_request variable instead of querying env and deletes some dead code in target-mips/helper.c.
Thiemo
Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.73
cpu-exec.c +1 -1
@@ -549,7 +549,7 @@ int cpu_exec(CPUState *env1) do_interrupt(env); }#endif -if (env->interrupt_request &CPU_INTERRUPT_EXITTB ) { +if (interrupt_request &CPU_INTERRUPT_EXITTB ) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB ;/* ensure that no TB jump will be modified as the program flow was changed */
Index: target-mips/helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-mips/helper.c,v retrieving revision 1.8
helper.c +0 -2
@@ -220,7 +219,6 @@ int cpu_mips_handle_mmu_fault (CPUState exception =EXCP_TLBS ; else exception =EXCP_TLBL ; - error_code =0 ;break ;case -4 :/* TLB match but 'D' bit is cleared */
@@ -350,7 +349,6 @@ void do_interrupt (CPUState *env) cause =4 ; goto set_EPC;case EXCP_TLBL : -case EXCP_TLBF : cause =2 ;if (env->error_code ==1 && !(env->hflags &MIPS_HFLAG_EXL )) offset =0x000 ;
Quoted 8 lines · Thiemo Seufer
Index:
cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.73
diff -u -p -r1.73cpu-exec.c
cpu-exec.c int cpu_exec(CPUState *env1) · line 555
Quoted 8 lines
cpu-exec.c +1
-1@@ -549,7 +549,7 @@ int cpu_exec(CPUState *env1) do_interrupt(env); }#endif -if (env->interrupt_request &CPU_INTERRUPT_EXITTB ) { +if (interrupt_request &CPU_INTERRUPT_EXITTB ) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB ;/* ensure that no TB jump will be modified as the program flow was changed */
Didn't we go round this recently? do_interrupt might modify env->interrupt_request - see target-arm/helper.c for instance.
Signature · 2 lines
Daniel Jacobowitz CodeSourcery
Quoted 12 lines · Daniel Jacobowitz
Quoted 11 lines · Thiemo Seufer
Index:
cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.73
diff -u -p -r1.73cpu-exec.ccpu-exec.c +0
-0@@ -549,7 +549,7 @@ int cpu_exec(CPUState *env1) do_interrupt(env); }#endif
Quoted 8 lines
cpu-exec.c int cpu_exec(CPUState *env1) · line 555
Quoted 5 lines
cpu-exec.c +1
-1-if (env->interrupt_request &CPU_INTERRUPT_EXITTB ) { +if (interrupt_request &CPU_INTERRUPT_EXITTB ) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB ;/* ensure that no TB jump will be modified as the program flow was changed */ Didn't we go round this recently?
do_interruptmight modifyenv->interrupt_request- seetarget-arm/helper.cfor instance.
Hm, interesting side-effect. Updated patch appended.
Thiemo
Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.73
cpu-exec.c +2 -0
@@ -549,6 +549,8 @@ int cpu_exec(CPUState *env1) do_interrupt(env); }#endif +/* Don't use the cached interupt_request value, +do_interrupt may have updated the EXITTB flag. */ if (env->interrupt_request &CPU_INTERRUPT_EXITTB ) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB ;/* ensure that no TB jump will be modified as
Index: target-mips/helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-mips/helper.c,v retrieving revision 1.8
helper.c +0 -2
@@ -220,7 +219,6 @@ int cpu_mips_handle_mmu_fault (CPUState exception =EXCP_TLBS ; else exception =EXCP_TLBL ; - error_code =0 ;break ;case -4 :/* TLB match but 'D' bit is cleared */
@@ -350,7 +349,6 @@ void do_interrupt (CPUState *env) cause =4 ; goto set_EPC;case EXCP_TLBL : -case EXCP_TLBF : cause =2 ;if (env->error_code ==1 && !(env->hflags &MIPS_HFLAG_EXL )) offset =0x000 ;