[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230330025550.GA2522@L-PF27918B-1352.localdomain>
Date: Thu, 30 Mar 2023 10:55:51 +0800
From: Wu Zongyong <wuzongyong@...ux.alibaba.com>
To: Tom Lendacky <thomas.lendacky@....com>
Cc: tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
x86@...nel.org, linux-kernel@...r.kernel.org, tony.luck@...el.com,
kirill.shutemov@...ux.intel.com, wutu.xq2@...ux.alibaba.com,
gerry@...ux.alibaba.com
Subject: Re: [RFC PATCH] x86/insn: support decode MOVSXD instruction for MMIO
On Wed, Mar 29, 2023 at 08:49:24AM -0500, Tom Lendacky wrote:
> On 3/28/23 21:59, Wu Zongyong wrote:
> > It seems MOVSXD which opcode is 0x63 is not handled, support
> > to decode it in insn_decode_mmio().
>
> Aren't there some caveats to worry about with this instruction based on the
> presence of the REX prefix 64-bit operand size bit? Sometimes it can be a
> sign extended and sometimes it can be a zero extended.
If I undertand right, the patch should like that?
diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
index 558a605929db..a1272f1be35d 100644
--- a/arch/x86/lib/insn-eval.c
+++ b/arch/x86/lib/insn-eval.c
@@ -1607,6 +1607,13 @@ enum insn_mmio_type insn_decode_mmio(struct insn *insn, int *bytes)
return INSN_MMIO_DECODE_FAILED;
switch (insn->opcode.bytes[0]) {
+ case 0x63:
+ *bytes = 4;
+ if (X86_REX_W(insn->rex_prefix.value))
+ type = INSN_MMIO_READ_SIGN_EXTEND;
+ else
+ type = INSN_MMIO_READ_ZERO_EXTEND;
+ break;
case 0x88: /* MOV m8,r8 */
*bytes = 1;
fallthrough;
>
> Thanks,
> Tom
>
> >
> > Signed-off-by: Wu Zongyong <wuzongyong@...ux.alibaba.com>
> > ---
> > arch/x86/lib/insn-eval.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
> > index 558a605929db..db6f93bad219 100644
> > --- a/arch/x86/lib/insn-eval.c
> > +++ b/arch/x86/lib/insn-eval.c
> > @@ -1607,6 +1607,10 @@ enum insn_mmio_type insn_decode_mmio(struct insn *insn, int *bytes)
> > return INSN_MMIO_DECODE_FAILED;
> > switch (insn->opcode.bytes[0]) {
> > + case 0x63: /* MOVSXD r64, m32 */
> > + *bytes = 4;
> > + type = INSN_MMIO_READ_SIGN_EXTEND;
> > + break;
> > case 0x88: /* MOV m8,r8 */
> > *bytes = 1;
> > fallthrough;
Powered by blists - more mailing lists