summaryrefslogtreecommitdiff
path: root/translate-all.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-04-28 00:32:32 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-04-28 00:32:32 +0000
commitd2856f1ad4c259e5766847c49acbb4e390731bd4 (patch)
treea6d87e5188c9951cb9e5c13b58eac28d34755fc0 /translate-all.c
parent923e5e339f16d55109a75e3f99a2c668571cc58b (diff)
Factorize code in translate.c
(Glauber Costa) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4274 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'translate-all.c')
-rw-r--r--translate-all.c96
1 files changed, 1 insertions, 95 deletions
diff --git a/translate-all.c b/translate-all.c
index d16d218f3c..cf8cc9bff0 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -194,102 +194,8 @@ int cpu_restore_state(TranslationBlock *tb,
/* now find start of instruction before */
while (gen_opc_instr_start[j] == 0)
j--;
-#if defined(TARGET_I386)
- {
- int cc_op;
-#ifdef DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_OP) {
- int i;
- fprintf(logfile, "RESTORE:\n");
- for(i=0;i<=j; i++) {
- if (gen_opc_instr_start[i]) {
- fprintf(logfile, "0x%04x: " TARGET_FMT_lx "\n", i, gen_opc_pc[i]);
- }
- }
- fprintf(logfile, "spc=0x%08lx j=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n",
- searched_pc, j, gen_opc_pc[j] - tb->cs_base,
- (uint32_t)tb->cs_base);
- }
-#endif
- env->eip = gen_opc_pc[j] - tb->cs_base;
- cc_op = gen_opc_cc_op[j];
- if (cc_op != CC_OP_DYNAMIC)
- env->cc_op = cc_op;
- }
-#elif defined(TARGET_ARM)
- env->regs[15] = gen_opc_pc[j];
-#elif defined(TARGET_SPARC)
- {
- target_ulong npc;
- env->pc = gen_opc_pc[j];
- npc = gen_opc_npc[j];
- if (npc == 1) {
- /* dynamic NPC: already stored */
- } else if (npc == 2) {
- target_ulong t2 = (target_ulong)(unsigned long)puc;
- /* jump PC: use T2 and the jump targets of the translation */
- if (t2)
- env->npc = gen_opc_jump_pc[0];
- else
- env->npc = gen_opc_jump_pc[1];
- } else {
- env->npc = npc;
- }
- }
-#elif defined(TARGET_PPC)
- {
- int type, c;
- /* for PPC, we need to look at the micro operation to get the
- access type */
- env->nip = gen_opc_pc[j];
- c = gen_opc_buf[j];
- switch(c) {
-#if defined(CONFIG_USER_ONLY)
-#define CASE3(op)\
- case INDEX_op_ ## op ## _raw
-#else
-#define CASE3(op)\
- case INDEX_op_ ## op ## _user:\
- case INDEX_op_ ## op ## _kernel:\
- case INDEX_op_ ## op ## _hypv
-#endif
- CASE3(stfd):
- CASE3(stfs):
- CASE3(lfd):
- CASE3(lfs):
- type = ACCESS_FLOAT;
- break;
- CASE3(lwarx):
- type = ACCESS_RES;
- break;
- CASE3(stwcx):
- type = ACCESS_RES;
- break;
- CASE3(eciwx):
- CASE3(ecowx):
- type = ACCESS_EXT;
- break;
- default:
- type = ACCESS_INT;
- break;
- }
- env->access_type = type;
- }
-#elif defined(TARGET_M68K)
- env->pc = gen_opc_pc[j];
-#elif defined(TARGET_MIPS)
- env->PC[env->current_tc] = gen_opc_pc[j];
- env->hflags &= ~MIPS_HFLAG_BMASK;
- env->hflags |= gen_opc_hflags[j];
-#elif defined(TARGET_ALPHA)
- env->pc = gen_opc_pc[j];
-#elif defined(TARGET_SH4)
- env->pc = gen_opc_pc[j];
- env->flags = gen_opc_hflags[j];
-#elif defined(TARGET_CRIS)
- env->pregs[PR_ERP] = gen_opc_pc[j];
-#endif
+ gen_pc_load(env, tb, searched_pc, j, puc);
#ifdef CONFIG_PROFILER
dyngen_restore_time += profile_getclock() - ti;