The response has been limited to 50k tokens of the smallest files in the repo. You can remove this limitation by removing the max tokens filter.
├── .github
    └── ISSUE_TEMPLATE
    │   └── bug_report.md
├── .gitignore
├── CHANGELOG.md
├── CMakeLists.txt
├── LICENSE
├── README.md
├── bin
    └── WinRing0
    │   ├── LICENSE
    │   └── WinRing0x64.sys
├── cmake
    ├── FindHWLOC.cmake
    ├── FindUV.cmake
    ├── OpenSSL.cmake
    ├── argon2.cmake
    ├── asm.cmake
    ├── cpu.cmake
    ├── flags.cmake
    ├── ghostrider.cmake
    ├── kawpow.cmake
    ├── os.cmake
    └── randomx.cmake
├── doc
    ├── ALGORITHMS.md
    ├── API.md
    ├── BENCHMARK.md
    ├── CHANGELOG_OLD.md
    ├── CPU.md
    ├── CPU_MAX_USAGE.md
    ├── PERSISTENT_OPTIONS.md
    ├── api
    │   └── 1
    │   │   ├── config.json
    │   │   ├── summary.json
    │   │   └── threads.json
    ├── build
    │   └── CMAKE_OPTIONS.md
    ├── gpg_keys
    │   └── xmrig.asc
    ├── screenshot.png
    ├── screenshot_v5_2_0.png
    └── topology
    │   ├── AMD_FX_8320_windows_2_0_4.xml
    │   ├── AMD_Opteron_6272_x4_N8_linux_2_0_4_LXC.xml
    │   ├── AMD_Opteron_6278_x2_UMA_windows_2_0_4.xml
    │   ├── AMD_Opteron_6344_x2_N4_win7_2_0_4_bug.xml
    │   ├── AMD_Opteron_6348_x4_N8_linux_1_11_2.xml
    │   ├── AMD_Opteron_6348_x4_N8_linux_2_0_4.xml
    │   ├── AMD_Opteron_6380_x4_N8_linux_1_11_5.xml
    │   ├── AMD_Ryzen_7_2700X_windows_2_0_4.xml
    │   ├── AMD_Ryzen_7_3700X_windows_2_0_4.xml
    │   ├── AMD_Ryzen_Threadripper_2950X_N2_linux_2_0_4.xml
    │   ├── AMD_Ryzen_Threadripper_2950X_UMA_linux_1_11_9.xml
    │   ├── Intel_Core_i7-3770_linux_2_0_4.xml
    │   ├── Intel_Core_i7-6700_linux_2_0_4.xml
    │   ├── Intel_Core_i7-6700_windows_2_0_4.xml
    │   ├── Intel_Core_i7-7660U_windows_2_0_4.xml
    │   ├── Intel_Xeon_E5-4650_0_x4_N4_windows_2_0_4.xml
    │   ├── Intel_Xeon_E5620_x2_UMA_windows_2_0_4.xml
    │   ├── Intel_Xeon_E7-4870_x4_N4_windows_2_0_4.xml
    │   ├── Intel_Xeon_Gold_6146_x2_UMA_linux_2_0_4.xml
    │   ├── Intel_Xeon_Silver_4114_x2_N2_linux_1_11_9.xml
    │   └── Intel_Xeon_Silver_4114_x2_N2_linux_2_0_4.xml
├── package.json
├── res
    ├── app.ico
    └── app.rc
├── scripts
    ├── benchmark_10M.cmd
    ├── benchmark_1M.cmd
    ├── build.hwloc.sh
    ├── build.hwloc1.sh
    ├── build.libressl.sh
    ├── build.openssl.sh
    ├── build.openssl3.sh
    ├── build.uv.sh
    ├── build_deps.sh
    ├── enable_1gb_pages.sh
    ├── generate_cl.js
    ├── js
    │   ├── opencl.js
    │   └── opencl_minify.js
    ├── pool_mine_example.cmd
    ├── randomx_boost.sh
    ├── rtm_ghostrider_example.cmd
    └── solo_mine_example.cmd
└── src
    ├── 3rdparty
        ├── CL
        │   ├── LICENSE
        │   ├── README.md
        │   ├── cl.h
        │   ├── cl_d3d10.h
        │   ├── cl_d3d11.h
        │   ├── cl_dx9_media_sharing.h
        │   ├── cl_dx9_media_sharing_intel.h
        │   ├── cl_egl.h
        │   ├── cl_ext.h
        │   ├── cl_ext_intel.h
        │   ├── cl_gl.h
        │   ├── cl_gl_ext.h
        │   ├── cl_platform.h
        │   ├── cl_va_api_media_sharing_intel.h
        │   ├── cl_version.h
        │   └── opencl.h
        ├── adl
        │   ├── adl_defines.h
        │   ├── adl_sdk.h
        │   └── adl_structures.h
        ├── argon2.h
        ├── argon2
        │   ├── CMakeLists.txt
        │   ├── LICENSE
        │   ├── README.md
        │   ├── arch
        │   │   ├── generic
        │   │   │   └── lib
        │   │   │   │   └── argon2-arch.c
        │   │   └── x86_64
        │   │   │   ├── lib
        │   │   │       ├── argon2-arch.c
        │   │   │       ├── argon2-avx2.c
        │   │   │       ├── argon2-avx2.h
        │   │   │       ├── argon2-avx512f.c
        │   │   │       ├── argon2-avx512f.h
        │   │   │       ├── argon2-sse2.c
        │   │   │       ├── argon2-sse2.h
        │   │   │       ├── argon2-ssse3.c
        │   │   │       ├── argon2-ssse3.h
        │   │   │       ├── argon2-template-128.h
        │   │   │       ├── argon2-xop.c
        │   │   │       └── argon2-xop.h
        │   │   │   └── src
        │   │   │       ├── test-feature-avx2.c
        │   │   │       ├── test-feature-avx512f.c
        │   │   │       ├── test-feature-sse2.c
        │   │   │       ├── test-feature-ssse3.c
        │   │   │       └── test-feature-xop.c
        │   ├── include
        │   │   └── argon2.h
        │   └── lib
        │   │   ├── argon2-template-64.h
        │   │   ├── argon2.c
        │   │   ├── blake2
        │   │       ├── blake2-impl.h
        │   │       ├── blake2.c
        │   │       └── blake2.h
        │   │   ├── core.c
        │   │   ├── core.h
        │   │   ├── encoding.c
        │   │   ├── encoding.h
        │   │   ├── genkat.c
        │   │   ├── genkat.h
        │   │   ├── impl-select.c
        │   │   └── impl-select.h
        ├── base32
        │   └── base32.h
        ├── cl.h
        ├── epee
        │   ├── LICENSE.txt
        │   ├── README.md
        │   └── span.h
        ├── fmt
        │   ├── LICENSE.rst
        │   ├── README.rst
        │   ├── chrono.h
        │   ├── color.h
        │   ├── compile.h
        │   ├── core.h
        │   ├── format-inl.h
        │   ├── format.cc
        │   ├── format.h
        │   ├── locale.h
        │   ├── os.cc
        │   ├── os.h
        │   ├── ostream.h
        │   ├── posix.h
        │   ├── printf.h
        │   └── ranges.h
        ├── getopt
        │   └── getopt.h
        ├── hwloc
        │   ├── AUTHORS
        │   ├── CMakeLists.txt
        │   ├── COPYING
        │   ├── NEWS
        │   ├── README
        │   ├── VERSION
        │   ├── include
        │   │   ├── hwloc.h
        │   │   ├── hwloc
        │   │   │   ├── autogen
        │   │   │   │   └── config.h
        │   │   │   ├── bitmap.h
        │   │   │   ├── cpukinds.h
        │   │   │   ├── cuda.h
        │   │   │   ├── cudart.h
        │   │   │   ├── deprecated.h
        │   │   │   ├── diff.h
        │   │   │   ├── distances.h
        │   │   │   ├── export.h
        │   │   │   ├── gl.h
        │   │   │   ├── glibc-sched.h
        │   │   │   ├── helper.h
        │   │   │   ├── inlines.h
        │   │   │   ├── levelzero.h
        │   │   │   ├── linux-libnuma.h
        │   │   │   ├── linux.h
        │   │   │   ├── memattrs.h
        │   │   │   ├── nvml.h
        │   │   │   ├── opencl.h
        │   │   │   ├── openfabrics-verbs.h
        │   │   │   ├── plugins.h
        │   │   │   ├── rename.h
        │   │   │   ├── rsmi.h
        │   │   │   ├── shmem.h
        │   │   │   └── windows.h
        │   │   └── private
        │   │   │   ├── autogen
        │   │   │       └── config.h
        │   │   │   ├── components.h
        │   │   │   ├── cpuid-x86.h
        │   │   │   ├── debug.h
        │   │   │   ├── internal-components.h
        │   │   │   ├── misc.h
        │   │   │   ├── private.h
        │   │   │   ├── solaris-chiptype.h
        │   │   │   ├── windows.h
        │   │   │   └── xml.h
        │   └── src
        │   │   ├── base64.c
        │   │   ├── bind.c
        │   │   ├── bitmap.c
        │   │   ├── components.c
        │   │   ├── cpukinds.c
        │   │   ├── diff.c
        │   │   ├── distances.c
        │   │   ├── memattrs.c
        │   │   ├── misc.c
        │   │   ├── pci-common.c
        │   │   ├── shmem.c
        │   │   ├── static-components.h
        │   │   ├── topology-noos.c
        │   │   ├── topology-synthetic.c
        │   │   ├── topology-windows.c
        │   │   ├── topology-x86.c
        │   │   ├── topology-xml-nolibxml.c
        │   │   ├── topology-xml.c
        │   │   ├── topology.c
        │   │   └── traversal.c
        ├── libethash
        │   ├── CMakeLists.txt
        │   ├── data_sizes.h
        │   ├── endian.h
        │   ├── ethash.h
        │   ├── ethash_internal.c
        │   ├── ethash_internal.h
        │   ├── fnv.h
        │   └── keccakf800.c
        ├── llhttp
        │   ├── LICENSE-MIT
        │   ├── README.md
        │   ├── api.c
        │   ├── http.c
        │   ├── llhttp.c
        │   └── llhttp.h
        └── rapidjson
        │   ├── allocators.h
        │   ├── cursorstreamwrapper.h
        │   ├── document.h
        │   ├── encodedstream.h
        │   ├── encodings.h
        │   ├── error
        │       ├── en.h
        │       └── error.h
        │   ├── filereadstream.h
        │   ├── filewritestream.h
        │   ├── fwd.h
        │   ├── internal
        │       ├── biginteger.h
        │       ├── clzll.h
        │       ├── diyfp.h
        │       ├── dtoa.h
        │       ├── ieee754.h
        │       ├── itoa.h
        │       ├── meta.h
        │       ├── pow10.h
        │       ├── regex.h
        │       ├── stack.h
        │       ├── strfunc.h
        │       ├── strtod.h
        │       └── swap.h
        │   ├── istreamwrapper.h
        │   ├── license.txt
        │   ├── memorybuffer.h
        │   ├── memorystream.h
        │   ├── msinttypes
        │       ├── inttypes.h
        │       └── stdint.h
        │   ├── ostreamwrapper.h
        │   ├── pointer.h
        │   ├── prettywriter.h
        │   ├── rapidjson.h
        │   ├── reader.h
        │   ├── readme.md
        │   ├── schema.h
        │   ├── stream.h
        │   ├── stringbuffer.h
        │   ├── uri.h
        │   └── writer.h
    ├── App.cpp
    ├── App.h
    ├── App_unix.cpp
    ├── App_win.cpp
    ├── Summary.cpp
    ├── Summary.h
    ├── backend
        ├── backend.cmake
        ├── common
        │   ├── GpuWorker.cpp
        │   ├── GpuWorker.h
        │   ├── Hashrate.cpp
        │   ├── Hashrate.h
        │   ├── HashrateInterpolator.cpp
        │   ├── HashrateInterpolator.h
        │   ├── Tags.h
        │   ├── Thread.h
        │   ├── Threads.cpp
        │   ├── Threads.h
        │   ├── Worker.cpp
        │   ├── Worker.h
        │   ├── WorkerJob.h
        │   ├── Workers.cpp
        │   ├── Workers.h
        │   ├── benchmark
        │   │   ├── BenchState.cpp
        │   │   ├── BenchState.h
        │   │   ├── BenchState_test.h
        │   │   ├── Benchmark.cpp
        │   │   └── Benchmark.h
        │   ├── common.cmake
        │   ├── interfaces
        │   │   ├── IBackend.h
        │   │   ├── IBenchListener.h
        │   │   ├── IMemoryPool.h
        │   │   ├── IRxListener.h
        │   │   ├── IRxStorage.h
        │   │   └── IWorker.h
        │   └── misc
        │   │   └── PciTopology.h
        ├── cpu
        │   ├── Cpu.cpp
        │   ├── Cpu.h
        │   ├── CpuBackend.cpp
        │   ├── CpuBackend.h
        │   ├── CpuConfig.cpp
        │   ├── CpuConfig.h
        │   ├── CpuConfig_gen.h
        │   ├── CpuLaunchData.cpp
        │   ├── CpuLaunchData.h
        │   ├── CpuThread.cpp
        │   ├── CpuThread.h
        │   ├── CpuThreads.cpp
        │   ├── CpuThreads.h
        │   ├── CpuWorker.cpp
        │   ├── CpuWorker.h
        │   ├── cpu.cmake
        │   ├── interfaces
        │   │   └── ICpuInfo.h
        │   └── platform
        │   │   ├── BasicCpuInfo.cpp
        │   │   ├── BasicCpuInfo.h
        │   │   ├── BasicCpuInfo_arm.cpp
        │   │   ├── BasicCpuInfo_arm_mac.cpp
        │   │   ├── BasicCpuInfo_arm_unix.cpp
        │   │   ├── BasicCpuInfo_arm_win.cpp
        │   │   ├── HwlocCpuInfo.cpp
        │   │   ├── HwlocCpuInfo.h
        │   │   └── lscpu_arm.cpp
        ├── cuda
        │   ├── CudaBackend.cpp
        │   ├── CudaBackend.h
        │   ├── CudaConfig.cpp
        │   ├── CudaConfig.h
        │   ├── CudaConfig_gen.h
        │   ├── CudaLaunchData.cpp
        │   ├── CudaLaunchData.h
        │   ├── CudaThread.cpp
        │   ├── CudaThread.h
        │   ├── CudaThreads.cpp
        │   ├── CudaThreads.h
        │   ├── CudaWorker.cpp
        │   ├── CudaWorker.h
        │   ├── cuda.cmake
        │   ├── interfaces
        │   │   └── ICudaRunner.h
        │   ├── runners
        │   │   ├── CudaBaseRunner.cpp
        │   │   ├── CudaBaseRunner.h
        │   │   ├── CudaCnRunner.cpp
        │   │   ├── CudaCnRunner.h
        │   │   ├── CudaKawPowRunner.cpp
        │   │   ├── CudaKawPowRunner.h
        │   │   ├── CudaRxRunner.cpp
        │   │   └── CudaRxRunner.h
        │   └── wrappers
        │   │   ├── CudaDevice.cpp
        │   │   ├── CudaDevice.h
        │   │   ├── CudaLib.cpp
        │   │   ├── CudaLib.h
        │   │   ├── NvmlHealth.h
        │   │   ├── NvmlLib.cpp
        │   │   ├── NvmlLib.h
        │   │   └── nvml_lite.h
        └── opencl
        │   ├── OclBackend.cpp
        │   ├── OclBackend.h
        │   ├── OclCache.cpp
        │   ├── OclCache.h
        │   ├── OclCache_unix.cpp
        │   ├── OclCache_win.cpp
        │   ├── OclConfig.cpp
        │   ├── OclConfig.h
        │   ├── OclConfig_gen.h
        │   ├── OclGenerator.h
        │   ├── OclLaunchData.cpp
        │   ├── OclLaunchData.h
        │   ├── OclThread.cpp
        │   ├── OclThread.h
        │   ├── OclThreads.cpp
        │   ├── OclThreads.h
        │   ├── OclWorker.cpp
        │   ├── OclWorker.h
        │   ├── cl
        │       ├── OclSource.cpp
        │       ├── OclSource.h
        │       ├── cn
        │       │   ├── algorithm.cl
        │       │   ├── blake256.cl
        │       │   ├── cryptonight.cl
        │       │   ├── cryptonight_cl.h
        │       │   ├── cryptonight_r.cl
        │       │   ├── cryptonight_r_cl.h
        │       │   ├── cryptonight_r_defines.cl
        │       │   ├── fast_div_heavy.cl
        │       │   ├── fast_int_math_v2.cl
        │       │   ├── groestl256.cl
        │       │   ├── jh.cl
        │       │   ├── keccak.cl
        │       │   ├── wolf-aes.cl
        │       │   └── wolf-skein.cl
        │       ├── kawpow
        │       │   ├── defs.h
        │       │   ├── kawpow.cl
        │       │   ├── kawpow_cl.h
        │       │   ├── kawpow_dag.cl
        │       │   └── kawpow_dag_cl.h
        │       └── rx
        │       │   ├── aes.cl
        │       │   ├── blake2b.cl
        │       │   ├── blake2b_double_block.cl
        │       │   ├── fillAes1Rx4.cl
        │       │   ├── randomx.cl
        │       │   ├── randomx_cl.h
        │       │   ├── randomx_constants_arqma.h
        │       │   ├── randomx_constants_graft.h
        │       │   ├── randomx_constants_monero.h
        │       │   ├── randomx_constants_wow.h
        │       │   ├── randomx_jit.cl
        │       │   ├── randomx_run_gfx1010.asm
        │       │   ├── randomx_run_gfx1010.h
        │       │   ├── randomx_run_gfx803.asm
        │       │   ├── randomx_run_gfx803.h
        │       │   ├── randomx_run_gfx900.asm
        │       │   ├── randomx_run_gfx900.h
        │       │   └── randomx_vm.cl
        │   ├── generators
        │       ├── ocl_generic_cn_generator.cpp
        │       ├── ocl_generic_kawpow_generator.cpp
        │       ├── ocl_generic_rx_generator.cpp
        │       └── ocl_vega_cn_generator.cpp
        │   ├── interfaces
        │       └── IOclRunner.h
        │   ├── kernels
        │       ├── Cn0Kernel.cpp
        │       ├── Cn0Kernel.h
        │       ├── Cn1Kernel.cpp
        │       ├── Cn1Kernel.h
        │       ├── Cn2Kernel.cpp
        │       ├── Cn2Kernel.h
        │       ├── CnBranchKernel.cpp
        │       ├── CnBranchKernel.h
        │       ├── kawpow
        │       │   ├── KawPow_CalculateDAGKernel.cpp
        │       │   └── KawPow_CalculateDAGKernel.h
        │       └── rx
        │       │   ├── Blake2bHashRegistersKernel.cpp
        │       │   ├── Blake2bHashRegistersKernel.h
        │       │   ├── Blake2bInitialHashBigKernel.cpp
        │       │   ├── Blake2bInitialHashBigKernel.h
        │       │   ├── Blake2bInitialHashDoubleKernel.cpp
        │       │   ├── Blake2bInitialHashDoubleKernel.h
        │       │   ├── Blake2bInitialHashKernel.cpp
        │       │   ├── Blake2bInitialHashKernel.h
        │       │   ├── ExecuteVmKernel.cpp
        │       │   ├── ExecuteVmKernel.h
        │       │   ├── FillAesKernel.cpp
        │       │   ├── FillAesKernel.h
        │       │   ├── FindSharesKernel.cpp
        │       │   ├── FindSharesKernel.h
        │       │   ├── HashAesKernel.cpp
        │       │   ├── HashAesKernel.h
        │       │   ├── InitVmKernel.cpp
        │       │   ├── InitVmKernel.h
        │       │   ├── RxJitKernel.cpp
        │       │   ├── RxJitKernel.h
        │       │   ├── RxRunKernel.cpp
        │       │   └── RxRunKernel.h
        │   ├── opencl.cmake
        │   ├── runners
        │       ├── OclBaseRunner.cpp
        │       ├── OclBaseRunner.h
        │       ├── OclCnRunner.cpp
        │       ├── OclCnRunner.h
        │       ├── OclKawPowRunner.cpp
        │       ├── OclKawPowRunner.h
        │       ├── OclRxBaseRunner.cpp
        │       ├── OclRxBaseRunner.h
        │       ├── OclRxJitRunner.cpp
        │       ├── OclRxJitRunner.h
        │       ├── OclRxVmRunner.cpp
        │       ├── OclRxVmRunner.h
        │       └── tools
        │       │   ├── OclCnR.cpp
        │       │   ├── OclCnR.h
        │       │   ├── OclKawPow.cpp
        │       │   ├── OclKawPow.h
        │       │   ├── OclSharedData.cpp
        │       │   ├── OclSharedData.h
        │       │   ├── OclSharedState.cpp
        │       │   └── OclSharedState.h
        │   └── wrappers
        │       ├── AdlHealth.h
        │       ├── AdlLib.cpp
        │       ├── AdlLib.h
        │       ├── AdlLib_linux.cpp
        │       ├── OclContext.cpp
        │       ├── OclContext.h
        │       ├── OclDevice.cpp
        │       ├── OclDevice.h
        │       ├── OclDevice_mac.cpp
        │       ├── OclError.cpp
        │       ├── OclError.h
        │       ├── OclKernel.cpp
        │       ├── OclKernel.h
        │       ├── OclLib.cpp
        │       ├── OclLib.h
        │       ├── OclPlatform.cpp
        │       ├── OclPlatform.h
        │       └── OclVendor.h
    ├── base
        ├── api
        │   ├── Api.cpp
        │   ├── Api.h
        │   ├── Httpd.cpp
        │   ├── Httpd.h
        │   ├── interfaces
        │   │   ├── IApiListener.h
        │   │   └── IApiRequest.h
        │   └── requests
        │   │   ├── ApiRequest.cpp
        │   │   ├── ApiRequest.h
        │   │   ├── HttpApiRequest.cpp
        │   │   └── HttpApiRequest.h
        ├── base.cmake
        ├── crypto
        │   ├── Algorithm.cpp
        │   ├── Algorithm.h
        │   ├── Coin.cpp
        │   ├── Coin.h
        │   ├── keccak.cpp
        │   ├── keccak.h
        │   ├── sha3.cpp
        │   └── sha3.h
        ├── io
        │   ├── Async.cpp
        │   ├── Async.h
        │   ├── Console.cpp
        │   ├── Console.h
        │   ├── Env.cpp
        │   ├── Env.h
        │   ├── Signals.cpp
        │   ├── Signals.h
        │   ├── Watcher.cpp
        │   ├── Watcher.h
        │   ├── json
        │   │   ├── Json.cpp
        │   │   ├── Json.h
        │   │   ├── JsonChain.cpp
        │   │   ├── JsonChain.h
        │   │   ├── JsonRequest.cpp
        │   │   ├── JsonRequest.h
        │   │   ├── Json_unix.cpp
        │   │   └── Json_win.cpp
        │   └── log
        │   │   ├── FileLogWriter.cpp
        │   │   ├── FileLogWriter.h
        │   │   ├── Log.cpp
        │   │   ├── Log.h
        │   │   ├── Tags.cpp
        │   │   ├── Tags.h
        │   │   └── backends
        │   │       ├── ConsoleLog.cpp
        │   │       ├── ConsoleLog.h
        │   │       ├── FileLog.cpp
        │   │       ├── FileLog.h
        │   │       ├── SysLog.cpp
        │   │       └── SysLog.h
        ├── kernel
        │   ├── Base.cpp
        │   ├── Base.h
        │   ├── Entry.cpp
        │   ├── Entry.h
        │   ├── Platform.cpp
        │   ├── Platform.h
        │   ├── Platform_hwloc.cpp
        │   ├── Platform_mac.cpp
        │   ├── Platform_unix.cpp
        │   ├── Platform_win.cpp
        │   ├── Process.cpp
        │   ├── Process.h
        │   ├── Process_unix.cpp
        │   ├── Process_win.cpp
        │   ├── config
        │   │   ├── BaseConfig.cpp
        │   │   ├── BaseConfig.h
        │   │   ├── BaseTransform.cpp
        │   │   ├── BaseTransform.h
        │   │   ├── Title.cpp
        │   │   └── Title.h
        │   ├── constants.h
        │   └── interfaces
        │   │   ├── IAsyncListener.h
        │   │   ├── IBaseListener.h
        │   │   ├── IClient.h
        │   │   ├── IClientListener.h
        │   │   ├── IConfig.h
        │   │   ├── IConfigListener.h
        │   │   ├── IConfigTransform.h
        │   │   ├── IConsoleListener.h
        │   │   ├── IDnsBackend.h
        │   │   ├── IDnsListener.h
        │   │   ├── IHttpListener.h
        │   │   ├── IJsonReader.h
        │   │   ├── ILineListener.h
        │   │   ├── ILogBackend.h
        │   │   ├── ISignalListener.h
        │   │   ├── IStrategy.h
        │   │   ├── IStrategyListener.h
        │   │   ├── ITcpServerListener.h
        │   │   ├── ITimerListener.h
        │   │   └── IWatcherListener.h
        ├── net
        │   ├── dns
        │   │   ├── Dns.cpp
        │   │   ├── Dns.h
        │   │   ├── DnsConfig.cpp
        │   │   ├── DnsConfig.h
        │   │   ├── DnsRecord.cpp
        │   │   ├── DnsRecord.h
        │   │   ├── DnsRecords.cpp
        │   │   ├── DnsRecords.h
        │   │   ├── DnsRequest.h
        │   │   ├── DnsUvBackend.cpp
        │   │   └── DnsUvBackend.h
        │   ├── http
        │   │   ├── Fetch.cpp
        │   │   ├── Fetch.h
        │   │   ├── Http.cpp
        │   │   ├── Http.h
        │   │   ├── HttpApiResponse.cpp
        │   │   ├── HttpApiResponse.h
        │   │   ├── HttpClient.cpp
        │   │   ├── HttpClient.h
        │   │   ├── HttpContext.cpp
        │   │   ├── HttpContext.h
        │   │   ├── HttpData.cpp
        │   │   ├── HttpData.h
        │   │   ├── HttpListener.cpp
        │   │   ├── HttpListener.h
        │   │   ├── HttpResponse.cpp
        │   │   ├── HttpResponse.h
        │   │   ├── HttpServer.cpp
        │   │   └── HttpServer.h
        │   ├── https
        │   │   ├── HttpsClient.cpp
        │   │   ├── HttpsClient.h
        │   │   ├── HttpsContext.cpp
        │   │   ├── HttpsContext.h
        │   │   ├── HttpsServer.cpp
        │   │   └── HttpsServer.h
        │   ├── stratum
        │   │   ├── AutoClient.cpp
        │   │   ├── AutoClient.h
        │   │   ├── BaseClient.cpp
        │   │   ├── BaseClient.h
        │   │   ├── Client.cpp
        │   │   ├── Client.h
        │   │   ├── DaemonClient.cpp
        │   │   ├── DaemonClient.h
        │   │   ├── EthStratumClient.cpp
        │   │   ├── EthStratumClient.h
        │   │   ├── Job.cpp
        │   │   ├── Job.h
        │   │   ├── NetworkState.cpp
        │   │   ├── NetworkState.h
        │   │   ├── Pool.cpp
        │   │   ├── Pool.h
        │   │   ├── Pools.cpp
        │   │   ├── Pools.h
        │   │   ├── ProxyUrl.cpp
        │   │   ├── ProxyUrl.h
        │   │   ├── SelfSelectClient.cpp
        │   │   ├── SelfSelectClient.h
        │   │   ├── Socks5.cpp
        │   │   ├── Socks5.h
        │   │   ├── SubmitResult.h
        │   │   ├── Tls.cpp
        │   │   ├── Tls.h
        │   │   ├── Url.cpp
        │   │   ├── Url.h
        │   │   ├── benchmark
        │   │   │   ├── BenchClient.cpp
        │   │   │   ├── BenchClient.h
        │   │   │   ├── BenchConfig.cpp
        │   │   │   └── BenchConfig.h
        │   │   └── strategies
        │   │   │   ├── FailoverStrategy.cpp
        │   │   │   ├── FailoverStrategy.h
        │   │   │   ├── SinglePoolStrategy.cpp
        │   │   │   ├── SinglePoolStrategy.h
        │   │   │   └── StrategyProxy.h
        │   ├── tls
        │   │   ├── ServerTls.cpp
        │   │   ├── ServerTls.h
        │   │   ├── TlsConfig.cpp
        │   │   ├── TlsConfig.h
        │   │   ├── TlsContext.cpp
        │   │   ├── TlsContext.h
        │   │   ├── TlsGen.cpp
        │   │   └── TlsGen.h
        │   └── tools
        │   │   ├── LineReader.cpp
        │   │   ├── LineReader.h
        │   │   ├── MemPool.h
        │   │   ├── NetBuffer.cpp
        │   │   ├── NetBuffer.h
        │   │   ├── Storage.h
        │   │   ├── TcpServer.cpp
        │   │   └── TcpServer.h
        └── tools
        │   ├── Alignment.h
        │   ├── Arguments.cpp
        │   ├── Arguments.h
        │   ├── Baton.h
        │   ├── Buffer.h
        │   ├── Chrono.cpp
        │   ├── Chrono.h
        │   ├── Cvt.cpp
        │   ├── Cvt.h
        │   ├── Handle.h
        │   ├── Object.h
        │   ├── Span.h
        │   ├── String.cpp
        │   ├── String.h
        │   ├── Timer.cpp
        │   ├── Timer.h
        │   ├── bswap_64.h
        │   └── cryptonote
        │       ├── BlobReader.h
        │       ├── BlockTemplate.cpp
        │       ├── BlockTemplate.h
        │       ├── Signatures.cpp
        │       ├── Signatures.h
        │       ├── WalletAddress.cpp
        │       ├── WalletAddress.h
        │       ├── crypto-ops-data.c
        │       ├── crypto-ops.c
        │       ├── crypto-ops.h
        │       └── umul128.h
    ├── config.json
    ├── core
        ├── Controller.cpp
        ├── Controller.h
        ├── Miner.cpp
        ├── Miner.h
        ├── Taskbar.cpp
        ├── Taskbar.h
        └── config
        │   ├── Config.cpp
        │   ├── Config.h
        │   ├── ConfigTransform.cpp
        │   ├── ConfigTransform.h
        │   ├── Config_default.h
        │   ├── Config_platform.h
        │   └── usage.h
    ├── crypto
        ├── argon2
        │   ├── Hash.h
        │   ├── Impl.cpp
        │   └── Impl.h
        ├── cn
        │   ├── CnAlgo.h
        │   ├── CnCtx.cpp
        │   ├── CnCtx.h
        │   ├── CnHash.cpp
        │   ├── CnHash.h
        │   ├── CryptoNight.h
        │   ├── CryptoNight_arm.h
        │   ├── CryptoNight_monero.h
        │   ├── CryptoNight_test.h
        │   ├── CryptoNight_x86.h
        │   ├── CryptoNight_x86_vaes.cpp
        │   ├── CryptoNight_x86_vaes.h
        │   ├── asm
        │   │   ├── CryptonightR_soft_aes_template.inc
        │   │   ├── CryptonightR_soft_aes_template_win.inc
        │   │   ├── CryptonightR_template.S
        │   │   ├── CryptonightR_template.asm
        │   │   ├── CryptonightR_template.h
        │   │   ├── CryptonightR_template.inc
        │   │   ├── CryptonightR_template_win.inc
        │   │   ├── cn1
        │   │   │   ├── cnv1_double_main_loop.inc
        │   │   │   ├── cnv1_quad_main_loop.inc
        │   │   │   └── cnv1_single_main_loop.inc
        │   │   ├── cn2
        │   │   │   ├── cnv2_double_main_loop_sandybridge.inc
        │   │   │   ├── cnv2_main_loop_bulldozer.inc
        │   │   │   ├── cnv2_main_loop_ivybridge.inc
        │   │   │   ├── cnv2_main_loop_ryzen.inc
        │   │   │   ├── cnv2_rwz_double_main_loop.inc
        │   │   │   ├── cnv2_rwz_main_loop.inc
        │   │   │   └── cnv2_upx_double_mainloop_zen3.inc
        │   │   ├── cn_main_loop.S
        │   │   ├── cn_main_loop.asm
        │   │   └── win64
        │   │   │   ├── CryptonightR_soft_aes_template_win.inc
        │   │   │   ├── CryptonightR_template.asm
        │   │   │   ├── CryptonightR_template_win.inc
        │   │   │   ├── cn1
        │   │   │       ├── cnv1_double_main_loop.inc
        │   │   │       ├── cnv1_quad_main_loop.inc
        │   │   │       └── cnv1_single_main_loop.inc
        │   │   │   ├── cn2
        │   │   │       ├── cnv2_double_main_loop_sandybridge.inc
        │   │   │       ├── cnv2_main_loop_bulldozer.inc
        │   │   │       ├── cnv2_main_loop_ivybridge.inc
        │   │   │       ├── cnv2_main_loop_ryzen.inc
        │   │   │       ├── cnv2_rwz_double_main_loop.inc
        │   │   │       ├── cnv2_rwz_main_loop.inc
        │   │   │       └── cnv2_upx_double_mainloop_zen3.inc
        │   │   │   ├── cn_main_loop.S
        │   │   │   └── cn_main_loop.asm
        │   ├── c_blake256.c
        │   ├── c_blake256.h
        │   ├── c_groestl.c
        │   ├── c_groestl.h
        │   ├── c_jh.c
        │   ├── c_jh.h
        │   ├── c_skein.c
        │   ├── c_skein.h
        │   ├── groestl_tables.h
        │   ├── hash.h
        │   ├── r
        │   │   ├── CryptonightR_gen.cpp
        │   │   └── variant4_random_math.h
        │   ├── skein_port.h
        │   ├── soft_aes.h
        │   └── sse2neon.h
        ├── common
        │   ├── Assembly.cpp
        │   ├── Assembly.h
        │   ├── HugePagesInfo.cpp
        │   ├── HugePagesInfo.h
        │   ├── LinuxMemory.cpp
        │   ├── LinuxMemory.h
        │   ├── MemoryPool.cpp
        │   ├── MemoryPool.h
        │   ├── NUMAMemoryPool.cpp
        │   ├── NUMAMemoryPool.h
        │   ├── Nonce.cpp
        │   ├── Nonce.h
        │   ├── VirtualMemory.cpp
        │   ├── VirtualMemory.h
        │   ├── VirtualMemory_hwloc.cpp
        │   ├── VirtualMemory_unix.cpp
        │   ├── VirtualMemory_win.cpp
        │   └── portable
        │   │   └── mm_malloc.h
        ├── ghostrider
        │   ├── CMakeLists.txt
        │   ├── README.md
        │   ├── aes_helper.c
        │   ├── ghostrider.cpp
        │   ├── ghostrider.h
        │   ├── md_helper.c
        │   ├── sph_blake.c
        │   ├── sph_blake.h
        │   ├── sph_bmw.c
        │   ├── sph_bmw.h
        │   ├── sph_cubehash.c
        │   ├── sph_cubehash.h
        │   ├── sph_echo.c
        │   ├── sph_echo.h
        │   ├── sph_fugue.c
        │   ├── sph_fugue.h
        │   ├── sph_groestl.c
        │   ├── sph_groestl.h
        │   ├── sph_hamsi.c
        │   ├── sph_hamsi.h
        │   ├── sph_hamsi_helper.c
        │   ├── sph_jh.c
        │   ├── sph_jh.h
        │   ├── sph_keccak.c
        │   ├── sph_keccak.h
        │   ├── sph_luffa.c
        │   ├── sph_luffa.h
        │   ├── sph_sha2.c
        │   ├── sph_sha2.h
        │   ├── sph_shabal.c
        │   ├── sph_shabal.h
        │   ├── sph_shavite.c
        │   ├── sph_shavite.h
        │   ├── sph_simd.c
        │   ├── sph_simd.h
        │   ├── sph_skein.c
        │   ├── sph_skein.h
        │   ├── sph_types.h
        │   ├── sph_whirlpool.c
        │   └── sph_whirlpool.h
        ├── kawpow
        │   ├── KPCache.cpp
        │   ├── KPCache.h
        │   ├── KPHash.cpp
        │   └── KPHash.h
        ├── randomx
        │   ├── aes_hash.cpp
        │   ├── aes_hash.hpp
        │   ├── allocator.cpp
        │   ├── allocator.hpp
        │   ├── asm
        │   │   ├── program_epilogue_linux.inc
        │   │   ├── program_epilogue_store.inc
        │   │   ├── program_epilogue_win64.inc
        │   │   ├── program_imul_rcp_store.inc
        │   │   ├── program_loop_load.inc
        │   │   ├── program_loop_load_xop.inc
        │   │   ├── program_loop_store.inc
        │   │   ├── program_prologue_linux.inc
        │   │   ├── program_prologue_win64.inc
        │   │   ├── program_read_dataset.inc
        │   │   ├── program_read_dataset_sshash_fin.inc
        │   │   ├── program_read_dataset_sshash_init.inc
        │   │   ├── program_sshash_avx2_constants.inc
        │   │   ├── program_sshash_avx2_epilogue.inc
        │   │   ├── program_sshash_avx2_loop_begin.inc
        │   │   ├── program_sshash_avx2_loop_end.inc
        │   │   ├── program_sshash_avx2_save_registers.inc
        │   │   ├── program_sshash_avx2_ssh_load.inc
        │   │   ├── program_sshash_avx2_ssh_prefetch.inc
        │   │   ├── program_sshash_constants.inc
        │   │   ├── program_sshash_load.inc
        │   │   ├── program_sshash_prefetch.inc
        │   │   ├── program_xmm_constants.inc
        │   │   └── randomx_reciprocal.inc
        │   ├── blake2
        │   │   ├── avx2
        │   │   │   ├── LICENSE
        │   │   │   ├── blake2.h
        │   │   │   ├── blake2b-common.h
        │   │   │   ├── blake2b-load-avx2.h
        │   │   │   ├── blake2b.h
        │   │   │   └── blake2b_avx2.c
        │   │   ├── blake2-impl.h
        │   │   ├── blake2.h
        │   │   ├── blake2b-round.h
        │   │   ├── blake2b.c
        │   │   ├── blake2b_sse41.c
        │   │   ├── blamka-round-ref.h
        │   │   └── endian.h
        │   ├── blake2_generator.cpp
        │   ├── blake2_generator.hpp
        │   ├── bytecode_machine.cpp
        │   ├── bytecode_machine.hpp
        │   ├── common.hpp
        │   ├── configuration.h
        │   ├── dataset.cpp
        │   ├── dataset.hpp
        │   ├── instruction.hpp
        │   ├── instructions_portable.cpp
        │   ├── intrin_portable.h
        │   ├── jit_compiler.hpp
        │   ├── jit_compiler_a64.cpp
        │   ├── jit_compiler_a64.hpp
        │   ├── jit_compiler_a64_static.S
        │   ├── jit_compiler_a64_static.hpp
        │   ├── jit_compiler_fallback.cpp
        │   ├── jit_compiler_fallback.hpp
        │   ├── jit_compiler_x86.cpp
        │   ├── jit_compiler_x86.hpp
        │   ├── jit_compiler_x86_static.S
        │   ├── jit_compiler_x86_static.asm
        │   ├── jit_compiler_x86_static.hpp
        │   ├── program.hpp
        │   ├── randomx.cpp
        │   ├── randomx.h
        │   ├── reciprocal.c
        │   ├── reciprocal.h
        │   ├── soft_aes.cpp
        │   ├── soft_aes.h
        │   ├── superscalar.cpp
        │   ├── superscalar.hpp
        │   ├── superscalar_program.hpp
        │   ├── virtual_machine.cpp
        │   ├── virtual_machine.hpp
        │   ├── virtual_memory.cpp
        │   ├── virtual_memory.hpp
        │   ├── vm_compiled.cpp
        │   ├── vm_compiled.hpp
        │   ├── vm_compiled_light.cpp
        │   ├── vm_compiled_light.hpp
        │   ├── vm_interpreted.cpp
        │   ├── vm_interpreted.hpp
        │   ├── vm_interpreted_light.cpp
        │   └── vm_interpreted_light.hpp
        └── rx
        │   ├── Profiler.cpp
        │   ├── Profiler.h
        │   ├── Rx.cpp
        │   ├── Rx.h
        │   ├── RxAlgo.cpp
        │   ├── RxAlgo.h
        │   ├── RxBasicStorage.cpp
        │   ├── RxBasicStorage.h
        │   ├── RxCache.cpp
        │   ├── RxCache.h
        │   ├── RxConfig.cpp
        │   ├── RxConfig.h
        │   ├── RxDataset.cpp
        │   ├── RxDataset.h
        │   ├── RxFix.h
        │   ├── RxFix_linux.cpp
        │   ├── RxFix_win.cpp
        │   ├── RxMsr.cpp
        │   ├── RxMsr.h
        │   ├── RxNUMAStorage.cpp
        │   ├── RxNUMAStorage.h
        │   ├── RxQueue.cpp
        │   ├── RxQueue.h
        │   ├── RxSeed.h
        │   ├── RxVm.cpp
        │   └── RxVm.h
    ├── donate.h
    ├── hw
        ├── api
        │   ├── HwApi.cpp
        │   ├── HwApi.h
        │   └── api.cmake
        ├── dmi
        │   ├── DmiBoard.cpp
        │   ├── DmiBoard.h
        │   ├── DmiMemory.cpp
        │   ├── DmiMemory.h
        │   ├── DmiReader.cpp
        │   ├── DmiReader.h
        │   ├── DmiReader_mac.cpp
        │   ├── DmiReader_unix.cpp
        │   ├── DmiReader_win.cpp
        │   ├── DmiTools.cpp
        │   ├── DmiTools.h
        │   └── dmi.cmake
        └── msr
        │   ├── Msr.cpp
        │   ├── Msr.h
        │   ├── MsrItem.cpp
        │   ├── MsrItem.h
        │   ├── Msr_linux.cpp
        │   └── Msr_win.cpp
    ├── net
        ├── JobResult.h
        ├── JobResults.cpp
        ├── JobResults.h
        ├── Network.cpp
        ├── Network.h
        ├── interfaces
        │   └── IJobResultListener.h
        └── strategies
        │   ├── DonateStrategy.cpp
        │   └── DonateStrategy.h
    ├── version.h
    └── xmrig.cpp


