Rename flags to avoid confusion

This commit is contained in:
mio 2023-01-28 22:18:39 +01:00
parent 513e797d46
commit a25adf84f0
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
4 changed files with 7 additions and 7 deletions

View File

@ -11,6 +11,6 @@
// QEMU by default allocates (and commits) 1GB memory on Windows, and multiple Unicorn instances will result in OOM error easily.
// Unfortunately, Windows doesn't have a similar demand paging feature like mmap(), therefore a workaround is to use tcg regions mechanism.
// Note most Unicorn hacks (and even QEMU!) relies on the assumption that the translation memory won't run out and thus it might result
// in some unexpected errors. If that is case, define to align with QEMU and Unicorn <= 2.0.1 behavior.
// in some unexpected errors. If that is case, define WIN32_QEMU_ALLOC_BUFFER to align with QEMU and Unicorn <= 2.0.1 behavior.
//
// #define USE_STATIC_CODE_GEN_BUFFER
// #define WIN32_QEMU_ALLOC_BUFFER

View File

@ -869,7 +869,7 @@ static inline void *alloc_code_gen_buffer(struct uc_struct *uc)
return buf;
}
#elif defined(_WIN32)
#ifdef USE_STATIC_CODE_GEN_BUFFER
#ifdef WIN32_QEMU_ALLOC_BUFFER
static inline void *alloc_code_gen_buffer(struct uc_struct *uc)
{
TCGContext *tcg_ctx = uc->tcg_ctx;

View File

@ -36,7 +36,7 @@
#include "qemu/int128.h"
// Unicorn: Default region size for win32
#if defined(_WIN32) && !defined(USE_STATIC_CODE_GEN_BUFFER)
#if defined(_WIN32) && !defined(WIN32_QEMU_ALLOC_BUFFER)
#define UC_TCG_REGION_PAGES_COUNT (128) // Note less pages may cause unexpected and subtle errors.
#endif

View File

@ -408,7 +408,7 @@ static void tcg_region_assign(TCGContext *s, size_t curr_region)
s->code_gen_buffer = start;
s->code_gen_ptr = start;
s->code_gen_buffer_size = (char *)end - (char *)start;
#if defined(WIN32) && !defined(USE_STATIC_CODE_GEN_BUFFER)
#if defined(WIN32) && !defined(WIN32_QEMU_ALLOC_BUFFER)
VirtualAlloc(
s->code_gen_buffer,
ROUND_UP(s->code_gen_buffer_size, s->uc->qemu_real_host_page_size),
@ -509,7 +509,7 @@ void tcg_region_init(TCGContext *tcg_ctx)
size_t n_regions;
size_t i;
#if defined(WIN32) && !defined(USE_STATIC_CODE_GEN_BUFFER)
#if defined(WIN32) && !defined(WIN32_QEMU_ALLOC_BUFFER)
n_regions = size / (tcg_ctx->uc->qemu_real_host_page_size * UC_TCG_REGION_PAGES_COUNT);
#else
n_regions = 1;
@ -551,7 +551,7 @@ void tcg_region_init(TCGContext *tcg_ctx)
tcg_ctx->tree = g_tree_new(tb_tc_cmp);
#if defined(WIN32) && !defined(USE_STATIC_CODE_GEN_BUFFER)
#if defined(WIN32) && !defined(WIN32_QEMU_ALLOC_BUFFER)
// Allocate a region immediately, or the highwater is not set correctly.
tcg_region_alloc(tcg_ctx);
#endif