aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-02-21 17:20:17 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-02-25 09:18:01 +0100
commit93c3593ad04f2610fd0a176dfa89a7e40b6afe1f (patch)
treeec2a66d9b003ce146f45e20bdccdd5d8985d8d0e
parentcce8944cc9efab47d4bf29cfffb3470371c3541b (diff)
downloadqemu-arm-93c3593ad04f2610fd0a176dfa89a7e40b6afe1f.tar.gz
target/i386: check for empty register in FXAM
The fxam instruction returns the wrong result after fdecstp or after an underflow. Check fptags to handle this. Reported-by: <chengang@emindsoft.com.cn> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--target/i386/fpu_helper.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c
index 99f28f267f..792a128a6d 100644
--- a/target/i386/fpu_helper.c
+++ b/target/i386/fpu_helper.c
@@ -991,7 +991,11 @@ void helper_fxam_ST0(CPUX86State *env)
env->fpus |= 0x200; /* C1 <-- 1 */
}
- /* XXX: test fptags too */
+ if (env->fptags[env->fpstt]) {
+ env->fpus |= 0x4100; /* Empty */
+ return;
+ }
+
expdif = EXPD(temp);
if (expdif == MAXEXPD) {
if (MANTD(temp) == 0x8000000000000000ULL) {