dataset.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Copyright (c) 2018 tevador
  3. This file is part of RandomX.
  4. RandomX 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. RandomX is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with RandomX. If not, see<http://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. #include <cstdint>
  17. #include <array>
  18. #include "intrinPortable.h"
  19. #include "common.hpp"
  20. #include "softAes.h"
  21. namespace RandomX {
  22. using KeysContainer = std::array<__m128i, 10>;
  23. template<bool soft, bool enc>
  24. void initBlock(const uint8_t* in, uint8_t* out, uint32_t blockNumber, const KeysContainer& keys);
  25. template<bool softAes>
  26. void initBlock(const uint8_t* cache, uint8_t* block, uint32_t blockNumber, const KeysContainer& keys);
  27. void datasetAlloc(dataset_t& ds, bool largePages);
  28. template<bool softAes>
  29. void datasetInit(Cache* cache, dataset_t ds, uint32_t startBlock, uint32_t blockCount);
  30. convertible_t datasetRead(addr_t addr, MemoryRegisters& memory);
  31. template<bool softAes>
  32. void datasetInitCache(const void* seed, dataset_t& dataset);
  33. template<bool softAes>
  34. convertible_t datasetReadLight(addr_t addr, MemoryRegisters& memory);
  35. }