Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ujit_asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,19 @@ uint8_t* alloc_exec_mem(uint32_t mem_size)
0
);

if (mem_block == MAP_FAILED) {
mem_block = (uint8_t*)mmap(
NULL, // try again without the address hint (e.g., valgrind)
mem_size,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS,
-1,
0
);
}

// Check that the memory mapping was successful
if (mem_block == MAP_FAILED)
{
if (mem_block == MAP_FAILED) {
fprintf(stderr, "mmap call failed\n");
exit(-1);
}
Expand Down