[PATCH 08/10] sh4: replace code inside ifdef with generic function

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

target-sh4/translate.c | 7 +++++++
translate-all.c | 3 +--
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index b7c5f8d..1468e7a 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -1302,3 +1302,10 @@ int gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb)
{
return gen_intermediate_code_internal(env, tb, 1);
}
+
+void gen_pc_load(CPUState *env, TranslationBlock *tb,
+ unsigned long searched_pc, int pc_pos, void *puc)
+{
+ env->pc = gen_opc_pc[pc_pos];
+ env->flags = gen_opc_hflags[pc_pos];
+}
diff --git a/translate-all.c b/translate-all.c
index bcad1f4..401969c 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -208,8 +208,7 @@ int cpu_restore_state(TranslationBlock *tb,
#elif defined(TARGET_ALPHA)
gen_pc_load(env, tb, searched_pc, j, puc);
#elif defined(TARGET_SH4)
- env->pc = gen_opc_pc[j];
- env->flags = gen_opc_hflags[j];
+ gen_pc_load(env, tb, searched_pc, j, puc);
#elif defined(TARGET_CRIS)
env->pregs[PR_ERP] = gen_opc_pc[j];
#endif