1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-10 09:02:45 -05:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Tony Butler
6fdb7c9f24 Merge 6c8098378a into 07e1e77c4f 2023-12-29 13:28:12 -08:00
XMRig
07e1e77c4f Code style cleanup. 2023-12-29 21:17:19 +07:00
Tony Butler
6c8098378a Add AUTO_HUGEPAGE feature to disable writing to nr_hugepages 2023-07-12 02:06:53 -06:00
4 changed files with 24 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ option(WITH_VAES "Enable VAES instructions for Cryptonight" ON)
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
option(WITH_AUTO_HUGEPAGE "Enable Automatic setting of nr_hugepages (Linux Only)" ON)
option(BUILD_STATIC "Build static binary" OFF)
option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
@@ -181,6 +182,10 @@ else()
if (XMRIG_OS_ANDROID)
set(EXTRA_LIBS pthread rt dl log)
elseif (XMRIG_OS_LINUX)
if (WITH_AUTO_HUGEPAGE)
add_definitions(/DXMRIG_FEATURE_AUTO_HUGEPAGE)
endif()
list(APPEND SOURCES_OS
src/crypto/common/LinuxMemory.h
src/crypto/common/LinuxMemory.cpp

View File

@@ -1,8 +1,8 @@
/* XMRig
* Copyright (c) 2012-2013 The Cryptonote developers
* Copyright (c) 2014-2021 The Monero Project
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 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
@@ -207,8 +207,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
setOffset(MINER_TX_PREFIX_OFFSET, ar.index());
ar(m_txVersion);
if (m_coin != Coin::TOWNFORGE)
if (m_coin != Coin::TOWNFORGE) {
ar(m_unlockTime);
}
ar(m_numInputs);
// must be 1 input
@@ -281,8 +284,9 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_viewTag);
}
if (m_coin == Coin::TOWNFORGE)
if (m_coin == Coin::TOWNFORGE) {
ar(m_unlockTime);
}
ar(m_extraSize);
@@ -340,8 +344,9 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(vin_rct_type);
// no way I'm parsing a full game update here
if (m_coin == Coin::TOWNFORGE && m_height % 720 == 0)
if (m_coin == Coin::TOWNFORGE && m_height % 720 == 0) {
return true;
}
// must be RCTTypeNull (0)
if (vin_rct_type != 0) {

View File

@@ -1,8 +1,8 @@
/* XMRig
* Copyright (c) 2012-2013 The Cryptonote developers
* Copyright (c) 2014-2021 The Monero Project
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 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
@@ -34,8 +34,7 @@
bool xmrig::WalletAddress::decode(const char *address, size_t size)
{
uint64_t tf_tag = 0;
if (size >= 4 && !strncmp(address, "TF", 2))
{
if (size >= 4 && !strncmp(address, "TF", 2)) {
tf_tag = 0x424200;
switch (address[2])
{
@@ -134,8 +133,9 @@ bool xmrig::WalletAddress::decode(const char *address, size_t size)
if (memcmp(m_checksum, md, sizeof(m_checksum)) == 0) {
m_data = { address, size };
if (tf_tag)
if (tf_tag) {
m_tag = tf_tag;
}
return true;
}

View File

@@ -60,7 +60,11 @@ bool xmrig::LinuxMemory::reserve(size_t size, uint32_t node, size_t hugePageSize
return false;
}
# ifdef XMRIG_FEATURE_AUTO_HUGEPAGE
return write_nr_hugepages(node, hugePageSize, std::max<size_t>(nr_hugepages(node, hugePageSize), 0) + (required - available));
# else
return false;
# endif
}