Monero
src
crypto
CryptonightR_JIT.h
Go to the documentation of this file.
1
#ifndef CRYPTONIGHTR_JIT_H
2
#define CRYPTONIGHTR_JIT_H
3
4
// Minimalistic JIT code generator for random math sequence in CryptonightR
5
//
6
// Usage:
7
// - Allocate writable and executable memory
8
// - Call v4_generate_JIT_code with "buf" pointed to memory allocated on previous step
9
// - Call the generated code instead of "v4_random_math(code, r)", omit the "code" parameter
10
11
typedef
void (*
v4_random_math_JIT_func
)(uint32_t* r)
12
#
if
defined __x86_64__
13
__attribute__
((sysv_abi))
14
#endif
15
;
16
17
// Given the random math sequence, generates machine code (x86-64) for it
18
// Returns 0 if code was generated successfully
19
// Returns -1 if provided buffer was too small
20
int
v4_generate_JIT_code
(
const
struct
V4_Instruction
* code,
v4_random_math_JIT_func
buf,
const
size_t
buf_size);
21
22
#endif // CRYPTONIGHTR_JIT_H
V4_Instruction
Definition:
variant4_random_math.h:53
v4_generate_JIT_code
int v4_generate_JIT_code(const struct V4_Instruction *code, v4_random_math_JIT_func buf, const size_t buf_size)
Definition:
CryptonightR_JIT.c:55
v4_random_math_JIT_func
void(* v4_random_math_JIT_func)(uint32_t *r)
Definition:
CryptonightR_JIT.h:11
__attribute__
__attribute__((noreturn)) void CXA_THROW(void *ex
Generated on Thu Mar 7 2019 12:00:00 for Monero by
1.8.15