Module Name:    src
Committed By:   matt
Date:           Wed Dec  5 19:05:47 UTC 2012

Modified Files:
        src/sys/arch/arm/arm: process_machdep.c sig_machdep.c
        src/sys/arch/arm/arm32: cpu.c cpuswitch.S vm_machdep.c
        src/sys/arch/arm/conf: files.arm
        src/sys/arch/arm/include: mcontext.h ptrace.h reg.h
        src/sys/arch/arm/vfp: vfp_init.c
Removed Files:
        src/sys/arch/arm/fpe-arm: armfpe.S armfpe.h armfpe_glue.S armfpe_init.c

Log Message:
ARMFPE hasn't compiled since NetBSD 4.  Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/arm/process_machdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/arm/sig_machdep.c
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/arm/arm32/cpuswitch.S
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/arm/arm32/vm_machdep.c
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/fpe-arm/armfpe.S
cvs rdiff -u -r1.7 -r0 src/sys/arch/arm/fpe-arm/armfpe.h
cvs rdiff -u -r1.4 -r0 src/sys/arch/arm/fpe-arm/armfpe_glue.S
cvs rdiff -u -r1.18 -r0 src/sys/arch/arm/fpe-arm/armfpe_init.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/mcontext.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/include/ptrace.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/include/reg.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/vfp/vfp_init.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm/process_machdep.c
diff -u src/sys/arch/arm/arm/process_machdep.c:1.23 src/sys/arch/arm/arm/process_machdep.c:1.24
--- src/sys/arch/arm/arm/process_machdep.c:1.23	Thu Aug 16 16:41:53 2012
+++ src/sys/arch/arm/arm/process_machdep.c	Wed Dec  5 19:05:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.23 2012/08/16 16:41:53 matt Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.24 2012/12/05 19:05:46 matt Exp $	*/
 
 /*
  * Copyright (c) 1993 The Regents of the University of California.
@@ -133,7 +133,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.23 2012/08/16 16:41:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.24 2012/12/05 19:05:46 matt Exp $");
 
 #include <sys/proc.h>
 #include <sys/ptrace.h>
@@ -145,10 +145,6 @@ __KERNEL_RCSID(0, "$NetBSD: process_mach
 
 #include <arm/armreg.h>
 
-#ifdef ARMFPE
-#include <arm/fpe-arm/armfpe.h>
-#endif
-
 int
 process_read_regs(struct lwp *l, struct reg *regs)
 {
@@ -177,14 +173,15 @@ process_read_regs(struct lwp *l, struct 
 int
 process_read_fpregs(struct lwp *l, struct fpreg *regs)
 {
-#ifdef ARMFPE
-	arm_fpe_getcontext(p, regs);
-	return(0);
-#else	/* ARMFPE */
-	/* No hardware FP support */
-	memset(regs, 0, sizeof(struct fpreg));
+#ifdef FPU_VFP
+	if (curcpu()->ci_vfp_id == 0) {
+		return EINVAL;
+	}
+	const struct pcb * const pcb = lwp_getpcb(l);
+	vfp_savecontext();
+	regs->fpr_vfp = pcb->pcb_vfp;
+#endif
 	return(0);
-#endif	/* ARMFPE */
 }
 
 int
