forked from xmrig/xmrig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,287 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
if (NOT CMAKE_SYSTEM_PROCESSOR) | ||
message(WARNING "CMAKE_SYSTEM_PROCESSOR not defined") | ||
endif() | ||
|
||
|
||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") | ||
add_definitions(/DRAPIDJSON_SSE2) | ||
endif() | ||
|
||
|
||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64)$") | ||
set(XMRIG_ARM ON) | ||
set(XMRIG_ARMv8 ON) | ||
set(WITH_LIBCPUID OFF) | ||
|
||
add_definitions(/DXMRIG_ARM) | ||
add_definitions(/DXMRIG_ARMv8) | ||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7|armv7f|armv7s|armv7k|armv7-a|armv7l)$") | ||
set(XMRIG_ARM ON) | ||
set(XMRIG_ARMv7 ON) | ||
set(WITH_LIBCPUID OFF) | ||
|
||
add_definitions(/DXMRIG_ARM) | ||
add_definitions(/DXMRIG_ARMv7) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "") | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
|
||
if (CMAKE_CXX_COMPILER_ID MATCHES GNU) | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing") | ||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fvariable-expansion-in-unroller -ftree-loop-if-convert-stores -fmerge-all-constants -fbranch-target-load-optimize2") | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions -fno-rtti") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s -funroll-loops -fvariable-expansion-in-unroller -ftree-loop-if-convert-stores -fmerge-all-constants -fbranch-target-load-optimize2") | ||
|
||
if (XMRIG_ARMv8) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+crypto") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crypto -flax-vector-conversions") | ||
elseif (XMRIG_ARMv7) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -flax-vector-conversions") | ||
else() | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") | ||
endif() | ||
|
||
if (WIN32) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") | ||
else() | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") | ||
endif() | ||
|
||
add_definitions(/D_GNU_SOURCE) | ||
|
||
if (${CMAKE_VERSION} VERSION_LESS "3.1.0") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
endif() | ||
|
||
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2") | ||
|
||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC) | ||
|
||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL") | ||
add_definitions(/D_CRT_SECURE_NO_WARNINGS) | ||
add_definitions(/D_CRT_NONSTDC_NO_WARNINGS) | ||
add_definitions(/DNOMINMAX) | ||
|
||
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") | ||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants") | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions -fno-rtti -Wno-missing-braces") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants") | ||
|
||
if (XMRIG_ARMv8) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+crypto") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crypto") | ||
elseif (XMRIG_ARMv7) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}") | ||
else() | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") | ||
endif() | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* XMRig | ||
* Copyright 2010 Jeff Garzik <[email protected]> | ||
* Copyright 2012-2014 pooler <[email protected]> | ||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones> | ||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2016-2017 XMRig <[email protected]> | ||
* | ||
* | ||
* 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 __ALIGNED_MALLOC_H__ | ||
#define __ALIGNED_MALLOC_H__ | ||
|
||
|
||
#include <stdlib.h> | ||
|
||
|
||
#ifndef __cplusplus | ||
extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size); | ||
#else | ||
// Some systems (e.g. those with GNU libc) declare posix_memalign with an | ||
// exception specifier. Via an "egregious workaround" in | ||
// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid | ||
// redeclaration of glibc's declaration. | ||
extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size); | ||
#endif | ||
|
||
|
||
static __inline__ void *__attribute__((__always_inline__, __malloc__)) _mm_malloc(size_t __size, size_t __align) | ||
{ | ||
if (__align == 1) { | ||
return malloc(__size); | ||
} | ||
|
||
if (!(__align & (__align - 1)) && __align < sizeof(void *)) | ||
__align = sizeof(void *); | ||
|
||
void *__mallocedMemory; | ||
if (posix_memalign(&__mallocedMemory, __align, __size)) { | ||
return 0; | ||
} | ||
|
||
return __mallocedMemory; | ||
} | ||
|
||
|
||
static __inline__ void __attribute__((__always_inline__)) _mm_free(void *__p) | ||
{ | ||
free(__p); | ||
} | ||
|
||
#endif /* __ALIGNED_MALLOC_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* XMRig | ||
* Copyright 2010 Jeff Garzik <[email protected]> | ||
* Copyright 2012-2014 pooler <[email protected]> | ||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones> | ||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> | ||
* Copyright 2016 Jay D Dee <[email protected]> | ||
* Copyright 2016-2017 XMRig <[email protected]> | ||
* | ||
* | ||
* 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/>. | ||
*/ | ||
|
||
|
||
#include <string.h> | ||
|
||
|
||
#include "Cpu.h" | ||
|
||
|
||
char Cpu::m_brand[64] = { 0 }; | ||
int Cpu::m_flags = 0; | ||
int Cpu::m_l2_cache = 0; | ||
int Cpu::m_l3_cache = 0; | ||
int Cpu::m_sockets = 1; | ||
int Cpu::m_totalCores = 0; | ||
int Cpu::m_totalThreads = 0; | ||
|
||
|
||
int Cpu::optimalThreadsCount(int algo, bool doubleHash, int maxCpuUsage) | ||
{ | ||
return m_totalThreads; | ||
} | ||
|
||
|
||
void Cpu::initCommon() | ||
{ | ||
memcpy(m_brand, "Unknown", 7); | ||
|
||
# if defined(XMRIG_ARMv8) | ||
m_flags |= X86_64; | ||
m_flags |= AES; | ||
# endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
|
||
|
||
#include <inttypes.h> | ||
#include <stdio.h> | ||
#include <uv.h> | ||
|
||
|
||
|
Oops, something went wrong.