From 90fc201f8d1e2f676aabb31a0bd8605e1529b243 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Wed, 2 Sep 2015 00:16:45 +0800 Subject: [PATCH] x86: enable bunch of instructions via CPUID. this fixes issue #91 --- qemu/target-i386/unicorn.c | 5 +++++ regress/pshufb.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/qemu/target-i386/unicorn.c b/qemu/target-i386/unicorn.c index c6350213..b0bd2f57 100644 --- a/qemu/target-i386/unicorn.c +++ b/qemu/target-i386/unicorn.c @@ -54,6 +54,11 @@ void x86_reg_reset(uch handle) CPUArchState *env; env = first_cpu->env_ptr; + env->features[FEAT_1_EDX] = CPUID_CX8 | CPUID_CMOV | CPUID_SSE2 | CPUID_FXSR | CPUID_SSE | CPUID_CLFLUSH; + env->features[FEAT_1_ECX] = CPUID_EXT_SSSE3 | CPUID_EXT_SSE41 | CPUID_EXT_SSE42 | CPUID_EXT_AES; + env->features[FEAT_8000_0001_EDX] = CPUID_EXT2_3DNOW | CPUID_EXT2_RDTSCP; + env->features[FEAT_8000_0001_ECX] = CPUID_EXT3_LAHF_LM | CPUID_EXT3_ABM | CPUID_EXT3_SKINIT | CPUID_EXT3_CR8LEG; + env->features[FEAT_7_0_EBX] = CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP; env->invalid_error = UC_ERR_OK; // no error memset(env->regs, 0, sizeof(env->regs)); diff --git a/regress/pshufb.py b/regress/pshufb.py index 0d01bf5e..432a2300 100755 --- a/regress/pshufb.py +++ b/regress/pshufb.py @@ -9,4 +9,4 @@ uc = Uc(UC_ARCH_X86, UC_MODE_64) uc.mem_map(0x2000, 0x1000) # pshufb xmm0, xmm1 uc.mem_write(0x2000, '660f3800c1'.decode('hex')) -uc.emu_start(0x2000, 0) +uc.emu_start(0x2000, 0x2005)