target-i386: tcg: Handle clflushopt/clwb/pcommit instructions
The following changes since commit 4b59f39bc9a03afcc74b2fa28da7c3189fca507c:
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-11-06' into staging (2015-11-06 12:50:24 +0000)
are available in the git repository at:
git://github.com/ehabkost/qemu.git tags/x86-pull-request
for you to fetch changes up to 0c47242b519a224279f13c685aa6e79347f97b85:
target-i386: Add clflushopt/clwb/pcommit to TCG_7_0_EBX_FEATURES (2015-11-06 12:19:33 -0200)
----------------------------------------------------------------
target-i386: tcg: Handle clflushopt/clwb/pcommit instructions
A small update to TCG code so it can handle the new clflushopt/clwb/pcommit instructions.
----------------------------------------------------------------
Eduardo Habkost (2):
target-i386: tcg: Accept clwb instruction
target-i386: tcg: Check right CPUID bits for clflushopt/pcommit
Xiao Guangrong (1):
target-i386: Add clflushopt/clwb/pcommit to TCG_7_0_EBX_FEATURES
target-i386/cpu.c | 4 +++- target-i386/translate.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.0
[Qemu-devel] [PULL 1/3] target-i386: tcg: Accept clwb instruction
Accept the clwb instruction (66 0F AE /6) if its corresponding feature flag is enabled on CPUID[7].
--- target-i386/translate.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
target-i386/translate.c +12 -1
@@ -7716,10 +7716,21 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, }break ;case 5 :/* lfence */ -case 6 :/* mfence */ if ((modrm &0xc7 ) !=0xc0 || !(s->cpuid_features &CPUID_SSE2 )) goto illegal_op;break ; +case 6 :/* mfence/clwb */ +if (s->prefix &PREFIX_DATA ) { +/* clwb */ +if (!(s->cpuid_7_0_ebx_features &CPUID_7_0_EBX_CLWB )) + goto illegal_op; +gen_nop_modrm (env, s, modrm); + }else { +/* mfence */ +if ((modrm &0xc7 ) !=0xc0 || !(s->cpuid_features &CPUID_SSE2 )) + goto illegal_op; + } +break ;case 7 :/* sfence / clflush */ if ((modrm &0xc7 ) ==0xc0 ) {/* sfence */
Signature · 1 line
2.1.0
[Qemu-devel] [PULL 2/3] target-i386: tcg: Check right CPUID bits for clflushopt/pcommit
In reply to Eduardo HabkostDetect the clflushopt and pcommit instructions and check their corresponding feature flags, instead of checking CPUID_SSE and CPUID_CLFLUSH.
--- target-i386/translate.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
target-i386/translate.c +20 -8
@@ -7731,16 +7731,28 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, goto illegal_op; }break ; -case 7 :/* sfence / clflush */ +case 7 :/* sfence / clflush / clflushopt / pcommit */ if ((modrm &0xc7 ) ==0xc0 ) { -/* sfence */ -/* XXX: also check for cpuid_ext2_features & CPUID_EXT2_EMMX */ -if (!(s->cpuid_features &CPUID_SSE )) - goto illegal_op; +if (s->prefix &PREFIX_DATA ) { +/* pcommit */ +if (!(s->cpuid_7_0_ebx_features &CPUID_7_0_EBX_PCOMMIT )) + 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 { -/* clflush */ -if (!(s->cpuid_features &CPUID_CLFLUSH )) - goto illegal_op; +if (s->prefix &PREFIX_DATA ) { +/* clflushopt */ +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); }break ;
Signature · 1 line
2.1.0
[Qemu-devel] [PULL 3/3] target-i386: Add clflushopt/clwb/pcommit to TCG_7_0_EBX_FEATURES
In reply to Eduardo HabkostFrom: Xiao Guangrong <[email protected]>
Now these instructions are handled by TCG and can be added to the TCG_7_0_EBX_FEATURES macro.
--- target-i386/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target-i386/cpu.c +3 -1
@@ -345,7 +345,9 @@ static const char *cpuid_6_feature_name[] = {#define TCG_SVM_FEATURES 0#define TCG_KVM_FEATURES 0#define TCG_7_0_EBX_FEATURES (CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_SMAP | \ - CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX) + CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX | \ + CPUID_7_0_EBX_PCOMMIT | CPUID_7_0_EBX_CLFLUSHOPT | \ + CPUID_7_0_EBX_CLWB)/* missing: CPUID_7_0_EBX_FSGSBASE, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2, CPUID_7_0_EBX_ERMS, CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM,
Signature · 1 line
2.1.0
Peter Maydell
AppliedQuoted 12 lines · Eduardo Habkost
The following changes since commit
4b59f39bc9a03afcc74b2fa28da7c3189fca507c:Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-11-06' into staging (2015-11-06 12:50:24 +0000)
are available in the git repository at:
git://github.com/ehabkost/qemu.gittags/x86-pull-requestfor you to fetch changes up to
0c47242b519a224279f13c685aa6e79347f97b85:target-i386: Add clflushopt/clwb/pcommit to
TCG_7_0_EBX_FEATURES(2015-11-06 12:19:33 -0200)
Quoted 7 lines
----------------------------------------------------------------
target-i386: tcg: Handle clflushopt/clwb/pcommit instructionsA small update to TCG code so it can handle the new clflushopt/clwb/pcommit instructions.
----------------------------------------------------------------
Applied, thanks.
-- PMM