diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-06-19 15:41:42 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-06-26 10:23:07 +0200 |
commit | fd5dcb1ccd660e47fb9f74043a16539631f53386 (patch) | |
tree | 3af85bcb9919b41498083ec13f68faeabad4ed41 /target/i386/tcg/translate.c | |
parent | 431c51e9d48faecbd2dd3ffc49b1636f280bfe8d (diff) | |
download | qemu-fd5dcb1ccd660e47fb9f74043a16539631f53386.zip qemu-fd5dcb1ccd660e47fb9f74043a16539631f53386.tar.gz qemu-fd5dcb1ccd660e47fb9f74043a16539631f53386.tar.bz2 |
target/i386: Intel only supports SYSCALL/SYSRET in long mode
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/tcg/translate.c')
-rw-r--r-- | target/i386/tcg/translate.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index b2e2dcc..ed4016f 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -5692,7 +5692,10 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) break; #ifdef TARGET_X86_64 case 0x105: /* syscall */ - /* XXX: is it usable in real mode ? */ + /* For Intel SYSCALL is only valid in long mode */ + if (!LMA(s) && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1) { + goto illegal_op; + } gen_update_cc_op(s); gen_update_eip_cur(s); gen_helper_syscall(cpu_env, cur_insn_len_i32(s)); @@ -5702,6 +5705,10 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) gen_eob_worker(s, false, true); break; case 0x107: /* sysret */ + /* For Intel SYSRET is only valid in long mode */ + if (!LMA(s) && env->cpuid_vendor1 == CPUID_VENDOR_INTEL_1) { + goto illegal_op; + } if (!PE(s)) { gen_exception_gpf(s); } else { |