/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
 1 | ---
 2 | name: Bug report
 3 | about: Create a report to help us improve
 4 | title: ''
 5 | labels: ''
 6 | assignees: ''
 7 | 
 8 | ---
 9 | 
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 | 
13 | **To Reproduce**
14 | Steps to reproduce the behavior.
15 | 
16 | **Expected behavior**
17 | A clear and concise description of what you expected to happen.
18 | 
19 | **Required data**
20 |  - XMRig version
21 |     - Either the exact link to a release you downloaded from https://github.com/xmrig/xmrig/releases
22 |     - Or the exact command lines that you used to build XMRig
23 |  - Miner log as text or screenshot
24 |  - Config file or command line (without wallets)
25 |  - OS: [e.g. Windows]
26 |  - For GPU related issues: information about GPUs and driver version.
27 | 
28 | **Additional context**
29 | Add any other context about the problem here.
30 | 


--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | scripts/build
3 | scripts/deps
4 | /CMakeLists.txt.user
5 | /.idea
6 | /src/backend/opencl/cl/cn/cryptonight_gen.cl
7 | 


--------------------------------------------------------------------------------
/bin/WinRing0/LICENSE:
--------------------------------------------------------------------------------
 1 | Copyright (c) 2007-2009 OpenLibSys.org. All rights reserved.
 2 | 
 3 | Redistribution and use in source and binary forms, with or without
 4 | modification, are permitted provided that the following conditions
 5 | are met:
 6 | 1. Redistributions of source code must retain the above copyright
 7 |    notice, this list of conditions and the following disclaimer.
 8 | 2. Redistributions in binary form must reproduce the above copyright
 9 |    notice, this list of conditions and the following disclaimer in the
10 |    documentation and/or other materials provided with the distribution.
11 | 
12 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
/bin/WinRing0/WinRing0x64.sys:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmrig/xmrig/6e4a5a6d94b33d6ed93890126c699b62f9553f50/bin/WinRing0/WinRing0x64.sys


--------------------------------------------------------------------------------
/cmake/FindHWLOC.cmake:
--------------------------------------------------------------------------------
 1 | find_path(
 2 |     HWLOC_INCLUDE_DIR
 3 |     NAMES hwloc.h
 4 |     PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
 5 |     PATH_SUFFIXES "include"
 6 |     NO_DEFAULT_PATH
 7 | )
 8 | 
 9 | find_path(HWLOC_INCLUDE_DIR NAMES hwloc.h)
10 | 
11 | find_library(
12 |     HWLOC_LIBRARY
13 |     NAMES hwloc.a hwloc libhwloc
14 |     PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
15 |     PATH_SUFFIXES "lib"
16 |     NO_DEFAULT_PATH
17 | )
18 | 
19 | find_library(HWLOC_LIBRARY NAMES hwloc.a hwloc libhwloc)
20 | 
21 | set(HWLOC_LIBRARIES ${HWLOC_LIBRARY})
22 | set(HWLOC_INCLUDE_DIRS ${HWLOC_INCLUDE_DIR})
23 | 
24 | include(FindPackageHandleStandardArgs)
25 | find_package_handle_standard_args(HWLOC DEFAULT_MSG HWLOC_LIBRARY HWLOC_INCLUDE_DIR)
26 | 


--------------------------------------------------------------------------------
/cmake/FindUV.cmake:
--------------------------------------------------------------------------------
 1 | find_path(
 2 |     UV_INCLUDE_DIR
 3 |     NAMES uv.h
 4 |     PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
 5 |     PATH_SUFFIXES "include"
 6 |     NO_DEFAULT_PATH
 7 | )
 8 | 
 9 | find_path(UV_INCLUDE_DIR NAMES uv.h)
10 | 
11 | find_library(
12 |     UV_LIBRARY
13 |     NAMES libuv.a uv libuv
14 |     PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS"
15 |     PATH_SUFFIXES "lib"
16 |     NO_DEFAULT_PATH
17 | )
18 | 
19 | find_library(UV_LIBRARY NAMES libuv.a uv libuv)
20 | 
21 | set(UV_LIBRARIES ${UV_LIBRARY})
22 | set(UV_INCLUDE_DIRS ${UV_INCLUDE_DIR})
23 | 
24 | include(FindPackageHandleStandardArgs)
25 | find_package_handle_standard_args(UV DEFAULT_MSG UV_LIBRARY UV_INCLUDE_DIR)
26 | 


--------------------------------------------------------------------------------
/cmake/argon2.cmake:
--------------------------------------------------------------------------------
 1 | if (WITH_ARGON2)
 2 |     add_definitions(/DXMRIG_ALGO_ARGON2)
 3 | 
 4 |     list(APPEND HEADERS_CRYPTO
 5 |         src/crypto/argon2/Hash.h
 6 |         src/crypto/argon2/Impl.h
 7 |     )
 8 | 
 9 |     list(APPEND SOURCES_CRYPTO
10 |         src/crypto/argon2/Impl.cpp
11 |     )
12 | 
13 |     add_subdirectory(src/3rdparty/argon2)
14 |     set(ARGON2_LIBRARY argon2)
15 | else()
16 |     remove_definitions(/DXMRIG_ALGO_ARGON2)
17 |     set(ARGON2_LIBRARY "")
18 | endif()
19 | 


--------------------------------------------------------------------------------
/cmake/ghostrider.cmake:
--------------------------------------------------------------------------------
1 | if (WITH_GHOSTRIDER)
2 |     add_definitions(/DXMRIG_ALGO_GHOSTRIDER)
3 |     add_subdirectory(src/crypto/ghostrider)
4 |     set(GHOSTRIDER_LIBRARY ghostrider)
5 | else()
6 |     remove_definitions(/DXMRIG_ALGO_GHOSTRIDER)
7 |     set(GHOSTRIDER_LIBRARY "")
8 | endif()
9 | 


--------------------------------------------------------------------------------
/cmake/kawpow.cmake:
--------------------------------------------------------------------------------
 1 | if (WITH_KAWPOW)
 2 |     add_definitions(/DXMRIG_ALGO_KAWPOW)
 3 | 
 4 |     list(APPEND HEADERS_CRYPTO
 5 |         src/crypto/kawpow/KPCache.h
 6 |         src/crypto/kawpow/KPHash.h
 7 |     )
 8 | 
 9 |     list(APPEND SOURCES_CRYPTO
10 |         src/crypto/kawpow/KPCache.cpp
11 |         src/crypto/kawpow/KPHash.cpp
12 |     )
13 | 
14 |     add_subdirectory(src/3rdparty/libethash)
15 |     set(ETHASH_LIBRARY ethash)
16 | else()
17 |     remove_definitions(/DXMRIG_ALGO_KAWPOW)
18 |     set(ETHASH_LIBRARY "")
19 | endif()
20 | 


--------------------------------------------------------------------------------
/cmake/os.cmake:
--------------------------------------------------------------------------------
 1 | if (WIN32)
 2 |     set(XMRIG_OS_WIN ON)
 3 | elseif (APPLE)
 4 |     set(XMRIG_OS_APPLE ON)
 5 | 
 6 |     if (IOS OR CMAKE_SYSTEM_NAME STREQUAL iOS)
 7 |         set(XMRIG_OS_IOS ON)
 8 |     else()
 9 |         set(XMRIG_OS_MACOS ON)
10 |     endif()
11 | else()
12 |     set(XMRIG_OS_UNIX ON)
13 | 
14 |     if (ANDROID OR CMAKE_SYSTEM_NAME MATCHES "Android")
15 |         set(XMRIG_OS_ANDROID ON)
16 |     elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
17 |         set(XMRIG_OS_LINUX ON)
18 |     elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL DragonFly)
19 |         set(XMRIG_OS_FREEBSD ON)
20 |     endif()
21 | endif()
22 | 
23 | if (XMRIG_OS_WIN)
24 |     add_definitions(-DWIN32 -DXMRIG_OS_WIN)
25 | elseif(XMRIG_OS_APPLE)
26 |     add_definitions(-DXMRIG_OS_APPLE)
27 | 
28 |     if (XMRIG_OS_IOS)
29 |         add_definitions(-DXMRIG_OS_IOS)
30 |     else()
31 |         add_definitions(-DXMRIG_OS_MACOS)
32 |     endif()
33 | 
34 |     if (XMRIG_ARM)
35 |         set(WITH_SECURE_JIT ON)
36 |     endif()
37 | elseif(XMRIG_OS_UNIX)
38 |     add_definitions(-DXMRIG_OS_UNIX)
39 | 
40 |     if (XMRIG_OS_ANDROID)
41 |         add_definitions(-DXMRIG_OS_ANDROID)
42 |     elseif (XMRIG_OS_LINUX)
43 |         add_definitions(-DXMRIG_OS_LINUX)
44 |     elseif (XMRIG_OS_FREEBSD)
45 |         add_definitions(-DXMRIG_OS_FREEBSD)
46 |     endif()
47 | endif()
48 | 
49 | if (WITH_SECURE_JIT)
50 |     add_definitions(-DXMRIG_SECURE_JIT)
51 | endif()
52 | 


--------------------------------------------------------------------------------
/doc/BENCHMARK.md:
--------------------------------------------------------------------------------
 1 | # Embedded benchmark
 2 | 
 3 | You can run with XMRig with the following commands:
 4 | ```
 5 | xmrig --bench=1M
 6 | xmrig --bench=10M
 7 | xmrig --bench=1M -a rx/wow
 8 | xmrig --bench=10M -a rx/wow
 9 | ```
10 | This will run between 1 and 10 million RandomX hashes, depending on `bench` parameter, and print the time it took. First two commands use Monero variant (2 MB per thread, best for Zen2/Zen3 CPUs), second two commands use Wownero variant (1 MB per thread, useful for Intel and 1st gen Zen/Zen+ CPUs).
11 | 
12 | Checksum of all the hashes will be also printed to check stability of your hardware: if it's green then it's correct, if it's red then there was hardware error during computation. No Internet connection is required for the benchmark.
13 | 
14 | Double check that you see `Huge pages 100%` both for dataset and for all threads, and also check for `msr register values ... has been set successfully` - without this result will be far from the best. Running as administrator is required for MSR and huge pages to be set up properly.
15 | 
16 | ![Benchmark example](https://i.imgur.com/PST3BYc.png)
17 | 
18 | ### Benchmark with custom config
19 | 
20 | You can run benchmark with any configuration you want. Just start without command line parameteres, use regular config.json and add `"benchmark":"1M",` on the next line after pool url. 
21 | 
22 | # Stress test
23 | 
24 | You can also run continuous stress-test that is as close to the real RandomX mining as possible and doesn't require any configuration:
25 | ```
26 | xmrig --stress
27 | xmrig --stress -a rx/wow
28 | ```
29 | This will require Internet connection and will run indefinitely.


--------------------------------------------------------------------------------
/doc/CPU_MAX_USAGE.md:
--------------------------------------------------------------------------------
 1 | # Maximum CPU usage
 2 | 
 3 | Please read this document carefully, `max-threads-hint` (was known as `max-cpu-usage`) option is most confusing option in the miner with many myth and legends.
 4 | This option is just hint for automatic configuration and can't precise define CPU usage.
 5 | 
 6 | ### Option definition
 7 | #### Config file:
 8 | ```json
 9 | {
10 |     ...
11 |     "cpu": {
12 |         "max-threads-hint": 100,
13 |         ...
14 |     },
15 |     ...
16 | }
17 | ```
18 | 
19 | #### Command line
20 | `--cpu-max-threads-hint 100`
21 | 
22 | ### Known issues and usage
23 | 
24 | * This option has no effect if miner already generated CPU configuration, to prevent config generation use `"autosave":false,`.
25 | * Only threads count can be changed, for 1 core CPU this option has no effect, for 2 core CPU only 2 values possible 50% and 100%, for 4 cores: 25%, 50%, 75%, 100%. etc. 
26 | * You CPU may limited by other factors, eg cache.
27 | 


--------------------------------------------------------------------------------
/doc/PERSISTENT_OPTIONS.md:
--------------------------------------------------------------------------------
 1 | # Persistent options
 2 | 
 3 | Options in list below can't changed in runtime by watching config file or via API.
 4 | 
 5 | * `background`
 6 | * `donate-level`
 7 | * `cpu/argon2-impl`
 8 | * `opencl/loader`
 9 | * `opencl/platform`
10 | 


--------------------------------------------------------------------------------
/doc/api/1/threads.json:
--------------------------------------------------------------------------------
 1 | {
 2 |     "hugepages": [
 3 |         4,
 4 |         4
 5 |     ],
 6 |     "memory": 8388608,
 7 |     "threads": [
 8 |         {
 9 |             "type": "cpu",
10 |             "algo": "cryptonight",
11 |             "av": 1,
12 |             "low_power_mode": 1,
13 |             "affine_to_cpu": 0,
14 |             "priority": -1,
15 |             "soft_aes": false,
16 |             "hashrate": [
17 |                 73.39,
18 |                 73.4,
19 |                 73.28
20 |             ]
21 |         },
22 |         {
23 |             "type": "cpu",
24 |             "algo": "cryptonight",
25 |             "av": 1,
26 |             "low_power_mode": 1,
27 |             "affine_to_cpu": 1,
28 |             "priority": -1,
29 |             "soft_aes": false,
30 |             "hashrate": [
31 |                 74.72,
32 |                 74.72,
33 |                 74.7
34 |             ]
35 |         },
36 |         {
37 |             "type": "cpu",
38 |             "algo": "cryptonight",
39 |             "av": 1,
40 |             "low_power_mode": 1,
41 |             "affine_to_cpu": 2,
42 |             "priority": -1,
43 |             "soft_aes": false,
44 |             "hashrate": [
45 |                 74.71,
46 |                 74.72,
47 |                 74.7
48 |             ]
49 |         },
50 |         {
51 |             "type": "cpu",
52 |             "algo": "cryptonight",
53 |             "av": 1,
54 |             "low_power_mode": 1,
55 |             "affine_to_cpu": 3,
56 |             "priority": -1,
57 |             "soft_aes": false,
58 |             "hashrate": [
59 |                 73.39,
60 |                 73.4,
61 |                 73.28
62 |             ]
63 |         }
64 |     ]
65 | }


--------------------------------------------------------------------------------
/doc/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmrig/xmrig/6e4a5a6d94b33d6ed93890126c699b62f9553f50/doc/screenshot.png


--------------------------------------------------------------------------------
/doc/screenshot_v5_2_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmrig/xmrig/6e4a5a6d94b33d6ed93890126c699b62f9553f50/doc/screenshot_v5_2_0.png


--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "name": "xmrig",
 3 |   "version": "3.0.0",
 4 |   "description": "RandomX, CryptoNight and Argon2 miner",
 5 |   "main": "index.js",
 6 |   "directories": {
 7 |     "doc": "doc"
 8 |   },
 9 |   "scripts": {
10 |     "build": "node scripts/generate_cl.js"
11 |   },
12 |   "repository": {
13 |     "type": "git",
14 |     "url": "git+https://github.com/xmrig/xmrig.git"
15 |   },
16 |   "keywords": [],
17 |   "author": "",
18 |   "license": "GPLv3",
19 |   "bugs": {
20 |     "url": "https://github.com/xmrig/xmrig/issues"
21 |   },
22 |   "homepage": "https://github.com/xmrig/xmrig#readme"
23 | }
24 | 


