linux: Implement linux_to_bsd_regset() on arm64

This will be used by ptrace.

Sponsored By:	EPSRC
This commit is contained in:
Edward Tomasz Napierala 2021-11-06 08:35:04 +00:00
parent 3be6e606d7
commit 6f397bc0fb
2 changed files with 15 additions and 0 deletions

View File

@ -324,5 +324,7 @@ struct reg;
void bsd_to_linux_regset(const struct reg *b_reg,
struct linux_pt_regset *l_regset);
void linux_to_bsd_regset(struct reg *b_reg,
const struct linux_pt_regset *l_regset);
#endif /* _ARM64_LINUX_H_ */

View File

@ -145,3 +145,16 @@ bsd_to_linux_regset(const struct reg *b_reg, struct linux_pt_regset *l_regset)
l_regset->pc = b_reg->elr;
l_regset->cpsr = b_reg->spsr;
}
void
linux_to_bsd_regset(struct reg *b_reg, const struct linux_pt_regset *l_regset)
{
KASSERT(sizeof(l_regset->x) == sizeof(b_reg->x) + sizeof(l_ulong),
("%s: size mismatch\n", __func__));
memcpy(b_reg->x, l_regset->x, sizeof(b_reg->x));
b_reg->sp = l_regset->sp;
b_reg->elr = l_regset->pc;
b_reg->spsr = l_regset->cpsr;
}