Merge branch 'dev' into systemz

This commit is contained in:
mio
2022-01-18 21:10:55 +01:00
16 changed files with 304 additions and 56 deletions

View File

@ -55,9 +55,12 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
int tb_exit;
uint8_t *tb_ptr = itb->tc.ptr;
UC_TRACE_START(UC_TRACE_TB_EXEC);
tb_exec_lock(cpu->uc->tcg_ctx);
ret = tcg_qemu_tb_exec(env, tb_ptr);
tb_exec_unlock(cpu->uc->tcg_ctx);
UC_TRACE_END(UC_TRACE_TB_EXEC, "[uc] exec tb 0x%" PRIx64 ": ", itb->pc);
cpu->can_do_io = 1;
last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK);
tb_exit = ret & TB_EXIT_MASK;

View File

@ -1619,7 +1619,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
tcg_func_start(tcg_ctx);
tcg_ctx->cpu = env_cpu(env);
UC_TRACE_START(UC_TRACE_TB_TRANS);
gen_intermediate_code(cpu, tb, max_insns);
UC_TRACE_END(UC_TRACE_TB_TRANS, "[uc] translate tb 0x%" PRIx64 ": ", tb->pc);
tcg_ctx->cpu = NULL;
/* generate machine code */

View File

@ -119,18 +119,13 @@ struct uc_struct;
* Only allow MAP_JIT for Mojave or later.
*
* Source: https://github.com/moby/hyperkit/pull/259/files#diff-e6b5417230ff2daff9155d9b15aefae12e89410ec2dca1f59d04be511f6737fcR41
*
* But using MAP_JIT causes performance regression for fork() so we only use MAP_JIT on Apple M1.
*
* Issue: https://github.com/desktop/desktop/issues/12978
*/
#if defined(__APPLE__)
#if defined(HAVE_PTHREAD_JIT_PROTECT)
#define USE_MAP_JIT
#else
#include <Availability.h>
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 && defined(MAP_JIT)
#define USE_MAP_JIT
#endif
#endif
#endif
#if defined(__APPLE__) && defined(HAVE_PTHREAD_JIT_PROTECT) && defined(__arm__)
#define USE_MAP_JIT
#endif
#include <glib_compat.h>

View File

@ -783,8 +783,6 @@ static void address_space_update_topology_pass(AddressSpace *as,
static void flatviews_init(struct uc_struct *uc)
{
static FlatView *empty_view;
if (uc->flat_views) {
return;
}
@ -792,13 +790,13 @@ static void flatviews_init(struct uc_struct *uc)
uc->flat_views = g_hash_table_new_full(NULL, NULL, NULL,
(GDestroyNotify) flatview_unref);
if (!empty_view) {
empty_view = generate_memory_topology(uc, NULL);
if (!uc->empty_view) {
uc->empty_view = generate_memory_topology(uc, NULL);
/* We keep it alive forever in the global variable. */
flatview_ref(empty_view);
flatview_ref(uc->empty_view);
} else {
g_hash_table_replace(uc->flat_views, NULL, empty_view);
flatview_ref(empty_view);
g_hash_table_replace(uc->flat_views, NULL, uc->empty_view);
flatview_ref(uc->empty_view);
}
}

View File

@ -11432,6 +11432,21 @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
dc->pc_curr = dc->base.pc_next;
insn = arm_ldl_code(env, dc->base.pc_next, dc->sctlr_b);
dc->insn = insn;
// Unicorn:
//
// If we get an error during fetching code, we have to skip the instruction decoding
// to ensure the PC remains unchanged.
//
// This is to keep the same behavior with Unicorn1, though, it's inconsistent with
// official arm documents.
//
// See discussion here: https://github.com/unicorn-engine/unicorn/issues/1536
if (dc->uc->invalid_error) {
dcbase->is_jmp = DISAS_WFI;
return;
}
dc->base.pc_next += 4;
disas_arm_insn(dc, insn);