Split config generator to separated files.
This commit is contained in:
parent
9dc2525ce1
commit
62f086f607
10 changed files with 322 additions and 140 deletions
|
@ -23,7 +23,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "backend/cpu/Cpu.h"
|
||||
|
@ -66,12 +66,6 @@
|
|||
m_map[algo][AV_DOUBLE][Assembly::BULLDOZER] = cryptonight_double_hash_asm<algo, Assembly::BULLDOZER>;
|
||||
|
||||
|
||||
extern "C" void cnv2_mainloop_ivybridge_asm(cryptonight_ctx **ctx);
|
||||
extern "C" void cnv2_mainloop_ryzen_asm(cryptonight_ctx **ctx);
|
||||
extern "C" void cnv2_mainloop_bulldozer_asm(cryptonight_ctx **ctx);
|
||||
extern "C" void cnv2_double_mainloop_sandybridge_asm(cryptonight_ctx **ctx);
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
|
@ -99,7 +93,7 @@ cn_mainloop_fun cn_double_double_mainloop_sandybridge_asm = nullptr;
|
|||
template<typename T, typename U>
|
||||
static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t mask = CnAlgo<Algorithm::CN_HALF>().mask())
|
||||
{
|
||||
const uint8_t* p = reinterpret_cast<const uint8_t*>(src);
|
||||
auto p = reinterpret_cast<const uint8_t*>(src);
|
||||
|
||||
// Workaround for Visual Studio placing trampoline in debug builds.
|
||||
# if defined(_MSC_VER)
|
||||
|
@ -117,7 +111,7 @@ static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t ma
|
|||
|
||||
memcpy((void*) dst, (const void*) src, size);
|
||||
|
||||
uint8_t* patched_data = reinterpret_cast<uint8_t*>(dst);
|
||||
auto patched_data = reinterpret_cast<uint8_t*>(dst);
|
||||
for (size_t i = 0; i + sizeof(uint32_t) <= size; ++i) {
|
||||
switch (*(uint32_t*)(patched_data + i)) {
|
||||
case CnAlgo<Algorithm::CN_2>().iterations():
|
||||
|
@ -135,7 +129,7 @@ static void patchCode(T dst, U src, const uint32_t iterations, const uint32_t ma
|
|||
static void patchAsmVariants()
|
||||
{
|
||||
const int allocation_size = 65536;
|
||||
uint8_t *base = static_cast<uint8_t *>(VirtualMemory::allocateExecutableMemory(allocation_size));
|
||||
auto base = static_cast<uint8_t *>(VirtualMemory::allocateExecutableMemory(allocation_size));
|
||||
|
||||
cn_half_mainloop_ivybridge_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x0000);
|
||||
cn_half_mainloop_ryzen_asm = reinterpret_cast<cn_mainloop_fun> (base + 0x1000);
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#define XMRIG_CN_HASH_H
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#include "crypto/cn/CnAlgo.h"
|
||||
|
@ -41,8 +41,8 @@ struct cryptonight_ctx;
|
|||
namespace xmrig
|
||||
{
|
||||
|
||||
typedef void (*cn_hash_fun)(const uint8_t *input, size_t size, uint8_t *output, cryptonight_ctx **ctx, uint64_t height);
|
||||
typedef void (*cn_mainloop_fun)(cryptonight_ctx **ctx);
|
||||
using cn_hash_fun = void (*)(const uint8_t *, size_t, uint8_t *, cryptonight_ctx **, uint64_t);
|
||||
using cn_mainloop_fun = void (*)(cryptonight_ctx **);
|
||||
|
||||
|
||||
class CnHash
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
inline Algorithm(const char *algo) : m_id(parse(algo)) {}
|
||||
inline Algorithm(Id id) : m_id(id) {}
|
||||
|
||||
inline bool isCN() const { auto f = family(); return f == CN || f == CN_LITE || f == CN_HEAVY || f == CN_PICO; }
|
||||
inline bool isEqual(const Algorithm &other) const { return m_id == other.m_id; }
|
||||
inline bool isValid() const { return m_id != INVALID; }
|
||||
inline const char *name() const { return name(false); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue