@@ -4734,14 +4734,14 @@ struct VM {
47344734 const auto& info = VM::cpu::analyze_cpu();
47354735 if (info.found) {
47364736 if (info.base_clock_mhz == 0) {
4737- debug (" TIMER: Processor's true base speed not available for this CPU " );
4737+ debug("TIMER: CPU not found in the database ");
47384738 }
47394739 else if (info.base_clock_mhz < 800.0) {
47404740 debug("TIMER: RDTSC seems to be intercepted by an hypervisor");
47414741 return true;
47424742 }
47434743 else {
4744- debug (" TIMER: Processor 's true base speed -> " , static_cast <double >(info.base_clock_mhz ), " MHz" );
4744+ debug("TIMER: CPU 's true base speed -> ", static_cast<double>(info.base_clock_mhz), " MHz");
47454745
47464746 constexpr u32 check_leaf = 0x80000007u;
47474747 constexpr double INVARIANT_TSC_DELTA = 250.0;
@@ -11246,6 +11246,43 @@ struct VM {
1124611246 return false;
1124711247 }
1124811248
11249+ // Surface Pro models typically do not have PIT
11250+ {
11251+ const char* manufacturer = nullptr;
11252+ const char* model = nullptr;
11253+ if (util::get_manufacturer_model(&manufacturer, &model)) {
11254+ auto ci_contains = [](const char* hay, const char* needle) noexcept -> bool {
11255+ if (!hay || !needle || !*hay || !*needle) return false;
11256+ const unsigned char* h = reinterpret_cast<const unsigned char*>(hay);
11257+ const unsigned char* n = reinterpret_cast<const unsigned char*>(needle);
11258+ const size_t nlen = strlen(reinterpret_cast<const char*>(n));
11259+ for (; *h; ++h) {
11260+ size_t i = 0;
11261+ for (;; ++i) {
11262+ unsigned char hc = h[i];
11263+ unsigned char nc = n[i];
11264+ if (!nc) return false; // matched whole needle
11265+ if (!hc) break; // hay ended
11266+ // ascii lowercase
11267+ if (hc >= 'A' && hc <= 'Z') hc += 32;
11268+ if (nc >= 'A' && nc <= 'Z') nc += 32;
11269+ if (hc != nc) break;
11270+ }
11271+ if (i == nlen) return false;
11272+ }
11273+ return false;
11274+ };
11275+
11276+ const bool model_has_surface = ci_contains(model, "surface");
11277+ const bool model_has_pro = ci_contains(model, "pro");
11278+ const bool man_is_microsoft = ci_contains(manufacturer, "microsoft");
11279+
11280+ if (model_has_surface && (model_has_pro || man_is_microsoft)) {
11281+ return false;
11282+ }
11283+ }
11284+ }
11285+
1124911286 // The RTC (ACPI/CMOS RTC) timer can't be always detected via SetupAPI, it needs AML decode of the DSDT firmware table
1125011287 // The HPET (PNP0103) timer presence check was removed, more info at: https://github.com/kernelwernel/VMAware/pull/616
1125111288 // Here, we check for the PIT/AT timer (PC-class System Timer)
0 commit comments