--------------------------------------------------------------------------------
/res/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmrig/xmrig/6e4a5a6d94b33d6ed93890126c699b62f9553f50/res/app.ico


--------------------------------------------------------------------------------
/res/app.rc:
--------------------------------------------------------------------------------
 1 | #include <windows.h>
 2 | #include "../src/version.h"
 3 | 
 4 | 101 ICON "app.ico"
 5 | 
 6 | VS_VERSION_INFO VERSIONINFO
 7 |   FILEVERSION APP_VER_MAJOR,APP_VER_MINOR,APP_VER_PATCH,0
 8 |   PRODUCTVERSION APP_VER_MAJOR,APP_VER_MINOR,APP_VER_PATCH,0
 9 |   FILEFLAGSMASK 0x3fL
10 | #ifdef _DEBUG
11 |   FILEFLAGS VS_FF_DEBUG
12 | #else
13 |   FILEFLAGS 0x0L
14 | #endif
15 |   FILEOS VOS__WINDOWS32
16 |   FILETYPE VFT_APP
17 |   FILESUBTYPE 0x0L
18 |   BEGIN
19 |     BLOCK "StringFileInfo"
20 |     BEGIN
21 |       BLOCK "000004b0"
22 |       BEGIN
23 |         VALUE "CompanyName",      APP_SITE
24 |         VALUE "FileDescription",  APP_DESC
25 |         VALUE "FileVersion",      APP_VERSION
26 |         VALUE "LegalCopyright",   APP_COPYRIGHT
27 |         VALUE "OriginalFilename", "xmrig.exe"
28 |         VALUE "ProductName",      APP_NAME
29 |         VALUE "ProductVersion",   APP_VERSION
30 |       END
31 |     END
32 |     BLOCK "VarFileInfo"
33 |     BEGIN
34 |       VALUE "Translation", 0x0, 1200
35 |     END
36 |   END
37 | 
38 | 


--------------------------------------------------------------------------------
/scripts/benchmark_10M.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d "%~dp0"
3 | xmrig.exe --bench=10M --submit
4 | pause
5 | 


--------------------------------------------------------------------------------
/scripts/benchmark_1M.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd /d "%~dp0"
3 | xmrig.exe --bench=1M --submit
4 | pause
5 | 


--------------------------------------------------------------------------------
/scripts/build.hwloc.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | HWLOC_VERSION_MAJOR="2"
 4 | HWLOC_VERSION_MINOR="12"
 5 | HWLOC_VERSION_PATCH="1"
 6 | 
 7 | HWLOC_VERSION="${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}.${HWLOC_VERSION_PATCH}"
 8 | 
 9 | mkdir -p deps
10 | mkdir -p deps/include
11 | mkdir -p deps/lib
12 | 
13 | mkdir -p build && cd build
14 | 
15 | wget https://download.open-mpi.org/release/hwloc/v${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}/hwloc-${HWLOC_VERSION}.tar.gz -O hwloc-${HWLOC_VERSION}.tar.gz
16 | tar -xzf hwloc-${HWLOC_VERSION}.tar.gz
17 | 
18 | cd hwloc-${HWLOC_VERSION}
19 | ./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2
20 | make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
21 | cp -fr include ../../deps
22 | cp hwloc/.libs/libhwloc.a ../../deps/lib
23 | cd ..
24 | 


--------------------------------------------------------------------------------
/scripts/build.hwloc1.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | HWLOC_VERSION="1.11.13"
 4 | 
 5 | mkdir -p deps
 6 | mkdir -p deps/include
 7 | mkdir -p deps/lib
 8 | 
 9 | mkdir -p build && cd build
10 | 
11 | wget https://download.open-mpi.org/release/hwloc/v1.11/hwloc-${HWLOC_VERSION}.tar.gz -O hwloc-${HWLOC_VERSION}.tar.gz
12 | tar -xzf hwloc-${HWLOC_VERSION}.tar.gz
13 | 
14 | cd hwloc-${HWLOC_VERSION}
15 | ./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2
16 | make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
17 | cp -fr include ../../deps
18 | cp src/.libs/libhwloc.a ../../deps/lib
19 | cd ..


--------------------------------------------------------------------------------
/scripts/build.libressl.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | LIBRESSL_VERSION="3.5.2"
 4 | 
 5 | mkdir -p deps
 6 | mkdir -p deps/include
 7 | mkdir -p deps/lib
 8 | 
 9 | mkdir -p build && cd build
10 | 
11 | wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz -O libressl-${LIBRESSL_VERSION}.tar.gz
12 | tar -xzf libressl-${LIBRESSL_VERSION}.tar.gz
13 | 
14 | cd libressl-${LIBRESSL_VERSION}
15 | ./configure --disable-shared
16 | make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
17 | cp -fr include ../../deps
18 | cp crypto/.libs/libcrypto.a ../../deps/lib
19 | cp ssl/.libs/libssl.a ../../deps/lib
20 | cd ..
21 | 


--------------------------------------------------------------------------------
/scripts/build.openssl.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | OPENSSL_VERSION="1.1.1u"
 4 | 
 5 | mkdir -p deps
 6 | mkdir -p deps/include
 7 | mkdir -p deps/lib
 8 | 
 9 | mkdir -p build && cd build
10 | 
11 | wget https://openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz -O openssl-${OPENSSL_VERSION}.tar.gz
12 | tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
13 | 
14 | cd openssl-${OPENSSL_VERSION}
15 | ./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms
16 | make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
17 | cp -fr include ../../deps
18 | cp libcrypto.a ../../deps/lib
19 | cp libssl.a ../../deps/lib
20 | cd ..
21 | 


--------------------------------------------------------------------------------
/scripts/build.openssl3.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | OPENSSL_VERSION="3.0.16"
 4 | 
 5 | mkdir -p deps
 6 | mkdir -p deps/include
 7 | mkdir -p deps/lib
 8 | 
 9 | mkdir -p build && cd build
10 | 
11 | wget https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}.tar.gz -O openssl-${OPENSSL_VERSION}.tar.gz
12 | tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
13 | 
14 | cd openssl-${OPENSSL_VERSION}
15 | ./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms
16 | make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
17 | cp -fr include ../../deps
18 | cp libcrypto.a ../../deps/lib
19 | cp libssl.a ../../deps/lib
20 | cd ..
21 | 


--------------------------------------------------------------------------------
/scripts/build.uv.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | UV_VERSION="1.51.0"
 4 | 
 5 | mkdir -p deps
 6 | mkdir -p deps/include
 7 | mkdir -p deps/lib
 8 | 
 9 | mkdir -p build && cd build
10 | 
11 | wget https://dist.libuv.org/dist/v${UV_VERSION}/libuv-v${UV_VERSION}.tar.gz -O v${UV_VERSION}.tar.gz
12 | tar -xzf v${UV_VERSION}.tar.gz
13 | 
14 | cd libuv-v${UV_VERSION}
15 | sh autogen.sh
16 | ./configure --disable-shared
17 | make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu)
18 | cp -fr include ../../deps
19 | cp .libs/libuv.a ../../deps/lib
20 | cd ..
21 | 


--------------------------------------------------------------------------------
/scripts/build_deps.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 | 
3 | ./build.uv.sh
4 | ./build.hwloc.sh
5 | ./build.openssl3.sh


--------------------------------------------------------------------------------
/scripts/enable_1gb_pages.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/sh -e
 2 | 
 3 | # https://xmrig.com/docs/miner/hugepages#onegb-huge-pages
 4 | 
 5 | sysctl -w vm.nr_hugepages=$(nproc)
 6 | 
 7 | for i in $(find /sys/devices/system/node/node* -maxdepth 0 -type d);
 8 | do
 9 |     echo 3 > "$i/hugepages/hugepages-1048576kB/nr_hugepages";
10 | done
11 | 
12 | echo "1GB pages successfully enabled"


--------------------------------------------------------------------------------
/scripts/pool_mine_example.cmd:
--------------------------------------------------------------------------------
 1 | :: Example batch file for mining Monero at a pool
 2 | ::
 3 | :: Format:
 4 | ::	xmrig.exe -o <pool address>:<pool port> -u <pool username/wallet> -p <pool password>
 5 | ::
 6 | :: Fields:
 7 | ::	pool address		The host name of the pool stratum or its IP address, for example pool.hashvault.pro
 8 | ::	pool port 		The port of the pool's stratum to connect to, for example 3333. Check your pool's getting started page.
 9 | ::	pool username/wallet 	For most pools, this is the wallet address you want to mine to. Some pools require a username
10 | ::	pool password 		For most pools this can be just 'x'. For pools using usernames, you may need to provide a password as configured on the pool.
11 | ::
12 | :: List of Monero mining pools:
13 | ::	https://miningpoolstats.stream/monero
14 | ::
15 | :: Choose pools outside of top 5 to help Monero network be more decentralized!
16 | :: Smaller pools also often have smaller fees/payout limits.
17 | 
18 | cd /d "%~dp0"
19 | xmrig.exe -o xmrpool.eu:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x
20 | pause
21 | 


--------------------------------------------------------------------------------
/scripts/rtm_ghostrider_example.cmd:
--------------------------------------------------------------------------------
 1 | :: Example batch file for mining Raptoreum at a pool
 2 | ::
 3 | :: Format:
 4 | ::      xmrig.exe -a gr -o <pool address>:<pool port> -u <pool username/wallet> -p <pool password>
 5 | ::
 6 | :: Fields:
 7 | ::      pool address            The host name of the pool stratum or its IP address, for example raptoreumemporium.com
 8 | ::      pool port               The port of the pool's stratum to connect to, for example 3333. Check your pool's getting started page.
 9 | ::      pool username/wallet    For most pools, this is the wallet address you want to mine to. Some pools require a username
10 | ::      pool password           For most pools this can be just 'x'. For pools using usernames, you may need to provide a password as configured on the pool.
11 | ::
12 | :: List of Raptoreum mining pools:
13 | ::      https://miningpoolstats.stream/raptoreum
14 | ::
15 | :: Choose pools outside of top 5 to help Raptoreum network be more decentralized!
16 | :: Smaller pools also often have smaller fees/payout limits.
17 | 
18 | cd /d "%~dp0"
19 | :: Use this command line to connect to non-SSL port
20 | xmrig.exe -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x
21 | :: Or use this command line to connect to an SSL port
22 | :: xmrig.exe -a gr -o rtm.suprnova.cc:4273 --tls -u WALLET_ADDRESS -p x
23 | pause
24 | 


--------------------------------------------------------------------------------
/scripts/solo_mine_example.cmd:
--------------------------------------------------------------------------------
 1 | :: Example batch file for mining Monero solo
 2 | ::
 3 | :: Format:
 4 | ::	xmrig.exe -o <node address>:<node port> -a rx/0 -u <wallet address> --daemon
 5 | ::
 6 | :: Fields:
 7 | ::	node address		The host name of your monerod node or its IP address. It can also be a public node with RPC enabled, for example node.xmr.to
 8 | ::	node port 		The RPC port of your monerod node to connect to, usually 18081.
 9 | ::	wallet address		Check your Monero CLI or GUI wallet to see your wallet's address.
10 | ::
11 | :: Mining solo is the best way to help Monero network be more decentralized!
12 | :: But you will only get a payout when you find a block which can take more than a year for a single low-end PC.
13 | 
14 | cd /d "%~dp0"
15 | xmrig.exe -o YOUR_NODE_IP:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon
16 | pause
17 | 


--------------------------------------------------------------------------------
/src/3rdparty/CL/LICENSE:
--------------------------------------------------------------------------------
 1 | Copyright (c) 2008-2015 The Khronos Group Inc.
 2 | 
 3 | Permission is hereby granted, free of charge, to any person obtaining a
 4 | copy of this software and/or associated documentation files (the
 5 | "Materials"), to deal in the Materials without restriction, including
 6 | without limitation the rights to use, copy, modify, merge, publish,
 7 | distribute, sublicense, and/or sell copies of the Materials, and to
 8 | permit persons to whom the Materials are furnished to do so, subject to
 9 | the following conditions:
10 | 
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Materials.
13 | 
14 | MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15 | KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
16 | SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
17 |    https://www.khronos.org/registry/
18 | 
19 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 | MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26 | 


--------------------------------------------------------------------------------
/src/3rdparty/CL/README.md:
--------------------------------------------------------------------------------
 1 | # OpenCL<sup>TM</sup> API Headers
 2 | 
 3 | This repository contains C language headers for the OpenCL API.
 4 | 
 5 | The authoritative public repository for these headers is located at:
 6 | 
 7 | https://github.com/KhronosGroup/OpenCL-Headers
 8 | 
 9 | Issues, proposed fixes for issues, and other suggested changes should be
10 | created using Github.
11 | 
12 | ## Branch Structure
13 | 
14 | The OpenCL API headers in this repository are Unified headers and are designed
15 | to work with all released OpenCL versions.  This differs from previous OpenCL
16 | API headers, where version-specific API headers either existed in separate
17 | branches, or in separate folders in a branch.
18 | 
19 | ## Compiling for a Specific OpenCL Version
20 | 
21 | By default, the OpenCL API headers in this repository are for the latest
22 | OpenCL version (currently OpenCL 2.2).  To use these API headers to target
23 | a different OpenCL version, an application may `#define` the preprocessor
24 | value `CL_TARGET_OPENCL_VERSION` before including the OpenCL API headers.
25 | The `CL_TARGET_OPENCL_VERSION` is a three digit decimal value representing
26 | the OpenCL API version.
27 | 
28 | For example, to enforce usage of no more than the OpenCL 1.2 APIs, you may
29 | include the OpenCL API headers as follows:
30 | 
31 | ```
32 | #define CL_TARGET_OPENCL_VERSION 120
33 | #include <CL/opencl.h>
34 | ```
35 | 
36 | ## Directory Structure
37 | 
38 | ```
39 | README.md               This file
40 | LICENSE                 Source license for the OpenCL API headers
41 | CL/                     Unified OpenCL API headers tree
42 | ```
43 | 
44 | ## License
45 | 
46 | See [LICENSE](LICENSE).
47 | 
48 | ---
49 | 
50 | OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.
51 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | 
26 | #ifndef XMRIG_3RDPARTY_ARGON2_H
27 | #define XMRIG_3RDPARTY_ARGON2_H
28 | 
29 | 
30 | #include "3rdparty/argon2/include/argon2.h"
31 | 
32 | 
33 | #endif /* XMRIG_3RDPARTY_ARGON2_H */
34 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/LICENSE:
--------------------------------------------------------------------------------
 1 | MIT License
 2 | 
 3 | Copyright (c) 2016 Ondrej Mosnáček
 4 | 
 5 | Permission is hereby granted, free of charge, to any person obtaining a copy
 6 | of this software and associated documentation files (the "Software"), to deal
 7 | in the Software without restriction, including without limitation the rights
 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 | 
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 | 
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/generic/lib/argon2-arch.c:
--------------------------------------------------------------------------------
 1 | #include <stdint.h>
 2 | #include <string.h>
 3 | #include <stdlib.h>
 4 | 
 5 | #include "impl-select.h"
 6 | 
 7 | #define rotr64(x, n) (((x) >> (n)) | ((x) << (64 - (n))))
 8 | 
 9 | #include "argon2-template-64.h"
10 | 
11 | void fill_segment_default(const argon2_instance_t *instance,
12 |                           argon2_position_t position)
13 | {
14 |     fill_segment_64(instance, position);
15 | }
16 | 
17 | void argon2_get_impl_list(argon2_impl_list *list)
18 | {
19 |     list->count = 0;
20 | }
21 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/lib/argon2-arch.c:
--------------------------------------------------------------------------------
 1 | #include <stdint.h>
 2 | #include <string.h>
 3 | #include <stdlib.h>
 4 | 
 5 | #include "impl-select.h"
 6 | 
 7 | #include "argon2-sse2.h"
 8 | #include "argon2-ssse3.h"
 9 | #include "argon2-xop.h"
10 | #include "argon2-avx2.h"
11 | #include "argon2-avx512f.h"
12 | 
13 | /* NOTE: there is no portable intrinsic for 64-bit rotate, but any
14 |  * sane compiler should be able to compile this into a ROR instruction: */
15 | #define rotr64(x, n) ((x) >> (n)) | ((x) << (64 - (n)))
16 | 
17 | #include "argon2-template-64.h"
18 | 
19 | void fill_segment_default(const argon2_instance_t *instance,
20 |                           argon2_position_t position)
21 | {
22 |     fill_segment_64(instance, position);
23 | }
24 | 
25 | void argon2_get_impl_list(argon2_impl_list *list)
26 | {
27 |     static const argon2_impl IMPLS[] = {
28 |         { "x86_64",     NULL,                     fill_segment_default },
29 |         { "SSE2",       xmrig_ar2_check_sse2,     xmrig_ar2_fill_segment_sse2 },
30 |         { "SSSE3",      xmrig_ar2_check_ssse3,    xmrig_ar2_fill_segment_ssse3 },
31 |         { "XOP",        xmrig_ar2_check_xop,      xmrig_ar2_fill_segment_xop },
32 |         { "AVX2",       xmrig_ar2_check_avx2,     xmrig_ar2_fill_segment_avx2 },
33 |         { "AVX-512F",   xmrig_ar2_check_avx512f,  xmrig_ar2_fill_segment_avx512f },
34 |     };
35 | 
36 |     list->count = sizeof(IMPLS) / sizeof(IMPLS[0]);
37 |     list->entries = IMPLS;
38 | }
39 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/lib/argon2-avx2.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_AVX2_H
 2 | #define ARGON2_AVX2_H
 3 | 
 4 | #include "core.h"
 5 | 
 6 | void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position);
 7 | int xmrig_ar2_check_avx2(void);
 8 | 
 9 | #endif // ARGON2_AVX2_H
10 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/lib/argon2-avx512f.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_AVX512F_H
 2 | #define ARGON2_AVX512F_H
 3 | 
 4 | #include "core.h"
 5 | 
 6 | void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position);
 7 | int xmrig_ar2_check_avx512f(void);
 8 | 
 9 | #endif // ARGON2_AVX512F_H
10 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/lib/argon2-sse2.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_SSE2_H
 2 | #define ARGON2_SSE2_H
 3 | 
 4 | #include "core.h"
 5 | 
 6 | void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position);
 7 | int xmrig_ar2_check_sse2(void);
 8 | 
 9 | #endif // ARGON2_SSE2_H
10 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/lib/argon2-ssse3.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_SSSE3_H
 2 | #define ARGON2_SSSE3_H
 3 | 
 4 | #include "core.h"
 5 | 
 6 | void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position);
 7 | int xmrig_ar2_check_ssse3(void);
 8 | 
 9 | #endif // ARGON2_SSSE3_H
10 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/lib/argon2-xop.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_XOP_H
 2 | #define ARGON2_XOP_H
 3 | 
 4 | #include "core.h"
 5 | 
 6 | void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position);
 7 | int xmrig_ar2_check_xop(void);
 8 | 
 9 | #endif // ARGON2_XOP_H
10 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/src/test-feature-avx2.c:
--------------------------------------------------------------------------------
1 | #include <x86intrin.h>
2 | 
3 | void function_avx2(__m256i *dst, const __m256i *a, const __m256i *b)
4 | {
5 |     *dst = _mm256_xor_si256(*a, *b);
6 | }
7 | 
8 | int main(void) { return 0; }
9 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/src/test-feature-avx512f.c:
--------------------------------------------------------------------------------
1 | #include <x86intrin.h>
2 | 
3 | void function_avx512f(__m512i *dst, const __m512i *a)
4 | {
5 |     *dst = _mm512_ror_epi64(*a, 57);
6 | }
7 | 
8 | int main(void) { return 0; }
9 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/src/test-feature-sse2.c:
--------------------------------------------------------------------------------
1 | #include <x86intrin.h>
2 | 
3 | void function_sse2(__m128i *dst, const __m128i *a, const __m128i *b)
4 | {
5 |     *dst = _mm_xor_si128(*a, *b);
6 | }
7 | 
8 | int main(void) { return 0; }
9 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/src/test-feature-ssse3.c:
--------------------------------------------------------------------------------
1 | #include <x86intrin.h>
2 | 
3 | void function_ssse3(__m128i *dst, const __m128i *a, const __m128i *b)
4 | {
5 |     *dst = _mm_shuffle_epi8(*a, *b);
6 | }
7 | 
8 | int main(void) { return 0; }
9 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/arch/x86_64/src/test-feature-xop.c:
--------------------------------------------------------------------------------
1 | #include <x86intrin.h>
2 | 
3 | void function_xop(__m128i *dst, const __m128i *a, int b)
4 | {
5 |     *dst = _mm_roti_epi64(*a, b);
6 | }
7 | 
8 | int main(void) { return 0; }
9 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/lib/blake2/blake2.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_BLAKE2_H
 2 | #define ARGON2_BLAKE2_H
 3 | 
 4 | #include <stddef.h>
 5 | #include <stdint.h>
 6 | 
 7 | enum blake2b_constant {
 8 |     BLAKE2B_BLOCKBYTES = 128,
 9 |     BLAKE2B_OUTBYTES = 64,
10 |     BLAKE2B_KEYBYTES = 64,
11 |     BLAKE2B_SALTBYTES = 16,
12 |     BLAKE2B_PERSONALBYTES = 16
13 | };
14 | 
15 | typedef struct __blake2b_state {
16 |     uint64_t h[8];
17 |     uint64_t t[2];
18 |     uint8_t buf[BLAKE2B_BLOCKBYTES];
19 |     size_t buflen;
20 | } blake2b_state;
21 | 
22 | /* Streaming API */
23 | void xmrig_ar2_blake2b_init(blake2b_state *S, size_t outlen);
24 | void xmrig_ar2_blake2b_update(blake2b_state *S, const void *in, size_t inlen);
25 | void xmrig_ar2_blake2b_final(blake2b_state *S, void *out, size_t outlen);
26 | 
27 | void xmrig_ar2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
28 | 
29 | #endif // ARGON2_BLAKE2_H
30 | 
31 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/lib/encoding.h:
--------------------------------------------------------------------------------
 1 | #ifndef ENCODING_H
 2 | #define ENCODING_H
 3 | #include "3rdparty/argon2.h"
 4 | 
 5 | #define ARGON2_MAX_DECODED_LANES UINT32_C(255)
 6 | #define ARGON2_MIN_DECODED_SALT_LEN UINT32_C(8)
 7 | #define ARGON2_MIN_DECODED_OUT_LEN UINT32_C(12)
 8 | 
 9 | /*
10 | * encode an Argon2 hash string into the provided buffer. 'dst_len'
11 | * contains the size, in characters, of the 'dst' buffer; if 'dst_len'
12 | * is less than the number of required characters (including the
13 | * terminating 0), then this function returns ARGON2_ENCODING_ERROR.
14 | *
15 | * on success, ARGON2_OK is returned.
16 | */
17 | int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
18 |                   argon2_type type);
19 | 
20 | /*
21 | * Decodes an Argon2 hash string into the provided structure 'ctx'.
22 | * The only fields that must be set prior to this call are ctx.saltlen and
23 | * ctx.outlen (which must be the maximal salt and out length values that are
24 | * allowed), ctx.salt and ctx.out (which must be buffers of the specified
25 | * length), and ctx.pwd and ctx.pwdlen which must hold a valid password.
26 | *
27 | * Invalid input string causes an error. On success, the ctx is valid and all
28 | * fields have been initialized.
29 | *
30 | * Returned value is ARGON2_OK on success, other ARGON2_ codes on error.
31 | */
32 | int decode_string(argon2_context *ctx, const char *str, argon2_type type);
33 | 
34 | /* Returns the length of the encoded byte stream with length len */
35 | size_t b64len(uint32_t len);
36 | 
37 | /* Returns the length of the encoded number num */
38 | size_t numlen(uint32_t num);
39 | 
40 | #endif
41 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/lib/genkat.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Argon2 source code package
 3 |  *
 4 |  * Written by Daniel Dinu and Dmitry Khovratovich, 2015
 5 |  *
 6 |  * This work is licensed under a Creative Commons CC0 1.0 License/Waiver.
 7 |  *
 8 |  * You should have received a copy of the CC0 Public Domain Dedication along
 9 |  * with
10 |  * this software. If not, see
11 |  * <http://creativecommons.org/publicdomain/zero/1.0/>.
12 |  */
13 | 
14 | #ifndef ARGON2_KAT_H
15 | #define ARGON2_KAT_H
16 | 
17 | #include "core.h"
18 | 
19 | /*
20 |  * Initial KAT function that prints the inputs to the file
21 |  * @param  blockhash  Array that contains pre-hashing digest
22 |  * @param  context Holds inputs
23 |  * @param  type Argon2 type
24 |  * @pre blockhash must point to INPUT_INITIAL_HASH_LENGTH bytes
25 |  * @pre context member pointers must point to allocated memory of size according
26 |  * to the length values
27 |  */
28 | void initial_kat(const uint8_t *blockhash, const argon2_context *context,
29 |                  argon2_type type);
30 | 
31 | /*
32 |  * Function that prints the output tag
33 |  * @param  out  output array pointer
34 |  * @param  outlen digest length
35 |  * @pre out must point to @a outlen bytes
36 |  **/
37 | void print_tag(const void *out, uint32_t outlen);
38 | 
39 | /*
40 |  * Function that prints the internal state at given moment
41 |  * @param  instance pointer to the current instance
42 |  * @param  pass current pass number
43 |  * @pre instance must have necessary memory allocated
44 |  **/
45 | void internal_kat(const argon2_instance_t *instance, uint32_t pass);
46 | 
47 | #endif
48 | 


