Merge branch 'dev'

This commit is contained in:
XMRig 2020-05-23 11:08:53 +07:00
commit 0a7324f500
No known key found for this signature in database
GPG key ID: 446A53638BE94409
188 changed files with 1414 additions and 2597 deletions

View file

@ -1,3 +1,11 @@
# v5.11.2
- [#1664](https://github.com/xmrig/xmrig/pull/1664) Improved JSON config error reporting.
- [#1668](https://github.com/xmrig/xmrig/pull/1668) Optimized RandomX dataset initialization.
- [#1675](https://github.com/xmrig/xmrig/pull/1675) Fixed cross-compiling on Linux.
- Fixed memory leak in HTTP client.
- Build [dependencies](https://github.com/xmrig/xmrig-deps/releases/tag/v4.1) updated to recent versions.
- Compiler for Windows gcc builds updated to v10.1.
# v5.11.1
- [#1652](https://github.com/xmrig/xmrig/pull/1652) Up to 1% RandomX perfomance improvement on recent AMD CPUs.
- [#1306](https://github.com/xmrig/xmrig/issues/1306) Fixed possible double connection to a pool.

View file

@ -1,5 +1,6 @@
if (WITH_RANDOMX)
add_definitions(/DXMRIG_ALGO_RANDOMX)
set(WITH_ARGON2 ON)
list(APPEND HEADERS_CRYPTO
src/crypto/rx/Rx.h
@ -16,8 +17,6 @@ if (WITH_RANDOMX)
list(APPEND SOURCES_CRYPTO
src/crypto/randomx/aes_hash.cpp
src/crypto/randomx/allocator.cpp
src/crypto/randomx/argon2_core.c
src/crypto/randomx/argon2_ref.c
src/crypto/randomx/blake2_generator.cpp
src/crypto/randomx/blake2/blake2b.c
src/crypto/randomx/bytecode_machine.cpp

19
scripts/build.hwloc.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash -e
HWLOC_VERSION="2.2.0"
mkdir -p deps
mkdir -p deps/include
mkdir -p deps/lib
mkdir -p build && cd build
wget https://download.open-mpi.org/release/hwloc/v2.2/hwloc-${HWLOC_VERSION}.tar.bz2 -O hwloc-${HWLOC_VERSION}.tar.bz2
tar -xjf hwloc-${HWLOC_VERSION}.tar.bz2
cd hwloc-${HWLOC_VERSION}
./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2
make -j$(nproc)
cp -fr include/ ../../deps
cp hwloc/.libs/libhwloc.a ../../deps/lib
cd ..

20
scripts/build.libressl.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash -e
LIBRESSL_VERSION="3.0.2"
mkdir -p deps
mkdir -p deps/include
mkdir -p deps/lib
mkdir -p build && cd build
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz -O libressl-${LIBRESSL_VERSION}.tar.gz
tar -xzf libressl-${LIBRESSL_VERSION}.tar.gz
cd libressl-${LIBRESSL_VERSION}
./configure --disable-shared
make -j$(nproc)
cp -fr include/ ../../deps
cp crypto/.libs/libcrypto.a ../../deps/lib
cp ssl/.libs/libssl.a ../../deps/lib
cd ..

20
scripts/build.openssl.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash -e
OPENSSL_VERSION="1.1.1g"
mkdir -p deps
mkdir -p deps/include
mkdir -p deps/lib
mkdir -p build && cd build
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O openssl-${OPENSSL_VERSION}.tar.gz
tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
cd openssl-${OPENSSL_VERSION}
./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms
make -j$(nproc)
cp -fr include/ ../../deps
cp libcrypto.a ../../deps/lib
cp libssl.a ../../deps/lib
cd ..

20
scripts/build.uv.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash -e
UV_VERSION="1.38.0"
mkdir -p deps
mkdir -p deps/include
mkdir -p deps/lib
mkdir -p build && cd build
wget https://github.com/libuv/libuv/archive/v${UV_VERSION}.tar.gz -O v${UV_VERSION}.tar.gz
tar -xzf v${UV_VERSION}.tar.gz
cd libuv-${UV_VERSION}
sh autogen.sh
./configure --disable-shared
make -j$(nproc)
cp -fr include/ ../../deps
cp .libs/libuv.a ../../deps/lib
cd ..

View file

@ -1,43 +1,5 @@
#!/bin/bash -e
UV_VERSION="1.34.0"
OPENSSL_VERSION="1.1.1d"
HWLOC_VERSION="2.1.0"
mkdir deps
mkdir deps/include
mkdir deps/lib
mkdir build && cd build
wget https://github.com/libuv/libuv/archive/v${UV_VERSION}.tar.gz
tar -xzf v${UV_VERSION}.tar.gz
wget https://download.open-mpi.org/release/hwloc/v2.1/hwloc-${HWLOC_VERSION}.tar.bz2
tar -xjf hwloc-${HWLOC_VERSION}.tar.bz2
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
cd libuv-${UV_VERSION}
sh autogen.sh
./configure --disable-shared
make -j$(nproc)
cp -fr include/ ../../deps
cp .libs/libuv.a ../../deps/lib
cd ..
cd hwloc-${HWLOC_VERSION}
./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2
make -j$(nproc)
cp -fr include/ ../../deps
cp hwloc/.libs/libhwloc.a ../../deps/lib
cd ..
cd openssl-${OPENSSL_VERSION}
./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms
make -j$(nproc)
cp -fr include/ ../../deps
cp libcrypto.a ../../deps/lib
cp libssl.a ../../deps/lib
cd ../..
./build.uv.sh
./build.hwloc.sh
./build.openssl.sh

View file

@ -17,7 +17,7 @@ set(ARGON2_SOURCES
set(ARGON2_X86_64_ENABLED ON)
set(ARGON2_X86_64_LIBS argon2-sse2 argon2-ssse3 argon2-xop argon2-avx2 argon2-avx512f)
set(ARGON2_X86_64_SOURCES arch/x86_64/lib/argon2-arch.c arch/x86_64/lib/cpu-flags.c)
set(ARGON2_X86_64_SOURCES arch/x86_64/lib/argon2-arch.c)
if (CMAKE_C_COMPILER_ID MATCHES MSVC)
function(add_feature_impl FEATURE MSVC_FLAG DEF)

View file

@ -4,7 +4,6 @@
#include "impl-select.h"
#include "cpu-flags.h"
#include "argon2-sse2.h"
#include "argon2-ssse3.h"
#include "argon2-xop.h"
@ -27,15 +26,13 @@ void argon2_get_impl_list(argon2_impl_list *list)
{
static const argon2_impl IMPLS[] = {
{ "x86_64", NULL, fill_segment_default },
{ "SSE2", check_sse2, fill_segment_sse2 },
{ "SSSE3", check_ssse3, fill_segment_ssse3 },
{ "XOP", check_xop, fill_segment_xop },
{ "AVX2", check_avx2, fill_segment_avx2 },
{ "AVX-512F", check_avx512f, fill_segment_avx512f },
{ "SSE2", xmrig_ar2_check_sse2, xmrig_ar2_fill_segment_sse2 },
{ "SSSE3", xmrig_ar2_check_ssse3, xmrig_ar2_fill_segment_ssse3 },
{ "XOP", xmrig_ar2_check_xop, xmrig_ar2_fill_segment_xop },
{ "AVX2", xmrig_ar2_check_avx2, xmrig_ar2_fill_segment_avx2 },
{ "AVX-512F", xmrig_ar2_check_avx512f, xmrig_ar2_fill_segment_avx512f },
};
cpu_flags_get();
list->count = sizeof(IMPLS) / sizeof(IMPLS[0]);
list->entries = IMPLS;
}

View file

@ -9,8 +9,6 @@
# include <intrin.h>
#endif
#include "cpu-flags.h"
#define r16 (_mm256_setr_epi8( \
2, 3, 4, 5, 6, 7, 0, 1, \
10, 11, 12, 13, 14, 15, 8, 9, \
@ -225,8 +223,7 @@ static void next_addresses(block *address_block, block *input_block)
fill_block(zero2_block, address_block, address_block, 0);
}
void fill_segment_avx2(const argon2_instance_t *instance,
argon2_position_t position)
void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position)
{
block *ref_block = NULL, *curr_block = NULL;
block address_block, input_block;
@ -310,8 +307,7 @@ void fill_segment_avx2(const argon2_instance_t *instance,
* lane.
*/
position.index = i;
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
ref_lane == position.lane);
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
/* 2 Creating a new block */
ref_block =
@ -327,21 +323,13 @@ void fill_segment_avx2(const argon2_instance_t *instance,
}
}
int check_avx2(void)
{
return cpu_flags_have_avx2();
}
extern int cpu_flags_has_avx2(void);
int xmrig_ar2_check_avx2(void) { return cpu_flags_has_avx2(); }
#else
void fill_segment_avx2(const argon2_instance_t *instance,
argon2_position_t position)
{
}
int check_avx2(void)
{
return 0;
}
void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position) {}
int xmrig_ar2_check_avx2(void) { return 0; }
#endif

View file

@ -3,9 +3,7 @@
#include "core.h"
void fill_segment_avx2(const argon2_instance_t *instance,
argon2_position_t position);
int check_avx2(void);
void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position);
int xmrig_ar2_check_avx2(void);
#endif // ARGON2_AVX2_H

View file

@ -10,8 +10,6 @@
# include <intrin.h>
#endif
#include "cpu-flags.h"
#define ror64(x, n) _mm512_ror_epi64((x), (n))
static __m512i f(__m512i x, __m512i y)
@ -210,8 +208,7 @@ static void next_addresses(block *address_block, block *input_block)
fill_block(zero2_block, address_block, address_block, 0);
}
void fill_segment_avx512f(const argon2_instance_t *instance,
argon2_position_t position)
void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position)
{
block *ref_block = NULL, *curr_block = NULL;
block address_block, input_block;
@ -295,8 +292,7 @@ void fill_segment_avx512f(const argon2_instance_t *instance,
* lane.
*/
position.index = i;
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
ref_lane == position.lane);
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
/* 2 Creating a new block */
ref_block =
@ -312,21 +308,12 @@ void fill_segment_avx512f(const argon2_instance_t *instance,
}
}
int check_avx512f(void)
{
return cpu_flags_have_avx512f();
}
extern int cpu_flags_has_avx512f(void);
int xmrig_ar2_check_avx512f(void) { return cpu_flags_has_avx512f(); }
#else
void fill_segment_avx512f(const argon2_instance_t *instance,
argon2_position_t position)
{
}
int check_avx512f(void)
{
return 0;
}
void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position) {}
int xmrig_ar2_check_avx512f(void) { return 0; }
#endif

View file

@ -3,9 +3,7 @@
#include "core.h"
void fill_segment_avx512f(const argon2_instance_t *instance,
argon2_position_t position);
int check_avx512f(void);
void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position);
int xmrig_ar2_check_avx512f(void);
#endif // ARGON2_AVX512F_H

View file

@ -7,8 +7,6 @@
# include <intrin.h>
#endif
#include "cpu-flags.h"
#define ror64_16(x) \
_mm_shufflehi_epi16( \
_mm_shufflelo_epi16((x), _MM_SHUFFLE(0, 3, 2, 1)), \
@ -102,27 +100,17 @@ static __m128i f(__m128i x, __m128i y)
#include "argon2-template-128.h"
void fill_segment_sse2(const argon2_instance_t *instance,
argon2_position_t position)
void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position)
{
fill_segment_128(instance, position);
}
int check_sse2(void)
{
return cpu_flags_have_sse2();
}
extern int cpu_flags_has_sse2(void);
int xmrig_ar2_check_sse2(void) { return cpu_flags_has_sse2(); }
#else
void fill_segment_sse2(const argon2_instance_t *instance,
argon2_position_t position)
{
}
int check_sse2(void)
{
return 0;
}
void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position) {}
int xmrig_ar2_check_sse2(void) { return 0; }
#endif

View file

@ -3,9 +3,7 @@
#include "core.h"
void fill_segment_sse2(const argon2_instance_t *instance,
argon2_position_t position);
int check_sse2(void);
void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position);
int xmrig_ar2_check_sse2(void);
#endif // ARGON2_SSE2_H

View file

@ -9,8 +9,6 @@
# include <intrin.h>
#endif
#include "cpu-flags.h"
#define r16 (_mm_setr_epi8( \
2, 3, 4, 5, 6, 7, 0, 1, \
10, 11, 12, 13, 14, 15, 8, 9))
@ -114,27 +112,17 @@ static __m128i f(__m128i x, __m128i y)
#include "argon2-template-128.h"
void fill_segment_ssse3(const argon2_instance_t *instance,
argon2_position_t position)
void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position)
{
fill_segment_128(instance, position);
}
int check_ssse3(void)
{
return cpu_flags_have_ssse3();
}
extern int cpu_flags_has_ssse3(void);
int xmrig_ar2_check_ssse3(void) { return cpu_flags_has_ssse3(); }
#else
void fill_segment_ssse3(const argon2_instance_t *instance,
argon2_position_t position)
{
}
int check_ssse3(void)
{
return 0;
}
void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position) {}
int xmrig_ar2_check_ssse3(void) { return 0; }
#endif

View file

@ -3,9 +3,7 @@
#include "core.h"
void fill_segment_ssse3(const argon2_instance_t *instance,
argon2_position_t position);
int check_ssse3(void);
void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position);
int xmrig_ar2_check_ssse3(void);
#endif // ARGON2_SSSE3_H

View file

@ -150,8 +150,7 @@ static void fill_segment_128(const argon2_instance_t *instance,
* lane.
*/
position.index = i;
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
ref_lane == position.lane);
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
/* 2 Creating a new block */
ref_block =

View file

@ -9,8 +9,6 @@
# include <intrin.h>
#endif
#include "cpu-flags.h"
#define ror64(x, c) _mm_roti_epi64((x), -(c))
static __m128i f(__m128i x, __m128i y)
@ -102,27 +100,17 @@ static __m128i f(__m128i x, __m128i y)
#include "argon2-template-128.h"
void fill_segment_xop(const argon2_instance_t *instance,
argon2_position_t position)
void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position)
{
fill_segment_128(instance, position);
}
int check_xop(void)
{
return cpu_flags_have_xop();
}
extern int cpu_flags_has_xop(void);
int xmrig_ar2_check_xop(void) { return cpu_flags_has_xop(); }
#else
void fill_segment_xop(const argon2_instance_t *instance,
argon2_position_t position)
{
}
int check_xop(void)
{
return 0;
}
void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position) {}
int xmrig_ar2_check_xop(void) { return 0; }
#endif

View file

@ -3,9 +3,7 @@
#include "core.h"
void fill_segment_xop(const argon2_instance_t *instance,
argon2_position_t position);
int check_xop(void);
void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position);
int xmrig_ar2_check_xop(void);
#endif // ARGON2_XOP_H

View file

