From 162bd4be978a7862a7cf5d8c8c4b69bec77b2c6f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 4 May 2026 12:39:34 -0700 Subject: [PATCH] win32: Query DCZID_EL0 so clzero works EL0 registers are readable without going through the registry, but we were failing to populate this register, which was causing clzero to not be supported. --- Source/Windows/Common/CPUFeatures.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Windows/Common/CPUFeatures.cpp b/Source/Windows/Common/CPUFeatures.cpp index 0b9696dce..9860eb6e2 100644 --- a/Source/Windows/Common/CPUFeatures.cpp +++ b/Source/Windows/Common/CPUFeatures.cpp @@ -31,6 +31,14 @@ uint64_t ReadRegU64(HKEY Key, const char* Name) { } // namespace namespace FEX::Windows { +#define GetSysReg(name, reg) \ + static uint64_t Get_##name() { \ + uint64_t Result {}; \ + __asm("mrs %[Res], " #reg : [Res] "=r"(Result)); \ + return Result; \ + } +GetSysReg(DCZID_EL0, DCZID_EL0); + class CPUFeaturesFromRegistry final : public FEX::CPUFeatures { public: explicit CPUFeaturesFromRegistry(HKEY Key) { @@ -43,6 +51,7 @@ public: ZFR0.SetReg(ReadRegU64(Key, "CP 4024")); MMFR1.SetReg(ReadRegU64(Key, "CP 4039")); ISAR2.SetReg(ReadRegU64(Key, "CP 4032")); + DCZID.SetReg(Get_DCZID_EL0()); FillFeatureFlags(); } };