14 {
17 int fd = syscall(SYS_memfd_create, "eosvmoc_mem", MFD_CLOEXEC);
18 FC_ASSERT(fd >= 0,
"Failed to create memory memfd");
20 int ret = ftruncate(fd, wasm_memory_size+memory_prologue_size);
22
23 mapsize = total_memory_per_slice*number_slices;
24 mapbase = (
uint8_t*)mmap(
nullptr, mapsize, PROT_NONE, MAP_PRIVATE|MAP_ANON, 0, 0);
25 FC_ASSERT(mapbase != MAP_FAILED,
"Failed to mmap memory");
26
29
30 for(
unsigned int p = 0;
p < number_slices; ++
p) {
31 last = (
uint8_t*)mmap(next_slice, memory_prologue_size+64u*1024u*
p, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd, 0);
32 FC_ASSERT(last != MAP_FAILED,
"Failed to mmap memory");
33 next_slice += total_memory_per_slice;
34 }
35
36 zeropage_base = mapbase + memory_prologue_size;
37 fullpage_base = last + memory_prologue_size;
38
39
42 for(const auto& intrinsic : intrinsics)
43 intrinsic_jump_table[-intrinsic.second.ordinal] = (
uintptr_t)intrinsic.second.function_ptr;
44}
static constexpr uintptr_t first_intrinsic_offset
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
void close(T *e, websocketpp::connection_hdl hdl)
scoped_exit< Callback > make_scoped_exit(Callback &&c)
const intrinsic_map_t & get_intrinsic_map()
std::map< std::string, intrinsic_entry > intrinsic_map_t
_W64 unsigned int uintptr_t
unsigned __int64 uint64_t