From 59b09a71bfc6fd8b95357944f6be9aa54f424421 Mon Sep 17 00:00:00 2001 From: mothran Date: Thu, 27 Aug 2015 21:54:23 -0700 Subject: [PATCH] first shot at getting FPIP working, need to remove all FP control instructions from being updated --- qemu/target-i386/fpu_helper.c | 2 +- qemu/target-i386/translate.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qemu/target-i386/fpu_helper.c b/qemu/target-i386/fpu_helper.c index 1d4eee39..fa20b7a1 100644 --- a/qemu/target-i386/fpu_helper.c +++ b/qemu/target-i386/fpu_helper.c @@ -991,7 +991,7 @@ void helper_fstenv(CPUX86State *env, target_ulong ptr, int data32) cpu_stl_data(env, ptr, env->fpuc); cpu_stl_data(env, ptr + 4, fpus); cpu_stl_data(env, ptr + 8, fptag); - cpu_stl_data(env, ptr + 12, 0); /* fpip */ + cpu_stl_data(env, ptr + 12, env->fpip); /* fpip */ cpu_stl_data(env, ptr + 16, 0); /* fpcs */ cpu_stl_data(env, ptr + 20, 0); /* fpoo */ cpu_stl_data(env, ptr + 24, 0); /* fpos */ diff --git a/qemu/target-i386/translate.c b/qemu/target-i386/translate.c index 7ce37ef8..d48ed3c8 100644 --- a/qemu/target-i386/translate.c +++ b/qemu/target-i386/translate.c @@ -248,6 +248,11 @@ static void gen_update_cc_op(DisasContext *s) } } +static void fpu_update_ip(CPUX86State *env) +{ + env->fpip = env->eip; +} + #ifdef TARGET_X86_64 #define NB_OP_SIZES 4 @@ -6065,6 +6070,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); break; } + fpu_update_ip(env); modrm = cpu_ldub_code(env, s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7;