1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

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
This commit is contained in:
Konstantin Belousov 2010-06-23 12:17:13 +00:00
parent 1060a94fb5
commit 692add74d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209463
3 changed files with 14 additions and 21 deletions

View File

@ -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 |

View File

@ -3319,7 +3319,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
*
* 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 mcontext_t *mcp)
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 |

View File

@ -2647,7 +2647,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp)
*
* 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, mcontext_t *mcp)
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 mcontext_t *mcp)
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();
}