Implemented unified cryptonight and RandomX scratchpad memory.
This commit is contained in:
parent
5699147aab
commit
20313cbc56
30 changed files with 434 additions and 297 deletions
|
@ -33,26 +33,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "program.hpp"
|
||||
|
||||
/* Global namespace for C binding */
|
||||
class randomx_vm {
|
||||
class randomx_vm
|
||||
{
|
||||
public:
|
||||
virtual ~randomx_vm() = 0;
|
||||
virtual void allocate() = 0;
|
||||
virtual void setScratchpad(uint8_t *scratchpad) = 0;
|
||||
virtual void getFinalResult(void* out, size_t outSize) = 0;
|
||||
virtual void setDataset(randomx_dataset* dataset) { }
|
||||
virtual void setCache(randomx_cache* cache) { }
|
||||
virtual void initScratchpad(void* seed) = 0;
|
||||
virtual void run(void* seed) = 0;
|
||||
void resetRoundingMode();
|
||||
|
||||
randomx::RegisterFile *getRegisterFile() {
|
||||
return ®
|
||||
}
|
||||
|
||||
const void* getScratchpad() {
|
||||
return scratchpad;
|
||||
}
|
||||
|
||||
const randomx::Program& getProgram()
|
||||
{
|
||||
return program;
|
||||
}
|
||||
|
||||
protected:
|
||||
void initialize();
|
||||
alignas(64) randomx::Program program;
|
||||
|
@ -69,15 +74,17 @@ protected:
|
|||
|
||||
namespace randomx {
|
||||
|
||||
template<class Allocator, bool softAes>
|
||||
class VmBase : public randomx_vm {
|
||||
template<bool softAes>
|
||||
class VmBase : public randomx_vm
|
||||
{
|
||||
public:
|
||||
~VmBase() override;
|
||||
void allocate() override;
|
||||
void setScratchpad(uint8_t *scratchpad) override;
|
||||
void initScratchpad(void* seed) override;
|
||||
void getFinalResult(void* out, size_t outSize) override;
|
||||
|
||||
protected:
|
||||
void generateProgram(void* seed);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue