x86: properly calculate EFLAGS when UC_HOOK_CODE is used. this should fix issue #246

This commit is contained in:
Nguyen Anh Quynh
2015-11-05 20:26:39 +08:00
parent 95745eff3b
commit 51323c9c17
4 changed files with 7 additions and 7 deletions

View File

@@ -70,6 +70,7 @@ void x86_reg_reset(struct uc_struct *uc)
env->eip = 0;
env->eflags = 0;
env->eflags0 = 0;
env->fpstt = 0; /* top of stack index */
env->fpus = 0;
@@ -580,6 +581,7 @@ int x86_reg_write(struct uc_struct *uc, unsigned int regid, const void *value)
break;
case UC_X86_REG_EFLAGS:
X86_CPU(uc, mycpu)->env.eflags = *(uint32_t *)value;
X86_CPU(uc, mycpu)->env.eflags0 = *(uint32_t *)value;
break;
case UC_X86_REG_EAX:
X86_CPU(uc, mycpu)->env.regs[R_EAX] = *(uint32_t *)value;
@@ -693,6 +695,7 @@ int x86_reg_write(struct uc_struct *uc, unsigned int regid, const void *value)
break;
case UC_X86_REG_EFLAGS:
X86_CPU(uc, mycpu)->env.eflags = *(uint64_t *)value;
X86_CPU(uc, mycpu)->env.eflags0 = *(uint64_t *)value;
break;
case UC_X86_REG_RAX:
X86_CPU(uc, mycpu)->env.regs[R_EAX] = *(uint64_t *)value;