Date: Fri, 10 Jul 2015 09:20:14 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285355 - head/sys/i386/isa Message-ID: <201507100920.t6A9KEBQ049180@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Jul 10 09:20:13 2015 New Revision: 285355 URL: https://svnweb.freebsd.org/changeset/base/285355 Log: 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 Modified: head/sys/i386/isa/npx.c Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Fri Jul 10 09:15:06 2015 (r285354) +++ head/sys/i386/isa/npx.c Fri Jul 10 09:20:13 2015 (r285355) @@ -1173,16 +1173,20 @@ npx_fill_fpregs_xmm1(struct savexmm *sv_ /* 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, /* 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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507100920.t6A9KEBQ049180>