mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-07 23:00:19 +02:00
OpcodeDispatcher: Allow x86 code to read CNTVCT on ARM64EC
Required by newer insider preview versions, I noticed many crashes with this exception number and QueryPeformanceCounter in the backtrace, testing with XTA found it to not be passed through and instead write the host CNTVCT (unscaled) into RAX. No other registers seem to be affected.
This commit is contained in:
1 parent
4f404160d0
commit
ef823ce82b
1 file changed
+9
@@ -4665,6 +4665,15 @@ void OpDispatchBuilder::INTOp(OpcodeArgs) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _M_ARM_64EC
|
||||
// This is used when QueryPerformanceCounter is called on recent Windows versions, it causes CNTVCT to be written into RAX.
|
||||
constexpr uint8_t GET_CNTVCT_LITERAL = 0x81;
|
||||
if (Literal == GET_CNTVCT_LITERAL) {
|
||||
StoreGPRRegister(X86State::REG_RAX, _CycleCounter());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reason.ErrorRegister = Literal << 3 | (0b010);
|
||||
Reason.Signal = Core::FAULT_SIGSEGV;
|
||||
// GP is raised when task-gate isn't setup to be valid
|
||||
|
||||
Reference in new issue
Block a user