diff options
author | SChernykh <sergey.v.chernykh@gmail.com> | 2019-02-16 17:28:43 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-04 11:56:29 +0000 |
commit | fff23bf7c67e7796daa87087f4e7e2ab07f7f0ea (patch) | |
tree | 2562b051b451f2a02970b3a565786554a6acda8c /src/crypto/CryptonightR_JIT.h | |
parent | blockchain: add v10 fork heights (diff) | |
download | monero-fff23bf7c67e7796daa87087f4e7e2ab07f7f0ea.tar.xz |
CNv4 JIT compiler for x86-64 and tests
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 the previous step
- Call the generated code instead of "v4_random_math(code, r)", omit the "code" parameter
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 |