x86: verify until address early when translating block in frontend. this should fix issue #63

This commit is contained in:
Nguyen Anh Quynh 2015-08-28 16:06:06 +08:00
parent adec227dad
commit 4a1c5ff071
2 changed files with 8 additions and 9 deletions

View File

@ -117,13 +117,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
(uc->arch == UC_ARCH_M68K && cpu->exception_index == 0x2f) /* M68K's EXCP_TRAP15 */
) {
cpu->halted = 1;
//cpu->exception_index = EXCP_HLT;
//no_shutdown = 0;
//printf(">>> calling shutdown-request...\n");
//printf(">>> ** current EIP = %x\n", X86_CPU(cpu)->env.eip);
//qemu_system_shutdown_request();
//pause_all_vcpus();
//cpu_loop_exit(cpu);
ret = EXCP_HLT;
break;
}

View File

@ -8254,7 +8254,7 @@ static inline void gen_intermediate_code_internal(uint8_t *gen_opc_cc_op,
uint64_t flags;
target_ulong pc_start;
target_ulong cs_base;
int num_insns;
int num_insns = 0;
int max_insns;
bool block_full = false;
@ -8339,12 +8339,18 @@ static inline void gen_intermediate_code_internal(uint8_t *gen_opc_cc_op,
// done with initializing TCG variables
env->uc->init_tcg = true;
// early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
gen_tb_start(tcg_ctx);
gen_interrupt(dc, 0x99, tb->pc - tb->cs_base, tb->pc - tb->cs_base);
goto done_generating;
}
gen_opc_end = tcg_ctx->gen_opc_buf + OPC_MAX_SIZE;
dc->is_jmp = DISAS_NEXT;
pc_ptr = pc_start;
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0)
max_insns = CF_COUNT_MASK;