Skip to content

Commit

Permalink
[qemu]In interpreter mode, disable allocation of _EXEC memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Naville committed Oct 29, 2024
1 parent 771e1a7 commit 9d20ee8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions qemu/accel/tcg/translate-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,12 +1019,18 @@ void free_code_gen_buffer(struct uc_struct *uc)
static inline void *alloc_code_gen_buffer(struct uc_struct *uc)
{
TCGContext *tcg_ctx = uc->tcg_ctx;
#if CONFIG_TCG_INTERPRETER
int prot = PROT_WRITE | PROT_READ;
#else
int prot = PROT_WRITE | PROT_READ | PROT_EXEC;
#endif
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
size_t size = tcg_ctx->code_gen_buffer_size;
void *buf;
#if !CONFIG_TCG_INTERPRETER
#ifdef USE_MAP_JIT
flags |= MAP_JIT;
#endif
#endif
buf = mmap(NULL, size, prot, flags, -1, 0);
if (buf == MAP_FAILED) {
Expand Down
2 changes: 1 addition & 1 deletion qemu/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,7 @@ if test "$have_sprr" = "yes" ; then
fi

if test "$interpreter" = "yes" ; then
echo "HAVE_INTERPRETER=y" >> $config_host_mak
echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
fi

# Hold two types of flag:
Expand Down

0 comments on commit 9d20ee8

Please sign in to comment.