Fix the error in the hook_code of the arm

Calling emu_stop and causing the pc value to be incorrect after the end of the run. (#1157)

Backports commit 83887b8193dfeca3e5e8da851b41f874bcd0514e from unicorn.
This commit is contained in:
w1tcher 2020-01-14 09:29:29 -05:00 committed by Lioncash
parent 644ea0c88c
commit b1f5794ab4
2 changed files with 5 additions and 4 deletions

View file

@ -69,7 +69,8 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
} else {
assert(cc->set_pc);
// avoid sync twice when helper_uc_tracecode() already did this.
if (env->uc->emu_counter <= env->uc->emu_count && !env->uc->quit_request) {
if (env->uc->emu_counter <= env->uc->emu_count &&
!env->uc->stop_request && !env->uc->quit_request) {
cc->set_pc(cpu, last_tb->pc);
}
}

View file

@ -202,9 +202,9 @@ void tb_cleanup(struct uc_struct *uc)
return;
}
int x = V_L1_SHIFT / V_L2_BITS;
int x = uc->v_l1_shift / V_L2_BITS;
if (x <= 1) {
for (int i = 0; i < V_L1_SIZE; i++) {
for (int i = 0; i < uc->v_l1_size; i++) {
void **p = uc->l1_map[i];
if (p) {
g_free(p);
@ -212,7 +212,7 @@ void tb_cleanup(struct uc_struct *uc)
}
}
} else {
for (int i = 0; i < V_L1_SIZE; i++) {
for (int i = 0; i < uc->v_l1_size; i++) {
void **p = uc->l1_map[i];
if (p) {
tb_clean_internal(p, x - 1);