Date: Sat, 6 Nov 2021 08:35:47 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 6f397bc0fbe3 - main - linux: Implement linux_to_bsd_regset() on arm64 Message-ID: <202111060835.1A68Zl3B072317@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6f397bc0fbe378664bbbc7c2296043e3b9673e2a commit 6f397bc0fbe378664bbbc7c2296043e3b9673e2a Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-11-06 08:35:04 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-11-06 08:35:04 +0000 linux: Implement linux_to_bsd_regset() on arm64 This will be used by ptrace. Sponsored By: EPSRC --- sys/arm64/linux/linux.h | 2 ++ sys/arm64/linux/linux_machdep.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index 5e4bf3ae0680..05e5bd189b36 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -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_ */ diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index c874f86a5f0c..0bcc05ff06de 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -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; +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111060835.1A68Zl3B072317>