mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 06:15:28 +00:00
tcg: define tcg_init_ctx and make tcg_ctx a pointer
Groundwork for supporting multiple TCG contexts. The core of this patch is this change to tcg/tcg.h: > -extern TCGContext tcg_ctx; > +extern TCGContext tcg_init_ctx; > +extern TCGContext *tcg_ctx; Note that for now we set *tcg_ctx to whatever TCGContext is passed to tcg_context_init -- in this case &tcg_init_ctx. Backports commit b1311c4acf503dc9c1a310cc40b64f05b08833dc from qemu
This commit is contained in:
parent
078c9e7e3b
commit
9d5b378475
|
@ -217,9 +217,10 @@ struct uc_struct {
|
||||||
intptr_t qemu_host_page_mask;
|
intptr_t qemu_host_page_mask;
|
||||||
|
|
||||||
/* code generation context */
|
/* code generation context */
|
||||||
void *tcg_ctx; // for "TCGContext tcg_ctx" in qemu/translate-all.c
|
void *tcg_ctx; // for "TCGContext tcg_ctx" in translate-all.c
|
||||||
|
void *tcg_init_ctx; // for "TCGContext init_tcg_contex" in translate-all.c
|
||||||
TBContext tb_ctx;
|
TBContext tb_ctx;
|
||||||
bool parallel_cpus; // for "bool parallel_cpus" in qemu/translate-all.c
|
bool parallel_cpus; // for "bool parallel_cpus" in translate-all.c
|
||||||
|
|
||||||
/* memory.c */
|
/* memory.c */
|
||||||
unsigned memory_region_transaction_depth;
|
unsigned memory_region_transaction_depth;
|
||||||
|
|
|
@ -167,8 +167,9 @@ static void page_table_config_init(struct uc_struct *uc)
|
||||||
|
|
||||||
static void cpu_gen_init(struct uc_struct *uc)
|
static void cpu_gen_init(struct uc_struct *uc)
|
||||||
{
|
{
|
||||||
uc->tcg_ctx = g_malloc0(sizeof(TCGContext));
|
uc->tcg_init_ctx = g_malloc0(sizeof(TCGContext));;
|
||||||
tcg_context_init(uc->tcg_ctx);
|
|
||||||
|
tcg_context_init(uc->tcg_init_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tb_clean_internal(struct uc_struct *uc, int i, void** lp)
|
static void tb_clean_internal(struct uc_struct *uc, int i, void** lp)
|
||||||
|
@ -879,6 +880,7 @@ void tcg_exec_init(struct uc_struct *uc, unsigned long tb_size)
|
||||||
TCGContext *tcg_ctx;
|
TCGContext *tcg_ctx;
|
||||||
|
|
||||||
cpu_gen_init(uc);
|
cpu_gen_init(uc);
|
||||||
|
uc->tcg_ctx = uc->tcg_init_ctx;
|
||||||
tcg_ctx = uc->tcg_ctx;
|
tcg_ctx = uc->tcg_ctx;
|
||||||
tcg_ctx->uc = uc;
|
tcg_ctx->uc = uc;
|
||||||
page_init(uc);
|
page_init(uc);
|
||||||
|
|
7
uc.c
7
uc.c
|
@ -307,9 +307,10 @@ UNICORN_EXPORT
|
||||||
uc_err uc_close(uc_engine *uc)
|
uc_err uc_close(uc_engine *uc)
|
||||||
{
|
{
|
||||||
// Cleanup internally.
|
// Cleanup internally.
|
||||||
if (uc->release)
|
if (uc->release) {
|
||||||
uc->release(uc->tcg_ctx);
|
uc->release(uc->tcg_init_ctx);
|
||||||
g_free(uc->tcg_ctx);
|
}
|
||||||
|
g_free(uc->tcg_init_ctx);
|
||||||
|
|
||||||
// Cleanup CPU.
|
// Cleanup CPU.
|
||||||
g_free(uc->cpu->cpu_ases);
|
g_free(uc->cpu->cpu_ases);
|
||||||
|
|
Loading…
Reference in a new issue