From owner-svn-src-all@FreeBSD.ORG Wed Jan 19 20:55:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51D3A10657CE; Wed, 19 Jan 2011 20:55:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 7F6B68FC27; Wed, 19 Jan 2011 20:55:17 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p0JKtDNm020716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Jan 2011 22:55:13 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p0JKtDsX020115; Wed, 19 Jan 2011 22:55:13 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p0JKtDJk020114; Wed, 19 Jan 2011 22:55:13 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 19 Jan 2011 22:55:13 +0200 From: Kostik Belousov To: Jung-uk Kim Message-ID: <20110119205513.GC2518@deviant.kiev.zoral.com.ua> References: <201101191709.p0JH97ZD083132@svn.freebsd.org> <20110119171807.GA2518@deviant.kiev.zoral.com.ua> <201101191311.03440.jkim@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bCKTTGDksHH4MFjj" Content-Disposition: inline In-Reply-To: <201101191311.03440.jkim@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r217587 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 19 Jan 2011 20:55:18 -0000 --bCKTTGDksHH4MFjj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 19, 2011 at 01:11:01PM -0500, Jung-uk Kim wrote: > On Wednesday 19 January 2011 12:18 pm, Kostik Belousov wrote: > > On Wed, Jan 19, 2011 at 05:09:07PM +0000, Jung-uk Kim wrote: > > > Author: jkim > > > Date: Wed Jan 19 17:09:07 2011 > > > New Revision: 217587 > > > URL: http://svn.freebsd.org/changeset/base/217587 > > > > > > Log: > > > Fix yet another fallout from r208833. VM86 BIOS call may cause > > > page fault when FPU is in use. > > > > > > Reported by: Marc UBM Bocklet (ubm dot freebsd at googlemail > > > dot com) Tested by: b. f. (bf1783 at googlemail dot com) > > > MFC after: 3 days > > > > > > Modified: > > > head/sys/i386/i386/vm86bios.s > > > > > > Modified: head/sys/i386/i386/vm86bios.s > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head/sys/i386/i386/vm86bio= s.s Wed Jan 19 > > > 17:04:07 2011 (r217586) +++ head/sys/i386/i386/vm86bios.s Wed Jan > > > 19 17:09:07 2011 (r217587) @@ -73,10 +73,9 @@ > > > ENTRY(vm86_bioscall) > > > je 1f /* no curproc/npxproc */ > > > pushl %edx > > > movl TD_PCB(%ecx),%ecx > > > - addl $PCB_SAVEFPU,%ecx > > > - pushl %ecx > > > + pushl PCB_SAVEFPU(%ecx) > > > call npxsave > > > - popl %ecx > > > + addl $4,%esp > > > popl %edx /* recover our pcb */ > > > 1: > > > popfl > > > > vm86_bioscall() in fact inlines the old version of npxexit(). > > Shouldn't the npxexit() be called from C code before call to > > vm86_bioscall ? >=20 > I think we can but I don't like redundant or nested uses of=20 > critical_enter()/critical_exit() from vm86_intcall()/vm86_datacall(). =20 Well, direct use of cli is worse, IMO. > And I don't think that's worth the code churn. 'Code churn' would remove hand-translated assembly code by calling equivalent C version. But due to issue below, I think this fragment should be removed at all. >=20 > > Also, if bioscall can be used from the syscall context, I think > > whatever npxsave()/npxexit() is used, and BIOS modifies FPU > > state, we are corrupting usermode FPU context. > > > > Probably, fpu_kern_enter()/fpu_kern_leave() braces around > > vm86_bioscall is proper solution. >=20 > BIOS should never modify FPU state, AFAIK. I believe Peter Holm still possesses the machine with quite amuzing habit to panic sometimes during early boot, since int 12 (?) BIOS handler tries to execute some FPU instruction and kernel has to panic since device not present fault handler is not yet established. Simply put, we cannot trust BIOS. --bCKTTGDksHH4MFjj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk03T7EACgkQC3+MBN1Mb4i0XACghOyZN7VsNHUmRzrRMSIGBEha t+oAmgNulwxXwNFAPhO8rP4U1fzDdUVf =FqMb -----END PGP SIGNATURE----- --bCKTTGDksHH4MFjj--