Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Mar 2014 14:17:04 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263913 - head/sys/arm/arm
Message-ID:  <201403291417.s2TEH4R3009586@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sat Mar 29 14:17:04 2014
New Revision: 263913
URL: http://svnweb.freebsd.org/changeset/base/263913

Log:
  Initialise fpscr to a sane value when we create the pcb. This sets NaNs to
  be the default NaN and for denormalised numbers to be flushed to zero.

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/vm_machdep.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Sat Mar 29 11:56:33 2014	(r263912)
+++ head/sys/arm/arm/machdep.c	Sat Mar 29 14:17:04 2014	(r263913)
@@ -101,6 +101,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/reg.h>
 #include <machine/trap.h>
 #include <machine/undefined.h>
+#include <machine/vfp.h>
 #include <machine/vmparam.h>
 #include <machine/sysarch.h>
 
@@ -990,6 +991,7 @@ init_proc0(vm_offset_t kstack)
 		(thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
 	thread0.td_pcb->pcb_flags = 0;
 	thread0.td_pcb->pcb_vfpcpu = -1;
+	thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ;
 	thread0.td_frame = &proc0_tf;
 	pcpup->pc_curpcb = thread0.td_pcb;
 }

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Sat Mar 29 11:56:33 2014	(r263912)
+++ head/sys/arm/arm/vm_machdep.c	Sat Mar 29 14:17:04 2014	(r263913)
@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/uma_int.h>
 
 #include <machine/md_var.h>
+#include <machine/vfp.h>
 
 /*
  * struct switchframe and trapframe must both be a multiple of 8
@@ -147,6 +148,7 @@ cpu_fork(register struct thread *td1, re
 	pcb2->un_32.pcb32_sp = td2->td_kstack +
 	    USPACE_SVC_STACK_TOP - sizeof(*pcb2);
 	pcb2->pcb_vfpcpu = -1;
+	pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ;
 	pmap_activate(td2);
 	td2->td_frame = tf = (struct trapframe *)STACKALIGN(
 	    pcb2->un_32.pcb32_sp - sizeof(struct trapframe));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403291417.s2TEH4R3009586>