From owner-svn-src-stable@freebsd.org Sat Jul 1 03:38:14 2017 Return-Path: Delivered-To: svn-src-stable@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 4BA64DA5D24; Sat, 1 Jul 2017 03:38:14 +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 141AD65CF4; Sat, 1 Jul 2017 03:38:14 +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 v613cDB1081349; Sat, 1 Jul 2017 03:38:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v613cDDT081348; Sat, 1 Jul 2017 03:38:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707010338.v613cDDT081348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 1 Jul 2017 03:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320525 - stable/10/sys/amd64/ia32 X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/amd64/ia32 X-SVN-Commit-Revision: 320525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jul 2017 03:38:14 -0000 Author: kib Date: Sat Jul 1 03:38:12 2017 New Revision: 320525 URL: https://svnweb.freebsd.org/changeset/base/320525 Log: MFC r320308: Translate between abridged and full x87 tags for compat32 ptrace(PT_GETFPREGS). Modified: stable/10/sys/amd64/ia32/ia32_reg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/ia32/ia32_reg.c ============================================================================== --- stable/10/sys/amd64/ia32/ia32_reg.c Sat Jul 1 03:33:26 2017 (r320524) +++ stable/10/sys/amd64/ia32/ia32_reg.c Sat Jul 1 03:38:12 2017 (r320525) @@ -156,7 +156,7 @@ fill_fpregs32(struct thread *td, struct fpreg32 *regs) /* 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; + /* * XXX for en_fip/fcs/foo/fos, check if the fxsave format * uses the old-style layout for 32 bit user apps. If so, @@ -170,9 +170,13 @@ fill_fpregs32(struct thread *td, struct fpreg32 *regs) /* Entry into the kernel always sets TF_HASSEGS */ penv_87->en_fos = td->td_frame->tf_ds; - /* 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_fpu->sv_fp[i].fp_acc; + if ((penv_xmm->en_tw & (1 << i)) != 0) + penv_87->en_tw &= ~(3 << i * 2); + } return (0); } @@ -189,15 +193,19 @@ set_fpregs32(struct thread *td, struct fpreg32 *regs) /* 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_rip = penv_87->en_fip; /* penv_87->en_fcs and en_fos ignored, see above */ penv_xmm->en_opcode = penv_87->en_opcode; penv_xmm->en_rdp = penv_87->en_foo; - /* FPU registers */ - for (i = 0; i < 8; ++i) + /* FPU registers and tags */ + penv_xmm->en_tw = 0; + for (i = 0; i < 8; ++i) { sv_fpu->sv_fp[i].fp_acc = sv_87->sv_ac[i]; + if ((penv_87->en_tw & (3 << i * 2)) != (3 << i * 2)) + penv_xmm->en_tw |= 1 << i; + } + for (i = 8; i < 16; ++i) bzero(&sv_fpu->sv_fp[i].fp_acc, sizeof(sv_fpu->sv_fp[i].fp_acc)); fpuuserinited(td);