@@ -222,13 +219,16 @@ process_write_regs(struct lwp *l, const 
 int
 process_write_fpregs(struct lwp *l, const struct fpreg *regs)
 {
-#ifdef ARMFPE
-	arm_fpe_setcontext(p, regs);
-	return(0);
-#else	/* ARMFPE */
-	/* No hardware FP support */
+#ifdef FPU_VFP
+	if (curcpu()->ci_vfp_id == 0) {
+		return EINVAL;
+	}
+	struct pcb * const pcb = lwp_getpcb(l);
+	vfp_discardcontext();
+	l->l_md.md_flags |= MDLWP_VFPUSED;
+	pcb->pcb_vfp = regs->fpr_vfp;
+#endif
 	return(0);
-#endif	/* ARMFPE */
 }
 
 int

Index: src/sys/arch/arm/arm/sig_machdep.c
diff -u src/sys/arch/arm/arm/sig_machdep.c:1.43 src/sys/arch/arm/arm/sig_machdep.c:1.44
--- src/sys/arch/arm/arm/sig_machdep.c:1.43	Thu Aug 16 16:41:53 2012
+++ src/sys/arch/arm/arm/sig_machdep.c	Wed Dec  5 19:05:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig_machdep.c,v 1.43 2012/08/16 16:41:53 matt Exp $	*/
+/*	$NetBSD: sig_machdep.c,v 1.44 2012/12/05 19:05:46 matt Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.43 2012/08/16 16:41:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.44 2012/12/05 19:05:46 matt Exp $");
 
 #include <sys/mount.h>		/* XXX only needed by syscallargs.h */
 #include <sys/proc.h>
@@ -191,10 +191,8 @@ cpu_getmcontext(struct lwp *l, mcontext_
 
 	*flags |= _UC_CPU;
 
-#ifdef ARMFPE
-	/* Save Floating Point Register context. */
-	arm_fpe_getcontext(p, (struct fpreg *)(void *)&mcp->fpregs);
-	*flags |= _UC_FPU;
+#ifdef FPU_VFP
+	vfp_getcontext(l, mcp, flags);
 #endif
 
 	mcp->_mc_tlsbase = (uintptr_t)l->l_private;
@@ -220,6 +218,11 @@ cpu_setmcontext(struct lwp *l, const mco
 	struct proc * const p = l->l_proc;
 	int error;
 
+#ifdef FPU_VFP
+	if ((flags & _UC_FPU) && curcpu()->ci_vfp_id == 0)
+		return EINVAL;
+#endif
+
 	if ((flags & _UC_CPU) != 0) {
 		/* Restore General Register context. */
 		error = cpu_mcontext_validate(l, mcp);
@@ -245,10 +248,10 @@ cpu_setmcontext(struct lwp *l, const mco
 		tf->tf_spsr   = gr[_REG_CPSR];
 	}
 
-#ifdef ARMFPE
+#ifdef FPU_VFP
 	if ((flags & _UC_FPU) != 0) {
 		/* Restore Floating Point Register context. */
-		arm_fpe_setcontext(p, (struct fpreg *)(void *)&mcp->__fpregs);
+		vfp_setcontext(l, mcp);
 	}
 #endif
 

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.90 src/sys/arch/arm/arm32/cpu.c:1.91
--- src/sys/arch/arm/arm32/cpu.c:1.90	Fri Nov 30 08:15:45 2012
+++ src/sys/arch/arm/arm32/cpu.c	Wed Dec  5 19:05:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.90 2012/11/30 08:15:45 msaitoh Exp $	*/
+/*	$NetBSD: cpu.c,v 1.91 2012/12/05 19:05:45 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.90 2012/11/30 08:15:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.91 2012/12/05 19:05:45 matt Exp $");
 
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -60,11 +60,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.90
 #include <arm/cpuconf.h>
 #include <arm/undefined.h>
 
-#ifdef ARMFPE
-#include <machine/bootconfig.h> /* For boot args */
-#include <arm/fpe-arm/armfpe.h>
-#endif
-
 char cpu_model[256];
 
 #ifdef MULTIPROCESSOR
@@ -209,39 +204,6 @@ cpu_attach(device_t dv, cpuid_t id)
  	}
 #endif
 
-#ifdef ARMFPE
-	/*
-	 * Ok now we test for an FPA
-	 * At this point no floating point emulator has been installed.
-	 * This means any FP instruction will cause undefined exception.
-	 * We install a temporay coproc 1 handler which will modify
-	 * undefined_test if it is called.
-	 * We then try to read the FP status register. If undefined_test
-	 * has been decremented then the instruction was not handled by
-	 * an FPA so we know the FPA is missing. If undefined_test is
-	 * still 1 then we know the instruction was handled by an FPA.
-	 * We then remove our test handler and look at the
-	 * FP status register for identification.
-	 */
- 
-	/*
-	 * Ok if ARMFPE is defined and the boot options request the 
-	 * ARM FPE then it will be installed as the FPE.
-	 * This is just while I work on integrating the new FPE.
-	 * It means the new FPE gets installed if compiled int (ARMFPE
-	 * defined) and also gives me a on/off option when I boot in
-	 * case the new FPE is causing panics.
-	 */
-
-
-	int usearmfpe = 1;
-	if (boot_args)
-		get_bootconf_option(boot_args, "armfpe",
-		    BOOTOPT_TYPE_BOOLEAN, &usearmfpe);
-	if (usearmfpe)
-		initialise_arm_fpe();
-#endif
-
 	vfp_attach();		/* XXX SMP */
 }
 

Index: src/sys/arch/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.73 src/sys/arch/arm/arm32/cpuswitch.S:1.74
--- src/sys/arch/arm/arm32/cpuswitch.S:1.73	Thu Nov  8 08:22:56 2012
+++ src/sys/arch/arm/arm32/cpuswitch.S	Wed Dec  5 19:05:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.73 2012/11/08 08:22:56 skrll Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.74 2012/12/05 19:05:45 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -89,7 +89,7 @@
 #include <machine/asm.h>
 #include <machine/cpu.h>
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.73 2012/11/08 08:22:56 skrll Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.74 2012/12/05 19:05:45 matt Exp $")
 
 /* LINTSTUB: include <sys/param.h> */
 	
@@ -277,17 +277,6 @@ ENTRY(cpu_switchto)
 	/* rem: r6 = new lwp */
 	/* rem: r7 = new pcb */
 
-#ifdef ARMFPE
-	add	r0, r7, #(PCB_SIZE) & 0x00ff
-	add	r0, r0, #(PCB_SIZE) & 0xff00 
-	bl	_C_LABEL(arm_fpe_core_changecontext)
-#endif
-
-	/* rem: r4 = old lwp */
-	/* rem: r5 = new lwp's proc */
-	/* rem: r6 = new lwp */
-	/* rem: r7 = new PCB */
-
 	/* 
 	 * Check for restartable atomic sequences (RAS).
 	 */

Index: src/sys/arch/arm/arm32/vm_machdep.c
diff -u src/sys/arch/arm/arm32/vm_machdep.c:1.61 src/sys/arch/arm/arm32/vm_machdep.c:1.62
--- src/sys/arch/arm/arm32/vm_machdep.c:1.61	Tue Oct 23 22:50:00 2012
+++ src/sys/arch/arm/arm32/vm_machdep.c	Wed Dec  5 19:05:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.61 2012/10/23 22:50:00 matt Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.62 2012/12/05 19:05:45 matt Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.61 2012/10/23 22:50:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.62 2012/12/05 19:05:45 matt Exp $");
 
 #include "opt_armfpe.h"
 #include "opt_pmap_debug.h"
@@ -69,10 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c
 #include <machine/reg.h>
 #include <machine/vmparam.h>
 
-#ifdef ARMFPE
-#include <arm/fpe-arm/armfpe.h>
-#endif
-
 extern pv_addr_t systempage;
 
 int process_read_regs(struct proc *p, struct reg *regs);
@@ -164,12 +160,6 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	}
 #endif	/* PMAP_DEBUG */
 
-#ifdef ARMFPE
-	/* Initialise a new FP context for p2 and copy the context from p1 */
-	arm_fpe_core_initcontext(FP_CONTEXT(l2));
-	arm_fpe_copycontext(FP_CONTEXT(l1), FP_CONTEXT(l2));
-#endif	/* ARMFPE */
-
 	struct trapframe *tf = (struct trapframe *)pcb2->pcb_sp - 1;
 	lwp_settrapframe(l2, tf);
 	*tf = *lwp_trapframe(l1);
@@ -201,23 +191,16 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 void
 cpu_lwp_free(struct lwp *l, int proc)
 {
-#ifdef ARMFPE
-	/* Abort any active FP operation and deactivate the context */
-	arm_fpe_core_abort(FP_CONTEXT(l), NULL, NULL);
-	arm_fpe_core_changecontext(0);
-#endif	/* ARMFPE */
-
 #ifdef STACKCHECKS
 	/* Report how much stack has been used - debugging */
-	if (l) {
-		u_char *ptr;
-		int loop;
-
-		ptr = (u_char *)pcb + USPACE_SVC_STACK_BOTTOM;
-		for (loop = 0; loop < (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM)
-		    && *ptr == 0xdd; ++loop, ++ptr) ;
-		log(LOG_INFO, "%d bytes of svc stack fill pattern\n", loop);
-	}
+	struct pcb * const pcb = lwp_getpcb(l);
+	u_char *ptr;
+	u_int loop;
+
+	ptr = (u_char *)pcb + USPACE_SVC_STACK_BOTTOM;
+	for (loop = 0; loop < (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM)
+	    && *ptr == 0xdd; ++loop, ++ptr) ;
+	log(LOG_INFO, "%u bytes of svc stack fill pattern\n", loop);
 #endif	/* STACKCHECKS */
 }
 

Index: src/sys/arch/arm/conf/files.arm
diff -u src/sys/arch/arm/conf/files.arm:1.112 src/sys/arch/arm/conf/files.arm:1.113
--- src/sys/arch/arm/conf/files.arm:1.112	Wed Oct 17 18:52:16 2012
+++ src/sys/arch/arm/conf/files.arm	Wed Dec  5 19:05:47 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arm,v 1.112 2012/10/17 18:52:16 matt Exp $
+#	$NetBSD: files.arm,v 1.113 2012/12/05 19:05:47 matt Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflag				ARM32
@@ -48,10 +48,7 @@ defflag	opt_arm_debug.h		ARM_LOCK_CAS_DE
 defflag  opt_arm_bus_space.h	__BUS_SPACE_HAS_STREAM_METHODS _ARM32_NEED_BUS_DMA_BOUNCE
 
 # Floating point emulator
-defflag				ARMFPE
-file	arch/arm/fpe-arm/armfpe_glue.S		armfpe
-file	arch/arm/fpe-arm/armfpe_init.c		armfpe
-file	arch/arm/fpe-arm/armfpe.S		armfpe
+obsolete defflag				ARMFPE
 
 # VFP support
 file	arch/arm/vfp/vfp_init.c			arm32

Index: src/sys/arch/arm/include/mcontext.h
diff -u src/sys/arch/arm/include/mcontext.h:1.11 src/sys/arch/arm/include/mcontext.h:1.12
--- src/sys/arch/arm/include/mcontext.h:1.11	Fri Aug  3 07:59:23 2012
+++ src/sys/arch/arm/include/mcontext.h	Wed Dec  5 19:05:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.11 2012/08/03 07:59:23 matt Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.12 2012/12/05 19:05:46 matt Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -126,4 +126,9 @@ __lwp_getprivate_fast(void)
 	return _lwp_getprivate();
 }
 
