[PATCH v2] x86: insn: Add insn_is_fpu()
Masami Hiramatsu
mhiramat at kernel.org
Fri Apr 10 00:47:26 UTC 2020
On Thu, 9 Apr 2020 16:32:12 +0200
Peter Zijlstra <peterz at infradead.org> wrote:
> On Thu, Apr 09, 2020 at 01:09:11AM +0900, Masami Hiramatsu wrote:
> > Add insn_is_fpu(insn) which tells that the insn is
> > whether touch the FPU/SSE/MMX register or the instruction
> > of FP coprocessor.
> >
> > Signed-off-by: Masami Hiramatsu <mhiramat at kernel.org>
> > ---
>
> Sadly, it turns out I need "FWAIT" too, which I tried adding like the
> below, but that comes apart most mighty :/
Thanks for pointing it out. Now I understand the FWAIT/WAIT is used
to wait for FPU...
>
> The trouble is that FWAIT doesn't take a MODRM, so the previous
> assumption that INAT_FPU implied INAT_MODRM needs to be broken, and I
> think that ripples through somewhere.
Oops, I missed it.
>
> (also, your patch adds some whitespace to convert_operands(), not sure
> that was intended)
Ah, that's my typo.
>
> --- a/arch/x86/lib/x86-opcode-map.txt
> +++ b/arch/x86/lib/x86-opcode-map.txt
> @@ -206,7 +206,7 @@ Table: one byte opcode
> 98: CBW/CWDE/CDQE
> 99: CWD/CDQ/CQO
> 9a: CALLF Ap (i64)
> -9b: FWAIT/WAIT
> +9b: FWAIT/WAIT {FPU}
> 9c: PUSHF/D/Q Fv (d64)
> 9d: POPF/D/Q Fv (d64)
> 9e: SAHF
> --- a/arch/x86/tools/gen-insn-attr-x86.awk
> +++ b/arch/x86/tools/gen-insn-attr-x86.awk
> @@ -331,9 +331,13 @@ function convert_operands(count,opnd,
> if (match(opcode, rex_expr))
> flags = add_flags(flags, "INAT_MAKE_PREFIX(INAT_PFX_REX)")
>
> + # check coprocessor escape
> + if (match(ext, "^ESC"))
> + flags = add_flags(flags, "INAT_MODRM")
> +
> # check FPU/MMX/SSE superscripts
> if (match(ext, fpu_expr))
> - flags = add_flags(flags, "INAT_MODRM | INAT_FPU")
> + flags = add_flags(flags, "INAT_FPU")
OK, I'll include this.
Thank you,
>
> # check VEX codes
> if (match(ext, evexonly_expr))
--
Masami Hiramatsu <mhiramat at kernel.org>
More information about the amd-gfx
mailing list