arm64: Implement cpu_ptrace().

Add a minimal implementation of cpu_ptrace() for arm64. It is only used to
get/set VFP registers for 32bits binaries, as it is apparently what we use
there, instead of the MI PT_GETFPREGS/PT_SETFPREGS.

PR:	267361
MFC After: 1 week
This commit is contained in:
Olivier Houchard 2022-10-27 23:25:59 +02:00
parent 473e9fcab4
commit d78c2cd831
2 changed files with 40 additions and 0 deletions

View File

@ -49,6 +49,36 @@ __FBSDID("$FreeBSD$");
#include <machine/armreg.h>
/* Only used to get/set 32bits VFP regs */
int
cpu_ptrace(struct thread *td, int req, void *arg, int data)
{
#if defined(VFP) && defined(COMPAT_FREEBSD32)
mcontext32_vfp_t vfp;
int error;
if (!SV_CURPROC_FLAG(SV_ILP32))
return (EINVAL);
switch (req) {
case PT_GETVFPREGS32:
get_fpcontext32(td, &vfp);
error = copyout(&vfp, arg, sizeof(vfp));
break;
case PT_SETVFPREGS32:
error = copyin(arg, &vfp, sizeof(vfp));
if (error == 0)
set_fpcontext32(td, &vfp);
break;
default:
error = EINVAL;
}
return (error);
#else
return (EINVAL);
#endif
}
#if defined(VFP) && defined(COMPAT_FREEBSD32)
static bool
get_arm_vfp(struct regset *rs, struct thread *td, void *buf, size_t *sizep)

View File

@ -1 +1,11 @@
/* $FreeBSD$ */
#ifndef _MACHINE_PTRACE_H_
#define _MACHINE_PTRACE_H_
#define __HAVE_PTRACE_MACHDEP
#define PT_GETVFPREGS32 (PT_FIRSTMACH + 0)
#define PT_SETVFPREGS32 (PT_FIRSTMACH + 1)
#endif /* _MACHINE_PTRACE_H_ */