Skip to content

Commit f8dde61

Browse files
authored
Merge pull request #634 from NotRequiem/main
added extra debugs in vm::timer for clarity
2 parents 33b6583 + 4f540a8 commit f8dde61

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/vmaware.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5011,9 +5011,11 @@ struct VM {
50115011
debug("TIMER: vmexit latency: ", cpuid_latency);
50125012

50135013
if (cpuid_latency >= cycle_threshold) {
5014+
debug("TIMER: VMAware detected a vmexit on CPUID");
50145015
return true;
50155016
}
50165017
else if (cpuid_latency <= 25) {
5018+
debug("TIMER: VMAware detected a hypervisor downscaling CPUID latency");
50175019
// cpuid is fully serializing, no CPU have this low average cycles in real-world scenarios
50185020
// however, in patches, zero or even negative deltas can be seen oftenly
50195021
return true;
@@ -5028,10 +5030,12 @@ struct VM {
50285030

50295031
// if thread 1 was faster than thread 2, hypervisor downscaled TSC per-vCPU in either cpuid or rdtsc
50305032
if (ratio < 0.95 || ratio > 1.05) {
5033+
debug("TIMER: VMAware detected a hypervisor intercepting TSC");
50315034
return true;
50325035
}
50335036
// if calibration was much faster than thread 1, hypervisor downscaled TSC globally while thread 2 was spamming
50345037
if (calibration_ratio < 0.95) {
5038+
debug("TIMER: VMAware detected a hypervisor intercepting TSC globally");
50355039
return true;
50365040
}
50375041

@@ -5086,7 +5090,7 @@ struct VM {
50865090
_freea(raw);
50875091

50885092
if (speed < 800) {
5089-
debug("TIMER: VMAware detected an hypervisor offsetting TSC: ", speed);
5093+
debug("TIMER: VMAware detected a hook in rdtsc, frequency was: ", speed);
50905094
return true;
50915095
}
50925096
#endif

0 commit comments

Comments
 (0)