systrap/arm64: use the fpsimd_context structure to parse fpu states

PiperOrigin-RevId: 514487900
This commit is contained in:
Andrei Vagin
2023-03-06 12:22:51 -08:00
committed by gVisor bot
parent 702540baec
commit 38189969f2
@@ -106,13 +106,13 @@ void __export_sighandler(int signo, siginfo_t *siginfo, void *_ucontext) {
// point context.
//
// See: arch/arm64/include/uapi/asm/sigcontext.h
const uint64_t kSigframeMagicHeaderLen = sizeof(struct _aarch64_ctx);
struct fpsimd_context *fpctx = &ucontext->uc_mcontext.__reserved;
// Verify the header.
if (((uint32_t *)&ucontext->uc_mcontext.__reserved)[0] != FPSIMD_MAGIC) {
if (fpctx->head.magic != FPSIMD_MAGIC ||
__export_arch_state.fp_len != sizeof(*fpctx) - sizeof(fpctx->head)) {
panic(0xbadf);
}
uint8_t *fpStatePointer =
(uint8_t *)&ucontext->uc_mcontext.__reserved + kSigframeMagicHeaderLen;
uint8_t *fpStatePointer = (uint8_t *)&fpctx->fpsr;
if (__export_context_decoupling_exp) {
memcpy(ctx->fpstate, fpStatePointer, __export_arch_state.fp_len);
} else {