From owner-svn-src-head@freebsd.org Sat Jun 17 11:25:32 2017 Return-Path: Delivered-To: svn-src-head@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 96E8BBF8803; Sat, 17 Jun 2017 11:25:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 550CE66239; Sat, 17 Jun 2017 11:25:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5HBPV62018604; Sat, 17 Jun 2017 11:25:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5HBPVIV018603; Sat, 17 Jun 2017 11:25:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706171125.v5HBPVIV018603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 17 Jun 2017 11:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320051 - 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jun 2017 11:25:32 -0000 Author: kib Date: Sat Jun 17 11:25:31 2017 New Revision: 320051 URL: https://svnweb.freebsd.org/changeset/base/320051 Log: Correct translations between abridged and full x87 tags. Reported and tested by: karnajit wangkhem 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 Sat Jun 17 07:36:46 2017 (r320050) +++ head/sys/i386/isa/npx.c Sat Jun 17 11:25:31 2017 (r320051) @@ -1108,7 +1108,7 @@ npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct sa 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); } } @@ -1139,11 +1139,16 @@ npx_set_fpregs_xmm(struct save87 *sv_87, struct savexm 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; } }