--------------------------------------------------------------------------------
/src/3rdparty/argon2/lib/impl-select.h:
--------------------------------------------------------------------------------
 1 | #ifndef ARGON2_IMPL_SELECT_H
 2 | #define ARGON2_IMPL_SELECT_H
 3 | 
 4 | #include "core.h"
 5 | 
 6 | typedef struct Argon2_impl {
 7 |     const char *name;
 8 |     int (*check)(void);
 9 |     void (*fill_segment)(const argon2_instance_t *instance,
10 |                          argon2_position_t position);
11 | } argon2_impl;
12 | 
13 | typedef struct Argon2_impl_list {
14 |     const argon2_impl *entries;
15 |     size_t count;
16 | } argon2_impl_list;
17 | 
18 | void argon2_get_impl_list(argon2_impl_list *list);
19 | void fill_segment_default(const argon2_instance_t *instance,
20 |                           argon2_position_t position);
21 | 
22 | #endif // ARGON2_IMPL_SELECT_H
23 | 
24 | 


--------------------------------------------------------------------------------
/src/3rdparty/cl.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_CL_H
26 | #define XMRIG_CL_H
27 | 
28 | 
29 | #if defined(__APPLE__)
30 | #   include <OpenCL/cl.h>
31 | #else
32 | #   include "3rdparty/CL/cl.h"
33 | #endif
34 | 
35 | 
36 | #endif /* XMRIG_CL_H */
37 | 


--------------------------------------------------------------------------------
/src/3rdparty/epee/LICENSE.txt:
--------------------------------------------------------------------------------
 1 | Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
 2 | All rights reserved.
 3 | 
 4 | Redistribution and use in source and binary forms, with or without
 5 | modification, are permitted provided that the following conditions are met:
 6 |     * Redistributions of source code must retain the above copyright
 7 |       notice, this list of conditions and the following disclaimer.
 8 |     * Redistributions in binary form must reproduce the above copyright
 9 |       notice, this list of conditions and the following disclaimer in the
10 |       documentation and/or other materials provided with the distribution.
11 |     * Neither the name of the Andrey N. Sabelnikov nor the
12 |       names of its contributors may be used to endorse or promote products
13 |       derived from this software without specific prior written permission.
14 | 
15 | 
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL Andrey N. Sabelnikov BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | 


--------------------------------------------------------------------------------
/src/3rdparty/epee/README.md:
--------------------------------------------------------------------------------
1 | epee -  is a small library of helpers, wrappers, tools and so on, used to make my life easier.
2 | 


--------------------------------------------------------------------------------
/src/3rdparty/fmt/LICENSE.rst:
--------------------------------------------------------------------------------
 1 | Copyright (c) 2012 - present, Victor Zverovich
 2 | 
 3 | Permission is hereby granted, free of charge, to any person obtaining
 4 | a copy of this software and associated documentation files (the
 5 | "Software"), to deal in the Software without restriction, including
 6 | without limitation the rights to use, copy, modify, merge, publish,
 7 | distribute, sublicense, and/or sell copies of the Software, and to
 8 | permit persons to whom the Software is furnished to do so, subject to
 9 | the following conditions:
10 | 
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 | 
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | 
22 | --- Optional exception to the license ---
23 | 
24 | As an exception, if, as a result of your compiling your source code, portions
25 | of this Software are embedded into a machine-executable object form of such
26 | source code, you may redistribute such embedded portions in such object form
27 | without including the above copyright and permission notices.
28 | 


--------------------------------------------------------------------------------
/src/3rdparty/fmt/posix.h:
--------------------------------------------------------------------------------
1 | #include "os.h"
2 | #warning "fmt/posix.h is deprecated; use fmt/os.h instead"
3 | 


--------------------------------------------------------------------------------
/src/3rdparty/hwloc/AUTHORS:
--------------------------------------------------------------------------------
 1 | hwloc Authors
 2 | =============
 3 | 
 4 | The following cumulative list contains the names of most individuals
 5 | who have committed code to the hwloc repository
 6 | (either directly or through a third party).
 7 | 
 8 | Name                         Affiliation(s)
 9 | ---------------------------  --------------------
10 | Grzegorz Andrejczuk          Intel
11 | Cédric Augonnet              University of Bordeaux
12 | Guillaume Beauchamp          Inria
13 | Ahmad Boissetri Binzagr      Inria
14 | Cyril Bordage                Inria
15 | Nicholas Buroker             UWL
16 | Christopher M. Cantalupo     Intel
17 | Jérôme Clet-Ortega           University of Bordeaux
18 | Ludovic Courtès              Inria
19 | Clément Foyer                Inria
20 | Nathalie Furmento            CNRS
21 | Bryon Gloden
22 | Brice Goglin                 Inria
23 | Gilles Gouaillardet          RIST
24 | Valentin Hoyet               Inria
25 | Joshua Hursey                UWL
26 | Alexey Kardashevskiy         IBM
27 | Rob Latham                   ANL
28 | Douglas MacFarland           UWL
29 | Marc Marí                    BSC
30 | Jonathan L Peyton            Intel
31 | Piotr Luc                    Intel
32 | Antoine Rougier              intern from University of Bordeaux
33 | Jeff Squyres                 Cisco
34 | Samuel Thibault              University of Bordeaux
35 | Jean-Yves VET                DDN
36 | Benjamin Worpitz
37 | Jeff Zhao                    Zhaoxin
38 | 
39 | Affiliaion abbreviations:
40 | -------------------------
41 | ANL = Argonne National Lab
42 | BSC = Barcelona Supercomputing Center
43 | Cisco = Cisco Systems, Inc.
44 | CNRS = Centre national de la recherche scientifique (France)
45 | UWL = University of Wisconsin-La Crosse
46 | 


--------------------------------------------------------------------------------
/src/3rdparty/hwloc/CMakeLists.txt:
--------------------------------------------------------------------------------
 1 | cmake_minimum_required(VERSION 3.10)
 2 | project (hwloc C)
 3 | 
 4 | include_directories(include)
 5 | include_directories(src)
 6 | 
 7 | add_definitions(/D_CRT_SECURE_NO_WARNINGS)
 8 | set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
 9 | 
10 | set(HEADERS
11 |     include/hwloc.h
12 |     src/static-components.h
13 |     )
14 | 
15 | set(SOURCES
16 |     src/base64.c
17 |     src/bind.c
18 |     src/bitmap.c
19 |     src/components.c
20 |     src/diff.c
21 |     src/distances.c
22 |     src/misc.c
23 |     src/pci-common.c
24 |     src/shmem.c
25 |     src/topology.c
26 |     src/topology-noos.c
27 |     src/topology-synthetic.c
28 |     src/topology-windows.c
29 |     src/topology-x86.c
30 |     src/topology-xml.c
31 |     src/topology-xml-nolibxml.c
32 |     src/traversal.c
33 |     src/memattrs.c
34 |     src/cpukinds.c
35 |    )
36 | 
37 | add_library(hwloc STATIC
38 |     ${HEADERS}
39 |     ${SOURCES}
40 |     )
41 | 


--------------------------------------------------------------------------------
/src/3rdparty/hwloc/include/private/solaris-chiptype.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright © 2009-2010 Oracle and/or its affiliates.  All rights reserved.
 3 |  *
 4 |  * Copyright © 2017 Inria.  All rights reserved.
 5 |  * $COPYRIGHT$
 6 |  *
 7 |  * Additional copyrights may follow
 8 |  *
 9 |  * $HEADER$
10 |  */
11 | 
12 | 
13 | #ifdef HWLOC_INSIDE_PLUGIN
14 | /*
15 |  * these declarations are internal only, they are not available to plugins
16 |  * (functions below are internal static symbols).
17 |  */
18 | #error This file should not be used in plugins
19 | #endif
20 | 
21 | 
22 | #ifndef HWLOC_PRIVATE_SOLARIS_CHIPTYPE_H
23 | #define HWLOC_PRIVATE_SOLARIS_CHIPTYPE_H
24 | 
25 | struct hwloc_solaris_chip_info_s {
26 |   char *model;
27 |   char *type;
28 |   /* L1i, L1d, L2, L3 */
29 | #define HWLOC_SOLARIS_CHIP_INFO_L1I 0
30 | #define HWLOC_SOLARIS_CHIP_INFO_L1D 1
31 | #define HWLOC_SOLARIS_CHIP_INFO_L2I 2
32 | #define HWLOC_SOLARIS_CHIP_INFO_L2D 3
33 | #define HWLOC_SOLARIS_CHIP_INFO_L3  4
34 |   long cache_size[5]; /* cleared to -1 if we don't want of that cache */
35 |   unsigned cache_linesize[5];
36 |   unsigned cache_associativity[5];
37 |   int l2_unified;
38 | };
39 | 
40 | /* fills the structure with 0 on error */
41 | extern void hwloc_solaris_get_chip_info(struct hwloc_solaris_chip_info_s *info);
42 | 
43 | #endif /* HWLOC_PRIVATE_SOLARIS_CHIPTYPE_H */
44 | 


--------------------------------------------------------------------------------
/src/3rdparty/hwloc/include/private/windows.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright © 2009 Université Bordeaux
 3 |  * Copyright © 2020-2022 Inria.  All rights reserved.
 4 |  *
 5 |  * See COPYING in top-level directory.
 6 |  */
 7 | 
 8 | #ifndef HWLOC_PRIVATE_WINDOWS_H
 9 | #define HWLOC_PRIVATE_WINDOWS_H
10 | 
11 | #ifndef _ANONYMOUS_UNION
12 | #ifdef __GNUC__
13 | #define _ANONYMOUS_UNION __extension__
14 | #else
15 | #define _ANONYMOUS_UNION
16 | #endif /* __GNUC__ */
17 | #endif /* _ANONYMOUS_UNION */
18 | 
19 | #ifndef _ANONYMOUS_STRUCT
20 | #ifdef __GNUC__
21 | #define _ANONYMOUS_STRUCT __extension__
22 | #else
23 | #define _ANONYMOUS_STRUCT
24 | #endif /* __GNUC__ */
25 | #endif /* _ANONYMOUS_STRUCT */
26 | 
27 | #define DUMMYUNIONNAME
28 | #define DUMMYSTRUCTNAME
29 | 
30 | #endif /* HWLOC_PRIVATE_WINDOWS_H */
31 | 


--------------------------------------------------------------------------------
/src/3rdparty/hwloc/src/static-components.h:
--------------------------------------------------------------------------------
 1 | HWLOC_DECLSPEC extern const struct hwloc_component hwloc_noos_component;
 2 | HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_component;
 3 | HWLOC_DECLSPEC extern const struct hwloc_component hwloc_synthetic_component;
 4 | HWLOC_DECLSPEC extern const struct hwloc_component hwloc_xml_nolibxml_component;
 5 | HWLOC_DECLSPEC extern const struct hwloc_component hwloc_windows_component;
 6 | HWLOC_DECLSPEC extern const struct hwloc_component hwloc_x86_component;
 7 | static const struct hwloc_component * hwloc_static_components[] = {
 8 |   &hwloc_noos_component,
 9 |   &hwloc_xml_component,
10 |   &hwloc_synthetic_component,
11 |   &hwloc_xml_nolibxml_component,
12 |   &hwloc_windows_component,
13 |   &hwloc_x86_component,
14 |   NULL
15 | };
16 | 


--------------------------------------------------------------------------------
/src/3rdparty/libethash/CMakeLists.txt:
--------------------------------------------------------------------------------
 1 | cmake_minimum_required(VERSION 3.10)
 2 | project (ethash C)
 3 | 
 4 | set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
 5 | 
 6 | set(HEADERS
 7 |     data_sizes.h
 8 |     endian.h
 9 |     ethash.h
10 |     ethash_internal.h
11 |     fnv.h
12 |     )
13 | 
14 | set(SOURCES
15 |     ethash_internal.c
16 |     keccakf800.c
17 |    )
18 | 
19 | include_directories(../..)
20 | 
21 | add_library(ethash STATIC
22 |     ${HEADERS}
23 |     ${SOURCES}
24 |     )
25 | 


--------------------------------------------------------------------------------
/src/3rdparty/libethash/fnv.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |   This file is part of cpp-ethereum.
 3 | 
 4 |   cpp-ethereum is free software: you can redistribute it and/or modify
 5 |   it under the terms of the GNU General Public License as published by
 6 |   the Free Software Foundation, either version 3 of the License, or
 7 |   (at your option) any later version.
 8 | 
 9 |   cpp-ethereum is distributed in the hope that it will be useful,
10 |   but WITHOUT ANY WARRANTY; without even the implied warranty of
11 |   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 |   GNU General Public License for more details.
13 | 
14 |   You should have received a copy of the GNU General Public License
15 |   along with cpp-ethereum.  If not, see <http://www.gnu.org/licenses/>.
16 | */
17 | /** @file fnv.h
18 | * @author Matthew Wampler-Doty <negacthulhu@gmail.com>
19 | * @date 2015
20 | */
21 | 
22 | #pragma once
23 | #include <stdint.h>
24 | 
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 | 
29 | #define FNV_PRIME 0x01000193
30 | 
31 | /* The FNV-1 spec multiplies the prime with the input one byte (octet) in turn.
32 |    We instead multiply it with the full 32-bit input.
33 |    This gives a different result compared to a canonical FNV-1 implementation.
34 | */
35 | static inline uint32_t fnv_hash(uint32_t const x, uint32_t const y)
36 | {
37 | 	return x * FNV_PRIME ^ y;
38 | }
39 | 
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 | 


--------------------------------------------------------------------------------
/src/3rdparty/llhttp/LICENSE-MIT:
--------------------------------------------------------------------------------
 1 | This software is licensed under the MIT License.
 2 | 
 3 | Copyright Fedor Indutny, 2018.
 4 | 
 5 | Permission is hereby granted, free of charge, to any person obtaining a
 6 | copy of this software and associated documentation files (the
 7 | "Software"), to deal in the Software without restriction, including
 8 | without limitation the rights to use, copy, modify, merge, publish,
 9 | distribute, sublicense, and/or sell copies of the Software, and to permit
10 | persons to whom the Software is furnished to do so, subject to the
11 | following conditions:
12 | 
13 | The above copyright notice and this permission notice shall be included
14 | in all copies or substantial portions of the Software.
15 | 
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
19 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 | USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | 


--------------------------------------------------------------------------------
/src/3rdparty/rapidjson/internal/swap.h:
--------------------------------------------------------------------------------
 1 | // Tencent is pleased to support the open source community by making RapidJSON available.
 2 | //
 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
 4 | //
 5 | // Licensed under the MIT License (the "License"); you may not use this file except
 6 | // in compliance with the License. You may obtain a copy of the License at
 7 | //
 8 | // http://opensource.org/licenses/MIT
 9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 | 
15 | #ifndef RAPIDJSON_INTERNAL_SWAP_H_
16 | #define RAPIDJSON_INTERNAL_SWAP_H_
17 | 
18 | #include "../rapidjson.h"
19 | 
20 | #if defined(__clang__)
21 | RAPIDJSON_DIAG_PUSH
22 | RAPIDJSON_DIAG_OFF(c++98-compat)
23 | #endif
24 | 
25 | RAPIDJSON_NAMESPACE_BEGIN
26 | namespace internal {
27 | 
28 | //! Custom swap() to avoid dependency on C++ <algorithm> header
29 | /*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only.
30 |     \note This has the same semantics as std::swap().
31 | */
32 | template <typename T>
33 | inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT {
34 |     T tmp = a;
35 |         a = b;
36 |         b = tmp;
37 | }
38 | 
39 | } // namespace internal
40 | RAPIDJSON_NAMESPACE_END
41 | 
42 | #if defined(__clang__)
43 | RAPIDJSON_DIAG_POP
44 | #endif
45 | 
46 | #endif // RAPIDJSON_INTERNAL_SWAP_H_
47 | 


--------------------------------------------------------------------------------
/src/Summary.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2022 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2022 XMRig       <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_SUMMARY_H
20 | #define XMRIG_SUMMARY_H
21 | 
22 | 
23 | namespace xmrig {
24 | 
25 | 
26 | class Controller;
27 | 
28 | 
29 | class Summary
30 | {
31 | public:
32 |     static void print(Controller *controller);
33 | };
34 | 
35 | 
36 | } // namespace xmrig
37 | 
38 | 
39 | #endif /* XMRIG_SUMMARY_H */
40 | 


--------------------------------------------------------------------------------
/src/backend/backend.cmake:
--------------------------------------------------------------------------------
 1 | include(src/backend/cpu/cpu.cmake)
 2 | include(src/backend/opencl/opencl.cmake)
 3 | include(src/backend/cuda/cuda.cmake)
 4 | include(src/backend/common/common.cmake)
 5 | 
 6 | 
 7 | set(HEADERS_BACKEND
 8 |     "${HEADERS_BACKEND_COMMON}"
 9 |     "${HEADERS_BACKEND_CPU}"
10 |     "${HEADERS_BACKEND_OPENCL}"
11 |     "${HEADERS_BACKEND_CUDA}"
12 |    )
13 | 
14 | set(SOURCES_BACKEND
15 |     "${SOURCES_BACKEND_COMMON}"
16 |     "${SOURCES_BACKEND_CPU}"
17 |     "${SOURCES_BACKEND_OPENCL}"
18 |     "${SOURCES_BACKEND_CUDA}"
19 |    )
20 | 


--------------------------------------------------------------------------------
/src/backend/common/HashrateInterpolator.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_HASHRATE_INTERPOLATOR_H
20 | #define XMRIG_HASHRATE_INTERPOLATOR_H
21 | 
22 | 
23 | #include <mutex>
24 | #include <deque>
25 | #include <utility>
26 | 
27 | 
28 | namespace xmrig {
29 | 
30 | 
31 | class HashrateInterpolator
32 | {
33 | public:
34 |     enum {
35 |         LagMS = 4000,
36 |     };
37 | 
38 |     uint64_t interpolate(uint64_t timeStamp) const;
39 |     void addDataPoint(uint64_t count, uint64_t timeStamp);
40 | 
41 | private:
42 |     // Buffer of hashrate counters, used for linear interpolation of past data
43 |     mutable std::mutex m_lock;
44 |     std::deque<std::pair<uint64_t, uint64_t> > m_data;
45 | };
46 | 
47 | 
48 | } // namespace xmrig
49 | 
50 | 
51 | #endif /* XMRIG_HASHRATE_INTERPOLATOR_H */
52 | 


--------------------------------------------------------------------------------
/src/backend/common/Worker.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include "backend/common/Worker.h"
21 | #include "base/kernel/Platform.h"
22 | #include "crypto/common/VirtualMemory.h"
23 | 
24 | 
25 | xmrig::Worker::Worker(size_t id, int64_t affinity, int priority) :
26 |     m_affinity(affinity),
27 |     m_id(id)
28 | {
29 |     m_node = VirtualMemory::bindToNUMANode(affinity);
30 | 
31 |     Platform::trySetThreadAffinity(affinity);
32 |     Platform::setThreadPriority(priority);
33 | }
34 | 


--------------------------------------------------------------------------------
/src/backend/common/benchmark/Benchmark.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_BENCHMARK_H
20 | #define XMRIG_BENCHMARK_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class IBackend;
30 | 
31 | 
32 | class Benchmark
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE_DEFAULT(Benchmark)
36 | 
37 |     Benchmark(size_t workers, const IBackend *backend);
38 |     ~Benchmark() = default;
39 | 
40 |     bool finish(uint64_t totalHashCount);
41 |     void printProgress() const;
42 |     void start();
43 | 
44 | private:
45 |     const IBackend *m_backend;
46 |     const size_t m_workers;
47 |     uint64_t m_current          = 0;
48 |     uint64_t m_startTime        = 0;
49 | };
50 | 
51 | 
52 | } // namespace xmrig
53 | 
54 | 
55 | #endif /* XMRIG_BENCHMARK_H */
56 | 


--------------------------------------------------------------------------------
/src/backend/common/common.cmake:
--------------------------------------------------------------------------------
 1 | set(HEADERS_BACKEND_COMMON
 2 |     src/backend/common/Hashrate.h
 3 |     src/backend/common/Tags.h
 4 |     src/backend/common/interfaces/IBackend.h
 5 |     src/backend/common/interfaces/IRxListener.h
 6 |     src/backend/common/interfaces/IRxStorage.h
 7 |     src/backend/common/interfaces/IWorker.h
 8 |     src/backend/common/misc/PciTopology.h
 9 |     src/backend/common/Thread.h
10 |     src/backend/common/Threads.h
11 |     src/backend/common/Worker.h
12 |     src/backend/common/WorkerJob.h
13 |     src/backend/common/Workers.h
14 |    )
15 | 
16 | set(SOURCES_BACKEND_COMMON
17 |     src/backend/common/Hashrate.cpp
18 |     src/backend/common/Threads.cpp
19 |     src/backend/common/Worker.cpp
20 |     src/backend/common/Workers.cpp
21 |    )
22 | 
23 | if (WITH_RANDOMX AND WITH_BENCHMARK)
24 |     list(APPEND HEADERS_BACKEND_COMMON
25 |         src/backend/common/benchmark/Benchmark.h
26 |         src/backend/common/benchmark/BenchState_test.h
27 |         src/backend/common/benchmark/BenchState.h
28 |         src/backend/common/interfaces/IBenchListener.h
29 |         )
30 | 
31 |     list(APPEND SOURCES_BACKEND_COMMON
32 |         src/backend/common/benchmark/Benchmark.cpp
33 |         src/backend/common/benchmark/BenchState.cpp
34 |         )
35 | endif()
36 | 
37 | 
38 | if (WITH_OPENCL OR WITH_CUDA)
39 |     list(APPEND HEADERS_BACKEND_COMMON
40 |         src/backend/common/HashrateInterpolator.h
41 |         src/backend/common/GpuWorker.h
42 |         )
43 | 
44 |     list(APPEND SOURCES_BACKEND_COMMON
45 |         src/backend/common/HashrateInterpolator.cpp
46 |         src/backend/common/GpuWorker.cpp
47 |         )
48 | endif()
49 | 


--------------------------------------------------------------------------------
/src/backend/common/interfaces/IBenchListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IBENCHLISTENER_H
20 | #define XMRIG_IBENCHLISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class IBackend;
30 | 
31 | 
32 | class IBenchListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(IBenchListener)
36 | 
37 |     IBenchListener()            = default;
38 |     virtual ~IBenchListener()   = default;
39 | 
40 |     virtual void onBenchDone(uint64_t result, uint64_t diff, uint64_t ts)               = 0;
41 |     virtual void onBenchReady(uint64_t ts, uint32_t threads, const IBackend *backend)   = 0;
42 | };
43 | 
44 | 
45 | } /* namespace xmrig */
46 | 
47 | 
48 | #endif // XMRIG_IBENCHLISTENER_H
49 | 


--------------------------------------------------------------------------------
/src/backend/common/interfaces/IMemoryPool.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IMEMORYPOOL_H
20 | #define XMRIG_IMEMORYPOOL_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | #include <cstddef>
27 | #include <cstdint>
28 | 
29 | 
30 | namespace xmrig {
31 | 
32 | 
33 | class IMemoryPool
34 | {
35 | public:
36 |     XMRIG_DISABLE_COPY_MOVE(IMemoryPool)
37 | 
38 |     IMemoryPool()           = default;
39 |     virtual ~IMemoryPool()  = default;
40 | 
41 |     virtual bool isHugePages(uint32_t node) const       = 0;
42 |     virtual uint8_t *get(size_t size, uint32_t node)    = 0;
43 |     virtual void release(uint32_t node)                 = 0;
44 | };
45 | 
46 | 
47 | } /* namespace xmrig */
48 | 
49 | 
50 | 
51 | #endif /* XMRIG_IMEMORYPOOL_H */
52 | 


--------------------------------------------------------------------------------
/src/backend/common/interfaces/IRxListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2019 tevador     <tevador@gmail.com>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_IRXLISTENER_H
21 | #define XMRIG_IRXLISTENER_H
22 | 
23 | 
24 | #include "base/tools/Object.h"
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | class IRxListener
31 | {
32 | public:
33 |     XMRIG_DISABLE_COPY_MOVE(IRxListener)
34 | 
35 |     IRxListener()           = default;
36 |     virtual ~IRxListener()  = default;
37 | 
38 | #   ifdef XMRIG_ALGO_RANDOMX
39 |     virtual void onDatasetReady() = 0;
40 | #   endif
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_IRXLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/backend/cpu/Cpu.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2023 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2023 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_CPU_H
20 | #define XMRIG_CPU_H
21 | 
22 | 
23 | #include "backend/cpu/interfaces/ICpuInfo.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class Cpu
30 | {
31 | public:
32 |     static ICpuInfo *info();
33 |     static rapidjson::Value toJSON(rapidjson::Document &doc);
34 |     static void release();
35 | 
36 |     inline static Assembly::Id assembly(Assembly::Id hint) { return hint == Assembly::AUTO ? Cpu::info()->assembly() : hint; }
37 | };
38 | 
39 | 
40 | } // namespace xmrig
41 | 
42 | 
43 | #endif // XMRIG_CPU_H
44 | 


--------------------------------------------------------------------------------
/src/backend/cpu/platform/BasicCpuInfo_arm_mac.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #include "backend/cpu/platform/BasicCpuInfo.h"
20 | 
21 | #include <sys/sysctl.h>
22 | 
23 | 
24 | void xmrig::BasicCpuInfo::init_arm()
25 | {
26 | #   if __ARM_FEATURE_CRYPTO
27 |     m_flags.set(FLAG_AES, true); // FIXME
28 | #   endif
29 | 
30 |     size_t buflen = sizeof(m_brand);
31 |     sysctlbyname("machdep.cpu.brand_string", &m_brand, &buflen, nullptr, 0);
32 | }
33 | 


--------------------------------------------------------------------------------
/src/backend/cpu/platform/BasicCpuInfo_arm_win.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #include "backend/cpu/platform/BasicCpuInfo.h"
20 | 
21 | #include <Windows.h>
22 | 
23 | 
24 | void xmrig::BasicCpuInfo::init_arm()
25 | {
26 |     DWORD size         = sizeof(m_brand) - 1;
27 |     const char *subkey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
28 | 
29 |     RegGetValueA(HKEY_LOCAL_MACHINE, subkey, "ProcessorNameString", RRF_RT_REG_SZ, nullptr, m_brand, &size);
30 | 
31 |     m_flags.set(FLAG_AES, IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE));
32 | }
33 | 


--------------------------------------------------------------------------------
/src/backend/cuda/CudaLaunchData.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include "backend/cuda/CudaLaunchData.h"
21 | #include "backend/common/Tags.h"
22 | 
23 | 
24 | xmrig::CudaLaunchData::CudaLaunchData(const Miner *miner, const Algorithm &algorithm, const CudaThread &thread, const CudaDevice &device) :
25 |     algorithm(algorithm),
26 |     device(device),
27 |     thread(thread),
28 |     affinity(thread.affinity()),
29 |     miner(miner)
30 | {
31 | }
32 | 
33 | 
34 | bool xmrig::CudaLaunchData::isEqual(const CudaLaunchData &other) const
35 | {
36 |     return (other.algorithm.family() == algorithm.family() &&
37 |             other.algorithm.l3()     == algorithm.l3() &&
38 |             other.thread             == thread);
39 | }
40 | 
41 | 
42 | const char *xmrig::CudaLaunchData::tag()
43 | {
44 |     return cuda_tag();
45 | }
46 | 


