Electroneum
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 __i386 || 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
uint32_t
unsigned int uint32_t
Definition:
stdint.h:126
v4_random_math_JIT_func
void(* v4_random_math_JIT_func)(uint32_t *r)
Definition:
CryptonightR_JIT.h:11
buf
const char * buf
Definition:
slow_memmem.cpp:74
V4_Instruction
Definition:
variant4_random_math.h:53
__attribute__
__attribute__((noreturn)) void CXA_THROW(void *ex
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)
src
crypto
CryptonightR_JIT.h
Generated on Sun Mar 10 2024 12:00:00 for Electroneum by
1.8.14