Messages in this thread Patch in this message | | | Date | Thu, 9 Apr 2020 16:32:12 +0200 | From | Peter Zijlstra <> | 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@kernel.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))
| |