Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/insn: Fix opcode map (!REX2) superscript tags

Commit:

159039af8c07 ("x86/insn: x86/insn: Add support for REX2 prefix to the instruction decoder opcode map")

added (!REX2) superscript with a space, but the correct format requires ','
for concatination with other superscript tags.

Add ',' to generate correct insn attribute tables.

I confirmed with following command:

arch/x86/lib/x86-opcode-map.txt | grep e8 | head -n 1
[0xe8] = INAT_MAKE_IMM(INAT_IMM_VWORD32) | INAT_FORCE64 | INAT_NO_REX2,

Fixes: 159039af8c07 ("x86/insn: x86/insn: Add support for REX2 prefix to the instruction decoder opcode map")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/174580489027.388420.15539375184727726142.stgit@devnote2

authored by

Masami Hiramatsu (Google) and committed by
Ingo Molnar
ca698ec2 83725bdf

+50 -50
+25 -25
arch/x86/lib/x86-opcode-map.txt
··· 35 35 # - (!F3) : the last prefix is not 0xF3 (including non-last prefix case) 36 36 # - (66&F2): Both 0x66 and 0xF2 prefixes are specified. 37 37 # 38 - # REX2 Prefix 38 + # REX2 Prefix Superscripts 39 39 # - (!REX2): REX2 is not allowed 40 40 # - (REX2): REX2 variant e.g. JMPABS 41 41 ··· 286 286 # Note: "forced64" is Intel CPU behavior: they ignore 0x66 prefix 287 287 # in 64-bit mode. AMD CPUs accept 0x66 prefix, it causes RIP truncation 288 288 # to 16 bits. In 32-bit mode, 0x66 is accepted by both Intel and AMD. 289 - e0: LOOPNE/LOOPNZ Jb (f64) (!REX2) 290 - e1: LOOPE/LOOPZ Jb (f64) (!REX2) 291 - e2: LOOP Jb (f64) (!REX2) 292 - e3: JrCXZ Jb (f64) (!REX2) 289 + e0: LOOPNE/LOOPNZ Jb (f64),(!REX2) 290 + e1: LOOPE/LOOPZ Jb (f64),(!REX2) 291 + e2: LOOP Jb (f64),(!REX2) 292 + e3: JrCXZ Jb (f64),(!REX2) 293 293 e4: IN AL,Ib (!REX2) 294 294 e5: IN eAX,Ib (!REX2) 295 295 e6: OUT Ib,AL (!REX2) ··· 298 298 # in "near" jumps and calls is 16-bit. For CALL, 299 299 # push of return address is 16-bit wide, RSP is decremented by 2 300 300 # but is not truncated to 16 bits, unlike RIP. 301 - e8: CALL Jz (f64) (!REX2) 302 - e9: JMP-near Jz (f64) (!REX2) 303 - ea: JMP-far Ap (i64) (!REX2) 304 - eb: JMP-short Jb (f64) (!REX2) 301 + e8: CALL Jz (f64),(!REX2) 302 + e9: JMP-near Jz (f64),(!REX2) 303 + ea: JMP-far Ap (i64),(!REX2) 304 + eb: JMP-short Jb (f64),(!REX2) 305 305 ec: IN AL,DX (!REX2) 306 306 ed: IN eAX,DX (!REX2) 307 307 ee: OUT DX,AL (!REX2) ··· 478 478 7f: movq Qq,Pq | vmovdqa Wx,Vx (66) | vmovdqa32/64 Wx,Vx (66),(evo) | vmovdqu Wx,Vx (F3) | vmovdqu32/64 Wx,Vx (F3),(evo) | vmovdqu8/16 Wx,Vx (F2),(ev) 479 479 # 0x0f 0x80-0x8f 480 480 # Note: "forced64" is Intel CPU behavior (see comment about CALL insn). 481 - 80: JO Jz (f64) (!REX2) 482 - 81: JNO Jz (f64) (!REX2) 483 - 82: JB/JC/JNAE Jz (f64) (!REX2) 484 - 83: JAE/JNB/JNC Jz (f64) (!REX2) 485 - 84: JE/JZ Jz (f64) (!REX2) 486 - 85: JNE/JNZ Jz (f64) (!REX2) 487 - 86: JBE/JNA Jz (f64) (!REX2) 488 - 87: JA/JNBE Jz (f64) (!REX2) 489 - 88: JS Jz (f64) (!REX2) 490 - 89: JNS Jz (f64) (!REX2) 491 - 8a: JP/JPE Jz (f64) (!REX2) 492 - 8b: JNP/JPO Jz (f64) (!REX2) 493 - 8c: JL/JNGE Jz (f64) (!REX2) 494 - 8d: JNL/JGE Jz (f64) (!REX2) 495 - 8e: JLE/JNG Jz (f64) (!REX2) 496 - 8f: JNLE/JG Jz (f64) (!REX2) 481 + 80: JO Jz (f64),(!REX2) 482 + 81: JNO Jz (f64),(!REX2) 483 + 82: JB/JC/JNAE Jz (f64),(!REX2) 484 + 83: JAE/JNB/JNC Jz (f64),(!REX2) 485 + 84: JE/JZ Jz (f64),(!REX2) 486 + 85: JNE/JNZ Jz (f64),(!REX2) 487 + 86: JBE/JNA Jz (f64),(!REX2) 488 + 87: JA/JNBE Jz (f64),(!REX2) 489 + 88: JS Jz (f64),(!REX2) 490 + 89: JNS Jz (f64),(!REX2) 491 + 8a: JP/JPE Jz (f64),(!REX2) 492 + 8b: JNP/JPO Jz (f64),(!REX2) 493 + 8c: JL/JNGE Jz (f64),(!REX2) 494 + 8d: JNL/JGE Jz (f64),(!REX2) 495 + 8e: JLE/JNG Jz (f64),(!REX2) 496 + 8f: JNLE/JG Jz (f64),(!REX2) 497 497 # 0x0f 0x90-0x9f 498 498 90: SETO Eb | kmovw/q Vk,Wk | kmovb/d Vk,Wk (66) 499 499 91: SETNO Eb | kmovw/q Mv,Vk | kmovb/d Mv,Vk (66)
+25 -25
tools/arch/x86/lib/x86-opcode-map.txt
··· 35 35 # - (!F3) : the last prefix is not 0xF3 (including non-last prefix case) 36 36 # - (66&F2): Both 0x66 and 0xF2 prefixes are specified. 37 37 # 38 - # REX2 Prefix 38 + # REX2 Prefix Superscripts 39 39 # - (!REX2): REX2 is not allowed 40 40 # - (REX2): REX2 variant e.g. JMPABS 41 41 ··· 286 286 # Note: "forced64" is Intel CPU behavior: they ignore 0x66 prefix 287 287 # in 64-bit mode. AMD CPUs accept 0x66 prefix, it causes RIP truncation 288 288 # to 16 bits. In 32-bit mode, 0x66 is accepted by both Intel and AMD. 289 - e0: LOOPNE/LOOPNZ Jb (f64) (!REX2) 290 - e1: LOOPE/LOOPZ Jb (f64) (!REX2) 291 - e2: LOOP Jb (f64) (!REX2) 292 - e3: JrCXZ Jb (f64) (!REX2) 289 + e0: LOOPNE/LOOPNZ Jb (f64),(!REX2) 290 + e1: LOOPE/LOOPZ Jb (f64),(!REX2) 291 + e2: LOOP Jb (f64),(!REX2) 292 + e3: JrCXZ Jb (f64),(!REX2) 293 293 e4: IN AL,Ib (!REX2) 294 294 e5: IN eAX,Ib (!REX2) 295 295 e6: OUT Ib,AL (!REX2) ··· 298 298 # in "near" jumps and calls is 16-bit. For CALL, 299 299 # push of return address is 16-bit wide, RSP is decremented by 2 300 300 # but is not truncated to 16 bits, unlike RIP. 301 - e8: CALL Jz (f64) (!REX2) 302 - e9: JMP-near Jz (f64) (!REX2) 303 - ea: JMP-far Ap (i64) (!REX2) 304 - eb: JMP-short Jb (f64) (!REX2) 301 + e8: CALL Jz (f64),(!REX2) 302 + e9: JMP-near Jz (f64),(!REX2) 303 + ea: JMP-far Ap (i64),(!REX2) 304 + eb: JMP-short Jb (f64),(!REX2) 305 305 ec: IN AL,DX (!REX2) 306 306 ed: IN eAX,DX (!REX2) 307 307 ee: OUT DX,AL (!REX2) ··· 478 478 7f: movq Qq,Pq | vmovdqa Wx,Vx (66) | vmovdqa32/64 Wx,Vx (66),(evo) | vmovdqu Wx,Vx (F3) | vmovdqu32/64 Wx,Vx (F3),(evo) | vmovdqu8/16 Wx,Vx (F2),(ev) 479 479 # 0x0f 0x80-0x8f 480 480 # Note: "forced64" is Intel CPU behavior (see comment about CALL insn). 481 - 80: JO Jz (f64) (!REX2) 482 - 81: JNO Jz (f64) (!REX2) 483 - 82: JB/JC/JNAE Jz (f64) (!REX2) 484 - 83: JAE/JNB/JNC Jz (f64) (!REX2) 485 - 84: JE/JZ Jz (f64) (!REX2) 486 - 85: JNE/JNZ Jz (f64) (!REX2) 487 - 86: JBE/JNA Jz (f64) (!REX2) 488 - 87: JA/JNBE Jz (f64) (!REX2) 489 - 88: JS Jz (f64) (!REX2) 490 - 89: JNS Jz (f64) (!REX2) 491 - 8a: JP/JPE Jz (f64) (!REX2) 492 - 8b: JNP/JPO Jz (f64) (!REX2) 493 - 8c: JL/JNGE Jz (f64) (!REX2) 494 - 8d: JNL/JGE Jz (f64) (!REX2) 495 - 8e: JLE/JNG Jz (f64) (!REX2) 496 - 8f: JNLE/JG Jz (f64) (!REX2) 481 + 80: JO Jz (f64),(!REX2) 482 + 81: JNO Jz (f64),(!REX2) 483 + 82: JB/JC/JNAE Jz (f64),(!REX2) 484 + 83: JAE/JNB/JNC Jz (f64),(!REX2) 485 + 84: JE/JZ Jz (f64),(!REX2) 486 + 85: JNE/JNZ Jz (f64),(!REX2) 487 + 86: JBE/JNA Jz (f64),(!REX2) 488 + 87: JA/JNBE Jz (f64),(!REX2) 489 + 88: JS Jz (f64),(!REX2) 490 + 89: JNS Jz (f64),(!REX2) 491 + 8a: JP/JPE Jz (f64),(!REX2) 492 + 8b: JNP/JPO Jz (f64),(!REX2) 493 + 8c: JL/JNGE Jz (f64),(!REX2) 494 + 8d: JNL/JGE Jz (f64),(!REX2) 495 + 8e: JLE/JNG Jz (f64),(!REX2) 496 + 8f: JNLE/JG Jz (f64),(!REX2) 497 497 # 0x0f 0x90-0x9f 498 498 90: SETO Eb | kmovw/q Vk,Wk | kmovb/d Vk,Wk (66) 499 499 91: SETNO Eb | kmovw/q Mv,Vk | kmovb/d Mv,Vk (66)