@ -1,129 +0,0 @@
#include <stdbool.h>
#include <stdint.h>
#include "cpu-flags.h"
#include <stdio.h>
#ifdef _MSC_VER
# include <intrin.h>
#else
# include <cpuid.h>
#endif
#ifndef bit_OSXSAVE
# define bit_OSXSAVE (1 << 27)
#endif
#ifndef bit_SSE2
# define bit_SSE2 (1 << 26)
#endif
#ifndef bit_SSSE3
# define bit_SSSE3 (1 << 9)
#endif
#ifndef bit_AVX2
# define bit_AVX2 (1 << 5)
#endif
#ifndef bit_AVX512F
# define bit_AVX512F (1 << 16)
#endif
#ifndef bit_XOP
# define bit_XOP (1 << 11)
#endif
#define PROCESSOR_INFO (1)
#define EXTENDED_FEATURES (7)
#define EAX_Reg (0)
#define EBX_Reg (1)
#define ECX_Reg (2)
#define EDX_Reg (3)
enum {
X86_64_FEATURE_SSE2 = (1 << 0),
X86_64_FEATURE_SSSE3 = (1 << 1),
X86_64_FEATURE_XOP = (1 << 2),
X86_64_FEATURE_AVX2 = (1 << 3),
X86_64_FEATURE_AVX512F = (1 << 4),
};
static unsigned int cpu_flags;
static inline void cpuid(uint32_t level, int32_t output[4])
{
# ifdef _MSC_VER
__cpuid(output, (int) level);
# else
__cpuid_count(level, 0, output[0], output[1], output[2], output[3]);
# endif
}
static bool has_feature(uint32_t level, uint32_t reg, int32_t bit)
{
int32_t cpu_info[4] = { 0 };
cpuid(level, cpu_info);
return (cpu_info[reg] & bit) != 0;
}
void cpu_flags_get(void)
{
if (has_feature(PROCESSOR_INFO, EDX_Reg, bit_SSE2)) {
cpu_flags |= X86_64_FEATURE_SSE2;
}
if (has_feature(PROCESSOR_INFO, ECX_Reg, bit_SSSE3)) {
cpu_flags |= X86_64_FEATURE_SSSE3;
}
if (!has_feature(PROCESSOR_INFO, ECX_Reg, bit_OSXSAVE)) {
return;
}
if (has_feature(EXTENDED_FEATURES, EBX_Reg, bit_AVX2)) {
cpu_flags |= X86_64_FEATURE_AVX2;
}
if (has_feature(EXTENDED_FEATURES, EBX_Reg, bit_AVX512F)) {
cpu_flags |= X86_64_FEATURE_AVX512F;
}
if (has_feature(0x80000001, ECX_Reg, bit_XOP)) {
cpu_flags |= X86_64_FEATURE_XOP;
}
}
int cpu_flags_have_sse2(void)
{
return cpu_flags & X86_64_FEATURE_SSE2;
}
int cpu_flags_have_ssse3(void)
{
return cpu_flags & X86_64_FEATURE_SSSE3;
}
int cpu_flags_have_xop(void)
{
return cpu_flags & X86_64_FEATURE_XOP;
}
int cpu_flags_have_avx2(void)
{
return cpu_flags & X86_64_FEATURE_AVX2;
}
int cpu_flags_have_avx512f(void)
{
return cpu_flags & X86_64_FEATURE_AVX512F;
}

View file

@ -1,12 +0,0 @@
#ifndef ARGON2_CPU_FLAGS_H
#define ARGON2_CPU_FLAGS_H
void cpu_flags_get(void);
int cpu_flags_have_sse2(void);
int cpu_flags_have_ssse3(void);
int cpu_flags_have_xop(void);
int cpu_flags_have_avx2(void);
int cpu_flags_have_avx512f(void);
#endif // ARGON2_CPU_FLAGS_H

View file

@ -174,8 +174,7 @@ static void fill_segment_64(const argon2_instance_t *instance,
* lane.
*/
position.index = i;
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
ref_lane == position.lane);
ref_index = xmrig_ar2_index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF, ref_lane == position.lane);
/* 2 Creating a new block */
ref_block =

View file

@ -57,7 +57,7 @@ size_t argon2_memory_size(uint32_t m_cost, uint32_t parallelism) {
int argon2_ctx_mem(argon2_context *context, argon2_type type, void *memory,
size_t memory_size) {
/* 1. Validate all inputs */
int result = validate_inputs(context);
int result = xmrig_ar2_validate_inputs(context);
uint32_t memory_blocks, segment_length;
argon2_instance_t instance;
@ -98,20 +98,20 @@ int argon2_ctx_mem(argon2_context *context, argon2_type type, void *memory,
/* 3. Initialization: Hashing inputs, allocating memory, filling first
* blocks
*/
result = initialize(&instance, context);
result = xmrig_ar2_initialize(&instance, context);
if (ARGON2_OK != result) {
return result;
}
/* 4. Filling memory */
result = fill_memory_blocks(&instance);
result = xmrig_ar2_fill_memory_blocks(&instance);
if (ARGON2_OK != result) {
return result;
}
/* 5. Finalization */
finalize(context, &instance);
xmrig_ar2_finalize(context, &instance);
return ARGON2_OK;
}
@ -174,7 +174,7 @@ int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
result = argon2_ctx(&context, type);
if (result != ARGON2_OK) {
clear_internal_memory(out, hashlen);
xmrig_ar2_clear_internal_memory(out, hashlen);
free(out);
return result;
}
@ -187,13 +187,13 @@ int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
/* if encoding requested, write it */
if (encoded && encodedlen) {
if (encode_string(encoded, encodedlen, &context, type) != ARGON2_OK) {
clear_internal_memory(out, hashlen); /* wipe buffers if error */
clear_internal_memory(encoded, encodedlen);
xmrig_ar2_clear_internal_memory(out, hashlen); /* wipe buffers if error */
xmrig_ar2_clear_internal_memory(encoded, encodedlen);
free(out);
return ARGON2_ENCODING_FAIL;
}
}
clear_internal_memory(out, hashlen);
xmrig_ar2_clear_internal_memory(out, hashlen);
free(out);
return ARGON2_OK;

View file

@ -128,14 +128,14 @@ static void blake2b_init_state(blake2b_state *S)
S->buflen = 0;
}
void blake2b_init(blake2b_state *S, size_t outlen)
void xmrig_ar2_blake2b_init(blake2b_state *S, size_t outlen)
{
blake2b_init_state(S);
/* XOR initial state with param block: */
S->h[0] ^= (uint64_t)outlen | (UINT64_C(1) << 16) | (UINT64_C(1) << 24);
}
void blake2b_update(blake2b_state *S, const void *in, size_t inlen)
void xmrig_ar2_blake2b_update(blake2b_state *S, const void *in, size_t inlen)
{
const uint8_t *pin = (const uint8_t *)in;
@ -160,7 +160,7 @@ void blake2b_update(blake2b_state *S, const void *in, size_t inlen)
S->buflen += inlen;
}
void blake2b_final(blake2b_state *S, void *out, size_t outlen)
void xmrig_ar2_blake2b_final(blake2b_state *S, void *out, size_t outlen)
{
uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
unsigned int i;
@ -174,12 +174,12 @@ void blake2b_final(blake2b_state *S, void *out, size_t outlen)
}
memcpy(out, buffer, outlen);
clear_internal_memory(buffer, sizeof(buffer));
clear_internal_memory(S->buf, sizeof(S->buf));
clear_internal_memory(S->h, sizeof(S->h));
xmrig_ar2_clear_internal_memory(buffer, sizeof(buffer));
xmrig_ar2_clear_internal_memory(S->buf, sizeof(S->buf));
xmrig_ar2_clear_internal_memory(S->h, sizeof(S->h));
}
void blake2b_long(void *out, size_t outlen, const void *in, size_t inlen)
void xmrig_ar2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen)
{
uint8_t *pout = (uint8_t *)out;
blake2b_state blake_state;
@ -187,39 +187,39 @@ void blake2b_long(void *out, size_t outlen, const void *in, size_t inlen)
store32(outlen_bytes, (uint32_t)outlen);
if (outlen <= BLAKE2B_OUTBYTES) {
blake2b_init(&blake_state, outlen);
blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
blake2b_update(&blake_state, in, inlen);
blake2b_final(&blake_state, pout, outlen);
xmrig_ar2_blake2b_init(&blake_state, outlen);
xmrig_ar2_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
xmrig_ar2_blake2b_update(&blake_state, in, inlen);
xmrig_ar2_blake2b_final(&blake_state, pout, outlen);
} else {
uint32_t toproduce;
uint8_t out_buffer[BLAKE2B_OUTBYTES];
blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
blake2b_update(&blake_state, in, inlen);
blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
xmrig_ar2_blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
xmrig_ar2_blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes));
xmrig_ar2_blake2b_update(&blake_state, in, inlen);
xmrig_ar2_blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
memcpy(pout, out_buffer, BLAKE2B_OUTBYTES / 2);
pout += BLAKE2B_OUTBYTES / 2;
toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;
while (toproduce > BLAKE2B_OUTBYTES) {
blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
xmrig_ar2_blake2b_init(&blake_state, BLAKE2B_OUTBYTES);
xmrig_ar2_blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
xmrig_ar2_blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
memcpy(pout, out_buffer, BLAKE2B_OUTBYTES / 2);
pout += BLAKE2B_OUTBYTES / 2;
toproduce -= BLAKE2B_OUTBYTES / 2;
}
blake2b_init(&blake_state, toproduce);
blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
blake2b_final(&blake_state, out_buffer, toproduce);
xmrig_ar2_blake2b_init(&blake_state, toproduce);
xmrig_ar2_blake2b_update(&blake_state, out_buffer, BLAKE2B_OUTBYTES);
xmrig_ar2_blake2b_final(&blake_state, out_buffer, toproduce);
memcpy(pout, out_buffer, toproduce);
clear_internal_memory(out_buffer, sizeof(out_buffer));
xmrig_ar2_clear_internal_memory(out_buffer, sizeof(out_buffer));
}
}

View file

@ -20,11 +20,11 @@ typedef struct __blake2b_state {
} blake2b_state;
/* Streaming API */
void blake2b_init(blake2b_state *S, size_t outlen);
void blake2b_update(blake2b_state *S, const void *in, size_t inlen);
void blake2b_final(blake2b_state *S, void *out, size_t outlen);
void xmrig_ar2_blake2b_init(blake2b_state *S, size_t outlen);
void xmrig_ar2_blake2b_update(blake2b_state *S, const void *in, size_t inlen);
void xmrig_ar2_blake2b_final(blake2b_state *S, void *out, size_t outlen);
void blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
void xmrig_ar2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
#endif // ARGON2_BLAKE2_H

View file

