From bb375e4fa9d68bf2878048d77ef07db7e209f1b1 Mon Sep 17 00:00:00 2001 From: Spl3en Date: Fri, 25 Dec 2015 04:55:15 +0100 Subject: [PATCH] Reset correctly the register CR0 in protected mode by calling cpu_x86_update_cr0 instead of setting it manually. --- qemu/target-i386/unicorn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/target-i386/unicorn.c b/qemu/target-i386/unicorn.c index b7c62e30..2280d564 100644 --- a/qemu/target-i386/unicorn.c +++ b/qemu/target-i386/unicorn.c @@ -132,12 +132,12 @@ void x86_reg_reset(struct uc_struct *uc) break; case UC_MODE_32: env->hflags |= HF_CS32_MASK | HF_SS32_MASK | HF_OSFXSR_MASK; - env->cr[0] = CR0_PE_MASK; // protected mode + cpu_x86_update_cr0(env, CR0_PE_MASK); // protected mode break; case UC_MODE_64: env->hflags |= HF_CS32_MASK | HF_SS32_MASK | HF_CS64_MASK | HF_LMA_MASK | HF_OSFXSR_MASK; env->hflags &= ~(HF_ADDSEG_MASK); - env->cr[0] = CR0_PE_MASK; // protected mode + cpu_x86_update_cr0(env, CR0_PE_MASK); // protected mode break; } }