+#if defined(_KERNEL)
+void vfp_getcontext(struct lwp *, mcontext_t *, int *);
+void vfp_setcontext(struct lwp *, const mcontext_t *); 
+#endif
+
 #endif	/* !_ARM_MCONTEXT_H_ */

Index: src/sys/arch/arm/include/ptrace.h
diff -u src/sys/arch/arm/include/ptrace.h:1.5 src/sys/arch/arm/include/ptrace.h:1.6
--- src/sys/arch/arm/include/ptrace.h:1.5	Fri Jan 25 11:59:20 2008
+++ src/sys/arch/arm/include/ptrace.h	Wed Dec  5 19:05:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.5 2008/01/25 11:59:20 skrll Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.6 2012/12/05 19:05:46 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank Lancaster
@@ -39,12 +39,15 @@
 #endif
 #define	PT_GETREGS	(PT_FIRSTMACH + 1)
 #define	PT_SETREGS	(PT_FIRSTMACH + 2)
-#define	PT_GETFPREGS	(PT_FIRSTMACH + 3)
-#define	PT_SETFPREGS	(PT_FIRSTMACH + 4)
+/* 3 and 4 are for FPE registers */
+#define	PT_GETFPREGS	(PT_FIRSTMACH + 5)
+#define	PT_SETFPREGS	(PT_FIRSTMACH + 6)
 
 #define PT_MACHDEP_STRINGS \
 	"(unused)", \
 	"PT_GETREGS", \
 	"PT_SETREGS", \
