arm,arm64: Add a NT_ARM_TLS read-only register set.

This register set exposes the per-thread TLS register.  It matches the
layout used by Linux on arm64.  Linux does not implement this note for
32-bit arm.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34595
This commit is contained in:
John Baldwin
2022-03-23 13:33:06 -07:00
parent add00c381e
commit b2cb74c22c
5 changed files with 75 additions and 0 deletions
+22
View File
@@ -67,6 +67,28 @@ static struct regset regset_arm_vfp = {
ELF_REGSET(regset_arm_vfp);
#endif
static bool
get_arm_tls(struct regset *rs, struct thread *td, void *buf,
size_t *sizep)
{
if (buf != NULL) {
KASSERT(*sizep == sizeof(td->td_pcb->pcb_regs.sf_tpidrurw),
("%s: invalid size", __func__));
memcpy(buf, &td->td_pcb->pcb_regs.sf_tpidrurw,
sizeof(td->td_pcb->pcb_regs.sf_tpidrurw));
}
*sizep = sizeof(td->td_pcb->pcb_regs.sf_tpidrurw);
return (true);
}
static struct regset regset_arm_tls = {
.note = NT_ARM_TLS,
.size = sizeof(uint32_t),
.get = get_arm_tls,
};
ELF_REGSET(regset_arm_tls);
int
cpu_ptrace(struct thread *td, int req, void *addr, int data)
{