[PATCH 06/10] mips: replace code inside ifdef with generic function

Glauber Costa
2008-04-25T03:23:06Z

target-mips/translate.c | 8 ++++++++
translate-all.c | 4 +---
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index 65f0ba9..46b917e 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -6942,3 +6942,11 @@ void cpu_reset (CPUMIPSState *env)
#endif
cpu_mips_register(env, env->cpu_model);
}
+
+void gen_pc_load(CPUState *env, TranslationBlock *tb,
+ unsigned long searched_pc, int pc_pos, void *puc)
+{
+ env->PC[env->current_tc] = gen_opc_pc[pc_pos];
+ env->hflags &= ~MIPS_HFLAG_BMASK;
+ env->hflags |= gen_opc_hflags[pc_pos];
+}
diff --git a/translate-all.c b/translate-all.c
index 5e63978..d2408f6 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -204,9 +204,7 @@ int cpu_restore_state(TranslationBlock *tb,
#elif defined(TARGET_M68K)
gen_pc_load(env, tb, searched_pc, j, puc);
#elif defined(TARGET_MIPS)
- env->PC[env->current_tc] = gen_opc_pc[j];
- env->hflags &= ~MIPS_HFLAG_BMASK;
- env->hflags |= gen_opc_hflags[j];
+ gen_pc_load(env, tb, searched_pc, j, puc);
#elif defined(TARGET_ALPHA)
env->pc = gen_opc_pc[j];
#elif defined(TARGET_SH4)