Rename flags to avoid confusion
This commit is contained in:
parent
513e797d46
commit
a25adf84f0
@ -11,6 +11,6 @@
|
|||||||
// QEMU by default allocates (and commits) 1GB memory on Windows, and multiple Unicorn instances will result in OOM error easily.
|
// 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.
|
// 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
|
// 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
|
@ -869,7 +869,7 @@ static inline void *alloc_code_gen_buffer(struct uc_struct *uc)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#elif defined(_WIN32)
|
#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)
|
static inline void *alloc_code_gen_buffer(struct uc_struct *uc)
|
||||||
{
|
{
|
||||||
TCGContext *tcg_ctx = uc->tcg_ctx;
|
TCGContext *tcg_ctx = uc->tcg_ctx;
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "qemu/int128.h"
|
#include "qemu/int128.h"
|
||||||
|
|
||||||
// Unicorn: Default region size for win32
|
// 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.
|
#define UC_TCG_REGION_PAGES_COUNT (128) // Note less pages may cause unexpected and subtle errors.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ static void tcg_region_assign(TCGContext *s, size_t curr_region)
|
|||||||
s->code_gen_buffer = start;
|
s->code_gen_buffer = start;
|
||||||
s->code_gen_ptr = start;
|
s->code_gen_ptr = start;
|
||||||
s->code_gen_buffer_size = (char *)end - (char *)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(
|
VirtualAlloc(
|
||||||
s->code_gen_buffer,
|
s->code_gen_buffer,
|
||||||
ROUND_UP(s->code_gen_buffer_size, s->uc->qemu_real_host_page_size),
|
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 n_regions;
|
||||||
size_t i;
|
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);
|
n_regions = size / (tcg_ctx->uc->qemu_real_host_page_size * UC_TCG_REGION_PAGES_COUNT);
|
||||||
#else
|
#else
|
||||||
n_regions = 1;
|
n_regions = 1;
|
||||||
@ -551,7 +551,7 @@ void tcg_region_init(TCGContext *tcg_ctx)
|
|||||||
|
|
||||||
tcg_ctx->tree = g_tree_new(tb_tc_cmp);
|
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.
|
// Allocate a region immediately, or the highwater is not set correctly.
|
||||||
tcg_region_alloc(tcg_ctx);
|
tcg_region_alloc(tcg_ctx);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user