+	"old PT_GETFPREGS", \
+	"old PT_SETFPREGS", \
 	"PT_GETFPREGS", \
 	"PT_SETFPREGS",

Index: src/sys/arch/arm/include/reg.h
diff -u src/sys/arch/arm/include/reg.h:1.2 src/sys/arch/arm/include/reg.h:1.3
--- src/sys/arch/arm/include/reg.h:1.2	Sat Mar 15 10:16:43 2008
+++ src/sys/arch/arm/include/reg.h	Wed Dec  5 19:05:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: reg.h,v 1.2 2008/03/15 10:16:43 rearnsha Exp $	*/
+/*	$NetBSD: reg.h,v 1.3 2012/12/05 19:05:46 matt Exp $	*/
 
 /*
  * Copyright (C) 1994, 1995 Frank Lancaster
@@ -46,11 +46,6 @@ struct reg {
 	unsigned int r_cpsr;
 };
 
-struct fpreg {
-	unsigned int fpr_fpsr;
-	fp_reg_t fpr[8];
-};
-
 struct vfpreg {
 	uint32_t vfp_fpexc;
 	uint32_t vfp_fpscr;
@@ -59,4 +54,9 @@ struct vfpreg {
 	uint32_t vfp_regs[33];	/* In case we need fstmx format.  */
 };
 
