1
0
mirror of https://github.com/xmrig/xmrig.git synced 2026-04-30 17:12:40 -04:00

Added RxMsr class.

This commit is contained in:
XMRig
2021-01-23 23:23:39 +07:00
parent b9d813c403
commit 9dae559b73
17 changed files with 435 additions and 746 deletions

View File

@@ -24,6 +24,7 @@
#include "hw/msr/MsrItem.h"
#include <functional>
#include <memory>
@@ -39,17 +40,24 @@ class Msr
public:
XMRIG_DISABLE_COPY_MOVE(Msr)
using Callback = std::function<bool(int32_t cpu)>;
Msr();
~Msr();
static const char *tag();
static std::shared_ptr<Msr> get();
inline bool write(const MsrItem &item, int32_t cpu = -1, bool verbose = true) { return write(item.reg(), item.value(), cpu, item.mask(), verbose); }
bool isAvailable() const;
bool write(uint32_t reg, uint64_t value, int32_t cpu = -1, uint64_t mask = MsrItem::kNoMask, bool verbose = true);
bool write(Callback &&callback);
MsrItem read(uint32_t reg, int32_t cpu = -1, bool verbose = true) const;
private:
bool rdmsr(uint32_t reg, int32_t cpu, uint64_t &value) const;
bool wrmsr(uint32_t reg, uint64_t value, int32_t cpu);
MsrPrivate *d_ptr = nullptr;
};