[][src]Function randomx4r_sys::randomx_create_vm

pub unsafe extern "C" fn randomx_create_vm(
    flags: randomx_flags,
    cache: *mut randomx_cache,
    dataset: *mut randomx_dataset
) -> *mut randomx_vm

Creates and initializes a RandomX virtual machine.

@param flags is any combination of these 5 flags (each flag can be set or not set): RANDOMX_FLAG_LARGE_PAGES - allocate scratchpad memory in large pages RANDOMX_FLAG_HARD_AES - virtual machine will use hardware accelerated AES RANDOMX_FLAG_FULL_MEM - virtual machine will use the full dataset RANDOMX_FLAG_JIT - virtual machine will use a JIT compiler RANDOMX_FLAG_SECURE - when combined with RANDOMX_FLAG_JIT, the JIT pages are never writable and executable at the same time (W^X policy) The numeric values of the first 4 flags are ordered so that a higher value will provide faster hash calculation and a lower numeric value will provide higher portability. Using RANDOMX_FLAG_DEFAULT (all flags not set) works on all platforms, but is the slowest. @param cache is a pointer to an initialized randomx_cache structure. Can be NULL if RANDOMX_FLAG_FULL_MEM is set. @param dataset is a pointer to a randomx_dataset structure. Can be NULL if RANDOMX_FLAG_FULL_MEM is not set.

@return Pointer to an initialized randomx_vm structure. Returns NULL if: (1) Scratchpad memory allocation fails. (2) The requested initialization flags are not supported on the current platform. (3) cache parameter is NULL and RANDOMX_FLAG_FULL_MEM is not set (4) dataset parameter is NULL and RANDOMX_FLAG_FULL_MEM is set