Hi Andrew, On 10/14/2016 17:53, Andrew Turner wrote: > Author: andrew > Date: Fri Oct 14 15:53:48 2016 > New Revision: 307321 > URL: https://svnweb.freebsd.org/changeset/base/307321 > > Log: > Rework how we store the VFP registers in the pcb. This will be used when > creating a floating-point context within the kernel without having to move > the stored values in memory. > > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/arm64/arm64/machdep.c > head/sys/arm64/arm64/vfp.c > head/sys/arm64/arm64/vm_machdep.c > head/sys/arm64/include/pcb.h > head/sys/arm64/include/vfp.h
[...] > Modified: head/sys/arm64/include/pcb.h > ============================================================================== > --- head/sys/arm64/include/pcb.h Fri Oct 14 15:16:44 2016 > (r307320) > +++ head/sys/arm64/include/pcb.h Fri Oct 14 15:53:48 2016 > (r307321) > @@ -31,6 +31,8 @@ > > #ifndef LOCORE > > +#include <machine/vfp.h> > + > struct trapframe; > > #define PCB_LR 30 > @@ -49,13 +51,17 @@ struct pcb { > #define PCB_SINGLE_STEP_SHIFT 0 > #define PCB_SINGLE_STEP (1 << PCB_SINGLE_STEP_SHIFT) > > - /* Place last to simplify the asm to access the rest if the struct */ > - __uint128_t pcb_vfp[32]; > - uint32_t pcb_fpcr; > - uint32_t pcb_fpsr; > + struct vfpstate *pcb_fpusaved; > int pcb_fpflags; > #define PCB_FP_STARTED 0x01 > u_int pcb_vfpcpu; /* Last cpu this thread ran VFP code */ > + > + /* > + * The userspace VFP state. The pcb_fpusaved pointer will point to > + * this unless the kernel has allocated a VFP context. > + * Place last to simplify the asm to access the rest if the struct. > + */ > + struct vfpstate pcb_fpustate; > }; > > #ifdef _KERNEL > > Modified: head/sys/arm64/include/vfp.h > ============================================================================== > --- head/sys/arm64/include/vfp.h Fri Oct 14 15:16:44 2016 > (r307320) > +++ head/sys/arm64/include/vfp.h Fri Oct 14 15:53:48 2016 > (r307321) > @@ -35,6 +35,12 @@ > #ifdef _KERNEL > > #ifndef LOCORE > +struct vfpstate { > + __uint128_t vfp_regs[32]; > + uint32_t vfp_fpcr; > + uint32_t vfp_fpsr; > +}; > + > void vfp_init(void); > void vfp_discard(struct thread *); > void vfp_restore_state(void); These changes break buildworld for arm64: In file included from /usr/home/def/FreeBSD/ekcd/repo/lib/libutil/kinfo_getfile.c:5: In file included from /usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/sys/user.h:38: /usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/machine/pcb.h:64:18: error: field has incomplete type 'struct vfpstate' struct vfpstate pcb_fpustate; ^ /usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/machine/pcb.h:54:9: note: forward declaration of 'struct vfpstate' struct vfpstate *pcb_fpusaved; ^ 1 error generated. --- kinfo_getfile.o --- *** [kinfo_getfile.o] Error code 1 You might want to consider making vfpstate available for userland as in arm case. If so I'm attaching a patch for it. Konrad
diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index de99118..9429247 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -32,15 +32,15 @@ #ifndef _MACHINE_VFP_H_ #define _MACHINE_VFP_H_ -#ifdef _KERNEL - #ifndef LOCORE + struct vfpstate { __uint128_t vfp_regs[32]; uint32_t vfp_fpcr; uint32_t vfp_fpsr; }; +#ifdef _KERNEL void vfp_init(void); void vfp_discard(struct thread *); void vfp_restore_state(void);
signature.asc
Description: OpenPGP digital signature