From 517a1836ee7e71de504e9cc61aaf5791ac28f1a5 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 28 Sep 2026 10:39:21 +0200 Subject: [PATCH] ARM64EC: Use correct context flags in ThreadTerm --- Source/Windows/ARM64EC/Module.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index 93a3ab098..7fd71d24b 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -1018,7 +1018,7 @@ NTSTATUS ThreadTerm(HANDLE Thread, LONG ExitCode) { return STATUS_ACCESS_DENIED; } - auto ThreadDup = FEX::Windows::DupHandle(Thread, THREAD_QUERY_INFORMATION | THREAD_SUSPEND_RESUME); + auto ThreadDup = FEX::Windows::DupHandle(Thread, THREAD_QUERY_INFORMATION | THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT); THREAD_BASIC_INFORMATION Info; if (auto Err = NtQueryInformationThread(*ThreadDup, ThreadBasicInformation, &Info, sizeof(Info), nullptr); Err) { @@ -1032,6 +1032,7 @@ NTSTATUS ThreadTerm(HANDLE Thread, LONG ExitCode) { // If we are suspending a thread that isn't ourselves, try to suspend it first so we know internal JIT locks aren't being held. NtSuspendThread(*ThreadDup, NULL); // This will wait for the thread to be suspended + TmpContext.ContextFlags = CONTEXT_CONTROL; NtGetContextThread(*ThreadDup, &TmpContext); }