--------------------------------------------------------------------------------
/src/backend/cuda/runners/CudaKawPowRunner.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_CUDAKAWPOWRUNNER_H
20 | #define XMRIG_CUDAKAWPOWRUNNER_H
21 | 
22 | 
23 | #include "backend/cuda/runners/CudaBaseRunner.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class CudaKawPowRunner : public CudaBaseRunner
30 | {
31 | public:
32 |     CudaKawPowRunner(size_t index, const CudaLaunchData &data);
33 | 
34 | protected:
35 |     bool run(uint32_t startNonce, uint32_t *rescount, uint32_t *resnonce) override;
36 |     bool set(const Job &job, uint8_t *blob) override;
37 |     size_t processedHashes() const override { return intensity() - m_skippedHashes; }
38 |     void jobEarlyNotification(const Job&) override;
39 | 
40 | private:
41 |     uint8_t* m_jobBlob = nullptr;
42 |     uint32_t m_skippedHashes = 0;
43 | };
44 | 
45 | 
46 | } /* namespace xmrig */
47 | 
48 | 
49 | #endif // XMRIG_CUDAKAWPOWRUNNER_H
50 | 


--------------------------------------------------------------------------------
/src/backend/cuda/wrappers/NvmlHealth.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_NVMLHEALTH_H
26 | #define XMRIG_NVMLHEALTH_H
27 | 
28 | 
29 | #include <cstdint>
30 | #include <vector>
31 | 
32 | 
33 | struct NvmlHealth
34 | {
35 |     std::vector<uint32_t> fanSpeed;
36 |     uint32_t clock          = 0;
37 |     uint32_t memClock       = 0;
38 |     uint32_t power          = 0;
39 |     uint32_t temperature    = 0;
40 | };
41 | 
42 | 
43 | #endif /* XMRIG_NVMLHEALTH_H */
44 | 


--------------------------------------------------------------------------------
/src/backend/opencl/OclCache.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_OCLCACHE_H
20 | #define XMRIG_OCLCACHE_H
21 | 
22 | 
23 | #include <string>
24 | 
25 | 
26 | using cl_program = struct _cl_program *;
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class IOclRunner;
33 | 
34 | 
35 | class OclCache
36 | {
37 | public:
38 |     static cl_program build(const IOclRunner *runner);
39 |     static std::string cacheKey(const char *deviceKey, const char *options, const char *source);
40 |     static std::string cacheKey(const IOclRunner *runner);
41 | 
42 | private:
43 |     static std::string prefix();
44 |     static void createDirectory();
45 |     static void save(cl_program program, const std::string &fileName);
46 | };
47 | 
48 | 
49 | } // namespace xmrig
50 | 
51 | 
52 | #endif /* XMRIG_OCLCACHE_H */
53 | 


--------------------------------------------------------------------------------
/src/backend/opencl/OclCache_unix.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #include <sys/stat.h>
26 | #include <unistd.h>
27 | 
28 | 
29 | #include "backend/opencl/OclCache.h"
30 | 
31 | 
32 | void xmrig::OclCache::createDirectory()
33 | {
34 |     std::string path = prefix() + "/.cache";
35 |     mkdir(path.c_str(), 0744);
36 | }
37 | 
38 | 
39 | std::string xmrig::OclCache::prefix()
40 | {
41 |     return ".";
42 | }
43 | 


--------------------------------------------------------------------------------
/src/backend/opencl/OclGenerator.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_OCLGENERATOR_H
26 | #define XMRIG_OCLGENERATOR_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class Algorithm;
33 | class OclDevice;
34 | class OclThreads;
35 | 
36 | 
37 | using ocl_gen_config_fun = bool (*)(const OclDevice &device, const Algorithm &algorithm, OclThreads &threads);
38 | 
39 | 
40 | } // namespace xmrig
41 | 
42 | 
43 | #endif /* XMRIG_OCLGENERATOR_H */
44 | 


--------------------------------------------------------------------------------
/src/backend/opencl/cl/OclSource.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2020 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_OCLSOURCE_H
26 | #define XMRIG_OCLSOURCE_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class Algorithm;
33 | 
34 | 
35 | class OclSource
36 | {
37 | public:
38 |     static const char *get(const Algorithm &algorithm);
39 |     static void init();
40 | };
41 | 
42 | 
43 | } // namespace xmrig
44 | 
45 | 
46 | #endif /* XMRIG_OCLSOURCE_H */
47 | 


--------------------------------------------------------------------------------
/src/backend/opencl/cl/cn/algorithm.cl:
--------------------------------------------------------------------------------
 1 | #define ALGO_CN_0           0x63150000
 2 | #define ALGO_CN_1           0x63150100
 3 | #define ALGO_CN_2           0x63150200
 4 | #define ALGO_CN_R           0x63150272
 5 | #define ALGO_CN_FAST        0x63150166
 6 | #define ALGO_CN_HALF        0x63150268
 7 | #define ALGO_CN_XAO         0x63150078
 8 | #define ALGO_CN_RTO         0x63150172
 9 | #define ALGO_CN_RWZ         0x63150277
10 | #define ALGO_CN_ZLS         0x6315027a
11 | #define ALGO_CN_DOUBLE      0x63150264
12 | #define ALGO_CN_CCX         0x63150063
13 | #define ALGO_CN_LITE_0      0x63140000
14 | #define ALGO_CN_LITE_1      0x63140100
15 | #define ALGO_CN_HEAVY_0     0x63160000
16 | #define ALGO_CN_HEAVY_TUBE  0x63160172
17 | #define ALGO_CN_HEAVY_XHV   0x63160068
18 | #define ALGO_CN_PICO_0      0x63120200
19 | #define ALGO_CN_PICO_TLO    0x63120274
20 | #define ALGO_CN_UPX2        0x63110200
21 | #define ALGO_RX_0           0x72151200
22 | #define ALGO_RX_WOW         0x72141177
23 | #define ALGO_RX_ARQMA       0x72121061
24 | #define ALGO_RX_SFX         0x72151273
25 | #define ALGO_RX_GRAFT       0x72151267
26 | #define ALGO_RX_YADA        0x72151279
27 | #define ALGO_AR2_CHUKWA     0x61130000
28 | #define ALGO_AR2_CHUKWA_V2  0x61140000
29 | #define ALGO_AR2_WRKZ       0x61120000
30 | #define ALGO_KAWPOW_RVN     0x6b0f0000
31 | 
32 | #define FAMILY_UNKNOWN      0
33 | #define FAMILY_CN           0x63150000
34 | #define FAMILY_CN_LITE      0x63140000
35 | #define FAMILY_CN_HEAVY     0x63160000
36 | #define FAMILY_CN_PICO      0x63120000
37 | #define FAMILY_CN_FEMTO     0x63110000
38 | #define FAMILY_RANDOM_X     0x72000000
39 | #define FAMILY_ARGON2       0x61000000
40 | #define FAMILY_KAWPOW       0x6b000000
41 | 


--------------------------------------------------------------------------------
/src/backend/opencl/cl/cn/cryptonight_r_defines.cl:
--------------------------------------------------------------------------------
 1 | #ifdef __NV_CL_C_VERSION
 2 | #	define SCRATCHPAD_CHUNK(N) (*(__local uint4*)((__local uchar*)(scratchpad_line) + (idx1 ^ (N << 4))))
 3 | #else
 4 | #	if (STRIDED_INDEX == 0)
 5 | #		define SCRATCHPAD_CHUNK(N) (*(__global uint4*)((__global uchar*)(Scratchpad) + (idx ^ (N << 4))))
 6 | #	elif (STRIDED_INDEX == 1)
 7 | #		define SCRATCHPAD_CHUNK(N) (*(__global uint4*)((__global uchar*)(Scratchpad) + mul24(as_uint(idx ^ (N << 4)), Threads)))
 8 | #	elif (STRIDED_INDEX == 2)
 9 | #		define SCRATCHPAD_CHUNK(N) (*(__global uint4*)((__global uchar*)(Scratchpad) + (((idx ^ (N << 4)) % (MEM_CHUNK << 4)) + ((idx ^ (N << 4)) / (MEM_CHUNK << 4)) * WORKSIZE * (MEM_CHUNK << 4))))
10 | #	endif
11 | #endif
12 | 
13 | #define ROT_BITS 32
14 | #define MEM_CHUNK (1 << MEM_CHUNK_EXPONENT)
15 | 
16 | #include "wolf-aes.cl"
17 | 


--------------------------------------------------------------------------------
/src/backend/opencl/cl/cn/fast_div_heavy.cl:
--------------------------------------------------------------------------------
 1 | #ifndef FAST_DIV_HEAVY_CL
 2 | #define FAST_DIV_HEAVY_CL
 3 | 
 4 | #if (ALGO_FAMILY == FAMILY_CN_HEAVY)
 5 | 
 6 | inline long fast_div_heavy(long _a, int _b)
 7 | {
 8 | 	long a = abs(_a);
 9 | 	int b = abs(_b);
10 | 
11 | 	float rcp = native_recip(convert_float_rte(b));
12 | 	float rcp2 = as_float(as_uint(rcp) + (32U << 23));
13 | 
14 | 	ulong q1 = convert_ulong(convert_float_rte(as_int2(a).s1) * rcp2);
15 | 	a -= q1 * as_uint(b);
16 | 
17 | 	float q2f = convert_float_rte(as_int2(a >> 12).s0) * rcp;
18 | 	q2f = as_float(as_uint(q2f) + (12U << 23));
19 | 	long q2 = convert_long_rte(q2f);
20 | 	int a2 = as_int2(a).s0 - as_int2(q2).s0 * b;
21 | 
22 | 	int q3 = convert_int_rte(convert_float_rte(a2) * rcp);
23 | 	q3 += (a2 - q3 * b) >> 31;
24 | 
25 | 	const long q = q1 + q2 + q3;
26 | 	return ((as_int2(_a).s1 ^ _b) < 0) ? -q : q;
27 | }
28 | 
29 | #endif
30 | 
31 | #endif
32 | 


--------------------------------------------------------------------------------
/src/backend/opencl/cl/kawpow/defs.h:
--------------------------------------------------------------------------------
 1 | #ifdef cl_clang_storage_class_specifiers
 2 | #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
 3 | #endif
 4 | 
 5 | #ifndef GROUP_SIZE
 6 | #define GROUP_SIZE 256
 7 | #endif
 8 | #define GROUP_SHARE (GROUP_SIZE / 16)
 9 | 
10 | typedef unsigned int       uint32_t;
11 | typedef unsigned long      uint64_t;
12 | #define ROTL32(x, n) rotate((x), (uint32_t)(n))
13 | #define ROTR32(x, n) rotate((x), (uint32_t)(32-n))
14 | 
15 | #define PROGPOW_LANES           16
16 | #define PROGPOW_REGS            32
17 | #define PROGPOW_DAG_LOADS       4
18 | #define PROGPOW_CACHE_WORDS     4096
19 | #define PROGPOW_CNT_DAG         64
20 | #define PROGPOW_CNT_MATH        18
21 | 
22 | #define OPENCL_PLATFORM_UNKNOWN 0
23 | #define OPENCL_PLATFORM_NVIDIA 1
24 | #define OPENCL_PLATFORM_AMD 2
25 | #define OPENCL_PLATFORM_CLOVER 3
26 | 
27 | #ifndef MAX_OUTPUTS
28 | #define MAX_OUTPUTS 63U
29 | #endif
30 | 
31 | #ifndef PLATFORM
32 | #ifdef cl_amd_media_ops
33 | #define PLATFORM OPENCL_PLATFORM_AMD
34 | #else
35 | #define PLATFORM OPENCL_PLATFORM_UNKNOWN
36 | #endif
37 | #endif
38 | 
39 | #define HASHES_PER_GROUP (GROUP_SIZE / PROGPOW_LANES)
40 | 
41 | #define FNV_PRIME 0x1000193
42 | #define FNV_OFFSET_BASIS 0x811c9dc5
43 | 


--------------------------------------------------------------------------------
/src/backend/opencl/cl/rx/randomx.cl:
--------------------------------------------------------------------------------
 1 | #include "../cn/algorithm.cl"
 2 | 
 3 | #if ((ALGO == ALGO_RX_0) || (ALGO == ALGO_RX_YADA))
 4 | #include "randomx_constants_monero.h"
 5 | #elif (ALGO == ALGO_RX_WOW)
 6 | #include "randomx_constants_wow.h"
 7 | #elif (ALGO == ALGO_RX_ARQMA)
 8 | #include "randomx_constants_arqma.h"
 9 | #elif (ALGO == ALGO_RX_GRAFT)
10 | #include "randomx_constants_graft.h"
11 | #endif
12 | 
13 | #include "aes.cl"
14 | #include "blake2b.cl"
15 | #include "randomx_vm.cl"
16 | #include "randomx_jit.cl"
17 | 


--------------------------------------------------------------------------------
/src/backend/opencl/kernels/kawpow/KawPow_CalculateDAGKernel.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_KAWPOW_CALCULATEDAGKERNEL_H
20 | #define XMRIG_KAWPOW_CALCULATEDAGKERNEL_H
21 | 
22 | 
23 | #include "backend/opencl/wrappers/OclKernel.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class KawPow_CalculateDAGKernel : public OclKernel
30 | {
31 | public:
32 |     inline KawPow_CalculateDAGKernel(cl_program program) : OclKernel(program, "ethash_calculate_dag_item") {}
33 | 
34 |     void enqueue(cl_command_queue queue, size_t threads, size_t workgroup_size);
35 |     void setArgs(uint32_t start, cl_mem g_light, cl_mem g_dag, uint32_t dag_words, uint32_t light_words);
36 | };
37 | 
38 | 
39 | } // namespace xmrig
40 | 
41 | 
42 | #endif /* XMRIG_KAWPOW_CALCULATEDAGKERNEL_H */
43 | 


--------------------------------------------------------------------------------
/src/backend/opencl/runners/tools/OclKawPow.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_OCLKAWPOW_H
20 | #define XMRIG_OCLKAWPOW_H
21 | 
22 | 
23 | #include <cstddef>
24 | #include <cstdint>
25 | 
26 | 
27 | using cl_kernel = struct _cl_kernel *;
28 | 
29 | 
30 | namespace xmrig {
31 | 
32 | 
33 | class IOclRunner;
34 | 
35 | 
36 | class OclKawPow
37 | {
38 | public:
39 |     static cl_kernel get(const IOclRunner &runner, uint64_t height, uint32_t worksize);
40 |     static void clear();
41 | };
42 | 
43 | 
44 | } // namespace xmrig
45 | 
46 | 
47 | #endif /* XMRIG_OCLKAWPOW_H */
48 | 


--------------------------------------------------------------------------------
/src/backend/opencl/wrappers/AdlHealth.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2008-2018 Advanced Micro Devices, Inc.
 3 |  * Copyright 2018-2020 SChernykh                    <https://github.com/SChernykh>
 4 |  * Copyright 2016-2020 XMRig                        <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_ADLHEALTH_H
21 | #define XMRIG_ADLHEALTH_H
22 | 
23 | 
24 | #include <cstdint>
25 | #include <vector>
26 | 
27 | 
28 | struct AdlHealth
29 | {
30 |     uint32_t clock          = 0;
31 |     uint32_t memClock       = 0;
32 |     uint32_t power          = 0;
33 |     uint32_t rpm            = 0;
34 |     uint32_t temperature    = 0;
35 | };
36 | 
37 | 
38 | #endif /* XMRIG_ADLHEALTH_H */
39 | 


--------------------------------------------------------------------------------
/src/backend/opencl/wrappers/OclError.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_OCLERROR_H
26 | #define XMRIG_OCLERROR_H
27 | 
28 | 
29 | #include "3rdparty/cl.h"
30 | 
31 | 
32 | #define OCL_ERR_SUCCESS    (0)
33 | #define OCL_ERR_API        (2)
34 | #define OCL_ERR_BAD_PARAMS (1)
35 | 
36 | 
37 | namespace xmrig {
38 | 
39 | 
40 | class OclError
41 | {
42 | public:
43 |     static const char *toString(cl_int ret);
44 | };
45 | 
46 | 
47 | } // namespace xmrig
48 | 
49 | 
50 | #endif /* XMRIG_OCLERROR_H */
51 | 


--------------------------------------------------------------------------------
/src/backend/opencl/wrappers/OclVendor.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_OCLVENDOR_H
26 | #define XMRIG_OCLVENDOR_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | enum OclVendor : unsigned {
33 |     OCL_VENDOR_UNKNOWN,
34 |     OCL_VENDOR_AMD,
35 |     OCL_VENDOR_NVIDIA,
36 |     OCL_VENDOR_INTEL,
37 |     OCL_VENDOR_APPLE
38 | };
39 | 
40 | 
41 | } // namespace xmrig
42 | 
43 | 
44 | #endif /* XMRIG_OCLVENDOR_H */
45 | 


--------------------------------------------------------------------------------
/src/base/api/interfaces/IApiListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IAPILISTENER_H
20 | #define XMRIG_IAPILISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class IApiRequest;
30 | 
31 | 
32 | class IApiListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(IApiListener)
36 | 
37 |     IApiListener()          = default;
38 |     virtual ~IApiListener() = default;
39 | 
40 | #   ifdef XMRIG_FEATURE_API
41 |     virtual void onRequest(IApiRequest &request) = 0;
42 | #   endif
43 | };
44 | 
45 | 
46 | } /* namespace xmrig */
47 | 
48 | 
49 | #endif // XMRIG_IAPILISTENER_H
50 | 


--------------------------------------------------------------------------------
/src/base/api/requests/ApiRequest.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | 
26 | #include "base/api/requests/ApiRequest.h"
27 | 
28 | 
29 | xmrig::ApiRequest::ApiRequest(Source source, bool restricted) :
30 |     m_restricted(restricted),
31 |     m_source(source)
32 | {
33 | }
34 | 
35 | 
36 | xmrig::ApiRequest::~ApiRequest() = default;
37 | 


--------------------------------------------------------------------------------
/src/base/io/Async.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2015-2020 libuv project contributors.
 3 |  * Copyright (c) 2020      cohcho      <https://github.com/cohcho>
 4 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 5 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 6 |  *
 7 |  *   This program is free software: you can redistribute it and/or modify
 8 |  *   it under the terms of the GNU General Public License as published by
 9 |  *   the Free Software Foundation, either version 3 of the License, or
10 |  *   (at your option) any later version.
11 |  *
12 |  *   This program is distributed in the hope that it will be useful,
13 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 |  *   GNU General Public License for more details.
16 |  *
17 |  *   You should have received a copy of the GNU General Public License
18 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
19 |  */
20 | 
21 | #ifndef XMRIG_ASYNC_H
22 | #define XMRIG_ASYNC_H
23 | 
24 | 
25 | #include "base/tools/Object.h"
26 | 
27 | 
28 | #include <functional>
29 | 
30 | 
31 | namespace xmrig {
32 | 
33 | 
34 | class AsyncPrivate;
35 | class IAsyncListener;
36 | 
37 | 
38 | class Async
39 | {
40 | public:
41 |     XMRIG_DISABLE_COPY_MOVE_DEFAULT(Async)
42 | 
43 |     using Callback = std::function<void()>;
44 | 
45 |     Async(Callback callback);
46 |     Async(IAsyncListener *listener);
47 |     ~Async();
48 | 
49 |     void send();
50 | 
51 | private:
52 |     AsyncPrivate *d_ptr;
53 | };
54 | 
55 | 
56 | } // namespace xmrig
57 | 
58 | 
59 | #endif /* XMRIG_ASYNC_H */
60 | 


--------------------------------------------------------------------------------
/src/base/io/Env.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ENV_H
20 | #define XMRIG_ENV_H
21 | 
22 | 
23 | #include "base/tools/String.h"
24 | 
25 | 
26 | #include <map>
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class Env
33 | {
34 | public:
35 |     static String expand(const char *in, const std::map<String, String> &extra = {});
36 |     static String get(const String &name, const std::map<String, String> &extra = {});
37 |     static String hostname();
38 | };
39 | 
40 | 
41 | } /* namespace xmrig */
42 | 
43 | 
44 | #endif /* XMRIG_ENV_H */
45 | 


--------------------------------------------------------------------------------
/src/base/io/log/backends/FileLog.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2019      Spudz76     <https://github.com/Spudz76>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | 
21 | #include "base/io/log/backends/FileLog.h"
22 | 
23 | 
24 | #include <cassert>
25 | #include <cstring>
26 | 
27 | 
28 | xmrig::FileLog::FileLog(const char *fileName) :
29 |     m_writer(fileName)
30 | {
31 | }
32 | 
33 | 
34 | void xmrig::FileLog::print(uint64_t, int, const char *line, size_t, size_t size, bool colors)
35 | {
36 |     if (!m_writer.isOpen() || colors) {
37 |         return;
38 |     }
39 | 
40 |     assert(strlen(line) == size);
41 | 
42 |     m_writer.write(line, size);
43 | }
44 | 


--------------------------------------------------------------------------------
/src/base/io/log/backends/FileLog.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2019      Spudz76     <https://github.com/Spudz76>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_FILELOG_H
21 | #define XMRIG_FILELOG_H
22 | 
23 | 
24 | #include "base/io/log/FileLogWriter.h"
25 | #include "base/kernel/interfaces/ILogBackend.h"
26 | 
27 | 
28 | namespace xmrig {
29 | 
30 | 
31 | class FileLog : public ILogBackend
32 | {
33 | public:
34 |     FileLog(const char *fileName);
35 | 
36 | protected:
37 |     void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) override;
38 | 
39 | private:
40 |     FileLogWriter m_writer;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif /* XMRIG_FILELOG_H */
48 | 


--------------------------------------------------------------------------------
/src/base/io/log/backends/SysLog.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2019      Spudz76     <https://github.com/Spudz76>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | 
21 | #include <syslog.h>
22 | 
23 | 
24 | #include "base/io/log/backends/SysLog.h"
25 | #include "version.h"
26 | 
27 | 
28 | xmrig::SysLog::SysLog()
29 | {
30 |     openlog(APP_ID, LOG_PID, LOG_USER);
31 | }
32 | 
33 | 
34 | xmrig::SysLog::~SysLog()
35 | {
36 |     closelog();
37 | }
38 | 
39 | 
40 | void xmrig::SysLog::print(uint64_t, int level, const char *line, size_t offset, size_t, bool colors)
41 | {
42 |     if (colors) {
43 |         return;
44 |     }
45 | 
46 |     syslog(level == -1 ? LOG_INFO : level, "%s", line + offset);
47 | }
48 | 


--------------------------------------------------------------------------------
/src/base/io/log/backends/SysLog.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2019      Spudz76     <https://github.com/Spudz76>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_SYSLOG_H
21 | #define XMRIG_SYSLOG_H
22 | 
23 | 
24 | #include "base/kernel/interfaces/ILogBackend.h"
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | class SysLog : public ILogBackend
31 | {
32 | public:
33 |     XMRIG_DISABLE_COPY_MOVE(SysLog)
34 | 
35 |     SysLog();
36 |     ~SysLog() override;
37 | 
38 | protected:
39 |     void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) override;
40 | };
41 | 
42 | 
43 | } /* namespace xmrig */
44 | 
45 | 
46 | #endif /* XMRIG_SYSLOG_H */
47 | 


--------------------------------------------------------------------------------
/src/base/kernel/Platform.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2023 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2023 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #include "base/kernel/Platform.h"
20 | 
21 | 
22 | #include <cstring>
23 | #include <uv.h>
24 | 
25 | 
26 | #ifdef XMRIG_FEATURE_TLS
27 | #   include <openssl/ssl.h>
28 | #   include <openssl/err.h>
29 | #endif
30 | 
31 | 
32 | namespace xmrig {
33 | 
34 | String Platform::m_userAgent;
35 | 
36 | } // namespace xmrig
37 | 
38 | 
39 | void xmrig::Platform::init(const char *userAgent)
40 | {
41 | #   ifdef XMRIG_FEATURE_TLS
42 |     SSL_library_init();
43 |     SSL_load_error_strings();
44 | 
45 | #   if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
46 |     ERR_load_BIO_strings();
47 |     ERR_load_crypto_strings();
48 | #   endif
49 | 
50 |     OpenSSL_add_all_digests();
51 | #   endif
52 | 
53 |     if (userAgent) {
54 |         m_userAgent = userAgent;
55 |     }
56 |     else {
57 |         m_userAgent = createUserAgent();
58 |     }
59 | }
60 | 


--------------------------------------------------------------------------------
/src/base/kernel/Process_unix.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include <uv.h>
21 | #include <unistd.h>
22 | 
23 | 
24 | #include "base/kernel/Process.h"
25 | 
26 | 
27 | int xmrig::Process::pid()
28 | {
29 | #   if UV_VERSION_HEX >= 0x011200
30 |     return uv_os_getpid();
31 | #   else
32 |     return getpid();
33 | #   endif
34 | }
35 | 


--------------------------------------------------------------------------------
/src/base/kernel/Process_win.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include <uv.h>
21 | 
22 | 
23 | #include "base/kernel/Process.h"
24 | 
25 | 
26 | int xmrig::Process::pid()
27 | {
28 | #   if UV_VERSION_HEX >= 0x011200
29 |     return uv_os_getpid();
30 | #   else
31 |     return GetCurrentProcessId();
32 | #   endif
33 | }
34 | 


--------------------------------------------------------------------------------
/src/base/kernel/config/Title.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_TITLE_H
20 | #define XMRIG_TITLE_H
21 | 
22 | 
23 | #include "3rdparty/rapidjson/fwd.h"
24 | #include "base/tools/String.h"
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | class Title
31 | {
32 | public:
33 |     Title() = default;
34 |     Title(const rapidjson::Value &value);
35 | 
36 |     inline bool isEnabled() const   { return m_enabled; }
37 | 
38 |     rapidjson::Value toJSON() const;
39 |     String value() const;
40 | 
41 | private:
42 |     bool m_enabled  = true;
43 |     String m_value;
44 | };
45 | 
46 | 
47 | } // namespace xmrig
48 | 
49 | 
50 | #endif /* XMRIG_TITLE_H */
51 | 


