summaryrefslogtreecommitdiff
path: root/target-i386/exec.h
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 /target-i386/exec.h
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 'target-i386/exec.h')
-rw-r--r--target-i386/exec.h57
1 files changed, 56 insertions, 1 deletions
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 680e580b7f..61af5468e7 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -20,7 +20,7 @@
#include "config.h"
#include "dyngen-exec.h"
-/* at least 4 register variables are defines */
+/* at least 4 register variables are defined */
register struct CPUX86State *env asm(AREG0);
register uint32_t T0 asm(AREG1);
register uint32_t T1 asm(AREG2);
@@ -546,3 +546,58 @@ static inline void load_eflags(int eflags, int update_mask)
(eflags & update_mask);
}
+static inline void env_to_regs(void)
+{
+#ifdef reg_EAX
+ EAX = env->regs[R_EAX];
+#endif
+#ifdef reg_ECX
+ ECX = env->regs[R_ECX];
+#endif
+#ifdef reg_EDX
+ EDX = env->regs[R_EDX];
+#endif
+#ifdef reg_EBX
+ EBX = env->regs[R_EBX];
+#endif
+#ifdef reg_ESP
+ ESP = env->regs[R_ESP];
+#endif
+#ifdef reg_EBP
+ EBP = env->regs[R_EBP];
+#endif
+#ifdef reg_ESI
+ ESI = env->regs[R_ESI];
+#endif
+#ifdef reg_EDI
+ EDI = env->regs[R_EDI];
+#endif
+}
+
+static inline void regs_to_env(void)
+{
+#ifdef reg_EAX
+ env->regs[R_EAX] = EAX;
+#endif
+#ifdef reg_ECX
+ env->regs[R_ECX] = ECX;
+#endif
+#ifdef reg_EDX
+ env->regs[R_EDX] = EDX;
+#endif
+#ifdef reg_EBX
+ env->regs[R_EBX] = EBX;
+#endif
+#ifdef reg_ESP
+ env->regs[R_ESP] = ESP;
+#endif
+#ifdef reg_EBP
+ env->regs[R_EBP] = EBP;
+#endif
+#ifdef reg_ESI
+ env->regs[R_ESI] = ESI;
+#endif
+#ifdef reg_EDI
+ env->regs[R_EDI] = EDI;
+#endif
+}