Use a regset for NT_ARM_VFP.

This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34448
This commit is contained in:
John Baldwin
2022-03-23 13:33:06 -07:00
parent a47fd6929f
commit add00c381e
7 changed files with 78 additions and 24 deletions
+2 -12
View File
@@ -145,19 +145,9 @@ elf32_arm_abi_supported(struct image_params *imgp, int32_t *osrel __unused,
}
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
+33
View File
@@ -28,12 +28,45 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/elf.h>
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/reg.h>
#ifdef VFP
#include <machine/vfp.h>
#endif
#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
int
cpu_ptrace(struct thread *td, int req, void *addr, int data)
{