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
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -375,6 +375,7 @@
375
375
#include<type_traits>
376
376
#include<stdexcept>
377
377
#include<numeric>
378
+
#include<atomic>
378
379
379
380
#if (WINDOWS)
380
381
#include<windows.h>
@@ -4661,11 +4662,15 @@ struct VM {
4661
4662
#endif
4662
4663
};
4663
4664
4664
-
thread_localu32 aux = 0;
4665
-
auto cpuid = [&](unsignedint leaf) noexcept -> u64 {
4666
4665
#if (MSVC)
4666
+
thread_localu32 aux = 0;
4667
+
#endif
4668
+
4669
+
auto cpuid = [&](unsignedint leaf) noexcept -> u64 {
4670
+
#if (MSVC)
4667
4671
// make regs volatile so writes cannot be optimized out, if this isn't added and the code is compiled in release mode, cycles would be around 40 even under Hyper-V
4668
4672
volatileint regs[4]{};
4673
+
4669
4674
// ensure the CPU pipeline is drained of previous loads before we start the clock
4670
4675
_mm_lfence();
4671
4676
@@ -4904,8 +4909,10 @@ struct VM {
4904
4909
4905
4910
constu64 a = t1_start.load(std::memory_order_acquire);
4906
4911
constu64 b = t1_end.load(std::memory_order_acquire);
4907
-
constu64 c = t2_start.load(std::memory_order_acquire);
4908
-
constu64 d = t2_end.load(std::memory_order_acquire);
4912
+
#ifdef __VMAWARE_DEBUG__
4913
+
constu64 c = t2_start.load(std::memory_order_acquire);
4914
+
constu64 d = t2_end.load(std::memory_order_acquire);
0 commit comments