--------------------------------------------------------------------------------
/src/base/kernel/constants.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_CONSTANTS_H
20 | #define XMRIG_CONSTANTS_H
21 | 
22 | 
23 | #include <cstddef>
24 | #include <cstdint>
25 | 
26 | 
27 | constexpr size_t      XMRIG_NET_BUFFER_CHUNK_SIZE           = 64 * 1024;
28 | constexpr size_t      XMRIG_NET_BUFFER_INIT_CHUNKS          = 4;
29 | 
30 | 
31 | #endif /* XMRIG_CONSTANTS_H */
32 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IAsyncListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IASYNCLISTENER_H
20 | #define XMRIG_IASYNCLISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class Async;
30 | 
31 | 
32 | class IAsyncListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(IAsyncListener)
36 | 
37 |     IAsyncListener()            = default;
38 |     virtual ~IAsyncListener()   = default;
39 | 
40 |     virtual void onAsync()      = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_IASYNCLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IBaseListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IBASELISTENER_H
20 | #define XMRIG_IBASELISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class Config;
30 | 
31 | 
32 | class IBaseListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(IBaseListener)
36 | 
37 |     IBaseListener()             = default;
38 |     virtual ~IBaseListener()    = default;
39 | 
40 |     virtual void onConfigChanged(Config *config, Config *previousConfig) = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_IBASELISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IConfigListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_ICONFIGLISTENER_H
26 | #define XMRIG_ICONFIGLISTENER_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class IConfig;
33 | 
34 | 
35 | class IConfigListener
36 | {
37 | public:
38 |     virtual ~IConfigListener() = default;
39 | 
40 |     virtual void onNewConfig(IConfig *config) = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_ICONFIGLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IConsoleListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ICONSOLELISTENER_H
20 | #define XMRIG_ICONSOLELISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class IConsoleListener
30 | {
31 | public:
32 |     XMRIG_DISABLE_COPY_MOVE(IConsoleListener)
33 | 
34 |     IConsoleListener()          = default;
35 |     virtual ~IConsoleListener() = default;
36 | 
37 |     virtual void onConsoleCommand(char command) = 0;
38 | };
39 | 
40 | 
41 | } /* namespace xmrig */
42 | 
43 | 
44 | #endif // XMRIG_ICONSOLELISTENER_H
45 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IDnsBackend.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #pragma once
20 | 
21 | #include "base/tools/Object.h"
22 | 
23 | 
24 | namespace xmrig {
25 | 
26 | 
27 | class DnsConfig;
28 | class DnsRecords;
29 | class IDnsListener;
30 | class String;
31 | 
32 | 
33 | class IDnsBackend
34 | {
35 | public:
36 |     XMRIG_DISABLE_COPY_MOVE(IDnsBackend)
37 | 
38 |     IDnsBackend()           = default;
39 |     virtual ~IDnsBackend()  = default;
40 | 
41 |     virtual void resolve(const String &host, const std::weak_ptr<IDnsListener> &listener, const DnsConfig &config)  = 0;
42 | };
43 | 
44 | 
45 | } // namespace xmrig
46 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IDnsListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IDNSLISTENER_H
20 | #define XMRIG_IDNSLISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class DnsRecords;
30 | 
31 | 
32 | class IDnsListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(IDnsListener)
36 | 
37 |     IDnsListener()          = default;
38 |     virtual ~IDnsListener() = default;
39 | 
40 |     virtual void onResolved(const DnsRecords &records, int status, const char *error)   = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_IDNSLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IHttpListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_IHTTPLISTENER_H
20 | #define XMRIG_IHTTPLISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class HttpData;
30 | class HttpResponse;
31 | 
32 | 
33 | class IHttpListener
34 | {
35 | public:
36 |     XMRIG_DISABLE_COPY_MOVE(IHttpListener)
37 | 
38 |     IHttpListener()             = default;
39 |     virtual ~IHttpListener()    = default;
40 | 
41 |     virtual void onHttpData(const HttpData &data) = 0;
42 | };
43 | 
44 | 
45 | } /* namespace xmrig */
46 | 
47 | 
48 | #endif // XMRIG_IHTTPLISTENER_H
49 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/ILogBackend.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ILOGBACKEND_H
20 | #define XMRIG_ILOGBACKEND_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | #include <cstdarg>
27 | #include <cstddef>
28 | 
29 | 
30 | namespace xmrig {
31 | 
32 | 
33 | class ILogBackend
34 | {
35 | public:
36 |     XMRIG_DISABLE_COPY_MOVE(ILogBackend)
37 | 
38 |     ILogBackend()           = default;
39 |     virtual ~ILogBackend()  = default;
40 | 
41 |     virtual void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) = 0;
42 | };
43 | 
44 | 
45 | } /* namespace xmrig */
46 | 
47 | 
48 | #endif // XMRIG_ILOGBACKEND_H
49 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/ISignalListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ISIGNALLISTENER_H
20 | #define XMRIG_ISIGNALLISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class String;
30 | 
31 | 
32 | class ISignalListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(ISignalListener)
36 | 
37 |     ISignalListener()           = default;
38 |     virtual ~ISignalListener()  = default;
39 | 
40 |     virtual void onSignal(int signum) = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_ISIGNALLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/ITimerListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ITIMERLISTENER_H
20 | #define XMRIG_ITIMERLISTENER_H
21 | 
22 | 
23 | #include "base/tools/Object.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class Timer;
30 | 
31 | 
32 | class ITimerListener
33 | {
34 | public:
35 |     XMRIG_DISABLE_COPY_MOVE(ITimerListener)
36 | 
37 |     ITimerListener()            = default;
38 |     virtual ~ITimerListener()   = default;
39 | 
40 |     virtual void onTimer(const Timer *timer) = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_ITIMERLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/kernel/interfaces/IWatcherListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_IWATCHERLISTENER_H
26 | #define XMRIG_IWATCHERLISTENER_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class String;
33 | 
34 | 
35 | class IWatcherListener
36 | {
37 | public:
38 |     virtual ~IWatcherListener() = default;
39 | 
40 |     virtual void onFileChanged(const String &fileName) = 0;
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif // XMRIG_IWATCHERLISTENER_H
48 | 


--------------------------------------------------------------------------------
/src/base/net/dns/Dns.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include "base/net/dns/Dns.h"
21 | #include "base/net/dns/DnsRequest.h"
22 | #include "base/net/dns/DnsUvBackend.h"
23 | 
24 | 
25 | namespace xmrig {
26 | 
27 | 
28 | DnsConfig Dns::m_config;
29 | std::map<String, std::shared_ptr<IDnsBackend>> Dns::m_backends;
30 | 
31 | 
32 | } // namespace xmrig
33 | 
34 | 
35 | std::shared_ptr<xmrig::DnsRequest> xmrig::Dns::resolve(const String &host, IDnsListener *listener)
36 | {
37 |     auto req = std::make_shared<DnsRequest>(listener);
38 | 
39 |     if (m_backends.find(host) == m_backends.end()) {
40 |         m_backends.insert({ host, std::make_shared<DnsUvBackend>() });
41 |     }
42 | 
43 |     m_backends.at(host)->resolve(host, req, m_config);
44 | 
45 |     return req;
46 | }
47 | 


--------------------------------------------------------------------------------
/src/base/net/dns/Dns.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_DNS_H
20 | #define XMRIG_DNS_H
21 | 
22 | 
23 | #include "base/net/dns/DnsConfig.h"
24 | #include "base/tools/String.h"
25 | 
26 | 
27 | #include <map>
28 | #include <memory>
29 | 
30 | 
31 | namespace xmrig {
32 | 
33 | 
34 | class DnsConfig;
35 | class DnsRequest;
36 | class IDnsBackend;
37 | class IDnsListener;
38 | 
39 | 
40 | class Dns
41 | {
42 | public:
43 |     inline static const DnsConfig &config()             { return m_config; }
44 |     inline static void set(const DnsConfig &config)     { m_config = config; }
45 | 
46 |     static std::shared_ptr<DnsRequest> resolve(const String &host, IDnsListener *listener);
47 | 
48 | private:
49 |     static DnsConfig m_config;
50 |     static std::map<String, std::shared_ptr<IDnsBackend> > m_backends;
51 | };
52 | 
53 | 
54 | } /* namespace xmrig */
55 | 
56 | 
57 | #endif /* XMRIG_DNS_H */
58 | 


--------------------------------------------------------------------------------
/src/base/net/dns/DnsConfig.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #pragma once
20 | 
21 | #include "3rdparty/rapidjson/fwd.h"
22 | 
23 | 
24 | namespace xmrig {
25 | 
26 | 
27 | class DnsConfig
28 | {
29 | public:
30 |     static const char *kField;
31 |     static const char *kIPv;
32 |     static const char *kTTL;
33 | 
34 |     DnsConfig() = default;
35 |     DnsConfig(const rapidjson::Value &value);
36 | 
37 |     inline uint32_t ipv() const { return m_ipv; }
38 |     inline uint32_t ttl() const { return m_ttl * 1000U; }
39 | 
40 |     int ai_family() const;
41 |     rapidjson::Value toJSON(rapidjson::Document &doc) const;
42 | 
43 | private:
44 |     uint32_t m_ttl = 30U;
45 |     uint32_t m_ipv = 0U;
46 | };
47 | 
48 | 
49 | } // namespace xmrig
50 | 


--------------------------------------------------------------------------------
/src/base/net/dns/DnsRecord.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #pragma once
20 | 
21 | struct addrinfo;
22 | struct sockaddr;
23 | 
24 | #include "base/tools/String.h"
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | class DnsRecord
31 | {
32 | public:
33 |     DnsRecord() {}
34 |     DnsRecord(const addrinfo *addr);
35 | 
36 |     const sockaddr *addr(uint16_t port = 0) const;
37 |     String ip() const;
38 | 
39 | private:
40 |     mutable uint8_t m_data[28]{};
41 | };
42 | 
43 | 
44 | } // namespace xmrig
45 | 


--------------------------------------------------------------------------------
/src/base/net/dns/DnsRecords.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #pragma once
20 | 
21 | #include "base/net/dns/DnsRecord.h"
22 | 
23 | 
24 | namespace xmrig {
25 | 
26 | 
27 | class DnsRecords
28 | {
29 | public:
30 |     DnsRecords() = default;
31 |     DnsRecords(const addrinfo *res, int ai_family);
32 | 
33 |     inline bool isEmpty() const                             { return m_records.empty(); }
34 |     inline const std::vector<DnsRecord> &records() const    { return m_records; }
35 |     inline size_t size() const                              { return m_records.size(); }
36 | 
37 |     const DnsRecord &get() const;
38 | 
39 | private:
40 |     mutable size_t m_index = 0;
41 |     std::vector<DnsRecord> m_records;
42 | };
43 | 
44 | 
45 | } // namespace xmrig
46 | 


--------------------------------------------------------------------------------
/src/base/net/dns/DnsRequest.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2025 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2025 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #pragma once
20 | 
21 | #include "base/kernel/interfaces/IDnsListener.h"
22 | 
23 | 
24 | namespace xmrig {
25 | 
26 | 
27 | class DnsRequest : public IDnsListener
28 | {
29 | public:
30 |     XMRIG_DISABLE_COPY_MOVE_DEFAULT(DnsRequest)
31 | 
32 |     inline DnsRequest(IDnsListener *listener) : m_listener(listener) {}
33 |     ~DnsRequest() override = default;
34 | 
35 | protected:
36 |     inline void onResolved(const DnsRecords &records, int status, const char *error) override {
37 |         m_listener->onResolved(records, status, error);
38 |     }
39 | 
40 | private:
41 |     IDnsListener *m_listener;
42 | };
43 | 
44 | 
45 | } // namespace xmrig
46 | 


--------------------------------------------------------------------------------
/src/base/net/http/HttpApiResponse.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2014-2019 heapwolf    <https://github.com/heapwolf>
 3 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_HTTPAPIRESPONSE_H
21 | #define XMRIG_HTTPAPIRESPONSE_H
22 | 
23 | 
24 | #include "3rdparty/rapidjson/document.h"
25 | #include "base/net/http/HttpResponse.h"
26 | 
27 | 
28 | namespace xmrig {
29 | 
30 | 
31 | class HttpApiResponse : public HttpResponse
32 | {
33 | public:
34 |     HttpApiResponse(uint64_t id);
35 |     HttpApiResponse(uint64_t id, int status);
36 | 
37 |     inline rapidjson::Document &doc() { return m_doc; }
38 | 
39 |     void end();
40 | 
41 | private:
42 |     rapidjson::Document m_doc;
43 | };
44 | 
45 | 
46 | } // namespace xmrig
47 | 
48 | 
49 | #endif // XMRIG_HTTPAPIRESPONSE_H
50 | 
51 | 


--------------------------------------------------------------------------------
/src/base/net/http/HttpListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_HTTPLISTENER_H
20 | #define XMRIG_HTTPLISTENER_H
21 | 
22 | 
23 | #include "base/kernel/interfaces/IHttpListener.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class HttpListener : public IHttpListener
30 | {
31 | public:
32 |     inline HttpListener(IHttpListener *listener, const char *tag = nullptr) :
33 | #       ifdef APP_DEBUG
34 |         m_tag(tag),
35 | #       endif
36 |         m_listener(listener)
37 |     {}
38 | 
39 | protected:
40 |     void onHttpData(const HttpData &data) override;
41 | 
42 | private:
43 | #   ifdef APP_DEBUG
44 |     const char *m_tag;
45 | #   endif
46 |     IHttpListener *m_listener;
47 | };
48 | 
49 | 
50 | } /* namespace xmrig */
51 | 
52 | 
53 | #endif // XMRIG_HTTPLISTENER_H
54 | 


--------------------------------------------------------------------------------
/src/base/net/http/HttpServer.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2014-2019 heapwolf    <https://github.com/heapwolf>
 3 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_HTTPSERVER_H
21 | #define XMRIG_HTTPSERVER_H
22 | 
23 | 
24 | #include "base/kernel/interfaces/ITcpServerListener.h"
25 | #include "base/tools/Object.h"
26 | 
27 | 
28 | #include <memory>
29 | 
30 | 
31 | namespace xmrig {
32 | 
33 | 
34 | class IHttpListener;
35 | 
36 | 
37 | class HttpServer : public ITcpServerListener
38 | {
39 | public:
40 |     XMRIG_DISABLE_COPY_MOVE_DEFAULT(HttpServer)
41 | 
42 |     HttpServer(const std::shared_ptr<IHttpListener> &listener);
43 |     ~HttpServer() override;
44 | 
45 | protected:
46 |     void onConnection(uv_stream_t *stream, uint16_t port) override;
47 | 
48 | private:
49 |     std::weak_ptr<IHttpListener> m_listener;
50 | };
51 | 
52 | 
53 | } // namespace xmrig
54 | 
55 | 
56 | #endif // XMRIG_HTTPSERVER_H
57 | 
58 | 


--------------------------------------------------------------------------------
/src/base/net/stratum/ProxyUrl.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_PROXYURL_H
20 | #define XMRIG_PROXYURL_H
21 | 
22 | 
23 | #include "base/net/stratum/Url.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | class ProxyUrl : public Url
30 | {
31 | public:
32 |     inline ProxyUrl() { m_port = 0; }
33 | 
34 |     ProxyUrl(const rapidjson::Value &value);
35 | 
36 |     inline bool isValid() const { return m_port > 0 && (m_scheme == UNSPECIFIED || m_scheme == SOCKS5); }
37 | 
38 |     const String &host() const;
39 |     rapidjson::Value toJSON(rapidjson::Document &doc) const;
40 | };
41 | 
42 | 
43 | } /* namespace xmrig */
44 | 
45 | 
46 | #endif /* XMRIG_PROXYURL_H */
47 | 


--------------------------------------------------------------------------------
/src/base/net/tools/NetBuffer.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_NETBUFFER_H
20 | #define XMRIG_NETBUFFER_H
21 | 
22 | 
23 | struct uv_buf_t;
24 | using uv_handle_t = struct uv_handle_s;
25 | 
26 | 
27 | #include <cstddef>
28 | 
29 | 
30 | namespace xmrig {
31 | 
32 | 
33 | class NetBuffer
34 | {
35 | public:
36 |     static char *allocate();
37 |     static void destroy();
38 |     static void onAlloc(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf);
39 |     static void release(const char *buf);
40 |     static void release(const uv_buf_t *buf);
41 | };
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 
46 | 
47 | #endif /* XMRIG_NETBUFFER_H */
48 | 


--------------------------------------------------------------------------------
/src/base/tools/Alignment.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2022 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2022 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ALIGNMENT_H
20 | #define XMRIG_ALIGNMENT_H
21 | 
22 | 
23 | #include <type_traits>
24 | #include <cstring>
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | template<typename T>
31 | inline T readUnaligned(const T* ptr)
32 | {
33 |     static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable");
34 | 
35 |     T result;
36 |     memcpy(&result, ptr, sizeof(T));
37 |     return result;
38 | }
39 | 
40 | 
41 | template<typename T>
42 | inline void writeUnaligned(T* ptr, T data)
43 | {
44 |     static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable");
45 | 
46 |     memcpy(ptr, &data, sizeof(T));
47 | }
48 | 
49 | 
50 | } /* namespace xmrig */
51 | 
52 | 
53 | #endif /* XMRIG_ALIGNMENT_H */
54 | 


--------------------------------------------------------------------------------
/src/base/tools/Arguments.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_ARGUMENTS_H
20 | #define XMRIG_ARGUMENTS_H
21 | 
22 | 
23 | #include <vector>
24 | 
25 | 
26 | #include "base/tools/String.h"
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class Arguments
33 | {
34 | public:
35 |     Arguments(int argc, char **argv);
36 | 
37 |     bool hasArg(const char *name) const;
38 |     const char *value(const char *key1, const char *key2 = nullptr) const;
39 | 
40 |     inline char **argv() const                     { return m_argv; }
41 |     inline const std::vector<String> &data() const { return m_data; }
42 |     inline int argc() const                        { return m_argc; }
43 | 
44 | private:
45 |     void add(const char *arg);
46 | 
47 |     char **m_argv;
48 |     int m_argc;
49 |     std::vector<String> m_data;
50 | };
51 | 
52 | 
53 | } /* namespace xmrig */
54 | 
55 | 
56 | #endif /* XMRIG_ARGUMENTS_H */
57 | 


--------------------------------------------------------------------------------
/src/base/tools/Baton.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_BATON_H
20 | #define XMRIG_BATON_H
21 | 
22 | 
23 | namespace xmrig {
24 | 
25 | 
26 | template<typename REQ>
27 | class Baton
28 | {
29 | public:
30 |     inline Baton() { req.data = this; }
31 | 
32 |     REQ req;
33 | };
34 | 
35 | 
36 | } /* namespace xmrig */
37 | 
38 | 
39 | #endif /* XMRIG_BATON_H */
40 | 


--------------------------------------------------------------------------------
/src/base/tools/Buffer.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_BUFFER_H
20 | #define XMRIG_BUFFER_H
21 | 
22 | 
23 | #include <cstdint>
24 | #include <vector>
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | using Buffer = std::vector<uint8_t>;
31 | 
32 | 
33 | } /* namespace xmrig */
34 | 
35 | 
36 | #endif /* XMRIG_BUFFER_H */
37 | 


--------------------------------------------------------------------------------
/src/base/tools/Chrono.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #include "Chrono.h"
20 | 
21 | 
22 | #ifdef XMRIG_OS_WIN
23 | #   include <Windows.h>
24 | #endif
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | double Chrono::highResolutionMSecs()
31 | {
32 | #   ifdef XMRIG_OS_WIN
33 |     LARGE_INTEGER f, t;
34 |     QueryPerformanceFrequency(&f);
35 |     QueryPerformanceCounter(&t);
36 |     return static_cast<double>(t.QuadPart) * 1e3 / f.QuadPart;
37 | #   else
38 |     using namespace std::chrono;
39 |     return static_cast<uint64_t>(duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count()) / 1e6;
40 | #   endif
41 | }
42 | 
43 | 
44 | } /* namespace xmrig */
45 | 


--------------------------------------------------------------------------------
/src/base/tools/Object.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2023 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2023 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_OBJECT_H
20 | #define XMRIG_OBJECT_H
21 | 
22 | 
23 | #include <cstddef>
24 | #include <cstdint>
25 | #include <memory>
26 | 
27 | 
28 | namespace xmrig {
29 | 
30 | 
31 | #define XMRIG_DISABLE_COPY_MOVE(X) \
32 |     X(const X &other)            = delete; \
33 |     X(X &&other)                 = delete; \
34 |     X &operator=(const X &other) = delete; \
35 |     X &operator=(X &&other)      = delete;
36 | 
37 | 
38 | #define XMRIG_DISABLE_COPY_MOVE_DEFAULT(X) \
39 |     X()                          = delete; \
40 |     X(const X &other)            = delete; \
41 |     X(X &&other)                 = delete; \
42 |     X &operator=(const X &other) = delete; \
43 |     X &operator=(X &&other)      = delete;
44 | 
45 | 
46 | } // namespace xmrig
47 | 
48 | 
49 | #endif // XMRIG_OBJECT_H
50 | 


--------------------------------------------------------------------------------
/src/base/tools/Span.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_SPAN_H
20 | #define XMRIG_SPAN_H
21 | 
22 | 
23 | #include "3rdparty/epee/span.h"
24 | 
25 | 
26 | namespace xmrig {
27 | 
28 | 
29 | using Span = epee::span<const uint8_t>;
30 | 
31 | 
32 | } /* namespace xmrig */
33 | 
34 | 
35 | #endif /* XMRIG_SPAN_H */
36 | 


--------------------------------------------------------------------------------
/src/base/tools/bswap_64.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_BSWAP_64_H
20 | #define XMRIG_BSWAP_64_H
21 | 
22 | #ifdef _MSC_VER
23 | 
24 | #include <stdlib.h>
25 | #define bswap_64(x) _byteswap_uint64(x)
26 | #define bswap_32(x) _byteswap_ulong(x)
27 | 
28 | #elif defined __GNUC__
29 | 
30 | #define bswap_64(x) __builtin_bswap64(x)
31 | #define bswap_32(x) __builtin_bswap32(x)
32 | 
33 | #else
34 | 
35 | #include <byteswap.h>
36 | 
37 | #endif
38 | 
39 | #endif /* XMRIG_BSWAP_64_H */
40 | 


--------------------------------------------------------------------------------
/src/core/Taskbar.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_TASKBAR_H
20 | #define XMRIG_TASKBAR_H
21 | 
22 | 
23 | namespace xmrig {
24 | 
25 | 
26 | struct TaskbarPrivate;
27 | 
28 | 
29 | class Taskbar
30 | {
31 | public:
32 |     Taskbar();
33 |     ~Taskbar();
34 | 
35 |     void setActive(bool active);
36 |     void setEnabled(bool enabled);
37 | 
38 | private:
39 |     bool m_active = false;
40 |     bool m_enabled = true;
41 | 
42 |     TaskbarPrivate* d_ptr = nullptr;
43 | 
44 |     void updateTaskbarColor();
45 | };
46 | 
47 | 
48 | } // namespace xmrig
49 | 
50 | 
51 | #endif /* XMRIG_TASKBAR_H */
52 | 


--------------------------------------------------------------------------------
/src/crypto/argon2/Impl.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2020 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_ARGON2_IMPL_H
26 | #define XMRIG_ARGON2_IMPL_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class String;
33 | 
34 | 
35 | namespace argon2 {
36 | 
37 | 
38 | class Impl
39 | {
40 | public:
41 |     static bool select(const String &nameHint, bool benchmark = false);
42 |     static const String &name();
43 | };
44 | 
45 | 
46 | }} // namespace xmrig::argon2
47 | 
48 | 
49 | #endif /* XMRIG_ARGON2_IMPL_H */
50 | 


--------------------------------------------------------------------------------
/src/crypto/cn/CnCtx.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018      Lee Clagett <https://github.com/vtnerd>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_CN_CTX_H
21 | #define XMRIG_CN_CTX_H
22 | 
23 | 
24 | #include <cstddef>
25 | #include <cstdint>
26 | 
27 | 
28 | struct cryptonight_ctx;
29 | 
30 | 
31 | namespace xmrig
32 | {
33 | 
34 | 
35 | class CnCtx
36 | {
37 | public:
38 |     static void create(cryptonight_ctx **ctx, uint8_t *memory, size_t size, size_t count);
39 |     static void release(cryptonight_ctx **ctx, size_t count);
40 | };
41 | 
42 | 
43 | } /* namespace xmrig */
44 | 
45 | 
46 | #endif /* XMRIG_CN_CTX_H */
47 | 


--------------------------------------------------------------------------------
/src/crypto/cn/asm/cn1/cnv1_single_main_loop.inc:
--------------------------------------------------------------------------------
 1 | 	mov	QWORD PTR [rsp+8], rbx
 2 | 	mov	QWORD PTR [rsp+16], rbp
 3 | 	mov	QWORD PTR [rsp+24], rsi
 4 | 	mov	QWORD PTR [rsp+32], rdi
 5 | 	push	r13
 6 | 	push	r14
 7 | 	push	r15
 8 | 	mov	rdx, QWORD PTR [rcx]
 9 | 	mov	esi, 524288
10 | 	mov	r11, QWORD PTR [rdx+32]
11 | 	xor	r11, QWORD PTR [rdx]
12 | 	mov	rdi, QWORD PTR [rdx+224]
13 | 	mov	rbx, QWORD PTR [rdx+40]
14 | 	xor	rbx, QWORD PTR [rdx+8]
15 | 	mov	rcx, QWORD PTR [rdx+56]
16 | 	xor	rcx, QWORD PTR [rdx+24]
17 | 	mov	rax, QWORD PTR [rdx+48]
18 | 	xor	rax, QWORD PTR [rdx+16]
19 | 	mov	rbp, QWORD PTR [rdx+240]
20 | 	mov	r14, QWORD PTR [rdx+232]
21 | 	movq	xmm2, rax
22 | 	pinsrq	xmm2, rcx, 1
23 | 
24 | 	ALIGN(64)
25 | main_loop_cnv1_single:
26 | 	mov	r8, r11
27 | 	and	r8d, 2097136
28 | 	movdqu	xmm1, XMMWORD PTR [rdi+r8]
29 | 	movq	xmm0, r11
30 | 	pinsrq	xmm0, rbx, 1
31 | 	aesenc	xmm1, xmm0
32 | 	movq	r15, xmm1
33 | 	mov	r9, r15
34 | 	and	r9d, 2097136
35 | 	movdqa	xmm0, xmm1
36 | 	pxor	xmm0, xmm2
37 | 	movdqa	xmm2, xmm1
38 | 	movq	QWORD PTR [rdi+r8], xmm0
39 | 	pextrq	rdx, xmm0, 1
40 | 	mov	eax, edx
41 | 	shr	rax, 24
42 | 	mov	ecx, DWORD PTR [r14+rax*4]
43 | 	xor	rcx, rdx
44 | 	mov	QWORD PTR [rdi+r8+8], rcx
45 | 	mov	r10, QWORD PTR [rdi+r9]
46 | 	mov	r8, QWORD PTR [rdi+r9+8]
47 | 	mov	rax, r10
48 | 	mul	r15
49 | 	add	rbx, rax
50 | 	add	r11, rdx
51 | 	mov	QWORD PTR [rdi+r9], r11
52 | 	mov	rax, rbx
53 | 	xor	rbx, r8
54 | 	xor	r11, r10
55 | 	xor	rax, rbp
56 | 	mov	QWORD PTR [rdi+r9+8], rax
57 | 	sub	rsi, 1
58 | 	jne	main_loop_cnv1_single
59 | 
60 | 	pop	r15
61 | 	pop	r14
62 | 	pop	r13
63 | 	mov	rbx, QWORD PTR [rsp+8]
64 | 	mov	rbp, QWORD PTR [rsp+16]
65 | 	mov	rsi, QWORD PTR [rsp+24]
66 | 	mov	rdi, QWORD PTR [rsp+32]
67 | 


--------------------------------------------------------------------------------
/src/crypto/cn/asm/win64/cn1/cnv1_single_main_loop.inc:
--------------------------------------------------------------------------------
 1 | 	mov	QWORD PTR [rsp+8], rbx
 2 | 	mov	QWORD PTR [rsp+16], rbp
 3 | 	mov	QWORD PTR [rsp+24], rsi
 4 | 	mov	QWORD PTR [rsp+32], rdi
 5 | 	push	r13
 6 | 	push	r14
 7 | 	push	r15
 8 | 	mov	rdx, QWORD PTR [rcx]
 9 | 	mov	esi, 524288
