summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2017-06-24 13:53:47 +0000
committerkib <kib@FreeBSD.org>2017-06-24 13:53:47 +0000
commit995f49bb5e121ad64c21dd018444b798c497d3b0 (patch)
tree2a514b122e31b899216f265c46c4ecadac45684c
parenta96e151cf2d921e0adbd43ca7feee26dc8f286fc (diff)
downloadFreeBSD-src-995f49bb5e121ad64c21dd018444b798c497d3b0.zip
FreeBSD-src-995f49bb5e121ad64c21dd018444b798c497d3b0.tar.gz
MFC r320051:
Correct translations between abridged and full x87 tags. Approved by: re (marius)
-rw-r--r--sys/i386/isa/npx.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index a12507e..1d9d0ab 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -1116,7 +1116,7 @@ npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct save87 *sv_87)
sv_87->sv_ac[i] = sv_xmm->sv_fp[i].fp_acc;
if ((penv_xmm->en_tw & (1 << i)) != 0)
/* zero and special are set as valid */
- penv_87->en_tw &= ~(3 << i);
+ penv_87->en_tw &= ~(3 << i * 2);
}
}
@@ -1147,11 +1147,16 @@ npx_set_fpregs_xmm(struct save87 *sv_87, struct savexmm *sv_xmm)
penv_xmm->en_foo = penv_87->en_foo;
penv_xmm->en_fos = penv_87->en_fos;
- /* FPU registers and tags */
+ /*
+ * FPU registers and tags.
+ * Abridged / Full translation (values in binary), see FXSAVE spec.
+ * 0 11
+ * 1 00, 01, 10
+ */
penv_xmm->en_tw = 0;
for (i = 0; i < 8; ++i) {
sv_xmm->sv_fp[i].fp_acc = sv_87->sv_ac[i];
- if ((penv_87->en_tw && (3 << i)) != (3 << i))
+ if ((penv_87->en_tw & (3 << i * 2)) != (3 << i * 2))
penv_xmm->en_tw |= 1 << i;
}
}
OpenPOWER on IntegriCloud