Only exit TB if pc is within the memory range

This commit is contained in:
2022-05-07 00:16:31 +02:00
parent 20c0a4b643
commit 345b63ee96
13 changed files with 83 additions and 5 deletions

View File

@@ -33,6 +33,15 @@ static void x86_set_pc(struct uc_struct *uc, uint64_t address)
((CPUX86State *)uc->cpu->env_ptr)->eip = address;
}
static uint64_t x86_get_pc(struct uc_struct *uc)
{
if (uc->mode == UC_MODE_16) {
return X86_CPU(uc->cpu)->env.segs[R_CS].selector * 16 + ((CPUX86State *)uc->cpu->env_ptr)->eip;
} else {
return ((CPUX86State *)uc->cpu->env_ptr)->eip;
}
}
static void x86_release(void *ctx)
{
int i;
@@ -1644,6 +1653,7 @@ void x86_uc_init(struct uc_struct *uc)
uc->reg_reset = x86_reg_reset;
uc->release = x86_release;
uc->set_pc = x86_set_pc;
uc->get_pc = x86_get_pc;
uc->stop_interrupt = x86_stop_interrupt;
uc->insn_hook_validate = x86_insn_hook_validate;
uc->opcode_hook_invalidate = x86_opcode_hook_invalidate;