We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1ae750f + ef30c26 commit b024ae0Copy full SHA for b024ae0
ujit_asm.c
@@ -137,9 +137,19 @@ uint8_t* alloc_exec_mem(uint32_t mem_size)
137
0
138
);
139
140
+ if (mem_block == MAP_FAILED) {
141
+ mem_block = (uint8_t*)mmap(
142
+ NULL, // try again without the address hint (e.g., valgrind)
143
+ mem_size,
144
+ PROT_READ | PROT_WRITE | PROT_EXEC,
145
+ MAP_PRIVATE | MAP_ANONYMOUS,
146
+ -1,
147
+ 0
148
+ );
149
+ }
150
+
151
// Check that the memory mapping was successful
- if (mem_block == MAP_FAILED)
- {
152
153
fprintf(stderr, "mmap call failed\n");
154
exit(-1);
155
}
0 commit comments