Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono] Look for Native Signal SIMD Context #89467

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/mono/mono/utils/mono-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,27 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
#endif
#ifdef __linux__
struct fpsimd_context *fpctx = (struct fpsimd_context*)&((ucontext_t*)sigctx)->uc_mcontext.__reserved;
int i;

g_assert (fpctx->head.magic == FPSIMD_MAGIC);
for (i = 0; i < 32; ++i)
size_t size = 0;
do {
struct fpsimd_context *fpctx_temp = (struct fpsimd_context*)&(((ucontext_t*)sigctx)->uc_mcontext.__reserved[size]);

if (fpctx_temp->head.magic == FPSIMD_MAGIC)
{
g_assert (fpctx_temp->head.size >= sizeof (struct fpsimd_context));
g_assert (size + fpctx_temp->head.size <= sizeof (((ucontext_t*)sigctx)->uc_mcontext.__reserved));

fpctx = fpctx_temp;
break;
}

if (fpctx_temp->head.size == 0)
break;

size += fpctx_temp->head.size;
} while (size + sizeof (struct fpsimd_context) <= sizeof (((ucontext_t*)sigctx)->uc_mcontext.__reserved));

for (int i = 0; i < 32; ++i)
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
mctx->fregs [i] = fpctx->vregs [i];
#endif
/* FIXME: apple */
Expand Down
Loading