Fixed --randomx-wrmsr option without parameters.

This commit is contained in:
XMRig 2019-12-11 19:16:01 +07:00
parent 5ab17fcd46
commit 4fb3086c1c
No known key found for this signature in database
GPG key ID: 446A53638BE94409
3 changed files with 12 additions and 2 deletions

View file

@ -170,6 +170,10 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
return set(doc, kRandomX, "1gb-pages", true); return set(doc, kRandomX, "1gb-pages", true);
case IConfig::RandomXWrmsrKey: /* --randomx-wrmsr */ case IConfig::RandomXWrmsrKey: /* --randomx-wrmsr */
if (arg == nullptr) {
return set(doc, kRandomX, "wrmsr", true);
}
return set(doc, kRandomX, "wrmsr", static_cast<int64_t>(strtol(arg, nullptr, 10))); return set(doc, kRandomX, "wrmsr", static_cast<int64_t>(strtol(arg, nullptr, 10)));
# endif # endif

View file

@ -100,7 +100,7 @@ static const option options[] = {
{ "randomx-mode", 1, nullptr, IConfig::RandomXModeKey }, { "randomx-mode", 1, nullptr, IConfig::RandomXModeKey },
{ "randomx-1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey }, { "randomx-1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey },
{ "1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey }, { "1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey },
{ "randomx-wrmsr", 1, nullptr, IConfig::RandomXWrmsrKey }, { "randomx-wrmsr", 2, nullptr, IConfig::RandomXWrmsrKey },
# endif # endif
# ifdef XMRIG_FEATURE_OPENCL # ifdef XMRIG_FEATURE_OPENCL
{ "opencl", 0, nullptr, IConfig::OclKey }, { "opencl", 0, nullptr, IConfig::OclKey },

View file

@ -109,7 +109,13 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
obj.AddMember(StringRef(kInit), m_threads, allocator); obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator); obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator);
obj.AddMember(StringRef(kOneGbPages), m_oneGbPages, allocator); obj.AddMember(StringRef(kOneGbPages), m_oneGbPages, allocator);
obj.AddMember(StringRef(kWrmsr), m_wrmsr < 0 ? Value(kFalseType) : Value(m_wrmsr), allocator);
if (m_wrmsr < 0 || m_wrmsr == 6) {
obj.AddMember(StringRef(kWrmsr), m_wrmsr == 6, allocator);
}
else {
obj.AddMember(StringRef(kWrmsr), m_wrmsr, allocator);
}
# ifdef XMRIG_FEATURE_HWLOC # ifdef XMRIG_FEATURE_HWLOC
if (!m_nodeset.empty()) { if (!m_nodeset.empty()) {