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.

MFC after:	2 weeks
This commit is contained in:
Michal Meloun 2017-03-24 11:46:49 +00:00
parent 3aef5b286a
commit dfe5f22fd7
7 changed files with 27 additions and 125 deletions

View File

@ -90,7 +90,7 @@ pt_fpreg_to_ucontext(const struct fpreg *r __unused, ucontext_t *uc)
mcontext_t *mc = &uc->uc_mcontext;
/* XXX */
memset(&mc->__fpu, 0, sizeof(mc->__fpu));
memset(&mc->mc_spare, 0, sizeof(mc->mc_spare));
}
void

View File

@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include <machine/armreg.h>
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/md_var.h>
#include <machine/pcb.h>
#include <machine/undefined.h>

View File

@ -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 */

View File

@ -38,8 +38,8 @@
#ifndef _MACHINE_PCB_H_
#define _MACHINE_PCB_H_
#include <machine/fp.h>
#include <machine/frame.h>
#include <machine/vfp.h>
/*

View File

@ -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];

View File

@ -63,38 +63,14 @@ typedef __greg_t __gregset_t[_NGREG];
#define _REG_LR _REG_R14
#define _REG_PC _REG_R15
/*
* 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;
typedef struct {
__gregset_t __gregs;
union {
__fpregset_t __fpregs;
__vfpregset_t __vfpregs;
} __fpu;
/*
* Originally, rest of this structure was named __fpu, 35 * 4 bytes
* long, never accessed from kernel.
*/
unsigned int mc_spare[35];
} 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
#endif /* !_MACHINE_MCONTEXT_H_ */

View File

@ -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