summaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-10-12 22:01:28 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-10-12 22:01:28 +0000
commit0d1a29f9fcd161b07a02b9256446235208d379ca (patch)
tree62c3841130c90348615724e92d30d19fe520e8ea /cpu-exec.c
parentb8b5ac63765360aacf356fb2a488c8bbfe59c286 (diff)
downloadqemu-0d1a29f9fcd161b07a02b9256446235208d379ca.tar.gz
correct handling of saved host registers
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1122 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 5229eaa895..b98c22c58e 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -123,37 +123,30 @@ int cpu_exec(CPUState *env1)
#if defined(TARGET_I386)
#ifdef reg_EAX
saved_EAX = EAX;
- EAX = env->regs[R_EAX];
#endif
#ifdef reg_ECX
saved_ECX = ECX;
- ECX = env->regs[R_ECX];
#endif
#ifdef reg_EDX
saved_EDX = EDX;
- EDX = env->regs[R_EDX];
#endif
#ifdef reg_EBX
saved_EBX = EBX;
- EBX = env->regs[R_EBX];
#endif
#ifdef reg_ESP
saved_ESP = ESP;
- ESP = env->regs[R_ESP];
#endif
#ifdef reg_EBP
saved_EBP = EBP;
- EBP = env->regs[R_EBP];
#endif
#ifdef reg_ESI
saved_ESI = ESI;
- ESI = env->regs[R_ESI];
#endif
#ifdef reg_EDI
saved_EDI = EDI;
- EDI = env->regs[R_EDI];
#endif
-
+
+ env_to_regs();
/* put eflags in CPU temporary format */
CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
DF = 1 - (2 * ((env->eflags >> 10) & 1));
@@ -353,6 +346,8 @@ int cpu_exec(CPUState *env1)
spin_lock(&tb_lock);
tb_invalidated_flag = 0;
+
+ regs_to_env(); /* XXX: do it just before cpu_gen_code() */
/* find translated block using physical mappings */
phys_pc = get_phys_addr_code(env, (unsigned long)pc);
@@ -556,6 +551,7 @@ int cpu_exec(CPUState *env1)
#endif
}
} else {
+ env_to_regs();
}
} /* for(;;) */