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

Method HandleSyscall

Source/Windows/ARM64EC/Module.cpp:567–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565 }
566
567 uint64_t HandleSyscall(FEXCore::Core::CpuStateFrame* Frame, FEXCore::HLE::SyscallArguments* Args) override {
568 ProcessPendingCrossProcessEmulatorWork();
569
570 // Manually raise an exeption with the current JIT state packed into a native context, ntdll handles this and
571 // reenters the JIT (see dlls/ntdll/signal_arm64ec.c in wine).
572 uint64_t FPCR, FPSR;
573 __asm volatile("mrs %[fpcr], fpcr" : [fpcr] "=r"(FPCR));
574 __asm volatile("mrs %[fpsr], fpsr" : [fpsr] "=r"(FPSR));
575
576 auto* Thread = GetCPUArea().ThreadState();
577 KiUserExceptionDispatcherStackLayout DispatchArgs {
578 .Context = StoreStateToPackedECContext(Thread, static_cast<uint32_t>(FPCR), static_cast<uint32_t>(FPSR)),
579 .Rec = {.ExceptionCode = STATUS_EMULATION_SYSCALL}};
580 // PC is expected to hold the return address after the thunk, so skip over the INT 2E/SYSCALL instruction.
581 DispatchArgs.Context.Pc += 2;
582 JumpSetStack(KiUserExceptionDispatcher, reinterpret_cast<uintptr_t>(&DispatchArgs));
583 }
584
585 FEXCore::HLE::SyscallABI GetSyscallABI(uint64_t Syscall) override {
586 return {.NumArgs = 0, .HasReturn = false, .HostSyscallNumber = -1};

Callers

nothing calls this directly

Calls 2

GetCPUAreaFunction · 0.85

Tested by

no test coverage detected