git: 519141de7e66 - stable/14 - libc/aarch64: Add a non-trivial getcontextx
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Sep 2024 08:50:40 UTC
The branch stable/14 has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=519141de7e6639e4df3485073d2521dc95b60207
commit 519141de7e6639e4df3485073d2521dc95b60207
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-03-06 12:51:18 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-09-02 08:44:40 +0000
libc/aarch64: Add a non-trivial getcontextx
Add support for extra registers to the arm64 getcontextx. As no
registers are defined this just adds the extra register list and an end
context.
Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44255
(cherry picked from commit 5202ca77aaf552310bcbaccba750ee9f0888d0d8)
---
lib/libc/aarch64/gen/getcontextx.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/libc/aarch64/gen/getcontextx.c b/lib/libc/aarch64/gen/getcontextx.c
index b9d4522d96ee..9972d3208d08 100644
--- a/lib/libc/aarch64/gen/getcontextx.c
+++ b/lib/libc/aarch64/gen/getcontextx.c
@@ -32,13 +32,26 @@
int
__getcontextx_size(void)
{
+ size_t size;
- return (sizeof(ucontext_t));
+ size = sizeof(ucontext_t);
+ size += sizeof(struct arm64_reg_context); /* Space for ARM64_CTX_END */
+
+ return (size);
}
int
__fillcontextx2(char *ctx)
{
+ struct arm64_reg_context *reg_ctx;
+ ucontext_t *ucp;
+
+ ucp = (ucontext_t *)ctx;
+ ucp->uc_mcontext.mc_ptr = (uint64_t)(ucp + 1);
+
+ reg_ctx = (struct arm64_reg_context *)ucp->uc_mcontext.mc_ptr;
+ reg_ctx->ctx_id = ARM64_CTX_END;
+ reg_ctx->ctx_size = sizeof(struct arm64_reg_context);
return (0);
}
@@ -49,7 +62,10 @@ __fillcontextx(char *ctx)
ucontext_t *ucp;
ucp = (ucontext_t *)ctx;
- return (getcontext(ucp));
+ if (getcontext(ucp) == -1)
+ return (-1);
+ __fillcontextx2(ctx);
+ return (0);
}
__weak_reference(__getcontextx, getcontextx);