10 | 	mov	r11, QWORD PTR [rdx+32]
11 | 	xor	r11, QWORD PTR [rdx]
12 | 	mov	rdi, QWORD PTR [rdx+224]
13 | 	mov	rbx, QWORD PTR [rdx+40]
14 | 	xor	rbx, QWORD PTR [rdx+8]
15 | 	mov	rcx, QWORD PTR [rdx+56]
16 | 	xor	rcx, QWORD PTR [rdx+24]
17 | 	mov	rax, QWORD PTR [rdx+48]
18 | 	xor	rax, QWORD PTR [rdx+16]
19 | 	mov	rbp, QWORD PTR [rdx+240]
20 | 	mov	r14, QWORD PTR [rdx+232]
21 | 	movd	xmm2, rax
22 | 	pinsrq	xmm2, rcx, 1
23 | 
24 | 	ALIGN(64)
25 | main_loop_cnv1_single:
26 | 	mov	r8, r11
27 | 	and	r8d, 2097136
28 | 	movdqu	xmm1, XMMWORD PTR [rdi+r8]
29 | 	movd	xmm0, r11
30 | 	pinsrq	xmm0, rbx, 1
31 | 	aesenc	xmm1, xmm0
32 | 	movd	r15, xmm1
33 | 	mov	r9, r15
34 | 	and	r9d, 2097136
35 | 	movdqa	xmm0, xmm1
36 | 	pxor	xmm0, xmm2
37 | 	movdqa	xmm2, xmm1
38 | 	movd	QWORD PTR [rdi+r8], xmm0
39 | 	pextrq	rdx, xmm0, 1
40 | 	mov	eax, edx
41 | 	shr	rax, 24
42 | 	mov	ecx, DWORD PTR [r14+rax*4]
43 | 	xor	rcx, rdx
44 | 	mov	QWORD PTR [rdi+r8+8], rcx
45 | 	mov	r10, QWORD PTR [rdi+r9]
46 | 	mov	r8, QWORD PTR [rdi+r9+8]
47 | 	mov	rax, r10
48 | 	mul	r15
49 | 	add	rbx, rax
50 | 	add	r11, rdx
51 | 	mov	QWORD PTR [rdi+r9], r11
52 | 	mov	rax, rbx
53 | 	xor	rbx, r8
54 | 	xor	r11, r10
55 | 	xor	rax, rbp
56 | 	mov	QWORD PTR [rdi+r9+8], rax
57 | 	sub	rsi, 1
58 | 	jne	main_loop_cnv1_single
59 | 
60 | 	pop	r15
61 | 	pop	r14
62 | 	pop	r13
63 | 	mov	rbx, QWORD PTR [rsp+8]
64 | 	mov	rbp, QWORD PTR [rsp+16]
65 | 	mov	rsi, QWORD PTR [rsp+24]
66 | 	mov	rdi, QWORD PTR [rsp+32]
67 | 


--------------------------------------------------------------------------------
/src/crypto/cn/c_blake256.h:
--------------------------------------------------------------------------------
 1 | #ifndef _BLAKE256_H_
 2 | #define _BLAKE256_H_
 3 | 
 4 | #include <stdint.h>
 5 | 
 6 | typedef struct {
 7 |   uint32_t h[8], s[4], t[2];
 8 |   int buflen, nullt;
 9 |   uint8_t buf[64];
10 | } state;
11 | 
12 | typedef struct {
13 |   state inner;
14 |   state outer;
15 | } hmac_state;
16 | 
17 | void blake256_init(state *);
18 | void blake224_init(state *);
19 | 
20 | void blake256_update(state *, const uint8_t *, uint64_t);
21 | void blake224_update(state *, const uint8_t *, uint64_t);
22 | 
23 | void blake256_final(state *, uint8_t *);
24 | void blake224_final(state *, uint8_t *);
25 | 
26 | void blake256_hash(uint8_t *, const uint8_t *, uint64_t);
27 | void blake224_hash(uint8_t *, const uint8_t *, uint64_t);
28 | 
29 | /* HMAC functions: */
30 | 
31 | void hmac_blake256_init(hmac_state *, const uint8_t *, uint64_t);
32 | void hmac_blake224_init(hmac_state *, const uint8_t *, uint64_t);
33 | 
34 | void hmac_blake256_update(hmac_state *, const uint8_t *, uint64_t);
35 | void hmac_blake224_update(hmac_state *, const uint8_t *, uint64_t);
36 | 
37 | void hmac_blake256_final(hmac_state *, uint8_t *);
38 | void hmac_blake224_final(hmac_state *, uint8_t *);
39 | 
40 | void hmac_blake256_hash(uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint64_t);
41 | void hmac_blake224_hash(uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint64_t);
42 | 
43 | #endif /* _BLAKE256_H_ */
44 | 


--------------------------------------------------------------------------------
/src/crypto/cn/c_groestl.h:
--------------------------------------------------------------------------------
 1 | #ifndef __hash_h
 2 | #define __hash_h
 3 | /*
 4 | #include "crypto_uint8.h"
 5 | #include "crypto_uint32.h"
 6 | #include "crypto_uint64.h"
 7 | #include "crypto_hash.h"
 8 | 
 9 | typedef crypto_uint8 uint8_t;
10 | typedef crypto_uint32 uint32_t;
11 | typedef crypto_uint64 uint64_t;
12 | */
13 | #include <stdint.h>
14 | 
15 | #include "hash.h"
16 | 
17 | /* some sizes (number of bytes) */
18 | #define ROWS 8
19 | #define LENGTHFIELDLEN ROWS
20 | #define COLS512 8
21 | 
22 | #define SIZE512 (ROWS*COLS512)
23 | 
24 | #define ROUNDS512 10
25 | #define HASH_BIT_LEN 256
26 | 
27 | #define ROTL32(v, n) ((((v)<<(n))|((v)>>(32-(n))))&li_32(ffffffff))
28 | 
29 | 
30 | #define li_32(h) 0x##h##u
31 | #define EXT_BYTE(var,n) ((uint8_t)((uint32_t)(var) >> (8*n)))
32 | #define u32BIG(a)				\
33 |   ((ROTL32(a,8) & li_32(00FF00FF)) |		\
34 |    (ROTL32(a,24) & li_32(FF00FF00)))
35 | 
36 | 
37 | /* NIST API begin */
38 | typedef struct {
39 |   uint32_t chaining[SIZE512/sizeof(uint32_t)];            /* actual state */
40 |   uint32_t block_counter1,
41 |   block_counter2;         /* message block counter(s) */
42 |   BitSequence buffer[SIZE512];      /* data buffer */
43 |   int buf_ptr;              /* data buffer pointer */
44 |   int bits_in_last_byte;    /* no. of message bits in last byte of
45 | 			       data buffer */
46 | } groestlHashState;
47 | 
48 | /*void Init(hashState*);
49 | void Update(hashState*, const BitSequence*, DataLength);
50 | void Final(hashState*, BitSequence*); */
51 | void groestl(const BitSequence*, DataLength, BitSequence*);
52 | /* NIST API end   */
53 | 
54 | /*
55 | int crypto_hash(unsigned char *out,
56 | 		const unsigned char *in,
57 | 		unsigned long long len);
58 | */
59 | 
60 | #endif /* __hash_h */
61 | 


--------------------------------------------------------------------------------
/src/crypto/cn/c_jh.h:
--------------------------------------------------------------------------------
 1 | /*This program gives the 64-bit optimized bitslice implementation of JH using ANSI C
 2 | 
 3 |    --------------------------------
 4 |    Performance
 5 | 
 6 |    Microprocessor: Intel CORE 2 processor (Core 2 Duo Mobile T6600 2.2GHz)
 7 |    Operating System: 64-bit Ubuntu 10.04 (Linux kernel 2.6.32-22-generic)
 8 |    Speed for long message:
 9 |    1) 45.8 cycles/byte   compiler: Intel C++ Compiler 11.1   compilation option: icc -O2
10 |    2) 56.8 cycles/byte   compiler: gcc 4.4.3                 compilation option: gcc -O3
11 | 
12 |    --------------------------------
13 |    Last Modified: January 16, 2011
14 | */
15 | #pragma once
16 | 
17 | #include "hash.h"
18 | 
19 | HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
20 | 


--------------------------------------------------------------------------------
/src/crypto/cn/hash.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | 
3 | typedef unsigned char BitSequence;
4 | typedef unsigned long long DataLength;
5 | typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;
6 | 


--------------------------------------------------------------------------------
/src/crypto/common/HugePagesInfo.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include "crypto/common/HugePagesInfo.h"
21 | #include "crypto/common/VirtualMemory.h"
22 | 
23 | 
24 | xmrig::HugePagesInfo::HugePagesInfo(const VirtualMemory *memory)
25 | {
26 |     if (memory->isOneGbPages()) {
27 |         size        = VirtualMemory::align(memory->size(), VirtualMemory::kOneGiB);
28 |         total       = size / VirtualMemory::kOneGiB;
29 |         allocated   = size / VirtualMemory::kOneGiB;
30 |     }
31 |     else {
32 |         size        = VirtualMemory::alignToHugePageSize(memory->size());
33 |         total       = size / VirtualMemory::hugePageSize();
34 |         allocated   = memory->isHugePages() ? total : 0;
35 |     }
36 | }
37 | 


--------------------------------------------------------------------------------
/src/crypto/common/LinuxMemory.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_LINUXMEMORY_H
20 | #define XMRIG_LINUXMEMORY_H
21 | 
22 | 
23 | #include <cstdint>
24 | #include <cstddef>
25 | 
26 | 
27 | namespace xmrig {
28 | 
29 | 
30 | class LinuxMemory
31 | {
32 | public:
33 |     static bool reserve(size_t size, uint32_t node, size_t hugePageSize);
34 | 
35 |     static bool write(const char *path, uint64_t value);
36 |     static int64_t read(const char *path);
37 | };
38 | 
39 | 
40 | } /* namespace xmrig */
41 | 
42 | 
43 | #endif /* XMRIG_LINUXMEMORY_H */
44 | 


--------------------------------------------------------------------------------
/src/crypto/common/VirtualMemory_hwloc.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018      Lee Clagett <https://github.com/vtnerd>
 3 |  * Copyright (c) 2018-2019 tevador     <tevador@gmail.com>
 4 |  * Copyright (c) 2018-2023 SChernykh   <https://github.com/SChernykh>
 5 |  * Copyright (c) 2016-2023 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 6 |  *
 7 |  *   This program is free software: you can redistribute it and/or modify
 8 |  *   it under the terms of the GNU General Public License as published by
 9 |  *   the Free Software Foundation, either version 3 of the License, or
10 |  *   (at your option) any later version.
11 |  *
12 |  *   This program is distributed in the hope that it will be useful,
13 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 |  *   GNU General Public License for more details.
16 |  *
17 |  *   You should have received a copy of the GNU General Public License
18 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
19 |  */
20 | 
21 | #include "crypto/common/VirtualMemory.h"
22 | #include "backend/cpu/Cpu.h"
23 | #include "base/io/log/Log.h"
24 | 
25 | 
26 | #include <hwloc.h>
27 | 
28 | 
29 | uint32_t xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
30 | {
31 |     if (affinity < 0 || Cpu::info()->nodes() < 2) {
32 |         return 0;
33 |     }
34 | 
35 |     auto pu = hwloc_get_pu_obj_by_os_index(Cpu::info()->topology(), static_cast<unsigned>(affinity));
36 | 
37 |     if (pu == nullptr || !Cpu::info()->membind(pu->nodeset)) {
38 |         LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity);
39 | 
40 |         return 0;
41 |     }
42 | 
43 |     return hwloc_bitmap_first(pu->nodeset);
44 | }
45 | 


--------------------------------------------------------------------------------
/src/crypto/ghostrider/ghostrider.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_GR_HASH_H
20 | #define XMRIG_GR_HASH_H
21 | 
22 | 
23 | #include <cstddef>
24 | #include <cstdint>
25 | #include <vector>
26 | 
27 | 
28 | struct cryptonight_ctx;
29 | 
30 | 
31 | namespace xmrig
32 | {
33 | 
34 | 
35 | namespace ghostrider
36 | {
37 | 
38 | 
39 | struct HelperThread;
40 | 
41 | void benchmark();
42 | HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::vector<int64_t>& affinities);
43 | void destroy_helper_thread(HelperThread* t);
44 | void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ctx** ctx, HelperThread* helper, bool verbose = true);
45 | 
46 | 
47 | } // namespace ghostrider
48 | 
49 | 
50 | } // namespace xmrig
51 | 
52 | #endif // XMRIG_GR_HASH_H


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_epilogue_linux.inc:
--------------------------------------------------------------------------------
 1 | 	;# restore callee-saved registers - System V AMD64 ABI
 2 | 	pop r15
 3 | 	pop r14
 4 | 	pop r13
 5 | 	pop r12
 6 | 	pop rbp
 7 | 	pop rbx
 8 | 
 9 | 	;# program finished
10 | 	ret 0


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_epilogue_store.inc:
--------------------------------------------------------------------------------
 1 | 	;# save VM register values
 2 | 	add rsp, 40
 3 | 	pop rcx
 4 | 	mov qword ptr [rcx+0], r8
 5 | 	mov qword ptr [rcx+8], r9
 6 | 	mov qword ptr [rcx+16], r10
 7 | 	mov qword ptr [rcx+24], r11
 8 | 	mov qword ptr [rcx+32], r12
 9 | 	mov qword ptr [rcx+40], r13
10 | 	mov qword ptr [rcx+48], r14
11 | 	mov qword ptr [rcx+56], r15
12 | 	movdqa xmmword ptr [rcx+64], xmm0
13 | 	movdqa xmmword ptr [rcx+80], xmm1
14 | 	movdqa xmmword ptr [rcx+96], xmm2
15 | 	movdqa xmmword ptr [rcx+112], xmm3
16 | 	lea rcx, [rcx+64]
17 | 	movdqa xmmword ptr [rcx+64], xmm4
18 | 	movdqa xmmword ptr [rcx+80], xmm5
19 | 	movdqa xmmword ptr [rcx+96], xmm6
20 | 	movdqa xmmword ptr [rcx+112], xmm7


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_epilogue_win64.inc:
--------------------------------------------------------------------------------
 1 | 	;# restore callee-saved registers - Microsoft x64 calling convention
 2 | 	movdqu xmm15, xmmword ptr [rsp]
 3 | 	movdqu xmm14, xmmword ptr [rsp+16]
 4 | 	movdqu xmm13, xmmword ptr [rsp+32]
 5 | 	movdqu xmm12, xmmword ptr [rsp+48]
 6 | 	movdqu xmm11, xmmword ptr [rsp+64]
 7 | 	add rsp, 80
 8 | 	movdqu xmm10, xmmword ptr [rsp]
 9 | 	movdqu xmm9, xmmword ptr [rsp+16]
10 | 	movdqu xmm8, xmmword ptr [rsp+32]
11 | 	movdqu xmm7, xmmword ptr [rsp+48]
12 | 	movdqu xmm6, xmmword ptr [rsp+64]
13 | 	add rsp, 80
14 | 	pop r15
15 | 	pop r14
16 | 	pop r13
17 | 	pop r12
18 | 	pop rsi
19 | 	pop rdi
20 | 	pop rbp
21 | 	pop rbx
22 | 
23 | 	;# program finished
24 | 	ret
25 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_imul_rcp_store.inc:
--------------------------------------------------------------------------------
 1 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 2 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 3 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 4 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 5 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 6 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 7 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 8 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
 9 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
10 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
11 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
12 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
13 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
14 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
15 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
16 | 	db 72, 185, 0, 0, 0, 0, 0, 0, 0, 0, 81
17 | 	add rsp, 128
18 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_loop_load.inc:
--------------------------------------------------------------------------------
 1 | 	lea rcx, [rsi+rax]
 2 | 	mov [rsp+16], rcx
 3 | 	xor r8,  qword ptr [rcx+0]
 4 | 	xor r9,  qword ptr [rcx+8]
 5 | 	xor r10, qword ptr [rcx+16]
 6 | 	xor r11, qword ptr [rcx+24]
 7 | 	xor r12, qword ptr [rcx+32]
 8 | 	xor r13, qword ptr [rcx+40]
 9 | 	xor r14, qword ptr [rcx+48]
10 | 	xor r15, qword ptr [rcx+56]
11 | 	lea rcx, [rsi+rdx]
12 | 	mov [rsp+24], rcx
13 | 	cvtdq2pd xmm0, qword ptr [rcx+0]
14 | 	cvtdq2pd xmm1, qword ptr [rcx+8]
15 | 	cvtdq2pd xmm2, qword ptr [rcx+16]
16 | 	cvtdq2pd xmm3, qword ptr [rcx+24]
17 | 	cvtdq2pd xmm4, qword ptr [rcx+32]
18 | 	cvtdq2pd xmm5, qword ptr [rcx+40]
19 | 	cvtdq2pd xmm6, qword ptr [rcx+48]
20 | 	cvtdq2pd xmm7, qword ptr [rcx+56]
21 | 	andpd xmm4, xmm13
22 | 	andpd xmm5, xmm13
23 | 	andpd xmm6, xmm13
24 | 	andpd xmm7, xmm13
25 | 	orpd xmm4, xmm14
26 | 	orpd xmm5, xmm14
27 | 	orpd xmm6, xmm14
28 | 	orpd xmm7, xmm14
29 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_loop_load_xop.inc:
--------------------------------------------------------------------------------
 1 | 	lea rcx, [rsi+rax]
 2 | 	mov [rsp+16], rcx
 3 | 	xor r8,  qword ptr [rcx+0]
 4 | 	xor r9,  qword ptr [rcx+8]
 5 | 	xor r10, qword ptr [rcx+16]
 6 | 	xor r11, qword ptr [rcx+24]
 7 | 	xor r12, qword ptr [rcx+32]
 8 | 	xor r13, qword ptr [rcx+40]
 9 | 	xor r14, qword ptr [rcx+48]
10 | 	xor r15, qword ptr [rcx+56]
11 | 	lea rcx, [rsi+rdx]
12 | 	mov [rsp+24], rcx
13 | 	cvtdq2pd xmm0, qword ptr [rcx+0]
14 | 	cvtdq2pd xmm1, qword ptr [rcx+8]
15 | 	cvtdq2pd xmm2, qword ptr [rcx+16]
16 | 	cvtdq2pd xmm3, qword ptr [rcx+24]
17 | 	cvtdq2pd xmm4, qword ptr [rcx+32]
18 | 	cvtdq2pd xmm5, qword ptr [rcx+40]
19 | 	cvtdq2pd xmm6, qword ptr [rcx+48]
20 | 	cvtdq2pd xmm7, qword ptr [rcx+56]
21 | 	vpcmov xmm4, xmm4, xmm14, xmm13
22 | 	vpcmov xmm5, xmm5, xmm14, xmm13
23 | 	vpcmov xmm6, xmm6, xmm14, xmm13
24 | 	vpcmov xmm7, xmm7, xmm14, xmm13
25 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_loop_store.inc:
--------------------------------------------------------------------------------
 1 | 	mov rcx, [rsp+24]
 2 | 	mov qword ptr [rcx+0], r8
 3 | 	mov qword ptr [rcx+8], r9
 4 | 	mov qword ptr [rcx+16], r10
 5 | 	mov qword ptr [rcx+24], r11
 6 | 	mov qword ptr [rcx+32], r12
 7 | 	mov qword ptr [rcx+40], r13
 8 | 	mov qword ptr [rcx+48], r14
 9 | 	mov qword ptr [rcx+56], r15
10 | 	mov rcx, [rsp+16]
11 | 	xorpd xmm0, xmm4
12 | 	xorpd xmm1, xmm5
13 | 	xorpd xmm2, xmm6
14 | 	xorpd xmm3, xmm7
15 | 	movapd xmmword ptr [rcx+0], xmm0
16 | 	movapd xmmword ptr [rcx+16], xmm1
17 | 	movapd xmmword ptr [rcx+32], xmm2
18 | 	movapd xmmword ptr [rcx+48], xmm3
19 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_prologue_linux.inc:
--------------------------------------------------------------------------------
 1 | 	;# callee-saved registers - System V AMD64 ABI
 2 | 	push rbx
 3 | 	push rbp
 4 | 	push r12
 5 | 	push r13
 6 | 	push r14
 7 | 	push r15
 8 | 
 9 | 	;# function arguments
10 | 	mov rbx, rcx                ;# loop counter
11 | 	push rdi                    ;# RegisterFile& registerFile
12 | 	mov rcx, rdi
13 | 	mov rbp, qword ptr [rsi]    ;# "mx", "ma"
14 | 	mov rdi, qword ptr [rsi+8]  ;# uint8_t* dataset
15 | 
16 | 	;# dataset prefetch for the first iteration of the main loop
17 | 	mov rax, rbp
18 | 	shr rax, 32
19 | 	and eax, RANDOMX_DATASET_BASE_MASK
20 | 	prefetchnta byte ptr [rdi+rax]
21 | 
22 | 	mov rsi, rdx                ;# uint8_t* scratchpad
23 | 
24 | 	mov rax, rbp
25 | 	ror rbp, 32
26 | 
27 | 	;# zero integer registers
28 | 	xor r8, r8
29 | 	xor r9, r9
30 | 	xor r10, r10
31 | 	xor r11, r11
32 | 	xor r12, r12
33 | 	xor r13, r13
34 | 	xor r14, r14
35 | 	xor r15, r15
36 | 
37 | 	;# load constant registers
38 | 	lea rcx, [rcx+120]
39 | 	movapd xmm8, xmmword ptr [rcx+72]
40 | 	movapd xmm9, xmmword ptr [rcx+88]
41 | 	movapd xmm10, xmmword ptr [rcx+104]
42 | 	movapd xmm11, xmmword ptr [rcx+120]
43 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_prologue_win64.inc:
--------------------------------------------------------------------------------
 1 | 	;# callee-saved registers - Microsoft x64 calling convention
 2 | 	push rbx
 3 | 	push rbp
 4 | 	push rdi
 5 | 	push rsi
 6 | 	push r12
 7 | 	push r13
 8 | 	push r14
 9 | 	push r15
10 | 	sub rsp, 80
11 | 	movdqu xmmword ptr [rsp+64], xmm6
12 | 	movdqu xmmword ptr [rsp+48], xmm7
13 | 	movdqu xmmword ptr [rsp+32], xmm8
14 | 	movdqu xmmword ptr [rsp+16], xmm9
15 | 	movdqu xmmword ptr [rsp+0], xmm10
16 | 	sub rsp, 80
17 | 	movdqu xmmword ptr [rsp+64], xmm11
18 | 	movdqu xmmword ptr [rsp+48], xmm12
19 | 	movdqu xmmword ptr [rsp+32], xmm13
20 | 	movdqu xmmword ptr [rsp+16], xmm14
21 | 	movdqu xmmword ptr [rsp+0], xmm15
22 | 
23 | 	;# function arguments
24 | 	push rcx                    ;# RegisterFile& registerFile
25 | 	mov rbp, qword ptr [rdx]    ;# "mx", "ma"
26 | 	mov rdi, qword ptr [rdx+8]  ;# uint8_t* dataset
27 | 
28 | 	;# dataset prefetch for the first iteration of the main loop
29 | 	mov rax, rbp
30 | 	shr rax, 32
31 | 	and eax, RANDOMX_DATASET_BASE_MASK
32 | 	prefetchnta byte ptr [rdi+rax]
33 | 
34 | 	mov rsi, r8                 ;# uint8_t* scratchpad
35 | 	mov rbx, r9                 ;# loop counter
36 | 
37 | 	mov rax, rbp
38 | 	ror rbp, 32
39 | 
40 | 	;# zero integer registers
41 | 	xor r8, r8
42 | 	xor r9, r9
43 | 	xor r10, r10
44 | 	xor r11, r11
45 | 	xor r12, r12
46 | 	xor r13, r13
47 | 	xor r14, r14
48 | 	xor r15, r15
49 | 
50 | 	;# load constant registers
51 | 	lea rcx, [rcx+120]
52 | 	movapd xmm8, xmmword ptr [rcx+72]
53 | 	movapd xmm9, xmmword ptr [rcx+88]
54 | 	movapd xmm10, xmmword ptr [rcx+104]
55 | 	movapd xmm11, xmmword ptr [rcx+120]
56 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_read_dataset.inc:
--------------------------------------------------------------------------------
 1 | 	mov ecx, ebp                       ;# ecx = ma
 2 | 	and ecx, RANDOMX_DATASET_BASE_MASK
 3 | 	xor r8, qword ptr [rdi+rcx]
 4 | 	ror rbp, 32                        ;# swap "ma" and "mx"
 5 | 	xor rbp, rax                       ;# modify "mx"
 6 | 	mov edx, ebp                       ;# edx = mx
 7 | 	and edx, RANDOMX_DATASET_BASE_MASK
 8 | 	prefetchnta byte ptr [rdi+rdx]
 9 | 	xor r9,  qword ptr [rdi+rcx+8]
10 | 	xor r10, qword ptr [rdi+rcx+16]
11 | 	xor r11, qword ptr [rdi+rcx+24]
12 | 	xor r12, qword ptr [rdi+rcx+32]
13 | 	xor r13, qword ptr [rdi+rcx+40]
14 | 	xor r14, qword ptr [rdi+rcx+48]
15 | 	xor r15, qword ptr [rdi+rcx+56]
16 | 	


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_read_dataset_sshash_fin.inc:
--------------------------------------------------------------------------------
 1 | 	mov rbx, qword ptr [rsp+64]
 2 | 	xor r8, qword ptr [rsp+56]
 3 | 	xor r9, qword ptr [rsp+48]
 4 | 	xor r10, qword ptr [rsp+40]
 5 | 	xor r11, qword ptr [rsp+32]
 6 | 	xor r12, qword ptr [rsp+24]
 7 | 	xor r13, qword ptr [rsp+16]
 8 | 	xor r14, qword ptr [rsp+8]
 9 | 	xor r15, qword ptr [rsp+0]
10 | 	add rsp, 200


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_read_dataset_sshash_init.inc:
--------------------------------------------------------------------------------
 1 | 	sub rsp, 200
 2 | 	mov qword ptr [rsp+64], rbx
 3 | 	mov qword ptr [rsp+56], r8
 4 | 	mov qword ptr [rsp+48], r9
 5 | 	mov qword ptr [rsp+40], r10
 6 | 	mov qword ptr [rsp+32], r11
 7 | 	mov qword ptr [rsp+24], r12
 8 | 	mov qword ptr [rsp+16], r13
 9 | 	mov qword ptr [rsp+8], r14
10 | 	mov qword ptr [rsp+0], r15
11 | 	ror rbp, 32                        ;# swap "ma" and "mx"
12 | 	xor rbp, rax                       ;# modify "mx"
13 | 	mov rbx, rbp                       ;# ebx = ma
14 | 	shr rbx, 38
15 | 	and ebx, RANDOMX_DATASET_BASE_MASK / 64 ;# ebx = Dataset block number
16 | 	;# add ebx, datasetOffset / 64
17 | 	;# call 32768


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_avx2_constants.inc:
--------------------------------------------------------------------------------
 1 | r0_avx2_increments:
 2 | 	db 2,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0
 3 | mul_hi_avx2_data:
 4 | 	db 0,0,0,0,1,0,0,0
 5 | r0_avx2_mul:
 6 | 	;#/ 6364136223846793005
 7 | 	db 45, 127, 149, 76, 45, 244, 81, 88
 8 | r1_avx2_add:
 9 | 	;#/ 9298411001130361340
