lkml.org 
[lkml]   [2020]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] x86: insn: Add insn_is_fpu()
On Thu, 9 Apr 2020 16:32:12 +0200
Peter Zijlstra <peterz@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@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@kernel.org>

\
 
 \ /
  Last update: 2020-04-10 02:48    [W:0.101 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site