+struct fpreg {
+	struct vfpreg fpr_vfp;
+};
+
+
 #endif /* !_ARM32_REG_H_ */

Index: src/sys/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.7 src/sys/arch/arm/vfp/vfp_init.c:1.8
--- src/sys/arch/arm/vfp/vfp_init.c:1.7	Sat Sep 22 19:45:54 2012
+++ src/sys/arch/arm/vfp/vfp_init.c	Wed Dec  5 19:05:46 2012
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.7 2012/09/22 19:45:54 matt Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.8 2012/12/05 19:05:46 matt Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -39,6 +39,7 @@
 #include <arm/pcb.h>
 #include <arm/undefined.h>
 #include <arm/vfpreg.h>
+#include <arm/mcontext.h>
 
 /* 
  * Use generic co-processor instructions to avoid assembly problems.
@@ -365,6 +366,10 @@ vfp_state_load(lwp_t *l, bool used)
 		switch (ci->ci_vfp_id) {
 		case FPU_VFP10_ARM10E:
 		case FPU_VFP11_ARM11:
+		case FPU_VFP_CORTEXA5:
+		case FPU_VFP_CORTEXA7:
+		case FPU_VFP_CORTEXA8:
+		case FPU_VFP_CORTEXA9:
 			write_fpinst2(fregs->vfp_fpinst2);
 			write_fpinst(fregs->vfp_fpinst);
 			break;
@@ -407,6 +412,10 @@ vfp_state_save(lwp_t *l)
 		switch (ci->ci_vfp_id) {
 		case FPU_VFP10_ARM10E:
 		case FPU_VFP11_ARM11:
+		case FPU_VFP_CORTEXA5:
+		case FPU_VFP_CORTEXA7:
+		case FPU_VFP_CORTEXA8:
+		case FPU_VFP_CORTEXA9:
 			fregs->vfp_fpinst = read_fpinst();
 			fregs->vfp_fpinst2 = read_fpinst2();
 			break;
@@ -456,4 +465,28 @@ vfp_discardcontext(void)
 	pcu_discard(&arm_vfp_ops);
 }
 
+void
+vfp_getcontext(struct lwp *l, mcontext_t *mcp, int *flagsp)
+{
+	if (l->l_md.md_flags & MDLWP_VFPUSED) {
+		const struct pcb * const pcb = lwp_getpcb(l);
+		pcu_save(&arm_vfp_ops);
+		mcp->__fpu.__vfpregs.__vfp_fpscr = pcb->pcb_vfp.vfp_fpscr;
+		memcpy(mcp->__fpu.__vfpregs.__vfp_fstmx, pcb->pcb_vfp.vfp_regs,
+		    sizeof(mcp->__fpu.__vfpregs.__vfp_fstmx));
+		*flagsp |= _UC_FPU;
+	}
+}
+
+void
+vfp_setcontext(struct lwp *l, const mcontext_t *mcp)
+{
+	pcu_discard(&arm_vfp_ops);
+	struct pcb * const pcb = lwp_getpcb(l);
+	l->l_md.md_flags |= MDLWP_VFPUSED;
+	pcb->pcb_vfp.vfp_fpscr = mcp->__fpu.__vfpregs.__vfp_fpscr;
+	memcpy(pcb->pcb_vfp.vfp_regs, mcp->__fpu.__vfpregs.__vfp_fstmx,
+	    sizeof(mcp->__fpu.__vfpregs.__vfp_fstmx));
+}
+
 #endif /* FPU_VFP */

Reply via email to