From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: kbusch@kernel.org, chang.seok.bae@intel.com
Subject: [PATCH 04/10] KVM: emulate: move op_prefix to struct x86_emulate_ctxt
Date: Thu, 13 Nov 2025 19:36:27 -0500 [thread overview]
Message-ID: <20251114003633.60689-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20251114003633.60689-1-pbonzini@redhat.com>
VEX decode will need to set it based on the "pp" bits, so make it
a field in the struct rather than a local variable.
No functional change intended.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/emulate.c | 8 ++++----
arch/x86/kvm/kvm_emulate.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 28f81346878e..7ef791407dbc 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4761,7 +4761,6 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int
int rc = X86EMUL_CONTINUE;
int mode = ctxt->mode;
int def_op_bytes, def_ad_bytes, goffset, simd_prefix;
- bool op_prefix = false;
bool has_seg_override = false;
struct opcode opcode;
u16 dummy;
@@ -4813,7 +4812,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int
for (;;) {
switch (ctxt->b = insn_fetch(u8, ctxt)) {
case 0x66: /* operand-size override */
- op_prefix = true;
+ ctxt->op_prefix = true;
/* switch between 2/4 bytes */
ctxt->op_bytes = def_op_bytes ^ 6;
break;
@@ -4920,9 +4919,9 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int
opcode = opcode.u.group[goffset];
break;
case Prefix:
- if (ctxt->rep_prefix && op_prefix)
+ if (ctxt->rep_prefix && ctxt->op_prefix)
return EMULATION_FAILED;
- simd_prefix = op_prefix ? 0x66 : ctxt->rep_prefix;
+ simd_prefix = ctxt->op_prefix ? 0x66 : ctxt->rep_prefix;
switch (simd_prefix) {
case 0x00: opcode = opcode.u.gprefix->pfx_no; break;
case 0x66: opcode = opcode.u.gprefix->pfx_66; break;
@@ -5140,6 +5139,7 @@ void init_decode_cache(struct x86_emulate_ctxt *ctxt)
ctxt->rip_relative = false;
ctxt->rex_prefix = 0;
ctxt->lock_prefix = 0;
+ ctxt->op_prefix = false;
ctxt->rep_prefix = 0;
ctxt->regs_valid = 0;
ctxt->regs_dirty = 0;
diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h
index 7b5ddb787a25..83af019620e3 100644
--- a/arch/x86/kvm/kvm_emulate.h
+++ b/arch/x86/kvm/kvm_emulate.h
@@ -348,6 +348,7 @@ struct x86_emulate_ctxt {
u8 opcode_len;
u8 b;
u8 intercept;
+ bool op_prefix;
u8 op_bytes;
u8 ad_bytes;
union {
--
2.43.5
next prev parent reply other threads:[~2025-11-14 0:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 0:36 [PATCH 00/10] KVM: emulate: enable AVX moves Paolo Bonzini
2025-11-14 0:36 ` [PATCH 01/10] KVM: emulate: add MOVNTDQA Paolo Bonzini
2025-11-14 0:36 ` [PATCH 02/10] KVM: emulate: move Src2Shift up one bit Paolo Bonzini
2025-11-17 19:51 ` Chang S. Bae
2025-11-14 0:36 ` [PATCH 03/10] KVM: emulate: improve formatting of flags table Paolo Bonzini
2025-11-17 19:53 ` Chang S. Bae
2025-11-14 0:36 ` Paolo Bonzini [this message]
2025-11-17 19:54 ` [PATCH 04/10] KVM: emulate: move op_prefix to struct x86_emulate_ctxt Chang S. Bae
2025-11-14 0:36 ` [PATCH 05/10] KVM: emulate: share common register decoding code Paolo Bonzini
2025-11-17 19:55 ` Chang S. Bae
2025-11-14 0:36 ` [PATCH 06/10] KVM: emulate: add get_xcr callback Paolo Bonzini
2025-11-17 19:56 ` Chang S. Bae
2025-11-14 0:36 ` [PATCH 07/10] KVM: emulate: add AVX support to register fetch and writeback Paolo Bonzini
2025-11-14 17:06 ` kernel test robot
2025-11-14 20:10 ` kernel test robot
2025-11-14 0:36 ` [PATCH 08/10] KVM: x86: Refactor REX prefix handling in instruction emulation Paolo Bonzini
2025-11-17 19:56 ` Chang S. Bae
2025-11-14 0:36 ` [PATCH 09/10] KVM: emulate: decode VEX prefix Paolo Bonzini
2025-11-14 0:36 ` [PATCH 10/10] KVM: emulate: enable AVX moves Paolo Bonzini
2025-11-14 0:51 ` [PATCH 00/10] " Keith Busch
2025-11-17 19:57 ` Chang S. Bae
2025-11-21 18:55 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251114003633.60689-5-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=chang.seok.bae@intel.com \
--cc=kbusch@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®