This commit is contained in:
lizzie 2026-05-19 08:09:44 +00:00
parent 7a20a37981
commit d77285fc35

View file

@ -38,8 +38,8 @@ void MicroSleep(u64 rem) {
constexpr auto EnableWaitTimeFlag = 1U << 1; constexpr auto EnableWaitTimeFlag = 1U << 1;
constexpr auto RequestC1State = 0U; constexpr auto RequestC1State = 0U;
// monitor_var should be aligned to a cache line. // monitor_var should be aligned to a cache line.
alignas(64) u64 monitor_var{}; alignas(64) static const u64 monitor_var{};
_mm_monitorx(&monitor_var, 0, 0); _mm_monitorx(const_cast<u64*>(std::addressof(monitor_var)), 0, 0);
_mm_mwaitx(EnableWaitTimeFlag, RequestC1State, cycles); _mm_mwaitx(EnableWaitTimeFlag, RequestC1State, cycles);
} else { } else {
std::this_thread::yield(); std::this_thread::yield();