From owner-svn-src-all@freebsd.org Fri Jul 10 09:20:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB4EF9967E0; Fri, 10 Jul 2015 09:20:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75EB38D8; Fri, 10 Jul 2015 09:20:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6A9KE7M049181; Fri, 10 Jul 2015 09:20:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6A9KEBQ049180; Fri, 10 Jul 2015 09:20:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507100920.t6A9KEBQ049180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Jul 2015 09:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285355 - head/sys/i386/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2015 09:20:14 -0000 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 */