diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-06-21 00:43:22 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-06-26 10:23:02 +0200 |
commit | f9e0dbae7844738f2b7d8bdead7be506a8c7646d (patch) | |
tree | 90a70f40f1866294ca1fed51a5b8b4a9c3118d73 /target/i386 | |
parent | 691925e5a3215caa6096f56070734b95054f800b (diff) |
target/i386: do not accept RDSEED if CPUID bit absent
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386')
-rw-r--r-- | target/i386/tcg/translate.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 0de068d4b7..4ef45bbd71 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -3925,12 +3925,20 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) break; case 7: /* RDSEED */ + if (mod != 3 || + (s->prefix & (PREFIX_LOCK | PREFIX_REPZ | PREFIX_REPNZ)) || + !(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_RDSEED)) { + goto illegal_op; + } + goto do_rdrand; + case 6: /* RDRAND */ if (mod != 3 || (s->prefix & (PREFIX_LOCK | PREFIX_REPZ | PREFIX_REPNZ)) || !(s->cpuid_ext_features & CPUID_EXT_RDRAND)) { goto illegal_op; } + do_rdrand: translator_io_start(&s->base); gen_helper_rdrand(s->T0, cpu_env); rm = (modrm & 7) | REX_B(s); |