mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-25 17:55:28 +00:00
target-i386: tcg: Check right CPUID bits for clflushopt/pcommit
Detect the clflushopt and pcommit instructions and check their corresponding feature flags, instead of checking CPUID_SSE and CPUID_CLFLUSH. Backports commit 891bc821a3ee462b09b1ec436f2891f00ab1f85b from qemu
This commit is contained in:
parent
6d0dae872d
commit
4a70bfed55
1 changed files with 20 additions and 8 deletions
|
@ -8392,16 +8392,28 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
|
||||||
goto illegal_op;
|
goto illegal_op;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7: /* sfence / clflush */
|
case 7: /* sfence / clflush / clflushopt / pcommit */
|
||||||
if ((modrm & 0xc7) == 0xc0) {
|
if ((modrm & 0xc7) == 0xc0) {
|
||||||
/* sfence */
|
if (s->prefix & PREFIX_DATA) {
|
||||||
/* XXX: also check for cpuid_ext2_features & CPUID_EXT2_EMMX */
|
/* pcommit */
|
||||||
if (!(s->cpuid_features & CPUID_SSE))
|
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_PCOMMIT))
|
||||||
goto illegal_op;
|
goto illegal_op;
|
||||||
|
} else {
|
||||||
|
/* sfence */
|
||||||
|
/* XXX: also check for cpuid_ext2_features & CPUID_EXT2_EMMX */
|
||||||
|
if (!(s->cpuid_features & CPUID_SSE))
|
||||||
|
goto illegal_op;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* clflush */
|
if (s->prefix & PREFIX_DATA) {
|
||||||
if (!(s->cpuid_features & CPUID_CLFLUSH))
|
/* clflushopt */
|
||||||
goto illegal_op;
|
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_CLFLUSHOPT))
|
||||||
|
goto illegal_op;
|
||||||
|
} else {
|
||||||
|
/* clflush */
|
||||||
|
if (!(s->cpuid_features & CPUID_CLFLUSH))
|
||||||
|
goto illegal_op;
|
||||||
|
}
|
||||||
gen_lea_modrm(env, s, modrm);
|
gen_lea_modrm(env, s, modrm);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue