diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-03-04 17:06:37 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-03-04 17:06:37 +0200 |
commit | 815c8a48ab38586baf7963f7a4d9a87263811855 (patch) | |
tree | 36fa875b076db18a0d2775a5b96e61dc01cd0616 /src/crypto/CryptonightR_JIT.h | |
parent | Merge pull request #5132 (diff) | |
parent | tests: add a CNv4 JIT test (diff) | |
download | monero-815c8a48ab38586baf7963f7a4d9a87263811855.tar.xz |
Merge pull request #5174
0de14396 tests: add a CNv4 JIT test (moneromooo-monero)
24d281c3 crypto: plug CNv4 JIT into cn_slow_hash (moneromooo-monero)
78ab59ea crypto: clear cache after generating random program (moneromooo-monero)
b9a61884 performance_tests: add tests for new Cryptonight variants (moneromooo-monero)
fff23bf7 CNv4 JIT compiler for x86-64 and tests (SChernykh)
3dde67d8 blockchain: add v10 fork heights (moneromooo-monero)
Diffstat (limited to 'src/crypto/CryptonightR_JIT.h')
-rw-r--r-- | src/crypto/CryptonightR_JIT.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/crypto/CryptonightR_JIT.h b/src/crypto/CryptonightR_JIT.h new file mode 100644 index 000000000..5f689b37b --- /dev/null +++ b/src/crypto/CryptonightR_JIT.h @@ -0,0 +1,18 @@ +#ifndef CRYPTONIGHTR_JIT_H +#define CRYPTONIGHTR_JIT_H + +// Minimalistic JIT code generator for random math sequence in CryptonightR +// +// Usage: +// - Allocate writable and executable memory +// - Call v4_generate_JIT_code with "buf" pointed to memory allocated on previous step +// - Call the generated code instead of "v4_random_math(code, r)", omit the "code" parameter + +typedef void (*v4_random_math_JIT_func)(uint32_t* r) __attribute__((sysv_abi)); + +// Given the random math sequence, generates machine code (x86-64) for it +// Returns 0 if code was generated successfully +// Returns -1 if provided buffer was too small +int v4_generate_JIT_code(const struct V4_Instruction* code, v4_random_math_JIT_func buf, const size_t buf_size); + +#endif // CRYPTONIGHTR_JIT_H |