Rename fp_init_pcb to fp_init_proc. Set the FEF bit in fprs register;

according the SCD it should be set if no user trap handler in set.

Submitted by:	tmm
This commit is contained in:
jake 2001-08-20 23:56:19 +00:00
parent eed959d0e2
commit 56800e0ac6
2 changed files with 19 additions and 5 deletions

View File

@ -75,7 +75,7 @@ struct fpstate {
u_long fp_fprs;
};
void fp_init_pcb(struct pcb *);
void fp_init_proc(struct pcb *);
int fp_enable_proc(struct proc *);
/*
* Note: The pointers passed to the next two functions must be aligned on

View File

@ -33,26 +33,40 @@
#include <machine/frame.h>
#include <machine/pcb.h>
#include <machine/tstate.h>
void
fp_init_pcb(struct pcb *pcb)
fp_init_proc(struct pcb *pcb)
{
bzero(&pcb->pcb_fpstate.fp_fb, sizeof(pcb->pcb_fpstate.fp_fb));
pcb->pcb_fpstate.fp_fsr = FSR_TEM_DZ;
pcb->pcb_fpstate.fp_fprs = FPRS_FEF;
pcb->pcb_fpstate.fp_fsr = 0;
wr(fprs, 0, 0);
}
int
fp_enable_proc(struct proc *p)
{
struct pcb *pcb;
pcb = &p->p_addr->u_pcb;
if ((p->p_frame->tf_tstate & TSTATE_PEF) != 0 &&
(pcb->pcb_fpstate.fp_fprs & FPRS_FEF) == 0) {
/*
* Enable FEF for now. The SCD mandates that this should be
* done when no user trap is set. User traps are not currently
* supported...
*/
wr(fprs, rd(fprs), FPRS_FEF);
return (1);
}
if ((p->p_frame->tf_tstate & TSTATE_PEF) != 0)
return (0);
mtx_lock_spin(&sched_lock);
p->p_frame->tf_tstate |= TSTATE_PEF;
/* Actually load the FP state into the registers. */
restorefpctx(&p->p_addr->u_pcb.pcb_fpstate);
restorefpctx(&pcb->pcb_fpstate);
mtx_unlock_spin(&sched_lock);
return (1);
}