@ -77,8 +77,7 @@ static void store_block(void *output, const block *src) {
/***************Memory functions*****************/
int allocate_memory(const argon2_context *context,
argon2_instance_t *instance) {
int xmrig_ar2_allocate_memory(const argon2_context *context, argon2_instance_t *instance) {
size_t blocks = instance->memory_blocks;
size_t memory_size = blocks * ARGON2_BLOCK_SIZE;
@ -107,11 +106,10 @@ int allocate_memory(const argon2_context *context,
return ARGON2_OK;
}
void free_memory(const argon2_context *context,
const argon2_instance_t *instance) {
void xmrig_ar2_free_memory(const argon2_context *context, const argon2_instance_t *instance) {
size_t memory_size = instance->memory_blocks * ARGON2_BLOCK_SIZE;
clear_internal_memory(instance->memory, memory_size);
xmrig_ar2_clear_internal_memory(instance->memory, memory_size);
if (instance->keep_memory) {
/* user-supplied memory -- do not free */
@ -125,7 +123,7 @@ void free_memory(const argon2_context *context,
}
}
void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
void NOT_OPTIMIZED xmrig_ar2_secure_wipe_memory(void *v, size_t n) {
#if defined(_MSC_VER) && VC_GE_2005(_MSC_VER)
SecureZeroMemory(v, n);
#elif defined memset_s
@ -140,14 +138,14 @@ void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
/* Memory clear flag defaults to true. */
int FLAG_clear_internal_memory = 0;
void clear_internal_memory(void *v, size_t n) {
void xmrig_ar2_clear_internal_memory(void *v, size_t n) {
if (FLAG_clear_internal_memory && v) {
secure_wipe_memory(v, n);
xmrig_ar2_secure_wipe_memory(v, n);
}
}
void finalize(const argon2_context *context, argon2_instance_t *instance) {
if (context != NULL && instance != NULL) {
void xmrig_ar2_finalize(const argon2_context *context, argon2_instance_t *instance) {
if (context != NULL && instance != NULL && context->out != NULL) {
block blockhash;
uint32_t l;
@ -164,24 +162,21 @@ void finalize(const argon2_context *context, argon2_instance_t *instance) {
{
uint8_t blockhash_bytes[ARGON2_BLOCK_SIZE];
store_block(blockhash_bytes, &blockhash);
blake2b_long(context->out, context->outlen, blockhash_bytes,
ARGON2_BLOCK_SIZE);
xmrig_ar2_blake2b_long(context->out, context->outlen, blockhash_bytes, ARGON2_BLOCK_SIZE);
/* clear blockhash and blockhash_bytes */
clear_internal_memory(blockhash.v, ARGON2_BLOCK_SIZE);
clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
xmrig_ar2_clear_internal_memory(blockhash.v, ARGON2_BLOCK_SIZE);
xmrig_ar2_clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
}
if (instance->print_internals) {
print_tag(context->out, context->outlen);
}
free_memory(context, instance);
xmrig_ar2_free_memory(context, instance);
}
}
uint32_t index_alpha(const argon2_instance_t *instance,
const argon2_position_t *position, uint32_t pseudo_rand,
int same_lane) {
uint32_t xmrig_ar2_index_alpha(const argon2_instance_t *instance, const argon2_position_t *position, uint32_t pseudo_rand, int same_lane) {
/*
* Pass 0:
* This lane : all already finished segments plus already constructed
@ -257,7 +252,7 @@ static int fill_memory_blocks_st(argon2_instance_t *instance) {
for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
for (l = 0; l < instance->lanes; ++l) {
argon2_position_t position = { r, l, (uint8_t)s, 0 };
fill_segment(instance, position);
xmrig_ar2_fill_segment(instance, position);
}
}
@ -268,7 +263,7 @@ static int fill_memory_blocks_st(argon2_instance_t *instance) {
return ARGON2_OK;
}
int fill_memory_blocks(argon2_instance_t *instance) {
int xmrig_ar2_fill_memory_blocks(argon2_instance_t *instance) {
if (instance == NULL || instance->lanes == 0) {
return ARGON2_INCORRECT_PARAMETER;
}
@ -276,19 +271,19 @@ int fill_memory_blocks(argon2_instance_t *instance) {
return fill_memory_blocks_st(instance);
}
int validate_inputs(const argon2_context *context) {
int xmrig_ar2_validate_inputs(const argon2_context *context) {
if (NULL == context) {
return ARGON2_INCORRECT_PARAMETER;
}
if (NULL == context->out) {
return ARGON2_OUTPUT_PTR_NULL;
}
//if (NULL == context->out) {
// return ARGON2_OUTPUT_PTR_NULL;
//}
/* Validate output length */
if (ARGON2_MIN_OUTLEN > context->outlen) {
return ARGON2_OUTPUT_TOO_SHORT;
}
//if (ARGON2_MIN_OUTLEN > context->outlen) {
// return ARGON2_OUTPUT_TOO_SHORT;
//}
if (ARGON2_MAX_OUTLEN < context->outlen) {
return ARGON2_OUTPUT_TOO_LONG;
@ -403,7 +398,7 @@ int validate_inputs(const argon2_context *context) {
return ARGON2_OK;
}
void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
void xmrig_ar2_fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
uint32_t l;
/* Make the first and second block in each lane as G(H0||0||i) or
G(H0||1||i) */
@ -412,21 +407,17 @@ void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 0);
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH + 4, l);
blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
ARGON2_PREHASH_SEED_LENGTH);
load_block(&instance->memory[l * instance->lane_length + 0],
blockhash_bytes);
xmrig_ar2_blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash, ARGON2_PREHASH_SEED_LENGTH);
load_block(&instance->memory[l * instance->lane_length + 0], blockhash_bytes);
store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 1);
blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
ARGON2_PREHASH_SEED_LENGTH);
load_block(&instance->memory[l * instance->lane_length + 1],
blockhash_bytes);
xmrig_ar2_blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash, ARGON2_PREHASH_SEED_LENGTH);
load_block(&instance->memory[l * instance->lane_length + 1], blockhash_bytes);
}
clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
xmrig_ar2_clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
}
void initial_hash(uint8_t *blockhash, argon2_context *context,
void xmrig_ar2_initial_hash(uint8_t *blockhash, argon2_context *context,
argon2_type type) {
blake2b_state BlakeHash;
uint8_t value[sizeof(uint32_t)];
@ -435,72 +426,70 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
return;
}
blake2b_init(&BlakeHash, ARGON2_PREHASH_DIGEST_LENGTH);
xmrig_ar2_blake2b_init(&BlakeHash, ARGON2_PREHASH_DIGEST_LENGTH);
store32(&value, context->lanes);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
store32(&value, context->outlen);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
store32(&value, context->m_cost);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
store32(&value, context->t_cost);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
store32(&value, context->version);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
store32(&value, (uint32_t)type);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
store32(&value, context->pwdlen);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
if (context->pwd != NULL) {
blake2b_update(&BlakeHash, (const uint8_t *)context->pwd,
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->pwd,
context->pwdlen);
if (context->flags & ARGON2_FLAG_CLEAR_PASSWORD) {
secure_wipe_memory(context->pwd, context->pwdlen);
xmrig_ar2_secure_wipe_memory(context->pwd, context->pwdlen);
context->pwdlen = 0;
}
}
store32(&value, context->saltlen);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
if (context->salt != NULL) {
blake2b_update(&BlakeHash, (const uint8_t *)context->salt,
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->salt,
context->saltlen);
}
store32(&value, context->secretlen);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
if (context->secret != NULL) {
blake2b_update(&BlakeHash, (const uint8_t *)context->secret,
context->secretlen);
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->secret, context->secretlen);
if (context->flags & ARGON2_FLAG_CLEAR_SECRET) {
secure_wipe_memory(context->secret, context->secretlen);
xmrig_ar2_secure_wipe_memory(context->secret, context->secretlen);
context->secretlen = 0;
}
}
store32(&value, context->adlen);
blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
if (context->ad != NULL) {
blake2b_update(&BlakeHash, (const uint8_t *)context->ad,
context->adlen);
xmrig_ar2_blake2b_update(&BlakeHash, (const uint8_t *)context->ad, context->adlen);
}
blake2b_final(&BlakeHash, blockhash, ARGON2_PREHASH_DIGEST_LENGTH);
xmrig_ar2_blake2b_final(&BlakeHash, blockhash, ARGON2_PREHASH_DIGEST_LENGTH);
}
int initialize(argon2_instance_t *instance, argon2_context *context) {
int xmrig_ar2_initialize(argon2_instance_t *instance, argon2_context *context) {
uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH];
int result = ARGON2_OK;
@ -510,7 +499,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
/* 1. Memory allocation */
result = allocate_memory(context, instance);
result = xmrig_ar2_allocate_memory(context, instance);
if (result != ARGON2_OK) {
return result;
}
@ -519,11 +508,9 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
/* H_0 + 8 extra bytes to produce the first blocks */
/* uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH]; */
/* Hashing all inputs */
initial_hash(blockhash, context, instance->type);
xmrig_ar2_initial_hash(blockhash, context, instance->type);
/* Zeroing 8 extra bytes */
clear_internal_memory(blockhash + ARGON2_PREHASH_DIGEST_LENGTH,
ARGON2_PREHASH_SEED_LENGTH -
ARGON2_PREHASH_DIGEST_LENGTH);
xmrig_ar2_clear_internal_memory(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, ARGON2_PREHASH_SEED_LENGTH - ARGON2_PREHASH_DIGEST_LENGTH);
if (instance->print_internals) {
initial_kat(blockhash, context, instance->type);
@ -531,9 +518,9 @@ int initialize(argon2_instance_t *instance, argon2_context *context) {
/* 3. Creating first blocks, we always have at least two blocks in a slice
*/
fill_first_blocks(blockhash, instance);
xmrig_ar2_fill_first_blocks(blockhash, instance);
/* Clearing the hash */
clear_internal_memory(blockhash, ARGON2_PREHASH_SEED_LENGTH);
xmrig_ar2_clear_internal_memory(blockhash, ARGON2_PREHASH_SEED_LENGTH);
return ARGON2_OK;
}

View file

@ -110,8 +110,7 @@ typedef struct Argon2_thread_data {
* @param instance the Argon2 instance
* @return ARGON2_OK if memory is allocated successfully
*/
int allocate_memory(const argon2_context *context,
argon2_instance_t *instance);
int xmrig_ar2_allocate_memory(const argon2_context *context, argon2_instance_t *instance);
/*
* Frees memory at the given pointer, uses the appropriate deallocator as
@ -119,22 +118,21 @@ int allocate_memory(const argon2_context *context,
* @param context argon2_context which specifies the deallocator
* @param instance the Argon2 instance
*/
void free_memory(const argon2_context *context,
const argon2_instance_t *instance);
void xmrig_ar2_free_memory(const argon2_context *context, const argon2_instance_t *instance);
/* Function that securely cleans the memory. This ignores any flags set
* regarding clearing memory. Usually one just calls clear_internal_memory.
* @param mem Pointer to the memory
* @param s Memory size in bytes
*/
void secure_wipe_memory(void *v, size_t n);
void xmrig_ar2_secure_wipe_memory(void *v, size_t n);
/* Function that securely clears the memory if FLAG_clear_internal_memory is
* set. If the flag isn't set, this function does nothing.
* @param mem Pointer to the memory
* @param s Memory size in bytes
*/
ARGON2_PUBLIC void clear_internal_memory(void *v, size_t n);
ARGON2_PUBLIC void xmrig_ar2_clear_internal_memory(void *v, size_t n);
/*
* Computes absolute position of reference block in the lane following a skewed
@ -146,9 +144,7 @@ ARGON2_PUBLIC void clear_internal_memory(void *v, size_t n);
* If so we can reference the current segment
* @pre All pointers must be valid
*/
uint32_t index_alpha(const argon2_instance_t *instance,
const argon2_position_t *position, uint32_t pseudo_rand,
int same_lane);
uint32_t xmrig_ar2_index_alpha(const argon2_instance_t *instance, const argon2_position_t *position, uint32_t pseudo_rand, int same_lane);
/*
* Function that validates all inputs against predefined restrictions and return
@ -157,7 +153,7 @@ uint32_t index_alpha(const argon2_instance_t *instance,
* @return ARGON2_OK if everything is all right, otherwise one of error codes
* (all defined in <argon2.h>
*/
int validate_inputs(const argon2_context *context);
int xmrig_ar2_validate_inputs(const argon2_context *context);
/*
* Hashes all the inputs into @a blockhash[PREHASH_DIGEST_LENGTH], clears
@ -169,8 +165,7 @@ int validate_inputs(const argon2_context *context);
* @pre @a blockhash must have at least @a PREHASH_DIGEST_LENGTH bytes
* allocated
*/
void initial_hash(uint8_t *blockhash, argon2_context *context,
argon2_type type);
void xmrig_ar2_initial_hash(uint8_t *blockhash, argon2_context *context, argon2_type type);
/*
* Function creates first 2 blocks per lane
@ -178,7 +173,7 @@ void initial_hash(uint8_t *blockhash, argon2_context *context,
* @param blockhash Pointer to the pre-hashing digest
* @pre blockhash must point to @a PREHASH_SEED_LENGTH allocated values
*/
void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
void xmrig_ar2_fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
/*
* Function allocates memory, hashes the inputs with Blake, and creates first
@ -190,7 +185,7 @@ void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
* @return Zero if successful, -1 if memory failed to allocate. @context->state
* will be modified if successful.
*/
int initialize(argon2_instance_t *instance, argon2_context *context);
int xmrig_ar2_initialize(argon2_instance_t *instance, argon2_context *context);
/*
* XORing the last block of each lane, hashing it, making the tag. Deallocates
@ -203,7 +198,7 @@ int initialize(argon2_instance_t *instance, argon2_context *context);
* @pre if context->free_cbk is not NULL, it should point to a function that
* deallocates memory
*/
void finalize(const argon2_context *context, argon2_instance_t *instance);
void xmrig_ar2_finalize(const argon2_context *context, argon2_instance_t *instance);
/*
* Function that fills the segment using previous segments also from other
@ -212,8 +207,7 @@ void finalize(const argon2_context *context, argon2_instance_t *instance);
* @param position Current position
* @pre all block pointers must be valid
*/
void fill_segment(const argon2_instance_t *instance,
argon2_position_t position);
void xmrig_ar2_fill_segment(const argon2_instance_t *instance, argon2_position_t position);
/*
* Function that fills the entire memory t_cost times based on the first two
@ -221,6 +215,6 @@ void fill_segment(const argon2_instance_t *instance,
* @param instance Pointer to the current instance
* @return ARGON2_OK if successful, @context->state
*/
int fill_memory_blocks(argon2_instance_t *instance);
int xmrig_ar2_fill_memory_blocks(argon2_instance_t *instance);
#endif

View file

@ -323,7 +323,7 @@ int decode_string(argon2_context *ctx, const char *str, argon2_type type) {
ctx->flags = ARGON2_DEFAULT_FLAGS;
/* On return, must have valid context */
validation_result = validate_inputs(ctx);
validation_result = xmrig_ar2_validate_inputs(ctx);
if (validation_result != ARGON2_OK) {
return validation_result;
}
@ -371,7 +371,7 @@ int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
} while ((void)0, 0)
const char* type_string = argon2_type2string(type, 0);
int validation_result = validate_inputs(ctx);
int validation_result = xmrig_ar2_validate_inputs(ctx);
if (!type_string) {
return ARGON2_ENCODING_FAIL;

View file

@ -2,28 +2,32 @@
#include <string.h>
#include "impl-select.h"
#include "3rdparty/argon2.h"
#define BENCH_SAMPLES 1024
extern uint64_t uv_hrtime(void);
#define BENCH_SAMPLES 1024U
#define BENCH_MEM_BLOCKS 512
static argon2_impl selected_argon_impl = {
"default", NULL, fill_segment_default
};
#ifdef _MSC_VER
# define strcasecmp _stricmp
#endif
static argon2_impl selected_argon_impl = { "default", NULL, fill_segment_default };
/* the benchmark routine is not thread-safe, so we can use a global var here: */
static block memory[BENCH_MEM_BLOCKS];
static uint64_t benchmark_impl(const argon2_impl *impl) {
clock_t time;
unsigned int i;
uint64_t bench;
argon2_instance_t instance;
argon2_position_t pos;
static uint64_t benchmark_impl(const argon2_impl *impl) {
memset(memory, 0, sizeof(memory));
argon2_instance_t instance;
instance.version = ARGON2_VERSION_NUMBER;
instance.memory = memory;
instance.passes = 1;
@ -32,8 +36,9 @@ static uint64_t benchmark_impl(const argon2_impl *impl) {
instance.lane_length = instance.segment_length * ARGON2_SYNC_POINTS;
instance.lanes = 1;
instance.threads = 1;
instance.type = Argon2_i;
instance.type = Argon2_id;
argon2_position_t pos;
pos.lane = 0;
pos.pass = 0;
pos.slice = 0;
@ -43,35 +48,32 @@ static uint64_t benchmark_impl(const argon2_impl *impl) {
impl->fill_segment(&instance, pos);
/* OK, now measure: */
bench = 0;
time = clock();
for (i = 0; i < BENCH_SAMPLES; i++) {
const uint64_t time = uv_hrtime();
for (uint32_t i = 0; i < BENCH_SAMPLES; i++) {
impl->fill_segment(&instance, pos);
}
time = clock() - time;
bench = (uint64_t)time;
return bench;
return uv_hrtime() - time;
}
void argon2_select_impl()
{
argon2_impl_list impls;
unsigned int i;
const argon2_impl *best_impl = NULL;
uint64_t best_bench = UINT_MAX;
argon2_get_impl_list(&impls);
for (i = 0; i < impls.count; i++) {
for (uint32_t i = 0; i < impls.count; i++) {
const argon2_impl *impl = &impls.entries[i];
uint64_t bench;
if (impl->check != NULL && !impl->check()) {
continue;
}
bench = benchmark_impl(impl);
const uint64_t bench = benchmark_impl(impl);
if (bench < best_bench) {
best_bench = bench;
best_impl = impl;
@ -83,11 +85,13 @@ void argon2_select_impl()
}
}
void fill_segment(const argon2_instance_t *instance, argon2_position_t position)
void xmrig_ar2_fill_segment(const argon2_instance_t *instance, argon2_position_t position)
{
selected_argon_impl.fill_segment(instance, position);
}
const char *argon2_get_impl_name()
{
return selected_argon_impl.name;
@ -97,14 +101,12 @@ const char *argon2_get_impl_name()
int argon2_select_impl_by_name(const char *name)
{
argon2_impl_list impls;
unsigned int i;
argon2_get_impl_list(&impls);
for (i = 0; i < impls.count; i++) {
for (uint32_t i = 0; i < impls.count; i++) {
const argon2_impl *impl = &impls.entries[i];
if (strcmp(impl->name, name) == 0) {
if (strcasecmp(impl->name, name) == 0) {
selected_argon_impl = *impl;
return 1;

View file

@ -1,5 +1,5 @@
Copyright © 2009 CNRS
Copyright © 2009-2019 Inria. All rights reserved.
Copyright © 2009-2020 Inria. All rights reserved.
Copyright © 2009-2013 Université Bordeaux
Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
@ -16,6 +16,27 @@ bug fixes (and other actions) for each version of hwloc since version
0.9.
Version 2.2.0
-------------
* API
+ Add hwloc_bitmap_singlify_by_core() to remove SMT from a given cpuset,
thanks to Florian Reynier for the suggestion.
+ Add --enable-32bits-pci-domain to stop ignoring PCI devices with domain
>16bits (e.g. 10000:02:03.4). Enabling this option breaks the library ABI.
Thanks to Dylan Simon for the help.
* Backends
+ Add support for Linux cgroups v2.
+ Add NUMA support for FreeBSD.
+ Add get_last_cpu_location support for FreeBSD.
+ Remove support for Intel Xeon Phi (MIC, Knights Corner) co-processors.
* Tools
+ Add --uid to filter the hwloc-ps output by uid on Linux.
+ Add a GRAPHICAL OUTPUT section in the manpage of lstopo.
* Misc
+ Use the native dlopen instead of libltdl,
unless --disable-plugin-dlopen is passed at configure time.
Version 2.1.0
-------------
* API

View file

@ -8,7 +8,7 @@
# Please update HWLOC_VERSION* in contrib/windows/hwloc_config.h too.
major=2
minor=1
minor=2
release=0
# greek is used for alpha or beta release tags. If it is non-empty,
@ -22,7 +22,7 @@ greek=
# The date when this release was created
date="Sep 30, 2019"
date="Mar 30, 2020"
# If snapshot=1, then use the value from snapshot_version as the
# entire hwloc version (i.e., ignore major, minor, release, and
@ -41,7 +41,7 @@ snapshot_version=${major}.${minor}.${release}${greek}-git
# 2. Version numbers are described in the Libtool current:revision:age
# format.
libhwloc_so_version=16:0:1
libhwloc_so_version=17:0:2
libnetloc_so_version=0:0:0
# Please also update the <TargetName> lines in contrib/windows/libhwloc.vcxproj

View file

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -173,8 +173,12 @@ typedef hwloc_const_bitmap_t hwloc_const_nodeset_t;
* may be defined in the future! If you need to compare types, use
* hwloc_compare_types() instead.
*/
#define HWLOC_OBJ_TYPE_MIN HWLOC_OBJ_MACHINE /**< \private Sentinel value */
typedef enum {
/** \cond */
#define HWLOC_OBJ_TYPE_MIN HWLOC_OBJ_MACHINE /* Sentinel value */
/** \endcond */
HWLOC_OBJ_MACHINE, /**< \brief Machine.
* A set of processors and memory with cache
* coherency.
@ -251,7 +255,7 @@ typedef enum {
*/
HWLOC_OBJ_BRIDGE, /**< \brief Bridge (filtered out by default).
* Any bridge that connects the host or an I/O bus,
* Any bridge (or PCI switch) that connects the host or an I/O bus,
* to another I/O bus.
* They are not added to the topology unless I/O discovery
* is enabled with hwloc_topology_set_flags().
@ -360,9 +364,8 @@ typedef enum hwloc_obj_osdev_type_e {
*/
HWLOC_DECLSPEC int hwloc_compare_types (hwloc_obj_type_t type1, hwloc_obj_type_t type2) __hwloc_attribute_const;
enum hwloc_compare_types_e {
HWLOC_TYPE_UNORDERED = INT_MAX /**< \brief Value returned by hwloc_compare_types() when types can not be compared. \hideinitializer */
};
/** \brief Value returned by hwloc_compare_types() when types can not be compared. \hideinitializer */
#define HWLOC_TYPE_UNORDERED INT_MAX
/** @} */
@ -614,7 +617,11 @@ union hwloc_obj_attr_u {
} group;
/** \brief PCI Device specific Object Attributes */
struct hwloc_pcidev_attr_s {
unsigned short domain;
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
unsigned short domain; /* Only 16bits PCI domains are supported by default */
#else
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
#endif
unsigned char bus, dev, func;
unsigned short class_id;
unsigned short vendor_id, device_id, subvendor_id, subdevice_id;
@ -629,7 +636,11 @@ union hwloc_obj_attr_u {
hwloc_obj_bridge_type_t upstream_type;
union {
struct {
unsigned short domain;
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
unsigned short domain; /* Only 16bits PCI domains are supported by default */
#else
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
#endif
unsigned char secondary_bus, subordinate_bus;
} pci;
} downstream;
@ -859,7 +870,8 @@ hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
/** \brief Returns the type of objects at depth \p depth.
*
* \p depth should between 0 and hwloc_topology_get_depth()-1.
* \p depth should between 0 and hwloc_topology_get_depth()-1,
* or a virtual depth such as ::HWLOC_TYPE_DEPTH_NUMANODE.
*
* \return (hwloc_obj_type_t)-1 if depth \p depth does not exist.
*/
@ -1355,7 +1367,7 @@ HWLOC_DECLSPEC int hwloc_get_proc_last_cpu_location(hwloc_topology_t topology, h
typedef enum {
/** \brief Reset the memory allocation policy to the system default.
* Depending on the operating system, this may correspond to
* ::HWLOC_MEMBIND_FIRSTTOUCH (Linux),
* ::HWLOC_MEMBIND_FIRSTTOUCH (Linux, FreeBSD),
* or ::HWLOC_MEMBIND_BIND (AIX, HP-UX, Solaris, Windows).
* This policy is never returned by get membind functions.
* The nodeset argument is ignored.
@ -2169,13 +2181,14 @@ HWLOC_DECLSPEC void * hwloc_topology_get_userdata(hwloc_topology_t topology);
enum hwloc_restrict_flags_e {
/** \brief Remove all objects that became CPU-less.
* By default, only objects that contain no PU and no memory are removed.
* This flag may not be used with ::HWLOC_RESTRICT_FLAG_BYNODESET.
* \hideinitializer
*/
HWLOC_RESTRICT_FLAG_REMOVE_CPULESS = (1UL<<0),
/** \brief Restrict by nodeset instead of CPU set.
* Only keep objects whose nodeset is included or partially included in the given set.
* This flag may not be used with ::HWLOC_RESTRICT_FLAG_BYNODESET.
* This flag may not be used with ::HWLOC_RESTRICT_FLAG_REMOVE_CPULESS.
*/
HWLOC_RESTRICT_FLAG_BYNODESET = (1UL<<3),

View file

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2018 Inria. All rights reserved.
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -11,9 +11,9 @@
#ifndef HWLOC_CONFIG_H
#define HWLOC_CONFIG_H
#define HWLOC_VERSION "2.1.0"
#define HWLOC_VERSION "2.2.0"
#define HWLOC_VERSION_MAJOR 2
#define HWLOC_VERSION_MINOR 1
#define HWLOC_VERSION_MINOR 2
#define HWLOC_VERSION_RELEASE 0
#define HWLOC_VERSION_GREEK ""

View file

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -672,6 +672,24 @@ hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute
* package has fewer caches than its peers.
*/
/** \brief Remove simultaneous multithreading PUs from a CPU set.
*
* For each core in \p topology, if \p cpuset contains some PUs of that core,
* modify \p cpuset to only keep a single PU for that core.
*
* \p which specifies which PU will be kept.
* PU are considered in physical index order.
* If 0, for each core, the function keeps the first PU that was originally set in \p cpuset.
*
* If \p which is larger than the number of PUs in a core there were originally set in \p cpuset,
* no PU is kept for that core.
*
* \note PUs that are not below a Core object are ignored
* (for instance if the topology does not contain any Core object).
* None of them is removed from \p cpuset.
*/
HWLOC_DECLSPEC int hwloc_bitmap_singlify_per_core(hwloc_topology_t topology, hwloc_bitmap_t cpuset, unsigned which);
/** \brief Returns the object of type ::HWLOC_OBJ_PU with \p os_index.
*
* This function is useful for converting a CPU set into the PU
@ -998,15 +1016,16 @@ hwloc_topology_get_allowed_nodeset(hwloc_topology_t topology) __hwloc_attribute_
* @{
*/
/** \brief Convert a CPU set into a NUMA node set and handle non-NUMA cases
/** \brief Convert a CPU set into a NUMA node set
*
* For each PU included in the input \p _cpuset, set the corresponding
* local NUMA node(s) in the output \p nodeset.
*
* If some NUMA nodes have no CPUs at all, this function never sets their
* indexes in the output node set, even if a full CPU set is given in input.
*
* If the topology contains no NUMA nodes, the machine is considered
* as a single memory node, and the following behavior is used:
* If \p cpuset is empty, \p nodeset will be emptied as well.
* Otherwise \p nodeset will be entirely filled.
* Hence the entire topology CPU set is converted into the set of all nodes
* that have some local CPUs.
*/
static __hwloc_inline int
hwloc_cpuset_to_nodeset(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
@ -1021,13 +1040,16 @@ hwloc_cpuset_to_nodeset(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset,
return 0;
}
/** \brief Convert a NUMA node set into a CPU set and handle non-NUMA cases
/** \brief Convert a NUMA node set into a CPU set
*
* If the topology contains no NUMA nodes, the machine is considered
* as a single memory node, and the following behavior is used:
* If \p nodeset is empty, \p cpuset will be emptied as well.
* Otherwise \p cpuset will be entirely filled.
* This is useful for manipulating memory binding sets.
* For each NUMA node included in the input \p nodeset, set the corresponding
* local PUs in the output \p _cpuset.
*
* If some CPUs have no local NUMA nodes, this function never sets their
* indexes in the output CPU set, even if a full node set is given in input.
*
* Hence the entire topology node set is converted into the set of all CPUs
* that have some local NUMA nodes.
*/
static __hwloc_inline int
hwloc_cpuset_from_nodeset(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2012-2018 Inria. All rights reserved.
* Copyright © 2012-2019 Inria. All rights reserved.
* Copyright © 2013, 2018 Université Bordeaux. All right reserved.
* See COPYING in top-level directory.
*/
@ -52,6 +52,7 @@ typedef union {
/* needs "cl_nv_device_attribute_query" device extension, but not strictly required for clGetDeviceInfo() */
#define HWLOC_CL_DEVICE_PCI_BUS_ID_NV 0x4008
#define HWLOC_CL_DEVICE_PCI_SLOT_ID_NV 0x4009
#define HWLOC_CL_DEVICE_PCI_DOMAIN_ID_NV 0x400A
/** \defgroup hwlocality_opencl Interoperability with OpenCL
@ -74,7 +75,7 @@ hwloc_opencl_get_device_pci_busid(cl_device_id device,
unsigned *domain, unsigned *bus, unsigned *dev, unsigned *func)
{
hwloc_cl_device_topology_amd amdtopo;
cl_uint nvbus, nvslot;
cl_uint nvbus, nvslot, nvdomain;
cl_int clret;
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_TOPOLOGY_AMD, sizeof(amdtopo), &amdtopo, NULL);
@ -91,8 +92,12 @@ hwloc_opencl_get_device_pci_busid(cl_device_id device,
if (CL_SUCCESS == clret) {
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_PCI_SLOT_ID_NV, sizeof(nvslot), &nvslot, NULL);
if (CL_SUCCESS == clret) {
/* FIXME: PCI bus only uses 8bit, assume nvidia hardcodes the domain in higher bits */
*domain = nvbus >> 8;
clret = clGetDeviceInfo(device, HWLOC_CL_DEVICE_PCI_DOMAIN_ID_NV, sizeof(nvdomain), &nvdomain, NULL);
if (CL_SUCCESS == clret) { /* available since CUDA 10.2 */
*domain = nvdomain;
} else {
*domain = 0;
}
*bus = nvbus & 0xff;
/* non-documented but used in many other projects */
*dev = nvslot >> 3;

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019 Inria. All rights reserved.
* Copyright © 2013-2020 Inria. All rights reserved.
* Copyright © 2016 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -17,7 +17,11 @@ struct hwloc_backend;
#ifdef HWLOC_INSIDE_PLUGIN
/* needed for hwloc_plugin_check_namespace() */
#ifdef HWLOC_HAVE_LTDL
#include <ltdl.h>
#else
#include <dlfcn.h>
#endif
#endif
@ -418,14 +422,22 @@ static __hwloc_inline int
hwloc_plugin_check_namespace(const char *pluginname __hwloc_attribute_unused, const char *symbol __hwloc_attribute_unused)
{
#ifdef HWLOC_INSIDE_PLUGIN
lt_dlhandle handle;
void *sym;
handle = lt_dlopen(NULL);
#ifdef HWLOC_HAVE_LTDL
lt_dlhandle handle = lt_dlopen(NULL);
#else
void *handle = dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
#endif
if (!handle)
/* cannot check, assume things will work */
return 0;
#ifdef HWLOC_HAVE_LTDL
sym = lt_dlsym(handle, symbol);
lt_dlclose(handle);
#else
sym = dlsym(handle, symbol);
dlclose(handle);
#endif
if (!sym) {
static int verboseenv_checked = 0;
static int verboseenv_value = 0;

View file

@ -28,6 +28,7 @@ extern "C" {
#define HWLOC_MUNGE_NAME(a, b) HWLOC_MUNGE_NAME2(a, b)
#define HWLOC_MUNGE_NAME2(a, b) a ## b
#define HWLOC_NAME(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX, hwloc_ ## name)
/* FIXME: should be "HWLOC_ ## name" below, unchanged because it doesn't matter much and could break some embedders hacks */
#define HWLOC_NAME_CAPS(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX_CAPS, hwloc_ ## name)
/* Now define all the "real" names to be the prefixed names. This
@ -92,9 +93,6 @@ extern "C" {
#define hwloc_compare_types HWLOC_NAME(compare_types)
#define hwloc_compare_types_e HWLOC_NAME(compare_types_e)
#define HWLOC_TYPE_UNORDERED HWLOC_NAME_CAPS(TYPE_UNORDERED)
#define hwloc_obj HWLOC_NAME(obj)
#define hwloc_obj_t HWLOC_NAME(obj_t)
@ -324,6 +322,7 @@ extern "C" {
#define hwloc_get_ancestor_obj_by_type HWLOC_NAME(get_ancestor_obj_by_type)
#define hwloc_get_next_obj_by_depth HWLOC_NAME(get_next_obj_by_depth)
#define hwloc_get_next_obj_by_type HWLOC_NAME(get_next_obj_by_type)
#define hwloc_bitmap_singlify_per_core HWLOC_NAME(bitmap_singlify_by_core)
#define hwloc_get_pu_obj_by_os_index HWLOC_NAME(get_pu_obj_by_os_index)
#define hwloc_get_numanode_obj_by_os_index HWLOC_NAME(get_numanode_obj_by_os_index)
#define hwloc_get_next_child HWLOC_NAME(get_next_child)
@ -482,11 +481,6 @@ extern "C" {
#define hwloc_ibv_get_device_osdev HWLOC_NAME(ibv_get_device_osdev)
#define hwloc_ibv_get_device_osdev_by_name HWLOC_NAME(ibv_get_device_osdev_by_name)
/* intel-mic.h */
#define hwloc_intel_mic_get_device_cpuset HWLOC_NAME(intel_mic_get_device_cpuset)
#define hwloc_intel_mic_get_device_osdev_by_index HWLOC_NAME(intel_mic_get_device_osdev_by_index)
/* opencl.h */
#define hwloc_cl_device_topology_amd HWLOC_NAME(cl_device_topology_amd)
@ -709,6 +703,7 @@ extern "C" {
#define hwloc_get_sysctlbyname HWLOC_NAME(get_sysctlbyname)
#define hwloc_get_sysctl HWLOC_NAME(get_sysctl)
#define hwloc_fallback_nbprocessors HWLOC_NAME(fallback_nbprocessors)
#define hwloc_fallback_memsize HWLOC_NAME(fallback_memsize)
#define hwloc__object_cpusets_compare_first HWLOC_NAME(_object_cpusets_compare_first)
#define hwloc__reorder_children HWLOC_NAME(_reorder_children)

View file

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
*
* See COPYING in top-level directory.
@ -224,11 +224,13 @@ struct hwloc_topology {
extern void hwloc_alloc_root_sets(hwloc_obj_t root);
extern void hwloc_setup_pu_level(struct hwloc_topology *topology, unsigned nb_pus);
extern int hwloc_get_sysctlbyname(const char *name, int64_t *n);
extern int hwloc_get_sysctl(int name[], unsigned namelen, int *n);
extern int hwloc_get_sysctl(int name[], unsigned namelen, int64_t *n);
/* returns the number of CPU from the OS (only valid if thissystem) */
#define HWLOC_FALLBACK_NBPROCESSORS_INCLUDE_OFFLINE 1 /* by default we try to get only the online CPUs */
extern int hwloc_fallback_nbprocessors(unsigned flags);
/* returns the memory size from the OS (only valid if thissystem) */
extern int64_t hwloc_fallback_memsize(void);
extern int hwloc__object_cpusets_compare_first(hwloc_obj_t obj1, hwloc_obj_t obj2);
extern void hwloc__reorder_children(hwloc_obj_t parent);

View file

@ -505,14 +505,16 @@ int hwloc_bitmap_list_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_re
if (begin != -1) {
/* finishing a range */
hwloc_bitmap_set_range(set, begin, val);
if (hwloc_bitmap_set_range(set, begin, val) < 0)
goto failed;
begin = -1;
} else if (*next == '-') {
/* starting a new range */
if (*(next+1) == '\0') {
/* infinite range */
hwloc_bitmap_set_range(set, val, -1);
if (hwloc_bitmap_set_range(set, val, -1) < 0)
goto failed;
break;
} else {
/* normal range */

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2012 Université Bordeaux
* See COPYING in top-level directory.
*/
@ -63,14 +63,128 @@ static pthread_mutex_t hwloc_components_mutex = PTHREAD_MUTEX_INITIALIZER;
#ifdef HWLOC_HAVE_PLUGINS
#ifdef HWLOC_HAVE_LTDL
/* ltdl-based plugin load */
#include <ltdl.h>
typedef lt_dlhandle hwloc_dlhandle;
#define hwloc_dlinit lt_dlinit
#define hwloc_dlexit lt_dlexit
#define hwloc_dlopenext lt_dlopenext
#define hwloc_dlclose lt_dlclose
#define hwloc_dlerror lt_dlerror
#define hwloc_dlsym lt_dlsym
#define hwloc_dlforeachfile lt_dlforeachfile
#else /* !HWLOC_HAVE_LTDL */
/* no-ltdl plugin load relies on less portable libdl */
#include <dlfcn.h>
typedef void * hwloc_dlhandle;
static __hwloc_inline int hwloc_dlinit(void) { return 0; }
static __hwloc_inline int hwloc_dlexit(void) { return 0; }
#define hwloc_dlclose dlclose
#define hwloc_dlerror dlerror
#define hwloc_dlsym dlsym
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
static hwloc_dlhandle hwloc_dlopenext(const char *_filename)
{
hwloc_dlhandle handle;
char *filename = NULL;
(void) asprintf(&filename, "%s.so", _filename);
if (!filename)
return NULL;
handle = dlopen(filename, RTLD_NOW|RTLD_LOCAL);
free(filename);
return handle;
}
static int
hwloc_dlforeachfile(const char *_paths,
int (*func)(const char *filename, void *data),
void *data)
{
char *paths = NULL, *path;
paths = strdup(_paths);
if (!paths)
return -1;
path = paths;
while (*path) {
char *colon;
DIR *dir;
struct dirent *dirent;
colon = strchr(path, ':');
if (colon)
*colon = '\0';
if (hwloc_plugins_verbose)
fprintf(stderr, " Looking under %s\n", path);
dir = opendir(path);
if (!dir)
goto next;
while ((dirent = readdir(dir)) != NULL) {
char *abs_name, *suffix;
struct stat stbuf;
int err;
err = asprintf(&abs_name, "%s/%s", path, dirent->d_name);
if (err < 0)
continue;
err = stat(abs_name, &stbuf);
if (err < 0) {
free(abs_name);
continue;
}
if (!S_ISREG(stbuf.st_mode)) {
free(abs_name);
continue;
}
/* Only keep .so files, and remove that suffix to get the component basename */
suffix = strrchr(abs_name, '.');
if (!suffix || strcmp(suffix, ".so")) {
free(abs_name);
continue;
}
*suffix = '\0';
err = func(abs_name, data);
if (err) {
free(abs_name);
continue;
}
free(abs_name);
}
closedir(dir);
next:
if (!colon)
break;
path = colon+1;
}
free(paths);
return 0;
}
#endif /* !HWLOC_HAVE_LTDL */
/* array of pointers to dynamically loaded plugins */
static struct hwloc__plugin_desc {
char *name;
struct hwloc_component *component;
char *filename;
lt_dlhandle handle;
hwloc_dlhandle handle;
struct hwloc__plugin_desc *next;
} *hwloc_plugins = NULL;
@ -78,9 +192,10 @@ static int
hwloc__dlforeach_cb(const char *filename, void *_data __hwloc_attribute_unused)
{
const char *basename;
lt_dlhandle handle;
hwloc_dlhandle handle;
struct hwloc_component *component;
struct hwloc__plugin_desc *desc, **prevdesc;
char *componentsymbolname;
if (hwloc_plugins_verbose)
fprintf(stderr, "Plugin dlforeach found `%s'\n", filename);
@ -98,33 +213,40 @@ hwloc__dlforeach_cb(const char *filename, void *_data __hwloc_attribute_unused)
}
/* dlopen and get the component structure */
handle = lt_dlopenext(filename);
handle = hwloc_dlopenext(filename);
if (!handle) {
if (hwloc_plugins_verbose)
fprintf(stderr, "Failed to load plugin: %s\n", lt_dlerror());
fprintf(stderr, "Failed to load plugin: %s\n", hwloc_dlerror());
goto out;
}
{
char componentsymbolname[strlen(basename)+10+1];
componentsymbolname = malloc(strlen(basename)+10+1);
if (!componentsymbolname) {
if (hwloc_plugins_verbose)
fprintf(stderr, "Failed to allocation component `%s' symbol\n",
basename);
goto out_with_handle;
}
sprintf(componentsymbolname, "%s_component", basename);
component = lt_dlsym(handle, componentsymbolname);
component = hwloc_dlsym(handle, componentsymbolname);
if (!component) {
if (hwloc_plugins_verbose)
fprintf(stderr, "Failed to find component symbol `%s'\n",
componentsymbolname);
free(componentsymbolname);
goto out_with_handle;
}
if (component->abi != HWLOC_COMPONENT_ABI) {
if (hwloc_plugins_verbose)
fprintf(stderr, "Plugin symbol ABI %u instead of %d\n",
component->abi, HWLOC_COMPONENT_ABI);
free(componentsymbolname);
goto out_with_handle;
}
if (hwloc_plugins_verbose)
fprintf(stderr, "Plugin contains expected symbol `%s'\n",
componentsymbolname);
}
free(componentsymbolname);
if (HWLOC_COMPONENT_TYPE_DISC == component->type) {
if (strncmp(basename, "hwloc_", 6)) {
@ -167,7 +289,7 @@ hwloc__dlforeach_cb(const char *filename, void *_data __hwloc_attribute_unused)
return 0;
out_with_handle:
lt_dlclose(handle);
hwloc_dlclose(handle);
out:
return 0;
}
@ -183,7 +305,7 @@ hwloc_plugins_exit(void)
desc = hwloc_plugins;
while (desc) {
next = desc->next;
lt_dlclose(desc->handle);
hwloc_dlclose(desc->handle);
free(desc->name);
free(desc->filename);
free(desc);
@ -191,7 +313,7 @@ hwloc_plugins_exit(void)
}
hwloc_plugins = NULL;
lt_dlexit();
hwloc_dlexit();
}
static int
@ -207,7 +329,7 @@ hwloc_plugins_init(void)
hwloc_plugins_blacklist = getenv("HWLOC_PLUGINS_BLACKLIST");
err = lt_dlinit();
err = hwloc_dlinit();
if (err)
goto out;
@ -219,7 +341,7 @@ hwloc_plugins_init(void)
if (hwloc_plugins_verbose)
fprintf(stderr, "Starting plugin dlforeach in %s\n", path);
err = lt_dlforeachfile(path, hwloc__dlforeach_cb, NULL);
err = hwloc_dlforeachfile(path, hwloc__dlforeach_cb, NULL);
if (err)
goto out_with_init;
@ -680,7 +802,8 @@ hwloc_disc_components_enable_others(struct hwloc_topology *topology)
while (*curenv) {
s = strcspn(curenv, HWLOC_COMPONENT_SEPS);
if (s) {
char c, *name;
char c;
const char *name;
if (!strncmp(curenv, HWLOC_COMPONENT_STOP_NAME, s)) {
tryall = 0;

View file

@ -323,6 +323,8 @@ hwloc_internal_distances__add(hwloc_topology_t topology, const char *name,
return 0;
err_with_dist:
if (name)
free(dist->name);
free(dist);
err:
free(different_types);

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2020 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@ -366,7 +366,7 @@ hwloc_pcidisc_add_hostbridges(struct hwloc_topology *topology,
struct hwloc_obj **dstnextp;
struct hwloc_obj **srcnextp;
struct hwloc_obj *child;
unsigned short current_domain;
unsigned current_domain;
unsigned char current_bus;
unsigned char current_subordinate;

View file

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -20,22 +20,27 @@ hwloc_look_noos(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus
*/
struct hwloc_topology *topology = backend->topology;
int nbprocs;
int64_t memsize;
assert(dstatus->phase == HWLOC_DISC_PHASE_CPU);
if (topology->levels[0][0]->cpuset)
/* somebody discovered things */
return -1;
if (!topology->levels[0][0]->cpuset) {
int nbprocs;
/* Nobody (even the x86 backend) created objects yet, setup basic objects */
nbprocs = hwloc_fallback_nbprocessors(0);
if (nbprocs >= 1)
topology->support.discovery->pu = 1;
else
nbprocs = 1;
hwloc_alloc_root_sets(topology->levels[0][0]);
hwloc_setup_pu_level(topology, nbprocs);
}
memsize = hwloc_fallback_memsize();
if (memsize > 0)
topology->machine_memory.local_memory = memsize;;
hwloc_add_uname_info(topology, NULL);
return 0;
}

View file

@ -1503,6 +1503,7 @@ hwloc_topology_export_synthetic(struct hwloc_topology * topology,
signed pdepth;
node = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, 0);
assert(node);
assert(hwloc__obj_type_is_normal(node->parent->type)); /* only depth-1 memory children for now */
pdepth = node->parent->depth;

View file

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -232,6 +232,10 @@ static void hwloc_win_get_function_ptrs(void)
{
HMODULE kernel32;
#if HWLOC_HAVE_GCC_W_CAST_FUNCTION_TYPE
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
kernel32 = LoadLibrary("kernel32.dll");
if (kernel32) {
GetActiveProcessorGroupCountProc =
@ -270,6 +274,10 @@ static void hwloc_win_get_function_ptrs(void)
if (psapi)
QueryWorkingSetExProc = (PFN_QUERYWORKINGSETEX) GetProcAddress(psapi, "QueryWorkingSetEx");
}
#if HWLOC_HAVE_GCC_W_CAST_FUNCTION_TYPE
#pragma GCC diagnostic warning "-Wcast-function-type"
#endif
}
/*
@ -1199,3 +1207,9 @@ hwloc_fallback_nbprocessors(unsigned flags __hwloc_attribute_unused) {
return n;
}
int64_t
hwloc_fallback_memsize(void) {
/* Unused */
return -1;
}

View file

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -34,7 +34,7 @@ struct hwloc__nolibxml_backend_data_s {
typedef struct hwloc__nolibxml_import_state_data_s {
char *tagbuffer; /* buffer containing the next tag */
char *attrbuffer; /* buffer containing the next attribute of the current node */
char *tagname; /* tag name of the current node */
const char *tagname; /* tag name of the current node */
int closed; /* set if the current node is auto-closing */
} __hwloc_attribute_may_alias * hwloc__nolibxml_import_state_data_t;
@ -137,7 +137,7 @@ hwloc__nolibxml_import_find_child(hwloc__xml_import_state_t state,
return 0;
/* normal tag */
tag = nchildstate->tagname = buffer;
nchildstate->tagname = tag = buffer;
/* find the end, mark it and return it */
end = strchr(buffer, '>');
@ -260,7 +260,7 @@ hwloc_nolibxml_look_init(struct hwloc_xml_backend_data_s *bdata,
unsigned major, minor;
char *end;
char *buffer = nbdata->buffer;
char *tagname;
const char *tagname;
HWLOC_BUILD_ASSERT(sizeof(*nstate) <= sizeof(state->data));

View file

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2011 Université Bordeaux
* Copyright © 2009-2018 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@ -107,7 +107,8 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
struct hwloc_xml_backend_data_s *data,
struct hwloc_obj *obj,
const char *name, const char *value,
hwloc__xml_import_state_t state)
hwloc__xml_import_state_t state,
int *ignore)
{
if (!strcmp(name, "type")) {
/* already handled */
@ -252,11 +253,20 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
case HWLOC_OBJ_PCI_DEVICE:
case HWLOC_OBJ_BRIDGE: {
unsigned domain, bus, dev, func;
if (sscanf(value, "%04x:%02x:%02x.%01x",
if (sscanf(value, "%x:%02x:%02x.%01x",
&domain, &bus, &dev, &func) != 4) {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid pci_busid format string %s\n",
state->global->msgprefix, value);
*ignore = 1;
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
} else if (domain > 0xffff) {
static int warned = 0;
if (!warned && !hwloc_hide_errors())
fprintf(stderr, "Ignoring PCI device with non-16bit domain.\nPass --enable-32bits-pci-domain to configure to support such devices\n(warning: it would break the library ABI, don't enable unless really needed).\n");
warned = 1;
*ignore = 1;
#endif
} else {
obj->attr->pcidev.domain = domain;
obj->attr->pcidev.bus = bus;
@ -278,7 +288,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
case HWLOC_OBJ_PCI_DEVICE:
case HWLOC_OBJ_BRIDGE: {
unsigned classid, vendor, device, subvendor, subdevice, revision;
if (sscanf(value, "%04x [%04x:%04x] [%04x:%04x] %02x",
if (sscanf(value, "%x [%04x:%04x] [%04x:%04x] %02x",
&classid, &vendor, &device, &subvendor, &subdevice, &revision) != 6) {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid pci_type format string %s\n",
@ -342,11 +352,20 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
switch (obj->type) {
case HWLOC_OBJ_BRIDGE: {
unsigned domain, secbus, subbus;
if (sscanf(value, "%04x:[%02x-%02x]",
if (sscanf(value, "%x:[%02x-%02x]",
&domain, &secbus, &subbus) != 3) {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid bridge_pci format string %s\n",
state->global->msgprefix, value);
*ignore = 1;
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
} else if (domain > 0xffff) {
static int warned = 0;
if (!warned && !hwloc_hide_errors())
fprintf(stderr, "Ignoring bridge to PCI with non-16bit domain.\nPass --enable-32bits-pci-domain to configure to support such devices\n(warning: it would break the library ABI, don't enable unless really needed).\n");
warned = 1;
*ignore = 1;
#endif
} else {
obj->attr->bridge.downstream.pci.domain = domain;
obj->attr->bridge.downstream.pci.secondary_bus = secbus;
@ -426,6 +445,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
memory->page_types = malloc(sizeof(*memory->page_types));
memory->page_types_len = 1;
}
assert(memory->page_types);
memory->page_types[0].size = lvalue << 10;
} else if (hwloc__xml_verbose()) {
fprintf(stderr, "%s: ignoring huge_page_size_kB attribute for non-NUMAnode non-root object\n",
@ -440,6 +460,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
memory->page_types = malloc(sizeof(*memory->page_types));
memory->page_types_len = 1;
}
assert(memory->page_types);
memory->page_types[0].count = lvalue;
} else if (hwloc__xml_verbose()) {
fprintf(stderr, "%s: ignoring huge_page_free attribute for non-NUMAnode non-root object\n",
@ -835,7 +856,7 @@ hwloc__xml_import_object(hwloc_topology_t topology,
state->global->msgprefix, attrname);
goto error_with_object;
}
hwloc__xml_import_object_attr(topology, data, obj, attrname, attrvalue, state);
hwloc__xml_import_object_attr(topology, data, obj, attrname, attrvalue, state, &ignored);
}
}
@ -1140,15 +1161,23 @@ hwloc__xml_import_object(hwloc_topology_t topology,
ret = -1;
}
if (ret < 0)
if (ret < 0) {
if (parent && !ignored)
goto error;
else
goto error_with_object;
}
state->global->close_child(&childstate);
tag = NULL;
ret = state->global->find_child(state, &childstate, &tag);
if (ret < 0)
if (ret < 0) {
if (parent && !ignored)
goto error;
else
goto error_with_object;
}
if (!ret)
break;
}
@ -1548,7 +1577,7 @@ hwloc__xml_import_diff_one(hwloc__xml_import_state_t state,
memset(&diff->obj_attr.diff, 0, sizeof(diff->obj_attr.diff));
diff->obj_attr.diff.generic.type = obj_attr_type;
switch (atoi(obj_attr_type_s)) {
switch (obj_attr_type) {
case HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_SIZE:
diff->obj_attr.diff.uint64.oldvalue = strtoull(obj_attr_oldvalue_s, NULL, 0);
diff->obj_attr.diff.uint64.newvalue = strtoull(obj_attr_newvalue_s, NULL, 0);
@ -1732,7 +1761,7 @@ hwloc_look_xml(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
goto failed;
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring unknown tag `%s' after root object, expected `distances2'\n",
fprintf(stderr, "%s: ignoring unknown tag `%s' after root object.\n",
data->msgprefix, tag);
goto done;
}
@ -1778,6 +1807,8 @@ done:
if (nbobjs == data->nbnumanodes) {
hwloc_obj_t *objs = malloc(nbobjs*sizeof(hwloc_obj_t));
uint64_t *values = malloc(nbobjs*nbobjs*sizeof(*values));
assert(data->nbnumanodes > 0); /* v1dist->nbobjs is >0 after import */
assert(data->first_numanode);
if (objs && values) {
hwloc_obj_t node;
unsigned i;
@ -2051,13 +2082,17 @@ hwloc__xml_export_object_contents (hwloc__xml_export_state_t state, hwloc_topolo
state->new_prop(state, "online_cpuset", setstring);
free(setstring);
if (v1export || !obj->parent) {
if (v1export) {
hwloc_bitmap_t allowed_cpuset = hwloc_bitmap_dup(obj->cpuset);
hwloc_bitmap_and(allowed_cpuset, allowed_cpuset, topology->allowed_cpuset);
hwloc_bitmap_asprintf(&setstring, allowed_cpuset);
state->new_prop(state, "allowed_cpuset", setstring);
free(setstring);
hwloc_bitmap_free(allowed_cpuset);
} else if (!obj->parent) {
hwloc_bitmap_asprintf(&setstring, topology->allowed_cpuset);
state->new_prop(state, "allowed_cpuset", setstring);
free(setstring);
}
}
@ -2072,13 +2107,17 @@ hwloc__xml_export_object_contents (hwloc__xml_export_state_t state, hwloc_topolo
state->new_prop(state, "complete_nodeset", setstring);
free(setstring);
if (v1export || !obj->parent) {
if (v1export) {
hwloc_bitmap_t allowed_nodeset = hwloc_bitmap_dup(obj->nodeset);
hwloc_bitmap_and(allowed_nodeset, allowed_nodeset, topology->allowed_nodeset);
hwloc_bitmap_asprintf(&setstring, allowed_nodeset);
state->new_prop(state, "allowed_nodeset", setstring);
free(setstring);
hwloc_bitmap_free(allowed_nodeset);
} else if (!obj->parent) {
hwloc_bitmap_asprintf(&setstring, topology->allowed_nodeset);
state->new_prop(state, "allowed_nodeset", setstring);
free(setstring);
}
}
@ -2921,6 +2960,7 @@ hwloc_export_obj_userdata(void *reserved,
int encoded;
size_t encoded_length;
const char *realname;
assert(name);
if (!strncmp(name, "base64", 6)) {
encoded = 1;
encoded_length = BASE64_ENCODED_LENGTH(length);

View file

@ -1,7 +1,7 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2019 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -33,6 +33,9 @@
#ifdef HAVE_MACH_MACH_INIT_H
#include <mach/mach_init.h>
#endif
#ifdef HAVE_MACH_INIT_H
#include <mach_init.h>
#endif
#ifdef HAVE_MACH_MACH_HOST_H
#include <mach/mach_host.h>
#endif
@ -123,15 +126,25 @@ int hwloc_get_sysctlbyname(const char *name, int64_t *ret)
#endif
#if defined(HAVE_SYSCTL)
int hwloc_get_sysctl(int name[], unsigned namelen, int *ret)
int hwloc_get_sysctl(int name[], unsigned namelen, int64_t *ret)
{
int n;
union {
int32_t i32;
int64_t i64;
} n;
size_t size = sizeof(n);
if (sysctl(name, namelen, &n, &size, NULL, 0))
return -1;
if (size != sizeof(n))
switch (size) {
case sizeof(n.i32):
*ret = n.i32;
break;
case sizeof(n.i64):
*ret = n.i64;
break;
default:
return -1;
*ret = n;
}
return 0;
}
#endif
@ -178,8 +191,10 @@ hwloc_fallback_nbprocessors(unsigned flags) {
n = nn;
#elif defined(HAVE_SYSCTL) && HAVE_DECL_CTL_HW && HAVE_DECL_HW_NCPU
static int name[2] = {CTL_HW, HW_NCPU};
if (hwloc_get_sysctl(name, sizeof(name)/sizeof(*name), &n))
int64_t nn;
if (hwloc_get_sysctl(name, sizeof(name)/sizeof(*name), &nn))
n = -1;
n = nn;
#else
#ifdef __GNUC__
#warning No known way to discover number of available processors on this system
@ -188,6 +203,46 @@ hwloc_fallback_nbprocessors(unsigned flags) {
#endif
return n;
}
int64_t
hwloc_fallback_memsize(void) {
int64_t size;
#if defined(HAVE_HOST_INFO) && HAVE_HOST_INFO
struct host_basic_info info;
mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
host_info(mach_host_self(), HOST_BASIC_INFO, (integer_t*) &info, &count);
size = info.memory_size;
#elif defined(HAVE_SYSCTL) && HAVE_DECL_CTL_HW && (HAVE_DECL_HW_REALMEM64 || HAVE_DECL_HW_MEMSIZE64 || HAVE_DECL_HW_PHYSMEM64 || HAVE_DECL_HW_USERMEM64 || HAVE_DECL_HW_REALMEM || HAVE_DECL_HW_MEMSIZE || HAVE_DECL_HW_PHYSMEM || HAVE_DECL_HW_USERMEM)
#if HAVE_DECL_HW_MEMSIZE64
static int name[2] = {CTL_HW, HW_MEMSIZE64};
#elif HAVE_DECL_HW_REALMEM64
static int name[2] = {CTL_HW, HW_REALMEM64};
#elif HAVE_DECL_HW_PHYSMEM64
static int name[2] = {CTL_HW, HW_PHYSMEM64};
#elif HAVE_DECL_HW_USERMEM64
static int name[2] = {CTL_HW, HW_USERMEM64};
#elif HAVE_DECL_HW_MEMSIZE
static int name[2] = {CTL_HW, HW_MEMSIZE};
#elif HAVE_DECL_HW_REALMEM
static int name[2] = {CTL_HW, HW_REALMEM};
#elif HAVE_DECL_HW_PHYSMEM
static int name[2] = {CTL_HW, HW_PHYSMEM};
#elif HAVE_DECL_HW_USERMEM
static int name[2] = {CTL_HW, HW_USERMEM};
#endif
if (hwloc_get_sysctl(name, sizeof(name)/sizeof(*name), &size))
size = -1;
#elif defined(HAVE_SYSCTLBYNAME)
if (hwloc_get_sysctlbyname("hw.memsize", &size) &&
hwloc_get_sysctlbyname("hw.realmem", &size) &&
hwloc_get_sysctlbyname("hw.physmem", &size) &&
hwloc_get_sysctlbyname("hw.usermem", &size))
size = -1;
#else
size = -1;
#endif
return size;
}
#endif /* !HWLOC_WIN_SYS */
/*
@ -2043,6 +2098,7 @@ propagate_total_memory(hwloc_obj_t obj)
if (obj->type == HWLOC_OBJ_NUMANODE) {
obj->total_memory += obj->attr->numanode.local_memory;
if (obj->attr->numanode.page_types_len) {
/* By the way, sort the page_type array.
* Cannot do it on insert since some backends (e.g. XML) add page_types after inserting the object.
*/
@ -2054,6 +2110,7 @@ propagate_total_memory(hwloc_obj_t obj)
obj->attr->numanode.page_types_len = i;
}
}
}
/* Now that root sets are ready, propagate them to children
* by allocating missing sets and restricting existing ones.
@ -2966,6 +3023,7 @@ hwloc_connect_levels(hwloc_topology_t topology)
if (hwloc_type_cmp(top_obj, objs[i]) == HWLOC_OBJ_EQUAL) {
/* Take it, add main children. */
taken_objs[n_taken_objs++] = objs[i];
if (objs[i]->arity)
memcpy(&new_objs[n_new_objs], objs[i]->children, objs[i]->arity * sizeof(new_objs[0]));
n_new_objs += objs[i]->arity;
} else {
@ -4113,6 +4171,7 @@ hwloc_topology_restrict(struct hwloc_topology *topology, hwloc_const_bitmap_t se
/* cpuset to clear */
if (flags & HWLOC_RESTRICT_FLAG_REMOVE_MEMLESS) {
hwloc_obj_t pu = hwloc_get_obj_by_type(topology, HWLOC_OBJ_PU, 0);
assert(pu);
do {
/* PU will be removed if cpuset gets or was empty */
if (hwloc_bitmap_iszero(pu->cpuset)
@ -4148,6 +4207,7 @@ hwloc_topology_restrict(struct hwloc_topology *topology, hwloc_const_bitmap_t se
/* nodeset to clear */
if (flags & HWLOC_RESTRICT_FLAG_REMOVE_CPULESS) {
hwloc_obj_t node = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, 0);
assert(node);
do {
/* node will be removed if nodeset gets or was empty */
if (hwloc_bitmap_iszero(node->cpuset)
@ -4242,6 +4302,9 @@ hwloc_topology_allow(struct hwloc_topology *topology,
goto error;
}
topology->binding_hooks.get_allowed_resources(topology);
/* make sure the backend returned something sane (Linux cpusets may return offline PUs in some cases) */
hwloc_bitmap_and(topology->allowed_cpuset, topology->allowed_cpuset, hwloc_get_root_obj(topology)->cpuset);
hwloc_bitmap_and(topology->allowed_nodeset, topology->allowed_nodeset, hwloc_get_root_obj(topology)->nodeset);
break;
}
case HWLOC_ALLOW_FLAG_CUSTOM: {

View file

@ -32,7 +32,7 @@
#include "backend/cpu/Cpu.h"
#include "base/io/Console.h"
#include "base/io/log/Log.h"
#include "base/kernel/Signals.h"
#include "base/io/Signals.h"
#include "base/kernel/Platform.h"
#include "core/config/Config.h"
#include "core/Controller.h"

View file

@ -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,10 +30,10 @@
#include "backend/common/Hashrate.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include "base/tools/Chrono.h"
#include "base/tools/Handle.h"
#include "rapidjson/document.h"
inline static const char *format(double h, char *buf, size_t size)

View file

@ -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,8 +30,8 @@
#include <cstdint>
#include "3rdparty/rapidjson/fwd.h"
#include "base/tools/Object.h"
#include "rapidjson/fwd.h"
namespace xmrig {

View file

@ -24,9 +24,9 @@
#include "backend/common/Threads.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/cpu/CpuThreads.h"
#include "crypto/cn/CnAlgo.h"
#include "rapidjson/document.h"
#ifdef XMRIG_FEATURE_OPENCL

View file

@ -30,9 +30,9 @@
#include <set>
#include "3rdparty/rapidjson/fwd.h"
#include "base/crypto/Algorithm.h"
#include "base/tools/String.h"
#include "rapidjson/fwd.h"
namespace xmrig {

View file

@ -4,7 +4,6 @@ set(HEADERS_BACKEND_COMMON
src/backend/common/interfaces/IBackend.h
src/backend/common/interfaces/IRxListener.h
src/backend/common/interfaces/IRxStorage.h
src/backend/common/interfaces/IThread.h
src/backend/common/interfaces/IWorker.h
src/backend/common/misc/PciTopology.h
src/backend/common/Thread.h

View file

@ -29,7 +29,7 @@
#include <cstdint>
#include "rapidjson/fwd.h"
#include "3rdparty/rapidjson/fwd.h"
namespace xmrig {

View file

@ -1,77 +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 2016-2018 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_ITHREAD_H
#define XMRIG_ITHREAD_H
#include <stdint.h>
#include "crypto/common/Algorithm.h"
#include "rapidjson/fwd.h"
namespace xmrig {
class IThread
{
public:
enum Type {
CPU,
OpenCL,
CUDA
};
enum Multiway {
SingleWay = 1,
DoubleWay,
TripleWay,
QuadWay,
PentaWay
};
virtual ~IThread() = default;
virtual Algorithm algorithm() const = 0;
virtual int priority() const = 0;
virtual int64_t affinity() const = 0;
virtual Multiway multiway() const = 0;
virtual rapidjson::Value toConfig(rapidjson::Document &doc) const = 0;
virtual size_t index() const = 0;
virtual Type type() const = 0;
# ifdef XMRIG_FEATURE_API
virtual rapidjson::Value toAPI(rapidjson::Document &doc) const = 0;
# endif
# ifdef APP_DEBUG
virtual void print() const = 0;
# endif
};
} /* namespace xmrig */
#endif // XMRIG_ITHREAD_H

View file

@ -27,7 +27,7 @@
#include "backend/cpu/Cpu.h"
#include "rapidjson/document.h"
#include "3rdparty/rapidjson/document.h"
#if defined(XMRIG_FEATURE_HWLOC)
@ -60,32 +60,7 @@ xmrig::ICpuInfo *xmrig::Cpu::info()
rapidjson::Value xmrig::Cpu::toJSON(rapidjson::Document &doc)
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();
ICpuInfo *i = info();
Value cpu(kObjectType);
Assembly assembly(i->assembly());
cpu.AddMember("brand", StringRef(i->brand()), allocator);
cpu.AddMember("aes", i->hasAES(), allocator);
cpu.AddMember("avx2", i->hasAVX2(), allocator);
cpu.AddMember("x64", ICpuInfo::isX64(), allocator);
cpu.AddMember("l2", static_cast<uint64_t>(i->L2()), allocator);
cpu.AddMember("l3", static_cast<uint64_t>(i->L3()), allocator);
cpu.AddMember("cores", static_cast<uint64_t>(i->cores()), allocator);
cpu.AddMember("threads", static_cast<uint64_t>(i->threads()), allocator);
cpu.AddMember("packages", static_cast<uint64_t>(i->packages()), allocator);
cpu.AddMember("nodes", static_cast<uint64_t>(i->nodes()), allocator);
cpu.AddMember("backend", StringRef(i->backend()), allocator);
# ifdef XMRIG_FEATURE_ASM
cpu.AddMember("assembly", StringRef(assembly.toString()), allocator);
# else
cpu.AddMember("assembly", "none", allocator);
# endif
return cpu;
return info()->toJSON(doc);
}

View file

@ -26,12 +26,13 @@
#include <mutex>
#include "backend/cpu/CpuBackend.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/common/Hashrate.h"
#include "backend/common/interfaces/IWorker.h"
#include "backend/common/Tags.h"
#include "backend/common/Workers.h"
#include "backend/cpu/Cpu.h"
#include "backend/cpu/CpuBackend.h"
#include "base/io/log/Log.h"
#include "base/net/stratum/Job.h"
#include "base/tools/Chrono.h"
@ -41,7 +42,6 @@
#include "crypto/common/VirtualMemory.h"
#include "crypto/rx/Rx.h"
#include "crypto/rx/RxDataset.h"
#include "rapidjson/document.h"
#ifdef XMRIG_FEATURE_API
@ -275,13 +275,16 @@ const xmrig::String &xmrig::CpuBackend::type() const
void xmrig::CpuBackend::prepare(const Job &nextJob)
{
# ifdef XMRIG_ALGO_ARGON2
if (nextJob.algorithm().family() == Algorithm::ARGON2 && argon2::Impl::select(d_ptr->controller->config()->cpu().argon2Impl())) {
const xmrig::Algorithm::Family f = nextJob.algorithm().family();
if ((f == Algorithm::ARGON2) || (f == Algorithm::RANDOM_X)) {
if (argon2::Impl::select(d_ptr->controller->config()->cpu().argon2Impl())) {
LOG_INFO("%s use " WHITE_BOLD("argon2") " implementation " CSI "1;%dm" "%s",
tag,
argon2::Impl::name() == "default" ? 33 : 32,
argon2::Impl::name().data()
);
}
}
# endif
}

View file

@ -24,10 +24,10 @@
#include "backend/cpu/CpuConfig.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/cpu/CpuConfig_gen.h"
#include "backend/cpu/Cpu.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
#include <algorithm>

View file

@ -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
@ -24,8 +24,8 @@
#include "backend/cpu/CpuThread.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
xmrig::CpuThread::CpuThread(const rapidjson::Value &value)

View file

@ -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
@ -26,7 +26,7 @@
#define XMRIG_CPUTHREAD_H
#include "rapidjson/fwd.h"
#include "3rdparty/rapidjson/fwd.h"
namespace xmrig {

View file

@ -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
@ -27,8 +27,8 @@
#include "backend/cpu/CpuThreads.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
namespace xmrig {

View file

@ -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

View file

@ -70,11 +70,8 @@ else()
)
endif()
if (NOT WITH_LIBCPUID)
if (XMRIG_ARM)
set(SOURCES_CPUID ${SOURCES_CPUID} src/backend/cpu/platform/BasicCpuInfo_arm.cpp)
list(APPEND SOURCES_CPUID src/backend/cpu/platform/BasicCpuInfo_arm.cpp)
else()
set(SOURCES_CPUID ${SOURCES_CPUID} src/backend/cpu/platform/BasicCpuInfo.cpp)
endif()
list(APPEND SOURCES_CPUID src/backend/cpu/platform/BasicCpuInfo.cpp)
endif()

View file

@ -51,6 +51,19 @@ public:
MSR_MOD_MAX
};
enum Flag : uint32_t {
FLAG_AES,
FLAG_AVX2,
FLAG_AVX512F,
FLAG_BMI2,
FLAG_OSXSAVE,
FLAG_PDPE1GB,
FLAG_SSE2,
FLAG_SSSE3,
FLAG_XOP,
FLAG_MAX
};
virtual ~ICpuInfo() = default;
# if defined(__x86_64__) || defined(_M_AMD64) || defined (__arm64__) || defined (__aarch64__)
@ -60,6 +73,7 @@ public:
# endif
virtual Assembly::Id assembly() const = 0;
virtual bool has(Flag feature) const = 0;
virtual bool hasAES() const = 0;
virtual bool hasAVX2() const = 0;
virtual bool hasBMI2() const = 0;
@ -68,6 +82,7 @@ public:
virtual const char *brand() const = 0;
virtual CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const = 0;
virtual MsrMod msrMod() const = 0;
virtual rapidjson::Value toJSON(rapidjson::Document &doc) const = 0;
virtual size_t cores() const = 0;
virtual size_t L2() const = 0;
virtual size_t L3() const = 0;

View file

@ -26,13 +26,6 @@
#include "3rdparty/libcpuid/libcpuid.h"
#ifdef _MSC_VER
# include <intrin.h>
#else
# include <cpuid.h>
#endif
#include <algorithm>
#include <cassert>
#include <cmath>
@ -40,59 +33,7 @@
#include <cstring>
namespace xmrig {
static inline void cpu_brand_string(char out[64], const char *in) {
size_t pos = 0;
const size_t size = strlen(in);
for (size_t i = 0; i < size; ++i) {
if (in[i] == ' ' && ((pos > 0 && out[pos - 1] == ' ') || pos == 0)) {
continue;
}
out[pos++] = in[i];
}
if (pos > 0 && out[pos - 1] == ' ') {
out[pos - 1] = '\0';
}
}
static inline void cpuid(uint32_t level, int32_t output[4])
{
memset(output, 0, sizeof(int32_t) * 4);
# ifdef _MSC_VER
__cpuid(output, static_cast<int>(level));
# else
__cpuid_count(level, 0, output[0], output[1], output[2], output[3]);
# endif
}
static inline bool has_feature(uint32_t level, uint32_t reg, int32_t bit)
{
int32_t cpu_info[4] = { 0 };
cpuid(level, cpu_info);
return (cpu_info[reg] & bit) != 0;
}
static inline bool has_pdpe1gb()
{
return has_feature(0x80000001, 3, 1 << 26);
}
} // namespace xmrig
xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
m_pdpe1gb(has_pdpe1gb())
xmrig::AdvancedCpuInfo::AdvancedCpuInfo()
{
struct cpu_raw_data_t raw = {};
struct cpu_id_t data = {};
@ -100,18 +41,10 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
cpuid_get_raw_data(&raw);
cpu_identify(&raw, &data);
cpu_brand_string(m_brand, data.brand_str);
snprintf(m_backend, sizeof m_backend, "libcpuid/%s", cpuid_lib_version());
if (data.vendor == ::VENDOR_INTEL) {
m_vendor = VENDOR_INTEL;
}
else if (data.vendor == ::VENDOR_AMD) {
m_vendor = VENDOR_AMD;
}
m_threads = static_cast<size_t>(data.total_logical_cpus);
m_packages = std::max<size_t>(threads() / static_cast<size_t>(data.num_logical_cpus), 1);
m_packages = std::max<size_t>(m_threads / static_cast<size_t>(data.num_logical_cpus), 1);
m_cores = static_cast<size_t>(data.num_cores) * m_packages;
m_L3 = data.l3_cache > 0 ? static_cast<size_t>(data.l3_cache) * m_packages : 0;
@ -134,26 +67,6 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
m_L2 *= 1024;
m_L3 *= 1024;
if (data.flags[CPU_FEATURE_AES]) {
m_aes = true;
if (m_vendor == VENDOR_AMD) {
if (data.ext_family >= 23) {
m_assembly = Assembly::RYZEN;
m_msrMod = MSR_MOD_RYZEN;
}
else {
m_assembly = Assembly::BULLDOZER;
}
}
else if (m_vendor == VENDOR_INTEL) {
m_assembly = Assembly::INTEL;
}
}
m_avx2 = data.flags[CPU_FEATURE_AVX2] && data.flags[CPU_FEATURE_OSXSAVE];
m_bmi2 = data.flags[CPU_FEATURE_BMI2];
}

View file

@ -26,13 +26,13 @@
#define XMRIG_ADVANCEDCPUINFO_H
#include "backend/cpu/interfaces/ICpuInfo.h"
#include "backend/cpu/platform/BasicCpuInfo.h"
namespace xmrig {
class AdvancedCpuInfo : public ICpuInfo
class AdvancedCpuInfo : public BasicCpuInfo
{
public:
AdvancedCpuInfo();
@ -40,38 +40,20 @@ public:
protected:
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
inline Assembly::Id assembly() const override { return m_assembly; }
inline bool hasAES() const override { return m_aes; }
inline bool hasAVX2() const override { return m_avx2; }
inline bool hasBMI2() const override { return m_bmi2; }
inline bool hasOneGbPages() const override { return m_pdpe1gb; }
inline const char *backend() const override { return m_backend; }
inline const char *brand() const override { return m_brand; }
inline MsrMod msrMod() const override { return m_msrMod; }
inline size_t cores() const override { return m_cores; }
inline size_t L2() const override { return m_L2; }
inline size_t L3() const override { return m_L3; }
inline size_t nodes() const override { return 0; }
inline size_t packages() const override { return m_packages; }
inline size_t threads() const override { return m_threads; }
inline Vendor vendor() const override { return m_vendor; }
private:
Assembly m_assembly;
bool m_aes = false;
bool m_avx2 = false;
bool m_bmi2 = false;
bool m_L2_exclusive = false;
char m_backend[32]{};
char m_brand[64 + 5]{};
const bool m_pdpe1gb = false;
MsrMod m_msrMod = MSR_MOD_NONE;
size_t m_cores = 0;
size_t m_L2 = 0;
size_t m_L3 = 0;
size_t m_packages = 1;
size_t m_threads = 0;
Vendor m_vendor = VENDOR_UNKNOWN;
};

View file

@ -23,6 +23,7 @@
*/
#include <algorithm>
#include <array>
#include <cstring>
#include <thread>
@ -33,28 +34,9 @@
# include <cpuid.h>
#endif
#ifndef bit_AES
# define bit_AES (1 << 25)
#endif
#ifndef bit_OSXSAVE
# define bit_OSXSAVE (1 << 27)
#endif
#ifndef bit_AVX2
# define bit_AVX2 (1 << 5)
#endif
#ifndef bit_BMI2
# define bit_BMI2 (1 << 8)
#endif
#ifndef bit_PDPE1GB
# define bit_PDPE1GB (1 << 26)
#endif
#include "backend/cpu/platform/BasicCpuInfo.h"
#include "3rdparty/rapidjson/document.h"
#include "crypto/common/Assembly.h"
@ -75,6 +57,10 @@
namespace xmrig {
static const std::array<const char *, ICpuInfo::FLAG_MAX> flagNames = { "aes", "avx2", "avx512f", "bmi2", "osxsave", "pdpe1gb", "sse2", "ssse3", "xop" };
static const std::array<const char *, ICpuInfo::MSR_MOD_MAX> msrNames = { "none", "ryzen", "intel", "custom" };
static inline void cpuid(uint32_t level, int32_t output[4])
{
memset(output, 0, sizeof(int32_t) * 4);
@ -133,42 +119,50 @@ static inline int32_t get_masked(int32_t val, int32_t h, int32_t l)
}
static inline bool has_aes_ni()
{
return has_feature(PROCESSOR_INFO, ECX_Reg, bit_AES);
}
static inline bool has_avx2()
{
return has_feature(EXTENDED_FEATURES, EBX_Reg, bit_AVX2) && has_feature(PROCESSOR_INFO, ECX_Reg, bit_OSXSAVE);
}
static inline bool has_bmi2()
{
return has_feature(EXTENDED_FEATURES, EBX_Reg, bit_BMI2);
}
static inline bool has_pdpe1gb()
{
return has_feature(PROCESSOR_EXT_INFO, EDX_Reg, bit_PDPE1GB);
}
static inline bool has_osxsave() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 27); }
static inline bool has_aes_ni() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 25); }
static inline bool has_avx2() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 5) && has_osxsave(); }
static inline bool has_avx512f() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 16) && has_osxsave(); }
static inline bool has_bmi2() { return has_feature(EXTENDED_FEATURES, EBX_Reg, 1 << 8); }
static inline bool has_pdpe1gb() { return has_feature(PROCESSOR_EXT_INFO, EDX_Reg, 1 << 26); }
static inline bool has_sse2() { return has_feature(PROCESSOR_INFO, EDX_Reg, 1 << 26); }
static inline bool has_ssse3() { return has_feature(PROCESSOR_INFO, ECX_Reg, 1 << 9); }
static inline bool has_xop() { return has_feature(0x80000001, ECX_Reg, 1 << 11); }
} // namespace xmrig
#ifdef XMRIG_ALGO_ARGON2
extern "C" {
int cpu_flags_has_avx2() { return xmrig::has_avx2(); }
int cpu_flags_has_avx512f() { return xmrig::has_avx512f(); }
int cpu_flags_has_sse2() { return xmrig::has_sse2(); }
int cpu_flags_has_ssse3() { return xmrig::has_ssse3(); }
int cpu_flags_has_xop() { return xmrig::has_xop(); }
}
#endif
xmrig::BasicCpuInfo::BasicCpuInfo() :
m_threads(std::thread::hardware_concurrency()),
m_aes(has_aes_ni()),
m_avx2(has_avx2()),
m_bmi2(has_bmi2()),
m_pdpe1gb(has_pdpe1gb())
m_threads(std::thread::hardware_concurrency())
{
cpu_brand_string(m_brand);
m_flags.set(FLAG_AES, has_aes_ni());
m_flags.set(FLAG_AVX2, has_avx2());
m_flags.set(FLAG_AVX512F, has_avx512f());
m_flags.set(FLAG_BMI2, has_bmi2());
m_flags.set(FLAG_OSXSAVE, has_osxsave());
m_flags.set(FLAG_PDPE1GB, has_pdpe1gb());
m_flags.set(FLAG_SSE2, has_sse2());
m_flags.set(FLAG_SSSE3, has_ssse3());
m_flags.set(FLAG_XOP, has_xop());
# ifdef XMRIG_FEATURE_ASM
if (hasAES()) {
char vendor[13] = { 0 };
@ -206,7 +200,7 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
const char *xmrig::BasicCpuInfo::backend() const
{
return "basic";
return "basic/1";
}
@ -270,3 +264,43 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &algorithm, uint3
return CpuThreads(std::max<size_t>(count / 2, 1), 1);
}
rapidjson::Value xmrig::BasicCpuInfo::toJSON(rapidjson::Document &doc) const
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();
Value out(kObjectType);
out.AddMember("brand", StringRef(brand()), allocator);
out.AddMember("aes", hasAES(), allocator);
out.AddMember("avx2", hasAVX2(), allocator);
out.AddMember("x64", isX64(), allocator);
out.AddMember("l2", static_cast<uint64_t>(L2()), allocator);
out.AddMember("l3", static_cast<uint64_t>(L3()), allocator);
out.AddMember("cores", static_cast<uint64_t>(cores()), allocator);
out.AddMember("threads", static_cast<uint64_t>(threads()), allocator);
out.AddMember("packages", static_cast<uint64_t>(packages()), allocator);
out.AddMember("nodes", static_cast<uint64_t>(nodes()), allocator);
out.AddMember("backend", StringRef(backend()), allocator);
out.AddMember("msr", StringRef(msrNames[msrMod()]), allocator);
# ifdef XMRIG_FEATURE_ASM
out.AddMember("assembly", StringRef(Assembly(assembly()).toString()), allocator);
# else
out.AddMember("assembly", "none", allocator);
# endif
Value flags(kArrayType);
for (size_t i = 0; i < flagNames.size(); ++i) {
if (m_flags.test(i)) {
flags.PushBack(StringRef(flagNames[i]), allocator);
}
}
out.AddMember("flags", flags, allocator);
return out;
}

View file

@ -29,6 +29,9 @@
#include "backend/cpu/interfaces/ICpuInfo.h"
#include <bitset>
namespace xmrig {
@ -40,12 +43,14 @@ public:
protected:
const char *backend() const override;
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
rapidjson::Value toJSON(rapidjson::Document &doc) const override;
inline Assembly::Id assembly() const override { return m_assembly; }
inline bool hasAES() const override { return m_aes; }
inline bool hasAVX2() const override { return m_avx2; }
inline bool hasBMI2() const override { return m_bmi2; }
inline bool hasOneGbPages() const override { return m_pdpe1gb; }
inline bool has(Flag flag) const override { return m_flags.test(flag); }
inline bool hasAES() const override { return has(FLAG_AES); }
inline bool hasAVX2() const override { return has(FLAG_AVX2); }
inline bool hasBMI2() const override { return has(FLAG_BMI2); }
inline bool hasOneGbPages() const override { return has(FLAG_PDPE1GB); }
inline const char *brand() const override { return m_brand; }
inline MsrMod msrMod() const override { return m_msrMod; }
inline size_t cores() const override { return 0; }
@ -59,15 +64,12 @@ protected:
protected:
char m_brand[64 + 6]{};
size_t m_threads;
Vendor m_vendor = VENDOR_UNKNOWN;
private:
Assembly m_assembly = Assembly::NONE;
bool m_aes = false;
const bool m_avx2 = false;
const bool m_bmi2 = false;
const bool m_pdpe1gb = false;
MsrMod m_msrMod = MSR_MOD_NONE;
Vendor m_vendor = VENDOR_UNKNOWN;
std::bitset<FLAG_MAX> m_flags;
};

View file

@ -5,8 +5,8 @@
* 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 2016-2019 XMRig <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 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
@ -22,6 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <array>
#include <cstring>
#include <thread>
@ -33,6 +34,7 @@
#include "backend/cpu/platform/BasicCpuInfo.h"
#include "3rdparty/rapidjson/document.h"
xmrig::BasicCpuInfo::BasicCpuInfo() :
@ -46,9 +48,9 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
# if __ARM_FEATURE_CRYPTO
# if !defined(__APPLE__)
m_aes = getauxval(AT_HWCAP) & HWCAP_AES;
m_flags.set(FLAG_AES, getauxval(AT_HWCAP) & HWCAP_AES);
# else
m_aes = true;
m_flags.set(FLAG_AES, true);
# endif
# endif
}
@ -56,7 +58,7 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
const char *xmrig::BasicCpuInfo::backend() const
{
return "basic_arm";
return "basic/1";
}
@ -64,3 +66,36 @@ xmrig::CpuThreads xmrig::BasicCpuInfo::threads(const Algorithm &, uint32_t) cons
{
return CpuThreads(threads());
}
rapidjson::Value xmrig::BasicCpuInfo::toJSON(rapidjson::Document &doc) const
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();
Value out(kObjectType);
out.AddMember("brand", StringRef(brand()), allocator);
out.AddMember("aes", hasAES(), allocator);
out.AddMember("avx2", false, allocator);
out.AddMember("x64", isX64(), allocator);
out.AddMember("l2", static_cast<uint64_t>(L2()), allocator);
out.AddMember("l3", static_cast<uint64_t>(L3()), allocator);
out.AddMember("cores", static_cast<uint64_t>(cores()), allocator);
out.AddMember("threads", static_cast<uint64_t>(threads()), allocator);
out.AddMember("packages", static_cast<uint64_t>(packages()), allocator);
out.AddMember("nodes", static_cast<uint64_t>(nodes()), allocator);
out.AddMember("backend", StringRef(backend()), allocator);
out.AddMember("msr", "none", allocator);
out.AddMember("assembly", "none", allocator);
Value flags(kArrayType);
if (hasAES()) {
flags.PushBack("aes", allocator);
}
out.AddMember("flags", flags, allocator);
return out;
}

View file

@ -5,8 +5,8 @@
* 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 2016-2019 XMRig <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 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
@ -313,7 +313,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
size_t cacheHashes = ((L3 + extra) + (scratchpad / 2)) / scratchpad;
# ifdef XMRIG_ALGO_CN_PICO
if (algorithm == Algorithm::CN_PICO_0 && (cacheHashes / PUs) >= 2) {
if (intensity && algorithm == Algorithm::CN_PICO_0 && (cacheHashes / PUs) >= 2) {
intensity = 2;
}
# endif

View file

@ -5,8 +5,8 @@
* 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 2016-2019 XMRig <support@xmrig.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 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

View file

@ -28,6 +28,7 @@
#include "backend/cuda/CudaBackend.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/common/Hashrate.h"
#include "backend/common/interfaces/IWorker.h"
#include "backend/common/Tags.h"
@ -43,7 +44,6 @@
#include "base/tools/String.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "rapidjson/document.h"
#ifdef XMRIG_ALGO_ASTROBWT

View file

@ -24,12 +24,12 @@
#include "backend/cuda/CudaConfig.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/common/Tags.h"
#include "backend/cuda/CudaConfig_gen.h"
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/io/json/Json.h"
#include "base/io/log/Log.h"
#include "rapidjson/document.h"
namespace xmrig {

View file

@ -24,9 +24,9 @@
#include "backend/cuda/CudaThread.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
#include <algorithm>

View file

@ -29,7 +29,7 @@
using nvid_ctx = struct nvid_ctx;
#include "rapidjson/fwd.h"
#include "3rdparty/rapidjson/fwd.h"
namespace xmrig {

View file

@ -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
@ -24,8 +24,8 @@
#include "backend/cuda/CudaThreads.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
#include <algorithm>

View file

@ -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

View file

@ -24,11 +24,12 @@
#include "backend/cuda/wrappers/CudaDevice.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/cuda/CudaThreads.h"
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/crypto/Algorithm.h"
#include "base/io/log/Log.h"
#include "rapidjson/document.h"
#ifdef XMRIG_FEATURE_NVML
# include "backend/cuda/wrappers/NvmlLib.h"

View file

@ -28,7 +28,7 @@
#include "backend/cuda/wrappers/CudaLib.h"
#include "base/kernel/Env.h"
#include "base/io/Env.h"
#include "crypto/rx/RxAlgo.h"

View file

@ -28,6 +28,7 @@
#include "backend/opencl/OclBackend.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/common/Hashrate.h"
#include "backend/common/interfaces/IWorker.h"
#include "backend/common/Tags.h"
@ -45,7 +46,6 @@
#include "base/tools/String.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "rapidjson/document.h"
#ifdef XMRIG_FEATURE_API

View file

@ -24,12 +24,12 @@
#include "backend/opencl/OclConfig.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/common/Tags.h"
#include "backend/opencl/OclConfig_gen.h"
#include "backend/opencl/wrappers/OclLib.h"
#include "base/io/json/Json.h"
#include "base/io/log/Log.h"
#include "rapidjson/document.h"
namespace xmrig {

View file

@ -24,8 +24,8 @@
#include "backend/opencl/OclThread.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
#include <algorithm>

View file

@ -26,7 +26,7 @@
#define XMRIG_OCLTHREAD_H
#include "rapidjson/fwd.h"
#include "3rdparty/rapidjson/fwd.h"
#include <bitset>

View file

@ -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
@ -27,8 +27,8 @@
#include "backend/opencl/OclThreads.h"
#include "3rdparty/rapidjson/document.h"
#include "base/io/json/Json.h"
#include "rapidjson/document.h"
xmrig::OclThreads::OclThreads(const rapidjson::Value &value)

View file

@ -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

View file

@ -24,11 +24,12 @@
#include "backend/opencl/wrappers/OclDevice.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/opencl/OclGenerator.h"
#include "backend/opencl/OclThreads.h"
#include "backend/opencl/wrappers/OclLib.h"
#include "base/io/log/Log.h"
#include "rapidjson/document.h"
#ifdef XMRIG_FEATURE_ADL
# include "backend/opencl/wrappers/AdlLib.h"

View file

@ -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
@ -31,8 +31,8 @@
#include "backend/opencl/wrappers/OclLib.h"
#include "backend/common/Tags.h"
#include "backend/opencl/wrappers/OclError.h"
#include "base/io/Env.h"
#include "base/io/log/Log.h"
#include "base/kernel/Env.h"
#if defined(OCL_DEBUG_REFERENCE_COUNT)

View file

@ -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

View file

@ -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,9 +23,9 @@
*/
#include "backend/opencl/wrappers/OclLib.h"
#include "backend/opencl/wrappers/OclPlatform.h"
#include "rapidjson/document.h"
#include "3rdparty/rapidjson/document.h"
#include "backend/opencl/wrappers/OclLib.h"
std::vector<xmrig::OclPlatform> xmrig::OclPlatform::get()

View file

@ -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

View file

@ -31,9 +31,9 @@
#include "base/api/interfaces/IApiListener.h"
#include "base/api/requests/HttpApiRequest.h"
#include "base/crypto/keccak.h"
#include "base/io/Env.h"
#include "base/io/json/Json.h"
#include "base/kernel/Base.h"
#include "base/kernel/Env.h"
#include "base/tools/Buffer.h"
#include "base/tools/Chrono.h"
#include "core/config/Config.h"

View file

@ -26,7 +26,7 @@
#define XMRIG_IAPIREQUEST_H
#include "rapidjson/fwd.h"
#include "3rdparty/rapidjson/fwd.h"
namespace xmrig {

View file

@ -23,11 +23,11 @@
*/
#include "3rdparty/http-parser/http_parser.h"
#include "base/api/requests/HttpApiRequest.h"
#include "3rdparty/http-parser/http_parser.h"
#include "3rdparty/rapidjson/error/en.h"
#include "base/io/json/Json.h"
#include "base/net/http/HttpData.h"
#include "rapidjson/error/en.h"
namespace xmrig {

View file

@ -4,6 +4,7 @@ set(HEADERS_BASE
src/base/crypto/Coin.h
src/base/crypto/keccak.h
src/base/io/Console.h
src/base/io/Env.h
src/base/io/json/Json.h
src/base/io/json/JsonChain.h
src/base/io/json/JsonRequest.h
@ -11,12 +12,12 @@ set(HEADERS_BASE
src/base/io/log/backends/FileLog.h
src/base/io/log/FileLogWriter.h
src/base/io/log/Log.h
src/base/io/Signals.h
src/base/io/Watcher.h
src/base/kernel/Base.h
src/base/kernel/config/BaseConfig.h
src/base/kernel/config/BaseTransform.h
src/base/kernel/Entry.h
src/base/kernel/Env.h
src/base/kernel/interfaces/IBaseListener.h
src/base/kernel/interfaces/IClient.h
src/base/kernel/interfaces/IClientListener.h
@ -34,7 +35,6 @@ set(HEADERS_BASE
src/base/kernel/interfaces/IWatcherListener.h
src/base/kernel/Platform.h
src/base/kernel/Process.h
src/base/kernel/Signals.h
src/base/net/dns/Dns.h
src/base/net/dns/DnsRecord.h
src/base/net/http/Http.h
@ -70,6 +70,7 @@ set(SOURCES_BASE
src/base/crypto/Coin.cpp
src/base/crypto/keccak.cpp
src/base/io/Console.cpp
src/base/io/Env.cpp
src/base/io/json/Json.cpp
src/base/io/json/JsonChain.cpp
src/base/io/json/JsonRequest.cpp
@ -77,15 +78,14 @@ set(SOURCES_BASE
src/base/io/log/backends/FileLog.cpp
src/base/io/log/FileLogWriter.cpp
src/base/io/log/Log.cpp
src/base/io/Signals.cpp
src/base/io/Watcher.cpp
src/base/kernel/Base.cpp
src/base/kernel/config/BaseConfig.cpp
src/base/kernel/config/BaseTransform.cpp
src/base/kernel/Entry.cpp
src/base/kernel/Env.cpp
src/base/kernel/Platform.cpp
src/base/kernel/Process.cpp
src/base/kernel/Signals.cpp
src/base/net/dns/Dns.cpp
src/base/net/dns/DnsRecord.cpp
src/base/net/http/Http.cpp

View file

@ -25,7 +25,7 @@
#include "base/crypto/Algorithm.h"
#include "rapidjson/document.h"
#include "3rdparty/rapidjson/document.h"
#include <cassert>

View file

@ -30,7 +30,7 @@
#include <vector>
#include "rapidjson/fwd.h"
#include "3rdparty/rapidjson/fwd.h"
namespace xmrig {

View file

@ -25,7 +25,7 @@
#include "base/crypto/Coin.h"
#include "rapidjson/document.h"
#include "3rdparty/rapidjson/document.h"
#include <cstring>

View file

@ -27,8 +27,8 @@
#define XMRIG_COIN_H
#include "3rdparty/rapidjson/fwd.h"
#include "base/crypto/Algorithm.h"
#include "rapidjson/fwd.h"
namespace xmrig {

Some files were not shown because too many files have changed in this diff Show more