Index: sys/arm/arm/elf_machdep.c =================================================================== --- sys/arm/arm/elf_machdep.c +++ sys/arm/arm/elf_machdep.c @@ -144,20 +144,41 @@ return (TRUE); } +#ifdef VFP +static bool +get_arm_vfp(struct regset *rs, struct thread *td, void *buf, size_t *sizep) +{ + if (buf != NULL) { + KASSERT(*sizep == sizeof(mcontext_vfp_t), + ("%s: invalid size", __func__)); + get_vfpcontext(td, buf); + } + *sizep = sizeof(mcontext_vfp_t); + return (true); +} + +static bool +set_arm_vfp(struct regset *rs, struct thread *td, void *buf, + size_t size) +{ + KASSERT(size == sizeof(mcontext_vfp_t), ("%s: invalid size", __func__)); + set_vfpcontext(td, buf); + return (true); +} + +static struct regset regset_arm_vfp = { + .note = NT_ARM_VFP, + .size = sizeof(mcontext_vfp_t), + .get = get_arm_vfp, + .set = set_arm_vfp, +}; +ELF_REGSET(regset_arm_vfp); +#endif + void -elf32_dump_thread(struct thread *td, void *dst, size_t *off) +elf32_dump_thread(struct thread *td __unused, void *dst __unused, + size_t *off __unused) { -#ifdef VFP - mcontext_vfp_t vfp; - - if (dst != NULL) { - get_vfpcontext(td, &vfp); - *off = elf32_populate_note(NT_ARM_VFP, &vfp, dst, sizeof(vfp), - NULL); - } else - *off = elf32_populate_note(NT_ARM_VFP, NULL, NULL, sizeof(vfp), - NULL); -#endif } bool Index: sys/arm64/arm64/elf32_machdep.c =================================================================== --- sys/arm64/arm64/elf32_machdep.c +++ sys/arm64/arm64/elf32_machdep.c @@ -285,8 +285,39 @@ bzero(&pcb->pcb_dbg_regs, sizeof(pcb->pcb_dbg_regs)); } +#ifdef VFP +static bool +get_arm_vfp(struct regset *rs, struct thread *td, void *buf, size_t *sizep) +{ + if (buf != NULL) { + KASSERT(*sizep == sizeof(mcontext32_vfp_t), + ("%s: invalid size", __func__)); + get_fpcontext32(td, buf); + } + *sizep = sizeof(mcontext32_vfp_t); + return (true); +} + +static bool +set_arm_vfp(struct regset *rs, struct thread *td, void *buf, + size_t size) +{ + KASSERT(size == sizeof(mcontext32_vfp_t), ("%s: invalid size", + __func__)); + set_fpcontext32(td, buf); + return (true); +} + +static struct regset regset_arm_vfp = { + .note = NT_ARM_VFP, + .size = sizeof(mcontext32_vfp_t), + .get = get_arm_vfp, + .set = set_arm_vfp, +}; +ELF_REGSET(regset_arm_vfp); +#endif + void elf32_dump_thread(struct thread *td, void *dst, size_t *off) { - /* XXX: VFP */ } Index: sys/arm64/arm64/freebsd32_machdep.c =================================================================== --- sys/arm64/arm64/freebsd32_machdep.c +++ sys/arm64/arm64/freebsd32_machdep.c @@ -61,10 +61,6 @@ */ #define UC32_COPY_SIZE offsetof(ucontext32_t, uc_link) -#ifdef VFP -static void get_fpcontext32(struct thread *td, mcontext32_vfp_t *); -#endif - /* * Stubs for machine dependent 32-bits system calls. */ @@ -127,7 +123,7 @@ } #ifdef VFP -static void +void get_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp) { struct pcb *curpcb; @@ -155,7 +151,7 @@ critical_exit(); } -static void +void set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp) { struct pcb *pcb; @@ -172,6 +168,7 @@ critical_exit(); } #endif + static void get_mcontext32(struct thread *td, mcontext32_t *mcp, int flags) { Index: sys/arm64/include/vfp.h =================================================================== --- sys/arm64/include/vfp.h +++ sys/arm64/include/vfp.h @@ -94,6 +94,11 @@ #define VFP_FPSR_FROM_FPSCR(vpscr) ((vpscr) &~ 0x7c00000) #define VFP_FPCR_FROM_FPSCR(vpsrc) ((vpsrc) & 0x7c00000) +#ifdef COMPAT_FREEBSD32 +void get_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp); +void set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp); +#endif + #endif #endif Index: usr.bin/gcore/elfcore.c =================================================================== --- usr.bin/gcore/elfcore.c +++ usr.bin/gcore/elfcore.c @@ -110,9 +110,6 @@ static void *elf_note_prpsinfo(void *, size_t *); static void *elf_note_thrmisc(void *, size_t *); static void *elf_note_ptlwpinfo(void *, size_t *); -#if defined(__arm__) -static void *elf_note_arm_vfp(void *, size_t *); -#endif #if defined(__i386__) || defined(__amd64__) static void *elf_note_x86_xstate(void *, size_t *); #endif @@ -375,8 +372,8 @@ elf_putregnote(NT_FPREGSET, tids[i], sb); elf_putnote(NT_THRMISC, elf_note_thrmisc, tids + i, sb); elf_putnote(NT_PTLWPINFO, elf_note_ptlwpinfo, tids + i, sb); -#if defined(__arm__) - elf_putnote(NT_ARM_VFP, elf_note_arm_vfp, tids + i, sb); +#if (defined(ELFCORE_COMPAT_32) && defined(__aarch64__)) || defined(__arm__) + elf_putregnote(NT_ARM_VFP, tids[i], sb); #endif #if defined(__i386__) || defined(__amd64__) elf_putnote(NT_X86_XSTATE, elf_note_x86_xstate, tids + i, sb);