diff options
| author | Andrew Turner <andrew@FreeBSD.org> | 2016-10-18 13:39:55 +0000 |
|---|---|---|
| committer | Andrew Turner <andrew@FreeBSD.org> | 2016-10-18 13:39:55 +0000 |
| commit | 4c247b971939f1a85a73ee08b056840513be9e0c (patch) | |
| tree | 400d0af24c13d3ff82fb7a88e08e8a592c55a826 /sys | |
| parent | 4c5fff6d495754eaa3589e6d66ea5b151c50eec8 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arm64/arm64/machdep.c | 4 | ||||
| -rw-r--r-- | sys/arm64/arm64/trap.c | 3 | ||||
| -rw-r--r-- | sys/arm64/include/pcb.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 9813fec4aca4..da2af94cae8b 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -341,6 +341,8 @@ get_fpcontext(struct thread *td, mcontext_t *mcp) KASSERT(curpcb->pcb_fpusaved == &curpcb->pcb_fpustate, ("Called get_fpcontext while the kernel is using the VFP")); + KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, + ("Non-userspace FPU flags set in get_fpcontext")); memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs, sizeof(mcp->mc_fpregs)); mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr; @@ -376,7 +378,7 @@ set_fpcontext(struct thread *td, mcontext_t *mcp) sizeof(mcp->mc_fpregs)); curpcb->pcb_fpustate.vfp_fpcr = mcp->mc_fpregs.fp_cr; curpcb->pcb_fpustate.vfp_fpsr = mcp->mc_fpregs.fp_sr; - curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags; + curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK; } critical_exit(); diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 1748ece48316..a7834229aa45 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -409,6 +409,9 @@ do_el0_sync(struct trapframe *frame) userret(td, frame); break; } + + KASSERT((curthread->td_pcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, + ("Kernel VFP flags set while entering userspace")); } void diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h index e76183409ae0..db4183be5a8a 100644 --- a/sys/arm64/include/pcb.h +++ b/sys/arm64/include/pcb.h @@ -54,6 +54,8 @@ struct pcb { struct vfpstate *pcb_fpusaved; int pcb_fpflags; #define PCB_FP_STARTED 0x01 +/* The bits passed to userspace in get_fpcontext */ +#define PCB_FP_USERMASK (PCB_FP_STARTED) u_int pcb_vfpcpu; /* Last cpu this thread ran VFP code */ /* |
