MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / ReconstructThreadState

Function ReconstructThreadState

Source/Windows/ARM64EC/Module.cpp:438–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438static void ReconstructThreadState(FEXCore::Core::InternalThreadState* Thread, ARM64_NT_CONTEXT& Context) {
439 const auto& Config = SignalDelegator->GetConfig();
440 auto& State = Thread->CurrentFrame->State;
441
442 State.rip = CTX->RestoreRIPFromHostPC(Thread, Context.Pc);
443
444 // Spill all SRA GPRs
445 for (size_t i = 0; i < Config.SRAGPRCount; i++) {
446 State.gregs[i] = Context.X[Config.SRAGPRMapping[i]];
447 }
448
449 // Spill all SRA FPRs
450 for (size_t i = 0; i < Config.SRAFPRCount; i++) {
451 memcpy(State.xmm.sse.data[i], &Context.V[Config.SRAFPRMapping[i]], sizeof(__uint128_t));
452 }
453
454 // Spill EFlags
455 uint32_t EFlags = CTX->ReconstructCompactedEFLAGS(Thread, true, Context.X, Context.Cpsr);
456 CTX->SetFlagsFromCompactedEFLAGS(Thread, EFlags);
457}
458
459// Reconstructs an x64 context from the input thread's state, packed into a regular ARM64 context following the ARM64EC register mapping
460static ARM64_NT_CONTEXT StoreStateToPackedECContext(FEXCore::Core::InternalThreadState* Thread, uint32_t FPCR, uint32_t FPSR) {

Callers 2

RethrowGuestExceptionFunction · 0.70

Calls 3

RestoreRIPFromHostPCMethod · 0.80

Tested by

no test coverage detected