diff options
author | kib <kib@FreeBSD.org> | 2015-07-10 09:20:13 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-07-10 09:20:13 +0000 |
commit | 04c0ab7814347e46757a387cae991a572fbf6bee (patch) | |
tree | c2fdb3fd1c2d5fbeb4a6b9063da75f4213cf34ca /sys/i386/isa | |
parent | a4e4a26325ac61419a28d06fb279232cc0aebe73 (diff) | |
download | FreeBSD-src-04c0ab7814347e46757a387cae991a572fbf6bee.zip FreeBSD-src-04c0ab7814347e46757a387cae991a572fbf6bee.tar.gz |
Convert between abridged (from FXSAVE) and unabridged (from FSAVE)
versions of the x87 tags. The conversion is naive, used abridged tag
is converted to valid unabridged, without additional checks for zero
and special values.
Noted by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/npx.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index d3cd628..ed21a18 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -1173,16 +1173,20 @@ npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct save87 *sv_87) /* FPU control/status */ penv_87->en_cw = penv_xmm->en_cw; penv_87->en_sw = penv_xmm->en_sw; - penv_87->en_tw = penv_xmm->en_tw; penv_87->en_fip = penv_xmm->en_fip; penv_87->en_fcs = penv_xmm->en_fcs; penv_87->en_opcode = penv_xmm->en_opcode; penv_87->en_foo = penv_xmm->en_foo; penv_87->en_fos = penv_xmm->en_fos; - /* FPU registers */ - for (i = 0; i < 8; ++i) + /* FPU registers and tags */ + penv_87->en_tw = 0xffff; + for (i = 0; i < 8; ++i) { 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); + } } void @@ -1206,16 +1210,19 @@ npx_set_fpregs_xmm(struct save87 *sv_87, struct savexmm *sv_xmm) /* FPU control/status */ penv_xmm->en_cw = penv_87->en_cw; penv_xmm->en_sw = penv_87->en_sw; - penv_xmm->en_tw = penv_87->en_tw; penv_xmm->en_fip = penv_87->en_fip; penv_xmm->en_fcs = penv_87->en_fcs; penv_xmm->en_opcode = penv_87->en_opcode; penv_xmm->en_foo = penv_87->en_foo; penv_xmm->en_fos = penv_87->en_fos; - /* FPU registers */ - for (i = 0; i < 8; ++i) + /* FPU registers and tags */ + 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)) + penv_xmm->en_tw |= 1 << i; + } } #endif /* CPU_ENABLE_SSE */ |