| 617 | } // namespace Exception |
| 618 | |
| 619 | extern "C" void SyncThreadContext(CONTEXT* Context) { |
| 620 | ProcessPendingCrossProcessEmulatorWork(); |
| 621 | auto* Thread = GetCPUArea().ThreadState(); |
| 622 | // All other EFlags bits are lost when converting to/from an ARM64EC context, so merge them in from the current JIT state. |
| 623 | // This is advisable over dropping their values as thread suspend/resume uses this function, and that can happen at any point in guest code. |
| 624 | static constexpr uint32_t ECValidEFlagsMask {(1U << FEXCore::X86State::RFLAG_OF_RAW_LOC) | (1U << FEXCore::X86State::RFLAG_CF_RAW_LOC) | |
| 625 | (1U << FEXCore::X86State::RFLAG_ZF_RAW_LOC) | (1U << FEXCore::X86State::RFLAG_SF_RAW_LOC) | |
| 626 | (1U << FEXCore::X86State::RFLAG_TF_RAW_LOC)}; |
| 627 | |
| 628 | uint32_t StateEFlags = CTX->ReconstructCompactedEFLAGS(Thread, false, nullptr, 0); |
| 629 | Context->EFlags = (Context->EFlags & ECValidEFlagsMask) | (StateEFlags & ~ECValidEFlagsMask); |
| 630 | Exception::LoadStateFromECContext(Thread, *Context); |
| 631 | } |
| 632 | |
| 633 | NTSTATUS ProcessInit() { |
| 634 | InitSyscalls(); |
nothing calls this directly
no test coverage detected