[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200409143212.GW20696@hirez.programming.kicks-ass.net>
Date: Thu, 9 Apr 2020 16:32:12 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Christian König <christian.koenig@....com>,
Jann Horn <jannh@...gle.com>,
Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>, amd-gfx@...ts.freedesktop.org,
Alex Deucher <alexander.deucher@....com>,
David Zhou <David1.Zhou@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
the arch/x86 maintainers <x86@...nel.org>,
kernel list <linux-kernel@...r.kernel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH v2] x86: insn: Add insn_is_fpu()
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@...nel.org>
> ---
Sadly, it turns out I need "FWAIT" too, which I tried adding like the
below, but that comes apart most mighty :/
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.
(also, your patch adds some whitespace to convert_operands(), not sure
that was intended)
--- 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")
# check VEX codes
if (match(ext, evexonly_expr))
Powered by blists - more mailing lists