From owner-svn-src-head@freebsd.org Tue Jan 19 08:04:03 2016 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 E2857A88E79; Tue, 19 Jan 2016 08:04:03 +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 AF7641D13; Tue, 19 Jan 2016 08:04:03 +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 u0J842wn098055; Tue, 19 Jan 2016 08:04:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0J842uu098054; Tue, 19 Jan 2016 08:04:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201601190804.u0J842uu098054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 19 Jan 2016 08:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294311 - head/sys/amd64/amd64 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.20 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: Tue, 19 Jan 2016 08:04:04 -0000 Author: kib Date: Tue Jan 19 08:04:02 2016 New Revision: 294311 URL: https://svnweb.freebsd.org/changeset/base/294311 Log: Clear whole XMM register file instead of only XMM0. Also clear x87 registers. This brings amd64 on par with i386, providing consistent initial FPU state. Note that we do not clear any extended state, at least because kernel does not understand extended state structure and consequences of zero overwrite after fninit()/fpusave(). Submitted by: joss.upton@yahoo.com PR: 206370 MFC after: 2 weeks Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Tue Jan 19 06:07:39 2016 (r294310) +++ head/sys/amd64/amd64/fpu.c Tue Jan 19 08:04:02 2016 (r294311) @@ -318,13 +318,15 @@ fpuinitstate(void *arg __unused) cpu_mxcsr_mask = 0xFFBF; /* - * The fninit instruction does not modify XMM registers. The - * fpusave call dumped the garbage contained in the registers - * after reset to the initial state saved. Clear XMM - * registers file image to make the startup program state and - * signal handler XMM register content predictable. + * The fninit instruction does not modify XMM registers or x87 + * registers (MM/ST). The fpusave call dumped the garbage + * contained in the registers after reset to the initial state + * saved. Clear XMM and x87 registers file image to make the + * startup program state and signal handler XMM/x87 register + * content predictable. */ - bzero(&fpu_initialstate->sv_xmm[0], sizeof(struct xmmacc)); + bzero(fpu_initialstate->sv_fp, sizeof(fpu_initialstate->sv_fp)); + bzero(fpu_initialstate->sv_xmm, sizeof(fpu_initialstate->sv_xmm)); /* * Create a table describing the layout of the CPU Extended