Changeset View
Changeset View
Standalone View
Standalone View
head/sys/riscv/riscv/machdep.c
Show First 20 Lines • Show All 413 Lines • ▼ Show 20 Lines | if ((curpcb->pcb_fpflags & PCB_FP_STARTED) != 0) { | ||||
* If we have just been running FPE instructions we will | * If we have just been running FPE instructions we will | ||||
* need to save the state to memcpy it below. | * need to save the state to memcpy it below. | ||||
*/ | */ | ||||
fpe_state_save(td); | fpe_state_save(td); | ||||
KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, | KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, | ||||
("Non-userspace FPE flags set in get_fpcontext")); | ("Non-userspace FPE flags set in get_fpcontext")); | ||||
memcpy(mcp->mc_fpregs.fp_x, curpcb->pcb_x, | memcpy(mcp->mc_fpregs.fp_x, curpcb->pcb_x, | ||||
sizeof(mcp->mc_fpregs)); | sizeof(mcp->mc_fpregs.fp_x)); | ||||
mcp->mc_fpregs.fp_fcsr = curpcb->pcb_fcsr; | mcp->mc_fpregs.fp_fcsr = curpcb->pcb_fcsr; | ||||
mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags; | mcp->mc_fpregs.fp_flags = curpcb->pcb_fpflags; | ||||
mcp->mc_flags |= _MC_FP_VALID; | mcp->mc_flags |= _MC_FP_VALID; | ||||
} | } | ||||
critical_exit(); | critical_exit(); | ||||
#endif | #endif | ||||
} | } | ||||
Show All 10 Lines | |||||
#ifdef FPE | #ifdef FPE | ||||
critical_enter(); | critical_enter(); | ||||
if ((mcp->mc_flags & _MC_FP_VALID) != 0) { | if ((mcp->mc_flags & _MC_FP_VALID) != 0) { | ||||
curpcb = curthread->td_pcb; | curpcb = curthread->td_pcb; | ||||
/* FPE usage is enabled, override registers. */ | /* FPE usage is enabled, override registers. */ | ||||
memcpy(curpcb->pcb_x, mcp->mc_fpregs.fp_x, | memcpy(curpcb->pcb_x, mcp->mc_fpregs.fp_x, | ||||
sizeof(mcp->mc_fpregs)); | sizeof(mcp->mc_fpregs.fp_x)); | ||||
curpcb->pcb_fcsr = mcp->mc_fpregs.fp_fcsr; | curpcb->pcb_fcsr = mcp->mc_fpregs.fp_fcsr; | ||||
curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK; | curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK; | ||||
td->td_frame->tf_sstatus |= SSTATUS_FS_CLEAN; | td->td_frame->tf_sstatus |= SSTATUS_FS_CLEAN; | ||||
} | } | ||||
critical_exit(); | critical_exit(); | ||||
#endif | #endif | ||||
} | } | ||||
▲ Show 20 Lines • Show All 518 Lines • Show Last 20 Lines |