Removed xmrig.h.
This commit is contained in:
parent
8b3f2d8fff
commit
dc87ef6062
13 changed files with 53 additions and 126 deletions
|
@ -27,7 +27,6 @@ set(HEADERS
|
|||
"${HEADERS_BACKEND}"
|
||||
src/api/interfaces/IApiListener.h
|
||||
src/App.h
|
||||
src/common/xmrig.h
|
||||
src/core/config/Config_default.h
|
||||
src/core/config/Config_platform.h
|
||||
src/core/config/Config.h
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
|
||||
#include "base/io/log/Log.h"
|
||||
#include "common/xmrig.h"
|
||||
#include "crypto/common/portable/mm_malloc.h"
|
||||
#include "crypto/common/VirtualMemory.h"
|
||||
#include "crypto/cn/CryptoNight.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
|
||||
#include "base/io/log/Log.h"
|
||||
#include "common/xmrig.h"
|
||||
#include "crypto/common/portable/mm_malloc.h"
|
||||
#include "crypto/common/VirtualMemory.h"
|
||||
#include "crypto/cn/CryptoNight.h"
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "base/kernel/interfaces/IConfig.h"
|
||||
#include "base/net/http/Http.h"
|
||||
#include "base/net/stratum/Pools.h"
|
||||
#include "common/xmrig.h"
|
||||
|
||||
|
||||
struct option;
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/* XMRig
|
||||
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
||||
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
||||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* 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>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_XMRIG_H
|
||||
#define XMRIG_XMRIG_H
|
||||
|
||||
|
||||
namespace xmrig
|
||||
{
|
||||
|
||||
|
||||
//--av=1 For CPUs with hardware AES.
|
||||
//--av=2 Lower power mode (double hash) of 1.
|
||||
//--av=3 Software AES implementation.
|
||||
//--av=4 Lower power mode (double hash) of 3.
|
||||
enum AlgoVariant {
|
||||
AV_AUTO, // --av=0 Automatic mode.
|
||||
AV_SINGLE, // --av=1 Single hash mode
|
||||
AV_DOUBLE, // --av=2 Double hash mode
|
||||
AV_SINGLE_SOFT, // --av=3 Single hash mode (Software AES)
|
||||
AV_DOUBLE_SOFT, // --av=4 Double hash mode (Software AES)
|
||||
AV_TRIPLE, // --av=5 Triple hash mode
|
||||
AV_QUAD, // --av=6 Quard hash mode
|
||||
AV_PENTA, // --av=7 Penta hash mode
|
||||
AV_TRIPLE_SOFT, // --av=8 Triple hash mode (Software AES)
|
||||
AV_QUAD_SOFT, // --av=9 Quard hash mode (Software AES)
|
||||
AV_PENTA_SOFT, // --av=10 Penta hash mode (Software AES)
|
||||
AV_MAX
|
||||
};
|
||||
|
||||
|
||||
enum AlgoVerify {
|
||||
VERIFY_HW_AES = 1,
|
||||
VERIFY_SOFT_AES = 2
|
||||
};
|
||||
|
||||
|
||||
enum AesMode {
|
||||
AES_AUTO,
|
||||
AES_HW,
|
||||
AES_SOFT
|
||||
};
|
||||
|
||||
|
||||
enum OclVendor {
|
||||
OCL_VENDOR_UNKNOWN = -2,
|
||||
OCL_VENDOR_MANUAL = -1,
|
||||
OCL_VENDOR_AMD = 0,
|
||||
OCL_VENDOR_NVIDIA = 1,
|
||||
OCL_VENDOR_INTEL = 2
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_XMRIG_H */
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
|
||||
xmrig::Config::Config() :
|
||||
m_algoVariant(AV_AUTO),
|
||||
m_algoVariant(CnHash::AV_AUTO),
|
||||
m_shouldSave(false)
|
||||
{
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ bool xmrig::Config::finalize()
|
|||
return true;
|
||||
}
|
||||
|
||||
const AlgoVariant av = getAlgoVariant();
|
||||
const CnHash::AlgoVariant av = getAlgoVariant();
|
||||
m_threads.mode = m_threads.count ? Simple : Automatic;
|
||||
|
||||
const size_t size = CpuThreadLegacy::multiway(av) * CnAlgo<>::memory(algorithm) / 1024; // FIXME MEMORY
|
||||
|
@ -158,8 +158,8 @@ bool xmrig::Config::finalize()
|
|||
|
||||
void xmrig::Config::setAlgoVariant(int av)
|
||||
{
|
||||
if (av >= AV_AUTO && av < AV_MAX) {
|
||||
m_algoVariant = static_cast<AlgoVariant>(av);
|
||||
if (av >= CnHash::AV_AUTO && av < CnHash::AV_MAX) {
|
||||
m_algoVariant = static_cast<CnHash::AlgoVariant>(av);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void xmrig::Config::setThreads(const rapidjson::Value &threads)
|
|||
}
|
||||
|
||||
|
||||
xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const
|
||||
xmrig::CnHash::AlgoVariant xmrig::Config::getAlgoVariant() const
|
||||
{
|
||||
# ifdef XMRIG_ALGO_CN_LITE
|
||||
// if (m_algorithm.algo() == xmrig::CRYPTONIGHT_LITE) { // FIXME
|
||||
|
@ -200,8 +200,8 @@ xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const
|
|||
// }
|
||||
# endif
|
||||
|
||||
if (m_algoVariant <= AV_AUTO || m_algoVariant >= AV_MAX) {
|
||||
return Cpu::info()->hasAES() ? AV_SINGLE : AV_SINGLE_SOFT;
|
||||
if (m_algoVariant <= CnHash::AV_AUTO || m_algoVariant >= CnHash::AV_MAX) {
|
||||
return Cpu::info()->hasAES() ? CnHash::AV_SINGLE : CnHash::AV_SINGLE_SOFT;
|
||||
}
|
||||
|
||||
// if (m_safe && !Cpu::info()->hasAES() && m_algoVariant <= AV_DOUBLE) {
|
||||
|
@ -213,10 +213,10 @@ xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const
|
|||
|
||||
|
||||
#ifdef XMRIG_ALGO_CN_LITE
|
||||
xmrig::AlgoVariant xmrig::Config::getAlgoVariantLite() const
|
||||
xmrig::CnHash::AlgoVariant xmrig::Config::getAlgoVariantLite() const
|
||||
{
|
||||
if (m_algoVariant <= AV_AUTO || m_algoVariant >= AV_MAX) {
|
||||
return Cpu::info()->hasAES() ? AV_DOUBLE : AV_DOUBLE_SOFT;
|
||||
if (m_algoVariant <= CnHash::AV_AUTO || m_algoVariant >= CnHash::AV_MAX) {
|
||||
return Cpu::info()->hasAES() ? CnHash::AV_DOUBLE : CnHash::AV_DOUBLE_SOFT;
|
||||
}
|
||||
|
||||
// if (m_safe && !Cpu::info()->hasAES() && m_algoVariant <= AV_DOUBLE) {
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "backend/cpu/CpuConfig.h"
|
||||
#include "base/kernel/config/BaseConfig.h"
|
||||
#include "common/xmrig.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
#include "workers/CpuThreadLegacy.h"
|
||||
|
||||
|
@ -58,7 +57,7 @@ public:
|
|||
bool read(const IJsonReader &reader, const char *fileName) override;
|
||||
void getJSON(rapidjson::Document &doc) const override;
|
||||
|
||||
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||
inline CnHash::AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade || m_cpu.isShouldSave()) && isAutoSave(); }
|
||||
inline const CpuConfig &cpu() const { return m_cpu; }
|
||||
inline const std::vector<IThread *> &threads() const { return m_threads.list; }
|
||||
|
@ -70,9 +69,9 @@ private:
|
|||
void setAlgoVariant(int av);
|
||||
void setThreads(const rapidjson::Value &threads);
|
||||
|
||||
AlgoVariant getAlgoVariant() const;
|
||||
CnHash::AlgoVariant getAlgoVariant() const;
|
||||
# ifdef XMRIG_ALGO_CN_LITE
|
||||
AlgoVariant getAlgoVariantLite() const;
|
||||
CnHash::AlgoVariant getAlgoVariantLite() const;
|
||||
# endif
|
||||
|
||||
struct Threads
|
||||
|
@ -87,7 +86,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
AlgoVariant m_algoVariant;
|
||||
CnHash::AlgoVariant m_algoVariant;
|
||||
bool m_shouldSave;
|
||||
CpuConfig m_cpu;
|
||||
Threads m_threads;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "common/xmrig.h"
|
||||
#include "crypto/cn/CnAlgo.h"
|
||||
#include "crypto/common/Assembly.h"
|
||||
|
||||
|
@ -49,6 +48,21 @@ typedef void (*cn_mainloop_fun)(cryptonight_ctx **ctx);
|
|||
class CnHash
|
||||
{
|
||||
public:
|
||||
enum AlgoVariant {
|
||||
AV_AUTO, // --av=0 Automatic mode.
|
||||
AV_SINGLE, // --av=1 Single hash mode
|
||||
AV_DOUBLE, // --av=2 Double hash mode
|
||||
AV_SINGLE_SOFT, // --av=3 Single hash mode (Software AES)
|
||||
AV_DOUBLE_SOFT, // --av=4 Double hash mode (Software AES)
|
||||
AV_TRIPLE, // --av=5 Triple hash mode
|
||||
AV_QUAD, // --av=6 Quard hash mode
|
||||
AV_PENTA, // --av=7 Penta hash mode
|
||||
AV_TRIPLE_SOFT, // --av=8 Triple hash mode (Software AES)
|
||||
AV_QUAD_SOFT, // --av=9 Quard hash mode (Software AES)
|
||||
AV_PENTA_SOFT, // --av=10 Penta hash mode (Software AES)
|
||||
AV_MAX
|
||||
};
|
||||
|
||||
CnHash();
|
||||
|
||||
cn_hash_fun fn(const Algorithm &algorithm, AlgoVariant av, Assembly::Id assembly) const;
|
||||
|
|
|
@ -178,7 +178,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include "common/xmrig.h"
|
||||
#include "crypto/cn/r/variant4_random_math.h"
|
||||
|
||||
#define VARIANT4_RANDOM_MATH_INIT(part) \
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define XMRIG_ASSEMBLY_H
|
||||
|
||||
|
||||
#include "common/xmrig.h"
|
||||
#include "rapidjson/fwd.h"
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
#include "base/tools/Timer.h"
|
||||
#include "common/xmrig.h"
|
||||
#include "core/config/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "crypto/common/keccak.h"
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
static const xmrig::CnHash cnHash;
|
||||
|
||||
|
||||
xmrig::CpuThreadLegacy::CpuThreadLegacy(size_t index, Algorithm algorithm, AlgoVariant av, Multiway multiway, int64_t affinity, int priority, bool softAES, bool prefetch, Assembly assembly) :
|
||||
xmrig::CpuThreadLegacy::CpuThreadLegacy(size_t index, Algorithm algorithm, CnHash::AlgoVariant av, Multiway multiway, int64_t affinity, int priority, bool softAES, bool prefetch, Assembly assembly) :
|
||||
m_algorithm(algorithm),
|
||||
m_av(av),
|
||||
m_assembly(assembly),
|
||||
|
@ -59,15 +59,15 @@ xmrig::cn_hash_fun xmrig::CpuThreadLegacy::fn(const Algorithm &algorithm) const
|
|||
|
||||
|
||||
|
||||
bool xmrig::CpuThreadLegacy::isSoftAES(AlgoVariant av)
|
||||
bool xmrig::CpuThreadLegacy::isSoftAES(CnHash::AlgoVariant av)
|
||||
{
|
||||
return av == AV_SINGLE_SOFT || av == AV_DOUBLE_SOFT || av > AV_PENTA;
|
||||
return av == CnHash::AV_SINGLE_SOFT || av == CnHash::AV_DOUBLE_SOFT || av > CnHash::AV_PENTA;
|
||||
}
|
||||
|
||||
|
||||
xmrig::CpuThreadLegacy *xmrig::CpuThreadLegacy::createFromAV(size_t index, const Algorithm &algorithm, AlgoVariant av, int64_t affinity, int priority, Assembly assembly)
|
||||
xmrig::CpuThreadLegacy *xmrig::CpuThreadLegacy::createFromAV(size_t index, const Algorithm &algorithm, CnHash::AlgoVariant av, int64_t affinity, int priority, Assembly assembly)
|
||||
{
|
||||
assert(av > AV_AUTO && av < AV_MAX);
|
||||
assert(av > CnHash::AV_AUTO && av < CnHash::AV_MAX);
|
||||
|
||||
int64_t cpuId = -1L;
|
||||
|
||||
|
@ -94,7 +94,7 @@ xmrig::CpuThreadLegacy *xmrig::CpuThreadLegacy::createFromAV(size_t index, const
|
|||
|
||||
xmrig::CpuThreadLegacy *xmrig::CpuThreadLegacy::createFromData(size_t index, const Algorithm &algorithm, const CpuThreadLegacy::Data &data, int priority, bool softAES)
|
||||
{
|
||||
int av = AV_AUTO;
|
||||
int av = CnHash::AV_AUTO;
|
||||
const Multiway multiway = data.multiway;
|
||||
|
||||
if (multiway <= DoubleWay) {
|
||||
|
@ -104,9 +104,9 @@ xmrig::CpuThreadLegacy *xmrig::CpuThreadLegacy::createFromData(size_t index, con
|
|||
av = softAES ? (multiway + 5) : (multiway + 2);
|
||||
}
|
||||
|
||||
assert(av > AV_AUTO && av < AV_MAX);
|
||||
assert(av > CnHash::AV_AUTO && av < CnHash::AV_MAX);
|
||||
|
||||
return new CpuThreadLegacy(index, algorithm, static_cast<AlgoVariant>(av), multiway, data.affinity, priority, softAES, false, data.assembly);
|
||||
return new CpuThreadLegacy(index, algorithm, static_cast<CnHash::AlgoVariant>(av), multiway, data.affinity, priority, softAES, false, data.assembly);
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,27 +140,27 @@ xmrig::CpuThreadLegacy::Data xmrig::CpuThreadLegacy::parse(const rapidjson::Valu
|
|||
}
|
||||
|
||||
|
||||
xmrig::IThread::Multiway xmrig::CpuThreadLegacy::multiway(AlgoVariant av)
|
||||
xmrig::IThread::Multiway xmrig::CpuThreadLegacy::multiway(CnHash::AlgoVariant av)
|
||||
{
|
||||
switch (av) {
|
||||
case AV_SINGLE:
|
||||
case AV_SINGLE_SOFT:
|
||||
case CnHash::AV_SINGLE:
|
||||
case CnHash::AV_SINGLE_SOFT:
|
||||
return SingleWay;
|
||||
|
||||
case AV_DOUBLE_SOFT:
|
||||
case AV_DOUBLE:
|
||||
case CnHash::AV_DOUBLE_SOFT:
|
||||
case CnHash::AV_DOUBLE:
|
||||
return DoubleWay;
|
||||
|
||||
case AV_TRIPLE_SOFT:
|
||||
case AV_TRIPLE:
|
||||
case CnHash::AV_TRIPLE_SOFT:
|
||||
case CnHash::AV_TRIPLE:
|
||||
return TripleWay;
|
||||
|
||||
case AV_QUAD_SOFT:
|
||||
case AV_QUAD:
|
||||
case CnHash::AV_QUAD_SOFT:
|
||||
case CnHash::AV_QUAD:
|
||||
return QuadWay;
|
||||
|
||||
case AV_PENTA_SOFT:
|
||||
case AV_PENTA:
|
||||
case CnHash::AV_PENTA_SOFT:
|
||||
case CnHash::AV_PENTA:
|
||||
return PentaWay;
|
||||
|
||||
default:
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define XMRIG_CPUTHREADLEGACY_H
|
||||
|
||||
|
||||
#include "common/xmrig.h"
|
||||
#include "crypto/cn/CnHash.h"
|
||||
#include "interfaces/IThread.h"
|
||||
|
||||
|
@ -59,15 +58,15 @@ public:
|
|||
};
|
||||
|
||||
|
||||
CpuThreadLegacy(size_t index, Algorithm algorithm, AlgoVariant av, Multiway multiway, int64_t affinity, int priority, bool softAES, bool prefetch, Assembly assembly);
|
||||
CpuThreadLegacy(size_t index, Algorithm algorithm, CnHash::AlgoVariant av, Multiway multiway, int64_t affinity, int priority, bool softAES, bool prefetch, Assembly assembly);
|
||||
|
||||
cn_hash_fun fn(const Algorithm &algorithm) const;
|
||||
|
||||
static bool isSoftAES(AlgoVariant av);
|
||||
static CpuThreadLegacy *createFromAV(size_t index, const Algorithm &algorithm, AlgoVariant av, int64_t affinity, int priority, Assembly assembly);
|
||||
static bool isSoftAES(CnHash::AlgoVariant av);
|
||||
static CpuThreadLegacy *createFromAV(size_t index, const Algorithm &algorithm, CnHash::AlgoVariant av, int64_t affinity, int priority, Assembly assembly);
|
||||
static CpuThreadLegacy *createFromData(size_t index, const Algorithm &algorithm, const CpuThreadLegacy::Data &data, int priority, bool softAES);
|
||||
static Data parse(const rapidjson::Value &object);
|
||||
static Multiway multiway(AlgoVariant av);
|
||||
static Multiway multiway(CnHash::AlgoVariant av);
|
||||
|
||||
inline bool isPrefetch() const { return m_prefetch; }
|
||||
inline bool isSoftAES() const { return m_softAES; }
|
||||
|
@ -92,7 +91,7 @@ protected:
|
|||
|
||||
private:
|
||||
const Algorithm m_algorithm;
|
||||
const AlgoVariant m_av;
|
||||
const CnHash::AlgoVariant m_av;
|
||||
const Assembly m_assembly;
|
||||
const bool m_prefetch;
|
||||
const bool m_softAES;
|
||||
|
|
Loading…
Reference in a new issue