x86: fix #968. also fix potential bug of not clearing high bytes when updateing EIP

This commit is contained in:
Nguyen Anh Quynh
2018-07-26 15:19:23 +08:00
parent 58e1f03f12
commit 4d0157eb4a
2 changed files with 11 additions and 4 deletions

11
uc.c
View File

@@ -548,9 +548,16 @@ uc_err uc_emu_start(uc_engine* uc, uint64_t begin, uint64_t until, uint64_t time
switch(uc->mode) {
default:
break;
case UC_MODE_16:
uc_reg_write(uc, UC_X86_REG_IP, &begin);
case UC_MODE_16: {
uint64_t ip;
uint16_t cs;
uc_reg_read(uc, UC_X86_REG_CS, &cs);
// compensate for later adding up IP & CS
ip = begin - cs*16;
uc_reg_write(uc, UC_X86_REG_IP, &ip);
break;
}
case UC_MODE_32:
uc_reg_write(uc, UC_X86_REG_EIP, &begin);
break;