mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 00:37:46 +00:00
Merge branch 'dev'
This commit is contained in:
commit
a80f3e8190
33 changed files with 428 additions and 279 deletions
|
@ -1,3 +1,11 @@
|
|||
# v5.5.1
|
||||
- [#1469](https://github.com/xmrig/xmrig/issues/1469) Fixed build with gcc 4.8.
|
||||
- [#1473](https://github.com/xmrig/xmrig/pull/1473) Added RandomX auto-config for mobile Ryzen APUs.
|
||||
- [#1477](https://github.com/xmrig/xmrig/pull/1477) Fixed build with Clang.
|
||||
- [#1489](https://github.com/xmrig/xmrig/pull/1489) RandomX JIT compiler tweaks.
|
||||
- [#1493](https://github.com/xmrig/xmrig/pull/1493) Default value for Intel MSR preset changed to `15`.
|
||||
- Fixed unwanted resume after RandomX dataset change.
|
||||
|
||||
# v5.5.0
|
||||
- [#179](https://github.com/xmrig/xmrig/issues/179) Added support for [environment variables](https://xmrig.com/docs/miner/environment-variables) in config file.
|
||||
- [#1445](https://github.com/xmrig/xmrig/pull/1445) Removed `rx/v` algorithm.
|
||||
|
|
|
@ -40,6 +40,12 @@ bool ocl_generic_rx_generator(const OclDevice &device, const Algorithm &algorith
|
|||
return false;
|
||||
}
|
||||
|
||||
// Mobile Ryzen APUs
|
||||
if (device.type() == OclDevice::Raven) {
|
||||
threads.add(OclThread(device.index(), (device.computeUnits() > 4) ? 256 : 128, 8, 1, true, true, 6));
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t mem = device.globalMemSize();
|
||||
auto config = RxAlgo::base(algorithm);
|
||||
bool gcnAsm = false;
|
||||
|
|
|
@ -52,7 +52,7 @@ xmrig::OclRxBaseRunner::OclRxBaseRunner(size_t index, const OclLaunchData &data)
|
|||
m_worksize = 8;
|
||||
}
|
||||
|
||||
if (data.device.type() == OclDevice::Vega_10 || data.device.type() == OclDevice::Vega_20) {
|
||||
if (data.device.type() == OclDevice::Vega_10 || data.device.type() == OclDevice::Vega_20 || data.device.type() == OclDevice::Raven) {
|
||||
m_gcn_version = 14;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -69,21 +69,23 @@ public:
|
|||
|
||||
virtual ~IApiRequest() = default;
|
||||
|
||||
virtual bool accept() = 0;
|
||||
virtual bool hasParseError() const = 0;
|
||||
virtual bool isDone() const = 0;
|
||||
virtual bool isNew() const = 0;
|
||||
virtual bool isRestricted() const = 0;
|
||||
virtual const rapidjson::Value &json() const = 0;
|
||||
virtual const String &rpcMethod() const = 0;
|
||||
virtual const String &url() const = 0;
|
||||
virtual int version() const = 0;
|
||||
virtual Method method() const = 0;
|
||||
virtual rapidjson::Document &doc() = 0;
|
||||
virtual rapidjson::Value &reply() = 0;
|
||||
virtual RequestType type() const = 0;
|
||||
virtual Source source() const = 0;
|
||||
virtual void done(int status) = 0;
|
||||
virtual bool accept() = 0;
|
||||
virtual bool hasParseError() const = 0;
|
||||
virtual bool isDone() const = 0;
|
||||
virtual bool isNew() const = 0;
|
||||
virtual bool isRestricted() const = 0;
|
||||
virtual const rapidjson::Value &json() const = 0;
|
||||
virtual const String &rpcMethod() const = 0;
|
||||
virtual const String &url() const = 0;
|
||||
virtual int version() const = 0;
|
||||
virtual Method method() const = 0;
|
||||
virtual rapidjson::Document &doc() = 0;
|
||||
virtual rapidjson::Value &reply() = 0;
|
||||
virtual RequestType type() const = 0;
|
||||
virtual Source source() const = 0;
|
||||
virtual void done(int status) = 0;
|
||||
virtual void setRpcError(int code, const char *message = nullptr) = 0;
|
||||
virtual void setRpcResult(rapidjson::Value &result) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -53,6 +53,10 @@ static inline const char *rpcError(int code) {
|
|||
return "Invalid params";
|
||||
}
|
||||
|
||||
if (code >= HTTP_STATUS_BAD_REQUEST && code <= HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED) {
|
||||
return http_status_str(static_cast<http_status>(code));
|
||||
}
|
||||
|
||||
return "Internal error";
|
||||
}
|
||||
|
||||
|
@ -82,7 +86,7 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
|||
return;
|
||||
}
|
||||
|
||||
m_rpcMethod = Json::getString(json(), "method");
|
||||
m_rpcMethod = Json::getString(m_body, "method");
|
||||
if (m_rpcMethod.isEmpty()) {
|
||||
done(RPC_INVALID_REQUEST);
|
||||
|
||||
|
@ -129,6 +133,10 @@ bool xmrig::HttpApiRequest::accept()
|
|||
|
||||
const rapidjson::Value &xmrig::HttpApiRequest::json() const
|
||||
{
|
||||
if (type() == REQ_JSON_RPC) {
|
||||
return Json::getValue(m_body, "params");
|
||||
}
|
||||
|
||||
return m_body;
|
||||
}
|
||||
|
||||
|
@ -150,25 +158,14 @@ void xmrig::HttpApiRequest::done(int status)
|
|||
m_res.setStatus(HTTP_STATUS_OK);
|
||||
|
||||
if (status != HTTP_STATUS_OK) {
|
||||
if (status == HTTP_STATUS_NOT_FOUND) {
|
||||
status = RPC_METHOD_NOT_FOUND;
|
||||
}
|
||||
|
||||
Value error(kObjectType);
|
||||
error.AddMember("code", status, allocator);
|
||||
error.AddMember("message", StringRef(rpcError(status)), allocator);
|
||||
|
||||
reply().AddMember(StringRef(kError), error, allocator);
|
||||
setRpcError(status == HTTP_STATUS_NOT_FOUND ? RPC_METHOD_NOT_FOUND : status);
|
||||
}
|
||||
else if (!reply().HasMember(kResult)) {
|
||||
Value result(kObjectType);
|
||||
result.AddMember("status", "OK", allocator);
|
||||
|
||||
reply().AddMember(StringRef(kResult), result, allocator);
|
||||
setRpcResult(result);
|
||||
}
|
||||
|
||||
reply().AddMember("jsonrpc", "2.0", allocator);
|
||||
reply().AddMember(StringRef(kId), Value().CopyFrom(Json::getValue(json(), kId), allocator), allocator);
|
||||
}
|
||||
else {
|
||||
m_res.setStatus(status);
|
||||
|
@ -176,3 +173,38 @@ void xmrig::HttpApiRequest::done(int status)
|
|||
|
||||
m_res.end();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::setRpcError(int code, const char *message)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc().GetAllocator();
|
||||
|
||||
Value error(kObjectType);
|
||||
error.AddMember("code", code, allocator);
|
||||
error.AddMember("message", message ? StringRef(message) : StringRef(rpcError(code)), allocator);
|
||||
|
||||
rpcDone(kError, error);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::setRpcResult(rapidjson::Value &result)
|
||||
{
|
||||
rpcDone(kResult, result);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::rpcDone(const char *key, rapidjson::Value &value)
|
||||
{
|
||||
ApiRequest::done(0);
|
||||
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc().GetAllocator();
|
||||
|
||||
reply().AddMember(StringRef(key), value, allocator);
|
||||
reply().AddMember("jsonrpc", "2.0", allocator);
|
||||
reply().AddMember(StringRef(kId), Value().CopyFrom(Json::getValue(m_body, kId), allocator), allocator);
|
||||
|
||||
m_res.setStatus(HTTP_STATUS_OK);
|
||||
m_res.end();
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -53,8 +53,12 @@ protected:
|
|||
const rapidjson::Value &json() const override;
|
||||
Method method() const override;
|
||||
void done(int status) override;
|
||||
void setRpcError(int code, const char *message = nullptr) override;
|
||||
void setRpcResult(rapidjson::Value &result) override;
|
||||
|
||||
private:
|
||||
void rpcDone(const char *key, rapidjson::Value &value);
|
||||
|
||||
const HttpData &m_req;
|
||||
HttpApiResponse m_res;
|
||||
int m_parsed = 0;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,7 +40,9 @@ static const rapidjson::Value kNullValue;
|
|||
|
||||
bool xmrig::Json::getBool(const rapidjson::Value &obj, const char *key, bool defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsBool()) {
|
||||
|
@ -51,9 +53,17 @@ bool xmrig::Json::getBool(const rapidjson::Value &obj, const char *key, bool def
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Json::isEmpty(const rapidjson::Value &obj)
|
||||
{
|
||||
return !obj.IsObject() || obj.ObjectEmpty();
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::Json::getString(const rapidjson::Value &obj, const char *key, const char *defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsString()) {
|
||||
|
@ -66,7 +76,9 @@ const char *xmrig::Json::getString(const rapidjson::Value &obj, const char *key,
|
|||
|
||||
const rapidjson::Value &xmrig::Json::getArray(const rapidjson::Value &obj, const char *key)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return kNullValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsArray()) {
|
||||
|
@ -79,7 +91,9 @@ const rapidjson::Value &xmrig::Json::getArray(const rapidjson::Value &obj, const
|
|||
|
||||
const rapidjson::Value &xmrig::Json::getObject(const rapidjson::Value &obj, const char *key)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return kNullValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsObject()) {
|
||||
|
@ -92,7 +106,9 @@ const rapidjson::Value &xmrig::Json::getObject(const rapidjson::Value &obj, cons
|
|||
|
||||
const rapidjson::Value &xmrig::Json::getValue(const rapidjson::Value &obj, const char *key)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return kNullValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd()) {
|
||||
|
@ -105,7 +121,9 @@ const rapidjson::Value &xmrig::Json::getValue(const rapidjson::Value &obj, const
|
|||
|
||||
int xmrig::Json::getInt(const rapidjson::Value &obj, const char *key, int defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsInt()) {
|
||||
|
@ -118,7 +136,9 @@ int xmrig::Json::getInt(const rapidjson::Value &obj, const char *key, int defaul
|
|||
|
||||
int64_t xmrig::Json::getInt64(const rapidjson::Value &obj, const char *key, int64_t defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsInt64()) {
|
||||
|
@ -131,7 +151,9 @@ int64_t xmrig::Json::getInt64(const rapidjson::Value &obj, const char *key, int6
|
|||
|
||||
uint64_t xmrig::Json::getUint64(const rapidjson::Value &obj, const char *key, uint64_t defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsUint64()) {
|
||||
|
@ -144,7 +166,9 @@ uint64_t xmrig::Json::getUint64(const rapidjson::Value &obj, const char *key, ui
|
|||
|
||||
unsigned xmrig::Json::getUint(const rapidjson::Value &obj, const char *key, unsigned defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsUint()) {
|
||||
|
@ -169,5 +193,5 @@ rapidjson::Value xmrig::Json::normalize(double value, bool zero)
|
|||
|
||||
bool xmrig::JsonReader::isEmpty() const
|
||||
{
|
||||
return !m_obj.IsObject() || m_obj.ObjectEmpty();
|
||||
return Json::isEmpty(m_obj);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -37,6 +37,7 @@ class Json
|
|||
{
|
||||
public:
|
||||
static bool getBool(const rapidjson::Value &obj, const char *key, bool defaultValue = false);
|
||||
static bool isEmpty(const rapidjson::Value &obj);
|
||||
static const char *getString(const rapidjson::Value &obj, const char *key, const char *defaultValue = nullptr);
|
||||
static const rapidjson::Value &getArray(const rapidjson::Value &obj, const char *key);
|
||||
static const rapidjson::Value &getObject(const rapidjson::Value &obj, const char *key);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,6 +47,28 @@
|
|||
#endif
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
const char *BaseConfig::kApi = "api";
|
||||
const char *BaseConfig::kApiId = "id";
|
||||
const char *BaseConfig::kApiWorkerId = "worker-id";
|
||||
const char *BaseConfig::kAutosave = "autosave";
|
||||
const char *BaseConfig::kBackground = "background";
|
||||
const char *BaseConfig::kColors = "colors";
|
||||
const char *BaseConfig::kDryRun = "dry-run";
|
||||
const char *BaseConfig::kHttp = "http";
|
||||
const char *BaseConfig::kLogFile = "log-file";
|
||||
const char *BaseConfig::kPrintTime = "print-time";
|
||||
const char *BaseConfig::kSyslog = "syslog";
|
||||
const char *BaseConfig::kUserAgent = "user-agent";
|
||||
const char *BaseConfig::kVerbose = "verbose";
|
||||
const char *BaseConfig::kWatch = "watch";
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
||||
{
|
||||
m_fileName = fileName;
|
||||
|
@ -55,26 +77,25 @@ bool xmrig::BaseConfig::read(const IJsonReader &reader, const char *fileName)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_autoSave = reader.getBool("autosave", m_autoSave);
|
||||
m_background = reader.getBool("background", m_background);
|
||||
m_dryRun = reader.getBool("dry-run", m_dryRun);
|
||||
m_syslog = reader.getBool("syslog", m_syslog);
|
||||
m_watch = reader.getBool("watch", m_watch);
|
||||
m_logFile = reader.getString("log-file");
|
||||
m_userAgent = reader.getString("user-agent");
|
||||
m_version = reader.getUint("version");
|
||||
m_autoSave = reader.getBool(kAutosave, m_autoSave);
|
||||
m_background = reader.getBool(kBackground, m_background);
|
||||
m_dryRun = reader.getBool(kDryRun, m_dryRun);
|
||||
m_syslog = reader.getBool(kSyslog, m_syslog);
|
||||
m_watch = reader.getBool(kWatch, m_watch);
|
||||
m_logFile = reader.getString(kLogFile);
|
||||
m_userAgent = reader.getString(kUserAgent);
|
||||
|
||||
Log::setColors(reader.getBool("colors", Log::isColors()));
|
||||
setPrintTime(reader.getUint("print-time", 60));
|
||||
setVerbose(reader.getValue("verbose"));
|
||||
Log::setColors(reader.getBool(kColors, Log::isColors()));
|
||||
setPrintTime(reader.getUint(kPrintTime, 60));
|
||||
setVerbose(reader.getValue(kVerbose));
|
||||
|
||||
const rapidjson::Value &api = reader.getObject("api");
|
||||
const rapidjson::Value &api = reader.getObject(kApi);
|
||||
if (api.IsObject()) {
|
||||
m_apiId = Json::getString(api, "id");
|
||||
m_apiWorkerId = Json::getString(api, "worker-id");
|
||||
m_apiId = Json::getString(api, kApiId);
|
||||
m_apiWorkerId = Json::getString(api, kApiWorkerId);
|
||||
}
|
||||
|
||||
m_http.load(reader.getObject("http"));
|
||||
m_http.load(reader.getObject(kHttp));
|
||||
m_pools.load(reader);
|
||||
|
||||
return m_pools.active() > 0;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,6 +40,21 @@ class IJsonReader;
|
|||
class BaseConfig : public IConfig
|
||||
{
|
||||
public:
|
||||
static const char *kApi;
|
||||
static const char *kApiId;
|
||||
static const char *kApiWorkerId;
|
||||
static const char *kAutosave;
|
||||
static const char *kBackground;
|
||||
static const char *kColors;
|
||||
static const char *kDryRun;
|
||||
static const char *kHttp;
|
||||
static const char *kLogFile;
|
||||
static const char *kPrintTime;
|
||||
static const char *kSyslog;
|
||||
static const char *kUserAgent;
|
||||
static const char *kVerbose;
|
||||
static const char *kWatch;
|
||||
|
||||
BaseConfig() = default;
|
||||
|
||||
inline bool isAutoSave() const { return m_autoSave; }
|
||||
|
@ -78,7 +93,6 @@ protected:
|
|||
String m_logFile;
|
||||
String m_userAgent;
|
||||
uint32_t m_printTime = 60;
|
||||
uint32_t m_version = 0;
|
||||
|
||||
private:
|
||||
inline void setPrintTime(uint32_t printTime) { if (printTime <= 3600) { m_printTime = printTime; } }
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,27 +33,17 @@
|
|||
#endif
|
||||
|
||||
|
||||
#include "base/kernel/config/BaseTransform.h"
|
||||
#include "base/io/json/JsonChain.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/config/BaseTransform.h"
|
||||
#include "base/kernel/config/BaseConfig.h"
|
||||
#include "base/kernel/interfaces/IConfig.h"
|
||||
#include "base/kernel/Process.h"
|
||||
#include "base/net/stratum/Pool.h"
|
||||
#include "base/net/stratum/Pools.h"
|
||||
#include "core/config/Config_platform.h"
|
||||
|
||||
|
||||
namespace xmrig
|
||||
{
|
||||
|
||||
static const char *kAlgo = "algo";
|
||||
static const char *kApi = "api";
|
||||
static const char *kCoin = "coin";
|
||||
static const char *kHttp = "http";
|
||||
static const char *kPools = "pools";
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
void xmrig::BaseTransform::load(JsonChain &chain, Process *process, IConfigTransform &transform)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
@ -95,26 +85,26 @@ void xmrig::BaseTransform::finalize(rapidjson::Document &doc)
|
|||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
if (m_algorithm.isValid() && doc.HasMember(kPools)) {
|
||||
auto &pools = doc[kPools];
|
||||
if (m_algorithm.isValid() && doc.HasMember(Pools::kPools)) {
|
||||
auto &pools = doc[Pools::kPools];
|
||||
for (Value &pool : pools.GetArray()) {
|
||||
if (!pool.HasMember(kAlgo)) {
|
||||
pool.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
|
||||
if (!pool.HasMember(Pool::kAlgo)) {
|
||||
pool.AddMember(StringRef(Pool::kAlgo), m_algorithm.toJSON(), allocator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_coin.isValid() && doc.HasMember(kPools)) {
|
||||
auto &pools = doc[kPools];
|
||||
if (m_coin.isValid() && doc.HasMember(Pools::kPools)) {
|
||||
auto &pools = doc[Pools::kPools];
|
||||
for (Value &pool : pools.GetArray()) {
|
||||
if (!pool.HasMember(kCoin)) {
|
||||
pool.AddMember(StringRef(kCoin), m_coin.toJSON(), allocator);
|
||||
if (!pool.HasMember(Pool::kCoin)) {
|
||||
pool.AddMember(StringRef(Pool::kCoin), m_coin.toJSON(), allocator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_http) {
|
||||
set(doc, kHttp, "enabled", true);
|
||||
set(doc, BaseConfig::kHttp, Http::kEnabled, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,20 +113,20 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
|||
{
|
||||
switch (key) {
|
||||
case IConfig::AlgorithmKey: /* --algo */
|
||||
if (!doc.HasMember(kPools)) {
|
||||
if (!doc.HasMember(Pools::kPools)) {
|
||||
m_algorithm = arg;
|
||||
}
|
||||
else {
|
||||
return add(doc, kPools, kAlgo, arg);
|
||||
return add(doc, Pools::kPools, Pool::kAlgo, arg);
|
||||
}
|
||||
break;
|
||||
|
||||
case IConfig::CoinKey: /* --coin */
|
||||
if (!doc.HasMember(kPools)) {
|
||||
if (!doc.HasMember(Pools::kPools)) {
|
||||
m_coin = arg;
|
||||
}
|
||||
else {
|
||||
return add(doc, kPools, kCoin, arg);
|
||||
return add(doc, Pools::kPools, Pool::kCoin, arg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -150,61 +140,61 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
|
|||
char *user = new char[p - arg + 1]();
|
||||
strncpy(user, arg, static_cast<size_t>(p - arg));
|
||||
|
||||
add<const char *>(doc, kPools, "user", user);
|
||||
add(doc, kPools, "pass", p + 1);
|
||||
add<const char *>(doc, Pools::kPools, Pool::kUser, user);
|
||||
add(doc, Pools::kPools, Pool::kPass, p + 1);
|
||||
delete [] user;
|
||||
}
|
||||
break;
|
||||
|
||||
case IConfig::UrlKey: /* --url */
|
||||
{
|
||||
if (!doc.HasMember(kPools)) {
|
||||
doc.AddMember(rapidjson::StringRef(kPools), rapidjson::kArrayType, doc.GetAllocator());
|
||||
if (!doc.HasMember(Pools::kPools)) {
|
||||
doc.AddMember(rapidjson::StringRef(Pools::kPools), rapidjson::kArrayType, doc.GetAllocator());
|
||||
}
|
||||
|
||||
rapidjson::Value &array = doc[kPools];
|
||||
rapidjson::Value &array = doc[Pools::kPools];
|
||||
if (array.Size() == 0 || Pool(array[array.Size() - 1]).isValid()) {
|
||||
array.PushBack(rapidjson::kObjectType, doc.GetAllocator());
|
||||
}
|
||||
|
||||
set(doc, array[array.Size() - 1], "url", arg);
|
||||
set(doc, array[array.Size() - 1], Pool::kUrl, arg);
|
||||
break;
|
||||
}
|
||||
|
||||
case IConfig::UserKey: /* --user */
|
||||
return add(doc, kPools, "user", arg);
|
||||
return add(doc, Pools::kPools, Pool::kUser, arg);
|
||||
|
||||
case IConfig::PasswordKey: /* --pass */
|
||||
return add(doc, kPools, "pass", arg);
|
||||
return add(doc, Pools::kPools, Pool::kPass, arg);
|
||||
|
||||
case IConfig::RigIdKey: /* --rig-id */
|
||||
return add(doc, kPools, "rig-id", arg);
|
||||
return add(doc, Pools::kPools, Pool::kRigId, arg);
|
||||
|
||||
case IConfig::FingerprintKey: /* --tls-fingerprint */
|
||||
return add(doc, kPools, "tls-fingerprint", arg);
|
||||
return add(doc, Pools::kPools, Pool::kFingerprint, arg);
|
||||
|
||||
case IConfig::SelfSelectKey: /* --self-select */
|
||||
return add(doc, kPools, "self-select", arg);
|
||||
return add(doc, Pools::kPools, Pool::kSelfSelect, arg);
|
||||
|
||||
case IConfig::LogFileKey: /* --log-file */
|
||||
return set(doc, "log-file", arg);
|
||||
return set(doc, BaseConfig::kLogFile, arg);
|
||||
|
||||
case IConfig::HttpAccessTokenKey: /* --http-access-token */
|
||||
m_http = true;
|
||||
return set(doc, kHttp, "access-token", arg);
|
||||
return set(doc, BaseConfig::kHttp, Http::kToken, arg);
|
||||
|
||||
case IConfig::HttpHostKey: /* --http-host */
|
||||
m_http = true;
|
||||
return set(doc, kHttp, "host", arg);
|
||||
return set(doc, BaseConfig::kHttp, Http::kHost, arg);
|
||||
|
||||
case IConfig::ApiWorkerIdKey: /* --api-worker-id */
|
||||
return set(doc, kApi, "worker-id", arg);
|
||||
return set(doc, BaseConfig::kApi, BaseConfig::kApiWorkerId, arg);
|
||||
|
||||
case IConfig::ApiIdKey: /* --api-id */
|
||||
return set(doc, kApi, "id", arg);
|
||||
return set(doc, BaseConfig::kApi, BaseConfig::kApiId, arg);
|
||||
|
||||
case IConfig::UserAgentKey: /* --user-agent */
|
||||
return set(doc, "user-agent", arg);
|
||||
return set(doc, BaseConfig::kUserAgent, arg);
|
||||
|
||||
case IConfig::RetriesKey: /* --retries */
|
||||
case IConfig::RetryPauseKey: /* --retry-pause */
|
||||
|
@ -239,43 +229,43 @@ void xmrig::BaseTransform::transformBoolean(rapidjson::Document &doc, int key, b
|
|||
{
|
||||
switch (key) {
|
||||
case IConfig::BackgroundKey: /* --background */
|
||||
return set(doc, "background", enable);
|
||||
return set(doc, BaseConfig::kBackground, enable);
|
||||
|
||||
case IConfig::SyslogKey: /* --syslog */
|
||||
return set(doc, "syslog", enable);
|
||||
return set(doc, BaseConfig::kSyslog, enable);
|
||||
|
||||
case IConfig::KeepAliveKey: /* --keepalive */
|
||||
return add(doc, kPools, "keepalive", enable);
|
||||
return add(doc, Pools::kPools, Pool::kKeepalive, enable);
|
||||
|
||||
case IConfig::TlsKey: /* --tls */
|
||||
return add(doc, kPools, "tls", enable);
|
||||
return add(doc, Pools::kPools, Pool::kTls, enable);
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
case IConfig::DaemonKey: /* --daemon */
|
||||
return add(doc, kPools, "daemon", enable);
|
||||
return add(doc, Pools::kPools, Pool::kDaemon, enable);
|
||||
# endif
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
case IConfig::NicehashKey: /* --nicehash */
|
||||
return add<bool>(doc, kPools, "nicehash", enable);
|
||||
return add<bool>(doc, Pools::kPools, Pool::kNicehash, enable);
|
||||
# endif
|
||||
|
||||
case IConfig::ColorKey: /* --no-color */
|
||||
return set(doc, "colors", enable);
|
||||
return set(doc, BaseConfig::kColors, enable);
|
||||
|
||||
case IConfig::HttpRestrictedKey: /* --http-no-restricted */
|
||||
m_http = true;
|
||||
return set(doc, kHttp, "restricted", enable);
|
||||
return set(doc, BaseConfig::kHttp, Http::kRestricted, enable);
|
||||
|
||||
case IConfig::HttpEnabledKey: /* --http-enabled */
|
||||
m_http = true;
|
||||
break;
|
||||
|
||||
case IConfig::DryRunKey: /* --dry-run */
|
||||
return set(doc, "dry-run", enable);
|
||||
return set(doc, BaseConfig::kDryRun, enable);
|
||||
|
||||
case IConfig::VerboseKey: /* --verbose */
|
||||
return set(doc, "verbose", enable);
|
||||
return set(doc, BaseConfig::kVerbose, enable);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -287,27 +277,27 @@ void xmrig::BaseTransform::transformUint64(rapidjson::Document &doc, int key, ui
|
|||
{
|
||||
switch (key) {
|
||||
case IConfig::RetriesKey: /* --retries */
|
||||
return set(doc, "retries", arg);
|
||||
return set(doc, Pools::kRetries, arg);
|
||||
|
||||
case IConfig::RetryPauseKey: /* --retry-pause */
|
||||
return set(doc, "retry-pause", arg);
|
||||
return set(doc, Pools::kRetryPause, arg);
|
||||
|
||||
case IConfig::DonateLevelKey: /* --donate-level */
|
||||
return set(doc, "donate-level", arg);
|
||||
return set(doc, Pools::kDonateLevel, arg);
|
||||
|
||||
case IConfig::ProxyDonateKey: /* --donate-over-proxy */
|
||||
return set(doc, "donate-over-proxy", arg);
|
||||
return set(doc, Pools::kDonateOverProxy, arg);
|
||||
|
||||
case IConfig::HttpPort: /* --http-port */
|
||||
m_http = true;
|
||||
return set(doc, kHttp, "port", arg);
|
||||
return set(doc, BaseConfig::kHttp, Http::kPort, arg);
|
||||
|
||||
case IConfig::PrintTimeKey: /* --print-time */
|
||||
return set(doc, "print-time", arg);
|
||||
return set(doc, BaseConfig::kPrintTime, arg);
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
case IConfig::DaemonPollKey: /* --daemon-poll-interval */
|
||||
return add(doc, kPools, "daemon-poll-interval", arg);
|
||||
return add(doc, Pools::kPools, Pool::kDaemonPollInterval, arg);
|
||||
# endif
|
||||
|
||||
default:
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -115,6 +115,7 @@ public:
|
|||
AccessLogFileKey = 'A',
|
||||
BindKey = 'b',
|
||||
CustomDiffKey = 1102,
|
||||
CustomDiffStatsKey = 1104,
|
||||
DebugKey = 1101,
|
||||
ModeKey = 'm',
|
||||
PoolCoinKey = 'C',
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,12 +30,14 @@
|
|||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kEnabled = "enabled";
|
||||
static const char *kHost = "host";
|
||||
static const char *kLocalhost = "127.0.0.1";
|
||||
static const char *kPort = "port";
|
||||
static const char *kRestricted = "restricted";
|
||||
static const char *kToken = "access-token";
|
||||
|
||||
const char *Http::kEnabled = "enabled";
|
||||
const char *Http::kHost = "host";
|
||||
const char *Http::kLocalhost = "127.0.0.1";
|
||||
const char *Http::kPort = "port";
|
||||
const char *Http::kRestricted = "restricted";
|
||||
const char *Http::kToken = "access-token";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,6 +36,13 @@ namespace xmrig {
|
|||
class Http
|
||||
{
|
||||
public:
|
||||
static const char *kEnabled;
|
||||
static const char *kHost;
|
||||
static const char *kLocalhost;
|
||||
static const char *kPort;
|
||||
static const char *kRestricted;
|
||||
static const char *kToken;
|
||||
|
||||
Http();
|
||||
|
||||
inline bool isAuthRequired() const { return !m_restricted || !m_token.isNull(); }
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2019 Howard Chu <https://github.com/hyc>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,23 +47,26 @@
|
|||
|
||||
namespace xmrig {
|
||||
|
||||
static const char *kAlgo = "algo";
|
||||
static const char *kCoin = "coin";
|
||||
static const char *kDaemon = "daemon";
|
||||
static const char *kDaemonPollInterval = "daemon-poll-interval";
|
||||
static const char *kEnabled = "enabled";
|
||||
static const char *kFingerprint = "tls-fingerprint";
|
||||
static const char *kKeepalive = "keepalive";
|
||||
static const char *kNicehash = "nicehash";
|
||||
static const char *kPass = "pass";
|
||||
static const char *kRigId = "rig-id";
|
||||
static const char *kSelfSelect = "self-select";
|
||||
static const char *kTls = "tls";
|
||||
static const char *kUrl = "url";
|
||||
static const char *kUser = "user";
|
||||
|
||||
const String Pool::kDefaultPassword = "x";
|
||||
const String Pool::kDefaultUser = "x";
|
||||
const String Pool::kDefaultPassword = "x";
|
||||
const String Pool::kDefaultUser = "x";
|
||||
|
||||
|
||||
const char *Pool::kAlgo = "algo";
|
||||
const char *Pool::kCoin = "coin";
|
||||
const char *Pool::kDaemon = "daemon";
|
||||
const char *Pool::kDaemonPollInterval = "daemon-poll-interval";
|
||||
const char *Pool::kEnabled = "enabled";
|
||||
const char *Pool::kFingerprint = "tls-fingerprint";
|
||||
const char *Pool::kKeepalive = "keepalive";
|
||||
const char *Pool::kNicehash = "nicehash";
|
||||
const char *Pool::kPass = "pass";
|
||||
const char *Pool::kRigId = "rig-id";
|
||||
const char *Pool::kSelfSelect = "self-select";
|
||||
const char *Pool::kTls = "tls";
|
||||
const char *Pool::kUrl = "url";
|
||||
const char *Pool::kUser = "user";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2019 Howard Chu <https://github.com/hyc>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -55,6 +55,21 @@ public:
|
|||
static const String kDefaultPassword;
|
||||
static const String kDefaultUser;
|
||||
|
||||
static const char *kAlgo;
|
||||
static const char *kCoin;
|
||||
static const char *kDaemon;
|
||||
static const char *kDaemonPollInterval;
|
||||
static const char *kEnabled;
|
||||
static const char *kFingerprint;
|
||||
static const char *kKeepalive;
|
||||
static const char *kNicehash;
|
||||
static const char *kPass;
|
||||
static const char *kRigId;
|
||||
static const char *kSelfSelect;
|
||||
static const char *kTls;
|
||||
static const char *kUrl;
|
||||
static const char *kUser;
|
||||
|
||||
constexpr static int kKeepAliveTimeout = 60;
|
||||
constexpr static uint16_t kDefaultPort = 3333;
|
||||
constexpr static uint64_t kDefaultPollInterval = 1000;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,20 +23,30 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "base/net/stratum/Pools.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/interfaces/IJsonReader.h"
|
||||
#include "base/net/stratum/Pools.h"
|
||||
#include "base/net/stratum/strategies/FailoverStrategy.h"
|
||||
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
|
||||
#include "donate.h"
|
||||
#include "rapidjson/document.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
const char *Pools::kDonateLevel = "donate-level";
|
||||
const char *Pools::kDonateOverProxy = "donate-over-proxy";
|
||||
const char *Pools::kPools = "pools";
|
||||
const char *Pools::kRetries = "retries";
|
||||
const char *Pools::kRetryPause = "retry-pause";
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::Pools::Pools() :
|
||||
m_donateLevel(kDefaultDonateLevel),
|
||||
m_retries(5),
|
||||
m_retryPause(5),
|
||||
m_proxyDonate(PROXY_DONATE_AUTO)
|
||||
m_donateLevel(kDefaultDonateLevel)
|
||||
{
|
||||
# ifdef XMRIG_PROXY_PROJECT
|
||||
m_retries = 2;
|
||||
|
@ -108,7 +118,7 @@ void xmrig::Pools::load(const IJsonReader &reader)
|
|||
{
|
||||
m_data.clear();
|
||||
|
||||
const rapidjson::Value &pools = reader.getArray("pools");
|
||||
const rapidjson::Value &pools = reader.getArray(kPools);
|
||||
if (!pools.IsArray()) {
|
||||
return;
|
||||
}
|
||||
|
@ -124,10 +134,10 @@ void xmrig::Pools::load(const IJsonReader &reader)
|
|||
}
|
||||
}
|
||||
|
||||
setDonateLevel(reader.getInt("donate-level", kDefaultDonateLevel));
|
||||
setProxyDonate(reader.getInt("donate-over-proxy", PROXY_DONATE_AUTO));
|
||||
setRetries(reader.getInt("retries"));
|
||||
setRetryPause(reader.getInt("retry-pause"));
|
||||
setDonateLevel(reader.getInt(kDonateLevel, kDefaultDonateLevel));
|
||||
setProxyDonate(reader.getInt(kDonateOverProxy, PROXY_DONATE_AUTO));
|
||||
setRetries(reader.getInt(kRetries));
|
||||
setRetryPause(reader.getInt(kRetryPause));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -43,6 +43,12 @@ class IStrategyListener;
|
|||
class Pools
|
||||
{
|
||||
public:
|
||||
static const char *kDonateLevel;
|
||||
static const char *kDonateOverProxy;
|
||||
static const char *kPools;
|
||||
static const char *kRetries;
|
||||
static const char *kRetryPause;
|
||||
|
||||
enum ProxyDonate {
|
||||
PROXY_DONATE_NONE,
|
||||
PROXY_DONATE_AUTO,
|
||||
|
@ -74,9 +80,9 @@ private:
|
|||
void setRetryPause(int retryPause);
|
||||
|
||||
int m_donateLevel;
|
||||
int m_retries;
|
||||
int m_retryPause;
|
||||
ProxyDonate m_proxyDonate;
|
||||
int m_retries = 5;
|
||||
int m_retryPause = 5;
|
||||
ProxyDonate m_proxyDonate = PROXY_DONATE_AUTO;
|
||||
std::vector<Pool> m_data;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -123,6 +123,10 @@ public:
|
|||
|
||||
inline void handleJobChange()
|
||||
{
|
||||
if (!enabled) {
|
||||
Nonce::pause(true);
|
||||
}
|
||||
|
||||
active = true;
|
||||
|
||||
if (reset) {
|
||||
|
@ -136,7 +140,7 @@ public:
|
|||
Nonce::touch();
|
||||
|
||||
if (enabled) {
|
||||
Nonce::pause(false);;
|
||||
Nonce::pause(false);
|
||||
}
|
||||
|
||||
if (ticks == 0) {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -211,41 +211,41 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
|||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
Value api(kObjectType);
|
||||
api.AddMember("id", m_apiId.toJSON(), allocator);
|
||||
api.AddMember("worker-id", m_apiWorkerId.toJSON(), allocator);
|
||||
api.AddMember(StringRef(kApiId), m_apiId.toJSON(), allocator);
|
||||
api.AddMember(StringRef(kApiWorkerId), m_apiWorkerId.toJSON(), allocator);
|
||||
|
||||
doc.AddMember("api", api, allocator);
|
||||
doc.AddMember("http", m_http.toJSON(doc), allocator);
|
||||
doc.AddMember("autosave", isAutoSave(), allocator);
|
||||
doc.AddMember("background", isBackground(), allocator);
|
||||
doc.AddMember("colors", Log::isColors(), allocator);
|
||||
doc.AddMember(StringRef(kApi), api, allocator);
|
||||
doc.AddMember(StringRef(kHttp), m_http.toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kAutosave), isAutoSave(), allocator);
|
||||
doc.AddMember(StringRef(kBackground), isBackground(), allocator);
|
||||
doc.AddMember(StringRef(kColors), Log::isColors(), allocator);
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
doc.AddMember(StringRef(kRandomX), rx().toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kRandomX), rx().toJSON(doc), allocator);
|
||||
# endif
|
||||
|
||||
doc.AddMember(StringRef(kCPU), cpu().toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kCPU), cpu().toJSON(doc), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
doc.AddMember(StringRef(kOcl), cl().toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kOcl), cl().toJSON(doc), allocator);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_CUDA
|
||||
doc.AddMember(StringRef(kCuda), cuda().toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kCuda), cuda().toJSON(doc), allocator);
|
||||
# endif
|
||||
|
||||
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
|
||||
doc.AddMember("donate-over-proxy", m_pools.proxyDonate(), allocator);
|
||||
doc.AddMember("log-file", m_logFile.toJSON(), allocator);
|
||||
doc.AddMember("pools", m_pools.toJSON(doc), allocator);
|
||||
doc.AddMember("print-time", printTime(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kDonateLevel), m_pools.donateLevel(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kDonateOverProxy), m_pools.proxyDonate(), allocator);
|
||||
doc.AddMember(StringRef(kLogFile), m_logFile.toJSON(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kPools), m_pools.toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kPrintTime), printTime(), allocator);
|
||||
# if defined(XMRIG_FEATURE_NVML)
|
||||
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
|
||||
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
|
||||
# endif
|
||||
doc.AddMember("retries", m_pools.retries(), allocator);
|
||||
doc.AddMember("retry-pause", m_pools.retryPause(), allocator);
|
||||
doc.AddMember("syslog", isSyslog(), allocator);
|
||||
doc.AddMember("user-agent", m_userAgent.toJSON(), allocator);
|
||||
doc.AddMember("verbose", Log::verbose(), allocator);
|
||||
doc.AddMember("watch", m_watch, allocator);
|
||||
doc.AddMember(StringRef(Pools::kRetries), m_pools.retries(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kRetryPause), m_pools.retryPause(), allocator);
|
||||
doc.AddMember(StringRef(kSyslog), isSyslog(), allocator);
|
||||
doc.AddMember(StringRef(kUserAgent), m_userAgent.toJSON(), allocator);
|
||||
doc.AddMember(StringRef(kVerbose), Log::verbose(), allocator);
|
||||
doc.AddMember(StringRef(kWatch), m_watch, allocator);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2018-2019 tevador <tevador@gmail.com>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -46,9 +46,6 @@ namespace xmrig {
|
|||
static IMemoryPool *pool = nullptr;
|
||||
static std::mutex mutex;
|
||||
|
||||
constexpr size_t twoMiB = 2U * 1024U * 1024U;
|
||||
constexpr size_t oneGiB = 1024U * 1024U * 1024U;
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2018-2019 tevador <tevador@gmail.com>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -300,6 +300,10 @@ namespace randomx {
|
|||
code = allocatedCode + (codeOffset.fetch_add(59 * 64) % CodeSize);
|
||||
memcpy(code, codePrologue, prologueSize);
|
||||
memcpy(code + epilogueOffset, codeEpilogue, epilogueSize);
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
mainLoopBounds.first = code + prologueSize;
|
||||
mainLoopBounds.second = code + epilogueOffset;
|
||||
# endif
|
||||
}
|
||||
|
||||
JitCompilerX86::~JitCompilerX86() {
|
||||
|
@ -386,7 +390,7 @@ namespace randomx {
|
|||
}
|
||||
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
xmrig::Rx::setMainLoopBounds(code + prologueSize, code + epilogueOffset);
|
||||
xmrig::Rx::setMainLoopBounds(mainLoopBounds);
|
||||
# endif
|
||||
|
||||
codePos = prologueSize;
|
||||
|
@ -403,9 +407,10 @@ namespace randomx {
|
|||
}
|
||||
|
||||
for (int i = 0, n = static_cast<int>(RandomX_CurrentConfig.ProgramSize); i < n; ++i) {
|
||||
Instruction instr = prog(i);
|
||||
Instruction& instr = prog(i);
|
||||
const uint8_t opcode = instr.opcode;
|
||||
*((uint64_t*)&instr) &= (uint64_t(-1) - (0xFFFF << 8)) | ((RegistersCount - 1) << 8) | ((RegistersCount - 1) << 16);
|
||||
(this->*(engine[instr.opcode]))(instr);
|
||||
(this->*(engine[opcode]))(instr);
|
||||
}
|
||||
|
||||
emit(REX_MOV_RR, code, codePos);
|
||||
|
@ -601,32 +606,22 @@ namespace randomx {
|
|||
codePos = pos;
|
||||
}
|
||||
|
||||
static const uint32_t template_IADD_M[8] = {
|
||||
0x0604034c,
|
||||
0x060c034c,
|
||||
0x0614034c,
|
||||
0x061c034c,
|
||||
0x0624034c,
|
||||
0x062c034c,
|
||||
0x0634034c,
|
||||
0x063c034c,
|
||||
};
|
||||
|
||||
void JitCompilerX86::h_IADD_M(const Instruction& instr) {
|
||||
uint8_t* const p = code;
|
||||
int pos = codePos;
|
||||
|
||||
if (instr.src != instr.dst) {
|
||||
const uint32_t dst = instr.dst;
|
||||
if (instr.src != dst) {
|
||||
genAddressReg<true>(instr, p, pos);
|
||||
emit32(template_IADD_M[instr.dst], p, pos);
|
||||
emit32(0x0604034c + (dst << 19), p, pos);
|
||||
}
|
||||
else {
|
||||
emit(REX_ADD_RM, p, pos);
|
||||
emitByte(0x86 + 8 * instr.dst, p, pos);
|
||||
emitByte(0x86 + (dst << 3), p, pos);
|
||||
genAddressImm(instr, p, pos);
|
||||
}
|
||||
|
||||
registerUsage[instr.dst] = pos;
|
||||
registerUsage[dst] = pos;
|
||||
codePos = pos;
|
||||
}
|
||||
|
||||
|
@ -656,19 +651,18 @@ namespace randomx {
|
|||
uint8_t* const p = code;
|
||||
int pos = codePos;
|
||||
|
||||
if (instr.src != instr.dst) {
|
||||
const uint32_t dst = instr.dst;
|
||||
if (instr.src != dst) {
|
||||
genAddressReg<true>(instr, p, pos);
|
||||
emit(REX_SUB_RM, p, pos);
|
||||
emitByte(0x04 + 8 * instr.dst, p, pos);
|
||||
emitByte(0x06, p, pos);
|
||||
emit32(0x06042b4c + (dst << 19), p, pos);
|
||||
}
|
||||
else {
|
||||
emit(REX_SUB_RM, p, pos);
|
||||
emitByte(0x86 + 8 * instr.dst, p, pos);
|
||||
emitByte(0x86 + (dst << 3), p, pos);
|
||||
genAddressImm(instr, p, pos);
|
||||
}
|
||||
|
||||
registerUsage[instr.dst] = pos;
|
||||
registerUsage[dst] = pos;
|
||||
codePos = pos;
|
||||
}
|
||||
|
||||
|
@ -1056,14 +1050,12 @@ namespace randomx {
|
|||
}
|
||||
}
|
||||
|
||||
emit(REX_ADD_I, p, pos);
|
||||
emitByte(0xc0 + reg, p, pos);
|
||||
*(uint32_t*)(p + pos) = 0x00c08149 + (reg << 16);
|
||||
const int shift = instr.getModCond() + RandomX_CurrentConfig.JumpOffset;
|
||||
const uint32_t imm = (instr.getImm32() | (1UL << shift)) & ~(1UL << (shift - 1));
|
||||
emit32(imm, p, pos);
|
||||
emit(REX_TEST, p, pos);
|
||||
emitByte(0xc0 + reg, p, pos);
|
||||
emit32(RandomX_CurrentConfig.ConditionMask_Calculated << shift, p, pos);
|
||||
*(uint32_t*)(p + pos + 3) = (instr.getImm32() | (1UL << shift)) & ~(1UL << (shift - 1));
|
||||
*(uint32_t*)(p + pos + 7) = 0x00c0f749 + (reg << 16);
|
||||
*(uint32_t*)(p + pos + 10) = RandomX_CurrentConfig.ConditionMask_Calculated << shift;
|
||||
pos += 14;
|
||||
|
||||
if (jmp_offset >= -128) {
|
||||
emitByte(JZ_SHORT, p, pos);
|
||||
|
@ -1090,9 +1082,7 @@ namespace randomx {
|
|||
int pos = codePos;
|
||||
|
||||
genAddressRegDst(instr, p, pos);
|
||||
emit(REX_MOV_MR, p, pos);
|
||||
emitByte(0x04 + 8 * instr.src, p, pos);
|
||||
emitByte(0x06, p, pos);
|
||||
emit32(0x0604894c + (static_cast<uint32_t>(instr.src) << 19), p, pos);
|
||||
|
||||
codePos = pos;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,9 @@ namespace randomx {
|
|||
int registerUsage[RegistersCount];
|
||||
uint8_t* allocatedCode;
|
||||
uint8_t* code;
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
std::pair<const void*, const void*> mainLoopBounds;
|
||||
# endif
|
||||
int32_t codePos;
|
||||
uint32_t vm_flags;
|
||||
|
||||
|
|
|
@ -58,18 +58,13 @@ public:
|
|||
static void init(IRxListener *listener);
|
||||
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
static inline const std::pair<const void*, const void*> &mainLoopBounds() { return m_mainLoopBounds; }
|
||||
static inline void setMainLoopBounds(const void* loopBegin, const void* loopEnd) { m_mainLoopBounds.first = loopBegin; m_mainLoopBounds.second = loopEnd; }
|
||||
static void setMainLoopBounds(const std::pair<const void*, const void*>& bounds);
|
||||
# endif
|
||||
|
||||
private:
|
||||
static void msrInit(const RxConfig &config);
|
||||
static void msrDestroy();
|
||||
static void setupMainLoopExceptionFrame();
|
||||
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
static thread_local std::pair<const void*, const void*> m_mainLoopBounds;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ constexpr size_t kMsrArraySize = 4;
|
|||
static const std::array<MsrItems, kMsrArraySize> msrPresets = {
|
||||
MsrItems(),
|
||||
MsrItems{{ 0xC0011020, 0x0 }, { 0xC0011021, 0x40, ~0x20ULL }, { 0xC0011022, 0x510000 }, { 0xC001102b, 0x1808cc16 }},
|
||||
MsrItems{{ 0x1a4, 0x6 }},
|
||||
MsrItems{{ 0x1a4, 0xf }},
|
||||
MsrItems()
|
||||
};
|
||||
|
||||
|
|
|
@ -180,6 +180,9 @@ static bool wrmsr(const MsrItems &preset, bool save)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FIX_RYZEN
|
||||
static thread_local std::pair<const void*, const void*> mainLoopBounds = { nullptr, nullptr };
|
||||
|
||||
static void MainLoopHandler(int sig, siginfo_t *info, void *ucontext)
|
||||
{
|
||||
ucontext_t *ucp = (ucontext_t*) ucontext;
|
||||
|
@ -187,7 +190,7 @@ static void MainLoopHandler(int sig, siginfo_t *info, void *ucontext)
|
|||
LOG_VERBOSE(YELLOW_BOLD("%s at %p"), (sig == SIGSEGV) ? "SIGSEGV" : "SIGILL", ucp->uc_mcontext.gregs[REG_RIP]);
|
||||
|
||||
void* p = reinterpret_cast<void*>(ucp->uc_mcontext.gregs[REG_RIP]);
|
||||
const std::pair<const void*, const void*>& loopBounds = Rx::mainLoopBounds();
|
||||
const std::pair<const void*, const void*>& loopBounds = mainLoopBounds;
|
||||
|
||||
if ((loopBounds.first <= p) && (p < loopBounds.second)) {
|
||||
ucp->uc_mcontext.gregs[REG_RIP] = reinterpret_cast<size_t>(loopBounds.second);
|
||||
|
@ -197,8 +200,11 @@ static void MainLoopHandler(int sig, siginfo_t *info, void *ucontext)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
thread_local std::pair<const void*, const void*> Rx::m_mainLoopBounds = { nullptr, nullptr };
|
||||
void Rx::setMainLoopBounds(const std::pair<const void*, const void*>& bounds)
|
||||
{
|
||||
mainLoopBounds = bounds;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
@ -235,9 +241,11 @@ void xmrig::Rx::msrDestroy()
|
|||
|
||||
void xmrig::Rx::setupMainLoopExceptionFrame()
|
||||
{
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
struct sigaction act = {};
|
||||
act.sa_sigaction = MainLoopHandler;
|
||||
act.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
sigaction(SIGSEGV, &act, nullptr);
|
||||
sigaction(SIGILL, &act, nullptr);
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -303,6 +303,9 @@ static bool wrmsr(const MsrItems &preset, bool save)
|
|||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FIX_RYZEN
|
||||
static thread_local std::pair<const void*, const void*> mainLoopBounds = { nullptr, nullptr };
|
||||
|
||||
static LONG WINAPI MainLoopHandler(_EXCEPTION_POINTERS *ExceptionInfo)
|
||||
{
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == 0xC0000005) {
|
||||
|
@ -320,7 +323,7 @@ static LONG WINAPI MainLoopHandler(_EXCEPTION_POINTERS *ExceptionInfo)
|
|||
}
|
||||
|
||||
void* p = reinterpret_cast<void*>(ExceptionInfo->ContextRecord->Rip);
|
||||
const std::pair<const void*, const void*>& loopBounds = Rx::mainLoopBounds();
|
||||
const std::pair<const void*, const void*>& loopBounds = mainLoopBounds;
|
||||
|
||||
if ((loopBounds.first <= p) && (p < loopBounds.second)) {
|
||||
ExceptionInfo->ContextRecord->Rip = reinterpret_cast<DWORD64>(loopBounds.second);
|
||||
|
@ -330,8 +333,11 @@ static LONG WINAPI MainLoopHandler(_EXCEPTION_POINTERS *ExceptionInfo)
|
|||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
||||
thread_local std::pair<const void*, const void*> Rx::m_mainLoopBounds = { nullptr, nullptr };
|
||||
void Rx::setMainLoopBounds(const std::pair<const void*, const void*>& bounds)
|
||||
{
|
||||
mainLoopBounds = bounds;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
@ -368,5 +374,7 @@ void xmrig::Rx::msrDestroy()
|
|||
|
||||
void xmrig::Rx::setupMainLoopExceptionFrame()
|
||||
{
|
||||
# ifdef XMRIG_FIX_RYZEN
|
||||
AddVectoredExceptionHandler(1, MainLoopHandler);
|
||||
# endif
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -110,9 +110,7 @@ void xmrig::DonateStrategy::connect()
|
|||
if (m_proxy) {
|
||||
m_proxy->connect();
|
||||
}
|
||||
else if (m_controller->config()->pools().proxyDonate() == Pools::PROXY_DONATE_ALWAYS) {
|
||||
setState(STATE_IDLE);
|
||||
}
|
||||
|
||||
else {
|
||||
m_strategy->connect();
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,15 +28,15 @@
|
|||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig miner"
|
||||
#define APP_VERSION "5.5.0"
|
||||
#define APP_VERSION "5.5.1-dev"
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com"
|
||||
#define APP_KIND "miner"
|
||||
|
||||
#define APP_VER_MAJOR 5
|
||||
#define APP_VER_MINOR 5
|
||||
#define APP_VER_PATCH 0
|
||||
#define APP_VER_PATCH 1
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1920)
|
||||
|
|
Loading…
Reference in a new issue