From owner-svn-src-all@FreeBSD.ORG Wed Jun 23 12:17:13 2010 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 A39411065679; Wed, 23 Jun 2010 12:17:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 920328FC17; Wed, 23 Jun 2010 12:17:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5NCHD8E062367; Wed, 23 Jun 2010 12:17:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5NCHDJ8062363; Wed, 23 Jun 2010 12:17:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006231217.o5NCHDJ8062363@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 23 Jun 2010 12:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209463 - in head/sys: amd64/amd64 i386/i386 pc98/pc98 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, 23 Jun 2010 12:17:13 -0000 Author: kib Date: Wed Jun 23 12:17:13 2010 New Revision: 209463 URL: http://svn.freebsd.org/changeset/base/209463 Log: Fix bugs on pc98, use npxgetuserregs() instead of npxgetregs() for get_fpcontext(), and npxsetuserregs() for set_fpcontext). Also, note that usercontext is not initialized anymore in fpstate_drop(). Systematically replace references to npxgetregs() and npxsetregs() by npxgetuserregs() and npxsetuserregs() in comments. Noted by: bde Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/i386/machdep.c head/sys/pc98/pc98/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Jun 23 11:21:19 2010 (r209462) +++ head/sys/amd64/amd64/machdep.c Wed Jun 23 12:17:13 2010 (r209463) @@ -2123,10 +2123,10 @@ fpstate_drop(struct thread *td) * XXX force a full drop of the fpu. The above only drops it if we * owned it. * - * XXX I don't much like fpugetregs()'s semantics of doing a full + * XXX I don't much like fpugetuserregs()'s semantics of doing a full * drop. Dropping only to the pcb matches fnsave's behaviour. * We only need to drop to !PCB_INITDONE in sendsig(). But - * sendsig() is the only caller of fpugetregs()... perhaps we just + * sendsig() is the only caller of fpugetuserregs()... perhaps we just * have too many layers. */ curthread->td_pcb->pcb_flags &= ~(PCB_FPUINITDONE | Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Wed Jun 23 11:21:19 2010 (r209462) +++ head/sys/i386/i386/machdep.c Wed Jun 23 12:17:13 2010 (r209463) @@ -3319,7 +3319,7 @@ get_fpcontext(struct thread *td, mcontex * * XXX unpessimize most cases by only aligning when fxsave might be * called, although this requires knowing too much about - * npxgetregs()'s internals. + * npxgetuserregs()'s internals. */ addr = (union savefpu *)&mcp->mc_fpstate; if (td == PCPU_GET(fpcurthread) && @@ -3372,10 +3372,6 @@ set_fpcontext(struct thread *td, const m if (cpu_fxsr) addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; #endif - /* - * XXX we violate the dubious requirement that npxsetregs() - * be called with interrupts disabled. - */ npxsetuserregs(td, addr); #endif /* @@ -3400,12 +3396,12 @@ fpstate_drop(struct thread *td) #endif /* * XXX force a full drop of the npx. The above only drops it if we - * owned it. npxgetregs() has the same bug in the !cpu_fxsr case. + * owned it. npxgetuserregs() has the same bug in the !cpu_fxsr case. * - * XXX I don't much like npxgetregs()'s semantics of doing a full + * XXX I don't much like npxgetuserregs()'s semantics of doing a full * drop. Dropping only to the pcb matches fnsave's behaviour. * We only need to drop to !PCB_INITDONE in sendsig(). But - * sendsig() is the only caller of npxgetregs()... perhaps we just + * sendsig() is the only caller of npxgetuserregs()... perhaps we just * have too many layers. */ curthread->td_pcb->pcb_flags &= ~(PCB_NPXINITDONE | Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Wed Jun 23 11:21:19 2010 (r209462) +++ head/sys/pc98/pc98/machdep.c Wed Jun 23 12:17:13 2010 (r209463) @@ -2647,7 +2647,7 @@ get_fpcontext(struct thread *td, mcontex * * XXX unpessimize most cases by only aligning when fxsave might be * called, although this requires knowing too much about - * npxgetregs()'s internals. + * npxgetuserregs()'s internals. */ addr = (union savefpu *)&mcp->mc_fpstate; if (td == PCPU_GET(fpcurthread) && @@ -2659,7 +2659,7 @@ get_fpcontext(struct thread *td, mcontex addr = (void *)((char *)addr + 4); while ((uintptr_t)(void *)addr & 0xF); } - mcp->mc_ownedfp = npxgetregs(td, addr); + mcp->mc_ownedfp = npxgetuserregs(td, addr); if (addr != (union savefpu *)&mcp->mc_fpstate) { bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2)); @@ -2700,11 +2700,7 @@ set_fpcontext(struct thread *td, const m if (cpu_fxsr) addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; #endif - /* - * XXX we violate the dubious requirement that npxsetregs() - * be called with interrupts disabled. - */ - npxsetregs(td, addr); + npxsetuserregs(td, addr); #endif /* * Don't bother putting things back where they were in the @@ -2727,15 +2723,16 @@ fpstate_drop(struct thread *td) #endif /* * XXX force a full drop of the npx. The above only drops it if we - * owned it. npxgetregs() has the same bug in the !cpu_fxsr case. + * owned it. npxusergetregs() has the same bug in the !cpu_fxsr case. * - * XXX I don't much like npxgetregs()'s semantics of doing a full + * XXX I don't much like npxgetuserregs()'s semantics of doing a full * drop. Dropping only to the pcb matches fnsave's behaviour. * We only need to drop to !PCB_INITDONE in sendsig(). But - * sendsig() is the only caller of npxgetregs()... perhaps we just + * sendsig() is the only caller of npxgetuserregs()... perhaps we just * have too many layers. */ - curthread->td_pcb->pcb_flags &= ~PCB_NPXINITDONE; + curthread->td_pcb->pcb_flags &= ~(PCB_NPXINITDONE | + PCB_NPXUSERINITDONE); critical_exit(); }