Date: Fri, 17 Jun 2022 19:38:21 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b04e157ce9ea - stable/13 - linux: Implement linux_to_bsd_regset() on arm64 Message-ID: <202206171938.25HJcLsc014574@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b04e157ce9eaea73d9aca3840d3d8db9c2c8ba32 commit b04e157ce9eaea73d9aca3840d3d8db9c2c8ba32 Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-11-06 08:35:04 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:33:36 +0000 linux: Implement linux_to_bsd_regset() on arm64 This will be used by ptrace. Sponsored By: EPSRC (cherry picked from commit 6f397bc0fbe378664bbbc7c2296043e3b9673e2a) --- 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 9172b10a5876..746c93bb86c8 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -147,3 +147,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?202206171938.25HJcLsc014574>