From 9405d8ed92fbe3194509562fdaf922939fa2ba0a Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 9 Mar 2020 19:10:26 +0100 Subject: [PATCH] Activate MSR mod only for RandomX algorithms --- src/crypto/rx/Rx.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/crypto/rx/Rx.cpp b/src/crypto/rx/Rx.cpp index c04254094..3971fb5b1 100644 --- a/src/crypto/rx/Rx.cpp +++ b/src/crypto/rx/Rx.cpp @@ -40,6 +40,7 @@ class RxPrivate; static bool osInitialized = false; +static bool msrInitialized = false; static const char *tag = BLUE_BG(WHITE_BOLD_S " rx ") " "; static RxPrivate *d_ptr = nullptr; @@ -65,6 +66,10 @@ const char *xmrig::rx_tag() bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cpu) { if (job.algorithm().family() != Algorithm::RANDOM_X) { + if (msrInitialized) { + msrDestroy(); + msrInitialized = false; + } return true; } @@ -72,8 +77,12 @@ bool xmrig::Rx::init(const Job &job, const RxConfig &config, const CpuConfig &cp return true; } - if (!osInitialized) { + if (!msrInitialized) { msrInit(config); + msrInitialized = true; + } + + if (!osInitialized) { setupMainLoopExceptionFrame(); osInitialized = true; }