From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCszc-0007d8-2i for qemu-devel@nongnu.org; Thu, 31 Jul 2014 12:14:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCszX-0007vd-4Z for qemu-devel@nongnu.org; Thu, 31 Jul 2014 12:14:12 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:51166 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCszW-0007vX-Ua for qemu-devel@nongnu.org; Thu, 31 Jul 2014 12:14:07 -0400 References: <20140731125321.1600.46604.stgit@PASHA-ISP.novsu.ac.ru> <20140731125457.1600.69049.stgit@PASHA-ISP.novsu.ac.ru> From: Alex =?utf-8?Q?Benn=C3=A9e?= Date: Thu, 31 Jul 2014 17:12:42 +0100 In-reply-to: <20140731125457.1600.69049.stgit@PASHA-ISP.novsu.ac.ru> Message-ID: <87k36tijzq.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC PATCH v3 16/49] target-i386: update fp status fix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, real@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com Pavel Dovgalyuk writes: > This patch adds calls to update_fp_status() function from several > places where FPU state is changed. > > Signed-off-by: Pavel Dovgalyuk > --- > target-i386/cpu.c | 1 + > target-i386/cpu.h | 1 + > target-i386/fpu_helper.c | 5 ++++- > target-i386/machine.c | 2 +- > 4 files changed, 7 insertions(+), 2 deletions(-) Hmm I wonder if this function should be renamed. It seems to be more about ensuring the softfloat library is correctly configured according to the emulated CPU configuration. > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 6d008ab..906d7d7 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2573,6 +2573,7 @@ static void x86_cpu_reset(CPUState *s) > env->fptags[i] = 1; > } > env->fpuc = 0x37f; > + update_fp_status(env); > > env->mxcsr = 0x1f80; > env->xstate_bv = XSTATE_FP | XSTATE_SSE; > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > index e634d83..42bda46 100644 > --- a/target-i386/cpu.h > +++ b/target-i386/cpu.h > @@ -1249,6 +1249,7 @@ void QEMU_NORETURN raise_interrupt(CPUX86State *nenv, int intno, int is_int, > /* cc_helper.c */ > extern const uint8_t parity_table[256]; > uint32_t cpu_cc_compute_all(CPUX86State *env1, int op); > +void update_fp_status(CPUX86State *env); > > static inline uint32_t cpu_compute_eflags(CPUX86State *env) > { > diff --git a/target-i386/fpu_helper.c b/target-i386/fpu_helper.c > index 1b2900d..a8ffba9 100644 > --- a/target-i386/fpu_helper.c > +++ b/target-i386/fpu_helper.c > @@ -537,7 +537,7 @@ uint32_t helper_fnstcw(CPUX86State *env) > return env->fpuc; > } > > -static void update_fp_status(CPUX86State *env) > +void update_fp_status(CPUX86State *env) > { > int rnd_type; > > @@ -1006,6 +1006,7 @@ void helper_fstenv(CPUX86State *env, target_ulong ptr, int data32) > cpu_stw_data(env, ptr + 10, 0); > cpu_stw_data(env, ptr + 12, 0); > } > + update_fp_status(env); > } > > void helper_fldenv(CPUX86State *env, target_ulong ptr, int data32) > @@ -1055,6 +1056,7 @@ void helper_fsave(CPUX86State *env, target_ulong ptr, int data32) > env->fptags[5] = 1; > env->fptags[6] = 1; > env->fptags[7] = 1; > + update_fp_status(env); > } > > void helper_frstor(CPUX86State *env, target_ulong ptr, int data32) > @@ -1158,6 +1160,7 @@ void helper_fxrstor(CPUX86State *env, target_ulong ptr, int data64) > } > > env->fpuc = cpu_lduw_data(env, ptr); > + update_fp_status(env); > fpus = cpu_lduw_data(env, ptr + 2); > fptag = cpu_lduw_data(env, ptr + 4); > env->fpstt = (fpus >> 11) & 7; > diff --git a/target-i386/machine.c b/target-i386/machine.c > index 16d2f6a..2922c97 100644 > --- a/target-i386/machine.c > +++ b/target-i386/machine.c > @@ -315,13 +315,13 @@ static int cpu_post_load(void *opaque, int version_id) > env->hflags &= ~HF_CPL_MASK; > env->hflags |= (env->segs[R_SS].flags >> DESC_DPL_SHIFT) & HF_CPL_MASK; > > - /* XXX: restore FPU round state */ > env->fpstt = (env->fpus_vmstate >> 11) & 7; > env->fpus = env->fpus_vmstate & ~0x3800; > env->fptag_vmstate ^= 0xff; > for(i = 0; i < 8; i++) { > env->fptags[i] = (env->fptag_vmstate >> i) & 1; > } > + update_fp_status(env); > > cpu_breakpoint_remove_all(cs, BP_CPU); > cpu_watchpoint_remove_all(cs, BP_CPU); -- Alex Bennée