From 1eabe2ffaa8aafa42bc3a957927ad1a498791803 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 9 Feb 2020 18:57:46 -0800 Subject: [PATCH] Fixes LM flag for CPUID extended feature mask (#1202) --- qemu/target-i386/unicorn.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu/target-i386/unicorn.c b/qemu/target-i386/unicorn.c index a72af6fb..242261fb 100644 --- a/qemu/target-i386/unicorn.c +++ b/qemu/target-i386/unicorn.c @@ -160,6 +160,10 @@ void x86_reg_reset(struct uc_struct *uc) env->hflags &= ~(HF_ADDSEG_MASK); env->efer |= MSR_EFER_LMA | MSR_EFER_LME; // extended mode activated cpu_x86_update_cr0(env, CR0_PE_MASK); // protected mode + /* If we are operating in 64bit mode then add the Long Mode flag + * to the CPUID feature flag + */ + env->features[FEAT_8000_0001_EDX] |= CPUID_EXT2_LM; break; } }