diff --git a/sys/arm/arm/vfp.c b/sys/arm/arm/vfp.c index 2494461c115..c149aafa78d 100644 --- a/sys/arm/arm/vfp.c +++ b/sys/arm/arm/vfp.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -128,6 +129,15 @@ vfp_init(void) tmp = fmrx(mvfr1); PCPU_SET(vfpmvfr1, tmp); + + if (PCPU_GET(cpuid) == 0) { + if ((tmp & VMVFR1_FZ_MASK) == 0x1) { + /* Denormals arithmetic support */ + initial_fpscr &= ~VFPSCR_FZ; + thread0.td_pcb->pcb_vfpstate.fpscr = + initial_fpscr; + } + } } /* initialize the coprocess 10 and 11 calls diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 895a14ce6b5..6a70cbf403e 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -85,6 +85,8 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct switchframe) == 48); CTASSERT(sizeof(struct trapframe) == 80); +uint32_t initial_fpscr = VFPSCR_DN | VFPSCR_FZ; + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -134,7 +136,7 @@ cpu_fork(register struct thread *td1, register struct proc *p2, pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); pcb2->pcb_vfpcpu = -1; - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; + pcb2->pcb_vfpstate.fpscr = initial_fpscr; tf = td2->td_frame; tf->tf_spsr &= ~PSR_C; diff --git a/sys/arm/include/md_var.h b/sys/arm/include/md_var.h index 030b48bf056..642124d9d21 100644 --- a/sys/arm/include/md_var.h +++ b/sys/arm/include/md_var.h @@ -71,4 +71,6 @@ void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); int minidumpsys(struct dumperinfo *); +extern uint32_t initial_fpscr; + #endif /* !_MACHINE_MD_VAR_H_ */