arm: fix change PC feature. now tests/regress/callback-pc.py passes

This commit is contained in:
Nguyen Anh Quynh 2016-01-28 16:03:19 +08:00
parent 5a04bcb115
commit c8569d8128
2 changed files with 6 additions and 2 deletions

View file

@ -236,6 +236,7 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
tc_ptr = tb->tc_ptr; tc_ptr = tb->tc_ptr;
/* execute the generated code */ /* execute the generated code */
next_tb = cpu_tb_exec(cpu, tc_ptr); // qq next_tb = cpu_tb_exec(cpu, tc_ptr); // qq
switch (next_tb & TB_EXIT_MASK) { switch (next_tb & TB_EXIT_MASK) {
case TB_EXIT_REQUESTED: case TB_EXIT_REQUESTED:
/* Something asked us to stop executing /* Something asked us to stop executing
@ -302,12 +303,13 @@ static tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr)
TranslationBlock *tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); TranslationBlock *tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK);
if (cc->synchronize_from_tb) { if (cc->synchronize_from_tb) {
// avoid sync twice when helper_uc_tracecode() already did this. // avoid sync twice when helper_uc_tracecode() already did this.
if (env->uc->emu_counter <= env->uc->emu_count && !env->uc->stop_request) if (env->uc->emu_counter <= env->uc->emu_count &&
!env->uc->stop_request && !env->uc->quit_request)
cc->synchronize_from_tb(cpu, tb); cc->synchronize_from_tb(cpu, tb);
} else { } else {
assert(cc->set_pc); assert(cc->set_pc);
// avoid sync twice when helper_uc_tracecode() already did this. // avoid sync twice when helper_uc_tracecode() already did this.
if (env->uc->emu_counter <= env->uc->emu_count) if (env->uc->emu_counter <= env->uc->emu_count && !env->uc->quit_request)
cc->set_pc(cpu, tb->pc); cc->set_pc(cpu, tb->pc);
} }
} }

View file

@ -90,10 +90,12 @@ int arm_reg_write(struct uc_struct *uc, unsigned int regid, const void *value)
break; break;
//case UC_ARM_REG_PC: //case UC_ARM_REG_PC:
case UC_ARM_REG_R15: case UC_ARM_REG_R15:
ARM_CPU(uc, mycpu)->env.pc = *(uint32_t *)value;
ARM_CPU(uc, mycpu)->env.regs[15] = *(uint32_t *)value; ARM_CPU(uc, mycpu)->env.regs[15] = *(uint32_t *)value;
// force to quit execution and flush TB // force to quit execution and flush TB
uc->quit_request = true; uc->quit_request = true;
uc_emu_stop(uc); uc_emu_stop(uc);
break; break;
} }
} }