diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-05-09 09:52:30 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-06-17 09:47:39 +0200 |
commit | 556c4c5cc44c3454f78d796b6050c6d574a35dd2 (patch) | |
tree | bce81f254c66f0a919814cfe951ab2ef70b08003 | |
parent | ea89aa895e98fd8a1b9ebf7e3dc8bfcd863b9466 (diff) | |
download | qemu-556c4c5cc44c3454f78d796b6050c6d574a35dd2.zip qemu-556c4c5cc44c3454f78d796b6050c6d574a35dd2.tar.gz qemu-556c4c5cc44c3454f78d796b6050c6d574a35dd2.tar.bz2 |
target/i386: split X86_CHECK_prot into PE and VM86 checks
SYSENTER is allowed in VM86 mode, but not in real mode. Split the check
so that PE and !VM86 are covered by separate bits.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | target/i386/tcg/decode-new.c.inc | 9 | ||||
-rw-r--r-- | target/i386/tcg/decode-new.h | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc index b845a1b..d0384a6 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -2566,8 +2566,13 @@ static void disas_insn(DisasContext *s, CPUState *cpu) goto illegal_op; } } - if (decode.e.check & X86_CHECK_prot) { - if (!PE(s) || VM86(s)) { + if (decode.e.check & X86_CHECK_prot_or_vm86) { + if (!PE(s)) { + goto illegal_op; + } + } + if (decode.e.check & X86_CHECK_no_vm86) { + if (VM86(s)) { goto illegal_op; } } diff --git a/target/i386/tcg/decode-new.h b/target/i386/tcg/decode-new.h index bcac844..1af28ef 100644 --- a/target/i386/tcg/decode-new.h +++ b/target/i386/tcg/decode-new.h @@ -150,8 +150,8 @@ typedef enum X86InsnCheck { X86_CHECK_i64 = 1, X86_CHECK_o64 = 2, - /* Fault outside protected mode */ - X86_CHECK_prot = 4, + /* Fault in vm86 mode */ + X86_CHECK_no_vm86 = 4, /* Privileged instruction checks */ X86_CHECK_cpl0 = 8, @@ -167,6 +167,10 @@ typedef enum X86InsnCheck { /* Fault if VEX.W=0 */ X86_CHECK_W1 = 256, + + /* Fault outside protected mode, possibly including vm86 mode */ + X86_CHECK_prot_or_vm86 = 512, + X86_CHECK_prot = X86_CHECK_prot_or_vm86 | X86_CHECK_no_vm86, } X86InsnCheck; typedef enum X86InsnSpecial { |