Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jun 2017 13:53:48 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r320309 - stable/11/sys/i386/isa
Message-ID:  <201706241353.v5ODrmhP037449@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Jun 24 13:53:47 2017
New Revision: 320309
URL: https://svnweb.freebsd.org/changeset/base/320309

Log:
  MFC r320051:
  Correct translations between abridged and full x87 tags.
  
  Approved by:	re (marius)

Modified:
  stable/11/sys/i386/isa/npx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/i386/isa/npx.c
==============================================================================
--- stable/11/sys/i386/isa/npx.c	Sat Jun 24 11:38:31 2017	(r320308)
+++ stable/11/sys/i386/isa/npx.c	Sat Jun 24 13:53:47 2017	(r320309)
@@ -1116,7 +1116,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);
 	}
 }
 
@@ -1147,11 +1147,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;
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706241353.v5ODrmhP037449>