[PATCH 2/2] ntdll: Report rdtsc processor feature if supported.

Paul Gofman gofmanp at gmail.com
Thu Feb 13 05:11:25 CST 2020


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48386
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/ntdll/nt.c            | 2 ++
 dlls/ntdll/tests/virtual.c | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index bc40d4e276..b89602cee8 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1122,6 +1122,7 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
                 user_shared_data->ProcessorFeatures[PF_VIRT_FIRMWARE_ENABLED]        = (regs2[2] >> 2) & 1;
                 user_shared_data->ProcessorFeatures[PF_NX_ENABLED]                   = (regs2[3] >> 20) & 1;
                 user_shared_data->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] >> 31) & 1;
+                user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = (regs2[3] >> 27) & 1;
                 if (regs2[3] >> 31) info->FeatureSet |= CPU_FEATURE_3DNOW;
             }
         }
@@ -1143,6 +1144,7 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
             {
                 do_cpuid(0x80000001, regs2);  /* get vendor features */
                 user_shared_data->ProcessorFeatures[PF_NX_ENABLED] = (regs2[3] >> 20) & 1;
+                user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = (regs2[3] >> 27) & 1;
             }
         }
         else
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
index 683a5e7bdf..3b0d74daeb 100644
--- a/dlls/ntdll/tests/virtual.c
+++ b/dlls/ntdll/tests/virtual.c
@@ -523,6 +523,11 @@ static void test_user_shared_data(void)
     ok(user_shared_data->NumberOfPhysicalPages == sbi.MmNumberOfPhysicalPages,
             "Got number of physical pages %#x, expected %#x.\n",
             user_shared_data->NumberOfPhysicalPages, sbi.MmNumberOfPhysicalPages);
+
+#if defined(__i386__) || defined(__x86_64__)
+    ok(user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] /* Supported since Pentium CPUs. */,
+            "_RDTSC not available.\n");
+#endif
 }
 
 START_TEST(virtual)
-- 
2.24.1




More information about the wine-devel mailing list