summaryrefslogtreecommitdiffstats
path: root/sys/arm/include
diff options
context:
space:
mode:
authormmel <mmel@FreeBSD.org>2017-04-16 07:33:47 +0000
committermmel <mmel@FreeBSD.org>2017-04-16 07:33:47 +0000
commit2d4b5ed3310ee2a108a26c0817ed03a5aeb0874d (patch)
tree239eb852f17c503f3919ea8dc9f50fbc3d4e9cb9 /sys/arm/include
parent2589e5f69f04cfa8fcf63ea99bd8a5914762ab67 (diff)
downloadFreeBSD-src-2d4b5ed3310ee2a108a26c0817ed03a5aeb0874d.zip
FreeBSD-src-2d4b5ed3310ee2a108a26c0817ed03a5aeb0874d.tar.gz
MFC r315900,r315973,r315974:
r315900: Cleanup structures related to VFP and/or mcontext_t. - in mcontext_t, rename newer used 'union __vfp' to equaly sized 'mc_spare'. Space allocated by 'union __vfp' is too small and cannot hold full VFP context. - move structures defined in fp.h to more appropriate headers. - remove all unused VFP structures. r315973: Save VFP state on fork(). Update the copy of VFP state in PCB before it is cloned for new process. r315974: Preserve VFP state across signal delivery.
Diffstat (limited to 'sys/arm/include')
-rw-r--r--sys/arm/include/fp.h89
-rw-r--r--sys/arm/include/frame.h1
-rw-r--r--sys/arm/include/pcb.h2
-rw-r--r--sys/arm/include/reg.h10
-rw-r--r--sys/arm/include/ucontext.h37
-rw-r--r--sys/arm/include/vfp.h12
6 files changed, 33 insertions, 118 deletions
diff --git a/sys/arm/include/fp.h b/sys/arm/include/fp.h
deleted file mode 100644
index 8817d84..0000000
--- a/sys/arm/include/fp.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: fp.h,v 1.1 2001/01/10 19:02:06 bjh21 Exp $ */
-
-/*-
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fp.h
- *
- * FP info
- *
- * Created : 10/10/95
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_FP_H
-#define _MACHINE_FP_H
-
-/*
- * An extended precision floating point number
- */
-
-typedef struct fp_extended_precision {
- u_int32_t fp_exponent;
- u_int32_t fp_mantissa_hi;
- u_int32_t fp_mantissa_lo;
-} fp_extended_precision_t;
-
-typedef struct fp_extended_precision fp_reg_t;
-
-/*
- * Information about the FPE-SP state that is stored in the pcb
- *
- * This needs to move and be hidden from userland.
- */
-
-struct vfp_state {
- u_int64_t reg[32];
- u_int32_t fpscr;
- u_int32_t fpexec;
- u_int32_t fpinst;
- u_int32_t fpinst2;
-};
-
-/*
- * Type for a saved FP context, if we want to translate the context to a
- * user-readable form
- */
-
-typedef struct {
- u_int32_t fpsr;
- fp_extended_precision_t regs[8];
-} fp_state_t;
-
-#endif /* _MACHINE_FP_H_ */
-
-/* End of fp.h */
diff --git a/sys/arm/include/frame.h b/sys/arm/include/frame.h
index 929bc96..c5a028a 100644
--- a/sys/arm/include/frame.h
+++ b/sys/arm/include/frame.h
@@ -94,6 +94,7 @@ struct trapframe {
struct sigframe {
siginfo_t sf_si; /* actual saved siginfo */
ucontext_t sf_uc; /* actual saved ucontext */
+ mcontext_vfp_t sf_vfp; /* actual saved VFP context */
};
diff --git a/sys/arm/include/pcb.h b/sys/arm/include/pcb.h
index 390758b..886fa43 100644
--- a/sys/arm/include/pcb.h
+++ b/sys/arm/include/pcb.h
@@ -38,8 +38,8 @@
#ifndef _MACHINE_PCB_H_
#define _MACHINE_PCB_H_
-#include <machine/fp.h>
#include <machine/frame.h>
+#include <machine/vfp.h>
/*
diff --git a/sys/arm/include/reg.h b/sys/arm/include/reg.h
index d4cc457..ab70ae1 100644
--- a/sys/arm/include/reg.h
+++ b/sys/arm/include/reg.h
@@ -3,8 +3,6 @@
#ifndef MACHINE_REG_H
#define MACHINE_REG_H
-#include <machine/fp.h>
-
struct reg {
unsigned int r[13];
unsigned int r_sp;
@@ -13,6 +11,14 @@ struct reg {
unsigned int r_cpsr;
};
+struct fp_extended_precision {
+ u_int32_t fp_exponent;
+ u_int32_t fp_mantissa_hi;
+ u_int32_t fp_mantissa_lo;
+};
+
+typedef struct fp_extended_precision fp_reg_t;
+
struct fpreg {
unsigned int fpr_fpsr;
fp_reg_t fpr[8];
diff --git a/sys/arm/include/ucontext.h b/sys/arm/include/ucontext.h
index afcd88d..3cc5113 100644
--- a/sys/arm/include/ucontext.h
+++ b/sys/arm/include/ucontext.h
@@ -66,35 +66,22 @@ typedef __greg_t __gregset_t[_NGREG];
/*
* Floating point register state
*/
-/* Note: the storage layout of this structure must be identical to ARMFPE! */
typedef struct {
- unsigned int __fp_fpsr;
- struct {
- unsigned int __fp_exponent;
- unsigned int __fp_mantissa_hi;
- unsigned int __fp_mantissa_lo;
- } __fp_fr[8];
-} __fpregset_t;
-
-typedef struct {
- unsigned int __vfp_fpscr;
- unsigned int __vfp_fstmx[33];
- unsigned int __vfp_fpsid;
-} __vfpregset_t;
+ __uint64_t mcv_reg[32];
+ __uint32_t mcv_fpscr;
+} mcontext_vfp_t;
typedef struct {
__gregset_t __gregs;
- union {
- __fpregset_t __fpregs;
- __vfpregset_t __vfpregs;
- } __fpu;
-} mcontext_t;
-/* Machine-dependent uc_flags */
-#define _UC_ARM_VFP 0x00010000 /* FPU field is VFP */
-
-/* used by signal delivery to indicate status of signal stack */
-#define _UC_SETSTACK 0x00020000
-#define _UC_CLRSTACK 0x00040000
+ /*
+ * Originally, rest of this structure was named __fpu, 35 * 4 bytes
+ * long, never accessed from kernel.
+ */
+ size_t mc_vfp_size;
+ void *mc_vfp_ptr;
+ unsigned int mc_spare[33];
+} mcontext_t;
+#define UC_
#endif /* !_MACHINE_MCONTEXT_H_ */
diff --git a/sys/arm/include/vfp.h b/sys/arm/include/vfp.h
index 2b91043..1c4540e 100644
--- a/sys/arm/include/vfp.h
+++ b/sys/arm/include/vfp.h
@@ -133,9 +133,19 @@
#define COPROC11 (0x3 << 22)
#ifndef LOCORE
+struct vfp_state {
+ uint64_t reg[32];
+ uint32_t fpscr;
+ uint32_t fpexec;
+ uint32_t fpinst;
+ uint32_t fpinst2;
+};
+
+#ifdef _KERNEL
void vfp_init(void);
void vfp_store(struct vfp_state *, boolean_t);
void vfp_discard(struct thread *);
-#endif
+#endif /* _KERNEL */
+#endif /* LOCORE */
#endif
OpenPOWER on IntegriCloud