do not use syscall to quit emulation. this can fix issues #147 & #148

This commit is contained in:
Nguyen Anh Quynh
2015-09-26 16:49:00 +08:00
parent 79b81e6ae4
commit 886946dcf4
22 changed files with 57 additions and 29 deletions

View File

@ -4751,7 +4751,11 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
// end address tells us to stop emulation
if (s->pc == s->uc->addr_end) {
gen_interrupt(s, 0x99, pc_start - s->cs_base, pc_start - s->cs_base);
// imitate the HLT instruction
gen_update_cc_op(s);
gen_jmp_im(s, pc_start - s->cs_base);
gen_helper_hlt(tcg_ctx, cpu_env, tcg_const_i32(tcg_ctx, s->pc - pc_start));
s->is_jmp = DISAS_TB_JUMP;
return s->pc;
}
@ -8361,8 +8365,11 @@ static inline void gen_intermediate_code_internal(uint8_t *gen_opc_cc_op,
// early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
// imitate the HLT instruction
gen_tb_start(tcg_ctx);
gen_interrupt(dc, 0x99, tb->pc - tb->cs_base, tb->pc - tb->cs_base);
gen_jmp_im(dc, tb->pc - tb->cs_base);
gen_helper_hlt(tcg_ctx, tcg_ctx->cpu_env, tcg_const_i32(tcg_ctx, 0));
dc->is_jmp = DISAS_TB_JUMP;
goto done_generating;
}