10 | 	db 252, 161, 245, 89, 138, 151, 10, 129
11 | r2_avx2_add:
12 | 	;#/ 12065312585734608966
13 | 	db 70, 216, 194, 56, 223, 153, 112, 167
14 | r3_avx2_add:
15 | 	;#/ 9306329213124626780
16 | 	db 92, 73, 34, 191, 28, 185, 38, 129
17 | r4_avx2_add:
18 | 	;#/ 5281919268842080866
19 | 	db 98, 138, 159, 23, 151, 37, 77, 73
20 | r5_avx2_add:
21 | 	;#/ 10536153434571861004
22 | 	db 12, 236, 170, 206, 185, 239, 55, 146
23 | r6_avx2_add:
24 | 	;#/ 3398623926847679864
25 | 	db 120, 45, 230, 108, 116, 86, 42, 47
26 | r7_avx2_add:
27 | 	;#/ 9549104520008361294
28 | 	db 78, 229, 44, 182, 247, 59, 133, 132


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_avx2_epilogue.inc:
--------------------------------------------------------------------------------
 1 | 	add rsp, 40
 2 | 	pop r9
 3 | 
 4 | 	movdqu xmm0,  xmmword ptr [rsp]
 5 | 	movdqu xmm1,  xmmword ptr [rsp + 16]
 6 | 	movdqu xmm2,  xmmword ptr [rsp + 32]
 7 | 	movdqu xmm3,  xmmword ptr [rsp + 48]
 8 | 	movdqu xmm4,  xmmword ptr [rsp + 64]
 9 | 	movdqu xmm5,  xmmword ptr [rsp + 80]
10 | 	movdqu xmm6,  xmmword ptr [rsp + 96]
11 | 	movdqu xmm7,  xmmword ptr [rsp + 112]
12 | 	movdqu xmm8,  xmmword ptr [rsp + 128]
13 | 	movdqu xmm9,  xmmword ptr [rsp + 144]
14 | 	movdqu xmm10, xmmword ptr [rsp + 160]
15 | 	movdqu xmm11, xmmword ptr [rsp + 176]
16 | 	movdqu xmm12, xmmword ptr [rsp + 192]
17 | 	movdqu xmm13, xmmword ptr [rsp + 208]
18 | 	movdqu xmm14, xmmword ptr [rsp + 224]
19 | 	movdqu xmm15, xmmword ptr [rsp + 240]
20 | 	vzeroupper
21 | 	add rsp, 256
22 | 
23 | 	pop r15
24 | 	pop r14
25 | 	pop r13
26 | 	pop r12
27 | 	pop rsi
28 | 	pop rdi
29 | 	pop rbp
30 | 	pop rbx
31 | 	ret
32 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_avx2_loop_begin.inc:
--------------------------------------------------------------------------------
 1 | 	;# prefetch RandomX dataset lines
 2 | 	prefetchnta byte ptr [rsi]
 3 | 	prefetchnta byte ptr [rsi+64]
 4 | 	prefetchnta byte ptr [rsi+128]
 5 | 	prefetchnta byte ptr [rsi+192]
 6 | 	prefetchnta byte ptr [rsi+256]
 7 | 
 8 | 	;# prefetch RandomX cache lines
 9 | 	mov rbx, rbp
10 | 	and rbx, RANDOMX_CACHE_MASK
11 | 	shl rbx, 6
12 | 	add rbx, rdi
13 | 	prefetchnta byte ptr [rbx]
14 | 	lea rax, [rbp+1]
15 | 	and rax, RANDOMX_CACHE_MASK
16 | 	shl rax, 6
17 | 	add rax, rdi
18 | 	prefetchnta byte ptr [rax]
19 | 	mov [rsp], rax
20 | 	lea rax, [rbp+2]
21 | 	and rax, RANDOMX_CACHE_MASK
22 | 	shl rax, 6
23 | 	add rax, rdi
24 | 	prefetchnta byte ptr [rax]
25 | 	mov [rsp+8], rax
26 | 	lea rax, [rbp+3]
27 | 	and rax, RANDOMX_CACHE_MASK
28 | 	shl rax, 6
29 | 	add rax, rdi
30 | 	prefetchnta byte ptr [rax]
31 | 	mov [rsp+16], rax
32 | 	lea rax, [rbp+4]
33 | 	and rax, RANDOMX_CACHE_MASK
34 | 	shl rax, 6
35 | 	add rax, rdi
36 | 	prefetchnta byte ptr [rax]
37 | 	mov [rsp+24], rax
38 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_avx2_loop_end.inc:
--------------------------------------------------------------------------------
 1 | 	mov qword ptr [rsi+0], r8
 2 | 	vpunpcklqdq ymm8, ymm0, ymm1
 3 | 	mov qword ptr [rsi+8], r9
 4 | 	vpunpcklqdq ymm9, ymm2, ymm3
 5 | 	mov qword ptr [rsi+16], r10
 6 | 	vpunpcklqdq ymm10, ymm4, ymm5
 7 | 	mov qword ptr [rsi+24], r11
 8 | 	vpunpcklqdq ymm11, ymm6, ymm7
 9 | 	mov qword ptr [rsi+32], r12
10 | 	vpunpckhqdq ymm12, ymm0, ymm1
11 | 	mov qword ptr [rsi+40], r13
12 | 	vpunpckhqdq ymm13, ymm2, ymm3
13 | 	mov qword ptr [rsi+48], r14
14 | 	vpunpckhqdq ymm14, ymm4, ymm5
15 | 	mov qword ptr [rsi+56], r15
16 | 	vpunpckhqdq ymm15, ymm6, ymm7
17 | 
18 | 	vperm2i128 ymm0, ymm8, ymm9, 32
19 | 	vperm2i128 ymm1, ymm10, ymm11, 32
20 | 	vmovdqu ymmword ptr [rsi+64], ymm0
21 | 	vmovdqu ymmword ptr [rsi+96], ymm1
22 | 	vperm2i128 ymm2, ymm12, ymm13, 32
23 | 	vperm2i128 ymm3, ymm14, ymm15, 32
24 | 	vmovdqu ymmword ptr [rsi+128], ymm2
25 | 	vmovdqu ymmword ptr [rsi+160], ymm3
26 | 	vperm2i128 ymm4, ymm8, ymm9, 49
27 | 	vperm2i128 ymm5, ymm10, ymm11, 49
28 | 	vmovdqu ymmword ptr [rsi+192], ymm4
29 | 	vmovdqu ymmword ptr [rsi+224], ymm5
30 | 	vperm2i128 ymm6, ymm12, ymm13, 49
31 | 	vperm2i128 ymm7, ymm14, ymm15, 49
32 | 	vmovdqu ymmword ptr [rsi+256], ymm6
33 | 	vmovdqu ymmword ptr [rsi+288], ymm7
34 | 
35 | 	add rbp, 5
36 | 	add rsi, 320
37 | 	cmp rbp, qword ptr [rsp+40]
38 | 	db 15, 130, 0, 0, 0, 0		;# jb rel32
39 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_avx2_save_registers.inc:
--------------------------------------------------------------------------------
 1 | 	push rbx
 2 | 	push rbp
 3 | 	push rdi
 4 | 	push rsi
 5 | 	push r12
 6 | 	push r13
 7 | 	push r14
 8 | 	push r15
 9 | 
10 | 	;# save all XMM registers just to be safe for all calling conventions
11 | 	sub rsp, 256
12 | 	movdqu xmmword ptr [rsp], xmm0
13 | 	movdqu xmmword ptr [rsp + 16], xmm1
14 | 	movdqu xmmword ptr [rsp + 32], xmm2
15 | 	movdqu xmmword ptr [rsp + 48], xmm3
16 | 	movdqu xmmword ptr [rsp + 64], xmm4
17 | 	movdqu xmmword ptr [rsp + 80], xmm5
18 | 	movdqu xmmword ptr [rsp + 96], xmm6
19 | 	movdqu xmmword ptr [rsp + 112], xmm7
20 | 	movdqu xmmword ptr [rsp + 128], xmm8
21 | 	movdqu xmmword ptr [rsp + 144], xmm9
22 | 	movdqu xmmword ptr [rsp + 160], xmm10
23 | 	movdqu xmmword ptr [rsp + 176], xmm11
24 | 	movdqu xmmword ptr [rsp + 192], xmm12
25 | 	movdqu xmmword ptr [rsp + 208], xmm13
26 | 	movdqu xmmword ptr [rsp + 224], xmm14
27 | 	movdqu xmmword ptr [rsp + 240], xmm15
28 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_avx2_ssh_prefetch.inc:
--------------------------------------------------------------------------------
 1 | 	vmovdqu ymmword ptr [rsp], ymm0
 2 | 
 3 | 	mov rax, [rsp]
 4 | 	and rax, RANDOMX_CACHE_MASK
 5 | 	shl rax, 6
 6 | 	add rax, rdi
 7 | 	mov [rsp], rax
 8 | 	prefetchnta byte ptr [rax]
 9 | 
10 | 	mov rax, [rsp+8]
11 | 	and rax, RANDOMX_CACHE_MASK
12 | 	shl rax, 6
13 | 	add rax, rdi
14 | 	mov [rsp+8], rax
15 | 	prefetchnta byte ptr [rax]
16 | 
17 | 	mov rax, [rsp+16]
18 | 	and rax, RANDOMX_CACHE_MASK
19 | 	shl rax, 6
20 | 	add rax, rdi
21 | 	mov [rsp+16], rax
22 | 	prefetchnta byte ptr [rax]
23 | 
24 | 	mov rax, [rsp+24]
25 | 	and rax, RANDOMX_CACHE_MASK
26 | 	shl rax, 6
27 | 	add rax, rdi
28 | 	mov [rsp+24], rax
29 | 	prefetchnta byte ptr [rax]
30 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_constants.inc:
--------------------------------------------------------------------------------
 1 | r0_mul:
 2 | 	;#/ 6364136223846793005
 3 | 	db 45, 127, 149, 76, 45, 244, 81, 88
 4 | r1_add:
 5 | 	;#/ 9298411001130361340
 6 | 	db 252, 161, 245, 89, 138, 151, 10, 129
 7 | r2_add:
 8 | 	;#/ 12065312585734608966
 9 | 	db 70, 216, 194, 56, 223, 153, 112, 167
10 | r3_add:
11 | 	;#/ 9306329213124626780
12 | 	db 92, 73, 34, 191, 28, 185, 38, 129
13 | r4_add:
14 | 	;#/ 5281919268842080866
15 | 	db 98, 138, 159, 23, 151, 37, 77, 73
16 | r5_add:
17 | 	;#/ 10536153434571861004
18 | 	db 12, 236, 170, 206, 185, 239, 55, 146
19 | r6_add:
20 | 	;#/ 3398623926847679864
21 | 	db 120, 45, 230, 108, 116, 86, 42, 47
22 | r7_add:
23 | 	;#/ 9549104520008361294
24 | 	db 78, 229, 44, 182, 247, 59, 133, 132


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_load.inc:
--------------------------------------------------------------------------------
1 | 	xor r8, qword ptr [rbx+0]
2 | 	xor r9, qword ptr [rbx+8]
3 | 	xor r10, qword ptr [rbx+16]
4 | 	xor r11, qword ptr [rbx+24]
5 | 	xor r12, qword ptr [rbx+32]
6 | 	xor r13, qword ptr [rbx+40]
7 | 	xor r14, qword ptr [rbx+48]
8 | 	xor r15, qword ptr [rbx+56]


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_sshash_prefetch.inc:
--------------------------------------------------------------------------------
1 | 	and rbx, RANDOMX_CACHE_MASK
2 | 	shl rbx, 6
3 | 	add rbx, rdi
4 | 	prefetchnta byte ptr [rbx]


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/program_xmm_constants.inc:
--------------------------------------------------------------------------------
1 | mantissaMask:
2 | 	db 0, 0, 192, 255, 255, 255, 255, 0, 0, 0, 192, 255, 255, 255, 255, 0
3 | exp240:
4 | 	db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
5 | scaleMask:
6 | 	db 0, 0, 0, 0, 0, 0, 240, 128, 0, 0, 0, 0, 0, 0, 240, 128


--------------------------------------------------------------------------------
/src/crypto/randomx/asm/randomx_reciprocal.inc:
--------------------------------------------------------------------------------
1 | 	mov edx, 1
2 | 	mov r8, rcx
3 | 	xor eax, eax
4 | 	bsr rcx, rcx
5 | 	shl rdx, cl
6 | 	div r8
7 | 	ret


--------------------------------------------------------------------------------
/src/crypto/randomx/blake2/avx2/blake2.h:
--------------------------------------------------------------------------------
 1 | #ifndef BLAKE2_AVX2_BLAKE2_H
 2 | #define BLAKE2_AVX2_BLAKE2_H
 3 | 
 4 | #if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
 5 |   #if   defined(_MSC_VER)
 6 |     #define INLINE __inline
 7 |   #elif defined(__GNUC__)
 8 |     #define INLINE __inline__
 9 |   #else
10 |     #define INLINE
11 |   #endif
12 | #else
13 |   #define INLINE inline
14 | #endif
15 | 
16 | #if defined(_MSC_VER)
17 | #define ALIGN(x) __declspec(align(x))
18 | #else
19 | #define ALIGN(x) __attribute__((aligned(x)))
20 | #endif
21 | 
22 | enum blake2s_constant {
23 |   BLAKE2S_BLOCKBYTES = 64,
24 |   BLAKE2S_OUTBYTES   = 32,
25 |   BLAKE2S_KEYBYTES   = 32,
26 |   BLAKE2S_SALTBYTES  = 8,
27 |   BLAKE2S_PERSONALBYTES = 8
28 | };
29 | 
30 | enum blake2b_constant {
31 |   BLAKE2B_BLOCKBYTES = 128,
32 |   BLAKE2B_OUTBYTES   = 64,
33 |   BLAKE2B_KEYBYTES   = 64,
34 |   BLAKE2B_SALTBYTES  = 16,
35 |   BLAKE2B_PERSONALBYTES = 16
36 | };
37 | 
38 | #endif
39 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/blake2/avx2/blake2b-common.h:
--------------------------------------------------------------------------------
 1 | #ifndef BLAKE2_AVX2_BLAKE2B_COMMON_H
 2 | #define BLAKE2_AVX2_BLAKE2B_COMMON_H
 3 | 
 4 | #include <stddef.h>
 5 | #include <stdint.h>
 6 | #include <string.h>
 7 | 
 8 | #include <immintrin.h>
 9 | 
10 | #include "blake2.h"
11 | 
12 | #define LOAD128(p)  _mm_load_si128( (__m128i *)(p) )
13 | #define STORE128(p,r) _mm_store_si128((__m128i *)(p), r)
14 | 
15 | #define LOADU128(p)  _mm_loadu_si128( (__m128i *)(p) )
16 | #define STOREU128(p,r) _mm_storeu_si128((__m128i *)(p), r)
17 | 
18 | #define LOAD(p)  _mm256_load_si256( (__m256i *)(p) )
19 | #define STORE(p,r) _mm256_store_si256((__m256i *)(p), r)
20 | 
21 | #define LOADU(p)  _mm256_loadu_si256( (__m256i *)(p) )
22 | #define STOREU(p,r) _mm256_storeu_si256((__m256i *)(p), r)
23 | 
24 | static INLINE uint64_t LOADU64(void const * p) {
25 |   uint64_t v;
26 |   memcpy(&v, p, sizeof v);
27 |   return v;
28 | }
29 | 
30 | #define ROTATE16 _mm256_setr_epi8( 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9, \
31 |                                    2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9 )
32 | 
33 | #define ROTATE24 _mm256_setr_epi8( 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10, \
34 |                                    3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10 )
35 | 
36 | #define ADD(a, b) _mm256_add_epi64(a, b)
37 | #define SUB(a, b) _mm256_sub_epi64(a, b)
38 | 
39 | #define XOR(a, b) _mm256_xor_si256(a, b)
40 | #define AND(a, b) _mm256_and_si256(a, b)
41 | #define  OR(a, b) _mm256_or_si256(a, b)
42 | 
43 | #define ROT32(x) _mm256_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1))
44 | #define ROT24(x) _mm256_shuffle_epi8((x), ROTATE24)
45 | #define ROT16(x) _mm256_shuffle_epi8((x), ROTATE16)
46 | #define ROT63(x) _mm256_or_si256(_mm256_srli_epi64((x), 63), ADD((x), (x)))
47 | 
48 | #endif
49 | 


--------------------------------------------------------------------------------
/src/crypto/randomx/blake2/avx2/blake2b.h:
--------------------------------------------------------------------------------
 1 | #ifndef BLAKE2_AVX2_BLAKE2B_H
 2 | #define BLAKE2_AVX2_BLAKE2B_H
 3 | 
 4 | #include <stddef.h>
 5 | 
 6 | #if defined(__cplusplus)
 7 | extern "C" {
 8 | #endif
 9 | 
10 | int blake2b_avx2(void* out, size_t outlen, const void* in, size_t inlen);
11 | 
12 | #if defined(__cplusplus)
13 | }
14 | #endif
15 | 
16 | #endif
17 | 


--------------------------------------------------------------------------------
/src/crypto/rx/RxFix.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2019 tevador     <tevador@gmail.com>
 3 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_RXFIX_H
21 | #define XMRIG_RXFIX_H
22 | 
23 | 
24 | #include <utility>
25 | 
26 | 
27 | namespace xmrig
28 | {
29 | 
30 | 
31 | class RxFix
32 | {
33 | public:
34 |     static void setMainLoopBounds(const std::pair<const void *, const void *> &bounds);
35 |     static void setupMainLoopExceptionFrame();
36 | };
37 | 
38 | 
39 | } /* namespace xmrig */
40 | 
41 | 
42 | #endif /* XMRIG_RXFIX_H */
43 | 


--------------------------------------------------------------------------------
/src/crypto/rx/RxMsr.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2019 tevador     <tevador@gmail.com>
 3 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_RXMSR_H
21 | #define XMRIG_RXMSR_H
22 | 
23 | 
24 | #include <vector>
25 | 
26 | 
27 | namespace xmrig
28 | {
29 | 
30 | 
31 | class CpuThread;
32 | class RxConfig;
33 | 
34 | 
35 | class RxMsr
36 | {
37 | public:
38 |     static inline bool isEnabled()      { return m_enabled; }
39 |     static inline bool isInitialized()  { return m_initialized; }
40 | 
41 |     static bool init(const RxConfig &config, const std::vector<CpuThread> &threads);
42 |     static void destroy();
43 | 
44 | private:
45 |     static bool m_cacheQoS;
46 |     static bool m_enabled;
47 |     static bool m_initialized;
48 | };
49 | 
50 | 
51 | } /* namespace xmrig */
52 | 
53 | 
54 | #endif /* XMRIG_RXMSR_H */
55 | 


--------------------------------------------------------------------------------
/src/crypto/rx/RxVm.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2019 tevador     <tevador@gmail.com>
 3 |  * Copyright (c) 2018-2020 SChernykh   <https://github.com/SChernykh>
 4 |  * Copyright (c) 2016-2020 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 5 |  *
 6 |  *   This program is free software: you can redistribute it and/or modify
 7 |  *   it under the terms of the GNU General Public License as published by
 8 |  *   the Free Software Foundation, either version 3 of the License, or
 9 |  *   (at your option) any later version.
10 |  *
11 |  *   This program is distributed in the hope that it will be useful,
12 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 |  *   GNU General Public License for more details.
15 |  *
16 |  *   You should have received a copy of the GNU General Public License
17 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
18 |  */
19 | 
20 | #ifndef XMRIG_RX_VM_H
21 | #define XMRIG_RX_VM_H
22 | 
23 | 
24 | #include <cstdint>
25 | 
26 | 
27 | class randomx_vm;
28 | 
29 | 
30 | namespace xmrig
31 | {
32 | 
33 | 
34 | class Assembly;
35 | class RxDataset;
36 | 
37 | 
38 | class RxVm
39 | {
40 | public:
41 |     static randomx_vm *create(RxDataset *dataset, uint8_t *scratchpad, bool softAes, const Assembly &assembly, uint32_t node);
42 |     static void destroy(randomx_vm *vm);
43 | };
44 | 
45 | 
46 | } /* namespace xmrig */
47 | 
48 | 
49 | #endif /* XMRIG_RX_VM_H */
50 | 


--------------------------------------------------------------------------------
/src/hw/api/HwApi.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh    <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig        <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | 
20 | #include "hw/api/HwApi.h"
21 | #include "base/api/interfaces/IApiRequest.h"
22 | #include "base/tools/String.h"
23 | 
24 | 
25 | #ifdef XMRIG_FEATURE_DMI
26 | #   include "hw/dmi/DmiReader.h"
27 | #endif
28 | 
29 | 
30 | void xmrig::HwApi::onRequest(IApiRequest &request)
31 | {
32 |     if (request.method() == IApiRequest::METHOD_GET) {
33 | #       ifdef XMRIG_FEATURE_DMI
34 |         if (request.url() == "/2/dmi") {
35 |             if (!m_dmi) {
36 |                 m_dmi = std::make_shared<DmiReader>();
37 |                 m_dmi->read();
38 |             }
39 | 
40 |             request.accept();
41 |             m_dmi->toJSON(request.reply(), request.doc());
42 |         }
43 | #       endif
44 |     }
45 | }
46 | 


--------------------------------------------------------------------------------
/src/hw/api/HwApi.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh    <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig        <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #ifndef XMRIG_HWAPI_H
20 | #define XMRIG_HWAPI_H
21 | 
22 | 
23 | #include "base/api/interfaces/IApiListener.h"
24 | 
25 | 
26 | #include <memory>
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class DmiReader;
33 | 
34 | 
35 | class HwApi : public IApiListener
36 | {
37 | public:
38 |     HwApi() = default;
39 | 
40 | protected:
41 |     void onRequest(IApiRequest &request) override;
42 | 
43 | private:
44 | #   ifdef XMRIG_FEATURE_DMI
45 |     std::shared_ptr<DmiReader> m_dmi;
46 | #   endif
47 | };
48 | 
49 | 
50 | } /* namespace xmrig */
51 | 
52 | 
53 | #endif /* XMRIG_HWAPI_H */
54 | 


--------------------------------------------------------------------------------
/src/hw/api/api.cmake:
--------------------------------------------------------------------------------
 1 | if (WITH_HTTP)
 2 |     add_definitions(/DXMRIG_FEATURE_DMI)
 3 | 
 4 |     list(APPEND HEADERS
 5 |         src/hw/api/HwApi.h
 6 |         )
 7 | 
 8 |     list(APPEND SOURCES
 9 |         src/hw/api/HwApi.cpp
10 |         )
11 | endif()
12 | 


--------------------------------------------------------------------------------
/src/hw/dmi/dmi.cmake:
--------------------------------------------------------------------------------
 1 | if (WITH_DMI AND (XMRIG_OS_WIN OR XMRIG_OS_LINUX OR XMRIG_OS_FREEBSD OR (XMRIG_OS_MACOS AND NOT XMRIG_ARM)))
 2 |     set(WITH_DMI ON)
 3 | else()
 4 |     set(WITH_DMI OFF)
 5 | endif()
 6 | 
 7 | if (WITH_DMI)
 8 |     add_definitions(/DXMRIG_FEATURE_DMI)
 9 | 
10 |     list(APPEND HEADERS
11 |         src/hw/dmi/DmiBoard.h
12 |         src/hw/dmi/DmiMemory.h
13 |         src/hw/dmi/DmiReader.h
14 |         src/hw/dmi/DmiTools.h
15 |         )
16 | 
17 |     list(APPEND SOURCES
18 |         src/hw/dmi/DmiBoard.cpp
19 |         src/hw/dmi/DmiMemory.cpp
20 |         src/hw/dmi/DmiReader.cpp
21 |         src/hw/dmi/DmiTools.cpp
22 |         )
23 | 
24 |     if (XMRIG_OS_WIN)
25 |         list(APPEND SOURCES src/hw/dmi/DmiReader_win.cpp)
26 |     elseif(XMRIG_OS_LINUX OR XMRIG_OS_FREEBSD)
27 |         list(APPEND SOURCES src/hw/dmi/DmiReader_unix.cpp)
28 |     elseif(XMRIG_OS_MACOS)
29 |         list(APPEND SOURCES src/hw/dmi/DmiReader_mac.cpp)
30 |     endif()
31 | else()
32 |     remove_definitions(/DXMRIG_FEATURE_DMI)
33 | endif()
34 | 


--------------------------------------------------------------------------------
/src/net/interfaces/IJobResultListener.h:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright 2010      Jeff Garzik <jgarzik@pobox.com>
 3 |  * Copyright 2012-2014 pooler      <pooler@litecoinpool.org>
 4 |  * Copyright 2014      Lucas Jones <https://github.com/lucasjones>
 5 |  * Copyright 2014-2016 Wolf9466    <https://github.com/OhGodAPet>
 6 |  * Copyright 2016      Jay D Dee   <jayddee246@gmail.com>
 7 |  * Copyright 2017-2018 XMR-Stak    <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
 8 |  * Copyright 2018-2019 SChernykh   <https://github.com/SChernykh>
 9 |  * Copyright 2016-2019 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
10 |  *
11 |  *   This program is free software: you can redistribute it and/or modify
12 |  *   it under the terms of the GNU General Public License as published by
13 |  *   the Free Software Foundation, either version 3 of the License, or
14 |  *   (at your option) any later version.
15 |  *
16 |  *   This program is distributed in the hope that it will be useful,
17 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 |  *   GNU General Public License for more details.
20 |  *
21 |  *   You should have received a copy of the GNU General Public License
22 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
23 |  */
24 | 
25 | #ifndef XMRIG_IJOBRESULTLISTENER_H
26 | #define XMRIG_IJOBRESULTLISTENER_H
27 | 
28 | 
29 | namespace xmrig {
30 | 
31 | 
32 | class Client;
33 | class JobResult;
34 | 
35 | 
36 | class IJobResultListener
37 | {
38 | public:
39 |     virtual ~IJobResultListener() = default;
40 | 
41 |     virtual void onJobResult(const JobResult &result) = 0;
42 | };
43 | 
44 | 
45 | } /* namespace xmrig */
46 | 
47 | 
48 | #endif // XMRIG_IJOBRESULTLISTENER_H
49 | 


--------------------------------------------------------------------------------
/src/xmrig.cpp:
--------------------------------------------------------------------------------
 1 | /* XMRig
 2 |  * Copyright (c) 2018-2021 SChernykh   <https://github.com/SChernykh>
 3 |  * Copyright (c) 2016-2021 XMRig       <https://github.com/xmrig>, <support@xmrig.com>
 4 |  *
 5 |  *   This program is free software: you can redistribute it and/or modify
 6 |  *   it under the terms of the GNU General Public License as published by
 7 |  *   the Free Software Foundation, either version 3 of the License, or
 8 |  *   (at your option) any later version.
 9 |  *
10 |  *   This program is distributed in the hope that it will be useful,
11 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 |  *   GNU General Public License for more details.
14 |  *
15 |  *   You should have received a copy of the GNU General Public License
16 |  *   along with this program. If not, see <http://www.gnu.org/licenses/>.
17 |  */
18 | 
19 | #include "App.h"
20 | #include "base/kernel/Entry.h"
21 | #include "base/kernel/Process.h"
22 | 
23 | 
24 | int main(int argc, char **argv)
25 | {
26 |     using namespace xmrig;
27 | 
28 |     Process process(argc, argv);
29 |     const Entry::Id entry = Entry::get(process);
30 |     if (entry) {
31 |         return Entry::exec(process, entry);
32 |     }
33 | 
34 |     App app(&process);
35 | 
36 |     return app.exec();
37 | }
38 | 


--------------------------------------------------------------------------------