You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/vmaware.hpp
+75-74Lines changed: 75 additions & 74 deletions
Original file line number
Diff line number
Diff line change
@@ -4698,79 +4698,6 @@ struct VM {
4698
4698
// The hypervisor cannot easily rewind the system wall clock (second loop, QIT/KUSER_SHARED_DATA) without causing system instability (network timeouts, audio lag, etc)
4699
4699
staticthread_localvolatileu64 g_sink = 0; // thread_local volatile so that it doesnt need to be captured by the lambda
4700
4700
4701
-
// First we start by randomizing counts WITHOUT syscalls and WITHOUT using instructions that can be trapped by hypervisors, this was a hard task
4702
-
structentropy_provider {
4703
-
// prevent inlining so optimizer can't fold this easily
// small local mix to change subsequent outputs (still in user-mode and not a syscall)
4766
-
volatile ULONG64 scrub = r;
4767
-
scrub ^= (scrub << 11);
4768
-
scrub ^= (scrub >> 9);
4769
-
(void)scrub;
4770
-
}
4771
-
};
4772
-
4773
-
const entropy_provider entropyProv{};
4774
4701
// the reason why we use CPUID rather than RDTSC is because RDTSC is a conditionally exiting instruction, and you can modify the guest TSC without trapping it
4775
4702
auto vm_exit = []() noexcept -> u64 {
4776
4703
volatileint regs[4] = { 0 }; // doesn't need to be as elaborated as the next cpuid_lambda we will use to calculate the real latency
@@ -5078,6 +5005,80 @@ struct VM {
5078
5005
return result;
5079
5006
};
5080
5007
5008
+
// First we start by randomizing counts WITHOUT syscalls and WITHOUT using instructions that can be trapped by hypervisors, this was a hard task
5009
+
structentropy_provider {
5010
+
// prevent inlining so optimizer can't fold this easily
0 commit comments