From e87b7cb0f0e04d7c4510564530ab00ed4db37a45 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 18 Apr 2011 06:39:52 +0000 Subject: Remove unused function parameters from gen_pc_load and rename the function Function gen_pc_load was introduced in commit d2856f1ad4c259e5766847c49acbb4e390731bd4. The only reason for parameter searched_pc was a debug statement in target-i386/translate.c. Parameter puc was needed by target-sparc until commit d7da2a10402f1644128b66414ca8f86bdea9ae7c. Remove searched_pc from the debug statement and remove both parameters from the parameter list of gen_pc_load. As the function name gen_pc_load was also misleading, it is now called restore_state_to_opc. This new name was suggested by Peter Maydell, thanks. v2: Remove last parameter, too, and rename the function. v3: Fix [] typo in target-arm/translate.c. Fix wrong SHA1 object name in commit message (copy+paste error). Cc: Aurelien Jarno Reviewed-by: Peter Maydell Signed-off-by: Stefan Weil --- target-lm32/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'target-lm32') diff --git a/target-lm32/translate.c b/target-lm32/translate.c index efc9b5a85..51b4f5a81 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -1212,8 +1212,7 @@ void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf, cpu_fprintf(f, "\n\n"); } -void gen_pc_load(CPUState *env, struct TranslationBlock *tb, - unsigned long searched_pc, int pc_pos, void *puc) +void restore_state_to_opc(CPUState *env, TranslationBlock *tb, int pc_pos) { env->pc = gen_opc_pc[pc_pos]; } -- cgit v1.2.3 From 618ba8e6a1313df6a8366ac8ffee47e3f885ac90 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 18 Apr 2011 06:39:53 +0000 Subject: Remove unused function parameter from cpu_restore_state The previous patch removed the need for parameter puc. Is is now unused, so remove it. Cc: Aurelien Jarno Reviewed-by: Peter Maydell Signed-off-by: Stefan Weil --- cpu-exec.c | 2 +- exec-all.h | 3 +-- exec.c | 9 ++++----- target-alpha/op_helper.c | 2 +- target-arm/op_helper.c | 2 +- target-cris/op_helper.c | 2 +- target-i386/op_helper.c | 2 +- target-lm32/op_helper.c | 2 +- target-m68k/op_helper.c | 2 +- target-microblaze/op_helper.c | 2 +- target-mips/op_helper.c | 4 ++-- target-ppc/op_helper.c | 2 +- target-s390x/op_helper.c | 2 +- target-sh4/op_helper.c | 2 +- target-sparc/op_helper.c | 2 +- translate-all.c | 3 +-- 16 files changed, 20 insertions(+), 23 deletions(-) (limited to 'target-lm32') diff --git a/cpu-exec.c b/cpu-exec.c index d57afef64..395cd8cf9 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -808,7 +808,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, puc); + cpu_restore_state(tb, env, pc); } /* we restore the process signal mask as the sigreturn should diff --git a/exec-all.h b/exec-all.h index 29fd32234..7c2d29ff9 100644 --- a/exec-all.h +++ b/exec-all.h @@ -84,8 +84,7 @@ void cpu_gen_init(void); int cpu_gen_code(CPUState *env, struct TranslationBlock *tb, int *gen_code_size_ptr); int cpu_restore_state(struct TranslationBlock *tb, - CPUState *env, unsigned long searched_pc, - void *puc); + CPUState *env, unsigned long searched_pc); void cpu_resume_from_signal(CPUState *env1, void *puc); void cpu_io_recompile(CPUState *env, void *retaddr); TranslationBlock *tb_gen_code(CPUState *env, diff --git a/exec.c b/exec.c index b1ee52a4d..c3dc68ae0 100644 --- a/exec.c +++ b/exec.c @@ -1070,8 +1070,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, restore the CPU state */ current_tb_modified = 1; - cpu_restore_state(current_tb, env, - env->mem_io_pc, NULL); + cpu_restore_state(current_tb, env, env->mem_io_pc); cpu_get_tb_cpu_state(env, ¤t_pc, ¤t_cs_base, ¤t_flags); } @@ -1179,7 +1178,7 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr, restore the CPU state */ current_tb_modified = 1; - cpu_restore_state(current_tb, env, pc, puc); + cpu_restore_state(current_tb, env, pc); cpu_get_tb_cpu_state(env, ¤t_pc, ¤t_cs_base, ¤t_flags); } @@ -3266,7 +3265,7 @@ static void check_watchpoint(int offset, int len_mask, int flags) cpu_abort(env, "check_watchpoint: could not find TB for " "pc=%p", (void *)env->mem_io_pc); } - cpu_restore_state(tb, env, env->mem_io_pc, NULL); + cpu_restore_state(tb, env, env->mem_io_pc); tb_phys_invalidate(tb, -1); if (wp->flags & BP_STOP_BEFORE_ACCESS) { env->exception_index = EXCP_DEBUG; @@ -4301,7 +4300,7 @@ void cpu_io_recompile(CPUState *env, void *retaddr) retaddr); } n = env->icount_decr.u16.low + tb->icount; - cpu_restore_state(tb, env, (unsigned long)retaddr, NULL); + cpu_restore_state(tb, env, (unsigned long)retaddr); /* Calculate how many instructions had been executed before the fault occurred. */ n = n - env->icount_decr.u16.low; diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c index 9f71db4c3..4ccb10b0f 100644 --- a/target-alpha/op_helper.c +++ b/target-alpha/op_helper.c @@ -1374,7 +1374,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (likely(tb)) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } /* Exception index and error code are already set */ diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index ee7286b77..8334fbcf6 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -90,7 +90,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } raise_exception(env->exception_index); diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c index be9eb06fd..34329e2a6 100644 --- a/target-cris/op_helper.c +++ b/target-cris/op_helper.c @@ -77,7 +77,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); /* Evaluate flags after retranslation. */ helper_top_evaluate_flags(); diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index a73427fe4..fba536f0f 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -4835,7 +4835,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } raise_exception_err(env->exception_index, env->error_code); diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c index e84ba488b..c72b1df47 100644 --- a/target-lm32/op_helper.c +++ b/target-lm32/op_helper.c @@ -95,7 +95,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } cpu_loop_exit(); diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c index 07111073f..9b13bdbcc 100644 --- a/target-m68k/op_helper.c +++ b/target-m68k/op_helper.c @@ -68,7 +68,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } cpu_loop_exit(); diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c index b7cd6b288..c7b2f97d9 100644 --- a/target-microblaze/op_helper.c +++ b/target-microblaze/op_helper.c @@ -60,7 +60,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } cpu_loop_exit(); diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index 8cba535a3..b8e4991f3 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -54,7 +54,7 @@ static void do_restore_state (void *pc_ptr) tb = tb_find_pc (pc); if (tb) { - cpu_restore_state (tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } #endif @@ -1972,7 +1972,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } helper_raise_exception_err(env->exception_index, env->error_code); diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 28d40ac9a..d5db484b4 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -3741,7 +3741,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (likely(tb)) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } helper_raise_exception_err(env->exception_index, env->error_code); diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c index 402df2d85..be455b9de 100644 --- a/target-s390x/op_helper.c +++ b/target-s390x/op_helper.c @@ -61,7 +61,7 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr) if (likely(tb)) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } /* XXX */ diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index c127860cd..b909d18bc 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c @@ -32,7 +32,7 @@ static void cpu_restore_state_from_retaddr(void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, NULL); + cpu_restore_state(tb, env, pc); } } } diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 854f168c6..ffffb8c0b 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -4375,7 +4375,7 @@ static void cpu_restore_state2(void *retaddr) if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc, (void *)(long)env->cond); + cpu_restore_state(tb, env, pc); } } } diff --git a/translate-all.c b/translate-all.c index 97668b2c8..2ca190ca8 100644 --- a/translate-all.c +++ b/translate-all.c @@ -112,8 +112,7 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr) /* The cpu state corresponding to 'searched_pc' is restored. */ int cpu_restore_state(TranslationBlock *tb, - CPUState *env, unsigned long searched_pc, - void *puc) + CPUState *env, unsigned long searched_pc) { TCGContext *s = &tcg_ctx; int j; -- cgit v1.2.3 From ecbe1de82362e73c2b1111770c4a91b675a6fca2 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Wed, 13 Apr 2011 00:29:33 +0200 Subject: lm32: fix exception handling Global interrupt enable bit is already saved within the exception handler helper routine. Thus remove extra code in translation routines. Additionally, debug exceptions has always DEBA as base address. Signed-off-by: Michael Walle Signed-off-by: Edgar E. Iglesias --- target-lm32/helper.c | 6 +----- target-lm32/translate.c | 26 -------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) (limited to 'target-lm32') diff --git a/target-lm32/helper.c b/target-lm32/helper.c index 318e2cf6e..4f3e7e0fc 100644 --- a/target-lm32/helper.c +++ b/target-lm32/helper.c @@ -76,11 +76,7 @@ void do_interrupt(CPUState *env) env->regs[R_BA] = env->pc; env->ie |= (env->ie & IE_IE) ? IE_BIE : 0; env->ie &= ~IE_IE; - if (env->dc & DC_RE) { - env->pc = env->deba + (env->exception_index * 32); - } else { - env->pc = env->eba + (env->exception_index * 32); - } + env->pc = env->deba + (env->exception_index * 32); log_cpu_state_mask(CPU_LOG_INT, env, 0); break; default: diff --git a/target-lm32/translate.c b/target-lm32/translate.c index 51b4f5a81..bcd52fe73 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -598,36 +598,10 @@ static void dec_scall(DisasContext *dc) t0 = tcg_temp_new(); l1 = gen_new_label(); - /* save IE.IE */ - tcg_gen_andi_tl(t0, cpu_ie, IE_IE); - - /* IE.IE = 0 */ - tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); - if (dc->imm5 == 7) { - /* IE.EIE = IE.IE */ - tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_EIE); - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_IE, l1); - tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_EIE); - gen_set_label(l1); - - /* gpr[ea] = PC */ - tcg_gen_movi_tl(cpu_R[R_EA], dc->pc); - tcg_temp_free(t0); - tcg_gen_movi_tl(cpu_pc, dc->pc); t_gen_raise_exception(dc, EXCP_SYSTEMCALL); } else { - /* IE.BIE = IE.IE */ - tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_BIE); - tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_IE, l1); - tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_BIE); - gen_set_label(l1); - - /* gpr[ba] = PC */ - tcg_gen_movi_tl(cpu_R[R_BA], dc->pc); - tcg_temp_free(t0); - tcg_gen_movi_tl(cpu_pc, dc->pc); t_gen_raise_exception(dc, EXCP_BREAKPOINT); } -- cgit v1.2.3