Merge remote-tracking branch 'refs/remotes/xmrig/master'
Conflicts: CHANGELOG.md README.md src/App.cpp src/App.h src/Cpu.cpp src/Options.cpp src/Options.h src/crypto/CryptoNight_arm.h src/crypto/CryptoNight_x86.h src/version.h
This commit is contained in:
commit
e9edd366fe
8 changed files with 76 additions and 56 deletions
|
@ -144,6 +144,7 @@ if (WITH_HTTPD)
|
||||||
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
|
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
set(MHD_LIBRARY "")
|
||||||
add_definitions(/DXMRIG_NO_HTTPD)
|
add_definitions(/DXMRIG_NO_HTTPD)
|
||||||
add_definitions(/DXMRIG_NO_API)
|
add_definitions(/DXMRIG_NO_API)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -147,6 +147,13 @@ int App::start()
|
||||||
|
|
||||||
Summary::print();
|
Summary::print();
|
||||||
|
|
||||||
|
if (m_options->dryRun()) {
|
||||||
|
LOG_NOTICE("OK");
|
||||||
|
release();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
# ifndef XMRIG_NO_API
|
# ifndef XMRIG_NO_API
|
||||||
Api::start();
|
Api::start();
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -125,6 +125,9 @@ static char const short_options[] = "a:c:khBp:Px:r:R:s:t:T:o:u:O:v:Vl:S";
|
||||||
|
|
||||||
static struct option const options[] = {
|
static struct option const options[] = {
|
||||||
{ "algo", 1, nullptr, 'a' },
|
{ "algo", 1, nullptr, 'a' },
|
||||||
|
{ "api-access-token", 1, nullptr, 4001 },
|
||||||
|
{ "api-port", 1, nullptr, 4000 },
|
||||||
|
{ "api-worker-id", 1, nullptr, 4002 },
|
||||||
{ "av", 1, nullptr, 'v' },
|
{ "av", 1, nullptr, 'v' },
|
||||||
{ "aesni", 1, nullptr, 'A' },
|
{ "aesni", 1, nullptr, 'A' },
|
||||||
{ "multihash-factor", 1, nullptr, 'm' },
|
{ "multihash-factor", 1, nullptr, 'm' },
|
||||||
|
@ -133,6 +136,7 @@ static struct option const options[] = {
|
||||||
{ "cpu-affinity", 1, nullptr, 1020 },
|
{ "cpu-affinity", 1, nullptr, 1020 },
|
||||||
{ "cpu-priority", 1, nullptr, 1021 },
|
{ "cpu-priority", 1, nullptr, 1021 },
|
||||||
{ "donate-level", 1, nullptr, 1003 },
|
{ "donate-level", 1, nullptr, 1003 },
|
||||||
|
{ "dry-run", 0, nullptr, 5000 },
|
||||||
{ "help", 0, nullptr, 'h' },
|
{ "help", 0, nullptr, 'h' },
|
||||||
{ "keepalive", 0, nullptr ,'k' },
|
{ "keepalive", 0, nullptr ,'k' },
|
||||||
{ "log-file", 1, nullptr, 'l' },
|
{ "log-file", 1, nullptr, 'l' },
|
||||||
|
@ -181,6 +185,7 @@ static struct option const config_options[] = {
|
||||||
{ "cpu-affinity", 1, nullptr, 1020 },
|
{ "cpu-affinity", 1, nullptr, 1020 },
|
||||||
{ "cpu-priority", 1, nullptr, 1021 },
|
{ "cpu-priority", 1, nullptr, 1021 },
|
||||||
{ "donate-level", 1, nullptr, 1003 },
|
{ "donate-level", 1, nullptr, 1003 },
|
||||||
|
{ "dry-run", 0, nullptr, 5000 },
|
||||||
{ "huge-pages", 0, nullptr, 1009 },
|
{ "huge-pages", 0, nullptr, 1009 },
|
||||||
{ "log-file", 1, nullptr, 'l' },
|
{ "log-file", 1, nullptr, 'l' },
|
||||||
{ "max-cpu-usage", 1, nullptr, 1004 },
|
{ "max-cpu-usage", 1, nullptr, 1004 },
|
||||||
|
@ -505,6 +510,7 @@ bool Options::parseArg(int key, const char *arg)
|
||||||
case 'S': /* --syslog */
|
case 'S': /* --syslog */
|
||||||
case 1005: /* --safe */
|
case 1005: /* --safe */
|
||||||
case 1006: /* --nicehash */
|
case 1006: /* --nicehash */
|
||||||
|
case 5000: /* --dry-run */
|
||||||
return parseBoolean(key, true);
|
return parseBoolean(key, true);
|
||||||
|
|
||||||
case 1002: /* --no-color */
|
case 1002: /* --no-color */
|
||||||
|
@ -719,6 +725,10 @@ bool Options::parseBoolean(int key, bool enable)
|
||||||
m_colors = enable;
|
m_colors = enable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 5000: /* --dry-run */
|
||||||
|
m_dryRun = enable;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ NetworkState::NetworkState() :
|
||||||
|
|
||||||
int NetworkState::connectionTime() const
|
int NetworkState::connectionTime() const
|
||||||
{
|
{
|
||||||
return m_active ? ((uv_now(uv_default_loop()) - m_connectionTime) / 1000) : 0;
|
return m_active ? (int)((uv_now(uv_default_loop()) - m_connectionTime) / 1000) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ uint32_t NetworkState::avgTime() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint32_t) connectionTime() / m_latency.size();
|
return connectionTime() / (uint32_t)m_latency.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -208,14 +208,14 @@ aes_round(__m128i key, __m128i* x0, __m128i* x1, __m128i* x2, __m128i* x3, __m12
|
||||||
__m128i* x7)
|
__m128i* x7)
|
||||||
{
|
{
|
||||||
if (SOFT_AES) {
|
if (SOFT_AES) {
|
||||||
*x0 = soft_aesenc(*x0, key);
|
*x0 = soft_aesenc((uint32_t*)x0, key);
|
||||||
*x1 = soft_aesenc(*x1, key);
|
*x1 = soft_aesenc((uint32_t*)x1, key);
|
||||||
*x2 = soft_aesenc(*x2, key);
|
*x2 = soft_aesenc((uint32_t*)x2, key);
|
||||||
*x3 = soft_aesenc(*x3, key);
|
*x3 = soft_aesenc((uint32_t*)x3, key);
|
||||||
*x4 = soft_aesenc(*x4, key);
|
*x4 = soft_aesenc((uint32_t*)x4, key);
|
||||||
*x5 = soft_aesenc(*x5, key);
|
*x5 = soft_aesenc((uint32_t*)x5, key);
|
||||||
*x6 = soft_aesenc(*x6, key);
|
*x6 = soft_aesenc((uint32_t*)x6, key);
|
||||||
*x7 = soft_aesenc(*x7, key);
|
*x7 = soft_aesenc((uint32_t*)x7, key);
|
||||||
}
|
}
|
||||||
# ifndef XMRIG_ARMv7
|
# ifndef XMRIG_ARMv7
|
||||||
else {
|
else {
|
||||||
|
@ -459,14 +459,16 @@ public:
|
||||||
bx = _mm_set_epi64x(h[3] ^ h[7], h[2] ^ h[6]);
|
bx = _mm_set_epi64x(h[3] ^ h[7], h[2] ^ h[6]);
|
||||||
idx = h[0] ^ h[4];
|
idx = h[0] ^ h[4];
|
||||||
|
|
||||||
for (size_t i = 0; i < ITERATIONS; i++) {
|
for (size_t i = 0; i < ITERATIONS; i++) {
|
||||||
__m128i cx = _mm_load_si128((__m128i*) &l[idx & MASK]);
|
__m128i cx;
|
||||||
|
|
||||||
if (SOFT_AES) {
|
if (SOFT_AES) {
|
||||||
cx = soft_aesenc(cx, _mm_set_epi64x(ah, al));
|
cx = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0));
|
||||||
} else {
|
}
|
||||||
# ifndef XMRIG_ARMv7
|
else {
|
||||||
cx = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah, al);
|
cx = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||||
|
# ifndef XMRIG_ARMv7
|
||||||
|
cx = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah0, al0);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,20 +632,19 @@ public:
|
||||||
uint64_t idx1 = h1[0] ^h1[4];
|
uint64_t idx1 = h1[0] ^h1[4];
|
||||||
uint64_t idx2 = h2[0] ^h2[4];
|
uint64_t idx2 = h2[0] ^h2[4];
|
||||||
|
|
||||||
for (size_t i = 0; i < ITERATIONS; i++) {
|
for (size_t i = 0; i < ITERATIONS; i++) {
|
||||||
__m128i cx0 = _mm_load_si128((__m128i*) &l0[idx0 & MASK]);
|
__m128i cx0, cx1;
|
||||||
__m128i cx1 = _mm_load_si128((__m128i*) &l1[idx1 & MASK]);
|
|
||||||
__m128i cx2 = _mm_load_si128((__m128i*) &l2[idx2 & MASK]);
|
|
||||||
|
|
||||||
if (SOFT_AES) {
|
if (SOFT_AES) {
|
||||||
cx0 = soft_aesenc(cx0, _mm_set_epi64x(ah0, al0));
|
cx0 = soft_aesenc((uint32_t*)&l0[idx0 & MASK], _mm_set_epi64x(ah0, al0));
|
||||||
cx1 = soft_aesenc(cx1, _mm_set_epi64x(ah1, al1));
|
cx1 = soft_aesenc((uint32_t*)&l1[idx1 & MASK], _mm_set_epi64x(ah1, al1));
|
||||||
cx2 = soft_aesenc(cx2, _mm_set_epi64x(ah2, al2));
|
}
|
||||||
} else {
|
else {
|
||||||
# ifndef XMRIG_ARMv7
|
cx0 = _mm_load_si128((__m128i *) &l0[idx0 & MASK]);
|
||||||
cx0 = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx0, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah0, al0);
|
cx1 = _mm_load_si128((__m128i *) &l1[idx1 & MASK]);
|
||||||
cx1 = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx1, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah1, al1);
|
# ifndef XMRIG_ARMv7
|
||||||
cx2 = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx2, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah2, al2);
|
cx0 = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx0, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah0, al0);
|
||||||
|
cx1 = vreinterpretq_m128i_u8(vaesmcq_u8(vaeseq_u8(cx1, vdupq_n_u8(0)))) ^ _mm_set_epi64x(ah1, al1);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,15 +204,16 @@ aes_round(__m128i key, __m128i* x0, __m128i* x1, __m128i* x2, __m128i* x3, __m12
|
||||||
__m128i* x7)
|
__m128i* x7)
|
||||||
{
|
{
|
||||||
if (SOFT_AES) {
|
if (SOFT_AES) {
|
||||||
*x0 = soft_aesenc(*x0, key);
|
*x0 = soft_aesenc((uint32_t*)x0, key);
|
||||||
*x1 = soft_aesenc(*x1, key);
|
*x1 = soft_aesenc((uint32_t*)x1, key);
|
||||||
*x2 = soft_aesenc(*x2, key);
|
*x2 = soft_aesenc((uint32_t*)x2, key);
|
||||||
*x3 = soft_aesenc(*x3, key);
|
*x3 = soft_aesenc((uint32_t*)x3, key);
|
||||||
*x4 = soft_aesenc(*x4, key);
|
*x4 = soft_aesenc((uint32_t*)x4, key);
|
||||||
*x5 = soft_aesenc(*x5, key);
|
*x5 = soft_aesenc((uint32_t*)x5, key);
|
||||||
*x6 = soft_aesenc(*x6, key);
|
*x6 = soft_aesenc((uint32_t*)x6, key);
|
||||||
*x7 = soft_aesenc(*x7, key);
|
*x7 = soft_aesenc((uint32_t*)x7, key);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*x0 = _mm_aesenc_si128(*x0, key);
|
*x0 = _mm_aesenc_si128(*x0, key);
|
||||||
*x1 = _mm_aesenc_si128(*x1, key);
|
*x1 = _mm_aesenc_si128(*x1, key);
|
||||||
*x2 = _mm_aesenc_si128(*x2, key);
|
*x2 = _mm_aesenc_si128(*x2, key);
|
||||||
|
|
|
@ -89,34 +89,34 @@
|
||||||
alignas(16) const uint32_t saes_table[4][256] = { saes_data(saes_u0), saes_data(saes_u1), saes_data(saes_u2), saes_data(saes_u3) };
|
alignas(16) const uint32_t saes_table[4][256] = { saes_data(saes_u0), saes_data(saes_u1), saes_data(saes_u2), saes_data(saes_u3) };
|
||||||
alignas(16) const uint8_t saes_sbox[256] = saes_data(saes_h0);
|
alignas(16) const uint8_t saes_sbox[256] = saes_data(saes_h0);
|
||||||
|
|
||||||
static inline __m128i soft_aesenc(__m128i in, __m128i key)
|
static inline __m128i soft_aesenc(const uint32_t* in, __m128i key)
|
||||||
{
|
{
|
||||||
const uint32_t x0 = _mm_cvtsi128_si32(in);
|
const uint32_t x0 = in[0];
|
||||||
const uint32_t x1 = _mm_cvtsi128_si32(_mm_shuffle_epi32(in, 0x55));
|
const uint32_t x1 = in[1];
|
||||||
const uint32_t x2 = _mm_cvtsi128_si32(_mm_shuffle_epi32(in, 0xAA));
|
const uint32_t x2 = in[2];
|
||||||
const uint32_t x3 = _mm_cvtsi128_si32(_mm_shuffle_epi32(in, 0xFF));
|
const uint32_t x3 = in[3];
|
||||||
|
|
||||||
__m128i out = _mm_set_epi32(
|
__m128i out = _mm_set_epi32(
|
||||||
(saes_table[0][x3 & 0xff] ^ saes_table[1][(x0 >> 8) & 0xff] ^ saes_table[2][(x1 >> 16) & 0xff] ^ saes_table[3][x2 >> 24]),
|
(saes_table[0][x3 & 0xff] ^ saes_table[1][(x0 >> 8) & 0xff] ^ saes_table[2][(x1 >> 16) & 0xff] ^ saes_table[3][x2 >> 24]),
|
||||||
(saes_table[0][x2 & 0xff] ^ saes_table[1][(x3 >> 8) & 0xff] ^ saes_table[2][(x0 >> 16) & 0xff] ^ saes_table[3][x1 >> 24]),
|
(saes_table[0][x2 & 0xff] ^ saes_table[1][(x3 >> 8) & 0xff] ^ saes_table[2][(x0 >> 16) & 0xff] ^ saes_table[3][x1 >> 24]),
|
||||||
(saes_table[0][x1 & 0xff] ^ saes_table[1][(x2 >> 8) & 0xff] ^ saes_table[2][(x3 >> 16) & 0xff] ^ saes_table[3][x0 >> 24]),
|
(saes_table[0][x1 & 0xff] ^ saes_table[1][(x2 >> 8) & 0xff] ^ saes_table[2][(x3 >> 16) & 0xff] ^ saes_table[3][x0 >> 24]),
|
||||||
(saes_table[0][x0 & 0xff] ^ saes_table[1][(x1 >> 8) & 0xff] ^ saes_table[2][(x2 >> 16) & 0xff] ^ saes_table[3][x3 >> 24]));
|
(saes_table[0][x0 & 0xff] ^ saes_table[1][(x1 >> 8) & 0xff] ^ saes_table[2][(x2 >> 16) & 0xff] ^ saes_table[3][x3 >> 24]));
|
||||||
|
|
||||||
return _mm_xor_si128(out, key);
|
return _mm_xor_si128(out, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t sub_word(uint32_t key)
|
static inline uint32_t sub_word(uint32_t key)
|
||||||
{
|
{
|
||||||
return (saes_sbox[key >> 24 ] << 24) |
|
return (saes_sbox[key >> 24 ] << 24) |
|
||||||
(saes_sbox[(key >> 16) & 0xff] << 16 ) |
|
(saes_sbox[(key >> 16) & 0xff] << 16 ) |
|
||||||
(saes_sbox[(key >> 8) & 0xff] << 8 ) |
|
(saes_sbox[(key >> 8) & 0xff] << 8 ) |
|
||||||
saes_sbox[key & 0xff];
|
saes_sbox[key & 0xff];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__clang__) || defined(XMRIG_ARM)
|
#if defined(__clang__) || defined(XMRIG_ARM)
|
||||||
static inline uint32_t _rotr(uint32_t value, uint32_t amount)
|
static inline uint32_t _rotr(uint32_t value, uint32_t amount)
|
||||||
{
|
{
|
||||||
return (value >> amount) | (value << ((32 - amount) & 31));
|
return (value >> amount) | (value << ((32 - amount) & 31));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -532,7 +532,7 @@ void Client::onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t
|
||||||
auto client = getClient(handle->data);
|
auto client = getClient(handle->data);
|
||||||
|
|
||||||
buf->base = &client->m_recvBuf.base[client->m_recvBufPos];
|
buf->base = &client->m_recvBuf.base[client->m_recvBufPos];
|
||||||
buf->len = client->m_recvBuf.len - client->m_recvBufPos;
|
buf->len = client->m_recvBuf.len - (unsigned long)client->m_recvBufPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue